File Coverage

blib/lib/OpenSearch/Parameters/Security/CreateUser.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::CreateUser;
2 4     4   2738 use strict;
  4         14  
  4         222  
3 4     4   23 use warnings;
  4         10  
  4         300  
4 4     4   27 use feature qw(state);
  4         7  
  4         529  
5 4     4   30 use Types::Standard qw(Str ArrayRef HashRef);
  4         10  
  4         32  
6 4     4   12015 use Moo::Role;
  4         10  
  4         37  
7              
8             with 'OpenSearch::Parameters';
9              
10             has 'username' => (
11             is => 'rw',
12             isa => Str,
13             required => 1
14             );
15              
16             has 'password' => (
17             is => 'rw',
18             isa => Str,
19             required => 1
20             );
21              
22             has 'opendistro_security_roles' => (
23             is => 'rw',
24             isa => ArrayRef,
25             required => 0
26             );
27              
28             has 'backend_roles' => (
29             is => 'rw',
30             isa => ArrayRef,
31             required => 0
32             );
33              
34             has 'attributes' => (
35             is => 'rw',
36             isa => HashRef,
37             required => 0
38             );
39              
40             around [qw/username password opendistro_security_roles backend_roles attributes/] => sub {
41             my $orig = shift;
42             my $self = shift;
43              
44             if (@_) {
45             $self->$orig(@_);
46             return ($self);
47             }
48             return ( $self->$orig );
49             };
50              
51             sub api_spec {
52 0     0 0   state $s = +{
53             username => {
54             encode_func => 'as_is',
55             type => 'path',
56             },
57             password => {
58             encode_func => 'as_is',
59             type => 'body',
60             },
61             opendistro_security_roles => {
62             encode_func => 'as_is',
63             type => 'body',
64             },
65             backend_roles => {
66             encode_func => 'as_is',
67             type => 'body',
68             },
69             attributes => {
70             encode_func => 'as_is',
71             type => 'body',
72             },
73             };
74             }
75              
76             1;