| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=encoding utf-8 |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Webservice::OVH::Domain |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Webservice::OVH; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $services = $ovh->domain->services; |
|
15
|
|
|
|
|
|
|
foreach my $service (@$services) { |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
print $service->name; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $ = $ovh->domain->zones; |
|
21
|
|
|
|
|
|
|
foreach my $zone (@$zones) { |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
print $zone->name; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
print "I have a zone" if $ovh->domain->zone_exists("myaddress.de"); |
|
27
|
|
|
|
|
|
|
print "I have a service" if $ovh->domain->service_exists("myaddress.de"); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Gives access to services and zones connected to the uses account. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
use strict; |
|
38
|
36
|
|
|
36
|
|
221
|
use warnings; |
|
|
36
|
|
|
|
|
69
|
|
|
|
36
|
|
|
|
|
926
|
|
|
39
|
36
|
|
|
36
|
|
158
|
use Carp qw{ carp croak }; |
|
|
36
|
|
|
|
|
71
|
|
|
|
36
|
|
|
|
|
917
|
|
|
40
|
36
|
|
|
36
|
|
151
|
|
|
|
36
|
|
|
|
|
58
|
|
|
|
36
|
|
|
|
|
2458
|
|
|
41
|
|
|
|
|
|
|
our $VERSION = 0.47; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
use Webservice::OVH::Domain::Service; |
|
44
|
36
|
|
|
36
|
|
13967
|
use Webservice::OVH::Domain::Zone; |
|
|
36
|
|
|
|
|
107
|
|
|
|
36
|
|
|
|
|
1308
|
|
|
45
|
36
|
|
|
36
|
|
15457
|
|
|
|
36
|
|
|
|
|
114
|
|
|
|
36
|
|
|
|
|
27977
|
|
|
46
|
|
|
|
|
|
|
=head2 _new |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Internal Method to create the domain object. |
|
49
|
|
|
|
|
|
|
This method is not ment to be called external. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=over |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order> |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Order->_new($ovh_api_wrapper, $self); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=back |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my ( $class, %params ) = @_; |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
|
|
die "Missing module" unless $params{module}; |
|
67
|
|
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
|
68
|
0
|
0
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
my $module = $params{module}; |
|
70
|
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
|
71
|
0
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $self = bless { _module => $module, _api_wrapper => $api_wrapper, _services => {}, _zones => {}, _aviable_services => [], _aviable_zones => [] }, $class; |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
return $self; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
0
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 service_exists |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Returns 1 if service is available for the connected account, 0 if not. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=over |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * Parameter: $service_name - Domain name, $no_recheck - (optional)only for internal usage |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * Return: VALUE |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * Synopsis: print "mydomain.com exists" if $ovh->domain->service_exists("mydomain.com"); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my ( $self, $service_name, $no_recheck ) = @_; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
if ( !$no_recheck ) { |
|
97
|
0
|
|
|
0
|
1
|
|
|
|
98
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
99
|
0
|
0
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/domain", noSignature => 0 ); |
|
100
|
|
|
|
|
|
|
croak $response->error if $response->error; |
|
101
|
0
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
my $list = $response->content; |
|
103
|
0
|
0
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
return ( grep { $_ eq $service_name } @$list ) ? 1 : 0; |
|
105
|
0
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} else { |
|
107
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
my $list = $self->{_aviable_services}; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
return ( grep { $_ eq $service_name } @$list ) ? 1 : 0; |
|
111
|
0
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
} |
|
113
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 zone_exists |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Returns 1 if zone is available for the connected account, 0 if not. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=over |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item * Parameter: $zone_name - Domain name, $no_recheck - (optional)only for internal usage |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * Return: VALUE |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * Synopsis: print "zone mydomain.com exists" if $ovh->domain->zone_exists("mydomain.com"); |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=back |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
my ( $self, $zone_name, $no_recheck ) = @_; |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
if ( !$no_recheck ) { |
|
134
|
|
|
|
|
|
|
|
|
135
|
0
|
|
|
0
|
1
|
|
my $api = $self->{_api_wrapper}; |
|
136
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/domain/zone", noSignature => 0 ); |
|
137
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
my $list = $response->content; |
|
140
|
0
|
|
|
|
|
|
|
|
141
|
0
|
0
|
|
|
|
|
return ( grep { $_ eq $zone_name } @$list ) ? 1 : 0; |
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
} else { |
|
144
|
|
|
|
|
|
|
|
|
145
|
0
|
0
|
|
|
|
|
my $list = $self->{_aviable_zones}; |
|
|
0
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
return ( grep { $_ eq $zone_name } @$list ) ? 1 : 0; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
0
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
0
|
0
|
|
|
|
|
=head2 services |
|
|
0
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Produces an array of all available services that are connected to the used account. |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=over |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * Return: ARRAY |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * Synopsis: my $services = $ovh->order->services(); |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=back |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
my ($self) = @_; |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
169
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/domain", noSignature => 0 ); |
|
170
|
|
|
|
|
|
|
croak $response->error if $response->error; |
|
171
|
0
|
|
|
0
|
1
|
|
|
|
172
|
|
|
|
|
|
|
my $service_array = $response->content; |
|
173
|
0
|
|
|
|
|
|
my $services = []; |
|
174
|
0
|
|
|
|
|
|
$self->{_aviable_services} = $service_array; |
|
175
|
0
|
0
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
foreach my $service_name (@$service_array) { |
|
177
|
0
|
|
|
|
|
|
if ( $self->service_exists( $service_name, 1 ) ) { |
|
178
|
0
|
|
|
|
|
|
my $service = $self->{_services}{$service_name} = $self->{_services}{$service_name} || Webservice::OVH::Domain::Service->_new( wrapper => $api, id => $service_name, module => $self->{_module} ); |
|
179
|
0
|
|
|
|
|
|
push @$services, $service; |
|
180
|
|
|
|
|
|
|
} |
|
181
|
0
|
|
|
|
|
|
} |
|
182
|
0
|
0
|
|
|
|
|
|
|
183
|
0
|
|
0
|
|
|
|
return $services; |
|
184
|
0
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 zones |
|
187
|
|
|
|
|
|
|
|
|
188
|
0
|
|
|
|
|
|
Produces an array of all available zones that are connected to the used account. |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=over |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * Return: ARRAY |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item * Synopsis: my $zones = $ovh->order->zones(); |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=back |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
my ($self) = @_; |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
204
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/domain/zone", noSignature => 0 ); |
|
205
|
|
|
|
|
|
|
croak $response->error if $response->error; |
|
206
|
|
|
|
|
|
|
|
|
207
|
0
|
|
|
0
|
1
|
|
my $zone_names = $response->content; |
|
208
|
|
|
|
|
|
|
my $zones = []; |
|
209
|
0
|
|
|
|
|
|
$self->{_aviable_zones} = $zone_names; |
|
210
|
0
|
|
|
|
|
|
|
|
211
|
0
|
0
|
|
|
|
|
foreach my $zone_name (@$zone_names) { |
|
212
|
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
if ( $self->zone_exists( $zone_name, 1 ) ) { |
|
214
|
0
|
|
|
|
|
|
my $zone = $self->{_zones}{$zone_name} = $self->{_zones}{$zone_name} || Webservice::OVH::Domain::Zone->_new( wrapper => $api, id => $zone_name, module => $self->{_module} ); |
|
215
|
0
|
|
|
|
|
|
push @$zones, $zone; |
|
216
|
|
|
|
|
|
|
} |
|
217
|
0
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
|
|
219
|
0
|
0
|
|
|
|
|
return $zones; |
|
220
|
0
|
|
0
|
|
|
|
} |
|
221
|
0
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 service |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Returns a single service by name |
|
225
|
0
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=over |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item * Parameter: $service_name - domain name |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Domain::Service> |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=item * Synopsis: my $service = $ovh->domain->service("mydomain.com"); |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=back |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=cut |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
my ( $self, $service_name ) = @_; |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
if ( $self->service_exists($service_name) ) { |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
244
|
|
|
|
|
|
|
my $service = $self->{_services}{$service_name} = $self->{_services}{$service_name} || Webservice::OVH::Domain::Service->_new( wrapper => $api, id => $service_name, module => $self->{_module} ); |
|
245
|
|
|
|
|
|
|
|
|
246
|
0
|
|
|
0
|
1
|
|
return $service; |
|
247
|
|
|
|
|
|
|
} else { |
|
248
|
0
|
0
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
carp "Service $service_name doesn't exists"; |
|
250
|
0
|
|
|
|
|
|
return undef; |
|
251
|
0
|
|
0
|
|
|
|
} |
|
252
|
|
|
|
|
|
|
} |
|
253
|
0
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head2 zone |
|
255
|
|
|
|
|
|
|
|
|
256
|
0
|
|
|
|
|
|
Returns a single zone by name |
|
257
|
0
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=over |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=item * Parameter: $zone_name - domain name |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Domain::Zone> |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=item * Synopsis: my $zone = $ovh->domain->zone("mydomain.com"); |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=back |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=cut |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
my ( $self, $zone_name ) = @_; |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
if ( $self->zone_exists($zone_name) ) { |
|
274
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
275
|
|
|
|
|
|
|
my $zone = $self->{_zones}{$zone_name} = $self->{_zones}{$zone_name} || Webservice::OVH::Domain::Zone->_new( wrapper => $api, id => $zone_name, module => $self->{_module} ); |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
return $zone; |
|
278
|
|
|
|
|
|
|
|
|
279
|
0
|
|
|
0
|
1
|
|
} else { |
|
280
|
|
|
|
|
|
|
|
|
281
|
0
|
0
|
|
|
|
|
carp "Zone $zone_name doesn't exists"; |
|
282
|
0
|
|
|
|
|
|
return undef; |
|
283
|
0
|
|
0
|
|
|
|
} |
|
284
|
|
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
|
} |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
1; |