line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=encoding utf-8 |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Webservice::OVH::Hosting::Web |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Gives access to services and zones connected to the uses account. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 METHODS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use strict; |
19
|
36
|
|
|
36
|
|
241
|
use warnings; |
|
36
|
|
|
|
|
69
|
|
|
36
|
|
|
|
|
899
|
|
20
|
36
|
|
|
36
|
|
168
|
use Carp qw{ carp croak }; |
|
36
|
|
|
|
|
69
|
|
|
36
|
|
|
|
|
835
|
|
21
|
36
|
|
|
36
|
|
241
|
|
|
36
|
|
|
|
|
90
|
|
|
36
|
|
|
|
|
2201
|
|
22
|
|
|
|
|
|
|
our $VERSION = 0.47; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use Webservice::OVH::Hosting::Web::Service; |
25
|
36
|
|
|
36
|
|
13760
|
|
|
36
|
|
|
|
|
104
|
|
|
36
|
|
|
|
|
15668
|
|
26
|
|
|
|
|
|
|
=head2 _new |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Internal Method to create the Web object. |
29
|
|
|
|
|
|
|
This method is not ment to be called external. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=over |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order> |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Order->_new($ovh_api_wrapper, $self); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=back |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my ( $class, %params ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
0
|
|
|
die "Missing module" unless $params{module}; |
47
|
|
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
48
|
0
|
0
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
my $module = $params{module}; |
50
|
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
51
|
0
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $self = bless { _module => $module, _api_wrapper => $api_wrapper, _services => {}, _aviable_services => [], }, $class; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $self; |
55
|
|
|
|
|
|
|
} |
56
|
0
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 service_exists |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Returns 1 if service is available for the connected account, 0 if not. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=over |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item * Parameter: $service_name - service name, $no_recheck - (optional)only for internal usage |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item * Return: VALUE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * Synopsis: print "mydomain.com exists" if $ovh->hosting->web->service_exists("mydomain.com"); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=back |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my ( $self, $service_name, $no_recheck ) = @_; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
if ( !$no_recheck ) { |
77
|
0
|
|
|
0
|
1
|
|
|
78
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
79
|
0
|
0
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/hosting/web", noSignature => 0 ); |
80
|
|
|
|
|
|
|
croak $response->error if $response->error; |
81
|
0
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $list = $response->content; |
83
|
0
|
0
|
|
|
|
|
|
84
|
|
|
|
|
|
|
return ( grep { $_ eq $service_name } @$list ) ? 1 : 0; |
85
|
0
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} else { |
87
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
my $list = $self->{_aviable_services}; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
return ( grep { $_ eq $service_name } @$list ) ? 1 : 0; |
91
|
0
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
} |
93
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 services |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Produces an array of all available services that are connected to the used account. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * Return: ARRAY |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item * Synopsis: my $services = $ovh->order->services(); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=back |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
my ($self) = @_; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
112
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/hosting/web", noSignature => 0 ); |
113
|
0
|
|
|
0
|
1
|
|
croak $response->error if $response->error; |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
my $service_array = $response->content; |
116
|
0
|
|
|
|
|
|
my $services = []; |
117
|
0
|
0
|
|
|
|
|
$self->{_aviable_services} = $service_array; |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
foreach my $service_name (@$service_array) { |
120
|
0
|
|
|
|
|
|
if ( $self->service_exists( $service_name, 1 ) ) { |
121
|
0
|
|
|
|
|
|
my $service = $self->{_services}{$service_name} = $self->{_services}{$service_name} || Webservice::OVH::Hosting::Web::Service->_new( wrapper => $api, id => $service_name, module => $self->{_module} ); |
122
|
|
|
|
|
|
|
push @$services, $service; |
123
|
0
|
|
|
|
|
|
} |
124
|
0
|
0
|
|
|
|
|
} |
125
|
0
|
|
0
|
|
|
|
|
126
|
0
|
|
|
|
|
|
return $services; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 service |
130
|
0
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Returns a single service by name |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=over |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item * Parameter: $service_name - service name |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Hosting::Web::Service> |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item * Synopsis: my $service = $ovh->hosting->web->service("mydomain.com"); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=back |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
my ( $self, $service_name ) = @_; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
if ( $self->service_exists($service_name) ) { |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
151
|
0
|
|
|
0
|
1
|
|
my $service = $self->{_services}{$service_name} = $self->{_services}{$service_name} || Webservice::OVH::Hosting::Web::Service->_new( wrapper => $api, id => $service_name, module => $self->{_module} ); |
152
|
|
|
|
|
|
|
|
153
|
0
|
0
|
|
|
|
|
return $service; |
154
|
|
|
|
|
|
|
} else { |
155
|
0
|
|
|
|
|
|
|
156
|
0
|
|
0
|
|
|
|
carp "Service $service_name doesn't exists"; |
157
|
|
|
|
|
|
|
return undef; |
158
|
0
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
1; |