line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
14
|
use utf8; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
14
|
|
2
|
|
|
|
|
|
|
package Etcd3::Auth::RoleAdd; |
3
|
|
|
|
|
|
|
|
4
|
4
|
|
|
4
|
|
121
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
59
|
|
5
|
4
|
|
|
4
|
|
10
|
use warnings; |
|
4
|
|
|
|
|
2
|
|
|
4
|
|
|
|
|
66
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
11
|
use Moo; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
15
|
|
8
|
4
|
|
|
4
|
|
731
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
4
|
|
|
|
|
75
|
|
|
4
|
|
|
|
|
19
|
|
9
|
4
|
|
|
4
|
|
2006
|
use MIME::Base64; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
170
|
|
10
|
4
|
|
|
4
|
|
13
|
use JSON; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
21
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Etcd3::Role::Actions'; |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
331
|
use namespace::clean; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
18
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Etcd3::Auth::RoleAdd |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Add user |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 endpoint |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has endpoint => ( |
33
|
|
|
|
|
|
|
is => 'ro', |
34
|
|
|
|
|
|
|
isa => Str, |
35
|
|
|
|
|
|
|
default => '/auth/role/add' |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 name |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
name of role |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has name => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
isa => Str, |
47
|
|
|
|
|
|
|
required => 1, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 json_args |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
arguments that will be sent to the api |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has json_args => ( |
57
|
|
|
|
|
|
|
is => 'lazy', |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _build_json_args { |
61
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
62
|
0
|
|
|
|
|
|
my $args; |
63
|
0
|
|
|
|
|
|
for my $key ( keys %{ $self }) { |
|
0
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
unless ( $key =~ /(?:_client|json_args|endpoint)$/ ) { |
65
|
0
|
|
|
|
|
|
$args->{$key} = $self->{$key}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
0
|
|
|
|
|
|
return to_json($args); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 init |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub init { |
76
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
77
|
0
|
|
|
|
|
|
my $init = $self->json_args; |
78
|
0
|
0
|
|
|
|
|
$init or return; |
79
|
0
|
|
|
|
|
|
return $self; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |