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

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 32 CC 3 SCAR 17.5
CC
3
Cov
0%
EventCategories
12.0
valid_fields
2.0
as_string
2.0
CRAP 5.8
1 package VM::EC2::DB::Event;
2  
3 =head1 NAME
4  
5 VM::EC2::DB::Event - An RDS Database Event
6  
7 =head1 SYNOPSIS
8  
9 use VM::EC2;
10 $ec2 = VM::EC2->new(...);
11 my @events = $ec2->describe_events;
12 print $_,"\n" foreach grep { $_->SourceIdentifier eq 'mydbinstance' } @events;
13  
14 =head1 DESCRIPTION
15  
16 This object represents an event related to DB instances, DB security groups,
17 DB snapshots, and DB parameter groups that have happened in the past 14 days.
18  
19 =head1 STRING OVERLOADING
20  
21 In string context, this object returns a string with the date,
22 identifier of the source of the event, and the event message.
23  
24 =head1 SEE ALSO
25  
26 L<VM::EC2>
27 L<VM::EC2::Generic>
28 L<VM::EC2::DB::Instance>
29  
30 =head1 AUTHOR
31  
32 Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>.
33  
34 Copyright (c) 2013 Loyalty Methods, Inc.
35  
36 This package and its accompanying libraries is free software; you can
37 redistribute it and/or modify it under the terms of the GPL (either
38 version 1, or at your option, any later version) or the Artistic
39 License 2.0. Refer to LICENSE for the full license text. In addition,
40 please see DISCLAIMER.txt for disclaimers of warranty.
41  
42 =cut
43  
44 use strict;
45 use base 'VM::EC2::Generic';
46  
47 use overload '""' => sub { shift->as_string },
48 fallback => 1;
49  
50 sub valid_fields {
51 my $self = shift;
52 return qw(Date EventCategories Message SourceIdentifier SourceType);
53 }
54  
55 sub EventCategories {
56 my $self = shift;
57 my $cats = $self->SUPER::EventCategories;
58 return unless $cats;
59 $cats = $cats->{EventCategory};
60 return ref $cats eq 'ARRAY' ? @$cats : ($cats);
61 }
62  
63 sub as_string {
64 my $self = shift;
65 return $self->Date . '[ ' . $self->SourceIdentifier . ' ] ' . $self->Message;
66 }
67  
68 1;