blib/lib/VM/EC2/DB/Event/Subscription.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 44 CC 5 SCAR 20.1
CC
5
Cov
0%
EventCategoriesList
12.0
SourceIdsList
12.0
valid_fields
2.0
CRAP 7.5
1 package VM::EC2::DB::Event::Subscription;
2  
3 =head1 NAME
4  
5 VM::EC2::DB::Event::Subscription - An RDS Database Event Subscription
6  
7 =head1 SYNOPSIS
8  
9 use VM::EC2;
10  
11 $ec2 = VM::EC2->new(...);
12 @subs = $ec2->describe_event_subscriptions;
13 @db_subs = grep { $_->SourceType eq 'db-instance' } @subs;
14 @enabled = grep { $_->Enabled } @subs;
15  
16 =head1 DESCRIPTION
17  
18 This object represents an RDS Event Subscription. It is the resultant
19 output of a VM::EC2->describe_event_subscriptions() and
20 VM::EC2->create_event_subscription() call.
21  
22 =head1 STRING OVERLOADING
23  
24 When used in a string context, this object will output the
25 CustSubscriptionId.
26  
27 =head1 SEE ALSO
28  
29 L<VM::EC2>
30 L<VM::EC2::Generic>
31 L<VM::EC2::DB::Instance>
32  
33 =head1 AUTHOR
34  
35 Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>.
36  
37 Copyright (c) 2013 Loyalty Methods, Inc.
38  
39 This package and its accompanying libraries is free software; you can
40 redistribute it and/or modify it under the terms of the GPL (either
41 version 1, or at your option, any later version) or the Artistic
42 License 2.0. Refer to LICENSE for the full license text. In addition,
43 please see DISCLAIMER.txt for disclaimers of warranty.
44  
45 =cut
46  
47 use strict;
48 use base 'VM::EC2::Generic';
49  
50 use overload '""' => sub { shift->CustSubscriptionId },
51 fallback => 1;
52  
53 sub valid_fields {
54 my $self = shift;
55 return qw(
56 CustSubscriptionId
57 CustomerAwsId
58 Enabled
59 EventCategoriesList
60 SnsTopicArn
61 SourceIdsList
62 SourceType
63 Status
64 SubscriptionCreationTime
65 );
66 }
67  
68 sub Enabled {
69 my $self = shift;
70 my $enabled = $self->SUPER::Enabled;
71 return $enabled eq 'true';
72 }
73  
74 sub EventCategoriesList {
75 my $self = shift;
76 my $cats = $self->SUPER::EventCategoriesList;
77 return unless $cats;
78 $cats = $cats->{EventCategory};
79 return ref $cats eq 'ARRAY' ? @$cats : ($cats);
80 }
81  
82 sub SourceIdsList {
83 my $self = shift;
84 my $ids = $self->SUPER::SourceIdsList;
85 return unless $ids;
86 $ids = $ids->{SourceId};
87 return ref $ids eq 'ARRAY' ? @$ids: ($ids);
88 }
89  
90 1;