File Coverage

blib/lib/OpenSearch/Parameters/Document/Bulk.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::Document::Bulk;
2 4     4   2694 use strict;
  4         13  
  4         160  
3 4     4   24 use warnings;
  4         10  
  4         1572  
4 4     4   27 use feature qw(state);
  4         11  
  4         447  
5 4     4   24 use Types::Standard qw(Str ArrayRef Bool Enum);
  4         11  
  4         32  
6 4     4   9454 use Moo::Role;
  4         12  
  4         39  
7              
8             with 'OpenSearch::Parameters';
9              
10             has 'index' => (
11             is => 'rw',
12             isa => Str,
13             );
14              
15             has 'docs' => (
16             is => 'rw',
17             isa => ArrayRef,
18             required => 1,
19             );
20              
21             has 'pipeline' => (
22             is => 'rw',
23             isa => Str,
24             );
25              
26             has 'refresh' => (
27             is => 'rw',
28             isa => Enum [qw(true false wait_for)],
29             );
30              
31             has 'require_alias' => (
32             is => 'rw',
33             isa => Bool,
34             );
35              
36             has 'routing' => (
37             is => 'rw',
38             isa => Str,
39             );
40              
41             has 'timeout' => (
42             is => 'rw',
43             isa => Str,
44             );
45              
46             has 'wait_for_active_shards' => (
47             is => 'rw',
48             isa => Str,
49             );
50              
51             around [
52             qw/
53             index pipeline refresh require_alias routing timeout wait_for_active_shards docs
54             /
55             ] => sub {
56             my $orig = shift;
57             my $self = shift;
58              
59             if (@_) {
60             $self->$orig(@_);
61             return ($self);
62             }
63             return ( $self->$orig );
64             };
65              
66             sub api_spec {
67 0     0 0   state $s = +{
68             index => {
69             encode_func => 'as_is',
70             type => 'path',
71             },
72             docs => {
73             encode_func => 'encode_bulk',
74             type => 'body',
75             forced_body => 1,
76             },
77             pipeline => {
78             encode_func => 'as_is',
79             type => 'url',
80             },
81             refresh => {
82             encode_func => 'as_is',
83             type => 'url',
84             },
85             require_alias => {
86             encode_func => 'encode_bool',
87             type => 'url',
88             },
89             routing => {
90             encode_func => 'as_is',
91             type => 'body',
92             },
93             timeout => {
94             encode_func => 'as_is',
95             type => 'url',
96             },
97             wait_for_active_shards => {
98             encode_func => 'as_is',
99             type => 'url',
100             }
101             };
102             }
103              
104             1;