| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Webservice::OVH::Email::Domain::Domain; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Webservice::OVH::Email::Domain::Domain |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Webservice::OVH; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $email_domain = $ovh->email->domain->domain('testdomain.de'); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Provides access to api email-domain methods like mailinglists, accounts and redirections. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 METHODS |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
|
24
|
|
|
|
|
|
|
|
|
25
|
36
|
|
|
36
|
|
275
|
use strict; |
|
|
36
|
|
|
|
|
86
|
|
|
|
36
|
|
|
|
|
1048
|
|
|
26
|
36
|
|
|
36
|
|
186
|
use warnings; |
|
|
36
|
|
|
|
|
79
|
|
|
|
36
|
|
|
|
|
1033
|
|
|
27
|
36
|
|
|
36
|
|
200
|
use Carp qw{ carp croak }; |
|
|
36
|
|
|
|
|
91
|
|
|
|
36
|
|
|
|
|
2558
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our $VERSION = 0.46; |
|
30
|
|
|
|
|
|
|
|
|
31
|
36
|
|
|
36
|
|
18352
|
use Webservice::OVH::Email::Domain::Domain::Redirection; |
|
|
36
|
|
|
|
|
118
|
|
|
|
36
|
|
|
|
|
1637
|
|
|
32
|
36
|
|
|
36
|
|
20120
|
use Webservice::OVH::Email::Domain::Domain::Account; |
|
|
36
|
|
|
|
|
120
|
|
|
|
36
|
|
|
|
|
3116
|
|
|
33
|
36
|
|
|
36
|
|
21572
|
use Webservice::OVH::Email::Domain::Domain::MailingList; |
|
|
36
|
|
|
|
|
126
|
|
|
|
36
|
|
|
|
|
1551
|
|
|
34
|
36
|
|
|
36
|
|
364
|
use Webservice::OVH::Email::Domain::Domain::Task; |
|
|
36
|
|
|
|
|
97
|
|
|
|
36
|
|
|
|
|
712
|
|
|
35
|
36
|
|
|
36
|
|
203
|
use Webservice::OVH::Helper; |
|
|
36
|
|
|
|
|
88
|
|
|
|
36
|
|
|
|
|
91501
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 _new |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Internal Method to create the domain object. |
|
40
|
|
|
|
|
|
|
This method is not ment to be called external. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Email::Domain> |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Email::Domain->_new($ovh_api_wrapper, $zone_name, $module); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=back |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _new { |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
0
|
|
|
my ( $class, %params ) = @_; |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
die "Missing module" unless $params{module}; |
|
59
|
0
|
0
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
|
60
|
0
|
0
|
|
|
|
|
die "Missing id" unless $params{id}; |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $module = $params{module}; |
|
63
|
0
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
|
64
|
0
|
|
|
|
|
|
my $domain = $params{id}; |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
croak "Missing domain name" unless $domain; |
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $self = bless { |
|
69
|
|
|
|
|
|
|
_module => $module, |
|
70
|
|
|
|
|
|
|
_api_wrapper => $api_wrapper, |
|
71
|
|
|
|
|
|
|
_name => $domain, |
|
72
|
|
|
|
|
|
|
_service_infos => undef, |
|
73
|
|
|
|
|
|
|
_properties => undef, |
|
74
|
|
|
|
|
|
|
_redirections => {}, |
|
75
|
|
|
|
|
|
|
_accounts => {}, |
|
76
|
|
|
|
|
|
|
_mailing_lists => {}, |
|
77
|
|
|
|
|
|
|
}, $class; |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task->_new( module => $module, wrapper => $api_wrapper, domain => $self ); |
|
80
|
0
|
|
|
|
|
|
$self->{_task} = $task; |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
return $self; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 service_infos |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Retrieves additional infos about the email-domain. |
|
88
|
|
|
|
|
|
|
Not part of the properties |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * Return: HASH |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * Synopsis: my $info = $email_domain->service_infos; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=back |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub service_infos { |
|
101
|
|
|
|
|
|
|
|
|
102
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
105
|
0
|
|
|
|
|
|
my $domain = $self->name; |
|
106
|
0
|
|
|
|
|
|
my $response_service_info = $api->rawCall( method => 'get', path => "/email/domain/$domain/serviceInfos", noSignature => 0 ); |
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
0
|
|
|
|
|
croak $response_service_info->error if $response_service_info->error; |
|
109
|
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
$self->{_service_infos} = $response_service_info->content; |
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
return $self->{_service_infos}; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 quota |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Retrieves info about quotas. |
|
118
|
|
|
|
|
|
|
Not part of the properties |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=over |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * Return: HASH |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * Synopsis: my $info = $email_domain->quota; |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=back |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub quota { |
|
131
|
|
|
|
|
|
|
|
|
132
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
135
|
0
|
|
|
|
|
|
my $domain = $self->name; |
|
136
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain/quota", noSignature => 0 ); |
|
137
|
|
|
|
|
|
|
|
|
138
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
139
|
0
|
|
|
|
|
|
return $response->content; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 name |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Name is the unique identifier. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=over |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * Return: VALUE |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * Synopsis: my $name = $email_domain->name; |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=back |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub name { |
|
157
|
|
|
|
|
|
|
|
|
158
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
159
|
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
return $self->{_name}; |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 properties |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Retrieves properties of the email-domain. |
|
166
|
|
|
|
|
|
|
This method updates the intern property variable. |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=over |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item * Return: HASH |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * Synopsis: my $properties = $email_domain->properties; |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=back |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=cut |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub properties { |
|
179
|
|
|
|
|
|
|
|
|
180
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
181
|
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
183
|
0
|
|
|
|
|
|
my $domain = $self->name; |
|
184
|
0
|
|
|
|
|
|
my $response_properties = $api->rawCall( method => 'get', path => "/email/domain/$domain", noSignature => 0 ); |
|
185
|
0
|
0
|
|
|
|
|
croak $response_properties->error if $response_properties->error; |
|
186
|
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
|
$self->{_properties} = $response_properties->content; |
|
188
|
|
|
|
|
|
|
|
|
189
|
0
|
|
|
|
|
|
return $self->{_properties}; |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 allowed_account_size |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Exposed Property Value. Readonly. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=over |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item * Return: VALUE |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item * Synopsis: my $allowed_account_size = $email_domain->allowed_account_size; |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=back |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=cut |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub allowed_account_size { |
|
207
|
|
|
|
|
|
|
|
|
208
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
209
|
|
|
|
|
|
|
|
|
210
|
0
|
|
|
|
|
|
return $self->{_properties}->{allowedAccountSize}; |
|
211
|
|
|
|
|
|
|
} |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 creation_date |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Exposed Property Value. Readonly. |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=over |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=item * Return: DateTime |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=item * Synopsis: my $creation_date = $email_domain->creation_date; |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=back |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub creation_date { |
|
228
|
|
|
|
|
|
|
|
|
229
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
230
|
|
|
|
|
|
|
|
|
231
|
0
|
|
|
|
|
|
my $str_datetime = $self->{_properties}->{creationDate}; |
|
232
|
0
|
|
|
|
|
|
my $datetime = Webservice::OVH::Helper->parse_datetime($str_datetime); |
|
233
|
0
|
|
|
|
|
|
return $datetime; |
|
234
|
|
|
|
|
|
|
} |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 filerz |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Exposed Property Value. Readonly. |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=over |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=item * Return: VALUE |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=item * Synopsis: my $filerz = $email_domain->filerz; |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=back |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=cut |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub filerz { |
|
251
|
|
|
|
|
|
|
|
|
252
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
253
|
|
|
|
|
|
|
|
|
254
|
0
|
|
|
|
|
|
return $self->{_properties}->{filerz}; |
|
255
|
|
|
|
|
|
|
} |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=head2 status |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
Exposed Property Value. Readonly. |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=over |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=item * Return: VALUE |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=item * Synopsis: my $status = $email_domain->status; |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=back |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=cut |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
sub status { |
|
272
|
|
|
|
|
|
|
|
|
273
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
274
|
|
|
|
|
|
|
|
|
275
|
0
|
|
|
|
|
|
return $self->{_properties}->{status}; |
|
276
|
|
|
|
|
|
|
} |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
sub redirections_count { |
|
279
|
|
|
|
|
|
|
|
|
280
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
281
|
|
|
|
|
|
|
|
|
282
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
283
|
0
|
|
|
|
|
|
my $domain_name = $self->name; |
|
284
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/redirection", noSignature => 0 ); |
|
285
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
286
|
|
|
|
|
|
|
|
|
287
|
0
|
|
|
|
|
|
return scalar @{ $response->content }; |
|
|
0
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
} |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=head2 redirections |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
Produces an array of all available redirections that are connected to the email-domain. |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=over |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=item * Synopsis: my $redirections = $email_domain->redirections(); |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=back |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=cut |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
sub redirections { |
|
305
|
|
|
|
|
|
|
|
|
306
|
0
|
|
|
0
|
1
|
|
my ( $self, %filter ) = @_; |
|
307
|
|
|
|
|
|
|
|
|
308
|
0
|
0
|
0
|
|
|
|
my $filter_from = ( exists $filter{from} && !$filter{from} ) ? "_empty_" : $filter{from}; |
|
309
|
0
|
0
|
0
|
|
|
|
my $filter_to = ( exists $filter{to} && !$filter{to} ) ? "_empty_" : $filter{to}; |
|
310
|
0
|
|
|
|
|
|
my $filter = Webservice::OVH::Helper->construct_filter( "from" => $filter_from, "to" => $filter_to ); |
|
311
|
|
|
|
|
|
|
|
|
312
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
313
|
0
|
|
|
|
|
|
my $domain_name = $self->name; |
|
314
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => sprintf( "/email/domain/$domain_name/redirection%s", $filter ), noSignature => 0 ); |
|
315
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
316
|
|
|
|
|
|
|
|
|
317
|
0
|
|
|
|
|
|
my $redirection_ids = $response->content; |
|
318
|
0
|
|
|
|
|
|
my $redirections = []; |
|
319
|
|
|
|
|
|
|
|
|
320
|
0
|
|
|
|
|
|
foreach my $redirection_id (@$redirection_ids) { |
|
321
|
|
|
|
|
|
|
|
|
322
|
0
|
|
0
|
|
|
|
my $redirection = $self->{_redirections}{$redirection_id} = $self->{_redirections}{$redirection_id} || Webservice::OVH::Email::Domain::Domain::Redirection->_new_existing( wrapper => $api, domain => $self, id => $redirection_id, module => $self->{_module} ); |
|
323
|
0
|
|
|
|
|
|
push @$redirections, $redirection; |
|
324
|
|
|
|
|
|
|
} |
|
325
|
|
|
|
|
|
|
|
|
326
|
0
|
|
|
|
|
|
return $redirections; |
|
327
|
|
|
|
|
|
|
} |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub redirection_exists { |
|
330
|
|
|
|
|
|
|
|
|
331
|
0
|
|
|
0
|
0
|
|
my ( $self, $redirection_id ) = @_; |
|
332
|
|
|
|
|
|
|
|
|
333
|
0
|
0
|
|
|
|
|
croak "Missing redirection_id" unless $redirection_id; |
|
334
|
|
|
|
|
|
|
|
|
335
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
336
|
0
|
|
|
|
|
|
my $domain_name = $self->name; |
|
337
|
|
|
|
|
|
|
|
|
338
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/redirection/$redirection_id", noSignature => 0 ); |
|
339
|
|
|
|
|
|
|
|
|
340
|
0
|
0
|
|
|
|
|
return $response->error ? 0 : 1; |
|
341
|
|
|
|
|
|
|
} |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=head2 redirection |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
Returns a single redirection by id |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=over |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=item * Parameter: $redirection_id - id |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Email::Domain::Domain::Redirection> |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=item * Synopsis: my $service = $email_domain->redirection(12345); |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=back |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=cut |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
sub redirection { |
|
360
|
|
|
|
|
|
|
|
|
361
|
0
|
|
|
0
|
1
|
|
my ( $self, $redirection_id ) = @_; |
|
362
|
|
|
|
|
|
|
|
|
363
|
0
|
0
|
|
|
|
|
croak "Missing redirection_id" unless $redirection_id; |
|
364
|
|
|
|
|
|
|
|
|
365
|
0
|
0
|
|
|
|
|
if ( $self->redirection_exists($redirection_id) ) { |
|
366
|
|
|
|
|
|
|
|
|
367
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
368
|
0
|
0
|
0
|
|
|
|
my $from_array_redirection = $self->{_redirections}{$redirection_id} if $self->{_redirections}{$redirection_id} && $self->{_redirections}{$redirection_id}->is_valid; |
|
369
|
0
|
|
0
|
|
|
|
my $redirection = $self->{_redirections}{$redirection_id} = $from_array_redirection || Webservice::OVH::Email::Domain::Domain::Redirection->_new_existing( wrapper => $api, domain => $self, id => $redirection_id, module => $self->{_module} ); |
|
370
|
|
|
|
|
|
|
|
|
371
|
0
|
|
|
|
|
|
return $redirection; |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
} else { |
|
374
|
|
|
|
|
|
|
|
|
375
|
0
|
|
|
|
|
|
return undef; |
|
376
|
|
|
|
|
|
|
} |
|
377
|
|
|
|
|
|
|
} |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=head2 new_redirection |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
Creates a new redirection. |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=over |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=item * Parameter: %params - key => value from to local_copy |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=item * Return: L<Webservice::Email::Domain::Domain::Redirection> |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=item * Synopsis: my $redirection = $email_domain->new_redirection(from => 'test@test.de', to => 'test2@test.de', local_copy => 'false'); |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=back |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=cut |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
sub new_redirection { |
|
396
|
|
|
|
|
|
|
|
|
397
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
|
398
|
|
|
|
|
|
|
|
|
399
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
400
|
0
|
|
|
|
|
|
my $redirection = Webservice::OVH::Email::Domain::Domain::Redirection->_new( wrapper => $api, domain => $self, module => $self->{_module}, %params ); |
|
401
|
|
|
|
|
|
|
|
|
402
|
0
|
|
|
|
|
|
return $redirection; |
|
403
|
|
|
|
|
|
|
} |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
sub accounts_count { |
|
406
|
|
|
|
|
|
|
|
|
407
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
408
|
|
|
|
|
|
|
|
|
409
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
410
|
0
|
|
|
|
|
|
my $domain_name = $self->name; |
|
411
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/account", noSignature => 0 ); |
|
412
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
413
|
|
|
|
|
|
|
|
|
414
|
0
|
|
|
|
|
|
return scalar @{ $response->content }; |
|
|
0
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
} |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=head2 accounts |
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
Produces an array of all available accounts that are connected to the email-domain. |
|
420
|
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=over |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
=item * Synopsis: my $accounts = $email_domain->accounts(); |
|
426
|
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=back |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=cut |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
sub accounts { |
|
432
|
|
|
|
|
|
|
|
|
433
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
434
|
|
|
|
|
|
|
|
|
435
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
436
|
0
|
|
|
|
|
|
my $domain_name = $self->name; |
|
437
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/account", noSignature => 0 ); |
|
438
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
439
|
|
|
|
|
|
|
|
|
440
|
0
|
|
|
|
|
|
my $account_names = $response->content; |
|
441
|
0
|
|
|
|
|
|
my $accounts = []; |
|
442
|
|
|
|
|
|
|
|
|
443
|
0
|
|
|
|
|
|
foreach my $account_name (@$account_names) { |
|
444
|
0
|
|
0
|
|
|
|
my $account = $self->{_accounts}{$account_name} = $self->{_accounts}{$account_name} || Webservice::OVH::Email::Domain::Domain::Account->_new_existing( wrapper => $api, domain => $self, id => $account_name, module => $self->{_module} ); |
|
445
|
0
|
|
|
|
|
|
push @$accounts, $account; |
|
446
|
|
|
|
|
|
|
} |
|
447
|
|
|
|
|
|
|
|
|
448
|
0
|
|
|
|
|
|
return $accounts; |
|
449
|
|
|
|
|
|
|
} |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
sub account_exists { |
|
452
|
|
|
|
|
|
|
|
|
453
|
0
|
|
|
0
|
0
|
|
my ( $self, $account_name ) = @_; |
|
454
|
|
|
|
|
|
|
|
|
455
|
0
|
0
|
|
|
|
|
croak "Missing account_name" unless $account_name; |
|
456
|
|
|
|
|
|
|
|
|
457
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
458
|
0
|
|
|
|
|
|
my $domain_name = $self->name; |
|
459
|
|
|
|
|
|
|
|
|
460
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/account/$account_name", noSignature => 0 ); |
|
461
|
|
|
|
|
|
|
|
|
462
|
0
|
0
|
|
|
|
|
return $response->error ? 0 : 1; |
|
463
|
|
|
|
|
|
|
} |
|
464
|
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
=head2 account |
|
466
|
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
Returns a single account by name |
|
468
|
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=over |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=item * Parameter: $account_name - name |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Email::Domain::Domain::Account> |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=item * Synopsis: my $account = $email_domain->account('testaccount'); |
|
476
|
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
=back |
|
478
|
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
=cut |
|
480
|
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
sub account { |
|
482
|
|
|
|
|
|
|
|
|
483
|
0
|
|
|
0
|
1
|
|
my ( $self, $account_name ) = @_; |
|
484
|
|
|
|
|
|
|
|
|
485
|
0
|
0
|
|
|
|
|
croak "Missing account_name" unless $account_name; |
|
486
|
|
|
|
|
|
|
|
|
487
|
0
|
|
|
|
|
|
$account_name = lc $account_name; |
|
488
|
|
|
|
|
|
|
|
|
489
|
0
|
0
|
|
|
|
|
if ( $self->account_exists($account_name) ) { |
|
490
|
|
|
|
|
|
|
|
|
491
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
492
|
0
|
0
|
0
|
|
|
|
my $from_array_account = $self->{_accounts}{$account_name} if $self->{_accounts}{$account_name} && $self->{_accounts}{$account_name}->is_valid; |
|
493
|
0
|
|
0
|
|
|
|
my $account = $self->{_accounts}{$account_name} = $from_array_account || Webservice::OVH::Email::Domain::Domain::Account->_new_existing( wrapper => $api, domain => $self, id => $account_name, module => $self->{_module} ); |
|
494
|
|
|
|
|
|
|
|
|
495
|
0
|
|
|
|
|
|
return $account; |
|
496
|
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
} else { |
|
498
|
|
|
|
|
|
|
|
|
499
|
0
|
|
|
|
|
|
return undef; |
|
500
|
|
|
|
|
|
|
} |
|
501
|
|
|
|
|
|
|
} |
|
502
|
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
=head2 new_account |
|
504
|
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
Creates a new account. |
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
=over |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=item * Parameter: %params - key => value account_name password description size |
|
510
|
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
=item * Return: L<Webservice::Email::Domain::Domain::Account> |
|
512
|
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
=item * Synopsis: my $account = $email_domain->new_account(account_name => 'testaccount', password => $password, description => 'a test account', size => 5000000 ); |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
=back |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=cut |
|
518
|
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
sub new_account { |
|
520
|
|
|
|
|
|
|
|
|
521
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
|
522
|
|
|
|
|
|
|
|
|
523
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
524
|
0
|
|
|
|
|
|
my ( $account, $task ) = Webservice::OVH::Email::Domain::Domain::Account->_new( wrapper => $api, domain => $self, module => $self->{_module}, %params ); |
|
525
|
|
|
|
|
|
|
|
|
526
|
0
|
|
|
|
|
|
return ( $account, $task ); |
|
527
|
|
|
|
|
|
|
} |
|
528
|
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
sub mailing_lists_count { |
|
530
|
|
|
|
|
|
|
|
|
531
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
532
|
|
|
|
|
|
|
|
|
533
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
534
|
0
|
|
|
|
|
|
my $domain_name = $self->name; |
|
535
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList", noSignature => 0 ); |
|
536
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
537
|
|
|
|
|
|
|
|
|
538
|
0
|
|
|
|
|
|
return scalar @{ $response->content }; |
|
|
0
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
} |
|
540
|
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
sub mailing_lists_names { |
|
542
|
|
|
|
|
|
|
|
|
543
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
544
|
|
|
|
|
|
|
|
|
545
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
546
|
0
|
|
|
|
|
|
my $domain_name = $self->name; |
|
547
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList", noSignature => 0 ); |
|
548
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
549
|
|
|
|
|
|
|
|
|
550
|
0
|
|
|
|
|
|
return $response->content; |
|
551
|
|
|
|
|
|
|
} |
|
552
|
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
=head2 mailing_lists |
|
554
|
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
Produces an array of all available mailing_lists that are connected to the email-domain. |
|
556
|
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
=over |
|
558
|
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
|
560
|
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
=item * Synopsis: my $mailing_lists = $email_domain->mailing_lists(); |
|
562
|
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=back |
|
564
|
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
=cut |
|
566
|
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
sub mailing_lists { |
|
568
|
|
|
|
|
|
|
|
|
569
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
570
|
|
|
|
|
|
|
|
|
571
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
572
|
0
|
|
|
|
|
|
my $domain_name = $self->name; |
|
573
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList", noSignature => 0 ); |
|
574
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
|
575
|
|
|
|
|
|
|
|
|
576
|
0
|
|
|
|
|
|
my $mailing_list_names = $response->content; |
|
577
|
0
|
|
|
|
|
|
my $mailing_lists = []; |
|
578
|
|
|
|
|
|
|
|
|
579
|
0
|
|
|
|
|
|
foreach my $mailing_list_name (@$mailing_list_names) { |
|
580
|
|
|
|
|
|
|
|
|
581
|
0
|
|
0
|
|
|
|
my $mailing_list = $self->{_mailing_lists}{$mailing_list_name} = $self->{_mailing_lists}{$mailing_list_name} || Webservice::OVH::Email::Domain::Domain::MailingList->_new_existing( wrapper => $api, domain => $self, id => $mailing_list_name, module => $self->{_module} ); |
|
582
|
0
|
|
|
|
|
|
push @$mailing_lists, $mailing_list; |
|
583
|
|
|
|
|
|
|
} |
|
584
|
|
|
|
|
|
|
|
|
585
|
0
|
|
|
|
|
|
return $mailing_lists; |
|
586
|
|
|
|
|
|
|
} |
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
sub mailinglist_exists { |
|
589
|
|
|
|
|
|
|
|
|
590
|
0
|
|
|
0
|
0
|
|
my ( $self, $mailinglist_name ) = @_; |
|
591
|
|
|
|
|
|
|
|
|
592
|
0
|
0
|
|
|
|
|
croak "Missing mailinglist_name" unless $mailinglist_name; |
|
593
|
|
|
|
|
|
|
|
|
594
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
595
|
0
|
|
|
|
|
|
my $domain_name = $self->name; |
|
596
|
|
|
|
|
|
|
|
|
597
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList/$mailinglist_name", noSignature => 0 ); |
|
598
|
|
|
|
|
|
|
|
|
599
|
0
|
0
|
|
|
|
|
return $response->error ? 0 : 1; |
|
600
|
|
|
|
|
|
|
} |
|
601
|
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
=head2 mailing_list |
|
603
|
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
Returns a single account by name |
|
605
|
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
=over |
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
=item * Parameter: $mailing_list_name - name |
|
609
|
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Email::Domain::Domain::MailingList> |
|
611
|
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
=item * Synopsis: my $mailing_list = $email_domain->mailing_list('subscriber_list'); |
|
613
|
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
=back |
|
615
|
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
=cut |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
sub mailing_list { |
|
619
|
|
|
|
|
|
|
|
|
620
|
0
|
|
|
0
|
1
|
|
my ( $self, $mailing_list_name ) = @_; |
|
621
|
|
|
|
|
|
|
|
|
622
|
0
|
0
|
|
|
|
|
croak "Missing mailing_list_name" unless $mailing_list_name; |
|
623
|
|
|
|
|
|
|
|
|
624
|
0
|
0
|
|
|
|
|
if ( $self->mailinglist_exists($mailing_list_name) ) { |
|
625
|
|
|
|
|
|
|
|
|
626
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
627
|
0
|
0
|
0
|
|
|
|
my $from_array_mailing_list = $self->{_mailing_lists}{$mailing_list_name} if $self->{_mailing_lists}{$mailing_list_name} && $self->{_mailing_lists}{$mailing_list_name}->is_valid; |
|
628
|
0
|
|
0
|
|
|
|
my $mailing_list = $self->{_mailing_lists}{$mailing_list_name} = $from_array_mailing_list || Webservice::OVH::Email::Domain::Domain::MailingList->_new_existing( wrapper => $api, domain => $self, id => $mailing_list_name, module => $self->{_module} ); |
|
629
|
|
|
|
|
|
|
|
|
630
|
0
|
|
|
|
|
|
return $mailing_list; |
|
631
|
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
} else { |
|
633
|
|
|
|
|
|
|
|
|
634
|
0
|
|
|
|
|
|
return undef; |
|
635
|
|
|
|
|
|
|
} |
|
636
|
|
|
|
|
|
|
} |
|
637
|
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
=head2 new_mailing_list |
|
639
|
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
Creates a new mailing list. |
|
641
|
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
=over |
|
643
|
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
=item * Parameter: %params - key => value language name options owner_email reply_to |
|
645
|
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
=item * Return: L<Webservice::Email::Domain::Domain::MailingList> |
|
647
|
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
=item * Synopsis: my $mailing_list = $email_domain->new_mailing_list(language 'DE', name => 'infos', options => {}, owner_email => 'owner@test.de', reply_to => 'test@test.de' ); |
|
649
|
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
=back |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
=cut |
|
653
|
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
sub new_mailing_list { |
|
655
|
|
|
|
|
|
|
|
|
656
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
|
657
|
|
|
|
|
|
|
|
|
658
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
|
659
|
0
|
|
|
|
|
|
my ( $mailing_list, $task ) = Webservice::OVH::Email::Domain::Domain::MailingList->_new( wrapper => $api, domain => $self, module => $self->{_module}, %params ); |
|
660
|
|
|
|
|
|
|
|
|
661
|
0
|
|
|
|
|
|
return ( $mailing_list, $task ); |
|
662
|
|
|
|
|
|
|
} |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
sub task { |
|
665
|
|
|
|
|
|
|
|
|
666
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
667
|
|
|
|
|
|
|
|
|
668
|
0
|
|
|
|
|
|
return $self->{_task}; |
|
669
|
|
|
|
|
|
|
} |
|
670
|
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
1; |