line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::DigitalOcean::Role::Droplets; |
2
|
|
|
|
|
|
|
# ABSTRACT: Droplets role for DigitalOcean WebService |
3
|
2
|
|
|
2
|
|
1217
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
4
|
2
|
|
|
2
|
|
62
|
use Moo::Role; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
5
|
2
|
|
|
2
|
|
570
|
use feature 'state'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
154
|
|
6
|
2
|
|
|
2
|
|
45
|
use Types::Standard qw/Str Object Dict ArrayRef Optional Bool Int/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
18
|
|
7
|
2
|
|
|
2
|
|
2062
|
use Type::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
8
|
2
|
|
|
2
|
|
2616
|
use Type::Params qw/compile/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires 'make_request'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.024'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub droplet_create { |
15
|
1
|
|
|
1
|
1
|
82698
|
state $check = compile(Object, |
16
|
|
|
|
|
|
|
Dict[ |
17
|
|
|
|
|
|
|
name => Str, |
18
|
|
|
|
|
|
|
region => Str, |
19
|
|
|
|
|
|
|
size => Str, |
20
|
|
|
|
|
|
|
image => Str, |
21
|
|
|
|
|
|
|
user_data => Optional[ Str ], |
22
|
|
|
|
|
|
|
ssh_keys => Optional[ ArrayRef ], |
23
|
|
|
|
|
|
|
backups => Optional[ Bool ], |
24
|
|
|
|
|
|
|
ipv6 => Optional[ Bool ], |
25
|
|
|
|
|
|
|
private_networking => Optional[ Bool ], |
26
|
|
|
|
|
|
|
], |
27
|
|
|
|
|
|
|
); |
28
|
1
|
|
|
|
|
159900
|
my ($self, $opts) = $check->(@_); |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
263
|
return $self->make_request(POST => '/droplets', $opts); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub droplet_list { |
34
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object); |
35
|
0
|
|
|
|
|
|
my ($self) = $check->(@_); |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return $self->make_request(GET => '/droplets'); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub droplet_get { |
41
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object, Int); |
42
|
0
|
|
|
|
|
|
my ($self, $id) = $check->(@_); |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return $self->make_request(GET => "/droplets/$id"); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub droplet_delete { |
48
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object, Int); |
49
|
0
|
|
|
|
|
|
my ($self, $id) = $check->(@_); |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return $self->make_request(DELETE => "/droplets/$id"); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |