| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Consul::API::ACL; |
|
2
|
|
|
|
|
|
|
$Consul::API::ACL::VERSION = '0.027'; |
|
3
|
9
|
|
|
9
|
|
4596
|
use namespace::autoclean; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
52
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
690
|
use Moo::Role; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
55
|
|
|
6
|
9
|
|
|
9
|
|
3325
|
use Types::Standard qw(Str); |
|
|
9
|
|
|
|
|
43
|
|
|
|
9
|
|
|
|
|
157
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
requires qw(_version_prefix _api_exec); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has _acl_endpoint => ( is => 'lazy', isa => Str ); |
|
11
|
|
|
|
|
|
|
sub _build__acl_endpoint { |
|
12
|
0
|
|
|
0
|
|
|
shift->_version_prefix . '/acl'; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub acl { |
|
16
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
17
|
0
|
0
|
|
|
|
|
$self = Consul->new(@_) unless ref $self; |
|
18
|
0
|
|
|
|
|
|
return bless \$self, "Consul::API::ACL::Impl"; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package |
|
22
|
|
|
|
|
|
|
Consul::API::ACL::Impl; # hide from PAUSE |
|
23
|
|
|
|
|
|
|
|
|
24
|
9
|
|
|
9
|
|
5533
|
use Moo; |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
48
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
9
|
|
|
9
|
|
2974
|
use Carp qw(croak); |
|
|
9
|
|
|
|
|
16
|
|
|
|
9
|
|
|
|
|
451
|
|
|
27
|
9
|
|
|
9
|
|
51
|
use Scalar::Util qw( blessed ); |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
369
|
|
|
28
|
9
|
|
|
9
|
|
3250
|
use Consul::ACL; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
5264
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub create { |
|
31
|
0
|
|
|
0
|
0
|
|
my ($self, $acl, %args) = @_; |
|
32
|
0
|
|
0
|
|
|
|
$acl ||= {}; |
|
33
|
0
|
0
|
|
|
|
|
$acl = Consul::ACL->new($acl) if !blessed $acl; |
|
34
|
|
|
|
|
|
|
$$self->_api_exec($$self->_acl_endpoint."/create", 'PUT', %args, _content => $acl->to_json(), sub{ |
|
35
|
0
|
|
|
0
|
|
|
Consul::API::ACL::Success->new($_[0]) |
|
36
|
0
|
|
|
|
|
|
}); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub update { |
|
40
|
0
|
|
|
0
|
0
|
|
my ($self, $acl, %args) = @_; |
|
41
|
0
|
0
|
|
|
|
|
croak 'usage: $acl->update($acl, [%args])' if grep { !defined } ($acl); |
|
|
0
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
$acl = Consul::ACL->new($acl) if !blessed $acl; |
|
43
|
0
|
|
|
|
|
|
$$self->_api_exec($$self->_acl_endpoint."/update", 'PUT', %args, _content => $acl->to_json()); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub destroy { |
|
47
|
0
|
|
|
0
|
0
|
|
my ($self, $id, %args) = @_; |
|
48
|
0
|
0
|
|
|
|
|
croak 'usage: $acl->destroy($id, [%args])' if grep { !defined } ($id); |
|
|
0
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$$self->_api_exec($$self->_acl_endpoint."/destroy/$id", 'PUT', %args); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub info { |
|
53
|
0
|
|
|
0
|
0
|
|
my ($self, $id, %args) = @_; |
|
54
|
0
|
0
|
|
|
|
|
croak 'usage: $acl->info($id, [%args])' if grep { !defined } ($id); |
|
|
0
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$$self->_api_exec($$self->_acl_endpoint."/info/$id", 'GET', %args, sub { |
|
56
|
0
|
|
|
0
|
|
|
Consul::API::ACL::Info->new($_[0]->[0]) |
|
57
|
0
|
|
|
|
|
|
}); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub clone { |
|
61
|
0
|
|
|
0
|
0
|
|
my ($self, $id, %args) = @_; |
|
62
|
0
|
0
|
|
|
|
|
croak 'usage: $acl->clone($id, [%args])' if grep { !defined } ($id); |
|
|
0
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$$self->_api_exec($$self->_acl_endpoint."/clone/$id", 'PUT', %args, sub{ |
|
64
|
0
|
|
|
0
|
|
|
Consul::API::ACL::Success->new($_[0]) |
|
65
|
0
|
|
|
|
|
|
}); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub list { |
|
69
|
0
|
|
|
0
|
0
|
|
my ($self, %args) = @_; |
|
70
|
|
|
|
|
|
|
$$self->_api_exec($$self->_acl_endpoint."/list", 'GET', %args, sub { |
|
71
|
0
|
|
|
0
|
|
|
[ map { Consul::API::ACL::Info->new($_) } @{$_[0]} ] |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
}); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
package Consul::API::ACL::Info; |
|
76
|
|
|
|
|
|
|
$Consul::API::ACL::Info::VERSION = '0.027'; |
|
77
|
9
|
|
|
9
|
|
70
|
use Moo; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
36
|
|
|
78
|
9
|
|
|
9
|
|
2814
|
use Types::Standard qw(Str); |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
38
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
has create_index => ( is => 'ro', isa => Str, init_arg => 'CreateIndex', required => 1 ); |
|
81
|
|
|
|
|
|
|
has modify_index => ( is => 'ro', isa => Str, init_arg => 'ModifyIndex', required => 1 ); |
|
82
|
|
|
|
|
|
|
has id => ( is => 'ro', isa => Str, init_arg => 'ID', required => 1 ); |
|
83
|
|
|
|
|
|
|
has name => ( is => 'ro', isa => Str, init_arg => 'Name', required => 1 ); |
|
84
|
|
|
|
|
|
|
has type => ( is => 'ro', isa => Str, init_arg => 'Type', required => 1 ); |
|
85
|
|
|
|
|
|
|
has rules => ( is => 'ro', isa => Str, init_arg => 'Rules', required => 1 ); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
package Consul::API::ACL::Success; |
|
88
|
|
|
|
|
|
|
$Consul::API::ACL::Success::VERSION = '0.027'; |
|
89
|
9
|
|
|
9
|
|
4986
|
use Moo; |
|
|
9
|
|
|
|
|
30
|
|
|
|
9
|
|
|
|
|
36
|
|
|
90
|
9
|
|
|
9
|
|
2836
|
use Types::Standard qw(Str); |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
55
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
has id => ( is => 'ro', isa => Str, init_arg => 'ID', required => 1 ); |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=pod |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=encoding UTF-8 |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 NAME |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Consul::API::ACL - Access control API |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
use Consul; |
|
107
|
|
|
|
|
|
|
my $acl = Consul->acl; |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
The ACL API is used to create, update, destroy, and query ACL tokens. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This API is fully documented at L. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 METHODS |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 create |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 update |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 destroy |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 info |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 clone |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 list |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
L |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |