| 1 | 9 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | package Net::Etcd::Auth::Role; | ||||||||||
| 3 | |||||||||||
| 4 | 9 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 9 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 9 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 9 | ▶ | use Types::Standard qw(Str Int Bool HashRef ArrayRef); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 9 | ▶ | use MIME::Base64; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 9 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 9 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 9 | with 'Net::Etcd::Role::Actions'; | |||||||||
| 14 | |||||||||||
| 15 | 9 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | =head1 NAME | ||||||||||
| 18 | |||||||||||
| 19 | Net::Etcd::Auth::Role | ||||||||||
| 20 | |||||||||||
| 21 | =cut | ||||||||||
| 22 | |||||||||||
| 23 | 9 | our $VERSION = '0.020'; | |||||||||
| 24 | |||||||||||
| 25 | =head1 DESCRIPTION | ||||||||||
| 26 | |||||||||||
| 27 | Role | ||||||||||
| 28 | |||||||||||
| 29 | =head2 endpoint | ||||||||||
| 30 | |||||||||||
| 31 | =cut | ||||||||||
| 32 | |||||||||||
| 33 | 9 | has endpoint => ( | |||||||||
| 34 | is => 'rwp', | ||||||||||
| 35 | isa => Str, | ||||||||||
| 36 | ); | ||||||||||
| 37 | |||||||||||
| 38 | =head2 name | ||||||||||
| 39 | |||||||||||
| 40 | name of role | ||||||||||
| 41 | |||||||||||
| 42 | =cut | ||||||||||
| 43 | |||||||||||
| 44 | 9 | has name => ( | |||||||||
| 45 | is => 'ro', | ||||||||||
| 46 | isa => Str, | ||||||||||
| 47 | ); | ||||||||||
| 48 | |||||||||||
| 49 | =head2 role | ||||||||||
| 50 | |||||||||||
| 51 | name of role | ||||||||||
| 52 | |||||||||||
| 53 | =cut | ||||||||||
| 54 | |||||||||||
| 55 | 9 | has role => ( | |||||||||
| 56 | is => 'ro', | ||||||||||
| 57 | isa => Str, | ||||||||||
| 58 | ); | ||||||||||
| 59 | |||||||||||
| 60 | =head2 add | ||||||||||
| 61 | |||||||||||
| 62 | Add role | ||||||||||
| 63 | |||||||||||
| 64 | =cut | ||||||||||
| 65 | |||||||||||
| 66 | sub add { | ||||||||||
| 67 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
add: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 68 | confess 'name required for ' . __PACKAGE__ . '->add' | ||||||||||
| 69 | 0 | ▶ | unless $self->{name}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | 0 | $self->{endpoint} = '/auth/role/add'; | |||||||||
| 71 | 0 | $self->request; | |||||||||
| 72 | 0 | return $self; | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | =head2 delete | ||||||||||
| 76 | |||||||||||
| 77 | Delete role | ||||||||||
| 78 | |||||||||||
| 79 | =cut | ||||||||||
| 80 | |||||||||||
| 81 | sub delete { | ||||||||||
| 82 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
delete: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 83 | confess 'role required for ' . __PACKAGE__ . '->delete' | ||||||||||
| 84 | 0 | ▶ | unless $self->{role}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 85 | 0 | $self->{endpoint} = '/auth/role/delete'; | |||||||||
| 86 | 0 | $self->request; | |||||||||
| 87 | 0 | return $self; | |||||||||
| 88 | } | ||||||||||
| 89 | |||||||||||
| 90 | =head2 get | ||||||||||
| 91 | |||||||||||
| 92 | Get role | ||||||||||
| 93 | |||||||||||
| 94 | =cut | ||||||||||
| 95 | |||||||||||
| 96 | sub get { | ||||||||||
| 97 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
get: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 98 | confess 'name required for ' . __PACKAGE__ . '->get' | ||||||||||
| 99 | 0 | ▶ | unless $self->{role}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 100 | 0 | $self->{endpoint} = '/auth/role/get'; | |||||||||
| 101 | 0 | $self->request; | |||||||||
| 102 | 0 | return $self; | |||||||||
| 103 | } | ||||||||||
| 104 | |||||||||||
| 105 | =head2 list | ||||||||||
| 106 | |||||||||||
| 107 | List roles | ||||||||||
| 108 | |||||||||||
| 109 | =cut | ||||||||||
| 110 | |||||||||||
| 111 | sub list { | ||||||||||
| 112 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
list: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 113 | 0 | $self->{endpoint} = '/auth/role/list'; | |||||||||
| 114 | 0 | $self->{json_args} = '{}'; | |||||||||
| 115 | 0 | $self->request; | |||||||||
| 116 | 0 | return $self; | |||||||||
| 117 | } | ||||||||||
| 118 | 9 | 1; | |||||||||