blib/lib/VM/EC2/DB/SecurityGroup.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 55 CC 5 SCAR 18.4
CC
5
Cov
0%
EC2SecurityGroups
12.0
IPRanges
12.0
valid_fields
2.0
CRAP 6.3
1 package VM::EC2::DB::SecurityGroup;
2  
3 =head1 NAME
4  
5 VM::EC2::DB::SecurityGroup - An RDS Database Security Group
6  
7 =head1 SYNOPSIS
8  
9 $ec2 = VM::EC2->new(...);
10 @sg = $ec2->describe_db_security_groups;
11 foreach $group (@sg) {
12 print $_,"\n" foreach $group->IPRanges;
13 print $_->group_name,"\n" foreach $group->EC2SecurityGroups;
14 }
15  
16 =head1 METHODS
17  
18 DBSecurityGroupDescription -- The description of the DB security group
19  
20 DBSecurityGroupName -- The name of the DB security group
21  
22 EC2SecurityGroups -- EC2 security groups enabled in the DB group
23  
24 IPRanges -- IP Ranges enabled in the DB group
25  
26 OwnerId -- The Owner ID of the DB security group
27  
28 VpcId -- The VPC ID of the DB security group
29  
30 ec2_security_groups -- Alias for EC2SecurityGroups
31  
32 ip_ranges -- Alias for IPRanges
33  
34 =head1 DESCRIPTION
35  
36 This object represents a DB Security Group. It is the resultant
37 output of the VM::EC2->describe_db_security_groups(),
38 VM::EC2->authorize_db_security_group_ingress(),
39 VM::EC2->create_db_security_group(),
40 and VM::EC2->revoke_db_security_group_ingress() calls.
41  
42 =head1 STRING OVERLOADING
43  
44 When used in a string context, this object outputs the DB Security Group Name.
45  
46 =head1 SEE ALSO
47  
48 L<VM::EC2>
49 L<VM::EC2::Generic>
50 L<VM::EC2::DB::Instance>
51  
52 =head1 AUTHOR
53  
54 Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>.
55  
56 Copyright (c) 2013 Loyalty Methods, Inc.
57  
58 This package and its accompanying libraries is free software; you can
59 redistribute it and/or modify it under the terms of the GPL (either
60 version 1, or at your option, any later version) or the Artistic
61 License 2.0. Refer to LICENSE for the full license text. In addition,
62 please see DISCLAIMER.txt for disclaimers of warranty.
63  
64 =cut
65  
66 use strict;
67 use base 'VM::EC2::Generic';
68 use VM::EC2::DB::EC2SecurityGroup;
69 use VM::EC2::DB::IPRange;
70  
71 use overload '""' => sub { shift->DBSecurityGroupName },
72 fallback => 1;
73  
74 sub valid_fields {
75 my $self = shift;
76 return qw(DBSecurityGroupDescription DBSecurityGroupName EC2SecurityGroups IPRanges OwnerId VpcId);
77 }
78  
79 sub EC2SecurityGroups {
80 my $self = shift;
81 my $groups = $self->SUPER::EC2SecurityGroups;
82 return unless $groups;
83 $groups = $groups->{EC2SecurityGroup};
84 return ref $groups eq 'HASH' ?
85 (VM::EC2::DB::EC2SecurityGroup->new($groups,$self->aws)) :
86 map { VM::EC2::DB::EC2SecurityGroup->new($_,$self->aws) } @$groups;
87 }
88  
89 sub IPRanges {
90 my $self = shift;
91 my $ranges = $self->SUPER::IPRanges;
92 return unless $ranges;
93 $ranges = $ranges->{IPRange};
94 return ref $ranges eq 'HASH' ?
95 (VM::EC2::DB::IPRange->new($ranges,$self->aws)) :
96 map { VM::EC2::DB::IPRange->new($_,$self->aws) } @$ranges;
97 }
98  
99 sub ec2_security_groups { shift->EC2SecurityGroups }
100  
101 sub ip_ranges { shift->IPRanges }
102  
103 1;