| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Webservice::OVH::Domain::Zone; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Webservice::OVH::Domain::Zone |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Webservice::OVH; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $zone = $ovh->domain->zone("myzone.de"); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $a_record = $zone->new_record(field_type => 'A', target => '0.0.0.0', ttl => 1000 ); |
|
18
|
|
|
|
|
|
|
my $mx_record = $zone->new_record(field_type => 'MX', target => '1 my.mail.server.de.'); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $records = $zone->records(filed_type => 'A', sub_domain => 'www'); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
foreach my $record (@$records) { |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$record->change( target => '0.0.0.0' ); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$zone->refresh; |
|
28
|
|
|
|
|
|
|
$zone->reset; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$zone->change_contact(contact_billing => 'account-ovh', contact_tech => 'account-ovh', contact_admin => 'account-ovh'); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Provieds basic functionality for Zones. Records can be created and fetched. |
|
35
|
|
|
|
|
|
|
Records can be fetched through a filter. |
|
36
|
|
|
|
|
|
|
A zone contact_change can be initialized. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
|
41
|
|
|
|
|
|
|
|
|
42
|
36
|
|
|
36
|
|
295
|
use strict; |
|
|
36
|
|
|
|
|
114
|
|
|
|
36
|
|
|
|
|
1118
|
|
|
43
|
36
|
|
|
36
|
|
211
|
use warnings; |
|
|
36
|
|
|
|
|
102
|
|
|
|
36
|
|
|
|
|
1091
|
|
|
44
|
36
|
|
|
36
|
|
247
|
use Carp qw{ carp croak }; |
|
|
36
|
|
|
|
|
91
|
|
|
|
36
|
|
|
|
|
2505
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
our $VERSION = 0.48; |
|
47
|
|
|
|
|
|
|
|
|
48
|
36
|
|
|
36
|
|
311
|
use Webservice::OVH::Helper; |
|
|
36
|
|
|
|
|
102
|
|
|
|
36
|
|
|
|
|
995
|
|
|
49
|
36
|
|
|
36
|
|
17492
|
use Webservice::OVH::Domain::Zone::Record; |
|
|
36
|
|
|
|
|
114
|
|
|
|
36
|
|
|
|
|
47965
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 _new |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Internal Method to create the zone object. |
|
54
|
|
|
|
|
|
|
This method is not ment to be called external. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Domain::Zone> |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Domain::Zone->_new($ovh_api_wrapper, $zone_name, $module); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _new { |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
0
|
|
|
my ( $class, %params ) = @_; |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
die "Missing module" unless $params{module}; |
|
73
|
0
|
0
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
|
74
|
0
|
0
|
|
|
|
|
die "Missing id" unless $params{id}; |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
my $module = $params{module}; |
|
77
|
0
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
|
78
|
0
|
|
|
|
|
|
my $zone_name = $params{id}; |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
croak "Missing zone_name" unless $zone_name; |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $self = bless { _module => $module, _api_wrapper => $api_wrapper, _name => $zone_name, _service_info => undef, _properties => undef, _records => {} }, $class; |
|
83
|
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return $self; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 service_infos |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Retrieves additional infos about the zone. |
|
90
|
|
|
|
|
|
|
Infos that are not part of the properties |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=over |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * Return: HASH |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * Synopsis: my $info = $zone->service_info; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub service_infos { |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
105
|
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
107
|
0
|
|
|
|
|
|
my $zone_name = $self->name; |
|
108
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/domain/zone/$zone_name/serviceInfos", noSignature => 0 ); |
|
109
|
|
|
|
|
|
|
|
|
110
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
$self->{_service_info} = $response->content; |
|
113
|
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
return $self->{_service_info}; |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 properties |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Retrieves properties of the zone. |
|
120
|
|
|
|
|
|
|
This method updates the intern property variable. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=over |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * Return: HASH |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * Synopsis: my $properties = $zone->properties; |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=back |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub properties { |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
137
|
0
|
|
|
|
|
|
my $zone_name = $self->name; |
|
138
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/domain/zone/$zone_name", noSignature => 0 ); |
|
139
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
140
|
|
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
|
$self->{_properties} = $response->content; |
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
return $self->{_properties}; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 dnssec_supported |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Exposed Property Value. Readonly. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=over |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * Return: VALUE |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item * Synopsis: my $value = $zone->dnssec_supported; |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=back |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub dnssec_supported { |
|
161
|
|
|
|
|
|
|
|
|
162
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
163
|
|
|
|
|
|
|
|
|
164
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
|
165
|
|
|
|
|
|
|
|
|
166
|
0
|
0
|
|
|
|
|
return $self->{_properties}->{dnssecSupported} ? 1 : 0; |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head2 has_dns_anycast |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Exposed Property Value. Readonly. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=over |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * Return: VALUE |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * Synopsis: my $value = $zone->has_dns_anycast; |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=back |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub has_dns_anycast { |
|
184
|
|
|
|
|
|
|
|
|
185
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
186
|
|
|
|
|
|
|
|
|
187
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
|
188
|
|
|
|
|
|
|
|
|
189
|
0
|
0
|
|
|
|
|
return $self->{_properties}->{hasDnsAnycast} ? 1 : 0; |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 last_update |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Exposed Property Value. Readonly. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=over |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item * Return: DateTime |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item * Synopsis: my $value = $zone->last_update; |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=back |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=cut |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub last_update { |
|
207
|
|
|
|
|
|
|
|
|
208
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
209
|
|
|
|
|
|
|
|
|
210
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
|
211
|
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
my $str_datetime = $self->{_properties}->{lastUpdate}; |
|
213
|
0
|
|
|
|
|
|
my $datetime = Webservice::OVH::Helper->parse_datetime($str_datetime); |
|
214
|
0
|
|
|
|
|
|
return $datetime; |
|
215
|
|
|
|
|
|
|
} |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head2 name_servers |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Exposed Property Value. Readonly. |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=over |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=item * Synopsis: my $value = $zone->name_servers; |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=back |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=cut |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub name_servers { |
|
232
|
|
|
|
|
|
|
|
|
233
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
234
|
|
|
|
|
|
|
|
|
235
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
|
236
|
|
|
|
|
|
|
|
|
237
|
0
|
|
|
|
|
|
return $self->{_properties}->{nameServers}; |
|
238
|
|
|
|
|
|
|
} |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head2 records |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Produces an Array of record Objects. |
|
243
|
|
|
|
|
|
|
Can be filtered by field_type and sub_domain. |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=over |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item * Parameter: %filter - (optional) - field_type => record type sub_domain => subdomain string |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=item * Synopsis: my $records = $zone->records(field_type => 'A', sub_domain => 'www'); |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=back |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=cut |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
sub records { |
|
258
|
|
|
|
|
|
|
|
|
259
|
0
|
|
|
0
|
1
|
|
my ( $self, %filter ) = @_; |
|
260
|
|
|
|
|
|
|
|
|
261
|
0
|
0
|
0
|
|
|
|
my $filter_type = ( exists $filter{field_type} && !$filter{field_type} ) ? "_empty_" : $filter{field_type}; |
|
262
|
0
|
0
|
0
|
|
|
|
my $filter_subdomain = ( exists $filter{subdomain} && !$filter{subdomain} ) ? "_empty_" : $filter{subdomain}; |
|
263
|
0
|
|
|
|
|
|
my $filter = Webservice::OVH::Helper->construct_filter( "fieldType" => $filter_type, "subDomain" => $filter_subdomain ); |
|
264
|
|
|
|
|
|
|
|
|
265
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
266
|
0
|
|
|
|
|
|
my $zone_name = $self->name; |
|
267
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => sprintf( "/domain/zone/$zone_name/record%s", $filter ), noSignature => 0 ); |
|
268
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
269
|
|
|
|
|
|
|
|
|
270
|
0
|
|
|
|
|
|
my $record_ids = $response->content; |
|
271
|
0
|
|
|
|
|
|
my $records = []; |
|
272
|
|
|
|
|
|
|
|
|
273
|
0
|
|
|
|
|
|
foreach my $record_id (@$record_ids) { |
|
274
|
|
|
|
|
|
|
|
|
275
|
0
|
|
0
|
|
|
|
my $record = $self->{_records}{$record_id} = $self->{_records}{$record_id} || Webservice::OVH::Domain::Zone::Record->_new_existing( wrapper => $api, module => $self->{_module}, zone => $self, id => $record_id ); |
|
276
|
0
|
|
|
|
|
|
push @$records, $record; |
|
277
|
|
|
|
|
|
|
} |
|
278
|
|
|
|
|
|
|
|
|
279
|
0
|
|
|
|
|
|
return $records; |
|
280
|
|
|
|
|
|
|
} |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=head2 record |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
Returns a single record by id |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=over |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=item * Parameter: $record_id - id |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Domain::Zone::Record> |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=item * Synopsis: my $record = $ovh->domain->zone->record(123456); |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=back |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=cut |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
sub record { |
|
299
|
|
|
|
|
|
|
|
|
300
|
0
|
|
|
0
|
1
|
|
my ( $self, $record_id ) = @_; |
|
301
|
|
|
|
|
|
|
|
|
302
|
0
|
0
|
|
|
|
|
croak "Missing record_id" unless $record_id; |
|
303
|
|
|
|
|
|
|
|
|
304
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
305
|
0
|
0
|
0
|
|
|
|
my $from_array_record = $self->{_records}{$record_id} if $self->{_records}{$record_id} && $self->{_records}{$record_id}->is_valid; |
|
306
|
0
|
|
0
|
|
|
|
my $record = $self->{_records}{$record_id} = $from_array_record || Webservice::OVH::Domain::Zone::Record->_new_existing( wrapper => $api, module => $self->{_module}, zone => $self, id => $record_id ); |
|
307
|
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
return $record; |
|
309
|
|
|
|
|
|
|
} |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=head2 new_record |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
Creates a new record. |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=over |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=item * Parameter: %params - refresh => 'true', 'false' - directly refreshes the zone target (required) => '0.0.0.0' ttl (optional) => 3000 sub_domain (optional) => 'www' field_type (required) => 'A' |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Domain::Zone::Record> |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=item * Synopsis: my $record = $zone->new_record(field_type => 'MX', target => '1 my.mailserver.de.'); |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=back |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
=cut |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
sub new_record { |
|
328
|
|
|
|
|
|
|
|
|
329
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
|
330
|
|
|
|
|
|
|
|
|
331
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
332
|
0
|
|
|
|
|
|
my $record = Webservice::OVH::Domain::Zone::Record->_new( wrapper => $api, module => $self->{_module}, zone => $self, %params ); |
|
333
|
|
|
|
|
|
|
|
|
334
|
0
|
|
|
|
|
|
return $record; |
|
335
|
|
|
|
|
|
|
} |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=head2 name |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
Name is the unique identifier. |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=over |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=item * Return: VALUE |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=item * Synopsis: my $name = $zone->name; |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=back |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=cut |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
sub name { |
|
352
|
|
|
|
|
|
|
|
|
353
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
354
|
|
|
|
|
|
|
|
|
355
|
0
|
|
|
|
|
|
return $self->{_name}; |
|
356
|
|
|
|
|
|
|
} |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=head2 change_contact |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
Changes contact information for this zone. |
|
361
|
|
|
|
|
|
|
Contact must be another ovh account name. |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=over |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=item * Parameter: %params - contactBilling (optional) => 'account-ovh' contact_admin (optional) => 'account-ovh' contact_tech (optional) => 'account-ovh' |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Me::Task> |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=item * Synopsis: my $task = $zone->change_contact(contact_billing => 'another-ovh'); |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=back |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=cut |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
sub change_contact { |
|
376
|
|
|
|
|
|
|
|
|
377
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
|
378
|
0
|
0
|
|
|
|
|
croak "at least one parameter needed: contact_billing contact_admin contact_tech" unless %params; |
|
379
|
|
|
|
|
|
|
|
|
380
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
381
|
0
|
|
|
|
|
|
my $zone_name = $self->name; |
|
382
|
0
|
|
|
|
|
|
my $body = {}; |
|
383
|
0
|
0
|
|
|
|
|
$body->{contactBilling} = $params{contact_billing} if exists $params{contact_billing}; |
|
384
|
0
|
0
|
|
|
|
|
$body->{contactAdmin} = $params{contact_admin} if exists $params{contact_admin}; |
|
385
|
0
|
0
|
|
|
|
|
$body->{contactTech} = $params{contact_tech} if exists $params{contact_tech}; |
|
386
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/domain/zone/$zone_name/changeContact", body => $body, noSignature => 0 ); |
|
387
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
388
|
|
|
|
|
|
|
|
|
389
|
0
|
|
|
|
|
|
my $tasks = []; |
|
390
|
0
|
|
|
|
|
|
my $task_ids = $response->content; |
|
391
|
0
|
|
|
|
|
|
foreach my $task_id (@$task_ids) { |
|
392
|
|
|
|
|
|
|
|
|
393
|
0
|
|
|
|
|
|
my $task = $api->me->task_contact_change($task_id); |
|
394
|
0
|
|
|
|
|
|
push @$tasks, $task; |
|
395
|
|
|
|
|
|
|
} |
|
396
|
|
|
|
|
|
|
|
|
397
|
0
|
|
|
|
|
|
return $tasks; |
|
398
|
|
|
|
|
|
|
} |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
=head2 refresh |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
Refreshes the domain zone and applies changes. |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
=over |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=item * Synopsis:$zone->refresh; |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
=back |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=cut |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
sub refresh { |
|
413
|
|
|
|
|
|
|
|
|
414
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
415
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
416
|
0
|
|
|
|
|
|
my $zone_name = $self->name; |
|
417
|
|
|
|
|
|
|
|
|
418
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/domain/zone/$zone_name/refresh", body => {}, noSignature => 0 ); |
|
419
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
420
|
|
|
|
|
|
|
} |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=head2 reset |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
Deletes all custom records and resetzt to default. |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
=over |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=item * Parameter: $minimal - only creates nesseccary dns records |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
=item * Synopsis: $zone->reset; |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
=back |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
=cut |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
sub reset { |
|
437
|
|
|
|
|
|
|
|
|
438
|
0
|
|
|
0
|
1
|
|
my ( $self, $minimal ) = @_; |
|
439
|
|
|
|
|
|
|
|
|
440
|
0
|
|
0
|
|
|
|
$minimal ||= 'false'; |
|
441
|
|
|
|
|
|
|
|
|
442
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
443
|
0
|
|
|
|
|
|
my $zone_name = $self->name; |
|
444
|
|
|
|
|
|
|
|
|
445
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/domain/zone/$zone_name/reset", body => {}, noSignature => 0 ); |
|
446
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
447
|
|
|
|
|
|
|
} |
|
448
|
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
1; |