File Coverage

blib/lib/OpenSearch/Parameters/Index/SetMappings.pm
Criterion Covered Total %
statement 18 19 94.7
branch n/a
condition n/a
subroutine 6 7 85.7
pod 0 1 0.0
total 24 27 88.8


line stmt bran cond sub pod time code
1             package OpenSearch::Parameters::Index::SetMappings;
2 4     4   2681 use strict;
  4         11  
  4         160  
3 4     4   21 use warnings;
  4         9  
  4         239  
4 4     4   27 use feature qw(state);
  4         8  
  4         443  
5 4     4   84 use Types::Standard qw(Str Bool HashRef);
  4         10  
  4         37  
6 4     4   8570 use Types::Common::String qw(NonEmptyStr);
  4         11  
  4         39  
7 4     4   4520 use Moo::Role;
  4         9  
  4         42  
8              
9             with 'OpenSearch::Parameters';
10              
11             has 'index' => (
12             is => 'rw',
13             isa => NonEmptyStr,
14             required => 1,
15             );
16              
17             has 'properties' => (
18             is => 'rw',
19             isa => HashRef,
20             required => 1,
21             );
22              
23             has 'dynamic' => (
24             is => 'rw',
25             isa => Str,
26             );
27              
28             has 'allow_no_indices' => (
29             is => 'rw',
30             isa => Bool,
31             );
32              
33             has 'expand_wildcards' => (
34             is => 'rw',
35             isa => Str,
36             );
37              
38             has 'ignore_unavailable' => (
39             is => 'rw',
40             isa => Bool,
41             );
42              
43             has 'ignore_malformed' => (
44             is => 'rw',
45             isa => Bool,
46             );
47              
48             has 'cluster_manager_timeout' => (
49             is => 'rw',
50             isa => Str,
51             );
52              
53             has 'timeout' => (
54             is => 'rw',
55             isa => Str,
56             );
57              
58             has 'write_index_only' => (
59             is => 'rw',
60             isa => Bool,
61             );
62              
63             around [
64             qw/index properties dynamic allow_no_indices ignore_unavailable ignore_malformed cluster_manager_timeout write_index_only/
65             ] => sub {
66             my $orig = shift;
67             my $self = shift;
68              
69             if (@_) {
70             $self->$orig(@_);
71             return ($self);
72             }
73             return ( $self->$orig );
74             };
75              
76             sub api_spec {
77 0     0 0   state $s = +{
78             index => {
79             encode_func => 'as_is',
80             type => 'path',
81             },
82             properties => {
83             encode_func => 'as_is',
84             type => 'body',
85             },
86             dynamic => {
87             encode_func => 'as_is',
88             type => 'body',
89             },
90             allow_no_indices => {
91             encode_func => 'encode_bool',
92             type => 'url',
93             },
94             expand_wildcards => {
95             encode_func => 'as_is',
96             type => 'url',
97             },
98             ignore_unavailable => {
99             encode_func => 'encode_bool',
100             type => 'url',
101             },
102             ignore_malformed => {
103             encode_func => 'encode_bool',
104             type => 'url',
105             },
106             cluster_manager_timeout => {
107             encode_func => 'as_is',
108             type => 'url',
109             },
110             timeout => {
111             encode_func => 'as_is',
112             type => 'url',
113             },
114             write_index_only => {
115             encode_func => 'encode_bool',
116             type => 'url',
117             }
118             };
119             }
120              
121             1;