line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Linode::DNS; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
678
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
87
|
|
7
|
1
|
|
|
1
|
|
5
|
use WebService::Linode::Base; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1178
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
WebService::Linode::DNS - Deprecated Perl Interface to the Linode.com API DNS methods. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.25'; |
16
|
|
|
|
|
|
|
our @ISA = ("WebService::Linode::Base"); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub getDomainIDbyName { |
19
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
20
|
0
|
|
|
|
|
|
my $self = shift; |
21
|
0
|
|
|
|
|
|
my $name = shift; |
22
|
0
|
|
|
|
|
|
$self->_debug(10, 'getDomainIDbyName called for: ' . $name); |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
if ($self->{_nocache}) { |
25
|
0
|
|
|
|
|
|
$self->_debug(10, 'Cache disabled calling domainList'); |
26
|
0
|
|
|
|
|
|
my $domains = $self->domainList(); |
27
|
0
|
|
|
|
|
|
foreach my $domain (@$domains) { |
28
|
0
|
0
|
|
|
|
|
return $domain->{domainid} if $domain->{domain} eq $name; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
0
|
0
|
|
|
|
|
$self->domainList unless exists($self->{_domains}{$name}); |
33
|
0
|
0
|
|
|
|
|
return $self->{_domains}{$name} if exists($self->{_domains}{$name}); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub domainList { |
40
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
41
|
0
|
|
|
|
|
|
my $self = shift; |
42
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainList called'); |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $data = $self->do_request( api_action => 'domain.list' ); |
45
|
0
|
0
|
|
|
|
|
if (defined($data)) { |
46
|
0
|
|
|
|
|
|
my @domains; |
47
|
0
|
|
|
|
|
|
for my $domain (@$data) { |
48
|
|
|
|
|
|
|
# lower case the keys (they come all caps) |
49
|
0
|
|
|
|
|
|
my $domain_data = $self->_lc_keys($domain); |
50
|
|
|
|
|
|
|
# store zone id in $self->{_domains}{[name]} |
51
|
0
|
0
|
|
|
|
|
$self->{_domains}{$domain_data->{domain}} = |
52
|
|
|
|
|
|
|
$domain_data->{domainid} unless $self->{_nocache}; |
53
|
0
|
|
|
|
|
|
push @domains, $domain_data; |
54
|
|
|
|
|
|
|
} |
55
|
0
|
|
|
|
|
|
return \@domains; |
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
|
|
|
return; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub domainGet { |
61
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
62
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
63
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainGet called'); |
64
|
0
|
|
|
|
|
|
my $domainid; |
65
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
if ($args{domain}) { |
67
|
0
|
|
|
|
|
|
$domainid = $self->getDomainIDbyName($args{domain}); |
68
|
0
|
0
|
|
|
|
|
$self->_error(-1, "$args{domain} not found") unless $domainid; |
69
|
0
|
0
|
|
|
|
|
return unless $domainid; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
0
|
|
|
|
|
|
$domainid = $args{domainid} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
unless (defined ($domainid)) { |
76
|
0
|
|
|
|
|
|
$self->_error(-1, 'Must pass domainid or domain to domainGet'); |
77
|
0
|
|
|
|
|
|
return; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my $data = $self->do_request( |
81
|
|
|
|
|
|
|
api_action => 'domain.list', domainid => $domainid |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return $self->_lc_keys(@$data); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub domainCreate { |
88
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
89
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
90
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainCreate called'); |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
my $data = $self->do_request( api_action => 'domain.create', %args); |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
return unless exists ($data->{DomainID}); |
95
|
0
|
|
|
|
|
|
return $data->{DomainID}; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub domainSave { |
99
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
100
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
101
|
0
|
|
|
|
|
|
carp "Deprecated use of domainSave, use domainCreate"; |
102
|
0
|
|
|
|
|
|
return $self->domainCreate(%args); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub domainUpdate { |
106
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
107
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
108
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainUpdate called'); |
109
|
|
|
|
|
|
|
|
110
|
0
|
0
|
|
|
|
|
if (!exists ($args{domainid})) { |
111
|
0
|
|
|
|
|
|
$self->_error(-1, "Must pass domainid to domainUpdate"); |
112
|
0
|
|
|
|
|
|
return; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
my %data = %{ $self->domainGet(domainid => $args{domainid}) }; |
|
0
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# overwrite changed items |
118
|
0
|
|
|
|
|
|
$data{$_} = $args{$_} for keys (%args); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
return $self->do_request( api_action => 'domain.update', %args); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub domainDelete { |
125
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
126
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
127
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainDelete called'); |
128
|
|
|
|
|
|
|
|
129
|
0
|
0
|
|
|
|
|
if (!exists ($args{domainid})) { |
130
|
0
|
|
|
|
|
|
$self->_error(-1, "Must pass domainid to domainDelete"); |
131
|
0
|
|
|
|
|
|
return; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
my $data = $self->do_request( api_action => 'domain.delete', %args); |
135
|
|
|
|
|
|
|
|
136
|
0
|
0
|
|
|
|
|
return unless exists ($data->{DomainID}); |
137
|
0
|
|
|
|
|
|
return $data->{DomainID}; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub domainResourceList { |
141
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
142
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
143
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainResourceList called'); |
144
|
0
|
|
|
|
|
|
my $domainid; |
145
|
|
|
|
|
|
|
|
146
|
0
|
0
|
|
|
|
|
if ($args{domain}) { |
147
|
0
|
|
|
|
|
|
$domainid = $self->getDomainIDbyName($args{domain}); |
148
|
0
|
0
|
|
|
|
|
$self->_error(-1, "$args{domain} not found") unless $domainid; |
149
|
0
|
0
|
|
|
|
|
return unless $domainid; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
else { |
152
|
0
|
|
|
|
|
|
$domainid = $args{domainid} |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
0
|
0
|
|
|
|
|
unless (defined ($domainid)) { |
156
|
0
|
|
|
|
|
|
$self->_error(-1, 'Must pass domainid or domain to domainResourceList'); |
157
|
0
|
|
|
|
|
|
return; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
my $data = $self->do_request( |
161
|
|
|
|
|
|
|
api_action => 'domain.resource.list', domainid => $domainid |
162
|
|
|
|
|
|
|
); |
163
|
|
|
|
|
|
|
|
164
|
0
|
0
|
|
|
|
|
if (defined($data)) { |
165
|
0
|
|
|
|
|
|
my @RRs; |
166
|
0
|
|
|
|
|
|
push @RRs, $self->_lc_keys($_) for (@$data); |
167
|
0
|
|
|
|
|
|
return \@RRs; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
return; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub domainResourceGet { |
174
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
175
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
176
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainResourceGet called'); |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
my $domainid; |
179
|
0
|
0
|
|
|
|
|
if ($args{domain}) { |
180
|
0
|
|
|
|
|
|
$domainid = $self->getDomainIDbyName($args{domain}); |
181
|
0
|
0
|
|
|
|
|
$self->_error(-1, "$args{domain} not found") unless $domainid; |
182
|
0
|
0
|
|
|
|
|
return unless $domainid; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
else { |
185
|
0
|
|
|
|
|
|
$domainid = $args{domainid} |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
0
|
0
|
0
|
|
|
|
unless ( exists( $args{resourceid} ) && exists( $args{domainid} ) ) { |
189
|
0
|
|
|
|
|
|
$self->_error(-1, |
190
|
|
|
|
|
|
|
'Must pass domain id or domain and resourceid to domainResourceGet'); |
191
|
0
|
|
|
|
|
|
return; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
0
|
|
|
|
|
|
my $data = $self->do_request( |
195
|
|
|
|
|
|
|
api_action => 'domain.resource.list', |
196
|
|
|
|
|
|
|
domainid => $domainid, |
197
|
|
|
|
|
|
|
resourceid => $args{resourceid}, |
198
|
|
|
|
|
|
|
); |
199
|
|
|
|
|
|
|
|
200
|
0
|
0
|
|
|
|
|
return unless defined ($data); |
201
|
|
|
|
|
|
|
|
202
|
0
|
|
|
|
|
|
return $self->_lc_keys($data); |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub getResourceIDbyName { |
206
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
207
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
208
|
0
|
|
|
|
|
|
$self->_debug(10, 'getResourceIDbyName called'); |
209
|
|
|
|
|
|
|
|
210
|
0
|
|
|
|
|
|
my $domainid = $args{domainid}; |
211
|
0
|
0
|
0
|
|
|
|
if (!exists ($args{domainid}) && exists($args{domain}) ) { |
212
|
0
|
|
|
|
|
|
$domainid = $self->getDomainIDbyName($args{domain}); |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
0
|
0
|
0
|
|
|
|
if (!(defined($domainid) && exists($args{name}))) { |
216
|
0
|
|
|
|
|
|
$self->_error(-1, |
217
|
|
|
|
|
|
|
'Must pass domain or domainid and (resource) name to getResourceIDbyName'); |
218
|
0
|
|
|
|
|
|
return; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
0
|
|
|
|
|
|
for my $rr ( @{ $self->domainResourceList(domainid => $domainid) } ) { |
|
0
|
|
|
|
|
|
|
222
|
0
|
0
|
|
|
|
|
return $rr->{resourceid} if $rr->{name} eq $args{name}; |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub domainResourceCreate { |
227
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
228
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
229
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainResourceCreate called'); |
230
|
|
|
|
|
|
|
|
231
|
0
|
|
|
|
|
|
my $data = $self->do_request( api_action => 'domain.resource.create', %args); |
232
|
|
|
|
|
|
|
|
233
|
0
|
0
|
|
|
|
|
return unless exists ($data->{ResourceID}); |
234
|
0
|
|
|
|
|
|
return $data->{ResourceID}; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub domainResourceSave { |
238
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
239
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
240
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainResourceCreate called'); |
241
|
|
|
|
|
|
|
|
242
|
0
|
|
|
|
|
|
carp "Depricated use of domainResourceSave, use domainResourceCreate"; |
243
|
|
|
|
|
|
|
|
244
|
0
|
|
|
|
|
|
return $self->domainResourceCreate(%args); |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
sub domainResourceUpdate { |
248
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
249
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
250
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainResourceUpdate called'); |
251
|
|
|
|
|
|
|
|
252
|
0
|
0
|
|
|
|
|
if (!exists ($args{resourceid})) { |
253
|
0
|
|
|
|
|
|
$self->_error(-1, "Must pass resourceid to domainResourceUpdate"); |
254
|
0
|
|
|
|
|
|
return; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
0
|
|
|
|
|
|
return $self->do_request( api_action => 'domain.resource.update', %args); |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
sub domainResourceDelete { |
261
|
0
|
|
|
0
|
0
|
|
carp "WebService::Linode::DNS is deprecated, use WebService::Linode instead!"; |
262
|
0
|
|
|
|
|
|
my ($self, %args) = @_; |
263
|
0
|
|
|
|
|
|
$self->_debug(10, 'domainResourceDelete called'); |
264
|
|
|
|
|
|
|
|
265
|
0
|
0
|
|
|
|
|
if (!exists ($args{resourceid})) { |
266
|
0
|
|
|
|
|
|
$self->_error(-1, "Must pass resourceid to domainResourceDelete"); |
267
|
0
|
|
|
|
|
|
return; |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
0
|
|
|
|
|
|
my $data = $self->do_request( api_action => 'domain.resource.delete', %args); |
271
|
|
|
|
|
|
|
|
272
|
0
|
0
|
|
|
|
|
return unless exists ($data->{ResourceID}); |
273
|
0
|
|
|
|
|
|
return $data->{ResourceID}; |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=head1 SYNOPSIS |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
THIS MODULE IS DEPRECATED, DON'T USE IT, USE L |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=head1 METHODS |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
If you are still reading, you are doing it wrong! Go here L |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=head1 AUTHOR |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
Michael Greb, C<< >> |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=head1 BUGS |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
This module does not yet support the Linode API batch method, patches welcome. |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Please report any bugs or feature requests to C
|
294
|
|
|
|
|
|
|
at rt.cpan.org>, or through the web interface at |
295
|
|
|
|
|
|
|
L. I will |
296
|
|
|
|
|
|
|
be notified, and then you'll automatically be notified of progress on your |
297
|
|
|
|
|
|
|
bug as I make changes. |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head1 SUPPORT |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
perldoc WebService::Linode::DNS |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
You can also look for information at: |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=over 4 |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=item * Module Repo |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
L |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
L |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
L |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=item * CPAN Ratings |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
L |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=item * Search CPAN |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
L |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=back |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
Copyright 2008-2014 Michael Greb, all rights reserved. |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
341
|
|
|
|
|
|
|
under the same terms as Perl itself. |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=cut |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
1; # End of WebService::Linode::DNS |