line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::DigitalOcean::Role::Keys; |
2
|
|
|
|
|
|
|
# ABSTRACT: Keys role for DigitalOcean WebService |
3
|
2
|
|
|
2
|
|
1289
|
use utf8; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
16
|
|
4
|
2
|
|
|
2
|
|
65
|
use Moo::Role; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
15
|
|
5
|
2
|
|
|
2
|
|
659
|
use feature 'state'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
202
|
|
6
|
2
|
|
|
2
|
|
12
|
use Types::Standard qw/Str Int Object Dict Optional/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
17
|
|
7
|
2
|
|
|
2
|
|
1830
|
use Type::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
17
|
|
8
|
2
|
|
|
2
|
|
3195
|
use Type::Params qw/compile/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
14
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires 'make_request'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.024'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub key_create { |
15
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object, |
16
|
|
|
|
|
|
|
Dict[ |
17
|
|
|
|
|
|
|
name => Str, |
18
|
|
|
|
|
|
|
public_key => Str, |
19
|
|
|
|
|
|
|
], |
20
|
|
|
|
|
|
|
); |
21
|
0
|
|
|
|
|
|
my ($self, $opts) = $check->(@_); |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
return $self->make_request(POST => "/account/keys", $opts); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub key_list { |
27
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object); |
28
|
0
|
|
|
|
|
|
my ($self, $opts) = $check->(@_); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
return $self->make_request(GET => "/account/keys"); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub key_get { |
34
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object, |
35
|
|
|
|
|
|
|
Dict[ |
36
|
|
|
|
|
|
|
fingerprint => Optional[Str], |
37
|
|
|
|
|
|
|
id => Optional[Int], |
38
|
|
|
|
|
|
|
], |
39
|
|
|
|
|
|
|
); |
40
|
0
|
|
|
|
|
|
my ($self, $opts) = $check->(@_); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
0
|
|
|
|
my $id = $opts->{id} || $opts->{fingerprint}; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return $self->make_request(GET => "/account/keys/$id"); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub key_delete { |
48
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object, |
49
|
|
|
|
|
|
|
Dict[ |
50
|
|
|
|
|
|
|
fingerprint => Optional[Str], |
51
|
|
|
|
|
|
|
id => Optional[Int], |
52
|
|
|
|
|
|
|
], |
53
|
|
|
|
|
|
|
); |
54
|
0
|
|
|
|
|
|
my ($self, $opts) = $check->(@_); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
0
|
|
|
|
my $id = $opts->{id} || $opts->{fingerprint}; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $self->make_request(DELETE => "/account/keys/$id"); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |