line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
77
|
|
2
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
89
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Net::Amazon::Route53::ResourceRecordSet::Change; |
5
|
|
|
|
|
|
|
$Net::Amazon::Route53::ResourceRecordSet::Change::VERSION = '0.173450'; |
6
|
2
|
|
|
2
|
|
10
|
use Moo; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
7
|
2
|
|
|
2
|
|
583
|
use Types::Standard 'ArrayRef'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
8
|
|
|
|
|
|
|
extends "Net::Amazon::Route53::ResourceRecordSet"; |
9
|
2
|
|
|
2
|
|
999
|
use HTML::Entities; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
650
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head2 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $record_change = Net::Amazon::Route53::ResourceRecordSet::Change->new( |
14
|
|
|
|
|
|
|
name => "example.com", |
15
|
|
|
|
|
|
|
ttl => 600, |
16
|
|
|
|
|
|
|
type => "A", |
17
|
|
|
|
|
|
|
values => [ "new_value1","new_value2", ], |
18
|
|
|
|
|
|
|
original_values => [ "old_value1", "old_value2", ], |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 ATTRIBUTES |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head3 original_values |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
The values associated with this resource record. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has 'original_values' => ( is => 'rw', isa => ArrayRef, required => 1, default => sub { [] } ); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head3 change |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This method changes the value of a record from original_value X to value Y. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $record = Net::Amazon::Route53::ResourceRecordSet::Change->new( |
44
|
|
|
|
|
|
|
name => "example.com", |
45
|
|
|
|
|
|
|
ttl => 600, |
46
|
|
|
|
|
|
|
type => "A", |
47
|
|
|
|
|
|
|
values => [ "new_value1","new_value2", ], |
48
|
|
|
|
|
|
|
original_values => [ "old_value1", "old_value2", ], |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
my $change = $record->change(1); # Set the 1 if you want to wait. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub change { |
55
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
56
|
0
|
|
|
|
|
|
my $wait = shift; |
57
|
0
|
0
|
|
|
|
|
$wait = 0 if !defined $wait; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $request_xml_str = <<'ENDXML'; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This change batch updates the %s record from original_values to values |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
DELETE |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
%s |
69
|
|
|
|
|
|
|
%s |
70
|
|
|
|
|
|
|
%s |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
%s |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
CREATE |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
%s |
80
|
|
|
|
|
|
|
%s |
81
|
|
|
|
|
|
|
%s |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
%s |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
ENDXML |
91
|
|
|
|
|
|
|
my $request_xml = sprintf( $request_xml_str, |
92
|
0
|
|
|
|
|
|
(map { $_ } ( $self->type, $self->name, $self->type, $self->ttl, ) ), |
93
|
0
|
|
|
|
|
|
join( "\n", map { "" . $_ . "" } @{ $self->original_values } ), |
|
0
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
(map { $_ } ( $self->name, $self->type, $self->ttl, ) ), |
95
|
0
|
|
|
|
|
|
join( "\n", map { "" . $_ . "" } @{ $self->values } ) ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $resp = $self->route53->request( |
98
|
|
|
|
|
|
|
'post', |
99
|
|
|
|
|
|
|
'https://route53.amazonaws.com/2010-10-01/' . $self->hostedzone->id . '/rrset', |
100
|
|
|
|
|
|
|
Content => $request_xml |
101
|
|
|
|
|
|
|
); |
102
|
|
|
|
|
|
|
my $change = Net::Amazon::Route53::Change->new( |
103
|
|
|
|
|
|
|
route53 => $self->route53, |
104
|
0
|
|
|
|
|
|
( map { lc($_) => decode_entities($resp->{ChangeInfo}{$_}) } qw/Id Status SubmittedAt/ ), |
|
0
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
); |
106
|
0
|
|
|
|
|
|
$change->refresh(); |
107
|
0
|
0
|
|
|
|
|
return $change if !$wait; |
108
|
0
|
|
|
|
|
|
while ( lc( $change->status ) ne 'insync' ) { |
109
|
0
|
|
|
|
|
|
sleep 2; |
110
|
0
|
|
|
|
|
|
$change->refresh(); |
111
|
|
|
|
|
|
|
} |
112
|
0
|
|
|
|
|
|
return $change; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
2
|
|
|
2
|
|
13
|
no Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Marco FONTANI |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Marco FONTANI. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
126
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |