line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
9
|
|
|
9
|
|
68
|
use utf8; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
55
|
|
2
|
|
|
|
|
|
|
package Net::Etcd::User; |
3
|
|
|
|
|
|
|
|
4
|
9
|
|
|
9
|
|
381
|
use strict; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
234
|
|
5
|
9
|
|
|
9
|
|
54
|
use warnings; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
263
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
51
|
use Moo; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
48
|
|
8
|
9
|
|
|
9
|
|
3231
|
use Carp; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
700
|
|
9
|
9
|
|
|
9
|
|
3468
|
use Net::Etcd::User::Role; |
|
9
|
|
|
|
|
31
|
|
|
9
|
|
|
|
|
352
|
|
10
|
9
|
|
|
9
|
|
66
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
53
|
|
11
|
9
|
|
|
9
|
|
9460
|
use Data::Dumper; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
662
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Net::Etcd::Role::Actions'; |
14
|
|
|
|
|
|
|
|
15
|
9
|
|
|
9
|
|
62
|
use namespace::clean; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
53
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Net::Etcd::User |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.021'; |
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; |