line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crashplan::Client::Org; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
41
|
use strict; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
392
|
|
4
|
8
|
|
|
8
|
|
46
|
use warnings; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
251
|
|
5
|
8
|
|
|
8
|
|
42
|
use JSON; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
105
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.003_0'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Crashplan::Client::Org - Object representation of Crashplan PROe server's entity |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Crashplan::Client::Org objects are instancied by Crashplan::Client. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Specifically, calling Crashplan::Client->parse_response after querying |
18
|
|
|
|
|
|
|
the server could produce Crashplan::Client::Org |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
An org represents a collection of users. Every user must belong to an org and |
23
|
|
|
|
|
|
|
cannot belong to more than one org at the same time. Orgs may also contains |
24
|
|
|
|
|
|
|
suborgs. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 new |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
The Crashplan::Client::Org constructor |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
36
|
6
|
|
|
6
|
1
|
9
|
my $class = shift; |
37
|
6
|
|
50
|
|
|
15
|
my $param = shift || {}; |
38
|
|
|
|
|
|
|
|
39
|
6
|
|
|
|
|
17
|
my %converted_name = ( |
40
|
|
|
|
|
|
|
quotaSeats => 'quota.seats', |
41
|
|
|
|
|
|
|
quotaBytes => 'quota.bytes', |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
6
|
|
|
|
|
8
|
my $self = $param; |
45
|
|
|
|
|
|
|
|
46
|
6
|
|
|
|
|
24
|
return bless $param,'Crashplan::Client::Org'; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 update |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Update an Org entry in the database |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub update { |
56
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
57
|
|
|
|
|
|
|
#my @attributes = qw/name status parentId masterGuid registrationKey/; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Filter out non REST attribute from the current object |
60
|
0
|
|
|
|
|
0
|
my @attributes = grep {!/^rest|rest_header$/} keys %$self; |
|
0
|
|
|
|
|
0
|
|
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
0
|
my $body = encode_json( { map {$_ => $self->{$_}} @attributes} ); |
|
0
|
|
|
|
|
0
|
|
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
0
|
$self->{rest}->PUT($self->url."/".$self->id,$body); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 delete |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Delete an Org entry in the database (not yet handled by the REST server) |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub delete { |
74
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
0
|
$self->{rest}->DELETE($self->url."/".$self->id); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 id |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Getter for the 'id" attribute. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub id { |
86
|
6
|
|
|
6
|
1
|
52131
|
my $self = shift; |
87
|
|
|
|
|
|
|
|
88
|
6
|
|
|
|
|
29
|
return $self->{id}; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 creationDate |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Getter for the 'creationDate" attribute. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub creationDate { |
98
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
99
|
|
|
|
|
|
|
|
100
|
1
|
|
|
|
|
5
|
return $self->{creationDate}; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 modificationDate |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Getter for the 'modificationDate" attribute. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub modificationDate { |
110
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
111
|
|
|
|
|
|
|
|
112
|
1
|
|
|
|
|
6
|
return $self->{modificationDate}; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 archiveBytesDeltaMonth |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Change in the number of bytes stored in all archiveswithin the org over 30 days |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub archiveBytesDeltaMonth { |
122
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
123
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
0
|
return $self->{archiveBytesDeltaMonth}; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 archiveBytesDelta |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Change in the number of bytes stored in all archiveswithin the org |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub archiveBytesDelta { |
134
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
0
|
return $self->{archiveBytesDelta}; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 status (['Active'|'Deactivated']) |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Getter/setter for the status property. |
142
|
|
|
|
|
|
|
“Active” if the org is currently active, “Deactivated” if the org has beendeactivated |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub status { |
147
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
148
|
1
|
|
|
|
|
2
|
my $val = shift; |
149
|
|
|
|
|
|
|
|
150
|
1
|
50
|
|
|
|
6
|
if ($val) { |
151
|
0
|
|
|
|
|
0
|
$self->{status} = $val; |
152
|
|
|
|
|
|
|
#$self->{rest}->PUT |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
1
|
|
|
|
|
6
|
return $self->{status}; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 quotaBytes |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Configured size quota for this org (in gigabytes) |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=cut |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub quotaBytes { |
165
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
166
|
|
|
|
|
|
|
|
167
|
0
|
|
|
|
|
0
|
return $self->{quotaBytes}; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 dailyChange |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
? |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=cut |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub dailyChange { |
177
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
0
|
return $self->{dailyChange}; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 name([$name]) |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Setter/getter for the current name of the org |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub name { |
189
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
190
|
1
|
|
|
|
|
3
|
my $val = shift; |
191
|
|
|
|
|
|
|
|
192
|
1
|
50
|
|
|
|
5
|
if ($val) { |
193
|
0
|
|
|
|
|
0
|
$self->{'name'} = $val; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
1
|
|
|
|
|
8
|
return $self->{name}; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head2 selectedBytes |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Byte count for all files selected for backup |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=cut |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub selectedBytes { |
206
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
207
|
0
|
|
|
|
|
0
|
my $val = shift; |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
210
|
0
|
|
|
|
|
0
|
return $self->{selectedBytes}; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 todoFiles |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Count of all files waiting to be backed up |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=cut |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
sub todoFiles { |
220
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
221
|
0
|
|
|
|
|
0
|
my $val = shift; |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
0
|
return $self->{todoFiles}; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head2 quotaSeats |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Configured seat quota for this org |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=cut |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub quotaSeats { |
234
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
235
|
0
|
|
|
|
|
0
|
my $val = shift; |
236
|
|
|
|
|
|
|
|
237
|
0
|
0
|
|
|
|
0
|
if ($val) { |
238
|
0
|
|
|
|
|
0
|
$self->{'quota.seats'} = $val; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
0
|
return $self->{'quota.seats'}; |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head2 archiveBytes |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Number of bytes stored in all archives within the org |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=cut |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub archiveBytes { |
251
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
252
|
0
|
|
|
|
|
0
|
my $val = shift; |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
|
255
|
0
|
|
|
|
|
0
|
return $self->{archiveBytes}; |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head2 parentId |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
The id value of the parent org or null if this org has no parent |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub parentId { |
265
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
266
|
1
|
|
|
|
|
3
|
my $val = shift; |
267
|
|
|
|
|
|
|
|
268
|
1
|
50
|
|
|
|
4
|
if ($val) { |
269
|
0
|
|
|
|
|
0
|
$self->{'parentId'} = $val; |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
|
272
|
1
|
|
|
|
|
5
|
return $self->{parentId}; |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head2 selectedFiles |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
Count of all files selected for backup |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=cut |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub selectedFiles { |
282
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
283
|
0
|
|
|
|
|
0
|
my $val = shift; |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
|
286
|
0
|
|
|
|
|
0
|
return $self->{selectedFiles}; |
287
|
|
|
|
|
|
|
} |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=head2 todoBytes |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
Byte count for all files waiting to be backed up |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=cut |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
sub todoBytes { |
296
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
297
|
0
|
|
|
|
|
0
|
my $val = shift; |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
|
300
|
0
|
|
|
|
|
0
|
return $self->{todoBytes}; |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head2 registrationKey |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
The registration key for this org |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=cut |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
sub registrationKey { |
310
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
311
|
1
|
|
|
|
|
3
|
my $val = shift; |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
#TODO : Invetigate, tests are not working (value not set) |
314
|
1
|
50
|
|
|
|
5
|
if ($val) { |
315
|
0
|
|
|
|
|
0
|
$self->{'registrationKey'} = $val; |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
1
|
|
|
|
|
6
|
return $self->{registrationKey}; |
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=head2 masterGuid |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
If not null then this org is a slave org and the value of this field contains theGUID for the corresponding master |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
=cut |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
sub masterGuid { |
328
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
329
|
1
|
|
|
|
|
3
|
my $val = shift; |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
#TODO : Invetigate, tests are not working (value not set) |
332
|
1
|
50
|
|
|
|
5
|
if ($val) { |
333
|
0
|
|
|
|
|
0
|
$self->{'masterGuid'} = $val; |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
|
336
|
1
|
|
|
|
|
4
|
return $self->{masterGuid}; |
337
|
|
|
|
|
|
|
} |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=head2 url |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
Getter for the 'url" to access the REST server |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=cut |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
sub url { |
346
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
347
|
|
|
|
|
|
|
|
348
|
0
|
|
|
|
|
|
return '/rest/orgs'; |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=head1 SEE ALSO |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
http://support.crashplanpro.com/doku.php/api#org |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=head1 AUTHOR |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
Arnaud (Arhuman) Assad, copyright 2011 Jaguar Network |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=head1 LICENSE |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
This library is free software . You can redistribute it and/or modify |
362
|
|
|
|
|
|
|
it under the same terms as perl itself. |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
=cut |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
1; |