line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
29
|
use utf8; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
28
|
|
2
|
|
|
|
|
|
|
package Etcd3::User; |
3
|
|
|
|
|
|
|
|
4
|
5
|
|
|
5
|
|
176
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
82
|
|
5
|
5
|
|
|
5
|
|
19
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
92
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
20
|
use Moo; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
21
|
|
8
|
5
|
|
|
5
|
|
1351
|
use Carp; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
239
|
|
9
|
5
|
|
|
5
|
|
1504
|
use Etcd3::User::Role; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
154
|
|
10
|
5
|
|
|
5
|
|
33
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
23
|
|
11
|
5
|
|
|
5
|
|
4431
|
use Data::Dumper; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
228
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Etcd3::Role::Actions'; |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
5
|
|
25
|
use namespace::clean; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
20
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Etcd3::User |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.006'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
User class |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 ACCESSORS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 endpoint |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has endpoint => ( |
38
|
|
|
|
|
|
|
is => 'rwp', |
39
|
|
|
|
|
|
|
isa => Str, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 name |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
name of user |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has name => ( |
49
|
|
|
|
|
|
|
is => 'ro', |
50
|
|
|
|
|
|
|
isa => Str, |
51
|
|
|
|
|
|
|
required => 1, |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 password |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has password => ( |
59
|
|
|
|
|
|
|
is => 'ro', |
60
|
|
|
|
|
|
|
isa => Str, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 PUBLIC METHODS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 add |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$etcd->user({ name =>'foo' password => 'bar' })->add |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub add { |
72
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
73
|
0
|
|
|
|
|
|
$self->{endpoint} = '/auth/user/add'; |
74
|
|
|
|
|
|
|
confess 'password required for ' . __PACKAGE__ . '->add' |
75
|
0
|
0
|
|
|
|
|
unless $self->{password}; |
76
|
0
|
|
|
|
|
|
$self->request; |
77
|
0
|
|
|
|
|
|
return $self; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 delete |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$etcd->user({ name =>'foo' })->delete |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub delete { |
87
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
88
|
0
|
|
|
|
|
|
$self->{endpoint} = '/auth/user/delete'; |
89
|
0
|
|
|
|
|
|
$self->request; |
90
|
0
|
|
|
|
|
|
return $self; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |