line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
9
|
|
|
9
|
|
47
|
use utf8; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
50
|
|
2
|
|
|
|
|
|
|
package Net::Etcd::User; |
3
|
|
|
|
|
|
|
|
4
|
9
|
|
|
9
|
|
309
|
use strict; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
142
|
|
5
|
9
|
|
|
9
|
|
30
|
use warnings; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
153
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
32
|
use Moo; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
36
|
|
8
|
9
|
|
|
9
|
|
2274
|
use Carp; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
444
|
|
9
|
9
|
|
|
9
|
|
2866
|
use Net::Etcd::User::Role; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
250
|
|
10
|
9
|
|
|
9
|
|
48
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
32
|
|
11
|
9
|
|
|
9
|
|
6747
|
use Data::Dumper; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
465
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Net::Etcd::Role::Actions'; |
14
|
|
|
|
|
|
|
|
15
|
9
|
|
|
9
|
|
46
|
use namespace::clean; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
38
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Net::Etcd::User |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.022'; |
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
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 changepw |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$etcd->user({ name =>'foo' password => 'bar' })->changepw |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub changepw { |
101
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
102
|
0
|
|
|
|
|
|
$self->{endpoint} = '/auth/user/changepw'; |
103
|
0
|
|
|
|
|
|
$self->request; |
104
|
0
|
|
|
|
|
|
return $self; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |