line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
67
|
|
2
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
93
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Net::Amazon::Route53::ResourceRecordSet; |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$Net::Amazon::Route53::ResourceRecordSet::VERSION = '0.123250'; |
7
|
|
|
|
|
|
|
} |
8
|
2
|
|
|
2
|
|
8
|
use Mouse; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
9
|
2
|
|
|
2
|
|
561
|
use XML::Bare; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
98
|
|
10
|
2
|
|
|
2
|
|
11
|
use HTML::Entities; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1514
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head2 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $resource = Net::Amazon::Route53::ResourceRecordSet->new(...); |
15
|
|
|
|
|
|
|
# use methods on $resource |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head2 ATTRIBUTES |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head3 route53 |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
A L object, needed and used to perform requests |
26
|
|
|
|
|
|
|
to Amazon's Route 53 service |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head3 hostedzone |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
The L object this hosted zone refers to |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has 'route53' => (is => 'rw', isa => 'Net::Amazon::Route53', required => 1,); |
35
|
|
|
|
|
|
|
has 'hostedzone' => |
36
|
|
|
|
|
|
|
(is => 'rw', isa => 'Net::Amazon::Route53::HostedZone', required => 1); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head3 name |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
The name for this resource record |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head3 ttl |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
The TTL associated with this resource record |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head3 type |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
The type of this resource record (C, C, C, etc) |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head3 values |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
The values associated with this resource record. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has 'name' => (is => 'rw', isa => 'Str', required => 1); |
57
|
|
|
|
|
|
|
has 'ttl' => (is => 'rw', isa => 'Int', required => 1); |
58
|
|
|
|
|
|
|
has 'type' => (is => 'rw', isa => 'Str', required => 1); |
59
|
|
|
|
|
|
|
has 'values' => |
60
|
|
|
|
|
|
|
(is => 'rw', isa => 'ArrayRef', required => 1, default => sub {[]}); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 METHODS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head3 create |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $record = Net::Amazon::Route53::ResourceRecordSet->new( ... ); |
69
|
|
|
|
|
|
|
$record->create; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Creates a new record. Needs all the attributes (name, ttl, type and values). |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Takes an optional boolean parameter, C, to indicate whether the request should |
74
|
|
|
|
|
|
|
return straightaway (default, or when C is C<0>) or it should wait until the |
75
|
|
|
|
|
|
|
request is C according to the Change's status. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns a L object representing the change requested. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub create { |
82
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
83
|
0
|
|
|
|
|
|
my $wait = shift; |
84
|
0
|
0
|
|
|
|
|
$wait = 0 if !defined $wait; |
85
|
0
|
0
|
|
|
|
|
$self->name =~ /\.$/ |
86
|
|
|
|
|
|
|
or die "Zone name needs to end in a dot, to be created\n"; |
87
|
0
|
|
|
|
|
|
my $request_xml_str = <<'ENDXML'; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This change batch creates the %s record for %s |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
CREATE |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
%s |
97
|
|
|
|
|
|
|
%s |
98
|
|
|
|
|
|
|
%s |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
%s |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
ENDXML |
108
|
0
|
|
|
|
|
|
my $request_xml = sprintf( |
109
|
|
|
|
|
|
|
$request_xml_str, |
110
|
0
|
|
|
|
|
|
map {$_} $self->type, |
111
|
|
|
|
|
|
|
$self->name, |
112
|
|
|
|
|
|
|
$self->name, |
113
|
|
|
|
|
|
|
$self->type, |
114
|
|
|
|
|
|
|
$self->ttl, |
115
|
|
|
|
|
|
|
join("\n", |
116
|
0
|
|
|
|
|
|
map {"$_"} |
117
|
0
|
|
|
|
|
|
@{ $self->values })); |
118
|
0
|
|
|
|
|
|
my $resp = $self->route53->request( |
119
|
|
|
|
|
|
|
'post', |
120
|
|
|
|
|
|
|
'https://route53.amazonaws.com/2010-10-01/' |
121
|
|
|
|
|
|
|
. $self->hostedzone->id |
122
|
|
|
|
|
|
|
. '/rrset', |
123
|
|
|
|
|
|
|
Content => $request_xml |
124
|
|
|
|
|
|
|
); |
125
|
0
|
|
|
|
|
|
my $change = Net::Amazon::Route53::Change->new( |
126
|
|
|
|
|
|
|
route53 => $self->route53, |
127
|
|
|
|
|
|
|
( |
128
|
0
|
|
|
|
|
|
map {lc($_) => decode_entities($resp->{ChangeInfo}{$_})} |
129
|
|
|
|
|
|
|
qw/Id Status SubmittedAt/ |
130
|
|
|
|
|
|
|
), |
131
|
|
|
|
|
|
|
); |
132
|
0
|
|
|
|
|
|
$change->refresh(); |
133
|
0
|
0
|
|
|
|
|
return $change if !$wait; |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
while (lc($change->status) ne 'insync') { |
136
|
0
|
|
|
|
|
|
sleep 2; |
137
|
0
|
|
|
|
|
|
$change->refresh(); |
138
|
|
|
|
|
|
|
} |
139
|
0
|
|
|
|
|
|
return $change; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head3 delete |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
$rrs->delete(); |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Asks Route 53 to delete the associated record. This should be used only when |
147
|
|
|
|
|
|
|
you want to delete the resource, not when changing a resource. In that case, |
148
|
|
|
|
|
|
|
use the C method instead, which takes care of creating a unique change |
149
|
|
|
|
|
|
|
in which the record is first deleted with the current details and then created |
150
|
|
|
|
|
|
|
with the new details. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Takes an optional boolean parameter, C, to indicate whether the request should |
153
|
|
|
|
|
|
|
return straightaway (default, or when C is C<0>) or it should wait until the |
154
|
|
|
|
|
|
|
request is C according to the Change's status. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Returns a L object representing the change requested. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub delete { |
161
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
162
|
0
|
|
|
|
|
|
my $wait = shift; |
163
|
0
|
0
|
|
|
|
|
$wait = 0 if !defined $wait; |
164
|
0
|
|
|
|
|
|
my $request_xml_str = <<'ENDXML'; |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
This change batch deletes the %s record for %s |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
DELETE |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
%s |
174
|
|
|
|
|
|
|
%s |
175
|
|
|
|
|
|
|
%s |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
%s |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
ENDXML |
185
|
0
|
|
|
|
|
|
my $request_xml = sprintf( |
186
|
|
|
|
|
|
|
$request_xml_str, |
187
|
|
|
|
|
|
|
( |
188
|
0
|
|
|
|
|
|
map {$_} ( |
189
|
|
|
|
|
|
|
$self->type, $self->name, $self->name, $self->type, $self->ttl |
190
|
|
|
|
|
|
|
) |
191
|
|
|
|
|
|
|
), |
192
|
|
|
|
|
|
|
join("\n", |
193
|
0
|
|
|
|
|
|
map {"" . $_ . ""} |
194
|
0
|
|
|
|
|
|
@{ $self->values })); |
195
|
0
|
|
|
|
|
|
my $resp = $self->route53->request( |
196
|
|
|
|
|
|
|
'post', |
197
|
|
|
|
|
|
|
'https://route53.amazonaws.com/2010-10-01/' |
198
|
|
|
|
|
|
|
. $self->hostedzone->id |
199
|
|
|
|
|
|
|
. '/rrset', |
200
|
|
|
|
|
|
|
Content => $request_xml |
201
|
|
|
|
|
|
|
); |
202
|
0
|
|
|
|
|
|
my $change = Net::Amazon::Route53::Change->new( |
203
|
|
|
|
|
|
|
route53 => $self->route53, |
204
|
|
|
|
|
|
|
( |
205
|
0
|
|
|
|
|
|
map {lc($_) => decode_entities($resp->{ChangeInfo}{$_})} |
206
|
|
|
|
|
|
|
qw/Id Status SubmittedAt/ |
207
|
|
|
|
|
|
|
), |
208
|
|
|
|
|
|
|
); |
209
|
0
|
|
|
|
|
|
$change->refresh(); |
210
|
0
|
0
|
|
|
|
|
return $change if !$wait; |
211
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
while (lc($change->status) ne 'insync') { |
213
|
0
|
|
|
|
|
|
sleep 2; |
214
|
0
|
|
|
|
|
|
$change->refresh(); |
215
|
|
|
|
|
|
|
} |
216
|
0
|
|
|
|
|
|
return $change; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
|
219
|
2
|
|
|
2
|
|
12
|
no Mouse; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head1 AUTHOR |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Marco FONTANI |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Marco FONTANI. |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
230
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=cut |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
1; |