File Coverage

blib/lib/OpenSearch/Parameters/Security/CreateRole.pm
Criterion Covered Total %
statement 15 16 93.7
branch n/a
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 20 23 86.9


line stmt bran cond sub pod time code
1             package OpenSearch::Parameters::Security::CreateRole;
2 4     4   2686 use strict;
  4         12  
  4         188  
3 4     4   22 use warnings;
  4         9  
  4         229  
4 4     4   26 use feature qw(state);
  4         8  
  4         466  
5 4     4   26 use Types::Standard qw(Str ArrayRef);
  4         21  
  4         31  
6 4     4   8638 use Moo::Role;
  4         8  
  4         40  
7              
8             with 'OpenSearch::Parameters';
9              
10             has 'role' => (
11             is => 'rw',
12             isa => Str,
13             required => 1
14             );
15              
16             # Actually only one of these is required so we dont do any local checks
17             has 'cluster_permissions' => (
18             is => 'rw',
19             isa => ArrayRef,
20             required => 0
21             );
22              
23             has 'index_permissions' => (
24             is => 'rw',
25             isa => ArrayRef,
26             required => 0
27             );
28              
29             has 'tenant_permissions' => (
30             is => 'rw',
31             isa => ArrayRef,
32             required => 0
33             );
34              
35             around [qw/role cluster_permissions index_permissions tenant_permissions/] => sub {
36             my $orig = shift;
37             my $self = shift;
38              
39             if (@_) {
40             $self->$orig(@_);
41             return ($self);
42             }
43             return ( $self->$orig );
44             };
45              
46             sub api_spec {
47 0     0 0   state $s = +{
48             role => {
49             encode_func => 'as_is',
50             type => 'path',
51             },
52             cluster_permissions => {
53             encode_func => 'as_is',
54             type => 'body',
55             },
56             index_permissions => {
57             encode_func => 'as_is',
58             type => 'body',
59             },
60             tenant_permissions => {
61             encode_func => 'as_is',
62             type => 'body',
63             },
64             };
65             }
66              
67             1;