File Coverage

blib/lib/Net/Amazon/Route53/Change.pm
Criterion Covered Total %
statement 18 24 75.0
branch 0 2 0.0
condition n/a
subroutine 6 7 85.7
pod 1 1 100.0
total 25 34 73.5


line stmt bran cond sub pod time code
1 2     2   14 use strict;
  2         6  
  2         57  
2 2     2   11 use warnings;
  2         3  
  2         92  
3              
4             package Net::Amazon::Route53::Change;
5             $Net::Amazon::Route53::Change::VERSION = '0.173450';
6 2     2   11 use Moo;
  2         4  
  2         11  
7 2     2   596 use Types::Standard qw(InstanceOf Str);
  2         3  
  2         10  
8 2     2   1465 use HTML::Entities;
  2         5  
  2         567  
9              
10             =head2 SYNOPSIS
11              
12             my $change = Net::Amazon::Route53::Change->new(...);
13             # use methods on $change
14              
15             =cut
16              
17             =head2 ATTRIBUTES
18              
19             =cut
20              
21             =head3 route53
22              
23             A L object, needed and used to perform requests
24             to Amazon's Route 53 service
25              
26             =cut
27              
28             has 'route53' => ( is => 'rw', isa => InstanceOf['Net::Amazon::Route53'], required => 1, weak_ref => 1 );
29              
30             =head3 id
31              
32             The change request's id
33              
34             =head3 status
35              
36             The change request's status; usually C or C.
37              
38             =head3 submittedat
39              
40             The date/time the change was submitted at, in the format:
41             C
42              
43             =head3 comment
44              
45             Any Comment given when the zone is created
46              
47             =cut
48              
49             has 'id' => ( is => 'rw', isa => Str, required => 1, default => '' );
50             has 'status' => ( is => 'rw', isa => Str, required => 1, default => '' );
51             has 'submittedat' => ( is => 'rw', isa => Str, required => 1, default => '' );
52              
53             =head2 METHODS
54              
55             =cut
56              
57             =head3 refresh
58              
59             Refresh the details of the change. When performed, the object's status is current.
60              
61             =cut
62              
63             sub refresh
64             {
65 0     0 1   my $self = shift;
66 0 0         die "Cannot refresh without an id\n" unless length $self->id;
67 0           my $resp = $self->route53->request( 'get', 'https://route53.amazonaws.com/2010-10-01/' . $self->id, );
68 0           for (qw/Id Status SubmittedAt/) {
69 0           my $method = lc $_;
70 0           $self->$method( decode_entities( $resp->{ChangeInfo}{$_} ) );
71             }
72             }
73              
74 2     2   35 no Moo;
  2         6  
  2         10  
75              
76             =head1 AUTHOR
77              
78             Marco FONTANI
79              
80             =head1 COPYRIGHT AND LICENSE
81              
82             This software is copyright (c) 2011 by Marco FONTANI.
83              
84             This is free software; you can redistribute it and/or modify it under
85             the same terms as the Perl 5 programming language system itself.
86              
87             =cut
88              
89             1;