line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
9
|
|
|
9
|
|
41
|
use utf8; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
32
|
|
2
|
|
|
|
|
|
|
package Net::Etcd::Auth::Role; |
3
|
|
|
|
|
|
|
|
4
|
9
|
|
|
9
|
|
252
|
use strict; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
115
|
|
5
|
9
|
|
|
9
|
|
29
|
use warnings; |
|
9
|
|
|
|
|
12
|
|
|
9
|
|
|
|
|
155
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
3616
|
use Moo; |
|
9
|
|
|
|
|
74763
|
|
|
9
|
|
|
|
|
32
|
|
8
|
9
|
|
|
9
|
|
9289
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
48
|
|
9
|
9
|
|
|
9
|
|
6238
|
use MIME::Base64; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
333
|
|
10
|
9
|
|
|
9
|
|
35
|
use Carp; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
345
|
|
11
|
9
|
|
|
9
|
|
40
|
use JSON; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
46
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Net::Etcd::Role::Actions'; |
14
|
|
|
|
|
|
|
|
15
|
9
|
|
|
9
|
|
3916
|
use namespace::clean; |
|
9
|
|
|
|
|
72421
|
|
|
9
|
|
|
|
|
41
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Net::Etcd::Auth::Role |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.022'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Role |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 endpoint |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has endpoint => ( |
34
|
|
|
|
|
|
|
is => 'rwp', |
35
|
|
|
|
|
|
|
isa => Str, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 name |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
name of role |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has name => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
isa => Str, |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 role |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
name of role |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has role => ( |
56
|
|
|
|
|
|
|
is => 'ro', |
57
|
|
|
|
|
|
|
isa => Str, |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 add |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Add role |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub add { |
67
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
68
|
|
|
|
|
|
|
confess 'name required for ' . __PACKAGE__ . '->add' |
69
|
0
|
0
|
|
|
|
|
unless $self->{name}; |
70
|
0
|
|
|
|
|
|
$self->{endpoint} = '/auth/role/add'; |
71
|
0
|
|
|
|
|
|
$self->request; |
72
|
0
|
|
|
|
|
|
return $self; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 delete |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Delete role |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub delete { |
82
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
83
|
|
|
|
|
|
|
confess 'role required for ' . __PACKAGE__ . '->delete' |
84
|
0
|
0
|
|
|
|
|
unless $self->{role}; |
85
|
0
|
|
|
|
|
|
$self->{endpoint} = '/auth/role/delete'; |
86
|
0
|
|
|
|
|
|
$self->request; |
87
|
0
|
|
|
|
|
|
return $self; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 get |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Get role |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub get { |
97
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
98
|
|
|
|
|
|
|
confess 'name required for ' . __PACKAGE__ . '->get' |
99
|
0
|
0
|
|
|
|
|
unless $self->{role}; |
100
|
0
|
|
|
|
|
|
$self->{endpoint} = '/auth/role/get'; |
101
|
0
|
|
|
|
|
|
$self->request; |
102
|
0
|
|
|
|
|
|
return $self; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 list |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
List roles |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub list { |
112
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
113
|
0
|
|
|
|
|
|
$self->{endpoint} = '/auth/role/list'; |
114
|
0
|
|
|
|
|
|
$self->{json_args} = '{}'; |
115
|
0
|
|
|
|
|
|
$self->request; |
116
|
0
|
|
|
|
|
|
return $self; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
1; |