line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=encoding utf-8 |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Webservice::OVH::Cloud::Project::Image |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Webservice::OVH; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $projects = $ovh->cloud->projects; |
15
|
|
|
|
|
|
|
my $example_project = $projects->[0]; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $images = $project->images; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
foreach my $image (@$images) { |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
print $image->type; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Provides access to information about an image. Nothing more can be done with this. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 METHODS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use strict; |
33
|
36
|
|
|
36
|
|
240
|
use warnings; |
|
36
|
|
|
|
|
93
|
|
|
36
|
|
|
|
|
1112
|
|
34
|
36
|
|
|
36
|
|
190
|
use Carp qw{ carp croak }; |
|
36
|
|
|
|
|
112
|
|
|
36
|
|
|
|
|
1093
|
|
35
|
36
|
|
|
36
|
|
181
|
|
|
36
|
|
|
|
|
75
|
|
|
36
|
|
|
|
|
25405
|
|
36
|
|
|
|
|
|
|
our $VERSION = 0.47; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 _new_existing |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Internal Method to create the image object. |
41
|
|
|
|
|
|
|
This method is not ment to be called directly. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=over |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item * Parameter: %params - key => value |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Cloud::Project::Image> |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Cloud::Project::Image->_new(wrapper => $ovh_api_wrapper, project => $project, module => $module, id => $id ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=back |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my ( $class, %params ) = @_; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
|
|
die "Missing id" unless $params{id}; |
59
|
|
|
|
|
|
|
die "Missing module" unless $params{module}; |
60
|
0
|
0
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
61
|
0
|
0
|
|
|
|
|
die "Missing project" unless $params{project}; |
62
|
0
|
0
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
my $project = $params{project}; |
64
|
|
|
|
|
|
|
my $project_id = $project->id; |
65
|
0
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
66
|
0
|
|
|
|
|
|
my $module = $params{module}; |
67
|
0
|
|
|
|
|
|
my $image_id = $params{id}; |
68
|
0
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my $response = $api_wrapper->rawCall( method => 'get', path => "/cloud/project/$project_id/image/$image_id", noSignature => 0 ); |
70
|
|
|
|
|
|
|
carp $response->error if $response->error; |
71
|
0
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
if ( !$response->error ) { |
73
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
my $porperties = $response->content; |
75
|
|
|
|
|
|
|
my $self = bless { _module => $module, _valid => 1, _api_wrapper => $api_wrapper, _id => $image_id, _properties => $porperties, _project => $project }, $class; |
76
|
0
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
return $self; |
78
|
|
|
|
|
|
|
} else { |
79
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
return undef; |
81
|
|
|
|
|
|
|
} |
82
|
0
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 project |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Root Project. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=over |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Cloud::Project> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * Synopsis: my $project = $ssh_key->project; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=back |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my ($self) = @_; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
return $self->{_project}; |
102
|
0
|
|
|
0
|
1
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
=head2 id |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Returns the api id |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=over |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item * Return: VALUE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * Synopsis: my $id = $image->id; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=back |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my ($self) = @_; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
return $self->{_id}; |
122
|
|
|
|
|
|
|
} |
123
|
0
|
|
|
0
|
1
|
|
|
124
|
|
|
|
|
|
|
=head2 properties |
125
|
0
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Returns the raw properties as a hash. |
127
|
|
|
|
|
|
|
This is the original return value of the web-api. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=over |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item * Return: HASH |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * Synopsis: my $properties = $image->properties; |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=back |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
my ($self) = @_; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
143
|
|
|
|
|
|
|
my $project_id = $self->project->id; |
144
|
|
|
|
|
|
|
my $image_id = $self->id; |
145
|
0
|
|
|
0
|
1
|
|
my $response = $api->rawCall( method => 'get', path => "/cloud/project/$project_id/image/$image_id", noSignature => 0 ); |
146
|
|
|
|
|
|
|
croak $response->error if $response->error; |
147
|
0
|
|
|
|
|
|
$self->{_properties} = $response->content; |
148
|
0
|
|
|
|
|
|
return $self->{_properties}; |
149
|
0
|
|
|
|
|
|
} |
150
|
0
|
|
|
|
|
|
|
151
|
0
|
0
|
|
|
|
|
=head2 visibility |
152
|
0
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
Exposed property value. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=over |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * Return: VALUE |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * Synopsis: my $visibility = $image->visibility; |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=back |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
my ($self) = @_; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
return $self->{_properties}->{visibility}; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 status |
172
|
0
|
|
|
0
|
1
|
|
|
173
|
|
|
|
|
|
|
Exposed property value. |
174
|
0
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=over |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * Return: VALUE |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item * Synopsis: my $status = $image->status; |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=back |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=cut |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
my ($self) = @_; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
return $self->{_properties}->{status}; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head2 name |
192
|
|
|
|
|
|
|
|
193
|
0
|
|
|
0
|
1
|
|
Exposed property value. |
194
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
=over |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item * Return: VALUE |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item * Synopsis: my $name = $image->name; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=back |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=cut |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
my ($self) = @_; |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
return $self->{_properties}->{name}; |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 region |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Exposed property value. |
214
|
0
|
|
|
0
|
1
|
|
|
215
|
|
|
|
|
|
|
=over |
216
|
0
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item * Return: VALUE |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=item * Synopsis: my $region = $image->region; |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=back |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=cut |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
my ($self) = @_; |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
return $self->{_properties}->{region}; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head2 min_disk |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
Exposed property value. |
234
|
|
|
|
|
|
|
|
235
|
0
|
|
|
0
|
1
|
|
=over |
236
|
|
|
|
|
|
|
|
237
|
0
|
|
|
|
|
|
=item * Return: VALUE |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=item * Synopsis: my $min_disk = $image->min_disk; |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=back |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=cut |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
my ($self) = @_; |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
return $self->{_properties}->{minDisk}; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head2 size |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Exposed property value. |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=over |
256
|
0
|
|
|
0
|
1
|
|
|
257
|
|
|
|
|
|
|
=item * Return: VALUE |
258
|
0
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=item * Synopsis: my $size = $image->size; |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=back |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=cut |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
my ($self) = @_; |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
return $self->{_properties}->{size}; |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head2 creation_date |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
Exposed property value. |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=over |
276
|
|
|
|
|
|
|
|
277
|
0
|
|
|
0
|
1
|
|
=item * Return: DateTime |
278
|
|
|
|
|
|
|
|
279
|
0
|
|
|
|
|
|
=item * Synopsis: my $creation_date = $image->creation_date; |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=back |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=cut |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
my ($self) = @_; |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
my $str_datetime = $self->{_properties}->{creationDate}; |
289
|
|
|
|
|
|
|
my $datetime = Webservice::OVH::Helper->parse_datetime($str_datetime); |
290
|
|
|
|
|
|
|
return $datetime; |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head2 min_ram |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
Exposed property value. |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=over |
298
|
0
|
|
|
0
|
1
|
|
|
299
|
|
|
|
|
|
|
=item * Return: VALUE |
300
|
0
|
|
|
|
|
|
|
301
|
0
|
|
|
|
|
|
=item * Synopsis: my $min_ram = $image->min_ram; |
302
|
0
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=back |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=cut |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
my ($self) = @_; |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
return $self->{_properties}->{minRam}; |
311
|
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=head2 user |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
Exposed property value. |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=over |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=item * Return: VALUE |
320
|
|
|
|
|
|
|
|
321
|
0
|
|
|
0
|
1
|
|
=item * Synopsis: my $user = $image->user; |
322
|
|
|
|
|
|
|
|
323
|
0
|
|
|
|
|
|
=back |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
=cut |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
my ($self) = @_; |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
return $self->{_properties}->{user}; |
331
|
|
|
|
|
|
|
} |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=head2 type |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
Exposed property value. |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=over |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=item * Return: VALUE |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=item * Synopsis: my $type = $image->type; |
342
|
0
|
|
|
0
|
1
|
|
|
343
|
|
|
|
|
|
|
=back |
344
|
0
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=cut |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
my ($self) = @_; |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
return $self->{_properties}->{type}; |
351
|
|
|
|
|
|
|
} |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
1; |