| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::DigitalOcean; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Access the DigitalOcean RESTful API (v2) |
|
3
|
2
|
|
|
2
|
|
100980
|
use Moo; |
|
|
2
|
|
|
|
|
16586
|
|
|
|
2
|
|
|
|
|
9
|
|
|
4
|
2
|
|
|
2
|
|
2999
|
use Types::Standard qw/Str/; |
|
|
2
|
|
|
|
|
102898
|
|
|
|
2
|
|
|
|
|
20
|
|
|
5
|
2
|
|
|
2
|
|
2667
|
use LWP::UserAgent; |
|
|
2
|
|
|
|
|
58644
|
|
|
|
2
|
|
|
|
|
54
|
|
|
6
|
2
|
|
|
2
|
|
1211
|
use JSON (); |
|
|
2
|
|
|
|
|
15861
|
|
|
|
2
|
|
|
|
|
42
|
|
|
7
|
2
|
|
|
2
|
|
1522
|
use DateTime; |
|
|
2
|
|
|
|
|
643201
|
|
|
|
2
|
|
|
|
|
78
|
|
|
8
|
2
|
|
|
2
|
|
16
|
use utf8; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with |
|
11
|
|
|
|
|
|
|
'WebService::DigitalOcean::Role::UserAgent', |
|
12
|
|
|
|
|
|
|
'WebService::DigitalOcean::Role::Domains', |
|
13
|
|
|
|
|
|
|
'WebService::DigitalOcean::Role::DomainRecords', |
|
14
|
|
|
|
|
|
|
'WebService::DigitalOcean::Role::Droplets', |
|
15
|
|
|
|
|
|
|
'WebService::DigitalOcean::Role::DropletActions', |
|
16
|
|
|
|
|
|
|
'WebService::DigitalOcean::Role::Keys', |
|
17
|
|
|
|
|
|
|
'WebService::DigitalOcean::Role::Regions', |
|
18
|
|
|
|
|
|
|
'WebService::DigitalOcean::Role::Sizes', |
|
19
|
|
|
|
|
|
|
'WebService::DigitalOcean::Role::Images'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.025'; # VERSION |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has api_base_url => ( |
|
24
|
|
|
|
|
|
|
is => 'ro', |
|
25
|
|
|
|
|
|
|
isa => Str, |
|
26
|
|
|
|
|
|
|
default => sub { 'https://api.digitalocean.com/v2' } |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has token => ( |
|
30
|
|
|
|
|
|
|
is => 'ro', |
|
31
|
|
|
|
|
|
|
isa => Str, |
|
32
|
|
|
|
|
|
|
required => 1, |
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=pod |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=encoding UTF-8 |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
WebService::DigitalOcean - Access the DigitalOcean RESTful API (v2) |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 VERSION |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
version 0.025 |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
use WebService::DigitalOcean; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $do = WebService::DigitalOcean->new({ token => $TOKEN }); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
### |
|
58
|
|
|
|
|
|
|
## Upload your public ssh key |
|
59
|
|
|
|
|
|
|
### |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
open my $fh, '<', $ENV{HOME} . '/.ssh/id_rsa.pub'; |
|
62
|
|
|
|
|
|
|
my $key = $do->key_create({ |
|
63
|
|
|
|
|
|
|
name => 'Andre Walker', |
|
64
|
|
|
|
|
|
|
public_key => do { local $/ = <$fh> }, |
|
65
|
|
|
|
|
|
|
}); |
|
66
|
|
|
|
|
|
|
close $fh; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
### |
|
69
|
|
|
|
|
|
|
## Select a random available region to create a droplet |
|
70
|
|
|
|
|
|
|
### |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my @regions = grep { $_->{available} } @{ $do->region_list->{content} }; |
|
73
|
|
|
|
|
|
|
my $random_region = $regions[rand @regions]; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
### |
|
76
|
|
|
|
|
|
|
## Create droplets! |
|
77
|
|
|
|
|
|
|
### |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $droplet1_res = $do->droplet_create({ |
|
80
|
|
|
|
|
|
|
name => 'server1.example.com', |
|
81
|
|
|
|
|
|
|
region => $random_region->{slug}, |
|
82
|
|
|
|
|
|
|
size => '1gb', |
|
83
|
|
|
|
|
|
|
image => 'ubuntu-14-04-x64', |
|
84
|
|
|
|
|
|
|
ssh_keys => [ $key->{content}{fingerprint} ], |
|
85
|
|
|
|
|
|
|
}); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
die "Could not create droplet 1" unless $droplet1_res->{is_success}; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
my $droplet2_res = $do->droplet_create({ |
|
90
|
|
|
|
|
|
|
name => 'server2.example.com', |
|
91
|
|
|
|
|
|
|
region => $random_region->{slug}, |
|
92
|
|
|
|
|
|
|
size => '1gb', |
|
93
|
|
|
|
|
|
|
image => 'ubuntu-14-04-x64', |
|
94
|
|
|
|
|
|
|
ssh_keys => [ $key->{content}{fingerprint} ], |
|
95
|
|
|
|
|
|
|
}); |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
die "Could not create droplet 2" unless $droplet2_res->{is_success}; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
### |
|
100
|
|
|
|
|
|
|
## Create domains |
|
101
|
|
|
|
|
|
|
### |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $subdomain1_res = $do->domain_record_create({ |
|
104
|
|
|
|
|
|
|
domain => 'example.com', |
|
105
|
|
|
|
|
|
|
type => 'A', |
|
106
|
|
|
|
|
|
|
name => 'server1', |
|
107
|
|
|
|
|
|
|
data => $droplet1_res->{content}{networks}{v4}{ip_address}, |
|
108
|
|
|
|
|
|
|
}); |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
die "Could not create subdomain server1" unless $subdomain1_res->{is_success}; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
my $subdomain2_res = $do->domain_create({ |
|
113
|
|
|
|
|
|
|
domain => 'example.com', |
|
114
|
|
|
|
|
|
|
type => 'A', |
|
115
|
|
|
|
|
|
|
name => 'server2', |
|
116
|
|
|
|
|
|
|
data => $droplet2_res->{content}{networks}{v4}{ip_address}, |
|
117
|
|
|
|
|
|
|
}); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
die "Could not create subdomain server2" unless $subdomain2_res->{is_success}; |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This module implements DigitalOceans new RESTful API. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 api_base_url |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
A string prepended to all API endpoints. By default, it's |
|
130
|
|
|
|
|
|
|
https://api.digitalocean.com/v2. This can be adjusted to facilitate tests. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 token |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
The authorization token. It can be retrieved by logging into one's DigitalOcean |
|
135
|
|
|
|
|
|
|
account, and generating a personal token here: |
|
136
|
|
|
|
|
|
|
L<< https://cloud.digitalocean.com/settings/applications >>. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 METHODS |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 domain_create |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
my $res = $do->domain_create({ |
|
143
|
|
|
|
|
|
|
name => 'example.com', |
|
144
|
|
|
|
|
|
|
ip_address => '12.34.56.78', |
|
145
|
|
|
|
|
|
|
}); |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
B<Arguments:> |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=over |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item C<Str> $args{name} |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
The domain name. |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item C<Str> $args{ip_address} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
The IP address the domain will point to. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=back |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Creates a new top level domain. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#create-a-new-domain >>. |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 domain_delete |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
$do->domain_delete('example.com'); |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
B<Arguments:> |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=over |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item C<Str> $domain |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
The domain name. |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=back |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Deletes the specified domain. |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#delete-a-domain >>. |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 domain_get |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
my $response = $do->domain_get('example.com'); |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
B<Arguments:> |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=over |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item C<Str> $domain |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
The domain name. |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=back |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Retrieves the specified domain. |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#retrieve-an-existing-domain >>. |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head2 domain_list |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
my $response = $do->domain_list(); |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
for (@{ $response->{content} }) { |
|
206
|
|
|
|
|
|
|
say $_->{id}; |
|
207
|
|
|
|
|
|
|
} |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Lists all domains for this account. |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#list-all-domains >>. |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 domain_record_create |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
my $response = $do->domain_record_create({ |
|
216
|
|
|
|
|
|
|
domain => 'example.com', |
|
217
|
|
|
|
|
|
|
type => 'A', |
|
218
|
|
|
|
|
|
|
name => 'www2', |
|
219
|
|
|
|
|
|
|
data => '12.34.56.78', |
|
220
|
|
|
|
|
|
|
}); |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
my $id = $response->{content}{id}; |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
B<Arguments:> |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=over |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item C<Str> $args{domain} |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
The domain under which the record will be created. |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=item C<Str> $args{type} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
The type of the record (eg MX, CNAME, A, etc). |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item C<Str> $args{name} (optional) |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
The name of the record. |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=item C<Str> $args{data} (optional) |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
The data (such as the IP address) of the record. |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=item C<Int> $args{priority} (optional) |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Priority, for MX or SRV records. |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=item C<Int> $args{port} (optional) |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
The port, for SRV records. |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=item C<Int> $args{weight} (optional) |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
The weight, for SRV records. |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=back |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Creates a new record for a domain. |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#create-a-new-domain-record >>. |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head2 domain_record_delete |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
$do->domain_record_delete({ |
|
265
|
|
|
|
|
|
|
domain => 'example.com', |
|
266
|
|
|
|
|
|
|
id => 1215, |
|
267
|
|
|
|
|
|
|
}); |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
B<Arguments:> |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=over |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=item C<Str> $args{domain} |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
The domain to which the record belongs. |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=item C<Int> $args{id} |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
The id of the record. |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=back |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
Deletes the specified record. |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#delete-a-domain-record >>. |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=head2 domain_record_get |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
my $response = $do->domain_record_get({ |
|
290
|
|
|
|
|
|
|
domain => 'example.com', |
|
291
|
|
|
|
|
|
|
id => 1215, |
|
292
|
|
|
|
|
|
|
}); |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
my $ip = $response->{content}{data}; |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
B<Arguments:> |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=over |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=item C<Str> $args{domain} |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
The domain to which the record belongs. |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
=item C<Int> $args{id} |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
The id of the record. |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=back |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
Retrieves details about a particular record, identified by id. |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#retrieve-an-existing-domain-record >>. |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=head2 domain_record_list |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
my $response = $do->domain_record_list('example.com'); |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
for (@{ $response->{content} }) { |
|
319
|
|
|
|
|
|
|
print "$_->{name} => $_->{data}\n"; |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
B<Arguments:> |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=over |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=item C<Str> $domain |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
The domain to which the records belong. |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=back |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
Retrieves all the records for a particular domain. |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#list-all-domain-records >>. |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=head2 droplet_create |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
$do->droplet_create( |
|
339
|
|
|
|
|
|
|
name => "My-Droplet", |
|
340
|
|
|
|
|
|
|
region => "nyc1", |
|
341
|
|
|
|
|
|
|
size => "512mb", |
|
342
|
|
|
|
|
|
|
image => 449676389, |
|
343
|
|
|
|
|
|
|
ssh_keys => [ 52341234, 215124, 64325534 ], |
|
344
|
|
|
|
|
|
|
backups => 0, |
|
345
|
|
|
|
|
|
|
ipv6 => 1, |
|
346
|
|
|
|
|
|
|
private_networking => 0, |
|
347
|
|
|
|
|
|
|
); |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
B<Arguments:> |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=over |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=item C<Str> $args{name} |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=item C<Str> $args{region} |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=item C<Str> $args{size} |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=item C<Str> $args{image} |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
=item C<Str> $args{user_data} (optional) |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=item C<ArrayRef> $args{ssh_keys} (optional) |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=item C<Bool> $args{backups} (optional) |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=item C<Bool> $args{ipv6} (optional) |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=item C<Bool> $args{private_networking} (optional) |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=back |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
Creates a new droplet. |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#create-a-new-droplet >>. |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=head2 droplet_delete |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
$do->droplet_delete(1250928); |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
B<Arguments:> |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=over |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=item C<Int> $id |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=back |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
Deletes the specified droplet. |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#delete-a-droplet >>. |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=head2 droplet_get |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
my $response = $do->droplet_get(15314123); |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
B<Arguments:> |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=over |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=item C<Int> $id |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=back |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
Retrieves the specified droplet. |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#retrieve-an-existing-droplet-by-id >>. |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=head2 droplet_list |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
my $response = $do->droplet_list(); |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
for (@{ $response->{content} }) { |
|
414
|
|
|
|
|
|
|
print $_->{id}; |
|
415
|
|
|
|
|
|
|
} |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
Lists all droplets for this account. |
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#list-all-droplets >>. |
|
420
|
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=head2 droplet_resize |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
$do->droplet_resize({ |
|
424
|
|
|
|
|
|
|
droplet => 123456, |
|
425
|
|
|
|
|
|
|
disk => 1, |
|
426
|
|
|
|
|
|
|
size => '1gb', |
|
427
|
|
|
|
|
|
|
}); |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
B<Arguments:> |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=over |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=item C<Int> $args{droplet} |
|
434
|
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=item C<Bool> $args{disk} |
|
436
|
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=item C<Str> $args{size} |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=back |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
Resizes a droplet. |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#resize-a-droplet >>. |
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=head2 droplet_change_kernel |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
$do->droplet_change_kernel({ |
|
448
|
|
|
|
|
|
|
droplet => 123456, |
|
449
|
|
|
|
|
|
|
kernel => 654321, |
|
450
|
|
|
|
|
|
|
}); |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
B<Arguments:> |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=over |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
=item C<Int> $args{droplet} |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
=item C<Int> $args{kernel} |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=back |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
Changes the kernel of a droplet. |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#change-the-kernel >>. |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=head2 droplet_rebuild |
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
$do->droplet_rebuild({ |
|
469
|
|
|
|
|
|
|
droplet => 123456, |
|
470
|
|
|
|
|
|
|
image => 654321, |
|
471
|
|
|
|
|
|
|
}); |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
B<Arguments:> |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=over |
|
476
|
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
=item C<Int> $args{droplet} |
|
478
|
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
=item C<Str> $args{image} |
|
480
|
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
=back |
|
482
|
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
Rebuilds a droplet. |
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#rebuild-a-droplet >>. |
|
486
|
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
=head2 droplet_restore |
|
488
|
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
$do->droplet_rebuild({ |
|
490
|
|
|
|
|
|
|
droplet => 123456, |
|
491
|
|
|
|
|
|
|
image => 654321, |
|
492
|
|
|
|
|
|
|
}); |
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
B<Arguments:> |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
=over |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=item C<Int> $args{droplet} |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
=item C<Str> $args{image} |
|
501
|
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
=back |
|
503
|
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
Restores a droplet to an image backup. |
|
505
|
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#restore-a-droplet >>. |
|
507
|
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
=head2 droplet_rename |
|
509
|
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
$do->droplet_rename({ |
|
511
|
|
|
|
|
|
|
droplet => 123456, |
|
512
|
|
|
|
|
|
|
name => 'new-name', |
|
513
|
|
|
|
|
|
|
}); |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
B<Arguments:> |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=over |
|
518
|
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=item C<Int> $args{droplet} |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
=item C<Str> $args{name} |
|
522
|
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=back |
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
Renames a droplet, thus setting the reverse DNS. |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#rename-a-droplet >>. |
|
528
|
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
=head2 droplet_snapshot |
|
530
|
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
$do->droplet_rebuild({ |
|
532
|
|
|
|
|
|
|
droplet => 123456, |
|
533
|
|
|
|
|
|
|
name => 'snapshot-name', |
|
534
|
|
|
|
|
|
|
}); |
|
535
|
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
B<Arguments:> |
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=over |
|
539
|
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
=item C<Int> $args{droplet} |
|
541
|
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
=item C<Str> $args{name} |
|
543
|
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
=back |
|
545
|
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
Saves a snapshopt of the droplet. |
|
547
|
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#rebuild-a-droplet >>. |
|
549
|
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
=head2 droplet_reboot |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
$do->droplet_reboot(123456); |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
B<Arguments:> |
|
555
|
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
=over |
|
557
|
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
=item C<Int> $droplet_id |
|
559
|
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
=back |
|
561
|
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
Reboots droplet. |
|
563
|
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#reboot-a-droplet >>. |
|
565
|
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
=head2 droplet_power_cycle |
|
567
|
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
$do->droplet_power_cycle(123456); |
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
B<Arguments:> |
|
571
|
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
=over |
|
573
|
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
=item C<Int> $droplet_id |
|
575
|
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
=back |
|
577
|
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
Power cycles droplet. |
|
579
|
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#power-cycle-a-droplet >>. |
|
581
|
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=head2 droplet_power_on |
|
583
|
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
$do->droplet_power_on(123456); |
|
585
|
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
B<Arguments:> |
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
=over |
|
589
|
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
=item C<Int> $droplet_id |
|
591
|
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
=back |
|
593
|
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
Powers on droplet. |
|
595
|
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#power-on-a-droplet >>. |
|
597
|
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
=head2 droplet_power_off |
|
599
|
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
$do->droplet_power_off(123456); |
|
601
|
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
B<Arguments:> |
|
603
|
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
=over |
|
605
|
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
=item C<Int> $droplet_id |
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
=back |
|
609
|
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
Powers off droplet. |
|
611
|
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#power-off-a-droplet >>. |
|
613
|
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
=head2 droplet_password_reset |
|
615
|
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
$do->droplet_password_reset(123456); |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
B<Arguments:> |
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
=over |
|
621
|
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
=item C<Int> $droplet_id |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
=back |
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
Resets the root password of the droplet. |
|
627
|
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#password-reset-a-droplet >>. |
|
629
|
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=head2 droplet_shutdown |
|
631
|
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
$do->droplet_shutdown(123456); |
|
633
|
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
B<Arguments:> |
|
635
|
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
=over |
|
637
|
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
=item C<Int> $droplet_id |
|
639
|
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
=back |
|
641
|
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
Shuts down a droplet |
|
643
|
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#shutdown-a-droplet >>. |
|
645
|
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
=head2 droplet_enable_ipv6 |
|
647
|
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
$do->droplet_enable_ipv6(123456); |
|
649
|
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
B<Arguments:> |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
=over |
|
653
|
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=item C<Int> $droplet_id |
|
655
|
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
=back |
|
657
|
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
Enables IPv6 in a droplet. |
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#enable-ipv6 >>. |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
=head2 droplet_enable_private_networking |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
$do->droplet_enable_private_networking(123456); |
|
665
|
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
B<Arguments:> |
|
667
|
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
=over |
|
669
|
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
=item C<Int> $droplet_id |
|
671
|
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
=back |
|
673
|
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
Enables private networking for a droplet. |
|
675
|
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#enable-private-networking >>. |
|
677
|
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
=head2 droplet_disable_backups |
|
679
|
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
$do->droplet_disable_backups(123456); |
|
681
|
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
B<Arguments:> |
|
683
|
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
=over |
|
685
|
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
=item C<Int> $droplet_id |
|
687
|
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
=back |
|
689
|
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
Disables backups for the droplet. |
|
691
|
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#disable-backups >>. |
|
693
|
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
=head2 droplet_action_get |
|
695
|
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
$do->droplet_action_get({ |
|
697
|
|
|
|
|
|
|
droplet => 123456, |
|
698
|
|
|
|
|
|
|
action => 53, |
|
699
|
|
|
|
|
|
|
}); |
|
700
|
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
B<Arguments:> |
|
702
|
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
=over |
|
704
|
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
=item C<Int> $args{droplet} |
|
706
|
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
=item C<Int> $args{action} |
|
708
|
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
=back |
|
710
|
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
Retrieve details from a specific action. |
|
712
|
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#retrieve-a-droplet-action >>. |
|
714
|
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
=head2 key_create |
|
716
|
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
my $response = $do->key_create({ |
|
718
|
|
|
|
|
|
|
name => 'my public key', |
|
719
|
|
|
|
|
|
|
public_key => <$public_key_fh>, |
|
720
|
|
|
|
|
|
|
}); |
|
721
|
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
B<Arguments:> |
|
723
|
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=over |
|
725
|
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
=item C<Str> $args{name} |
|
727
|
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
=item C<Str> $args{public_key} |
|
729
|
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
=back |
|
731
|
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
Creates a new ssh key for this account. |
|
733
|
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#create-a-new-key >>. |
|
735
|
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
=head2 key_delete |
|
737
|
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
$do->key_delete({ id => 146432 }); |
|
739
|
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
B<Arguments:> |
|
741
|
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
=over |
|
743
|
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
=item C<Int> $args{id} I<OR> |
|
745
|
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
=item C<Str> $args{fingerprint} |
|
747
|
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=back |
|
749
|
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
Deletes the specified ssh key. |
|
751
|
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#destroy-a-key >>. |
|
753
|
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
=head2 key_get |
|
755
|
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
my $response = $do->key_get({ id => 1215 }); |
|
757
|
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
B<Arguments:> |
|
759
|
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
=over |
|
761
|
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
=item C<Int> $args{id} I<OR> |
|
763
|
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
=item C<Str> $args{fingerprint} |
|
765
|
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
=back |
|
767
|
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
Retrieves details about a particular ssh key, identified by id or fingerprint (pick one). |
|
769
|
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#retrieve-an-existing-key >>. |
|
771
|
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
=head2 key_list |
|
773
|
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
Retrieves all the keys for this account. |
|
775
|
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#list-all-keys >>. |
|
777
|
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=head2 region_list |
|
779
|
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
my $regions = $do->region_list(); |
|
781
|
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
for my $r (@{ $regions->{content} }) { |
|
783
|
|
|
|
|
|
|
if ($r->{available}) { |
|
784
|
|
|
|
|
|
|
say "$r->{name} is available"; |
|
785
|
|
|
|
|
|
|
} |
|
786
|
|
|
|
|
|
|
} |
|
787
|
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
Retrieves all the regions available in Digital Ocean. |
|
789
|
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#list-all-regions >>. |
|
791
|
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
=head2 size_list |
|
793
|
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
Retrieves all the sizes available in Digital Ocean. |
|
795
|
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
my $sizes = $do->size_list(); |
|
797
|
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
for my $s (@{ $sizes->{content} }) { |
|
799
|
|
|
|
|
|
|
say "Size $s->{slug} costs $s->{price_hourly} per hour."; |
|
800
|
|
|
|
|
|
|
} |
|
801
|
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#list-all-sizes >>. |
|
803
|
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
=head2 image_list |
|
805
|
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
Retrieves all the images available in Digital Ocean. |
|
807
|
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
my $images = $do->image_list(); |
|
809
|
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
for my $i (@{ $images->{content} }) { |
|
811
|
|
|
|
|
|
|
say join "\t", $i->{distribution}, $i->{id}, $i->{name}; |
|
812
|
|
|
|
|
|
|
} |
|
813
|
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
More info: L<< https://developers.digitalocean.com/documentation/v2/#list-all-images >>. |
|
815
|
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
817
|
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
=over |
|
819
|
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
=item L<DigitalOcean> |
|
821
|
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
First DigitalOcean module, uses v1 API. It has a more OO |
|
823
|
|
|
|
|
|
|
approach than this module, and might have a more stable interface at the |
|
824
|
|
|
|
|
|
|
moment. |
|
825
|
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
=item L<< https://developers.digitalocean.com/documentation/v2/ >> |
|
827
|
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
Documentation for API v2, in DigitalOcean's website. |
|
829
|
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
=back |
|
831
|
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
=head1 AUTHOR |
|
833
|
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
André Walker <andre@cpan.org> |
|
835
|
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
837
|
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by André Walker. |
|
839
|
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
This is free software, licensed under: |
|
841
|
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
The GNU General Public License, Version 2, June 1991 |
|
843
|
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
=cut |