line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::DigitalOcean::Role::Keys; |
2
|
|
|
|
|
|
|
# ABSTRACT: Keys role for DigitalOcean WebService |
3
|
2
|
|
|
2
|
|
845
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
4
|
2
|
|
|
2
|
|
46
|
use Moo::Role; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
11
|
|
5
|
2
|
|
|
2
|
|
415
|
use feature 'state'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
155
|
|
6
|
2
|
|
|
2
|
|
9
|
use Types::Standard qw/Str Int Object Dict Optional/; |
|
2
|
|
|
|
|
1
|
|
|
2
|
|
|
|
|
13
|
|
7
|
2
|
|
|
2
|
|
1144
|
use Type::Utils; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
9
|
|
8
|
2
|
|
|
2
|
|
1686
|
use Type::Params qw/compile/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires 'make_request'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.025'; # 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__ |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=pod |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=encoding UTF-8 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 NAME |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
WebService::DigitalOcean::Role::Keys - Keys role for DigitalOcean WebService |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 VERSION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
version 0.025 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Implements the SSH Keys methods. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 METHODS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 key_create |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 key_list |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 key_get |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 key_delete |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
See main documentation in L<WebService::DigitalOcean>. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHOR |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
André Walker <andre@cpan.org> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by André Walker. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This is free software, licensed under: |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The GNU General Public License, Version 2, June 1991 |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |