line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=encoding utf-8 |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Webservice::OVH::Email::Domain::Domain::Account |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Webservice::OVH; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $email_domain = $ovh->email->domain->domain('testdomain.de'); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $account = $email_domain->new_account( account_name => 'testaccount', password => $password, description => 'a test account', size => 50000000 ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Provides access to email accounts. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use strict; |
27
|
36
|
|
|
36
|
|
229
|
use warnings; |
|
36
|
|
|
|
|
97
|
|
|
36
|
|
|
|
|
946
|
|
28
|
36
|
|
|
36
|
|
171
|
use Carp qw{ carp croak }; |
|
36
|
|
|
|
|
69
|
|
|
36
|
|
|
|
|
906
|
|
29
|
36
|
|
|
36
|
|
173
|
|
|
36
|
|
|
|
|
75
|
|
|
36
|
|
|
|
|
2477
|
|
30
|
|
|
|
|
|
|
our $VERSION = 0.47; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use Webservice::OVH::Helper; |
33
|
36
|
|
|
36
|
|
275
|
|
|
36
|
|
|
|
|
92
|
|
|
36
|
|
|
|
|
50980
|
|
34
|
|
|
|
|
|
|
=head2 _new_existing |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Internal Method to create an Account object. |
37
|
|
|
|
|
|
|
This method should never be called directly. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=over |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $domain - parent domain Objekt, $account_name => unique name |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Email::Domain::Domain::Account> |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Email::Domain::Domain::Account->_new_existing($ovh_api_wrapper, $domain, $account_name, $module); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=back |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my ( $class, %params ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
|
|
die "Missing module" unless $params{module}; |
55
|
|
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
56
|
0
|
0
|
|
|
|
|
die "Missing id" unless $params{id}; |
57
|
0
|
0
|
|
|
|
|
die "Missing domain" unless $params{domain}; |
58
|
0
|
0
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
|
my $module = $params{module}; |
60
|
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
61
|
0
|
|
|
|
|
|
my $account_name = $params{id}; |
62
|
0
|
|
|
|
|
|
my $domain = $params{domain}; |
63
|
0
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$account_name = lc $account_name; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $self = bless { _module => $module, _valid => 1, _api_wrapper => $api_wrapper, _name => $account_name, _properties => undef, _domain => $domain }, $class; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return $self; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 _new |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Internal Method to create the Account object. |
75
|
|
|
|
|
|
|
This method should never be called directly. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $domain - parent domain, %params - key => value |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Email::Domain::Domain::Account> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Email::Domain::Domain::Account->_new($ovh_api_wrapper, $domain, $module, account_name => $account_name, password => $password, description => $description, size => $size ); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=back |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my ( $class, %params ) = @_; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
die "Missing module" unless $params{module}; |
93
|
0
|
|
|
0
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
94
|
|
|
|
|
|
|
die "Missing domain" unless $params{domain}; |
95
|
0
|
0
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
|
my $module = $params{module}; |
97
|
0
|
0
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
98
|
|
|
|
|
|
|
my $domain = $params{domain}; |
99
|
0
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my @keys_needed = qw{ account_name password }; |
101
|
0
|
|
|
|
|
|
if ( my @missing_parameters = grep { not $params{$_} } @keys_needed ) { |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
croak "Missing parameter: @missing_parameters"; |
104
|
0
|
0
|
|
|
|
|
} |
|
0
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
my $domain_name = $domain->name; |
107
|
|
|
|
|
|
|
my $body = {}; |
108
|
|
|
|
|
|
|
$body->{accountName} = Webservice::OVH::Helper->trim($params{account_name}); |
109
|
0
|
|
|
|
|
|
$body->{password} = $params{password}; |
110
|
0
|
|
|
|
|
|
$body->{description} = $params{description} if exists $params{description}; |
111
|
0
|
|
|
|
|
|
$body->{size} = $params{size} if exists $params{size}; |
112
|
0
|
|
|
|
|
|
my $response = $api_wrapper->rawCall( method => 'post', path => "/email/domain/$domain_name/account", body => $body, noSignature => 0 ); |
113
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
114
|
0
|
0
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
116
|
0
|
0
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Account->_new_existing( wrapper => $api_wrapper, domain => $domain, id => $task_id, module => $module ); |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
my $self = bless { _module => $module, _valid => 1, _api_wrapper => $api_wrapper, _name => $params{account_name}, _properties => undef, _domain => $domain }, $class; |
119
|
0
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
return ( $self, $task ); |
121
|
0
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
} |
123
|
0
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 is_valid |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
When this account is deleted on the api side, this method returns 0. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=over |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * Return: VALUE |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * Synopsis: print "Valid" if $account->is_valid; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=back |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
my ($self) = @_; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
$self->properties; |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
0
|
1
|
|
return $self->{_valid}; |
144
|
|
|
|
|
|
|
} |
145
|
0
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 name |
147
|
0
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Unique identifier. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=over |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * Return: VALUE |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item * Synopsis: my $name = $account->name; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=back |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
my ($self) = @_; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
return $self->{_name}; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
0
|
|
|
0
|
1
|
|
=head2 properties |
167
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
|
Returns the raw properties as a hash. |
169
|
|
|
|
|
|
|
This is the original return value of the web-api. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=over |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item * Return: HASH |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * Synopsis: my $properties = $account->properties; |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=back |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=cut |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
my ($self) = @_; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
return unless $self->{_valid}; |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
187
|
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
188
|
0
|
|
|
0
|
1
|
|
my $account_name = $self->name; |
189
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/account/$account_name", noSignature => 0 ); |
190
|
0
|
0
|
|
|
|
|
carp $response->error if $response->error; |
191
|
|
|
|
|
|
|
|
192
|
0
|
|
|
|
|
|
if ( $response->error ) { |
193
|
0
|
|
|
|
|
|
|
194
|
0
|
|
|
|
|
|
$self->{_valid} = 0; |
195
|
0
|
|
|
|
|
|
$self->{_properties} = undef; |
196
|
0
|
0
|
|
|
|
|
return; |
197
|
|
|
|
|
|
|
|
198
|
0
|
0
|
|
|
|
|
} else { |
199
|
|
|
|
|
|
|
|
200
|
0
|
|
|
|
|
|
$self->{_properties} = $response->content; |
201
|
0
|
|
|
|
|
|
return $self->{_properties}; |
202
|
0
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
0
|
|
|
|
|
|
=head2 is_blocked |
207
|
0
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Exposed property value. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=over |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item * Return: VALUE |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=item * Synopsis: my $is_blocked = $account->is_blocked; |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=back |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=cut |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
my ($self) = @_; |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
$self->properties unless $self->{_properties}; |
224
|
|
|
|
|
|
|
return unless $self->{_valid}; |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
return $self->{_properties}->{isBlocked} ? 1 : 0; |
227
|
|
|
|
|
|
|
|
228
|
0
|
|
|
0
|
1
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
0
|
0
|
|
|
|
|
=head2 email |
231
|
0
|
0
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Exposed property value. |
233
|
0
|
0
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=over |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item * Return: VALUE |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=item * Synopsis: my $email = $account->email; |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=back |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=cut |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
my ($self) = @_; |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
$self->properties unless $self->{_properties}; |
248
|
|
|
|
|
|
|
return unless $self->{_valid}; |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
return $self->{_properties}->{email}; |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
} |
253
|
0
|
|
|
0
|
1
|
|
|
254
|
|
|
|
|
|
|
=head2 domain |
255
|
0
|
0
|
|
|
|
|
|
256
|
0
|
0
|
|
|
|
|
Returns the email-domain this account is attached to. |
257
|
|
|
|
|
|
|
|
258
|
0
|
|
|
|
|
|
=over |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=item * Return: L<Webservice::Email::Domain::Domain> |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=item * Synopsis: my $email_domain = $account->domain; |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=back |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=cut |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
my ($self) = @_; |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
return $self->{_domain}; |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=head2 description |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
Exposed property value. |
277
|
|
|
|
|
|
|
|
278
|
0
|
|
|
0
|
1
|
|
=over |
279
|
|
|
|
|
|
|
|
280
|
0
|
|
|
|
|
|
=item * Return: VALUE |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=item * Synopsis: my $description = $account->description; |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=back |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=cut |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
my ($self) = @_; |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
$self->properties unless $self->{_properties}; |
292
|
|
|
|
|
|
|
return unless $self->{_valid}; |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
return $self->{_properties}->{description}; |
295
|
|
|
|
|
|
|
} |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head2 size |
298
|
|
|
|
|
|
|
|
299
|
0
|
|
|
0
|
1
|
|
Exposed property value. |
300
|
|
|
|
|
|
|
|
301
|
0
|
0
|
|
|
|
|
=over |
302
|
0
|
0
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=item * Return: VALUE |
304
|
0
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=item * Synopsis: my $size = $account->size; |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=back |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=cut |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
my ($self) = @_; |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
$self->properties unless $self->{_properties}; |
315
|
|
|
|
|
|
|
return unless $self->{_valid}; |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
return $self->{_properties}->{size}; |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=head2 change |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
Changes the account |
323
|
0
|
|
|
0
|
1
|
|
|
324
|
|
|
|
|
|
|
=over |
325
|
0
|
0
|
|
|
|
|
|
326
|
0
|
0
|
|
|
|
|
=item * Parameter: %params - key => value description size |
327
|
|
|
|
|
|
|
|
328
|
0
|
|
|
|
|
|
=item * Synopsis: $account->change(description => 'authors account', size => 2000000 ); |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=back |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=cut |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
my ( $self, %params ) = @_; |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
croak "Objet is invalid" unless $self->{_valid}; |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
340
|
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
341
|
|
|
|
|
|
|
my $account_name = $self->name; |
342
|
|
|
|
|
|
|
my $body = {}; |
343
|
|
|
|
|
|
|
$body->{description} = $params{description} if exists $params{description}; |
344
|
|
|
|
|
|
|
$body->{size} = $params{size} if exists $params{size}; |
345
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'put', path => "/email/domain/$domain_name/account/$account_name", body => $body, noSignature => 0 ); |
346
|
|
|
|
|
|
|
croak $response->error if $response->error; |
347
|
0
|
|
|
0
|
1
|
|
|
348
|
|
|
|
|
|
|
$self->properties; |
349
|
0
|
0
|
|
|
|
|
|
350
|
|
|
|
|
|
|
} |
351
|
0
|
|
|
|
|
|
|
352
|
0
|
|
|
|
|
|
=head2 delete |
353
|
0
|
|
|
|
|
|
|
354
|
0
|
|
|
|
|
|
Deletes the account api sided and sets this object invalid. |
355
|
0
|
0
|
|
|
|
|
|
356
|
0
|
0
|
|
|
|
|
=over |
357
|
0
|
|
|
|
|
|
|
358
|
0
|
0
|
|
|
|
|
=item * Synopsis: $account->delete; |
359
|
|
|
|
|
|
|
|
360
|
0
|
|
|
|
|
|
=back |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
=cut |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
my ( $self, %params ) = @_; |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
croak "Objet is invalid" unless $self->{_valid}; |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
370
|
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
371
|
|
|
|
|
|
|
my $account_name = $self->name; |
372
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'delete', path => "/email/domain/$domain_name/account/$account_name", noSignature => 0 ); |
373
|
|
|
|
|
|
|
croak $response->error if $response->error; |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
376
|
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Account->_new_existing( wrapper => $api, domain => $self->domain, id => $task_id, module => $self->{_module} ); |
377
|
|
|
|
|
|
|
|
378
|
0
|
|
|
0
|
1
|
|
$self->{_valid} = 0; |
379
|
|
|
|
|
|
|
|
380
|
0
|
0
|
|
|
|
|
return $task; |
381
|
|
|
|
|
|
|
} |
382
|
0
|
|
|
|
|
|
|
383
|
0
|
|
|
|
|
|
=head2 delete |
384
|
0
|
|
|
|
|
|
|
385
|
0
|
|
|
|
|
|
Deletes the account api sided and sets this object invalid. |
386
|
0
|
0
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=over |
388
|
0
|
|
|
|
|
|
|
389
|
0
|
|
|
|
|
|
=item * Parameter: $password - new password |
390
|
|
|
|
|
|
|
|
391
|
0
|
|
|
|
|
|
=item * Synopsis: $account->change_password($password); |
392
|
|
|
|
|
|
|
|
393
|
0
|
|
|
|
|
|
=back |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=cut |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
my ( $self, $password ) = @_; |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
croak "Objet is invalid" unless $self->{_valid}; |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
403
|
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
404
|
|
|
|
|
|
|
my $account_name = $self->name; |
405
|
|
|
|
|
|
|
my $body = { password => $password }; |
406
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/email/domain/$domain_name/account/$account_name/changePassword", body => $body, noSignature => 0 ); |
407
|
|
|
|
|
|
|
croak $response->error if $response->error; |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
410
|
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Account->_new_existing( wrapper => $api, domain => $self->domain, id => $task_id, module => $self->{_module} ); |
411
|
|
|
|
|
|
|
|
412
|
0
|
|
|
0
|
1
|
|
return $task; |
413
|
|
|
|
|
|
|
|
414
|
0
|
0
|
|
|
|
|
} |
415
|
|
|
|
|
|
|
|
416
|
0
|
|
|
|
|
|
=head2 usage |
417
|
0
|
|
|
|
|
|
|
418
|
0
|
|
|
|
|
|
Deletes the account api sided and sets this object invalid. |
419
|
0
|
|
|
|
|
|
|
420
|
0
|
|
|
|
|
|
=over |
421
|
0
|
0
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=item * Return: HASH |
423
|
0
|
|
|
|
|
|
|
424
|
0
|
|
|
|
|
|
=item * Synopsis: $account->usage; |
425
|
|
|
|
|
|
|
|
426
|
0
|
|
|
|
|
|
=back |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=cut |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
my ($self) = @_; |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
croak "Objet is invalid" unless $self->{_valid}; |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
436
|
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
437
|
|
|
|
|
|
|
my $account_name = $self->name; |
438
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/account/$account_name/usage", noSignature => 0 ); |
439
|
|
|
|
|
|
|
croak $response->error if $response->error; |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
return $response->content; |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
} |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=head2 tasks |
446
|
0
|
|
|
0
|
1
|
|
|
447
|
|
|
|
|
|
|
Get all associated tasks |
448
|
0
|
0
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=over |
450
|
0
|
|
|
|
|
|
|
451
|
0
|
|
|
|
|
|
=item * Return: HASH |
452
|
0
|
|
|
|
|
|
|
453
|
0
|
|
|
|
|
|
=item * Synopsis: $account->tasks; |
454
|
0
|
0
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=back |
456
|
0
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=cut |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
my ($self) = @_; |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
croak "Objet is invalid" unless $self->{_valid}; |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
465
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
466
|
|
|
|
|
|
|
my $name = $self->name; |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => sprintf( "/email/domain/$domain_name/task/account?name=%s", $name ), noSignature => 0 ); |
469
|
|
|
|
|
|
|
croak $response->error if $response->error; |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
my $taks = $response->content || []; |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
return unless scalar @$taks; |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
return $taks; |
476
|
0
|
|
|
0
|
1
|
|
|
477
|
|
|
|
|
|
|
} |
478
|
0
|
0
|
|
|
|
|
|
479
|
|
|
|
|
|
|
1; |