| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::Hetzner::Cloud::SSHKey; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Hetzner Cloud SSHKey object |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.100'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
25
|
|
|
25
|
|
167
|
use Moo; |
|
|
25
|
|
|
|
|
64
|
|
|
|
25
|
|
|
|
|
182
|
|
|
7
|
25
|
|
|
25
|
|
9468
|
use Carp qw(croak); |
|
|
25
|
|
|
|
|
50
|
|
|
|
25
|
|
|
|
|
1512
|
|
|
8
|
25
|
|
|
25
|
|
150
|
use namespace::clean; |
|
|
25
|
|
|
|
|
42
|
|
|
|
25
|
|
|
|
|
191
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has _client => ( |
|
12
|
|
|
|
|
|
|
is => 'ro', |
|
13
|
|
|
|
|
|
|
required => 1, |
|
14
|
|
|
|
|
|
|
weak_ref => 1, |
|
15
|
|
|
|
|
|
|
init_arg => 'client', |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has id => ( is => 'ro' ); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has name => ( is => 'rw' ); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has public_key => ( is => 'ro' ); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has fingerprint => ( is => 'ro' ); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has created => ( is => 'ro' ); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has labels => ( is => 'rw', default => sub { {} } ); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub update { |
|
37
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
38
|
0
|
0
|
|
|
|
|
croak "Cannot update SSH key without ID" unless $self->id; |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$self->_client->put("/ssh_keys/" . $self->id, { |
|
41
|
|
|
|
|
|
|
name => $self->name, |
|
42
|
|
|
|
|
|
|
labels => $self->labels, |
|
43
|
|
|
|
|
|
|
}); |
|
44
|
0
|
|
|
|
|
|
return $self; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub delete { |
|
49
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
50
|
0
|
0
|
|
|
|
|
croak "Cannot delete SSH key without ID" unless $self->id; |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
$self->_client->delete("/ssh_keys/" . $self->id); |
|
53
|
0
|
|
|
|
|
|
return 1; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub data { |
|
58
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
59
|
|
|
|
|
|
|
return { |
|
60
|
0
|
|
|
|
|
|
id => $self->id, |
|
61
|
|
|
|
|
|
|
name => $self->name, |
|
62
|
|
|
|
|
|
|
public_key => $self->public_key, |
|
63
|
|
|
|
|
|
|
fingerprint => $self->fingerprint, |
|
64
|
|
|
|
|
|
|
created => $self->created, |
|
65
|
|
|
|
|
|
|
labels => $self->labels, |
|
66
|
|
|
|
|
|
|
}; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |