| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::DigitalOcean::Role::Droplets; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Droplets role for DigitalOcean WebService |
|
3
|
2
|
|
|
2
|
|
1162
|
use utf8; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
10
|
|
|
4
|
2
|
|
|
2
|
|
63
|
use Moo::Role; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
14
|
|
|
5
|
2
|
|
|
2
|
|
481
|
use feature 'state'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
139
|
|
|
6
|
2
|
|
|
2
|
|
34
|
use Types::Standard qw/Str Object Dict ArrayRef Optional Bool Int/; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
32
|
|
|
7
|
2
|
|
|
2
|
|
1742
|
use Type::Utils; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
11
|
|
|
8
|
2
|
|
|
2
|
|
1938
|
use Type::Params qw/compile/; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
11
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires 'make_request'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.026'; # VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub droplet_create { |
|
15
|
1
|
|
|
1
|
1
|
1159
|
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
|
|
|
|
|
35062
|
my ($self, $opts) = $check->(@_); |
|
29
|
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
621
|
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__ |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=pod |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=encoding UTF-8 |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
WebService::DigitalOcean::Role::Droplets - Droplets role for DigitalOcean WebService |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 VERSION |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
version 0.026 |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Implements the droplets methods. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 METHODS |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 droplet_create |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 droplet_list |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 droplet_get |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 droplet_delete |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
See main documentation in L<WebService::DigitalOcean>. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 AUTHOR |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
André Walker <andre@cpan.org> |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by André Walker. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This is free software, licensed under: |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
The GNU General Public License, Version 2, June 1991 |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |