line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# ABSTRACT: API Client for Net::Graylog::API |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# I am assuming you are using Dist::Zilla and have set [PkgVersion] in yout dist.ini |
6
|
|
|
|
|
|
|
# to create the $Net::Graylog::API::VERSION variable |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Net::Graylog::API; |
9
|
|
|
|
|
|
|
{ |
10
|
|
|
|
|
|
|
$Net::Graylog::API::VERSION = '0.4'; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
19765
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
14
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
15
|
1
|
|
|
1
|
|
5
|
use Furl; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
16
|
1
|
|
|
1
|
|
505
|
use JSON; |
|
1
|
|
|
|
|
8798
|
|
|
1
|
|
|
|
|
5
|
|
17
|
1
|
|
|
1
|
|
102
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
18
|
1
|
|
|
1
|
|
722
|
use URI::Escape::XS qw/uri_escape/; |
|
1
|
|
|
|
|
93120
|
|
|
1
|
|
|
|
|
79
|
|
19
|
1
|
|
|
1
|
|
9
|
use Data::Printer; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
20
|
1
|
|
|
1
|
|
48
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my %SearchResponse = ( |
27
|
|
|
|
|
|
|
built_query => 'string', |
28
|
|
|
|
|
|
|
error => { |
29
|
|
|
|
|
|
|
begin_column => 'integer', |
30
|
|
|
|
|
|
|
begin_line => 'integer', |
31
|
|
|
|
|
|
|
end_column => 'integer', |
32
|
|
|
|
|
|
|
end_line => 'integer', |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
fields => [ type => 'string', ], |
35
|
|
|
|
|
|
|
generic_error => { |
36
|
|
|
|
|
|
|
exception_name => 'string', |
37
|
|
|
|
|
|
|
message => 'string', |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
messages => [ |
40
|
|
|
|
|
|
|
properties => { |
41
|
|
|
|
|
|
|
index => 'string', |
42
|
|
|
|
|
|
|
message => { additional_properties => 'any', }, |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
], |
45
|
|
|
|
|
|
|
query => 'string', |
46
|
|
|
|
|
|
|
time => 'integer', |
47
|
|
|
|
|
|
|
total_results => 'integer', |
48
|
|
|
|
|
|
|
used_indices => [ type => 'string', ], |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my %ReaderPermissionResponse = ( permissions => [ type => 'string', ], ); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my %LdapTestConfigResponse = ( |
56
|
|
|
|
|
|
|
connected => 'boolean', |
57
|
|
|
|
|
|
|
entry => { additional_properties => 'string', }, |
58
|
|
|
|
|
|
|
exception => 'string', |
59
|
|
|
|
|
|
|
login_authenticated => 'boolean', |
60
|
|
|
|
|
|
|
system_authenticated => 'boolean', |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my %LdapTestConfigRequest = ( |
65
|
|
|
|
|
|
|
active_directory => 'boolean', |
66
|
|
|
|
|
|
|
ldap_uri => 'string', |
67
|
|
|
|
|
|
|
password => 'string', |
68
|
|
|
|
|
|
|
principal => 'string', |
69
|
|
|
|
|
|
|
search_base => 'string', |
70
|
|
|
|
|
|
|
search_pattern => 'string', |
71
|
|
|
|
|
|
|
system_password => 'string', |
72
|
|
|
|
|
|
|
system_username => 'string', |
73
|
|
|
|
|
|
|
test_connect_only => 'boolean', |
74
|
|
|
|
|
|
|
trust_all_certificates => 'boolean', |
75
|
|
|
|
|
|
|
use_start_tls => 'boolean', |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my %SessionCreateRequest = ( |
80
|
|
|
|
|
|
|
host => 'string', |
81
|
|
|
|
|
|
|
password => 'string', |
82
|
|
|
|
|
|
|
username => 'string', |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
my %Session = ( |
87
|
|
|
|
|
|
|
session_id => 'string', |
88
|
|
|
|
|
|
|
valid_until => 'string', |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
my %Token = ( |
93
|
|
|
|
|
|
|
last_access => 'string', |
94
|
|
|
|
|
|
|
name => 'string', |
95
|
|
|
|
|
|
|
token => 'string', |
96
|
|
|
|
|
|
|
); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my %TokenList = ( |
100
|
|
|
|
|
|
|
tokens => [ |
101
|
|
|
|
|
|
|
properties => { |
102
|
|
|
|
|
|
|
last_access => 'string', |
103
|
|
|
|
|
|
|
name => 'string', |
104
|
|
|
|
|
|
|
token => 'string', |
105
|
|
|
|
|
|
|
}, |
106
|
|
|
|
|
|
|
], |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
my %_models = ( |
110
|
|
|
|
|
|
|
SearchResponse => \%SearchResponse, |
111
|
|
|
|
|
|
|
ReaderPermissionResponse => \%ReaderPermissionResponse, |
112
|
|
|
|
|
|
|
LdapTestConfigResponse => \%LdapTestConfigResponse, |
113
|
|
|
|
|
|
|
LdapTestConfigRequest => \%LdapTestConfigRequest, |
114
|
|
|
|
|
|
|
SessionCreateRequest => \%SessionCreateRequest, |
115
|
|
|
|
|
|
|
Session => \%Session, |
116
|
|
|
|
|
|
|
Token => \%Token, |
117
|
|
|
|
|
|
|
TokenList => \%TokenList, |
118
|
|
|
|
|
|
|
); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
has url => ( is => 'ro', required => 1 ); |
124
|
|
|
|
|
|
|
has user => ( is => 'ro' ); |
125
|
|
|
|
|
|
|
has password => ( is => 'ro' ); |
126
|
|
|
|
|
|
|
has timeout => ( is => 'ro', default => sub { 0.01; } ); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# we need to set a timeout for the connection as Furl seems to wait |
129
|
|
|
|
|
|
|
# for this time to elapse before giving us any response. If the default is used |
130
|
|
|
|
|
|
|
# 180s then this will block for 3 minutes! crazy stuff, so I set it to 0.01 |
131
|
|
|
|
|
|
|
# which would allow me to send 100 messages/sec, which should be OK for my |
132
|
|
|
|
|
|
|
# purposes especially as my graylog is on the local network |
133
|
|
|
|
|
|
|
has _furl => ( |
134
|
|
|
|
|
|
|
is => 'lazy', |
135
|
|
|
|
|
|
|
default => sub { |
136
|
|
|
|
|
|
|
my $self = shift; |
137
|
|
|
|
|
|
|
return Furl->new( |
138
|
|
|
|
|
|
|
agent => __PACKAGE__, |
139
|
|
|
|
|
|
|
headers => [ |
140
|
|
|
|
|
|
|
'Accept' => 'application/json', |
141
|
|
|
|
|
|
|
'content-type' => 'application/json', |
142
|
|
|
|
|
|
|
], |
143
|
|
|
|
|
|
|
timeout => $self->timeout, |
144
|
|
|
|
|
|
|
); |
145
|
|
|
|
|
|
|
}, |
146
|
|
|
|
|
|
|
init_arg => undef, |
147
|
|
|
|
|
|
|
); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
150
|
|
|
|
|
|
|
# validate a parameter against known types or the models |
151
|
|
|
|
|
|
|
# returns an error string if there is an issue |
152
|
|
|
|
|
|
|
# for the moment I am not going to attempt a full parse of the swagger spec |
153
|
|
|
|
|
|
|
# https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#433-data-type-fields |
154
|
|
|
|
|
|
|
# just the ones I need for graylog2 |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub _validate_parameter { |
157
|
0
|
|
|
0
|
|
0
|
my ( $data, $info ) = @_; |
158
|
0
|
|
|
|
|
0
|
my $response; |
159
|
0
|
|
0
|
|
|
0
|
my $type = lc( $info->{type} || "" ); |
160
|
0
|
|
0
|
|
|
0
|
my $format = lc( $info->{format} || "" ); |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
# not having data is not an issue, the caller should already have checked if it |
163
|
|
|
|
|
|
|
# was a required field |
164
|
0
|
0
|
|
|
|
0
|
return "" if ( !$data ); |
165
|
|
|
|
|
|
|
|
166
|
0
|
0
|
|
|
|
0
|
if ( $info->{'$ref'} ) { |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
# are we are refering to an element in the data model |
169
|
0
|
|
|
|
|
0
|
die "Not setup to handle object references yet"; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
0
|
0
|
|
|
|
0
|
if ( $type eq 'integer' ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
173
|
0
|
0
|
0
|
|
|
0
|
if ( $data !~ /^[0-9]+$/ ) { |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
# not checking the format int32/int64 |
176
|
0
|
|
|
|
|
0
|
$response = 'is not an integer'; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
elsif ( $info->{maximum} && $data > $info->{maximum} ) { |
179
|
0
|
|
|
|
|
0
|
$response = "is greater than allowed maximum ($info->{maximum}"; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
elsif ( $info->{minimum} && $data < $info->{maximum} ) { |
182
|
0
|
|
|
|
|
0
|
$response = "is less than allowed minimum ($info->{minimum}"; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
elsif ( $type eq 'number' ) { |
187
|
0
|
0
|
0
|
|
|
0
|
if ( $data !~ /^[0-9]{1,}(\.[0-9]{1,})$/ ) { |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
# not checking the format float/double |
190
|
0
|
|
|
|
|
0
|
$response = 'is not a number'; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
elsif ( $info->{maximum} && $data > $info->{maximum} ) { |
193
|
0
|
|
|
|
|
0
|
$response = "is greater than allowed maximum ($info->{maximum}"; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
elsif ( $info->{minimum} && $data < $info->{maximum} ) { |
196
|
0
|
|
|
|
|
0
|
$response = "is less than allowed minimum ($info->{minimum}"; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
elsif ( $type eq 'string' ) { |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
# we will let most things though as strings, no validation |
202
|
0
|
0
|
|
|
|
0
|
if ($format) { |
203
|
0
|
0
|
|
|
|
0
|
if ( $format eq 'date' ) { |
|
|
0
|
|
|
|
|
|
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
# I am not checking if the actual values in the fields make sense |
206
|
|
|
|
|
|
|
# allow dd/mm/yy dd/mm/yyyy yyyy/mm/dd xx/xx/xx |
207
|
|
|
|
|
|
|
# allow dd-mm-yy dd-mm-yyyy yyyy-mm-dd xx-xx-xx |
208
|
0
|
0
|
0
|
|
|
0
|
$response = 'does not look like a date' if ( m|^\d{2}[-\/]\d{2}[-\/]\d{2,4}$| || m|^\d{4}[-\/]\d{2}[-\/]\d{2}$| ); |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
elsif ( $format eq 'date-time' ) { |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
# assuming something like ISO8601 YYYY-MM-DD HH:mm:SS plus trailing bits |
213
|
0
|
0
|
|
|
|
0
|
$response = 'does not look like a datetime' if (m|^\d{2,4}[-\/]\d{2}[-\/]\d{2}[ T]\d{2}:\d{2}:d{2}|); |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
elsif ( $type eq 'boolean' ) { |
218
|
0
|
0
|
|
|
|
0
|
$response = "is not boolean" if ( $data !~ /true|false|1|0|yes|no/i ); |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
elsif ( $_models{$type} ) { |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
# one of the models, now we need to validate all the fields of it, groan |
223
|
0
|
|
|
|
|
0
|
die "Not handling models yet"; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
else { |
226
|
0
|
|
|
|
|
0
|
$response = "has unknown type - $info->{type}"; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
# prefix with the param name if there was an error |
230
|
0
|
0
|
|
|
|
0
|
$response = "$info->{name} $response" if ($response); |
231
|
0
|
|
|
|
|
0
|
return $response; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
235
|
|
|
|
|
|
|
# get the url, add in the username and password if they exist |
236
|
|
|
|
|
|
|
sub _action_url { |
237
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
238
|
1
|
|
|
|
|
3
|
my ( $method, $url, $params, $content ) = @_; |
239
|
|
|
|
|
|
|
|
240
|
1
|
|
|
|
|
6
|
$url = $self->url . $url; |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
# we are only using basic auth nothing fancy like oauth! |
243
|
1
|
50
|
|
|
|
6
|
if ( $self->user ) { |
244
|
1
|
|
|
|
|
6
|
my $auth = $self->user . ':' . $self->password . '@'; |
245
|
1
|
|
|
|
|
9
|
$url =~ s|^(https?://)(.*)|$1$auth$2|; |
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
|
248
|
1
|
50
|
|
|
|
2
|
if ( keys %{$params} ) { |
|
1
|
|
|
|
|
5
|
|
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
# we need to encode the parameters as part of the URL |
251
|
0
|
|
|
|
|
0
|
$url .= '?'; |
252
|
0
|
|
|
|
|
0
|
foreach my $k ( keys %{$params} ) { |
|
0
|
|
|
|
|
0
|
|
253
|
0
|
0
|
|
|
|
0
|
next if ( !$params->{$k} ); |
254
|
0
|
|
|
|
|
0
|
$url .= ( uri_escape($k) . '=' . uri_escape( $params->{$k} ) . '&' ); |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
} |
257
|
1
|
|
|
|
|
2
|
$url =~ s/&$//; |
258
|
|
|
|
|
|
|
|
259
|
1
|
50
|
|
|
|
4
|
say STDERR "url [$method] $url" if ( $ENV{DEBUG} ); |
260
|
1
|
|
|
|
|
3
|
my $headers; #= [ 'Content-type' => ['application/json'] ] ; |
261
|
1
|
|
|
|
|
18
|
my $res = $self->_furl->request( |
262
|
|
|
|
|
|
|
method => uc($method), |
263
|
|
|
|
|
|
|
url => $url, |
264
|
|
|
|
|
|
|
headers => $headers, |
265
|
|
|
|
|
|
|
content => $content |
266
|
|
|
|
|
|
|
); |
267
|
|
|
|
|
|
|
|
268
|
1
|
50
|
|
|
|
27642
|
if ( $res->is_success ) { |
269
|
0
|
|
|
|
|
0
|
my $json = decode_json( $res->content ); |
270
|
0
|
|
|
|
|
0
|
$res->{json} = $json; |
271
|
|
|
|
|
|
|
} |
272
|
1
|
|
|
|
|
18
|
return $res; |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
sub alerts_list { |
280
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
281
|
0
|
|
|
|
|
0
|
my (%params) = @_; |
282
|
0
|
|
|
|
|
0
|
my ( %clean_data, $body ); |
283
|
0
|
|
|
|
|
0
|
my $url = "/streams/$params{streamId}/alerts"; |
284
|
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
0
|
my $args = { |
286
|
|
|
|
|
|
|
streamId => { |
287
|
|
|
|
|
|
|
description => "The stream id this new alert condition belongs to.", |
288
|
|
|
|
|
|
|
name => "streamId", |
289
|
|
|
|
|
|
|
paramType => "path", |
290
|
|
|
|
|
|
|
required => 1, |
291
|
|
|
|
|
|
|
type => "String" |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
}; |
294
|
0
|
|
|
|
|
0
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
0
|
|
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
# check if the parameters exist if needed |
297
|
0
|
0
|
0
|
|
|
0
|
die "alerts_list is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
# validate the type of the parameter |
300
|
0
|
|
|
|
|
0
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
301
|
0
|
0
|
|
|
|
0
|
die "Bad argument $params{$a} to alerts_list ($err)" if ($err); |
302
|
|
|
|
|
|
|
|
303
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
304
|
0
|
|
|
|
|
0
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
305
|
0
|
|
|
|
|
0
|
next; |
306
|
|
|
|
|
|
|
} |
307
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
308
|
0
|
0
|
|
|
|
0
|
die "body has already been defined in alerts_list for $args->{$a}->{name}" if ($body); |
309
|
0
|
|
|
|
|
0
|
$body = $params{$a}; |
310
|
|
|
|
|
|
|
} |
311
|
|
|
|
|
|
|
else { |
312
|
|
|
|
|
|
|
# we only want to send data that is allowed |
313
|
0
|
0
|
|
|
|
0
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
} |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
318
|
0
|
0
|
|
|
|
0
|
if ( ref($body) ne 'SCALAR' ) { |
319
|
0
|
0
|
|
|
|
0
|
$body = to_json($body) if ($body); |
320
|
|
|
|
|
|
|
} |
321
|
0
|
|
|
|
|
0
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
sub alerts_check_conditions { |
328
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
329
|
0
|
|
|
|
|
0
|
my (%params) = @_; |
330
|
0
|
|
|
|
|
0
|
my ( %clean_data, $body ); |
331
|
0
|
|
|
|
|
0
|
my $url = "/streams/$params{streamId}/alerts/check"; |
332
|
|
|
|
|
|
|
|
333
|
0
|
|
|
|
|
0
|
my $args = { |
334
|
|
|
|
|
|
|
streamId => { |
335
|
|
|
|
|
|
|
description => "The ID of the stream to check.", |
336
|
|
|
|
|
|
|
name => "streamId", |
337
|
|
|
|
|
|
|
paramType => "path", |
338
|
|
|
|
|
|
|
required => 1, |
339
|
|
|
|
|
|
|
type => "String" |
340
|
|
|
|
|
|
|
} |
341
|
|
|
|
|
|
|
}; |
342
|
0
|
|
|
|
|
0
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
0
|
|
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
# check if the parameters exist if needed |
345
|
0
|
0
|
0
|
|
|
0
|
die "alerts_check_conditions is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
# validate the type of the parameter |
348
|
0
|
|
|
|
|
0
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
349
|
0
|
0
|
|
|
|
0
|
die "Bad argument $params{$a} to alerts_check_conditions ($err)" if ($err); |
350
|
|
|
|
|
|
|
|
351
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
352
|
0
|
|
|
|
|
0
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
353
|
0
|
|
|
|
|
0
|
next; |
354
|
|
|
|
|
|
|
} |
355
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
356
|
0
|
0
|
|
|
|
0
|
die "body has already been defined in alerts_check_conditions for $args->{$a}->{name}" if ($body); |
357
|
0
|
|
|
|
|
0
|
$body = $params{$a}; |
358
|
|
|
|
|
|
|
} |
359
|
|
|
|
|
|
|
else { |
360
|
|
|
|
|
|
|
# we only want to send data that is allowed |
361
|
0
|
0
|
|
|
|
0
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
} |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
366
|
0
|
0
|
|
|
|
0
|
if ( ref($body) ne 'SCALAR' ) { |
367
|
0
|
0
|
|
|
|
0
|
$body = to_json($body) if ($body); |
368
|
|
|
|
|
|
|
} |
369
|
0
|
|
|
|
|
0
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
370
|
|
|
|
|
|
|
} |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
sub alerts_list_conditions { |
376
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
377
|
0
|
|
|
|
|
0
|
my (%params) = @_; |
378
|
0
|
|
|
|
|
0
|
my ( %clean_data, $body ); |
379
|
0
|
|
|
|
|
0
|
my $url = "/streams/$params{streamId}/alerts/conditions"; |
380
|
|
|
|
|
|
|
|
381
|
0
|
|
|
|
|
0
|
my $args = { |
382
|
|
|
|
|
|
|
streamId => { |
383
|
|
|
|
|
|
|
description => "The stream id this new alert condition belongs to.", |
384
|
|
|
|
|
|
|
name => "streamId", |
385
|
|
|
|
|
|
|
paramType => "path", |
386
|
|
|
|
|
|
|
required => 1, |
387
|
|
|
|
|
|
|
type => "String" |
388
|
|
|
|
|
|
|
} |
389
|
|
|
|
|
|
|
}; |
390
|
0
|
|
|
|
|
0
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
0
|
|
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
# check if the parameters exist if needed |
393
|
0
|
0
|
0
|
|
|
0
|
die "alerts_list_conditions is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
# validate the type of the parameter |
396
|
0
|
|
|
|
|
0
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
397
|
0
|
0
|
|
|
|
0
|
die "Bad argument $params{$a} to alerts_list_conditions ($err)" if ($err); |
398
|
|
|
|
|
|
|
|
399
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
400
|
0
|
|
|
|
|
0
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
401
|
0
|
|
|
|
|
0
|
next; |
402
|
|
|
|
|
|
|
} |
403
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
404
|
0
|
0
|
|
|
|
0
|
die "body has already been defined in alerts_list_conditions for $args->{$a}->{name}" if ($body); |
405
|
0
|
|
|
|
|
0
|
$body = $params{$a}; |
406
|
|
|
|
|
|
|
} |
407
|
|
|
|
|
|
|
else { |
408
|
|
|
|
|
|
|
# we only want to send data that is allowed |
409
|
0
|
0
|
|
|
|
0
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
410
|
|
|
|
|
|
|
} |
411
|
|
|
|
|
|
|
} |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
414
|
0
|
0
|
|
|
|
0
|
if ( ref($body) ne 'SCALAR' ) { |
415
|
0
|
0
|
|
|
|
0
|
$body = to_json($body) if ($body); |
416
|
|
|
|
|
|
|
} |
417
|
0
|
|
|
|
|
0
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
sub alerts_create { |
424
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
425
|
0
|
|
|
|
|
0
|
my (%params) = @_; |
426
|
0
|
|
|
|
|
0
|
my ( %clean_data, $body ); |
427
|
0
|
|
|
|
|
0
|
my $url = "/streams/$params{streamId}/alerts/conditions"; |
428
|
|
|
|
|
|
|
|
429
|
0
|
|
|
|
|
0
|
my $args = { |
430
|
|
|
|
|
|
|
"JSON body" => { |
431
|
|
|
|
|
|
|
description => "", |
432
|
|
|
|
|
|
|
name => "JSON body", |
433
|
|
|
|
|
|
|
paramType => "body", |
434
|
|
|
|
|
|
|
required => 1, |
435
|
|
|
|
|
|
|
type => "String" |
436
|
|
|
|
|
|
|
}, |
437
|
|
|
|
|
|
|
streamId => { |
438
|
|
|
|
|
|
|
description => "The stream id this new alert condition belongs to.", |
439
|
|
|
|
|
|
|
name => "streamId", |
440
|
|
|
|
|
|
|
paramType => "path", |
441
|
|
|
|
|
|
|
required => 1, |
442
|
|
|
|
|
|
|
type => "String" |
443
|
|
|
|
|
|
|
} |
444
|
|
|
|
|
|
|
}; |
445
|
0
|
|
|
|
|
0
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
0
|
|
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
# check if the parameters exist if needed |
448
|
0
|
0
|
0
|
|
|
0
|
die "alerts_create is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
# validate the type of the parameter |
451
|
0
|
|
|
|
|
0
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
452
|
0
|
0
|
|
|
|
0
|
die "Bad argument $params{$a} to alerts_create ($err)" if ($err); |
453
|
|
|
|
|
|
|
|
454
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
455
|
0
|
|
|
|
|
0
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
456
|
0
|
|
|
|
|
0
|
next; |
457
|
|
|
|
|
|
|
} |
458
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
459
|
0
|
0
|
|
|
|
0
|
die "body has already been defined in alerts_create for $args->{$a}->{name}" if ($body); |
460
|
0
|
|
|
|
|
0
|
$body = $params{$a}; |
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
else { |
463
|
|
|
|
|
|
|
# we only want to send data that is allowed |
464
|
0
|
0
|
|
|
|
0
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
465
|
|
|
|
|
|
|
} |
466
|
|
|
|
|
|
|
} |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
469
|
0
|
0
|
|
|
|
0
|
if ( ref($body) ne 'SCALAR' ) { |
470
|
0
|
0
|
|
|
|
0
|
$body = to_json($body) if ($body); |
471
|
|
|
|
|
|
|
} |
472
|
0
|
|
|
|
|
0
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
473
|
|
|
|
|
|
|
} |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
sub delete_alerts_list { |
479
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
480
|
0
|
|
|
|
|
0
|
my (%params) = @_; |
481
|
0
|
|
|
|
|
0
|
my ( %clean_data, $body ); |
482
|
0
|
|
|
|
|
0
|
my $url = "/streams/$params{streamId}/alerts/conditions/$params{conditionId}"; |
483
|
|
|
|
|
|
|
|
484
|
0
|
|
|
|
|
0
|
my $args = { |
485
|
|
|
|
|
|
|
conditionId => { |
486
|
|
|
|
|
|
|
description => "The stream id this new alert condition belongs to.", |
487
|
|
|
|
|
|
|
name => "conditionId", |
488
|
|
|
|
|
|
|
paramType => "path", |
489
|
|
|
|
|
|
|
required => 1, |
490
|
|
|
|
|
|
|
type => "String" |
491
|
|
|
|
|
|
|
}, |
492
|
|
|
|
|
|
|
streamId => { |
493
|
|
|
|
|
|
|
description => "The stream id this new alert condition belongs to.", |
494
|
|
|
|
|
|
|
name => "streamId", |
495
|
|
|
|
|
|
|
paramType => "path", |
496
|
|
|
|
|
|
|
required => 1, |
497
|
|
|
|
|
|
|
type => "String" |
498
|
|
|
|
|
|
|
} |
499
|
|
|
|
|
|
|
}; |
500
|
0
|
|
|
|
|
0
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
0
|
|
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
# check if the parameters exist if needed |
503
|
0
|
0
|
0
|
|
|
0
|
die "delete_alerts_list is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
# validate the type of the parameter |
506
|
0
|
|
|
|
|
0
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
507
|
0
|
0
|
|
|
|
0
|
die "Bad argument $params{$a} to delete_alerts_list ($err)" if ($err); |
508
|
|
|
|
|
|
|
|
509
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
510
|
0
|
|
|
|
|
0
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
511
|
0
|
|
|
|
|
0
|
next; |
512
|
|
|
|
|
|
|
} |
513
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
514
|
0
|
0
|
|
|
|
0
|
die "body has already been defined in delete_alerts_list for $args->{$a}->{name}" if ($body); |
515
|
0
|
|
|
|
|
0
|
$body = $params{$a}; |
516
|
|
|
|
|
|
|
} |
517
|
|
|
|
|
|
|
else { |
518
|
|
|
|
|
|
|
# we only want to send data that is allowed |
519
|
0
|
0
|
|
|
|
0
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
520
|
|
|
|
|
|
|
} |
521
|
|
|
|
|
|
|
} |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
524
|
0
|
0
|
|
|
|
0
|
if ( ref($body) ne 'SCALAR' ) { |
525
|
0
|
0
|
|
|
|
0
|
$body = to_json($body) if ($body); |
526
|
|
|
|
|
|
|
} |
527
|
0
|
|
|
|
|
0
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
528
|
|
|
|
|
|
|
} |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
sub alerts_add_receiver { |
534
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
535
|
0
|
|
|
|
|
0
|
my (%params) = @_; |
536
|
0
|
|
|
|
|
0
|
my ( %clean_data, $body ); |
537
|
0
|
|
|
|
|
0
|
my $url = "/streams/$params{streamId}/alerts/receivers"; |
538
|
|
|
|
|
|
|
|
539
|
0
|
|
|
|
|
0
|
my $args = { |
540
|
|
|
|
|
|
|
entity => { |
541
|
|
|
|
|
|
|
description => "Name/ID of user or email address to add as alert receiver.", |
542
|
|
|
|
|
|
|
name => "entity", |
543
|
|
|
|
|
|
|
paramType => "query", |
544
|
|
|
|
|
|
|
required => 1, |
545
|
|
|
|
|
|
|
type => "String" |
546
|
|
|
|
|
|
|
}, |
547
|
|
|
|
|
|
|
streamId => { |
548
|
|
|
|
|
|
|
description => "The stream id this new alert condition belongs to.", |
549
|
|
|
|
|
|
|
name => "streamId", |
550
|
|
|
|
|
|
|
paramType => "path", |
551
|
|
|
|
|
|
|
required => 1, |
552
|
|
|
|
|
|
|
type => "String" |
553
|
|
|
|
|
|
|
}, |
554
|
|
|
|
|
|
|
type => { |
555
|
|
|
|
|
|
|
description => "Type: users or emails", |
556
|
|
|
|
|
|
|
name => "type", |
557
|
|
|
|
|
|
|
paramType => "query", |
558
|
|
|
|
|
|
|
required => 1, |
559
|
|
|
|
|
|
|
type => "String" |
560
|
|
|
|
|
|
|
} |
561
|
|
|
|
|
|
|
}; |
562
|
0
|
|
|
|
|
0
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
0
|
|
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
# check if the parameters exist if needed |
565
|
0
|
0
|
0
|
|
|
0
|
die "alerts_add_receiver is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
# validate the type of the parameter |
568
|
0
|
|
|
|
|
0
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
569
|
0
|
0
|
|
|
|
0
|
die "Bad argument $params{$a} to alerts_add_receiver ($err)" if ($err); |
570
|
|
|
|
|
|
|
|
571
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
572
|
0
|
|
|
|
|
0
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
573
|
0
|
|
|
|
|
0
|
next; |
574
|
|
|
|
|
|
|
} |
575
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
576
|
0
|
0
|
|
|
|
0
|
die "body has already been defined in alerts_add_receiver for $args->{$a}->{name}" if ($body); |
577
|
0
|
|
|
|
|
0
|
$body = $params{$a}; |
578
|
|
|
|
|
|
|
} |
579
|
|
|
|
|
|
|
else { |
580
|
|
|
|
|
|
|
# we only want to send data that is allowed |
581
|
0
|
0
|
|
|
|
0
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
582
|
|
|
|
|
|
|
} |
583
|
|
|
|
|
|
|
} |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
586
|
0
|
0
|
|
|
|
0
|
if ( ref($body) ne 'SCALAR' ) { |
587
|
0
|
0
|
|
|
|
0
|
$body = to_json($body) if ($body); |
588
|
|
|
|
|
|
|
} |
589
|
0
|
|
|
|
|
0
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
590
|
|
|
|
|
|
|
} |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
sub alerts_remove_receiver { |
596
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
597
|
0
|
|
|
|
|
0
|
my (%params) = @_; |
598
|
0
|
|
|
|
|
0
|
my ( %clean_data, $body ); |
599
|
0
|
|
|
|
|
0
|
my $url = "/streams/$params{streamId}/alerts/receivers"; |
600
|
|
|
|
|
|
|
|
601
|
0
|
|
|
|
|
0
|
my $args = { |
602
|
|
|
|
|
|
|
entity => { |
603
|
|
|
|
|
|
|
description => "Name/ID of user or email address to remove from alert receivers.", |
604
|
|
|
|
|
|
|
name => "entity", |
605
|
|
|
|
|
|
|
paramType => "query", |
606
|
|
|
|
|
|
|
required => 1, |
607
|
|
|
|
|
|
|
type => "String" |
608
|
|
|
|
|
|
|
}, |
609
|
|
|
|
|
|
|
streamId => { |
610
|
|
|
|
|
|
|
description => "The stream id this new alert condition belongs to.", |
611
|
|
|
|
|
|
|
name => "streamId", |
612
|
|
|
|
|
|
|
paramType => "path", |
613
|
|
|
|
|
|
|
required => 1, |
614
|
|
|
|
|
|
|
type => "String" |
615
|
|
|
|
|
|
|
}, |
616
|
|
|
|
|
|
|
type => { |
617
|
|
|
|
|
|
|
description => "Type: users or emails", |
618
|
|
|
|
|
|
|
name => "type", |
619
|
|
|
|
|
|
|
paramType => "query", |
620
|
|
|
|
|
|
|
required => 1, |
621
|
|
|
|
|
|
|
type => "String" |
622
|
|
|
|
|
|
|
} |
623
|
|
|
|
|
|
|
}; |
624
|
0
|
|
|
|
|
0
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
0
|
|
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
# check if the parameters exist if needed |
627
|
0
|
0
|
0
|
|
|
0
|
die "alerts_remove_receiver is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
# validate the type of the parameter |
630
|
0
|
|
|
|
|
0
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
631
|
0
|
0
|
|
|
|
0
|
die "Bad argument $params{$a} to alerts_remove_receiver ($err)" if ($err); |
632
|
|
|
|
|
|
|
|
633
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
634
|
0
|
|
|
|
|
0
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
635
|
0
|
|
|
|
|
0
|
next; |
636
|
|
|
|
|
|
|
} |
637
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
638
|
0
|
0
|
|
|
|
0
|
die "body has already been defined in alerts_remove_receiver for $args->{$a}->{name}" if ($body); |
639
|
0
|
|
|
|
|
0
|
$body = $params{$a}; |
640
|
|
|
|
|
|
|
} |
641
|
|
|
|
|
|
|
else { |
642
|
|
|
|
|
|
|
# we only want to send data that is allowed |
643
|
0
|
0
|
|
|
|
0
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
644
|
|
|
|
|
|
|
} |
645
|
|
|
|
|
|
|
} |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
648
|
0
|
0
|
|
|
|
0
|
if ( ref($body) ne 'SCALAR' ) { |
649
|
0
|
0
|
|
|
|
0
|
$body = to_json($body) if ($body); |
650
|
|
|
|
|
|
|
} |
651
|
0
|
|
|
|
|
0
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
652
|
|
|
|
|
|
|
} |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
sub alerts_send_dummy_alert { |
658
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
659
|
0
|
|
|
|
|
0
|
my (%params) = @_; |
660
|
0
|
|
|
|
|
0
|
my ( %clean_data, $body ); |
661
|
0
|
|
|
|
|
0
|
my $url = "/streams/$params{streamId}/alerts/sendDummyAlert"; |
662
|
|
|
|
|
|
|
|
663
|
0
|
|
|
|
|
0
|
my $args = { |
664
|
|
|
|
|
|
|
streamId => { |
665
|
|
|
|
|
|
|
description => "The stream id this new alert condition belongs to.", |
666
|
|
|
|
|
|
|
name => "streamId", |
667
|
|
|
|
|
|
|
paramType => "path", |
668
|
|
|
|
|
|
|
required => 1, |
669
|
|
|
|
|
|
|
type => "String" |
670
|
|
|
|
|
|
|
} |
671
|
|
|
|
|
|
|
}; |
672
|
0
|
|
|
|
|
0
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
0
|
|
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
# check if the parameters exist if needed |
675
|
0
|
0
|
0
|
|
|
0
|
die "alerts_send_dummy_alert is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
# validate the type of the parameter |
678
|
0
|
|
|
|
|
0
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
679
|
0
|
0
|
|
|
|
0
|
die "Bad argument $params{$a} to alerts_send_dummy_alert ($err)" if ($err); |
680
|
|
|
|
|
|
|
|
681
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
682
|
0
|
|
|
|
|
0
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
683
|
0
|
|
|
|
|
0
|
next; |
684
|
|
|
|
|
|
|
} |
685
|
0
|
0
|
|
|
|
0
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
686
|
0
|
0
|
|
|
|
0
|
die "body has already been defined in alerts_send_dummy_alert for $args->{$a}->{name}" if ($body); |
687
|
0
|
|
|
|
|
0
|
$body = $params{$a}; |
688
|
|
|
|
|
|
|
} |
689
|
|
|
|
|
|
|
else { |
690
|
|
|
|
|
|
|
# we only want to send data that is allowed |
691
|
0
|
0
|
|
|
|
0
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
692
|
|
|
|
|
|
|
} |
693
|
|
|
|
|
|
|
} |
694
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
696
|
0
|
0
|
|
|
|
0
|
if ( ref($body) ne 'SCALAR' ) { |
697
|
0
|
0
|
|
|
|
0
|
$body = to_json($body) if ($body); |
698
|
|
|
|
|
|
|
} |
699
|
0
|
|
|
|
|
0
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
700
|
|
|
|
|
|
|
} |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
sub counts_total { |
707
|
1
|
|
|
1
|
1
|
10
|
my $self = shift; |
708
|
1
|
|
|
|
|
4
|
my (%params) = @_; |
709
|
1
|
|
|
|
|
2
|
my ( %clean_data, $body ); |
710
|
1
|
|
|
|
|
2
|
my $url = "/count/total"; |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
713
|
1
|
50
|
|
|
|
5
|
if ( ref($body) ne 'SCALAR' ) { |
714
|
1
|
50
|
|
|
|
3
|
$body = to_json($body) if ($body); |
715
|
|
|
|
|
|
|
} |
716
|
1
|
|
|
|
|
6
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
717
|
|
|
|
|
|
|
} |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
sub dashboards_list { |
724
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
725
|
0
|
|
|
|
|
|
my (%params) = @_; |
726
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
727
|
0
|
|
|
|
|
|
my $url = "/dashboards"; |
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
730
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
731
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
732
|
|
|
|
|
|
|
} |
733
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
734
|
|
|
|
|
|
|
} |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
sub dashboards_create { |
740
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
741
|
0
|
|
|
|
|
|
my (%params) = @_; |
742
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
743
|
0
|
|
|
|
|
|
my $url = "/dashboards"; |
744
|
|
|
|
|
|
|
|
745
|
0
|
|
|
|
|
|
my $args = { |
746
|
|
|
|
|
|
|
"JSON body" => { |
747
|
|
|
|
|
|
|
description => "", |
748
|
|
|
|
|
|
|
name => "JSON body", |
749
|
|
|
|
|
|
|
paramType => "body", |
750
|
|
|
|
|
|
|
required => 1, |
751
|
|
|
|
|
|
|
type => "String" |
752
|
|
|
|
|
|
|
} |
753
|
|
|
|
|
|
|
}; |
754
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
# check if the parameters exist if needed |
757
|
0
|
0
|
0
|
|
|
|
die "dashboards_create is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
758
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
# validate the type of the parameter |
760
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
761
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to dashboards_create ($err)" if ($err); |
762
|
|
|
|
|
|
|
|
763
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
764
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
765
|
0
|
|
|
|
|
|
next; |
766
|
|
|
|
|
|
|
} |
767
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
768
|
0
|
0
|
|
|
|
|
die "body has already been defined in dashboards_create for $args->{$a}->{name}" if ($body); |
769
|
0
|
|
|
|
|
|
$body = $params{$a}; |
770
|
|
|
|
|
|
|
} |
771
|
|
|
|
|
|
|
else { |
772
|
|
|
|
|
|
|
# we only want to send data that is allowed |
773
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
774
|
|
|
|
|
|
|
} |
775
|
|
|
|
|
|
|
} |
776
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
778
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
779
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
780
|
|
|
|
|
|
|
} |
781
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
782
|
|
|
|
|
|
|
} |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
sub dashboards_get { |
788
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
789
|
0
|
|
|
|
|
|
my (%params) = @_; |
790
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
791
|
0
|
|
|
|
|
|
my $url = "/dashboards/$params{dashboardId}"; |
792
|
|
|
|
|
|
|
|
793
|
0
|
|
|
|
|
|
my $args = { |
794
|
|
|
|
|
|
|
dashboardId => { |
795
|
|
|
|
|
|
|
description => "", |
796
|
|
|
|
|
|
|
name => "dashboardId", |
797
|
|
|
|
|
|
|
paramType => "path", |
798
|
|
|
|
|
|
|
required => 1, |
799
|
|
|
|
|
|
|
type => "String" |
800
|
|
|
|
|
|
|
} |
801
|
|
|
|
|
|
|
}; |
802
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
# check if the parameters exist if needed |
805
|
0
|
0
|
0
|
|
|
|
die "dashboards_get is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
806
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
# validate the type of the parameter |
808
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
809
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to dashboards_get ($err)" if ($err); |
810
|
|
|
|
|
|
|
|
811
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
812
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
813
|
0
|
|
|
|
|
|
next; |
814
|
|
|
|
|
|
|
} |
815
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
816
|
0
|
0
|
|
|
|
|
die "body has already been defined in dashboards_get for $args->{$a}->{name}" if ($body); |
817
|
0
|
|
|
|
|
|
$body = $params{$a}; |
818
|
|
|
|
|
|
|
} |
819
|
|
|
|
|
|
|
else { |
820
|
|
|
|
|
|
|
# we only want to send data that is allowed |
821
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
822
|
|
|
|
|
|
|
} |
823
|
|
|
|
|
|
|
} |
824
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
826
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
827
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
828
|
|
|
|
|
|
|
} |
829
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
830
|
|
|
|
|
|
|
} |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
sub dashboards_delete { |
836
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
837
|
0
|
|
|
|
|
|
my (%params) = @_; |
838
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
839
|
0
|
|
|
|
|
|
my $url = "/dashboards/$params{dashboardId}"; |
840
|
|
|
|
|
|
|
|
841
|
0
|
|
|
|
|
|
my $args = { |
842
|
|
|
|
|
|
|
dashboardId => { |
843
|
|
|
|
|
|
|
description => "", |
844
|
|
|
|
|
|
|
name => "dashboardId", |
845
|
|
|
|
|
|
|
paramType => "path", |
846
|
|
|
|
|
|
|
required => 1, |
847
|
|
|
|
|
|
|
type => "String" |
848
|
|
|
|
|
|
|
} |
849
|
|
|
|
|
|
|
}; |
850
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
|
852
|
|
|
|
|
|
|
# check if the parameters exist if needed |
853
|
0
|
0
|
0
|
|
|
|
die "dashboards_delete is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
854
|
|
|
|
|
|
|
|
855
|
|
|
|
|
|
|
# validate the type of the parameter |
856
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
857
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to dashboards_delete ($err)" if ($err); |
858
|
|
|
|
|
|
|
|
859
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
860
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
861
|
0
|
|
|
|
|
|
next; |
862
|
|
|
|
|
|
|
} |
863
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
864
|
0
|
0
|
|
|
|
|
die "body has already been defined in dashboards_delete for $args->{$a}->{name}" if ($body); |
865
|
0
|
|
|
|
|
|
$body = $params{$a}; |
866
|
|
|
|
|
|
|
} |
867
|
|
|
|
|
|
|
else { |
868
|
|
|
|
|
|
|
# we only want to send data that is allowed |
869
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
870
|
|
|
|
|
|
|
} |
871
|
|
|
|
|
|
|
} |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
874
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
875
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
876
|
|
|
|
|
|
|
} |
877
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
878
|
|
|
|
|
|
|
} |
879
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
sub dashboards_update { |
884
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
885
|
0
|
|
|
|
|
|
my (%params) = @_; |
886
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
887
|
0
|
|
|
|
|
|
my $url = "/dashboards/$params{dashboardId}"; |
888
|
|
|
|
|
|
|
|
889
|
0
|
|
|
|
|
|
my $args = { |
890
|
|
|
|
|
|
|
"JSON body" => { |
891
|
|
|
|
|
|
|
description => "", |
892
|
|
|
|
|
|
|
name => "JSON body", |
893
|
|
|
|
|
|
|
paramType => "body", |
894
|
|
|
|
|
|
|
required => 1, |
895
|
|
|
|
|
|
|
type => "String" |
896
|
|
|
|
|
|
|
}, |
897
|
|
|
|
|
|
|
dashboardId => { |
898
|
|
|
|
|
|
|
description => "", |
899
|
|
|
|
|
|
|
name => "dashboardId", |
900
|
|
|
|
|
|
|
paramType => "path", |
901
|
|
|
|
|
|
|
required => 1, |
902
|
|
|
|
|
|
|
type => "String" |
903
|
|
|
|
|
|
|
} |
904
|
|
|
|
|
|
|
}; |
905
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
# check if the parameters exist if needed |
908
|
0
|
0
|
0
|
|
|
|
die "dashboards_update is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
# validate the type of the parameter |
911
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
912
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to dashboards_update ($err)" if ($err); |
913
|
|
|
|
|
|
|
|
914
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
915
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
916
|
0
|
|
|
|
|
|
next; |
917
|
|
|
|
|
|
|
} |
918
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
919
|
0
|
0
|
|
|
|
|
die "body has already been defined in dashboards_update for $args->{$a}->{name}" if ($body); |
920
|
0
|
|
|
|
|
|
$body = $params{$a}; |
921
|
|
|
|
|
|
|
} |
922
|
|
|
|
|
|
|
else { |
923
|
|
|
|
|
|
|
# we only want to send data that is allowed |
924
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
925
|
|
|
|
|
|
|
} |
926
|
|
|
|
|
|
|
} |
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
929
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
930
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
931
|
|
|
|
|
|
|
} |
932
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
933
|
|
|
|
|
|
|
} |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
936
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
sub dashboards_set_positions { |
939
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
940
|
0
|
|
|
|
|
|
my (%params) = @_; |
941
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
942
|
0
|
|
|
|
|
|
my $url = "/dashboards/$params{dashboardId}/positions"; |
943
|
|
|
|
|
|
|
|
944
|
0
|
|
|
|
|
|
my $args = { |
945
|
|
|
|
|
|
|
"JSON body" => { |
946
|
|
|
|
|
|
|
description => "", |
947
|
|
|
|
|
|
|
name => "JSON body", |
948
|
|
|
|
|
|
|
paramType => "body", |
949
|
|
|
|
|
|
|
required => 1, |
950
|
|
|
|
|
|
|
type => "String" |
951
|
|
|
|
|
|
|
}, |
952
|
|
|
|
|
|
|
dashboardId => { |
953
|
|
|
|
|
|
|
description => "", |
954
|
|
|
|
|
|
|
name => "dashboardId", |
955
|
|
|
|
|
|
|
paramType => "path", |
956
|
|
|
|
|
|
|
required => 1, |
957
|
|
|
|
|
|
|
type => "String" |
958
|
|
|
|
|
|
|
} |
959
|
|
|
|
|
|
|
}; |
960
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
# check if the parameters exist if needed |
963
|
0
|
0
|
0
|
|
|
|
die "dashboards_set_positions is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
964
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
# validate the type of the parameter |
966
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
967
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to dashboards_set_positions ($err)" if ($err); |
968
|
|
|
|
|
|
|
|
969
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
970
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
971
|
0
|
|
|
|
|
|
next; |
972
|
|
|
|
|
|
|
} |
973
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
974
|
0
|
0
|
|
|
|
|
die "body has already been defined in dashboards_set_positions for $args->{$a}->{name}" if ($body); |
975
|
0
|
|
|
|
|
|
$body = $params{$a}; |
976
|
|
|
|
|
|
|
} |
977
|
|
|
|
|
|
|
else { |
978
|
|
|
|
|
|
|
# we only want to send data that is allowed |
979
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
980
|
|
|
|
|
|
|
} |
981
|
|
|
|
|
|
|
} |
982
|
|
|
|
|
|
|
|
983
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
984
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
985
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
986
|
|
|
|
|
|
|
} |
987
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
988
|
|
|
|
|
|
|
} |
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
|
993
|
|
|
|
|
|
|
sub dashboards_add_widget { |
994
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
995
|
0
|
|
|
|
|
|
my (%params) = @_; |
996
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
997
|
0
|
|
|
|
|
|
my $url = "/dashboards/$params{dashboardId}/widgets"; |
998
|
|
|
|
|
|
|
|
999
|
0
|
|
|
|
|
|
my $args = { |
1000
|
|
|
|
|
|
|
"JSON body" => { |
1001
|
|
|
|
|
|
|
description => "", |
1002
|
|
|
|
|
|
|
name => "JSON body", |
1003
|
|
|
|
|
|
|
paramType => "body", |
1004
|
|
|
|
|
|
|
required => 1, |
1005
|
|
|
|
|
|
|
type => "String" |
1006
|
|
|
|
|
|
|
}, |
1007
|
|
|
|
|
|
|
dashboardId => { |
1008
|
|
|
|
|
|
|
description => "", |
1009
|
|
|
|
|
|
|
name => "dashboardId", |
1010
|
|
|
|
|
|
|
paramType => "path", |
1011
|
|
|
|
|
|
|
required => 1, |
1012
|
|
|
|
|
|
|
type => "String" |
1013
|
|
|
|
|
|
|
} |
1014
|
|
|
|
|
|
|
}; |
1015
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
|
1017
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1018
|
0
|
0
|
0
|
|
|
|
die "dashboards_add_widget is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
# validate the type of the parameter |
1021
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1022
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to dashboards_add_widget ($err)" if ($err); |
1023
|
|
|
|
|
|
|
|
1024
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1025
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1026
|
0
|
|
|
|
|
|
next; |
1027
|
|
|
|
|
|
|
} |
1028
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1029
|
0
|
0
|
|
|
|
|
die "body has already been defined in dashboards_add_widget for $args->{$a}->{name}" if ($body); |
1030
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1031
|
|
|
|
|
|
|
} |
1032
|
|
|
|
|
|
|
else { |
1033
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1034
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1035
|
|
|
|
|
|
|
} |
1036
|
|
|
|
|
|
|
} |
1037
|
|
|
|
|
|
|
|
1038
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1039
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1040
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1041
|
|
|
|
|
|
|
} |
1042
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
1043
|
|
|
|
|
|
|
} |
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1046
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
sub dashboards_remove { |
1049
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1050
|
0
|
|
|
|
|
|
my (%params) = @_; |
1051
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1052
|
0
|
|
|
|
|
|
my $url = "/dashboards/$params{dashboardId}/widgets/$params{widgetId}"; |
1053
|
|
|
|
|
|
|
|
1054
|
0
|
|
|
|
|
|
my $args = { |
1055
|
|
|
|
|
|
|
dashboardId => { |
1056
|
|
|
|
|
|
|
description => "", |
1057
|
|
|
|
|
|
|
name => "dashboardId", |
1058
|
|
|
|
|
|
|
paramType => "path", |
1059
|
|
|
|
|
|
|
required => 1, |
1060
|
|
|
|
|
|
|
type => "String" |
1061
|
|
|
|
|
|
|
}, |
1062
|
|
|
|
|
|
|
widgetId => { |
1063
|
|
|
|
|
|
|
description => "", |
1064
|
|
|
|
|
|
|
name => "widgetId", |
1065
|
|
|
|
|
|
|
paramType => "path", |
1066
|
|
|
|
|
|
|
required => 1, |
1067
|
|
|
|
|
|
|
type => "String" |
1068
|
|
|
|
|
|
|
} |
1069
|
|
|
|
|
|
|
}; |
1070
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
|
1072
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1073
|
0
|
0
|
0
|
|
|
|
die "dashboards_remove is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1074
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
# validate the type of the parameter |
1076
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1077
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to dashboards_remove ($err)" if ($err); |
1078
|
|
|
|
|
|
|
|
1079
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1080
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1081
|
0
|
|
|
|
|
|
next; |
1082
|
|
|
|
|
|
|
} |
1083
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1084
|
0
|
0
|
|
|
|
|
die "body has already been defined in dashboards_remove for $args->{$a}->{name}" if ($body); |
1085
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1086
|
|
|
|
|
|
|
} |
1087
|
|
|
|
|
|
|
else { |
1088
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1089
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1090
|
|
|
|
|
|
|
} |
1091
|
|
|
|
|
|
|
} |
1092
|
|
|
|
|
|
|
|
1093
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1094
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1095
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1096
|
|
|
|
|
|
|
} |
1097
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
1098
|
|
|
|
|
|
|
} |
1099
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
|
1103
|
|
|
|
|
|
|
sub dashboards_update_cache_time { |
1104
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1105
|
0
|
|
|
|
|
|
my (%params) = @_; |
1106
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1107
|
0
|
|
|
|
|
|
my $url = "/dashboards/$params{dashboardId}/widgets/$params{widgetId}/cachetime"; |
1108
|
|
|
|
|
|
|
|
1109
|
0
|
|
|
|
|
|
my $args = { |
1110
|
|
|
|
|
|
|
"JSON body" => { |
1111
|
|
|
|
|
|
|
description => "", |
1112
|
|
|
|
|
|
|
name => "JSON body", |
1113
|
|
|
|
|
|
|
paramType => "body", |
1114
|
|
|
|
|
|
|
required => 1, |
1115
|
|
|
|
|
|
|
type => "String" |
1116
|
|
|
|
|
|
|
}, |
1117
|
|
|
|
|
|
|
dashboardId => { |
1118
|
|
|
|
|
|
|
description => "", |
1119
|
|
|
|
|
|
|
name => "dashboardId", |
1120
|
|
|
|
|
|
|
paramType => "path", |
1121
|
|
|
|
|
|
|
required => 1, |
1122
|
|
|
|
|
|
|
type => "String" |
1123
|
|
|
|
|
|
|
}, |
1124
|
|
|
|
|
|
|
widgetId => { |
1125
|
|
|
|
|
|
|
description => "", |
1126
|
|
|
|
|
|
|
name => "widgetId", |
1127
|
|
|
|
|
|
|
paramType => "path", |
1128
|
|
|
|
|
|
|
required => 1, |
1129
|
|
|
|
|
|
|
type => "String" |
1130
|
|
|
|
|
|
|
} |
1131
|
|
|
|
|
|
|
}; |
1132
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1135
|
0
|
0
|
0
|
|
|
|
die "dashboards_update_cache_time is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1136
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
# validate the type of the parameter |
1138
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1139
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to dashboards_update_cache_time ($err)" if ($err); |
1140
|
|
|
|
|
|
|
|
1141
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1142
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1143
|
0
|
|
|
|
|
|
next; |
1144
|
|
|
|
|
|
|
} |
1145
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1146
|
0
|
0
|
|
|
|
|
die "body has already been defined in dashboards_update_cache_time for $args->{$a}->{name}" if ($body); |
1147
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1148
|
|
|
|
|
|
|
} |
1149
|
|
|
|
|
|
|
else { |
1150
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1151
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1152
|
|
|
|
|
|
|
} |
1153
|
|
|
|
|
|
|
} |
1154
|
|
|
|
|
|
|
|
1155
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1156
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1157
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1158
|
|
|
|
|
|
|
} |
1159
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
1160
|
|
|
|
|
|
|
} |
1161
|
|
|
|
|
|
|
|
1162
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1163
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
sub dashboards_update_description { |
1166
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1167
|
0
|
|
|
|
|
|
my (%params) = @_; |
1168
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1169
|
0
|
|
|
|
|
|
my $url = "/dashboards/$params{dashboardId}/widgets/$params{widgetId}/description"; |
1170
|
|
|
|
|
|
|
|
1171
|
0
|
|
|
|
|
|
my $args = { |
1172
|
|
|
|
|
|
|
"JSON body" => { |
1173
|
|
|
|
|
|
|
description => "", |
1174
|
|
|
|
|
|
|
name => "JSON body", |
1175
|
|
|
|
|
|
|
paramType => "body", |
1176
|
|
|
|
|
|
|
required => 1, |
1177
|
|
|
|
|
|
|
type => "String" |
1178
|
|
|
|
|
|
|
}, |
1179
|
|
|
|
|
|
|
dashboardId => { |
1180
|
|
|
|
|
|
|
description => "", |
1181
|
|
|
|
|
|
|
name => "dashboardId", |
1182
|
|
|
|
|
|
|
paramType => "path", |
1183
|
|
|
|
|
|
|
required => 1, |
1184
|
|
|
|
|
|
|
type => "String" |
1185
|
|
|
|
|
|
|
}, |
1186
|
|
|
|
|
|
|
widgetId => { |
1187
|
|
|
|
|
|
|
description => "", |
1188
|
|
|
|
|
|
|
name => "widgetId", |
1189
|
|
|
|
|
|
|
paramType => "path", |
1190
|
|
|
|
|
|
|
required => 1, |
1191
|
|
|
|
|
|
|
type => "String" |
1192
|
|
|
|
|
|
|
} |
1193
|
|
|
|
|
|
|
}; |
1194
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1197
|
0
|
0
|
0
|
|
|
|
die "dashboards_update_description is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1198
|
|
|
|
|
|
|
|
1199
|
|
|
|
|
|
|
# validate the type of the parameter |
1200
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1201
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to dashboards_update_description ($err)" if ($err); |
1202
|
|
|
|
|
|
|
|
1203
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1204
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1205
|
0
|
|
|
|
|
|
next; |
1206
|
|
|
|
|
|
|
} |
1207
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1208
|
0
|
0
|
|
|
|
|
die "body has already been defined in dashboards_update_description for $args->{$a}->{name}" if ($body); |
1209
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1210
|
|
|
|
|
|
|
} |
1211
|
|
|
|
|
|
|
else { |
1212
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1213
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1214
|
|
|
|
|
|
|
} |
1215
|
|
|
|
|
|
|
} |
1216
|
|
|
|
|
|
|
|
1217
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1218
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1219
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1220
|
|
|
|
|
|
|
} |
1221
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
1222
|
|
|
|
|
|
|
} |
1223
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1225
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
|
1227
|
|
|
|
|
|
|
sub dashboards_widget_value { |
1228
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1229
|
0
|
|
|
|
|
|
my (%params) = @_; |
1230
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1231
|
0
|
|
|
|
|
|
my $url = "/dashboards/$params{dashboardId}/widgets/$params{widgetId}/value"; |
1232
|
|
|
|
|
|
|
|
1233
|
0
|
|
|
|
|
|
my $args = { |
1234
|
|
|
|
|
|
|
dashboardId => { |
1235
|
|
|
|
|
|
|
description => "", |
1236
|
|
|
|
|
|
|
name => "dashboardId", |
1237
|
|
|
|
|
|
|
paramType => "path", |
1238
|
|
|
|
|
|
|
required => 1, |
1239
|
|
|
|
|
|
|
type => "String" |
1240
|
|
|
|
|
|
|
}, |
1241
|
|
|
|
|
|
|
widgetId => { |
1242
|
|
|
|
|
|
|
description => "", |
1243
|
|
|
|
|
|
|
name => "widgetId", |
1244
|
|
|
|
|
|
|
paramType => "path", |
1245
|
|
|
|
|
|
|
required => 1, |
1246
|
|
|
|
|
|
|
type => "String" |
1247
|
|
|
|
|
|
|
} |
1248
|
|
|
|
|
|
|
}; |
1249
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1250
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1252
|
0
|
0
|
0
|
|
|
|
die "dashboards_widget_value is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1253
|
|
|
|
|
|
|
|
1254
|
|
|
|
|
|
|
# validate the type of the parameter |
1255
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1256
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to dashboards_widget_value ($err)" if ($err); |
1257
|
|
|
|
|
|
|
|
1258
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1259
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1260
|
0
|
|
|
|
|
|
next; |
1261
|
|
|
|
|
|
|
} |
1262
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1263
|
0
|
0
|
|
|
|
|
die "body has already been defined in dashboards_widget_value for $args->{$a}->{name}" if ($body); |
1264
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1265
|
|
|
|
|
|
|
} |
1266
|
|
|
|
|
|
|
else { |
1267
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1268
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1269
|
|
|
|
|
|
|
} |
1270
|
|
|
|
|
|
|
} |
1271
|
|
|
|
|
|
|
|
1272
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1273
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1274
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1275
|
|
|
|
|
|
|
} |
1276
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1277
|
|
|
|
|
|
|
} |
1278
|
|
|
|
|
|
|
|
1279
|
|
|
|
|
|
|
|
1280
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1281
|
|
|
|
|
|
|
|
1282
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
sub documentation_overview { |
1284
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1285
|
0
|
|
|
|
|
|
my (%params) = @_; |
1286
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1287
|
0
|
|
|
|
|
|
my $url = "/api-docs"; |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1290
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1291
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1292
|
|
|
|
|
|
|
} |
1293
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1294
|
|
|
|
|
|
|
} |
1295
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1297
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
|
1299
|
|
|
|
|
|
|
sub documentation_route { |
1300
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1301
|
0
|
|
|
|
|
|
my (%params) = @_; |
1302
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1303
|
0
|
|
|
|
|
|
my $url = "/api-docs/$params{route}"; |
1304
|
|
|
|
|
|
|
|
1305
|
0
|
|
|
|
|
|
my $args = { |
1306
|
|
|
|
|
|
|
route => { |
1307
|
|
|
|
|
|
|
description => "Route to fetch. For example /system", |
1308
|
|
|
|
|
|
|
name => "route", |
1309
|
|
|
|
|
|
|
paramType => "path", |
1310
|
|
|
|
|
|
|
required => 1, |
1311
|
|
|
|
|
|
|
type => "String" |
1312
|
|
|
|
|
|
|
} |
1313
|
|
|
|
|
|
|
}; |
1314
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1315
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1317
|
0
|
0
|
0
|
|
|
|
die "documentation_route is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1318
|
|
|
|
|
|
|
|
1319
|
|
|
|
|
|
|
# validate the type of the parameter |
1320
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1321
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to documentation_route ($err)" if ($err); |
1322
|
|
|
|
|
|
|
|
1323
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1324
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1325
|
0
|
|
|
|
|
|
next; |
1326
|
|
|
|
|
|
|
} |
1327
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1328
|
0
|
0
|
|
|
|
|
die "body has already been defined in documentation_route for $args->{$a}->{name}" if ($body); |
1329
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1330
|
|
|
|
|
|
|
} |
1331
|
|
|
|
|
|
|
else { |
1332
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1333
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1334
|
|
|
|
|
|
|
} |
1335
|
|
|
|
|
|
|
} |
1336
|
|
|
|
|
|
|
|
1337
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1338
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1339
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1340
|
|
|
|
|
|
|
} |
1341
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1342
|
|
|
|
|
|
|
} |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
|
1345
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1346
|
|
|
|
|
|
|
|
1347
|
|
|
|
|
|
|
|
1348
|
|
|
|
|
|
|
sub extractors_list { |
1349
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1350
|
0
|
|
|
|
|
|
my (%params) = @_; |
1351
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1352
|
0
|
|
|
|
|
|
my $url = "/system/inputs/$params{inputId}/extractors"; |
1353
|
|
|
|
|
|
|
|
1354
|
0
|
|
|
|
|
|
my $args = { |
1355
|
|
|
|
|
|
|
inputId => { |
1356
|
|
|
|
|
|
|
description => "", |
1357
|
|
|
|
|
|
|
name => "inputId", |
1358
|
|
|
|
|
|
|
paramType => "path", |
1359
|
|
|
|
|
|
|
required => 1, |
1360
|
|
|
|
|
|
|
type => "String" |
1361
|
|
|
|
|
|
|
} |
1362
|
|
|
|
|
|
|
}; |
1363
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1366
|
0
|
0
|
0
|
|
|
|
die "extractors_list is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1367
|
|
|
|
|
|
|
|
1368
|
|
|
|
|
|
|
# validate the type of the parameter |
1369
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1370
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to extractors_list ($err)" if ($err); |
1371
|
|
|
|
|
|
|
|
1372
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1373
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1374
|
0
|
|
|
|
|
|
next; |
1375
|
|
|
|
|
|
|
} |
1376
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1377
|
0
|
0
|
|
|
|
|
die "body has already been defined in extractors_list for $args->{$a}->{name}" if ($body); |
1378
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1379
|
|
|
|
|
|
|
} |
1380
|
|
|
|
|
|
|
else { |
1381
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1382
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1383
|
|
|
|
|
|
|
} |
1384
|
|
|
|
|
|
|
} |
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1387
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1388
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1389
|
|
|
|
|
|
|
} |
1390
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1391
|
|
|
|
|
|
|
} |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
|
1396
|
|
|
|
|
|
|
sub extractors_create { |
1397
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1398
|
0
|
|
|
|
|
|
my (%params) = @_; |
1399
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1400
|
0
|
|
|
|
|
|
my $url = "/system/inputs/$params{inputId}/extractors"; |
1401
|
|
|
|
|
|
|
|
1402
|
0
|
|
|
|
|
|
my $args = { |
1403
|
|
|
|
|
|
|
"JSON body" => { |
1404
|
|
|
|
|
|
|
description => "", |
1405
|
|
|
|
|
|
|
name => "JSON body", |
1406
|
|
|
|
|
|
|
paramType => "body", |
1407
|
|
|
|
|
|
|
required => 1, |
1408
|
|
|
|
|
|
|
type => "String" |
1409
|
|
|
|
|
|
|
}, |
1410
|
|
|
|
|
|
|
inputId => { |
1411
|
|
|
|
|
|
|
description => "", |
1412
|
|
|
|
|
|
|
name => "inputId", |
1413
|
|
|
|
|
|
|
paramType => "path", |
1414
|
|
|
|
|
|
|
required => 1, |
1415
|
|
|
|
|
|
|
type => "String" |
1416
|
|
|
|
|
|
|
} |
1417
|
|
|
|
|
|
|
}; |
1418
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
|
1420
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1421
|
0
|
0
|
0
|
|
|
|
die "extractors_create is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1422
|
|
|
|
|
|
|
|
1423
|
|
|
|
|
|
|
# validate the type of the parameter |
1424
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1425
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to extractors_create ($err)" if ($err); |
1426
|
|
|
|
|
|
|
|
1427
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1428
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1429
|
0
|
|
|
|
|
|
next; |
1430
|
|
|
|
|
|
|
} |
1431
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1432
|
0
|
0
|
|
|
|
|
die "body has already been defined in extractors_create for $args->{$a}->{name}" if ($body); |
1433
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1434
|
|
|
|
|
|
|
} |
1435
|
|
|
|
|
|
|
else { |
1436
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1437
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1438
|
|
|
|
|
|
|
} |
1439
|
|
|
|
|
|
|
} |
1440
|
|
|
|
|
|
|
|
1441
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1442
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1443
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1444
|
|
|
|
|
|
|
} |
1445
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
1446
|
|
|
|
|
|
|
} |
1447
|
|
|
|
|
|
|
|
1448
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1449
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
|
1451
|
|
|
|
|
|
|
sub extractors_terminate { |
1452
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1453
|
0
|
|
|
|
|
|
my (%params) = @_; |
1454
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1455
|
0
|
|
|
|
|
|
my $url = "/system/inputs/$params{inputId}/extractors/$params{extractorId}"; |
1456
|
|
|
|
|
|
|
|
1457
|
0
|
|
|
|
|
|
my $args = { |
1458
|
|
|
|
|
|
|
extractorId => { |
1459
|
|
|
|
|
|
|
description => "", |
1460
|
|
|
|
|
|
|
name => "extractorId", |
1461
|
|
|
|
|
|
|
paramType => "path", |
1462
|
|
|
|
|
|
|
required => 1, |
1463
|
|
|
|
|
|
|
type => "String" |
1464
|
|
|
|
|
|
|
}, |
1465
|
|
|
|
|
|
|
inputId => { |
1466
|
|
|
|
|
|
|
description => "", |
1467
|
|
|
|
|
|
|
name => "inputId", |
1468
|
|
|
|
|
|
|
paramType => "path", |
1469
|
|
|
|
|
|
|
required => 1, |
1470
|
|
|
|
|
|
|
type => "String" |
1471
|
|
|
|
|
|
|
} |
1472
|
|
|
|
|
|
|
}; |
1473
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1474
|
|
|
|
|
|
|
|
1475
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1476
|
0
|
0
|
0
|
|
|
|
die "extractors_terminate is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1477
|
|
|
|
|
|
|
|
1478
|
|
|
|
|
|
|
# validate the type of the parameter |
1479
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1480
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to extractors_terminate ($err)" if ($err); |
1481
|
|
|
|
|
|
|
|
1482
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1483
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1484
|
0
|
|
|
|
|
|
next; |
1485
|
|
|
|
|
|
|
} |
1486
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1487
|
0
|
0
|
|
|
|
|
die "body has already been defined in extractors_terminate for $args->{$a}->{name}" if ($body); |
1488
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1489
|
|
|
|
|
|
|
} |
1490
|
|
|
|
|
|
|
else { |
1491
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1492
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1493
|
|
|
|
|
|
|
} |
1494
|
|
|
|
|
|
|
} |
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1497
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1498
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1499
|
|
|
|
|
|
|
} |
1500
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
1501
|
|
|
|
|
|
|
} |
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
|
1504
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1505
|
|
|
|
|
|
|
|
1506
|
|
|
|
|
|
|
|
1507
|
|
|
|
|
|
|
sub indexer_cluster_cluster_health { |
1508
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1509
|
0
|
|
|
|
|
|
my (%params) = @_; |
1510
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1511
|
0
|
|
|
|
|
|
my $url = "/system/indexer/cluster/health"; |
1512
|
|
|
|
|
|
|
|
1513
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1514
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1515
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1516
|
|
|
|
|
|
|
} |
1517
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1518
|
|
|
|
|
|
|
} |
1519
|
|
|
|
|
|
|
|
1520
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1521
|
|
|
|
|
|
|
|
1522
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
sub indexer_cluster_cluster_name { |
1524
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1525
|
0
|
|
|
|
|
|
my (%params) = @_; |
1526
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1527
|
0
|
|
|
|
|
|
my $url = "/system/indexer/cluster/name"; |
1528
|
|
|
|
|
|
|
|
1529
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1530
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1531
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1532
|
|
|
|
|
|
|
} |
1533
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1534
|
|
|
|
|
|
|
} |
1535
|
|
|
|
|
|
|
|
1536
|
|
|
|
|
|
|
|
1537
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1538
|
|
|
|
|
|
|
|
1539
|
|
|
|
|
|
|
|
1540
|
|
|
|
|
|
|
sub indexer_failures_single { |
1541
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1542
|
0
|
|
|
|
|
|
my (%params) = @_; |
1543
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1544
|
0
|
|
|
|
|
|
my $url = "/system/indexer/failures"; |
1545
|
|
|
|
|
|
|
|
1546
|
0
|
|
|
|
|
|
my $args = { |
1547
|
|
|
|
|
|
|
limit => { |
1548
|
|
|
|
|
|
|
description => "Limit", |
1549
|
|
|
|
|
|
|
name => "limit", |
1550
|
|
|
|
|
|
|
paramType => "query", |
1551
|
|
|
|
|
|
|
required => 1, |
1552
|
|
|
|
|
|
|
type => "Integer" |
1553
|
|
|
|
|
|
|
}, |
1554
|
|
|
|
|
|
|
offset => { |
1555
|
|
|
|
|
|
|
description => "Offset", |
1556
|
|
|
|
|
|
|
name => "offset", |
1557
|
|
|
|
|
|
|
paramType => "query", |
1558
|
|
|
|
|
|
|
required => 1, |
1559
|
|
|
|
|
|
|
type => "Integer" |
1560
|
|
|
|
|
|
|
} |
1561
|
|
|
|
|
|
|
}; |
1562
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1563
|
|
|
|
|
|
|
|
1564
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1565
|
0
|
0
|
0
|
|
|
|
die "indexer_failures_single is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1566
|
|
|
|
|
|
|
|
1567
|
|
|
|
|
|
|
# validate the type of the parameter |
1568
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1569
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to indexer_failures_single ($err)" if ($err); |
1570
|
|
|
|
|
|
|
|
1571
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1572
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1573
|
0
|
|
|
|
|
|
next; |
1574
|
|
|
|
|
|
|
} |
1575
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1576
|
0
|
0
|
|
|
|
|
die "body has already been defined in indexer_failures_single for $args->{$a}->{name}" if ($body); |
1577
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1578
|
|
|
|
|
|
|
} |
1579
|
|
|
|
|
|
|
else { |
1580
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1581
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1582
|
|
|
|
|
|
|
} |
1583
|
|
|
|
|
|
|
} |
1584
|
|
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1586
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1587
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1588
|
|
|
|
|
|
|
} |
1589
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1590
|
|
|
|
|
|
|
} |
1591
|
|
|
|
|
|
|
|
1592
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1593
|
|
|
|
|
|
|
|
1594
|
|
|
|
|
|
|
|
1595
|
|
|
|
|
|
|
sub indexer_failures_count { |
1596
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1597
|
0
|
|
|
|
|
|
my (%params) = @_; |
1598
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1599
|
0
|
|
|
|
|
|
my $url = "/system/indexer/failures/count"; |
1600
|
|
|
|
|
|
|
|
1601
|
0
|
|
|
|
|
|
my $args = { |
1602
|
|
|
|
|
|
|
since => { |
1603
|
|
|
|
|
|
|
description => "ISO8601 date", |
1604
|
|
|
|
|
|
|
name => "since", |
1605
|
|
|
|
|
|
|
paramType => "query", |
1606
|
|
|
|
|
|
|
required => 0, |
1607
|
|
|
|
|
|
|
type => "String" |
1608
|
|
|
|
|
|
|
} |
1609
|
|
|
|
|
|
|
}; |
1610
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1611
|
|
|
|
|
|
|
|
1612
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1613
|
0
|
0
|
0
|
|
|
|
die "indexer_failures_count is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1614
|
|
|
|
|
|
|
|
1615
|
|
|
|
|
|
|
# validate the type of the parameter |
1616
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1617
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to indexer_failures_count ($err)" if ($err); |
1618
|
|
|
|
|
|
|
|
1619
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1620
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1621
|
0
|
|
|
|
|
|
next; |
1622
|
|
|
|
|
|
|
} |
1623
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1624
|
0
|
0
|
|
|
|
|
die "body has already been defined in indexer_failures_count for $args->{$a}->{name}" if ($body); |
1625
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1626
|
|
|
|
|
|
|
} |
1627
|
|
|
|
|
|
|
else { |
1628
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1629
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1630
|
|
|
|
|
|
|
} |
1631
|
|
|
|
|
|
|
} |
1632
|
|
|
|
|
|
|
|
1633
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1634
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1635
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1636
|
|
|
|
|
|
|
} |
1637
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1638
|
|
|
|
|
|
|
} |
1639
|
|
|
|
|
|
|
|
1640
|
|
|
|
|
|
|
|
1641
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1642
|
|
|
|
|
|
|
|
1643
|
|
|
|
|
|
|
|
1644
|
|
|
|
|
|
|
sub indexer_indices_closed { |
1645
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1646
|
0
|
|
|
|
|
|
my (%params) = @_; |
1647
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1648
|
0
|
|
|
|
|
|
my $url = "/system/indexer/indices/closed"; |
1649
|
|
|
|
|
|
|
|
1650
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1651
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1652
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1653
|
|
|
|
|
|
|
} |
1654
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1655
|
|
|
|
|
|
|
} |
1656
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1658
|
|
|
|
|
|
|
|
1659
|
|
|
|
|
|
|
|
1660
|
|
|
|
|
|
|
sub indexer_indices_single { |
1661
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1662
|
0
|
|
|
|
|
|
my (%params) = @_; |
1663
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1664
|
0
|
|
|
|
|
|
my $url = "/system/indexer/indices/$params{index}"; |
1665
|
|
|
|
|
|
|
|
1666
|
0
|
|
|
|
|
|
my $args = { |
1667
|
|
|
|
|
|
|
index => { |
1668
|
|
|
|
|
|
|
description => "", |
1669
|
|
|
|
|
|
|
name => "index", |
1670
|
|
|
|
|
|
|
paramType => "path", |
1671
|
|
|
|
|
|
|
required => 0, |
1672
|
|
|
|
|
|
|
type => "String" |
1673
|
|
|
|
|
|
|
} |
1674
|
|
|
|
|
|
|
}; |
1675
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1676
|
|
|
|
|
|
|
|
1677
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1678
|
0
|
0
|
0
|
|
|
|
die "indexer_indices_single is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1679
|
|
|
|
|
|
|
|
1680
|
|
|
|
|
|
|
# validate the type of the parameter |
1681
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1682
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to indexer_indices_single ($err)" if ($err); |
1683
|
|
|
|
|
|
|
|
1684
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1685
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1686
|
0
|
|
|
|
|
|
next; |
1687
|
|
|
|
|
|
|
} |
1688
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1689
|
0
|
0
|
|
|
|
|
die "body has already been defined in indexer_indices_single for $args->{$a}->{name}" if ($body); |
1690
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1691
|
|
|
|
|
|
|
} |
1692
|
|
|
|
|
|
|
else { |
1693
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1694
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1695
|
|
|
|
|
|
|
} |
1696
|
|
|
|
|
|
|
} |
1697
|
|
|
|
|
|
|
|
1698
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1699
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1700
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1701
|
|
|
|
|
|
|
} |
1702
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1703
|
|
|
|
|
|
|
} |
1704
|
|
|
|
|
|
|
|
1705
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1706
|
|
|
|
|
|
|
|
1707
|
|
|
|
|
|
|
|
1708
|
|
|
|
|
|
|
sub indexer_indices_delete { |
1709
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1710
|
0
|
|
|
|
|
|
my (%params) = @_; |
1711
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1712
|
0
|
|
|
|
|
|
my $url = "/system/indexer/indices/$params{index}"; |
1713
|
|
|
|
|
|
|
|
1714
|
0
|
|
|
|
|
|
my $args = { |
1715
|
|
|
|
|
|
|
index => { |
1716
|
|
|
|
|
|
|
description => "", |
1717
|
|
|
|
|
|
|
name => "index", |
1718
|
|
|
|
|
|
|
paramType => "path", |
1719
|
|
|
|
|
|
|
required => 0, |
1720
|
|
|
|
|
|
|
type => "String" |
1721
|
|
|
|
|
|
|
} |
1722
|
|
|
|
|
|
|
}; |
1723
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1724
|
|
|
|
|
|
|
|
1725
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1726
|
0
|
0
|
0
|
|
|
|
die "indexer_indices_delete is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1727
|
|
|
|
|
|
|
|
1728
|
|
|
|
|
|
|
# validate the type of the parameter |
1729
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1730
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to indexer_indices_delete ($err)" if ($err); |
1731
|
|
|
|
|
|
|
|
1732
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1733
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1734
|
0
|
|
|
|
|
|
next; |
1735
|
|
|
|
|
|
|
} |
1736
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1737
|
0
|
0
|
|
|
|
|
die "body has already been defined in indexer_indices_delete for $args->{$a}->{name}" if ($body); |
1738
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1739
|
|
|
|
|
|
|
} |
1740
|
|
|
|
|
|
|
else { |
1741
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1742
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1743
|
|
|
|
|
|
|
} |
1744
|
|
|
|
|
|
|
} |
1745
|
|
|
|
|
|
|
|
1746
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1747
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1748
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1749
|
|
|
|
|
|
|
} |
1750
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
1751
|
|
|
|
|
|
|
} |
1752
|
|
|
|
|
|
|
|
1753
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1754
|
|
|
|
|
|
|
|
1755
|
|
|
|
|
|
|
|
1756
|
|
|
|
|
|
|
sub indexer_indices_close { |
1757
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1758
|
0
|
|
|
|
|
|
my (%params) = @_; |
1759
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1760
|
0
|
|
|
|
|
|
my $url = "/system/indexer/indices/$params{index}/close"; |
1761
|
|
|
|
|
|
|
|
1762
|
0
|
|
|
|
|
|
my $args = { |
1763
|
|
|
|
|
|
|
index => { |
1764
|
|
|
|
|
|
|
description => "", |
1765
|
|
|
|
|
|
|
name => "index", |
1766
|
|
|
|
|
|
|
paramType => "path", |
1767
|
|
|
|
|
|
|
required => 0, |
1768
|
|
|
|
|
|
|
type => "String" |
1769
|
|
|
|
|
|
|
} |
1770
|
|
|
|
|
|
|
}; |
1771
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1772
|
|
|
|
|
|
|
|
1773
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1774
|
0
|
0
|
0
|
|
|
|
die "indexer_indices_close is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1775
|
|
|
|
|
|
|
|
1776
|
|
|
|
|
|
|
# validate the type of the parameter |
1777
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1778
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to indexer_indices_close ($err)" if ($err); |
1779
|
|
|
|
|
|
|
|
1780
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1781
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1782
|
0
|
|
|
|
|
|
next; |
1783
|
|
|
|
|
|
|
} |
1784
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1785
|
0
|
0
|
|
|
|
|
die "body has already been defined in indexer_indices_close for $args->{$a}->{name}" if ($body); |
1786
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1787
|
|
|
|
|
|
|
} |
1788
|
|
|
|
|
|
|
else { |
1789
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1790
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1791
|
|
|
|
|
|
|
} |
1792
|
|
|
|
|
|
|
} |
1793
|
|
|
|
|
|
|
|
1794
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1795
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1796
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1797
|
|
|
|
|
|
|
} |
1798
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
1799
|
|
|
|
|
|
|
} |
1800
|
|
|
|
|
|
|
|
1801
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1802
|
|
|
|
|
|
|
|
1803
|
|
|
|
|
|
|
|
1804
|
|
|
|
|
|
|
sub indexer_indices_reopen { |
1805
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1806
|
0
|
|
|
|
|
|
my (%params) = @_; |
1807
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1808
|
0
|
|
|
|
|
|
my $url = "/system/indexer/indices/$params{index}/reopen"; |
1809
|
|
|
|
|
|
|
|
1810
|
0
|
|
|
|
|
|
my $args = { |
1811
|
|
|
|
|
|
|
index => { |
1812
|
|
|
|
|
|
|
description => "", |
1813
|
|
|
|
|
|
|
name => "index", |
1814
|
|
|
|
|
|
|
paramType => "path", |
1815
|
|
|
|
|
|
|
required => 0, |
1816
|
|
|
|
|
|
|
type => "String" |
1817
|
|
|
|
|
|
|
} |
1818
|
|
|
|
|
|
|
}; |
1819
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1820
|
|
|
|
|
|
|
|
1821
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1822
|
0
|
0
|
0
|
|
|
|
die "indexer_indices_reopen is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1823
|
|
|
|
|
|
|
|
1824
|
|
|
|
|
|
|
# validate the type of the parameter |
1825
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1826
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to indexer_indices_reopen ($err)" if ($err); |
1827
|
|
|
|
|
|
|
|
1828
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1829
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1830
|
0
|
|
|
|
|
|
next; |
1831
|
|
|
|
|
|
|
} |
1832
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1833
|
0
|
0
|
|
|
|
|
die "body has already been defined in indexer_indices_reopen for $args->{$a}->{name}" if ($body); |
1834
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1835
|
|
|
|
|
|
|
} |
1836
|
|
|
|
|
|
|
else { |
1837
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1838
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1839
|
|
|
|
|
|
|
} |
1840
|
|
|
|
|
|
|
} |
1841
|
|
|
|
|
|
|
|
1842
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1843
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1844
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1845
|
|
|
|
|
|
|
} |
1846
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
1847
|
|
|
|
|
|
|
} |
1848
|
|
|
|
|
|
|
|
1849
|
|
|
|
|
|
|
|
1850
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1851
|
|
|
|
|
|
|
|
1852
|
|
|
|
|
|
|
|
1853
|
|
|
|
|
|
|
sub messages_analyze { |
1854
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1855
|
0
|
|
|
|
|
|
my (%params) = @_; |
1856
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1857
|
0
|
|
|
|
|
|
my $url = "/messages/$params{index}/analyze"; |
1858
|
|
|
|
|
|
|
|
1859
|
0
|
|
|
|
|
|
my $args = { |
1860
|
|
|
|
|
|
|
index => { |
1861
|
|
|
|
|
|
|
description => "The index the message containing the string is stored in.", |
1862
|
|
|
|
|
|
|
name => "index", |
1863
|
|
|
|
|
|
|
paramType => "path", |
1864
|
|
|
|
|
|
|
required => 1, |
1865
|
|
|
|
|
|
|
type => "String" |
1866
|
|
|
|
|
|
|
}, |
1867
|
|
|
|
|
|
|
string => { |
1868
|
|
|
|
|
|
|
description => "The string to analyze.", |
1869
|
|
|
|
|
|
|
name => "string", |
1870
|
|
|
|
|
|
|
paramType => "query", |
1871
|
|
|
|
|
|
|
required => 1, |
1872
|
|
|
|
|
|
|
type => "String" |
1873
|
|
|
|
|
|
|
} |
1874
|
|
|
|
|
|
|
}; |
1875
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1876
|
|
|
|
|
|
|
|
1877
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1878
|
0
|
0
|
0
|
|
|
|
die "messages_analyze is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1879
|
|
|
|
|
|
|
|
1880
|
|
|
|
|
|
|
# validate the type of the parameter |
1881
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1882
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to messages_analyze ($err)" if ($err); |
1883
|
|
|
|
|
|
|
|
1884
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1885
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1886
|
0
|
|
|
|
|
|
next; |
1887
|
|
|
|
|
|
|
} |
1888
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1889
|
0
|
0
|
|
|
|
|
die "body has already been defined in messages_analyze for $args->{$a}->{name}" if ($body); |
1890
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1891
|
|
|
|
|
|
|
} |
1892
|
|
|
|
|
|
|
else { |
1893
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1894
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1895
|
|
|
|
|
|
|
} |
1896
|
|
|
|
|
|
|
} |
1897
|
|
|
|
|
|
|
|
1898
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1899
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1900
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1901
|
|
|
|
|
|
|
} |
1902
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1903
|
|
|
|
|
|
|
} |
1904
|
|
|
|
|
|
|
|
1905
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1906
|
|
|
|
|
|
|
|
1907
|
|
|
|
|
|
|
|
1908
|
|
|
|
|
|
|
sub messages_search { |
1909
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1910
|
0
|
|
|
|
|
|
my (%params) = @_; |
1911
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1912
|
0
|
|
|
|
|
|
my $url = "/messages/$params{index}/$params{messageId}"; |
1913
|
|
|
|
|
|
|
|
1914
|
0
|
|
|
|
|
|
my $args = { |
1915
|
|
|
|
|
|
|
index => { |
1916
|
|
|
|
|
|
|
description => "The index this message is stored in.", |
1917
|
|
|
|
|
|
|
name => "index", |
1918
|
|
|
|
|
|
|
paramType => "path", |
1919
|
|
|
|
|
|
|
required => 1, |
1920
|
|
|
|
|
|
|
type => "String" |
1921
|
|
|
|
|
|
|
}, |
1922
|
|
|
|
|
|
|
messageId => { |
1923
|
|
|
|
|
|
|
description => "", |
1924
|
|
|
|
|
|
|
name => "messageId", |
1925
|
|
|
|
|
|
|
paramType => "path", |
1926
|
|
|
|
|
|
|
required => 1, |
1927
|
|
|
|
|
|
|
type => "String" |
1928
|
|
|
|
|
|
|
} |
1929
|
|
|
|
|
|
|
}; |
1930
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
1931
|
|
|
|
|
|
|
|
1932
|
|
|
|
|
|
|
# check if the parameters exist if needed |
1933
|
0
|
0
|
0
|
|
|
|
die "messages_search is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
1934
|
|
|
|
|
|
|
|
1935
|
|
|
|
|
|
|
# validate the type of the parameter |
1936
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
1937
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to messages_search ($err)" if ($err); |
1938
|
|
|
|
|
|
|
|
1939
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
1940
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
1941
|
0
|
|
|
|
|
|
next; |
1942
|
|
|
|
|
|
|
} |
1943
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
1944
|
0
|
0
|
|
|
|
|
die "body has already been defined in messages_search for $args->{$a}->{name}" if ($body); |
1945
|
0
|
|
|
|
|
|
$body = $params{$a}; |
1946
|
|
|
|
|
|
|
} |
1947
|
|
|
|
|
|
|
else { |
1948
|
|
|
|
|
|
|
# we only want to send data that is allowed |
1949
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
1950
|
|
|
|
|
|
|
} |
1951
|
|
|
|
|
|
|
} |
1952
|
|
|
|
|
|
|
|
1953
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
1954
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
1955
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
1956
|
|
|
|
|
|
|
} |
1957
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
1958
|
|
|
|
|
|
|
} |
1959
|
|
|
|
|
|
|
|
1960
|
|
|
|
|
|
|
|
1961
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
1962
|
|
|
|
|
|
|
|
1963
|
|
|
|
|
|
|
|
1964
|
|
|
|
|
|
|
sub search_absolute_search_absolute { |
1965
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1966
|
0
|
|
|
|
|
|
my (%params) = @_; |
1967
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
1968
|
0
|
|
|
|
|
|
my $url = "/search/universal/absolute"; |
1969
|
|
|
|
|
|
|
|
1970
|
0
|
|
|
|
|
|
my $args = { |
1971
|
|
|
|
|
|
|
filter => { |
1972
|
|
|
|
|
|
|
description => "Filter", |
1973
|
|
|
|
|
|
|
name => "filter", |
1974
|
|
|
|
|
|
|
paramType => "query", |
1975
|
|
|
|
|
|
|
required => 0, |
1976
|
|
|
|
|
|
|
type => "String" |
1977
|
|
|
|
|
|
|
}, |
1978
|
|
|
|
|
|
|
from => { |
1979
|
|
|
|
|
|
|
description => "Timerange start. See description for date format", |
1980
|
|
|
|
|
|
|
name => "from", |
1981
|
|
|
|
|
|
|
paramType => "query", |
1982
|
|
|
|
|
|
|
required => 1, |
1983
|
|
|
|
|
|
|
type => "String" |
1984
|
|
|
|
|
|
|
}, |
1985
|
|
|
|
|
|
|
limit => { |
1986
|
|
|
|
|
|
|
description => "Maximum number of messages to return.", |
1987
|
|
|
|
|
|
|
name => "limit", |
1988
|
|
|
|
|
|
|
paramType => "query", |
1989
|
|
|
|
|
|
|
required => 0, |
1990
|
|
|
|
|
|
|
type => "Integer" |
1991
|
|
|
|
|
|
|
}, |
1992
|
|
|
|
|
|
|
offset => { |
1993
|
|
|
|
|
|
|
description => "Offset", |
1994
|
|
|
|
|
|
|
name => "offset", |
1995
|
|
|
|
|
|
|
paramType => "query", |
1996
|
|
|
|
|
|
|
required => 0, |
1997
|
|
|
|
|
|
|
type => "Integer" |
1998
|
|
|
|
|
|
|
}, |
1999
|
|
|
|
|
|
|
query => { |
2000
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2001
|
|
|
|
|
|
|
name => "query", |
2002
|
|
|
|
|
|
|
paramType => "query", |
2003
|
|
|
|
|
|
|
required => 1, |
2004
|
|
|
|
|
|
|
type => "String" |
2005
|
|
|
|
|
|
|
}, |
2006
|
|
|
|
|
|
|
sort => { |
2007
|
|
|
|
|
|
|
description => "Sorting (field:asc / field:desc)", |
2008
|
|
|
|
|
|
|
name => "sort", |
2009
|
|
|
|
|
|
|
paramType => "query", |
2010
|
|
|
|
|
|
|
required => 0, |
2011
|
|
|
|
|
|
|
type => "String" |
2012
|
|
|
|
|
|
|
}, |
2013
|
|
|
|
|
|
|
to => { |
2014
|
|
|
|
|
|
|
description => "Timerange end. See description for date format", |
2015
|
|
|
|
|
|
|
name => "to", |
2016
|
|
|
|
|
|
|
paramType => "query", |
2017
|
|
|
|
|
|
|
required => 1, |
2018
|
|
|
|
|
|
|
type => "String" |
2019
|
|
|
|
|
|
|
} |
2020
|
|
|
|
|
|
|
}; |
2021
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2022
|
|
|
|
|
|
|
|
2023
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2024
|
0
|
0
|
0
|
|
|
|
die "search_absolute_search_absolute is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2025
|
|
|
|
|
|
|
|
2026
|
|
|
|
|
|
|
# validate the type of the parameter |
2027
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2028
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_absolute_search_absolute ($err)" if ($err); |
2029
|
|
|
|
|
|
|
|
2030
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2031
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2032
|
0
|
|
|
|
|
|
next; |
2033
|
|
|
|
|
|
|
} |
2034
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2035
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_absolute_search_absolute for $args->{$a}->{name}" if ($body); |
2036
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2037
|
|
|
|
|
|
|
} |
2038
|
|
|
|
|
|
|
else { |
2039
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2040
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2041
|
|
|
|
|
|
|
} |
2042
|
|
|
|
|
|
|
} |
2043
|
|
|
|
|
|
|
|
2044
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2045
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2046
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2047
|
|
|
|
|
|
|
} |
2048
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2049
|
|
|
|
|
|
|
} |
2050
|
|
|
|
|
|
|
|
2051
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2052
|
|
|
|
|
|
|
|
2053
|
|
|
|
|
|
|
|
2054
|
|
|
|
|
|
|
sub search_absolute_field_histogram_absolute { |
2055
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2056
|
0
|
|
|
|
|
|
my (%params) = @_; |
2057
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2058
|
0
|
|
|
|
|
|
my $url = "/search/universal/absolute/fieldhistogram"; |
2059
|
|
|
|
|
|
|
|
2060
|
0
|
|
|
|
|
|
my $args = { |
2061
|
|
|
|
|
|
|
field => { |
2062
|
|
|
|
|
|
|
description => "Field of whose values to get the histogram of", |
2063
|
|
|
|
|
|
|
name => "field", |
2064
|
|
|
|
|
|
|
paramType => "query", |
2065
|
|
|
|
|
|
|
required => 1, |
2066
|
|
|
|
|
|
|
type => "String" |
2067
|
|
|
|
|
|
|
}, |
2068
|
|
|
|
|
|
|
filter => { |
2069
|
|
|
|
|
|
|
description => "Filter", |
2070
|
|
|
|
|
|
|
name => "filter", |
2071
|
|
|
|
|
|
|
paramType => "query", |
2072
|
|
|
|
|
|
|
required => 0, |
2073
|
|
|
|
|
|
|
type => "String" |
2074
|
|
|
|
|
|
|
}, |
2075
|
|
|
|
|
|
|
from => { |
2076
|
|
|
|
|
|
|
description => "Timerange start. See search method description for date format", |
2077
|
|
|
|
|
|
|
name => "from", |
2078
|
|
|
|
|
|
|
paramType => "query", |
2079
|
|
|
|
|
|
|
required => 1, |
2080
|
|
|
|
|
|
|
type => "String" |
2081
|
|
|
|
|
|
|
}, |
2082
|
|
|
|
|
|
|
interval => { |
2083
|
|
|
|
|
|
|
description => "Histogram interval / bucket size. (year, quarter, month, week, day, hour or minute)", |
2084
|
|
|
|
|
|
|
name => "interval", |
2085
|
|
|
|
|
|
|
paramType => "query", |
2086
|
|
|
|
|
|
|
required => 1, |
2087
|
|
|
|
|
|
|
type => "String" |
2088
|
|
|
|
|
|
|
}, |
2089
|
|
|
|
|
|
|
query => { |
2090
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2091
|
|
|
|
|
|
|
name => "query", |
2092
|
|
|
|
|
|
|
paramType => "query", |
2093
|
|
|
|
|
|
|
required => 1, |
2094
|
|
|
|
|
|
|
type => "String" |
2095
|
|
|
|
|
|
|
}, |
2096
|
|
|
|
|
|
|
to => { |
2097
|
|
|
|
|
|
|
description => "Timerange end. See search method description for date format", |
2098
|
|
|
|
|
|
|
name => "to", |
2099
|
|
|
|
|
|
|
paramType => "query", |
2100
|
|
|
|
|
|
|
required => 1, |
2101
|
|
|
|
|
|
|
type => "String" |
2102
|
|
|
|
|
|
|
} |
2103
|
|
|
|
|
|
|
}; |
2104
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2105
|
|
|
|
|
|
|
|
2106
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2107
|
0
|
0
|
0
|
|
|
|
die "search_absolute_field_histogram_absolute is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2108
|
|
|
|
|
|
|
|
2109
|
|
|
|
|
|
|
# validate the type of the parameter |
2110
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2111
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_absolute_field_histogram_absolute ($err)" if ($err); |
2112
|
|
|
|
|
|
|
|
2113
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2114
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2115
|
0
|
|
|
|
|
|
next; |
2116
|
|
|
|
|
|
|
} |
2117
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2118
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_absolute_field_histogram_absolute for $args->{$a}->{name}" if ($body); |
2119
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2120
|
|
|
|
|
|
|
} |
2121
|
|
|
|
|
|
|
else { |
2122
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2123
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2124
|
|
|
|
|
|
|
} |
2125
|
|
|
|
|
|
|
} |
2126
|
|
|
|
|
|
|
|
2127
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2128
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2129
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2130
|
|
|
|
|
|
|
} |
2131
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2132
|
|
|
|
|
|
|
} |
2133
|
|
|
|
|
|
|
|
2134
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2135
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
|
2137
|
|
|
|
|
|
|
sub search_absolute_histogram_absolute { |
2138
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2139
|
0
|
|
|
|
|
|
my (%params) = @_; |
2140
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2141
|
0
|
|
|
|
|
|
my $url = "/search/universal/absolute/histogram"; |
2142
|
|
|
|
|
|
|
|
2143
|
0
|
|
|
|
|
|
my $args = { |
2144
|
|
|
|
|
|
|
filter => { |
2145
|
|
|
|
|
|
|
description => "Filter", |
2146
|
|
|
|
|
|
|
name => "filter", |
2147
|
|
|
|
|
|
|
paramType => "query", |
2148
|
|
|
|
|
|
|
required => 0, |
2149
|
|
|
|
|
|
|
type => "String" |
2150
|
|
|
|
|
|
|
}, |
2151
|
|
|
|
|
|
|
from => { |
2152
|
|
|
|
|
|
|
description => "Timerange start. See search method description for date format", |
2153
|
|
|
|
|
|
|
name => "from", |
2154
|
|
|
|
|
|
|
paramType => "query", |
2155
|
|
|
|
|
|
|
required => 1, |
2156
|
|
|
|
|
|
|
type => "String" |
2157
|
|
|
|
|
|
|
}, |
2158
|
|
|
|
|
|
|
interval => { |
2159
|
|
|
|
|
|
|
description => "Histogram interval / bucket size. (year, quarter, month, week, day, hour or minute)", |
2160
|
|
|
|
|
|
|
name => "interval", |
2161
|
|
|
|
|
|
|
paramType => "query", |
2162
|
|
|
|
|
|
|
required => 1, |
2163
|
|
|
|
|
|
|
type => "String" |
2164
|
|
|
|
|
|
|
}, |
2165
|
|
|
|
|
|
|
query => { |
2166
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2167
|
|
|
|
|
|
|
name => "query", |
2168
|
|
|
|
|
|
|
paramType => "query", |
2169
|
|
|
|
|
|
|
required => 1, |
2170
|
|
|
|
|
|
|
type => "String" |
2171
|
|
|
|
|
|
|
}, |
2172
|
|
|
|
|
|
|
to => { |
2173
|
|
|
|
|
|
|
description => "Timerange end. See search method description for date format", |
2174
|
|
|
|
|
|
|
name => "to", |
2175
|
|
|
|
|
|
|
paramType => "query", |
2176
|
|
|
|
|
|
|
required => 1, |
2177
|
|
|
|
|
|
|
type => "String" |
2178
|
|
|
|
|
|
|
} |
2179
|
|
|
|
|
|
|
}; |
2180
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2181
|
|
|
|
|
|
|
|
2182
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2183
|
0
|
0
|
0
|
|
|
|
die "search_absolute_histogram_absolute is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2184
|
|
|
|
|
|
|
|
2185
|
|
|
|
|
|
|
# validate the type of the parameter |
2186
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2187
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_absolute_histogram_absolute ($err)" if ($err); |
2188
|
|
|
|
|
|
|
|
2189
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2190
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2191
|
0
|
|
|
|
|
|
next; |
2192
|
|
|
|
|
|
|
} |
2193
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2194
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_absolute_histogram_absolute for $args->{$a}->{name}" if ($body); |
2195
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2196
|
|
|
|
|
|
|
} |
2197
|
|
|
|
|
|
|
else { |
2198
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2199
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2200
|
|
|
|
|
|
|
} |
2201
|
|
|
|
|
|
|
} |
2202
|
|
|
|
|
|
|
|
2203
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2204
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2205
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2206
|
|
|
|
|
|
|
} |
2207
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2208
|
|
|
|
|
|
|
} |
2209
|
|
|
|
|
|
|
|
2210
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2211
|
|
|
|
|
|
|
|
2212
|
|
|
|
|
|
|
|
2213
|
|
|
|
|
|
|
sub search_absolute_stats_absolute { |
2214
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2215
|
0
|
|
|
|
|
|
my (%params) = @_; |
2216
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2217
|
0
|
|
|
|
|
|
my $url = "/search/universal/absolute/stats"; |
2218
|
|
|
|
|
|
|
|
2219
|
0
|
|
|
|
|
|
my $args = { |
2220
|
|
|
|
|
|
|
field => { |
2221
|
|
|
|
|
|
|
description => "Message field of numeric type to return statistics for", |
2222
|
|
|
|
|
|
|
name => "field", |
2223
|
|
|
|
|
|
|
paramType => "query", |
2224
|
|
|
|
|
|
|
required => 1, |
2225
|
|
|
|
|
|
|
type => "String" |
2226
|
|
|
|
|
|
|
}, |
2227
|
|
|
|
|
|
|
filter => { |
2228
|
|
|
|
|
|
|
description => "Filter", |
2229
|
|
|
|
|
|
|
name => "filter", |
2230
|
|
|
|
|
|
|
paramType => "query", |
2231
|
|
|
|
|
|
|
required => 0, |
2232
|
|
|
|
|
|
|
type => "String" |
2233
|
|
|
|
|
|
|
}, |
2234
|
|
|
|
|
|
|
from => { |
2235
|
|
|
|
|
|
|
description => "Timerange start. See search method description for date format", |
2236
|
|
|
|
|
|
|
name => "from", |
2237
|
|
|
|
|
|
|
paramType => "query", |
2238
|
|
|
|
|
|
|
required => 1, |
2239
|
|
|
|
|
|
|
type => "String" |
2240
|
|
|
|
|
|
|
}, |
2241
|
|
|
|
|
|
|
query => { |
2242
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2243
|
|
|
|
|
|
|
name => "query", |
2244
|
|
|
|
|
|
|
paramType => "query", |
2245
|
|
|
|
|
|
|
required => 1, |
2246
|
|
|
|
|
|
|
type => "String" |
2247
|
|
|
|
|
|
|
}, |
2248
|
|
|
|
|
|
|
to => { |
2249
|
|
|
|
|
|
|
description => "Timerange end. See search method description for date format", |
2250
|
|
|
|
|
|
|
name => "to", |
2251
|
|
|
|
|
|
|
paramType => "query", |
2252
|
|
|
|
|
|
|
required => 1, |
2253
|
|
|
|
|
|
|
type => "String" |
2254
|
|
|
|
|
|
|
} |
2255
|
|
|
|
|
|
|
}; |
2256
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2257
|
|
|
|
|
|
|
|
2258
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2259
|
0
|
0
|
0
|
|
|
|
die "search_absolute_stats_absolute is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2260
|
|
|
|
|
|
|
|
2261
|
|
|
|
|
|
|
# validate the type of the parameter |
2262
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2263
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_absolute_stats_absolute ($err)" if ($err); |
2264
|
|
|
|
|
|
|
|
2265
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2266
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2267
|
0
|
|
|
|
|
|
next; |
2268
|
|
|
|
|
|
|
} |
2269
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2270
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_absolute_stats_absolute for $args->{$a}->{name}" if ($body); |
2271
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2272
|
|
|
|
|
|
|
} |
2273
|
|
|
|
|
|
|
else { |
2274
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2275
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2276
|
|
|
|
|
|
|
} |
2277
|
|
|
|
|
|
|
} |
2278
|
|
|
|
|
|
|
|
2279
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2280
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2281
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2282
|
|
|
|
|
|
|
} |
2283
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2284
|
|
|
|
|
|
|
} |
2285
|
|
|
|
|
|
|
|
2286
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2287
|
|
|
|
|
|
|
|
2288
|
|
|
|
|
|
|
|
2289
|
|
|
|
|
|
|
sub search_absolute_terms_absolute { |
2290
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2291
|
0
|
|
|
|
|
|
my (%params) = @_; |
2292
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2293
|
0
|
|
|
|
|
|
my $url = "/search/universal/absolute/terms"; |
2294
|
|
|
|
|
|
|
|
2295
|
0
|
|
|
|
|
|
my $args = { |
2296
|
|
|
|
|
|
|
field => { |
2297
|
|
|
|
|
|
|
description => "Message field of to return terms of", |
2298
|
|
|
|
|
|
|
name => "field", |
2299
|
|
|
|
|
|
|
paramType => "query", |
2300
|
|
|
|
|
|
|
required => 1, |
2301
|
|
|
|
|
|
|
type => "String" |
2302
|
|
|
|
|
|
|
}, |
2303
|
|
|
|
|
|
|
filter => { |
2304
|
|
|
|
|
|
|
description => "Filter", |
2305
|
|
|
|
|
|
|
name => "filter", |
2306
|
|
|
|
|
|
|
paramType => "query", |
2307
|
|
|
|
|
|
|
required => 0, |
2308
|
|
|
|
|
|
|
type => "String" |
2309
|
|
|
|
|
|
|
}, |
2310
|
|
|
|
|
|
|
from => { |
2311
|
|
|
|
|
|
|
description => "Timerange start. See search method description for date format", |
2312
|
|
|
|
|
|
|
name => "from", |
2313
|
|
|
|
|
|
|
paramType => "query", |
2314
|
|
|
|
|
|
|
required => 1, |
2315
|
|
|
|
|
|
|
type => "String" |
2316
|
|
|
|
|
|
|
}, |
2317
|
|
|
|
|
|
|
query => { |
2318
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2319
|
|
|
|
|
|
|
name => "query", |
2320
|
|
|
|
|
|
|
paramType => "query", |
2321
|
|
|
|
|
|
|
required => 1, |
2322
|
|
|
|
|
|
|
type => "String" |
2323
|
|
|
|
|
|
|
}, |
2324
|
|
|
|
|
|
|
size => { |
2325
|
|
|
|
|
|
|
description => "Maximum number of terms to return", |
2326
|
|
|
|
|
|
|
name => "size", |
2327
|
|
|
|
|
|
|
paramType => "query", |
2328
|
|
|
|
|
|
|
required => 0, |
2329
|
|
|
|
|
|
|
type => "Integer" |
2330
|
|
|
|
|
|
|
}, |
2331
|
|
|
|
|
|
|
to => { |
2332
|
|
|
|
|
|
|
description => "Timerange end. See search method description for date format", |
2333
|
|
|
|
|
|
|
name => "to", |
2334
|
|
|
|
|
|
|
paramType => "query", |
2335
|
|
|
|
|
|
|
required => 1, |
2336
|
|
|
|
|
|
|
type => "String" |
2337
|
|
|
|
|
|
|
} |
2338
|
|
|
|
|
|
|
}; |
2339
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2340
|
|
|
|
|
|
|
|
2341
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2342
|
0
|
0
|
0
|
|
|
|
die "search_absolute_terms_absolute is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2343
|
|
|
|
|
|
|
|
2344
|
|
|
|
|
|
|
# validate the type of the parameter |
2345
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2346
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_absolute_terms_absolute ($err)" if ($err); |
2347
|
|
|
|
|
|
|
|
2348
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2349
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2350
|
0
|
|
|
|
|
|
next; |
2351
|
|
|
|
|
|
|
} |
2352
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2353
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_absolute_terms_absolute for $args->{$a}->{name}" if ($body); |
2354
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2355
|
|
|
|
|
|
|
} |
2356
|
|
|
|
|
|
|
else { |
2357
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2358
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2359
|
|
|
|
|
|
|
} |
2360
|
|
|
|
|
|
|
} |
2361
|
|
|
|
|
|
|
|
2362
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2363
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2364
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2365
|
|
|
|
|
|
|
} |
2366
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2367
|
|
|
|
|
|
|
} |
2368
|
|
|
|
|
|
|
|
2369
|
|
|
|
|
|
|
|
2370
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2371
|
|
|
|
|
|
|
|
2372
|
|
|
|
|
|
|
|
2373
|
|
|
|
|
|
|
sub search_keyword_search_keyword { |
2374
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2375
|
0
|
|
|
|
|
|
my (%params) = @_; |
2376
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2377
|
0
|
|
|
|
|
|
my $url = "/search/universal/keyword"; |
2378
|
|
|
|
|
|
|
|
2379
|
0
|
|
|
|
|
|
my $args = { |
2380
|
|
|
|
|
|
|
filter => { |
2381
|
|
|
|
|
|
|
description => "Filter", |
2382
|
|
|
|
|
|
|
name => "filter", |
2383
|
|
|
|
|
|
|
paramType => "query", |
2384
|
|
|
|
|
|
|
required => 0, |
2385
|
|
|
|
|
|
|
type => "String" |
2386
|
|
|
|
|
|
|
}, |
2387
|
|
|
|
|
|
|
keyword => { |
2388
|
|
|
|
|
|
|
description => "Range keyword", |
2389
|
|
|
|
|
|
|
name => "keyword", |
2390
|
|
|
|
|
|
|
paramType => "query", |
2391
|
|
|
|
|
|
|
required => 1, |
2392
|
|
|
|
|
|
|
type => "String" |
2393
|
|
|
|
|
|
|
}, |
2394
|
|
|
|
|
|
|
limit => { |
2395
|
|
|
|
|
|
|
description => "Maximum number of messages to return.", |
2396
|
|
|
|
|
|
|
name => "limit", |
2397
|
|
|
|
|
|
|
paramType => "query", |
2398
|
|
|
|
|
|
|
required => 0, |
2399
|
|
|
|
|
|
|
type => "Integer" |
2400
|
|
|
|
|
|
|
}, |
2401
|
|
|
|
|
|
|
offset => { |
2402
|
|
|
|
|
|
|
description => "Offset", |
2403
|
|
|
|
|
|
|
name => "offset", |
2404
|
|
|
|
|
|
|
paramType => "query", |
2405
|
|
|
|
|
|
|
required => 0, |
2406
|
|
|
|
|
|
|
type => "Integer" |
2407
|
|
|
|
|
|
|
}, |
2408
|
|
|
|
|
|
|
query => { |
2409
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2410
|
|
|
|
|
|
|
name => "query", |
2411
|
|
|
|
|
|
|
paramType => "query", |
2412
|
|
|
|
|
|
|
required => 1, |
2413
|
|
|
|
|
|
|
type => "String" |
2414
|
|
|
|
|
|
|
}, |
2415
|
|
|
|
|
|
|
sort => { |
2416
|
|
|
|
|
|
|
description => "Sorting (field:asc / field:desc)", |
2417
|
|
|
|
|
|
|
name => "sort", |
2418
|
|
|
|
|
|
|
paramType => "query", |
2419
|
|
|
|
|
|
|
required => 0, |
2420
|
|
|
|
|
|
|
type => "String" |
2421
|
|
|
|
|
|
|
} |
2422
|
|
|
|
|
|
|
}; |
2423
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2424
|
|
|
|
|
|
|
|
2425
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2426
|
0
|
0
|
0
|
|
|
|
die "search_keyword_search_keyword is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2427
|
|
|
|
|
|
|
|
2428
|
|
|
|
|
|
|
# validate the type of the parameter |
2429
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2430
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_keyword_search_keyword ($err)" if ($err); |
2431
|
|
|
|
|
|
|
|
2432
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2433
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2434
|
0
|
|
|
|
|
|
next; |
2435
|
|
|
|
|
|
|
} |
2436
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2437
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_keyword_search_keyword for $args->{$a}->{name}" if ($body); |
2438
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2439
|
|
|
|
|
|
|
} |
2440
|
|
|
|
|
|
|
else { |
2441
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2442
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2443
|
|
|
|
|
|
|
} |
2444
|
|
|
|
|
|
|
} |
2445
|
|
|
|
|
|
|
|
2446
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2447
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2448
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2449
|
|
|
|
|
|
|
} |
2450
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2451
|
|
|
|
|
|
|
} |
2452
|
|
|
|
|
|
|
|
2453
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2454
|
|
|
|
|
|
|
|
2455
|
|
|
|
|
|
|
|
2456
|
|
|
|
|
|
|
sub search_keyword_field_histogram_keyword { |
2457
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2458
|
0
|
|
|
|
|
|
my (%params) = @_; |
2459
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2460
|
0
|
|
|
|
|
|
my $url = "/search/universal/keyword/fieldhistogram"; |
2461
|
|
|
|
|
|
|
|
2462
|
0
|
|
|
|
|
|
my $args = { |
2463
|
|
|
|
|
|
|
field => { |
2464
|
|
|
|
|
|
|
description => "Field of whose values to get the histogram of", |
2465
|
|
|
|
|
|
|
name => "field", |
2466
|
|
|
|
|
|
|
paramType => "query", |
2467
|
|
|
|
|
|
|
required => 1, |
2468
|
|
|
|
|
|
|
type => "String" |
2469
|
|
|
|
|
|
|
}, |
2470
|
|
|
|
|
|
|
filter => { |
2471
|
|
|
|
|
|
|
description => "Filter", |
2472
|
|
|
|
|
|
|
name => "filter", |
2473
|
|
|
|
|
|
|
paramType => "query", |
2474
|
|
|
|
|
|
|
required => 0, |
2475
|
|
|
|
|
|
|
type => "String" |
2476
|
|
|
|
|
|
|
}, |
2477
|
|
|
|
|
|
|
interval => { |
2478
|
|
|
|
|
|
|
description => "Histogram interval / bucket size. (year, quarter, month, week, day, hour or minute)", |
2479
|
|
|
|
|
|
|
name => "interval", |
2480
|
|
|
|
|
|
|
paramType => "query", |
2481
|
|
|
|
|
|
|
required => 1, |
2482
|
|
|
|
|
|
|
type => "String" |
2483
|
|
|
|
|
|
|
}, |
2484
|
|
|
|
|
|
|
keyword => { |
2485
|
|
|
|
|
|
|
description => "Range keyword", |
2486
|
|
|
|
|
|
|
name => "keyword", |
2487
|
|
|
|
|
|
|
paramType => "query", |
2488
|
|
|
|
|
|
|
required => 1, |
2489
|
|
|
|
|
|
|
type => "String" |
2490
|
|
|
|
|
|
|
}, |
2491
|
|
|
|
|
|
|
query => { |
2492
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2493
|
|
|
|
|
|
|
name => "query", |
2494
|
|
|
|
|
|
|
paramType => "query", |
2495
|
|
|
|
|
|
|
required => 1, |
2496
|
|
|
|
|
|
|
type => "String" |
2497
|
|
|
|
|
|
|
} |
2498
|
|
|
|
|
|
|
}; |
2499
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2500
|
|
|
|
|
|
|
|
2501
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2502
|
0
|
0
|
0
|
|
|
|
die "search_keyword_field_histogram_keyword is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2503
|
|
|
|
|
|
|
|
2504
|
|
|
|
|
|
|
# validate the type of the parameter |
2505
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2506
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_keyword_field_histogram_keyword ($err)" if ($err); |
2507
|
|
|
|
|
|
|
|
2508
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2509
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2510
|
0
|
|
|
|
|
|
next; |
2511
|
|
|
|
|
|
|
} |
2512
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2513
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_keyword_field_histogram_keyword for $args->{$a}->{name}" if ($body); |
2514
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2515
|
|
|
|
|
|
|
} |
2516
|
|
|
|
|
|
|
else { |
2517
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2518
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2519
|
|
|
|
|
|
|
} |
2520
|
|
|
|
|
|
|
} |
2521
|
|
|
|
|
|
|
|
2522
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2523
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2524
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2525
|
|
|
|
|
|
|
} |
2526
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2527
|
|
|
|
|
|
|
} |
2528
|
|
|
|
|
|
|
|
2529
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2530
|
|
|
|
|
|
|
|
2531
|
|
|
|
|
|
|
|
2532
|
|
|
|
|
|
|
sub search_keyword_histogram_keyword { |
2533
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2534
|
0
|
|
|
|
|
|
my (%params) = @_; |
2535
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2536
|
0
|
|
|
|
|
|
my $url = "/search/universal/keyword/histogram"; |
2537
|
|
|
|
|
|
|
|
2538
|
0
|
|
|
|
|
|
my $args = { |
2539
|
|
|
|
|
|
|
filter => { |
2540
|
|
|
|
|
|
|
description => "Filter", |
2541
|
|
|
|
|
|
|
name => "filter", |
2542
|
|
|
|
|
|
|
paramType => "query", |
2543
|
|
|
|
|
|
|
required => 0, |
2544
|
|
|
|
|
|
|
type => "String" |
2545
|
|
|
|
|
|
|
}, |
2546
|
|
|
|
|
|
|
interval => { |
2547
|
|
|
|
|
|
|
description => "Histogram interval / bucket size. (year, quarter, month, week, day, hour or minute)", |
2548
|
|
|
|
|
|
|
name => "interval", |
2549
|
|
|
|
|
|
|
paramType => "query", |
2550
|
|
|
|
|
|
|
required => 1, |
2551
|
|
|
|
|
|
|
type => "String" |
2552
|
|
|
|
|
|
|
}, |
2553
|
|
|
|
|
|
|
keyword => { |
2554
|
|
|
|
|
|
|
description => "Range keyword", |
2555
|
|
|
|
|
|
|
name => "keyword", |
2556
|
|
|
|
|
|
|
paramType => "query", |
2557
|
|
|
|
|
|
|
required => 1, |
2558
|
|
|
|
|
|
|
type => "String" |
2559
|
|
|
|
|
|
|
}, |
2560
|
|
|
|
|
|
|
query => { |
2561
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2562
|
|
|
|
|
|
|
name => "query", |
2563
|
|
|
|
|
|
|
paramType => "query", |
2564
|
|
|
|
|
|
|
required => 1, |
2565
|
|
|
|
|
|
|
type => "String" |
2566
|
|
|
|
|
|
|
} |
2567
|
|
|
|
|
|
|
}; |
2568
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2569
|
|
|
|
|
|
|
|
2570
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2571
|
0
|
0
|
0
|
|
|
|
die "search_keyword_histogram_keyword is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2572
|
|
|
|
|
|
|
|
2573
|
|
|
|
|
|
|
# validate the type of the parameter |
2574
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2575
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_keyword_histogram_keyword ($err)" if ($err); |
2576
|
|
|
|
|
|
|
|
2577
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2578
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2579
|
0
|
|
|
|
|
|
next; |
2580
|
|
|
|
|
|
|
} |
2581
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2582
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_keyword_histogram_keyword for $args->{$a}->{name}" if ($body); |
2583
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2584
|
|
|
|
|
|
|
} |
2585
|
|
|
|
|
|
|
else { |
2586
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2587
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2588
|
|
|
|
|
|
|
} |
2589
|
|
|
|
|
|
|
} |
2590
|
|
|
|
|
|
|
|
2591
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2592
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2593
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2594
|
|
|
|
|
|
|
} |
2595
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2596
|
|
|
|
|
|
|
} |
2597
|
|
|
|
|
|
|
|
2598
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2599
|
|
|
|
|
|
|
|
2600
|
|
|
|
|
|
|
|
2601
|
|
|
|
|
|
|
sub search_keyword_stats_keyword { |
2602
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2603
|
0
|
|
|
|
|
|
my (%params) = @_; |
2604
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2605
|
0
|
|
|
|
|
|
my $url = "/search/universal/keyword/stats"; |
2606
|
|
|
|
|
|
|
|
2607
|
0
|
|
|
|
|
|
my $args = { |
2608
|
|
|
|
|
|
|
field => { |
2609
|
|
|
|
|
|
|
description => "Message field of numeric type to return statistics for", |
2610
|
|
|
|
|
|
|
name => "field", |
2611
|
|
|
|
|
|
|
paramType => "query", |
2612
|
|
|
|
|
|
|
required => 1, |
2613
|
|
|
|
|
|
|
type => "String" |
2614
|
|
|
|
|
|
|
}, |
2615
|
|
|
|
|
|
|
filter => { |
2616
|
|
|
|
|
|
|
description => "Filter", |
2617
|
|
|
|
|
|
|
name => "filter", |
2618
|
|
|
|
|
|
|
paramType => "query", |
2619
|
|
|
|
|
|
|
required => 0, |
2620
|
|
|
|
|
|
|
type => "String" |
2621
|
|
|
|
|
|
|
}, |
2622
|
|
|
|
|
|
|
keyword => { |
2623
|
|
|
|
|
|
|
description => "Range keyword", |
2624
|
|
|
|
|
|
|
name => "keyword", |
2625
|
|
|
|
|
|
|
paramType => "query", |
2626
|
|
|
|
|
|
|
required => 1, |
2627
|
|
|
|
|
|
|
type => "String" |
2628
|
|
|
|
|
|
|
}, |
2629
|
|
|
|
|
|
|
query => { |
2630
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2631
|
|
|
|
|
|
|
name => "query", |
2632
|
|
|
|
|
|
|
paramType => "query", |
2633
|
|
|
|
|
|
|
required => 1, |
2634
|
|
|
|
|
|
|
type => "String" |
2635
|
|
|
|
|
|
|
} |
2636
|
|
|
|
|
|
|
}; |
2637
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2638
|
|
|
|
|
|
|
|
2639
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2640
|
0
|
0
|
0
|
|
|
|
die "search_keyword_stats_keyword is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2641
|
|
|
|
|
|
|
|
2642
|
|
|
|
|
|
|
# validate the type of the parameter |
2643
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2644
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_keyword_stats_keyword ($err)" if ($err); |
2645
|
|
|
|
|
|
|
|
2646
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2647
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2648
|
0
|
|
|
|
|
|
next; |
2649
|
|
|
|
|
|
|
} |
2650
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2651
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_keyword_stats_keyword for $args->{$a}->{name}" if ($body); |
2652
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2653
|
|
|
|
|
|
|
} |
2654
|
|
|
|
|
|
|
else { |
2655
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2656
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2657
|
|
|
|
|
|
|
} |
2658
|
|
|
|
|
|
|
} |
2659
|
|
|
|
|
|
|
|
2660
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2661
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2662
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2663
|
|
|
|
|
|
|
} |
2664
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2665
|
|
|
|
|
|
|
} |
2666
|
|
|
|
|
|
|
|
2667
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2668
|
|
|
|
|
|
|
|
2669
|
|
|
|
|
|
|
|
2670
|
|
|
|
|
|
|
sub search_keyword_terms_keyword { |
2671
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2672
|
0
|
|
|
|
|
|
my (%params) = @_; |
2673
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2674
|
0
|
|
|
|
|
|
my $url = "/search/universal/keyword/terms"; |
2675
|
|
|
|
|
|
|
|
2676
|
0
|
|
|
|
|
|
my $args = { |
2677
|
|
|
|
|
|
|
field => { |
2678
|
|
|
|
|
|
|
description => "Message field of to return terms of", |
2679
|
|
|
|
|
|
|
name => "field", |
2680
|
|
|
|
|
|
|
paramType => "query", |
2681
|
|
|
|
|
|
|
required => 1, |
2682
|
|
|
|
|
|
|
type => "String" |
2683
|
|
|
|
|
|
|
}, |
2684
|
|
|
|
|
|
|
filter => { |
2685
|
|
|
|
|
|
|
description => "Filter", |
2686
|
|
|
|
|
|
|
name => "filter", |
2687
|
|
|
|
|
|
|
paramType => "query", |
2688
|
|
|
|
|
|
|
required => 0, |
2689
|
|
|
|
|
|
|
type => "String" |
2690
|
|
|
|
|
|
|
}, |
2691
|
|
|
|
|
|
|
keyword => { |
2692
|
|
|
|
|
|
|
description => "Range keyword", |
2693
|
|
|
|
|
|
|
name => "keyword", |
2694
|
|
|
|
|
|
|
paramType => "query", |
2695
|
|
|
|
|
|
|
required => 1, |
2696
|
|
|
|
|
|
|
type => "String" |
2697
|
|
|
|
|
|
|
}, |
2698
|
|
|
|
|
|
|
query => { |
2699
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2700
|
|
|
|
|
|
|
name => "query", |
2701
|
|
|
|
|
|
|
paramType => "query", |
2702
|
|
|
|
|
|
|
required => 1, |
2703
|
|
|
|
|
|
|
type => "String" |
2704
|
|
|
|
|
|
|
}, |
2705
|
|
|
|
|
|
|
size => { |
2706
|
|
|
|
|
|
|
description => "Maximum number of terms to return", |
2707
|
|
|
|
|
|
|
name => "size", |
2708
|
|
|
|
|
|
|
paramType => "query", |
2709
|
|
|
|
|
|
|
required => 0, |
2710
|
|
|
|
|
|
|
type => "Integer" |
2711
|
|
|
|
|
|
|
} |
2712
|
|
|
|
|
|
|
}; |
2713
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2714
|
|
|
|
|
|
|
|
2715
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2716
|
0
|
0
|
0
|
|
|
|
die "search_keyword_terms_keyword is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2717
|
|
|
|
|
|
|
|
2718
|
|
|
|
|
|
|
# validate the type of the parameter |
2719
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2720
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_keyword_terms_keyword ($err)" if ($err); |
2721
|
|
|
|
|
|
|
|
2722
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2723
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2724
|
0
|
|
|
|
|
|
next; |
2725
|
|
|
|
|
|
|
} |
2726
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2727
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_keyword_terms_keyword for $args->{$a}->{name}" if ($body); |
2728
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2729
|
|
|
|
|
|
|
} |
2730
|
|
|
|
|
|
|
else { |
2731
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2732
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2733
|
|
|
|
|
|
|
} |
2734
|
|
|
|
|
|
|
} |
2735
|
|
|
|
|
|
|
|
2736
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2737
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2738
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2739
|
|
|
|
|
|
|
} |
2740
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2741
|
|
|
|
|
|
|
} |
2742
|
|
|
|
|
|
|
|
2743
|
|
|
|
|
|
|
|
2744
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2745
|
|
|
|
|
|
|
|
2746
|
|
|
|
|
|
|
|
2747
|
|
|
|
|
|
|
sub search_relative_search_relative { |
2748
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2749
|
0
|
|
|
|
|
|
my (%params) = @_; |
2750
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2751
|
0
|
|
|
|
|
|
my $url = "/search/universal/relative"; |
2752
|
|
|
|
|
|
|
|
2753
|
0
|
|
|
|
|
|
my $args = { |
2754
|
|
|
|
|
|
|
filter => { |
2755
|
|
|
|
|
|
|
description => "Filter", |
2756
|
|
|
|
|
|
|
name => "filter", |
2757
|
|
|
|
|
|
|
paramType => "query", |
2758
|
|
|
|
|
|
|
required => 0, |
2759
|
|
|
|
|
|
|
type => "String" |
2760
|
|
|
|
|
|
|
}, |
2761
|
|
|
|
|
|
|
limit => { |
2762
|
|
|
|
|
|
|
description => "Maximum number of messages to return.", |
2763
|
|
|
|
|
|
|
name => "limit", |
2764
|
|
|
|
|
|
|
paramType => "query", |
2765
|
|
|
|
|
|
|
required => 0, |
2766
|
|
|
|
|
|
|
type => "Integer" |
2767
|
|
|
|
|
|
|
}, |
2768
|
|
|
|
|
|
|
offset => { |
2769
|
|
|
|
|
|
|
description => "Offset", |
2770
|
|
|
|
|
|
|
name => "offset", |
2771
|
|
|
|
|
|
|
paramType => "query", |
2772
|
|
|
|
|
|
|
required => 0, |
2773
|
|
|
|
|
|
|
type => "Integer" |
2774
|
|
|
|
|
|
|
}, |
2775
|
|
|
|
|
|
|
query => { |
2776
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2777
|
|
|
|
|
|
|
name => "query", |
2778
|
|
|
|
|
|
|
paramType => "query", |
2779
|
|
|
|
|
|
|
required => 1, |
2780
|
|
|
|
|
|
|
type => "String" |
2781
|
|
|
|
|
|
|
}, |
2782
|
|
|
|
|
|
|
range => { |
2783
|
|
|
|
|
|
|
description => "Relative timeframe to search in. See method description.", |
2784
|
|
|
|
|
|
|
name => "range", |
2785
|
|
|
|
|
|
|
paramType => "query", |
2786
|
|
|
|
|
|
|
required => 1, |
2787
|
|
|
|
|
|
|
type => "Integer" |
2788
|
|
|
|
|
|
|
}, |
2789
|
|
|
|
|
|
|
sort => { |
2790
|
|
|
|
|
|
|
description => "Sorting (field:asc / field:desc)", |
2791
|
|
|
|
|
|
|
name => "sort", |
2792
|
|
|
|
|
|
|
paramType => "query", |
2793
|
|
|
|
|
|
|
required => 0, |
2794
|
|
|
|
|
|
|
type => "String" |
2795
|
|
|
|
|
|
|
} |
2796
|
|
|
|
|
|
|
}; |
2797
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2798
|
|
|
|
|
|
|
|
2799
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2800
|
0
|
0
|
0
|
|
|
|
die "search_relative_search_relative is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2801
|
|
|
|
|
|
|
|
2802
|
|
|
|
|
|
|
# validate the type of the parameter |
2803
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2804
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_relative_search_relative ($err)" if ($err); |
2805
|
|
|
|
|
|
|
|
2806
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2807
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2808
|
0
|
|
|
|
|
|
next; |
2809
|
|
|
|
|
|
|
} |
2810
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2811
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_relative_search_relative for $args->{$a}->{name}" if ($body); |
2812
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2813
|
|
|
|
|
|
|
} |
2814
|
|
|
|
|
|
|
else { |
2815
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2816
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2817
|
|
|
|
|
|
|
} |
2818
|
|
|
|
|
|
|
} |
2819
|
|
|
|
|
|
|
|
2820
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2821
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2822
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2823
|
|
|
|
|
|
|
} |
2824
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2825
|
|
|
|
|
|
|
} |
2826
|
|
|
|
|
|
|
|
2827
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2828
|
|
|
|
|
|
|
|
2829
|
|
|
|
|
|
|
|
2830
|
|
|
|
|
|
|
sub search_relative_field_histogram_relative { |
2831
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2832
|
0
|
|
|
|
|
|
my (%params) = @_; |
2833
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2834
|
0
|
|
|
|
|
|
my $url = "/search/universal/relative/fieldhistogram"; |
2835
|
|
|
|
|
|
|
|
2836
|
0
|
|
|
|
|
|
my $args = { |
2837
|
|
|
|
|
|
|
field => { |
2838
|
|
|
|
|
|
|
description => "Field of whose values to get the histogram of", |
2839
|
|
|
|
|
|
|
name => "field", |
2840
|
|
|
|
|
|
|
paramType => "query", |
2841
|
|
|
|
|
|
|
required => 1, |
2842
|
|
|
|
|
|
|
type => "String" |
2843
|
|
|
|
|
|
|
}, |
2844
|
|
|
|
|
|
|
filter => { |
2845
|
|
|
|
|
|
|
description => "Filter", |
2846
|
|
|
|
|
|
|
name => "filter", |
2847
|
|
|
|
|
|
|
paramType => "query", |
2848
|
|
|
|
|
|
|
required => 0, |
2849
|
|
|
|
|
|
|
type => "String" |
2850
|
|
|
|
|
|
|
}, |
2851
|
|
|
|
|
|
|
interval => { |
2852
|
|
|
|
|
|
|
description => "Histogram interval / bucket size. (year, quarter, month, week, day, hour or minute)", |
2853
|
|
|
|
|
|
|
name => "interval", |
2854
|
|
|
|
|
|
|
paramType => "query", |
2855
|
|
|
|
|
|
|
required => 1, |
2856
|
|
|
|
|
|
|
type => "String" |
2857
|
|
|
|
|
|
|
}, |
2858
|
|
|
|
|
|
|
query => { |
2859
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2860
|
|
|
|
|
|
|
name => "query", |
2861
|
|
|
|
|
|
|
paramType => "query", |
2862
|
|
|
|
|
|
|
required => 1, |
2863
|
|
|
|
|
|
|
type => "String" |
2864
|
|
|
|
|
|
|
}, |
2865
|
|
|
|
|
|
|
range => { |
2866
|
|
|
|
|
|
|
description => "Relative timeframe to search in. See search method description.", |
2867
|
|
|
|
|
|
|
name => "range", |
2868
|
|
|
|
|
|
|
paramType => "query", |
2869
|
|
|
|
|
|
|
required => 1, |
2870
|
|
|
|
|
|
|
type => "Integer" |
2871
|
|
|
|
|
|
|
} |
2872
|
|
|
|
|
|
|
}; |
2873
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2874
|
|
|
|
|
|
|
|
2875
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2876
|
0
|
0
|
0
|
|
|
|
die "search_relative_field_histogram_relative is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2877
|
|
|
|
|
|
|
|
2878
|
|
|
|
|
|
|
# validate the type of the parameter |
2879
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2880
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_relative_field_histogram_relative ($err)" if ($err); |
2881
|
|
|
|
|
|
|
|
2882
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2883
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2884
|
0
|
|
|
|
|
|
next; |
2885
|
|
|
|
|
|
|
} |
2886
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2887
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_relative_field_histogram_relative for $args->{$a}->{name}" if ($body); |
2888
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2889
|
|
|
|
|
|
|
} |
2890
|
|
|
|
|
|
|
else { |
2891
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2892
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2893
|
|
|
|
|
|
|
} |
2894
|
|
|
|
|
|
|
} |
2895
|
|
|
|
|
|
|
|
2896
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2897
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2898
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2899
|
|
|
|
|
|
|
} |
2900
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2901
|
|
|
|
|
|
|
} |
2902
|
|
|
|
|
|
|
|
2903
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2904
|
|
|
|
|
|
|
|
2905
|
|
|
|
|
|
|
|
2906
|
|
|
|
|
|
|
sub search_relative_histogram_relative { |
2907
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2908
|
0
|
|
|
|
|
|
my (%params) = @_; |
2909
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2910
|
0
|
|
|
|
|
|
my $url = "/search/universal/relative/histogram"; |
2911
|
|
|
|
|
|
|
|
2912
|
0
|
|
|
|
|
|
my $args = { |
2913
|
|
|
|
|
|
|
filter => { |
2914
|
|
|
|
|
|
|
description => "Filter", |
2915
|
|
|
|
|
|
|
name => "filter", |
2916
|
|
|
|
|
|
|
paramType => "query", |
2917
|
|
|
|
|
|
|
required => 0, |
2918
|
|
|
|
|
|
|
type => "String" |
2919
|
|
|
|
|
|
|
}, |
2920
|
|
|
|
|
|
|
interval => { |
2921
|
|
|
|
|
|
|
description => "Histogram interval / bucket size. (year, quarter, month, week, day, hour or minute)", |
2922
|
|
|
|
|
|
|
name => "interval", |
2923
|
|
|
|
|
|
|
paramType => "query", |
2924
|
|
|
|
|
|
|
required => 1, |
2925
|
|
|
|
|
|
|
type => "String" |
2926
|
|
|
|
|
|
|
}, |
2927
|
|
|
|
|
|
|
query => { |
2928
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2929
|
|
|
|
|
|
|
name => "query", |
2930
|
|
|
|
|
|
|
paramType => "query", |
2931
|
|
|
|
|
|
|
required => 1, |
2932
|
|
|
|
|
|
|
type => "String" |
2933
|
|
|
|
|
|
|
}, |
2934
|
|
|
|
|
|
|
range => { |
2935
|
|
|
|
|
|
|
description => "Relative timeframe to search in. See search method description.", |
2936
|
|
|
|
|
|
|
name => "range", |
2937
|
|
|
|
|
|
|
paramType => "query", |
2938
|
|
|
|
|
|
|
required => 1, |
2939
|
|
|
|
|
|
|
type => "Integer" |
2940
|
|
|
|
|
|
|
} |
2941
|
|
|
|
|
|
|
}; |
2942
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
2943
|
|
|
|
|
|
|
|
2944
|
|
|
|
|
|
|
# check if the parameters exist if needed |
2945
|
0
|
0
|
0
|
|
|
|
die "search_relative_histogram_relative is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
2946
|
|
|
|
|
|
|
|
2947
|
|
|
|
|
|
|
# validate the type of the parameter |
2948
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
2949
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_relative_histogram_relative ($err)" if ($err); |
2950
|
|
|
|
|
|
|
|
2951
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
2952
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
2953
|
0
|
|
|
|
|
|
next; |
2954
|
|
|
|
|
|
|
} |
2955
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
2956
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_relative_histogram_relative for $args->{$a}->{name}" if ($body); |
2957
|
0
|
|
|
|
|
|
$body = $params{$a}; |
2958
|
|
|
|
|
|
|
} |
2959
|
|
|
|
|
|
|
else { |
2960
|
|
|
|
|
|
|
# we only want to send data that is allowed |
2961
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
2962
|
|
|
|
|
|
|
} |
2963
|
|
|
|
|
|
|
} |
2964
|
|
|
|
|
|
|
|
2965
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
2966
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
2967
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
2968
|
|
|
|
|
|
|
} |
2969
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
2970
|
|
|
|
|
|
|
} |
2971
|
|
|
|
|
|
|
|
2972
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
2973
|
|
|
|
|
|
|
|
2974
|
|
|
|
|
|
|
|
2975
|
|
|
|
|
|
|
sub search_relative_stats_relative { |
2976
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
2977
|
0
|
|
|
|
|
|
my (%params) = @_; |
2978
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
2979
|
0
|
|
|
|
|
|
my $url = "/search/universal/relative/stats"; |
2980
|
|
|
|
|
|
|
|
2981
|
0
|
|
|
|
|
|
my $args = { |
2982
|
|
|
|
|
|
|
field => { |
2983
|
|
|
|
|
|
|
description => "Message field of numeric type to return statistics for", |
2984
|
|
|
|
|
|
|
name => "field", |
2985
|
|
|
|
|
|
|
paramType => "query", |
2986
|
|
|
|
|
|
|
required => 1, |
2987
|
|
|
|
|
|
|
type => "String" |
2988
|
|
|
|
|
|
|
}, |
2989
|
|
|
|
|
|
|
filter => { |
2990
|
|
|
|
|
|
|
description => "Filter", |
2991
|
|
|
|
|
|
|
name => "filter", |
2992
|
|
|
|
|
|
|
paramType => "query", |
2993
|
|
|
|
|
|
|
required => 0, |
2994
|
|
|
|
|
|
|
type => "String" |
2995
|
|
|
|
|
|
|
}, |
2996
|
|
|
|
|
|
|
query => { |
2997
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
2998
|
|
|
|
|
|
|
name => "query", |
2999
|
|
|
|
|
|
|
paramType => "query", |
3000
|
|
|
|
|
|
|
required => 1, |
3001
|
|
|
|
|
|
|
type => "String" |
3002
|
|
|
|
|
|
|
}, |
3003
|
|
|
|
|
|
|
range => { |
3004
|
|
|
|
|
|
|
description => "Relative timeframe to search in. See search method description.", |
3005
|
|
|
|
|
|
|
name => "range", |
3006
|
|
|
|
|
|
|
paramType => "query", |
3007
|
|
|
|
|
|
|
required => 1, |
3008
|
|
|
|
|
|
|
type => "Integer" |
3009
|
|
|
|
|
|
|
} |
3010
|
|
|
|
|
|
|
}; |
3011
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3012
|
|
|
|
|
|
|
|
3013
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3014
|
0
|
0
|
0
|
|
|
|
die "search_relative_stats_relative is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3015
|
|
|
|
|
|
|
|
3016
|
|
|
|
|
|
|
# validate the type of the parameter |
3017
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3018
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_relative_stats_relative ($err)" if ($err); |
3019
|
|
|
|
|
|
|
|
3020
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3021
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3022
|
0
|
|
|
|
|
|
next; |
3023
|
|
|
|
|
|
|
} |
3024
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3025
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_relative_stats_relative for $args->{$a}->{name}" if ($body); |
3026
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3027
|
|
|
|
|
|
|
} |
3028
|
|
|
|
|
|
|
else { |
3029
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3030
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3031
|
|
|
|
|
|
|
} |
3032
|
|
|
|
|
|
|
} |
3033
|
|
|
|
|
|
|
|
3034
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3035
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3036
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3037
|
|
|
|
|
|
|
} |
3038
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3039
|
|
|
|
|
|
|
} |
3040
|
|
|
|
|
|
|
|
3041
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3042
|
|
|
|
|
|
|
|
3043
|
|
|
|
|
|
|
|
3044
|
|
|
|
|
|
|
sub search_relative_terms_relative { |
3045
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3046
|
0
|
|
|
|
|
|
my (%params) = @_; |
3047
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3048
|
0
|
|
|
|
|
|
my $url = "/search/universal/relative/terms"; |
3049
|
|
|
|
|
|
|
|
3050
|
0
|
|
|
|
|
|
my $args = { |
3051
|
|
|
|
|
|
|
field => { |
3052
|
|
|
|
|
|
|
description => "Message field of to return terms of", |
3053
|
|
|
|
|
|
|
name => "field", |
3054
|
|
|
|
|
|
|
paramType => "query", |
3055
|
|
|
|
|
|
|
required => 1, |
3056
|
|
|
|
|
|
|
type => "String" |
3057
|
|
|
|
|
|
|
}, |
3058
|
|
|
|
|
|
|
filter => { |
3059
|
|
|
|
|
|
|
description => "Filter", |
3060
|
|
|
|
|
|
|
name => "filter", |
3061
|
|
|
|
|
|
|
paramType => "query", |
3062
|
|
|
|
|
|
|
required => 0, |
3063
|
|
|
|
|
|
|
type => "String" |
3064
|
|
|
|
|
|
|
}, |
3065
|
|
|
|
|
|
|
query => { |
3066
|
|
|
|
|
|
|
description => "Query (Lucene syntax)", |
3067
|
|
|
|
|
|
|
name => "query", |
3068
|
|
|
|
|
|
|
paramType => "query", |
3069
|
|
|
|
|
|
|
required => 1, |
3070
|
|
|
|
|
|
|
type => "String" |
3071
|
|
|
|
|
|
|
}, |
3072
|
|
|
|
|
|
|
range => { |
3073
|
|
|
|
|
|
|
description => "Relative timeframe to search in. See search method description.", |
3074
|
|
|
|
|
|
|
name => "range", |
3075
|
|
|
|
|
|
|
paramType => "query", |
3076
|
|
|
|
|
|
|
required => 1, |
3077
|
|
|
|
|
|
|
type => "Integer" |
3078
|
|
|
|
|
|
|
}, |
3079
|
|
|
|
|
|
|
size => { |
3080
|
|
|
|
|
|
|
description => "Maximum number of terms to return", |
3081
|
|
|
|
|
|
|
name => "size", |
3082
|
|
|
|
|
|
|
paramType => "query", |
3083
|
|
|
|
|
|
|
required => 0, |
3084
|
|
|
|
|
|
|
type => "Integer" |
3085
|
|
|
|
|
|
|
} |
3086
|
|
|
|
|
|
|
}; |
3087
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3088
|
|
|
|
|
|
|
|
3089
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3090
|
0
|
0
|
0
|
|
|
|
die "search_relative_terms_relative is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3091
|
|
|
|
|
|
|
|
3092
|
|
|
|
|
|
|
# validate the type of the parameter |
3093
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3094
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_relative_terms_relative ($err)" if ($err); |
3095
|
|
|
|
|
|
|
|
3096
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3097
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3098
|
0
|
|
|
|
|
|
next; |
3099
|
|
|
|
|
|
|
} |
3100
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3101
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_relative_terms_relative for $args->{$a}->{name}" if ($body); |
3102
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3103
|
|
|
|
|
|
|
} |
3104
|
|
|
|
|
|
|
else { |
3105
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3106
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3107
|
|
|
|
|
|
|
} |
3108
|
|
|
|
|
|
|
} |
3109
|
|
|
|
|
|
|
|
3110
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3111
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3112
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3113
|
|
|
|
|
|
|
} |
3114
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3115
|
|
|
|
|
|
|
} |
3116
|
|
|
|
|
|
|
|
3117
|
|
|
|
|
|
|
|
3118
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3119
|
|
|
|
|
|
|
|
3120
|
|
|
|
|
|
|
|
3121
|
|
|
|
|
|
|
sub search_saved_list { |
3122
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3123
|
0
|
|
|
|
|
|
my (%params) = @_; |
3124
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3125
|
0
|
|
|
|
|
|
my $url = "/search/saved"; |
3126
|
|
|
|
|
|
|
|
3127
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3128
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3129
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3130
|
|
|
|
|
|
|
} |
3131
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3132
|
|
|
|
|
|
|
} |
3133
|
|
|
|
|
|
|
|
3134
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3135
|
|
|
|
|
|
|
|
3136
|
|
|
|
|
|
|
|
3137
|
|
|
|
|
|
|
sub search_saved_create { |
3138
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3139
|
0
|
|
|
|
|
|
my (%params) = @_; |
3140
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3141
|
0
|
|
|
|
|
|
my $url = "/search/saved"; |
3142
|
|
|
|
|
|
|
|
3143
|
0
|
|
|
|
|
|
my $args = { |
3144
|
|
|
|
|
|
|
"JSON body" => { |
3145
|
|
|
|
|
|
|
description => "", |
3146
|
|
|
|
|
|
|
name => "JSON body", |
3147
|
|
|
|
|
|
|
paramType => "body", |
3148
|
|
|
|
|
|
|
required => 1, |
3149
|
|
|
|
|
|
|
type => "String" |
3150
|
|
|
|
|
|
|
} |
3151
|
|
|
|
|
|
|
}; |
3152
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3153
|
|
|
|
|
|
|
|
3154
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3155
|
0
|
0
|
0
|
|
|
|
die "search_saved_create is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3156
|
|
|
|
|
|
|
|
3157
|
|
|
|
|
|
|
# validate the type of the parameter |
3158
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3159
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_saved_create ($err)" if ($err); |
3160
|
|
|
|
|
|
|
|
3161
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3162
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3163
|
0
|
|
|
|
|
|
next; |
3164
|
|
|
|
|
|
|
} |
3165
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3166
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_saved_create for $args->{$a}->{name}" if ($body); |
3167
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3168
|
|
|
|
|
|
|
} |
3169
|
|
|
|
|
|
|
else { |
3170
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3171
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3172
|
|
|
|
|
|
|
} |
3173
|
|
|
|
|
|
|
} |
3174
|
|
|
|
|
|
|
|
3175
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3176
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3177
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3178
|
|
|
|
|
|
|
} |
3179
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
3180
|
|
|
|
|
|
|
} |
3181
|
|
|
|
|
|
|
|
3182
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3183
|
|
|
|
|
|
|
|
3184
|
|
|
|
|
|
|
|
3185
|
|
|
|
|
|
|
sub search_saved_get { |
3186
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3187
|
0
|
|
|
|
|
|
my (%params) = @_; |
3188
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3189
|
0
|
|
|
|
|
|
my $url = "/search/saved/$params{searchId}"; |
3190
|
|
|
|
|
|
|
|
3191
|
0
|
|
|
|
|
|
my $args = { |
3192
|
|
|
|
|
|
|
searchId => { |
3193
|
|
|
|
|
|
|
description => "", |
3194
|
|
|
|
|
|
|
name => "searchId", |
3195
|
|
|
|
|
|
|
paramType => "path", |
3196
|
|
|
|
|
|
|
required => 1, |
3197
|
|
|
|
|
|
|
type => "String" |
3198
|
|
|
|
|
|
|
} |
3199
|
|
|
|
|
|
|
}; |
3200
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3201
|
|
|
|
|
|
|
|
3202
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3203
|
0
|
0
|
0
|
|
|
|
die "search_saved_get is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3204
|
|
|
|
|
|
|
|
3205
|
|
|
|
|
|
|
# validate the type of the parameter |
3206
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3207
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_saved_get ($err)" if ($err); |
3208
|
|
|
|
|
|
|
|
3209
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3210
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3211
|
0
|
|
|
|
|
|
next; |
3212
|
|
|
|
|
|
|
} |
3213
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3214
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_saved_get for $args->{$a}->{name}" if ($body); |
3215
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3216
|
|
|
|
|
|
|
} |
3217
|
|
|
|
|
|
|
else { |
3218
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3219
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3220
|
|
|
|
|
|
|
} |
3221
|
|
|
|
|
|
|
} |
3222
|
|
|
|
|
|
|
|
3223
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3224
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3225
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3226
|
|
|
|
|
|
|
} |
3227
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3228
|
|
|
|
|
|
|
} |
3229
|
|
|
|
|
|
|
|
3230
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3231
|
|
|
|
|
|
|
|
3232
|
|
|
|
|
|
|
|
3233
|
|
|
|
|
|
|
sub search_saved_delete { |
3234
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3235
|
0
|
|
|
|
|
|
my (%params) = @_; |
3236
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3237
|
0
|
|
|
|
|
|
my $url = "/search/saved/$params{searchId}"; |
3238
|
|
|
|
|
|
|
|
3239
|
0
|
|
|
|
|
|
my $args = { |
3240
|
|
|
|
|
|
|
searchId => { |
3241
|
|
|
|
|
|
|
description => "", |
3242
|
|
|
|
|
|
|
name => "searchId", |
3243
|
|
|
|
|
|
|
paramType => "path", |
3244
|
|
|
|
|
|
|
required => 1, |
3245
|
|
|
|
|
|
|
type => "String" |
3246
|
|
|
|
|
|
|
} |
3247
|
|
|
|
|
|
|
}; |
3248
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3249
|
|
|
|
|
|
|
|
3250
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3251
|
0
|
0
|
0
|
|
|
|
die "search_saved_delete is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3252
|
|
|
|
|
|
|
|
3253
|
|
|
|
|
|
|
# validate the type of the parameter |
3254
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3255
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to search_saved_delete ($err)" if ($err); |
3256
|
|
|
|
|
|
|
|
3257
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3258
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3259
|
0
|
|
|
|
|
|
next; |
3260
|
|
|
|
|
|
|
} |
3261
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3262
|
0
|
0
|
|
|
|
|
die "body has already been defined in search_saved_delete for $args->{$a}->{name}" if ($body); |
3263
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3264
|
|
|
|
|
|
|
} |
3265
|
|
|
|
|
|
|
else { |
3266
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3267
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3268
|
|
|
|
|
|
|
} |
3269
|
|
|
|
|
|
|
} |
3270
|
|
|
|
|
|
|
|
3271
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3272
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3273
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3274
|
|
|
|
|
|
|
} |
3275
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
3276
|
|
|
|
|
|
|
} |
3277
|
|
|
|
|
|
|
|
3278
|
|
|
|
|
|
|
|
3279
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3280
|
|
|
|
|
|
|
|
3281
|
|
|
|
|
|
|
|
3282
|
|
|
|
|
|
|
sub sources_list { |
3283
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3284
|
0
|
|
|
|
|
|
my (%params) = @_; |
3285
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3286
|
0
|
|
|
|
|
|
my $url = "/sources"; |
3287
|
|
|
|
|
|
|
|
3288
|
0
|
|
|
|
|
|
my $args = { |
3289
|
|
|
|
|
|
|
range => { |
3290
|
|
|
|
|
|
|
description => "Relative timeframe to search in. See method description.", |
3291
|
|
|
|
|
|
|
name => "range", |
3292
|
|
|
|
|
|
|
paramType => "query", |
3293
|
|
|
|
|
|
|
required => 1, |
3294
|
|
|
|
|
|
|
type => "Integer" |
3295
|
|
|
|
|
|
|
} |
3296
|
|
|
|
|
|
|
}; |
3297
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3298
|
|
|
|
|
|
|
|
3299
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3300
|
0
|
0
|
0
|
|
|
|
die "sources_list is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3301
|
|
|
|
|
|
|
|
3302
|
|
|
|
|
|
|
# validate the type of the parameter |
3303
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3304
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to sources_list ($err)" if ($err); |
3305
|
|
|
|
|
|
|
|
3306
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3307
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3308
|
0
|
|
|
|
|
|
next; |
3309
|
|
|
|
|
|
|
} |
3310
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3311
|
0
|
0
|
|
|
|
|
die "body has already been defined in sources_list for $args->{$a}->{name}" if ($body); |
3312
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3313
|
|
|
|
|
|
|
} |
3314
|
|
|
|
|
|
|
else { |
3315
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3316
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3317
|
|
|
|
|
|
|
} |
3318
|
|
|
|
|
|
|
} |
3319
|
|
|
|
|
|
|
|
3320
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3321
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3322
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3323
|
|
|
|
|
|
|
} |
3324
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3325
|
|
|
|
|
|
|
} |
3326
|
|
|
|
|
|
|
|
3327
|
|
|
|
|
|
|
|
3328
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3329
|
|
|
|
|
|
|
|
3330
|
|
|
|
|
|
|
|
3331
|
|
|
|
|
|
|
sub static_fields_create { |
3332
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3333
|
0
|
|
|
|
|
|
my (%params) = @_; |
3334
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3335
|
0
|
|
|
|
|
|
my $url = "/system/inputs/$params{inputId}/staticfields"; |
3336
|
|
|
|
|
|
|
|
3337
|
0
|
|
|
|
|
|
my $args = { |
3338
|
|
|
|
|
|
|
"JSON body" => { |
3339
|
|
|
|
|
|
|
description => "", |
3340
|
|
|
|
|
|
|
name => "JSON body", |
3341
|
|
|
|
|
|
|
paramType => "body", |
3342
|
|
|
|
|
|
|
required => 1, |
3343
|
|
|
|
|
|
|
type => "String" |
3344
|
|
|
|
|
|
|
}, |
3345
|
|
|
|
|
|
|
inputId => { |
3346
|
|
|
|
|
|
|
description => "", |
3347
|
|
|
|
|
|
|
name => "inputId", |
3348
|
|
|
|
|
|
|
paramType => "path", |
3349
|
|
|
|
|
|
|
required => 1, |
3350
|
|
|
|
|
|
|
type => "String" |
3351
|
|
|
|
|
|
|
} |
3352
|
|
|
|
|
|
|
}; |
3353
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3354
|
|
|
|
|
|
|
|
3355
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3356
|
0
|
0
|
0
|
|
|
|
die "static_fields_create is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3357
|
|
|
|
|
|
|
|
3358
|
|
|
|
|
|
|
# validate the type of the parameter |
3359
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3360
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to static_fields_create ($err)" if ($err); |
3361
|
|
|
|
|
|
|
|
3362
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3363
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3364
|
0
|
|
|
|
|
|
next; |
3365
|
|
|
|
|
|
|
} |
3366
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3367
|
0
|
0
|
|
|
|
|
die "body has already been defined in static_fields_create for $args->{$a}->{name}" if ($body); |
3368
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3369
|
|
|
|
|
|
|
} |
3370
|
|
|
|
|
|
|
else { |
3371
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3372
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3373
|
|
|
|
|
|
|
} |
3374
|
|
|
|
|
|
|
} |
3375
|
|
|
|
|
|
|
|
3376
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3377
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3378
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3379
|
|
|
|
|
|
|
} |
3380
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
3381
|
|
|
|
|
|
|
} |
3382
|
|
|
|
|
|
|
|
3383
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3384
|
|
|
|
|
|
|
|
3385
|
|
|
|
|
|
|
|
3386
|
|
|
|
|
|
|
sub static_fields_delete { |
3387
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3388
|
0
|
|
|
|
|
|
my (%params) = @_; |
3389
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3390
|
0
|
|
|
|
|
|
my $url = "/system/inputs/$params{inputId}/staticfields/$params{key}"; |
3391
|
|
|
|
|
|
|
|
3392
|
0
|
|
|
|
|
|
my $args = { |
3393
|
|
|
|
|
|
|
Key => { |
3394
|
|
|
|
|
|
|
description => "", |
3395
|
|
|
|
|
|
|
name => "Key", |
3396
|
|
|
|
|
|
|
paramType => "path", |
3397
|
|
|
|
|
|
|
required => 1, |
3398
|
|
|
|
|
|
|
type => "String" |
3399
|
|
|
|
|
|
|
}, |
3400
|
|
|
|
|
|
|
inputId => { |
3401
|
|
|
|
|
|
|
description => "", |
3402
|
|
|
|
|
|
|
name => "inputId", |
3403
|
|
|
|
|
|
|
paramType => "path", |
3404
|
|
|
|
|
|
|
required => 1, |
3405
|
|
|
|
|
|
|
type => "String" |
3406
|
|
|
|
|
|
|
} |
3407
|
|
|
|
|
|
|
}; |
3408
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3409
|
|
|
|
|
|
|
|
3410
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3411
|
0
|
0
|
0
|
|
|
|
die "static_fields_delete is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3412
|
|
|
|
|
|
|
|
3413
|
|
|
|
|
|
|
# validate the type of the parameter |
3414
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3415
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to static_fields_delete ($err)" if ($err); |
3416
|
|
|
|
|
|
|
|
3417
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3418
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3419
|
0
|
|
|
|
|
|
next; |
3420
|
|
|
|
|
|
|
} |
3421
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3422
|
0
|
0
|
|
|
|
|
die "body has already been defined in static_fields_delete for $args->{$a}->{name}" if ($body); |
3423
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3424
|
|
|
|
|
|
|
} |
3425
|
|
|
|
|
|
|
else { |
3426
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3427
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3428
|
|
|
|
|
|
|
} |
3429
|
|
|
|
|
|
|
} |
3430
|
|
|
|
|
|
|
|
3431
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3432
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3433
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3434
|
|
|
|
|
|
|
} |
3435
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
3436
|
|
|
|
|
|
|
} |
3437
|
|
|
|
|
|
|
|
3438
|
|
|
|
|
|
|
|
3439
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3440
|
|
|
|
|
|
|
|
3441
|
|
|
|
|
|
|
|
3442
|
|
|
|
|
|
|
sub stream_rules_get { |
3443
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3444
|
0
|
|
|
|
|
|
my (%params) = @_; |
3445
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3446
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamid}/rules"; |
3447
|
|
|
|
|
|
|
|
3448
|
0
|
|
|
|
|
|
my $args = { |
3449
|
|
|
|
|
|
|
streamid => { |
3450
|
|
|
|
|
|
|
description => "The id of the stream whose stream rules we want.", |
3451
|
|
|
|
|
|
|
name => "streamid", |
3452
|
|
|
|
|
|
|
paramType => "path", |
3453
|
|
|
|
|
|
|
required => 1, |
3454
|
|
|
|
|
|
|
type => "String" |
3455
|
|
|
|
|
|
|
} |
3456
|
|
|
|
|
|
|
}; |
3457
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3458
|
|
|
|
|
|
|
|
3459
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3460
|
0
|
0
|
0
|
|
|
|
die "stream_rules_get is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3461
|
|
|
|
|
|
|
|
3462
|
|
|
|
|
|
|
# validate the type of the parameter |
3463
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3464
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to stream_rules_get ($err)" if ($err); |
3465
|
|
|
|
|
|
|
|
3466
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3467
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3468
|
0
|
|
|
|
|
|
next; |
3469
|
|
|
|
|
|
|
} |
3470
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3471
|
0
|
0
|
|
|
|
|
die "body has already been defined in stream_rules_get for $args->{$a}->{name}" if ($body); |
3472
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3473
|
|
|
|
|
|
|
} |
3474
|
|
|
|
|
|
|
else { |
3475
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3476
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3477
|
|
|
|
|
|
|
} |
3478
|
|
|
|
|
|
|
} |
3479
|
|
|
|
|
|
|
|
3480
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3481
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3482
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3483
|
|
|
|
|
|
|
} |
3484
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3485
|
|
|
|
|
|
|
} |
3486
|
|
|
|
|
|
|
|
3487
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3488
|
|
|
|
|
|
|
|
3489
|
|
|
|
|
|
|
|
3490
|
|
|
|
|
|
|
sub stream_rules_create { |
3491
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3492
|
0
|
|
|
|
|
|
my (%params) = @_; |
3493
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3494
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamid}/rules"; |
3495
|
|
|
|
|
|
|
|
3496
|
0
|
|
|
|
|
|
my $args = { |
3497
|
|
|
|
|
|
|
"JSON body" => { |
3498
|
|
|
|
|
|
|
description => "", |
3499
|
|
|
|
|
|
|
name => "JSON body", |
3500
|
|
|
|
|
|
|
paramType => "body", |
3501
|
|
|
|
|
|
|
required => 1, |
3502
|
|
|
|
|
|
|
type => "String" |
3503
|
|
|
|
|
|
|
}, |
3504
|
|
|
|
|
|
|
streamid => { |
3505
|
|
|
|
|
|
|
description => "The stream id this new rule belongs to.", |
3506
|
|
|
|
|
|
|
name => "streamid", |
3507
|
|
|
|
|
|
|
paramType => "path", |
3508
|
|
|
|
|
|
|
required => 1, |
3509
|
|
|
|
|
|
|
type => "String" |
3510
|
|
|
|
|
|
|
} |
3511
|
|
|
|
|
|
|
}; |
3512
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3513
|
|
|
|
|
|
|
|
3514
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3515
|
0
|
0
|
0
|
|
|
|
die "stream_rules_create is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3516
|
|
|
|
|
|
|
|
3517
|
|
|
|
|
|
|
# validate the type of the parameter |
3518
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3519
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to stream_rules_create ($err)" if ($err); |
3520
|
|
|
|
|
|
|
|
3521
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3522
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3523
|
0
|
|
|
|
|
|
next; |
3524
|
|
|
|
|
|
|
} |
3525
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3526
|
0
|
0
|
|
|
|
|
die "body has already been defined in stream_rules_create for $args->{$a}->{name}" if ($body); |
3527
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3528
|
|
|
|
|
|
|
} |
3529
|
|
|
|
|
|
|
else { |
3530
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3531
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3532
|
|
|
|
|
|
|
} |
3533
|
|
|
|
|
|
|
} |
3534
|
|
|
|
|
|
|
|
3535
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3536
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3537
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3538
|
|
|
|
|
|
|
} |
3539
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
3540
|
|
|
|
|
|
|
} |
3541
|
|
|
|
|
|
|
|
3542
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3543
|
|
|
|
|
|
|
|
3544
|
|
|
|
|
|
|
|
3545
|
|
|
|
|
|
|
sub get_stream_rules_get { |
3546
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3547
|
0
|
|
|
|
|
|
my (%params) = @_; |
3548
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3549
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamid}/rules/$params{streamRuleId}"; |
3550
|
|
|
|
|
|
|
|
3551
|
0
|
|
|
|
|
|
my $args = { |
3552
|
|
|
|
|
|
|
streamRuleId => { |
3553
|
|
|
|
|
|
|
description => "The stream rule id we are getting", |
3554
|
|
|
|
|
|
|
name => "streamRuleId", |
3555
|
|
|
|
|
|
|
paramType => "path", |
3556
|
|
|
|
|
|
|
required => 1, |
3557
|
|
|
|
|
|
|
type => "String" |
3558
|
|
|
|
|
|
|
}, |
3559
|
|
|
|
|
|
|
streamid => { |
3560
|
|
|
|
|
|
|
description => "The id of the stream whose stream rule we want.", |
3561
|
|
|
|
|
|
|
name => "streamid", |
3562
|
|
|
|
|
|
|
paramType => "path", |
3563
|
|
|
|
|
|
|
required => 1, |
3564
|
|
|
|
|
|
|
type => "String" |
3565
|
|
|
|
|
|
|
} |
3566
|
|
|
|
|
|
|
}; |
3567
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3568
|
|
|
|
|
|
|
|
3569
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3570
|
0
|
0
|
0
|
|
|
|
die "get_stream_rules_get is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3571
|
|
|
|
|
|
|
|
3572
|
|
|
|
|
|
|
# validate the type of the parameter |
3573
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3574
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to get_stream_rules_get ($err)" if ($err); |
3575
|
|
|
|
|
|
|
|
3576
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3577
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3578
|
0
|
|
|
|
|
|
next; |
3579
|
|
|
|
|
|
|
} |
3580
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3581
|
0
|
0
|
|
|
|
|
die "body has already been defined in get_stream_rules_get for $args->{$a}->{name}" if ($body); |
3582
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3583
|
|
|
|
|
|
|
} |
3584
|
|
|
|
|
|
|
else { |
3585
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3586
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3587
|
|
|
|
|
|
|
} |
3588
|
|
|
|
|
|
|
} |
3589
|
|
|
|
|
|
|
|
3590
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3591
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3592
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3593
|
|
|
|
|
|
|
} |
3594
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3595
|
|
|
|
|
|
|
} |
3596
|
|
|
|
|
|
|
|
3597
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3598
|
|
|
|
|
|
|
|
3599
|
|
|
|
|
|
|
|
3600
|
|
|
|
|
|
|
sub stream_rules_delete { |
3601
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3602
|
0
|
|
|
|
|
|
my (%params) = @_; |
3603
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3604
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamid}/rules/$params{streamRuleId}"; |
3605
|
|
|
|
|
|
|
|
3606
|
0
|
|
|
|
|
|
my $args = { |
3607
|
|
|
|
|
|
|
streamRuleId => { |
3608
|
|
|
|
|
|
|
description => "", |
3609
|
|
|
|
|
|
|
name => "streamRuleId", |
3610
|
|
|
|
|
|
|
paramType => "path", |
3611
|
|
|
|
|
|
|
required => 1, |
3612
|
|
|
|
|
|
|
type => "String" |
3613
|
|
|
|
|
|
|
}, |
3614
|
|
|
|
|
|
|
streamid => { |
3615
|
|
|
|
|
|
|
description => "The stream id this new rule belongs to.", |
3616
|
|
|
|
|
|
|
name => "streamid", |
3617
|
|
|
|
|
|
|
paramType => "path", |
3618
|
|
|
|
|
|
|
required => 1, |
3619
|
|
|
|
|
|
|
type => "String" |
3620
|
|
|
|
|
|
|
} |
3621
|
|
|
|
|
|
|
}; |
3622
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3623
|
|
|
|
|
|
|
|
3624
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3625
|
0
|
0
|
0
|
|
|
|
die "stream_rules_delete is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3626
|
|
|
|
|
|
|
|
3627
|
|
|
|
|
|
|
# validate the type of the parameter |
3628
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3629
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to stream_rules_delete ($err)" if ($err); |
3630
|
|
|
|
|
|
|
|
3631
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3632
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3633
|
0
|
|
|
|
|
|
next; |
3634
|
|
|
|
|
|
|
} |
3635
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3636
|
0
|
0
|
|
|
|
|
die "body has already been defined in stream_rules_delete for $args->{$a}->{name}" if ($body); |
3637
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3638
|
|
|
|
|
|
|
} |
3639
|
|
|
|
|
|
|
else { |
3640
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3641
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3642
|
|
|
|
|
|
|
} |
3643
|
|
|
|
|
|
|
} |
3644
|
|
|
|
|
|
|
|
3645
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3646
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3647
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3648
|
|
|
|
|
|
|
} |
3649
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
3650
|
|
|
|
|
|
|
} |
3651
|
|
|
|
|
|
|
|
3652
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3653
|
|
|
|
|
|
|
|
3654
|
|
|
|
|
|
|
|
3655
|
|
|
|
|
|
|
sub stream_rules_update { |
3656
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3657
|
0
|
|
|
|
|
|
my (%params) = @_; |
3658
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3659
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamid}/rules/$params{streamRuleId}"; |
3660
|
|
|
|
|
|
|
|
3661
|
0
|
|
|
|
|
|
my $args = { |
3662
|
|
|
|
|
|
|
"JSON body" => { |
3663
|
|
|
|
|
|
|
description => "", |
3664
|
|
|
|
|
|
|
name => "JSON body", |
3665
|
|
|
|
|
|
|
paramType => "body", |
3666
|
|
|
|
|
|
|
required => 1, |
3667
|
|
|
|
|
|
|
type => "String" |
3668
|
|
|
|
|
|
|
}, |
3669
|
|
|
|
|
|
|
streamRuleId => { |
3670
|
|
|
|
|
|
|
description => "The stream rule id we are updating", |
3671
|
|
|
|
|
|
|
name => "streamRuleId", |
3672
|
|
|
|
|
|
|
paramType => "path", |
3673
|
|
|
|
|
|
|
required => 1, |
3674
|
|
|
|
|
|
|
type => "String" |
3675
|
|
|
|
|
|
|
}, |
3676
|
|
|
|
|
|
|
streamid => { |
3677
|
|
|
|
|
|
|
description => "The stream id this rule belongs to.", |
3678
|
|
|
|
|
|
|
name => "streamid", |
3679
|
|
|
|
|
|
|
paramType => "path", |
3680
|
|
|
|
|
|
|
required => 1, |
3681
|
|
|
|
|
|
|
type => "String" |
3682
|
|
|
|
|
|
|
} |
3683
|
|
|
|
|
|
|
}; |
3684
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3685
|
|
|
|
|
|
|
|
3686
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3687
|
0
|
0
|
0
|
|
|
|
die "stream_rules_update is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3688
|
|
|
|
|
|
|
|
3689
|
|
|
|
|
|
|
# validate the type of the parameter |
3690
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3691
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to stream_rules_update ($err)" if ($err); |
3692
|
|
|
|
|
|
|
|
3693
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3694
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3695
|
0
|
|
|
|
|
|
next; |
3696
|
|
|
|
|
|
|
} |
3697
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3698
|
0
|
0
|
|
|
|
|
die "body has already been defined in stream_rules_update for $args->{$a}->{name}" if ($body); |
3699
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3700
|
|
|
|
|
|
|
} |
3701
|
|
|
|
|
|
|
else { |
3702
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3703
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3704
|
|
|
|
|
|
|
} |
3705
|
|
|
|
|
|
|
} |
3706
|
|
|
|
|
|
|
|
3707
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3708
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3709
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3710
|
|
|
|
|
|
|
} |
3711
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
3712
|
|
|
|
|
|
|
} |
3713
|
|
|
|
|
|
|
|
3714
|
|
|
|
|
|
|
|
3715
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3716
|
|
|
|
|
|
|
|
3717
|
|
|
|
|
|
|
|
3718
|
|
|
|
|
|
|
sub streams_get { |
3719
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3720
|
0
|
|
|
|
|
|
my (%params) = @_; |
3721
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3722
|
0
|
|
|
|
|
|
my $url = "/streams"; |
3723
|
|
|
|
|
|
|
|
3724
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3725
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3726
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3727
|
|
|
|
|
|
|
} |
3728
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3729
|
|
|
|
|
|
|
} |
3730
|
|
|
|
|
|
|
|
3731
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3732
|
|
|
|
|
|
|
|
3733
|
|
|
|
|
|
|
|
3734
|
|
|
|
|
|
|
sub streams_create { |
3735
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3736
|
0
|
|
|
|
|
|
my (%params) = @_; |
3737
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3738
|
0
|
|
|
|
|
|
my $url = "/streams"; |
3739
|
|
|
|
|
|
|
|
3740
|
0
|
|
|
|
|
|
my $args = { |
3741
|
|
|
|
|
|
|
"JSON body" => { |
3742
|
|
|
|
|
|
|
description => "", |
3743
|
|
|
|
|
|
|
name => "JSON body", |
3744
|
|
|
|
|
|
|
paramType => "body", |
3745
|
|
|
|
|
|
|
required => 1, |
3746
|
|
|
|
|
|
|
type => "String" |
3747
|
|
|
|
|
|
|
} |
3748
|
|
|
|
|
|
|
}; |
3749
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3750
|
|
|
|
|
|
|
|
3751
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3752
|
0
|
0
|
0
|
|
|
|
die "streams_create is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3753
|
|
|
|
|
|
|
|
3754
|
|
|
|
|
|
|
# validate the type of the parameter |
3755
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3756
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to streams_create ($err)" if ($err); |
3757
|
|
|
|
|
|
|
|
3758
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3759
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3760
|
0
|
|
|
|
|
|
next; |
3761
|
|
|
|
|
|
|
} |
3762
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3763
|
0
|
0
|
|
|
|
|
die "body has already been defined in streams_create for $args->{$a}->{name}" if ($body); |
3764
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3765
|
|
|
|
|
|
|
} |
3766
|
|
|
|
|
|
|
else { |
3767
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3768
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3769
|
|
|
|
|
|
|
} |
3770
|
|
|
|
|
|
|
} |
3771
|
|
|
|
|
|
|
|
3772
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3773
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3774
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3775
|
|
|
|
|
|
|
} |
3776
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
3777
|
|
|
|
|
|
|
} |
3778
|
|
|
|
|
|
|
|
3779
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3780
|
|
|
|
|
|
|
|
3781
|
|
|
|
|
|
|
|
3782
|
|
|
|
|
|
|
sub streams_get_enabled { |
3783
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3784
|
0
|
|
|
|
|
|
my (%params) = @_; |
3785
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3786
|
0
|
|
|
|
|
|
my $url = "/streams/enabled"; |
3787
|
|
|
|
|
|
|
|
3788
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3789
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3790
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3791
|
|
|
|
|
|
|
} |
3792
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3793
|
|
|
|
|
|
|
} |
3794
|
|
|
|
|
|
|
|
3795
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3796
|
|
|
|
|
|
|
|
3797
|
|
|
|
|
|
|
|
3798
|
|
|
|
|
|
|
sub streams_stream_throughput { |
3799
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3800
|
0
|
|
|
|
|
|
my (%params) = @_; |
3801
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3802
|
0
|
|
|
|
|
|
my $url = "/streams/throughput"; |
3803
|
|
|
|
|
|
|
|
3804
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3805
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3806
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3807
|
|
|
|
|
|
|
} |
3808
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3809
|
|
|
|
|
|
|
} |
3810
|
|
|
|
|
|
|
|
3811
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3812
|
|
|
|
|
|
|
|
3813
|
|
|
|
|
|
|
|
3814
|
|
|
|
|
|
|
sub get_streams_get { |
3815
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3816
|
0
|
|
|
|
|
|
my (%params) = @_; |
3817
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3818
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamId}"; |
3819
|
|
|
|
|
|
|
|
3820
|
0
|
|
|
|
|
|
my $args = { |
3821
|
|
|
|
|
|
|
streamId => { |
3822
|
|
|
|
|
|
|
description => "", |
3823
|
|
|
|
|
|
|
name => "streamId", |
3824
|
|
|
|
|
|
|
paramType => "path", |
3825
|
|
|
|
|
|
|
required => 1, |
3826
|
|
|
|
|
|
|
type => "String" |
3827
|
|
|
|
|
|
|
} |
3828
|
|
|
|
|
|
|
}; |
3829
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3830
|
|
|
|
|
|
|
|
3831
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3832
|
0
|
0
|
0
|
|
|
|
die "get_streams_get is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3833
|
|
|
|
|
|
|
|
3834
|
|
|
|
|
|
|
# validate the type of the parameter |
3835
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3836
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to get_streams_get ($err)" if ($err); |
3837
|
|
|
|
|
|
|
|
3838
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3839
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3840
|
0
|
|
|
|
|
|
next; |
3841
|
|
|
|
|
|
|
} |
3842
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3843
|
0
|
0
|
|
|
|
|
die "body has already been defined in get_streams_get for $args->{$a}->{name}" if ($body); |
3844
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3845
|
|
|
|
|
|
|
} |
3846
|
|
|
|
|
|
|
else { |
3847
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3848
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3849
|
|
|
|
|
|
|
} |
3850
|
|
|
|
|
|
|
} |
3851
|
|
|
|
|
|
|
|
3852
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3853
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3854
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3855
|
|
|
|
|
|
|
} |
3856
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
3857
|
|
|
|
|
|
|
} |
3858
|
|
|
|
|
|
|
|
3859
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3860
|
|
|
|
|
|
|
|
3861
|
|
|
|
|
|
|
|
3862
|
|
|
|
|
|
|
sub streams_delete { |
3863
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3864
|
0
|
|
|
|
|
|
my (%params) = @_; |
3865
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3866
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamId}"; |
3867
|
|
|
|
|
|
|
|
3868
|
0
|
|
|
|
|
|
my $args = { |
3869
|
|
|
|
|
|
|
streamId => { |
3870
|
|
|
|
|
|
|
description => "", |
3871
|
|
|
|
|
|
|
name => "streamId", |
3872
|
|
|
|
|
|
|
paramType => "path", |
3873
|
|
|
|
|
|
|
required => 1, |
3874
|
|
|
|
|
|
|
type => "String" |
3875
|
|
|
|
|
|
|
} |
3876
|
|
|
|
|
|
|
}; |
3877
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3878
|
|
|
|
|
|
|
|
3879
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3880
|
0
|
0
|
0
|
|
|
|
die "streams_delete is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3881
|
|
|
|
|
|
|
|
3882
|
|
|
|
|
|
|
# validate the type of the parameter |
3883
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3884
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to streams_delete ($err)" if ($err); |
3885
|
|
|
|
|
|
|
|
3886
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3887
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3888
|
0
|
|
|
|
|
|
next; |
3889
|
|
|
|
|
|
|
} |
3890
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3891
|
0
|
0
|
|
|
|
|
die "body has already been defined in streams_delete for $args->{$a}->{name}" if ($body); |
3892
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3893
|
|
|
|
|
|
|
} |
3894
|
|
|
|
|
|
|
else { |
3895
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3896
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3897
|
|
|
|
|
|
|
} |
3898
|
|
|
|
|
|
|
} |
3899
|
|
|
|
|
|
|
|
3900
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3901
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3902
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3903
|
|
|
|
|
|
|
} |
3904
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
3905
|
|
|
|
|
|
|
} |
3906
|
|
|
|
|
|
|
|
3907
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3908
|
|
|
|
|
|
|
|
3909
|
|
|
|
|
|
|
|
3910
|
|
|
|
|
|
|
sub streams_update { |
3911
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3912
|
0
|
|
|
|
|
|
my (%params) = @_; |
3913
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3914
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamId}"; |
3915
|
|
|
|
|
|
|
|
3916
|
0
|
|
|
|
|
|
my $args = { |
3917
|
|
|
|
|
|
|
"JSON body" => { |
3918
|
|
|
|
|
|
|
description => "", |
3919
|
|
|
|
|
|
|
name => "JSON body", |
3920
|
|
|
|
|
|
|
paramType => "body", |
3921
|
|
|
|
|
|
|
required => 1, |
3922
|
|
|
|
|
|
|
type => "String" |
3923
|
|
|
|
|
|
|
}, |
3924
|
|
|
|
|
|
|
streamId => { |
3925
|
|
|
|
|
|
|
description => "", |
3926
|
|
|
|
|
|
|
name => "streamId", |
3927
|
|
|
|
|
|
|
paramType => "path", |
3928
|
|
|
|
|
|
|
required => 1, |
3929
|
|
|
|
|
|
|
type => "String" |
3930
|
|
|
|
|
|
|
} |
3931
|
|
|
|
|
|
|
}; |
3932
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3933
|
|
|
|
|
|
|
|
3934
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3935
|
0
|
0
|
0
|
|
|
|
die "streams_update is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3936
|
|
|
|
|
|
|
|
3937
|
|
|
|
|
|
|
# validate the type of the parameter |
3938
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3939
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to streams_update ($err)" if ($err); |
3940
|
|
|
|
|
|
|
|
3941
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3942
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3943
|
0
|
|
|
|
|
|
next; |
3944
|
|
|
|
|
|
|
} |
3945
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
3946
|
0
|
0
|
|
|
|
|
die "body has already been defined in streams_update for $args->{$a}->{name}" if ($body); |
3947
|
0
|
|
|
|
|
|
$body = $params{$a}; |
3948
|
|
|
|
|
|
|
} |
3949
|
|
|
|
|
|
|
else { |
3950
|
|
|
|
|
|
|
# we only want to send data that is allowed |
3951
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
3952
|
|
|
|
|
|
|
} |
3953
|
|
|
|
|
|
|
} |
3954
|
|
|
|
|
|
|
|
3955
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
3956
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
3957
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
3958
|
|
|
|
|
|
|
} |
3959
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
3960
|
|
|
|
|
|
|
} |
3961
|
|
|
|
|
|
|
|
3962
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3963
|
|
|
|
|
|
|
|
3964
|
|
|
|
|
|
|
|
3965
|
|
|
|
|
|
|
sub streams_clone_stream { |
3966
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
3967
|
0
|
|
|
|
|
|
my (%params) = @_; |
3968
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
3969
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamId}/clone"; |
3970
|
|
|
|
|
|
|
|
3971
|
0
|
|
|
|
|
|
my $args = { |
3972
|
|
|
|
|
|
|
"JSON body" => { |
3973
|
|
|
|
|
|
|
description => "", |
3974
|
|
|
|
|
|
|
name => "JSON body", |
3975
|
|
|
|
|
|
|
paramType => "body", |
3976
|
|
|
|
|
|
|
required => 1, |
3977
|
|
|
|
|
|
|
type => "String" |
3978
|
|
|
|
|
|
|
}, |
3979
|
|
|
|
|
|
|
streamId => { |
3980
|
|
|
|
|
|
|
description => "", |
3981
|
|
|
|
|
|
|
name => "streamId", |
3982
|
|
|
|
|
|
|
paramType => "path", |
3983
|
|
|
|
|
|
|
required => 1, |
3984
|
|
|
|
|
|
|
type => "String" |
3985
|
|
|
|
|
|
|
} |
3986
|
|
|
|
|
|
|
}; |
3987
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
3988
|
|
|
|
|
|
|
|
3989
|
|
|
|
|
|
|
# check if the parameters exist if needed |
3990
|
0
|
0
|
0
|
|
|
|
die "streams_clone_stream is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
3991
|
|
|
|
|
|
|
|
3992
|
|
|
|
|
|
|
# validate the type of the parameter |
3993
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
3994
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to streams_clone_stream ($err)" if ($err); |
3995
|
|
|
|
|
|
|
|
3996
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
3997
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
3998
|
0
|
|
|
|
|
|
next; |
3999
|
|
|
|
|
|
|
} |
4000
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4001
|
0
|
0
|
|
|
|
|
die "body has already been defined in streams_clone_stream for $args->{$a}->{name}" if ($body); |
4002
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4003
|
|
|
|
|
|
|
} |
4004
|
|
|
|
|
|
|
else { |
4005
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4006
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4007
|
|
|
|
|
|
|
} |
4008
|
|
|
|
|
|
|
} |
4009
|
|
|
|
|
|
|
|
4010
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4011
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4012
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4013
|
|
|
|
|
|
|
} |
4014
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
4015
|
|
|
|
|
|
|
} |
4016
|
|
|
|
|
|
|
|
4017
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4018
|
|
|
|
|
|
|
|
4019
|
|
|
|
|
|
|
|
4020
|
|
|
|
|
|
|
sub streams_pause { |
4021
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4022
|
0
|
|
|
|
|
|
my (%params) = @_; |
4023
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4024
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamId}/pause"; |
4025
|
|
|
|
|
|
|
|
4026
|
0
|
|
|
|
|
|
my $args = { |
4027
|
|
|
|
|
|
|
streamId => { |
4028
|
|
|
|
|
|
|
description => "", |
4029
|
|
|
|
|
|
|
name => "streamId", |
4030
|
|
|
|
|
|
|
paramType => "path", |
4031
|
|
|
|
|
|
|
required => 1, |
4032
|
|
|
|
|
|
|
type => "String" |
4033
|
|
|
|
|
|
|
} |
4034
|
|
|
|
|
|
|
}; |
4035
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4036
|
|
|
|
|
|
|
|
4037
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4038
|
0
|
0
|
0
|
|
|
|
die "streams_pause is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4039
|
|
|
|
|
|
|
|
4040
|
|
|
|
|
|
|
# validate the type of the parameter |
4041
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4042
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to streams_pause ($err)" if ($err); |
4043
|
|
|
|
|
|
|
|
4044
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4045
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4046
|
0
|
|
|
|
|
|
next; |
4047
|
|
|
|
|
|
|
} |
4048
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4049
|
0
|
0
|
|
|
|
|
die "body has already been defined in streams_pause for $args->{$a}->{name}" if ($body); |
4050
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4051
|
|
|
|
|
|
|
} |
4052
|
|
|
|
|
|
|
else { |
4053
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4054
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4055
|
|
|
|
|
|
|
} |
4056
|
|
|
|
|
|
|
} |
4057
|
|
|
|
|
|
|
|
4058
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4059
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4060
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4061
|
|
|
|
|
|
|
} |
4062
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
4063
|
|
|
|
|
|
|
} |
4064
|
|
|
|
|
|
|
|
4065
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4066
|
|
|
|
|
|
|
|
4067
|
|
|
|
|
|
|
|
4068
|
|
|
|
|
|
|
sub streams_resume { |
4069
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4070
|
0
|
|
|
|
|
|
my (%params) = @_; |
4071
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4072
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamId}/resume"; |
4073
|
|
|
|
|
|
|
|
4074
|
0
|
|
|
|
|
|
my $args = { |
4075
|
|
|
|
|
|
|
streamId => { |
4076
|
|
|
|
|
|
|
description => "", |
4077
|
|
|
|
|
|
|
name => "streamId", |
4078
|
|
|
|
|
|
|
paramType => "path", |
4079
|
|
|
|
|
|
|
required => 1, |
4080
|
|
|
|
|
|
|
type => "String" |
4081
|
|
|
|
|
|
|
} |
4082
|
|
|
|
|
|
|
}; |
4083
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4084
|
|
|
|
|
|
|
|
4085
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4086
|
0
|
0
|
0
|
|
|
|
die "streams_resume is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4087
|
|
|
|
|
|
|
|
4088
|
|
|
|
|
|
|
# validate the type of the parameter |
4089
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4090
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to streams_resume ($err)" if ($err); |
4091
|
|
|
|
|
|
|
|
4092
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4093
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4094
|
0
|
|
|
|
|
|
next; |
4095
|
|
|
|
|
|
|
} |
4096
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4097
|
0
|
0
|
|
|
|
|
die "body has already been defined in streams_resume for $args->{$a}->{name}" if ($body); |
4098
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4099
|
|
|
|
|
|
|
} |
4100
|
|
|
|
|
|
|
else { |
4101
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4102
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4103
|
|
|
|
|
|
|
} |
4104
|
|
|
|
|
|
|
} |
4105
|
|
|
|
|
|
|
|
4106
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4107
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4108
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4109
|
|
|
|
|
|
|
} |
4110
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
4111
|
|
|
|
|
|
|
} |
4112
|
|
|
|
|
|
|
|
4113
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4114
|
|
|
|
|
|
|
|
4115
|
|
|
|
|
|
|
|
4116
|
|
|
|
|
|
|
sub streams_test_match { |
4117
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4118
|
0
|
|
|
|
|
|
my (%params) = @_; |
4119
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4120
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamId}/testMatch"; |
4121
|
|
|
|
|
|
|
|
4122
|
0
|
|
|
|
|
|
my $args = { |
4123
|
|
|
|
|
|
|
"JSON body" => { |
4124
|
|
|
|
|
|
|
description => "", |
4125
|
|
|
|
|
|
|
name => "JSON body", |
4126
|
|
|
|
|
|
|
paramType => "body", |
4127
|
|
|
|
|
|
|
required => 1, |
4128
|
|
|
|
|
|
|
type => "String" |
4129
|
|
|
|
|
|
|
}, |
4130
|
|
|
|
|
|
|
streamId => { |
4131
|
|
|
|
|
|
|
description => "", |
4132
|
|
|
|
|
|
|
name => "streamId", |
4133
|
|
|
|
|
|
|
paramType => "path", |
4134
|
|
|
|
|
|
|
required => 1, |
4135
|
|
|
|
|
|
|
type => "String" |
4136
|
|
|
|
|
|
|
} |
4137
|
|
|
|
|
|
|
}; |
4138
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4139
|
|
|
|
|
|
|
|
4140
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4141
|
0
|
0
|
0
|
|
|
|
die "streams_test_match is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4142
|
|
|
|
|
|
|
|
4143
|
|
|
|
|
|
|
# validate the type of the parameter |
4144
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4145
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to streams_test_match ($err)" if ($err); |
4146
|
|
|
|
|
|
|
|
4147
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4148
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4149
|
0
|
|
|
|
|
|
next; |
4150
|
|
|
|
|
|
|
} |
4151
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4152
|
0
|
0
|
|
|
|
|
die "body has already been defined in streams_test_match for $args->{$a}->{name}" if ($body); |
4153
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4154
|
|
|
|
|
|
|
} |
4155
|
|
|
|
|
|
|
else { |
4156
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4157
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4158
|
|
|
|
|
|
|
} |
4159
|
|
|
|
|
|
|
} |
4160
|
|
|
|
|
|
|
|
4161
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4162
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4163
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4164
|
|
|
|
|
|
|
} |
4165
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
4166
|
|
|
|
|
|
|
} |
4167
|
|
|
|
|
|
|
|
4168
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4169
|
|
|
|
|
|
|
|
4170
|
|
|
|
|
|
|
|
4171
|
|
|
|
|
|
|
sub streams_one_stream_throughput { |
4172
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4173
|
0
|
|
|
|
|
|
my (%params) = @_; |
4174
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4175
|
0
|
|
|
|
|
|
my $url = "/streams/$params{streamId}/throughput"; |
4176
|
|
|
|
|
|
|
|
4177
|
0
|
|
|
|
|
|
my $args = { |
4178
|
|
|
|
|
|
|
streamId => { |
4179
|
|
|
|
|
|
|
description => "", |
4180
|
|
|
|
|
|
|
name => "streamId", |
4181
|
|
|
|
|
|
|
paramType => "path", |
4182
|
|
|
|
|
|
|
required => 1, |
4183
|
|
|
|
|
|
|
type => "String" |
4184
|
|
|
|
|
|
|
} |
4185
|
|
|
|
|
|
|
}; |
4186
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4187
|
|
|
|
|
|
|
|
4188
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4189
|
0
|
0
|
0
|
|
|
|
die "streams_one_stream_throughput is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4190
|
|
|
|
|
|
|
|
4191
|
|
|
|
|
|
|
# validate the type of the parameter |
4192
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4193
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to streams_one_stream_throughput ($err)" if ($err); |
4194
|
|
|
|
|
|
|
|
4195
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4196
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4197
|
0
|
|
|
|
|
|
next; |
4198
|
|
|
|
|
|
|
} |
4199
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4200
|
0
|
0
|
|
|
|
|
die "body has already been defined in streams_one_stream_throughput for $args->{$a}->{name}" if ($body); |
4201
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4202
|
|
|
|
|
|
|
} |
4203
|
|
|
|
|
|
|
else { |
4204
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4205
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4206
|
|
|
|
|
|
|
} |
4207
|
|
|
|
|
|
|
} |
4208
|
|
|
|
|
|
|
|
4209
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4210
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4211
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4212
|
|
|
|
|
|
|
} |
4213
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4214
|
|
|
|
|
|
|
} |
4215
|
|
|
|
|
|
|
|
4216
|
|
|
|
|
|
|
|
4217
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4218
|
|
|
|
|
|
|
|
4219
|
|
|
|
|
|
|
|
4220
|
|
|
|
|
|
|
sub system { |
4221
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4222
|
0
|
|
|
|
|
|
my (%params) = @_; |
4223
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4224
|
0
|
|
|
|
|
|
my $url = "/system"; |
4225
|
|
|
|
|
|
|
|
4226
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4227
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4228
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4229
|
|
|
|
|
|
|
} |
4230
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4231
|
|
|
|
|
|
|
} |
4232
|
|
|
|
|
|
|
|
4233
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4234
|
|
|
|
|
|
|
|
4235
|
|
|
|
|
|
|
|
4236
|
|
|
|
|
|
|
sub system_fields { |
4237
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4238
|
0
|
|
|
|
|
|
my (%params) = @_; |
4239
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4240
|
0
|
|
|
|
|
|
my $url = "/system/fields"; |
4241
|
|
|
|
|
|
|
|
4242
|
0
|
|
|
|
|
|
my $args = { |
4243
|
|
|
|
|
|
|
limit => { |
4244
|
|
|
|
|
|
|
description => "Maximum number of fields to return. Set to 0 for all fields.", |
4245
|
|
|
|
|
|
|
name => "limit", |
4246
|
|
|
|
|
|
|
paramType => "query", |
4247
|
|
|
|
|
|
|
required => 0, |
4248
|
|
|
|
|
|
|
type => "Integer" |
4249
|
|
|
|
|
|
|
} |
4250
|
|
|
|
|
|
|
}; |
4251
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4252
|
|
|
|
|
|
|
|
4253
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4254
|
0
|
0
|
0
|
|
|
|
die "system_fields is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4255
|
|
|
|
|
|
|
|
4256
|
|
|
|
|
|
|
# validate the type of the parameter |
4257
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4258
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_fields ($err)" if ($err); |
4259
|
|
|
|
|
|
|
|
4260
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4261
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4262
|
0
|
|
|
|
|
|
next; |
4263
|
|
|
|
|
|
|
} |
4264
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4265
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_fields for $args->{$a}->{name}" if ($body); |
4266
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4267
|
|
|
|
|
|
|
} |
4268
|
|
|
|
|
|
|
else { |
4269
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4270
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4271
|
|
|
|
|
|
|
} |
4272
|
|
|
|
|
|
|
} |
4273
|
|
|
|
|
|
|
|
4274
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4275
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4276
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4277
|
|
|
|
|
|
|
} |
4278
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4279
|
|
|
|
|
|
|
} |
4280
|
|
|
|
|
|
|
|
4281
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4282
|
|
|
|
|
|
|
|
4283
|
|
|
|
|
|
|
|
4284
|
|
|
|
|
|
|
sub system_jvm { |
4285
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4286
|
0
|
|
|
|
|
|
my (%params) = @_; |
4287
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4288
|
0
|
|
|
|
|
|
my $url = "/system/jvm"; |
4289
|
|
|
|
|
|
|
|
4290
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4291
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4292
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4293
|
|
|
|
|
|
|
} |
4294
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4295
|
|
|
|
|
|
|
} |
4296
|
|
|
|
|
|
|
|
4297
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4298
|
|
|
|
|
|
|
|
4299
|
|
|
|
|
|
|
|
4300
|
|
|
|
|
|
|
sub system_permissions { |
4301
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4302
|
0
|
|
|
|
|
|
my (%params) = @_; |
4303
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4304
|
0
|
|
|
|
|
|
my $url = "/system/permissions"; |
4305
|
|
|
|
|
|
|
|
4306
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4307
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4308
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4309
|
|
|
|
|
|
|
} |
4310
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4311
|
|
|
|
|
|
|
} |
4312
|
|
|
|
|
|
|
|
4313
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4314
|
|
|
|
|
|
|
|
4315
|
|
|
|
|
|
|
|
4316
|
|
|
|
|
|
|
sub system_reader_permissions { |
4317
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4318
|
0
|
|
|
|
|
|
my (%params) = @_; |
4319
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4320
|
0
|
|
|
|
|
|
my $url = "/system/permissions/reader/$params{username}"; |
4321
|
|
|
|
|
|
|
|
4322
|
0
|
|
|
|
|
|
my $args = { |
4323
|
|
|
|
|
|
|
username => { |
4324
|
|
|
|
|
|
|
description => "", |
4325
|
|
|
|
|
|
|
name => "username", |
4326
|
|
|
|
|
|
|
paramType => "path", |
4327
|
|
|
|
|
|
|
required => 1, |
4328
|
|
|
|
|
|
|
type => "String" |
4329
|
|
|
|
|
|
|
} |
4330
|
|
|
|
|
|
|
}; |
4331
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4332
|
|
|
|
|
|
|
|
4333
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4334
|
0
|
0
|
0
|
|
|
|
die "system_reader_permissions is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4335
|
|
|
|
|
|
|
|
4336
|
|
|
|
|
|
|
# validate the type of the parameter |
4337
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4338
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_reader_permissions ($err)" if ($err); |
4339
|
|
|
|
|
|
|
|
4340
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4341
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4342
|
0
|
|
|
|
|
|
next; |
4343
|
|
|
|
|
|
|
} |
4344
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4345
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_reader_permissions for $args->{$a}->{name}" if ($body); |
4346
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4347
|
|
|
|
|
|
|
} |
4348
|
|
|
|
|
|
|
else { |
4349
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4350
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4351
|
|
|
|
|
|
|
} |
4352
|
|
|
|
|
|
|
} |
4353
|
|
|
|
|
|
|
|
4354
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4355
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4356
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4357
|
|
|
|
|
|
|
} |
4358
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4359
|
|
|
|
|
|
|
} |
4360
|
|
|
|
|
|
|
|
4361
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4362
|
|
|
|
|
|
|
|
4363
|
|
|
|
|
|
|
|
4364
|
|
|
|
|
|
|
sub system_pause_processing { |
4365
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4366
|
0
|
|
|
|
|
|
my (%params) = @_; |
4367
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4368
|
0
|
|
|
|
|
|
my $url = "/system/processing/pause"; |
4369
|
|
|
|
|
|
|
|
4370
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4371
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4372
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4373
|
|
|
|
|
|
|
} |
4374
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
4375
|
|
|
|
|
|
|
} |
4376
|
|
|
|
|
|
|
|
4377
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4378
|
|
|
|
|
|
|
|
4379
|
|
|
|
|
|
|
|
4380
|
|
|
|
|
|
|
sub system_resume_processing { |
4381
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4382
|
0
|
|
|
|
|
|
my (%params) = @_; |
4383
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4384
|
0
|
|
|
|
|
|
my $url = "/system/processing/resume"; |
4385
|
|
|
|
|
|
|
|
4386
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4387
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4388
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4389
|
|
|
|
|
|
|
} |
4390
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
4391
|
|
|
|
|
|
|
} |
4392
|
|
|
|
|
|
|
|
4393
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4394
|
|
|
|
|
|
|
|
4395
|
|
|
|
|
|
|
|
4396
|
|
|
|
|
|
|
sub system_threaddump { |
4397
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4398
|
0
|
|
|
|
|
|
my (%params) = @_; |
4399
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4400
|
0
|
|
|
|
|
|
my $url = "/system/threaddump"; |
4401
|
|
|
|
|
|
|
|
4402
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4403
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4404
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4405
|
|
|
|
|
|
|
} |
4406
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4407
|
|
|
|
|
|
|
} |
4408
|
|
|
|
|
|
|
|
4409
|
|
|
|
|
|
|
|
4410
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4411
|
|
|
|
|
|
|
|
4412
|
|
|
|
|
|
|
|
4413
|
|
|
|
|
|
|
sub system_buffers_utilization { |
4414
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4415
|
0
|
|
|
|
|
|
my (%params) = @_; |
4416
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4417
|
0
|
|
|
|
|
|
my $url = "/system/buffers"; |
4418
|
|
|
|
|
|
|
|
4419
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4420
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4421
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4422
|
|
|
|
|
|
|
} |
4423
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4424
|
|
|
|
|
|
|
} |
4425
|
|
|
|
|
|
|
|
4426
|
|
|
|
|
|
|
|
4427
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4428
|
|
|
|
|
|
|
|
4429
|
|
|
|
|
|
|
|
4430
|
|
|
|
|
|
|
sub system_cluster_node { |
4431
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4432
|
0
|
|
|
|
|
|
my (%params) = @_; |
4433
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4434
|
0
|
|
|
|
|
|
my $url = "/system/cluster/node"; |
4435
|
|
|
|
|
|
|
|
4436
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4437
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4438
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4439
|
|
|
|
|
|
|
} |
4440
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4441
|
|
|
|
|
|
|
} |
4442
|
|
|
|
|
|
|
|
4443
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4444
|
|
|
|
|
|
|
|
4445
|
|
|
|
|
|
|
|
4446
|
|
|
|
|
|
|
sub system_cluster_nodes { |
4447
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4448
|
0
|
|
|
|
|
|
my (%params) = @_; |
4449
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4450
|
0
|
|
|
|
|
|
my $url = "/system/cluster/nodes"; |
4451
|
|
|
|
|
|
|
|
4452
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4453
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4454
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4455
|
|
|
|
|
|
|
} |
4456
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4457
|
|
|
|
|
|
|
} |
4458
|
|
|
|
|
|
|
|
4459
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4460
|
|
|
|
|
|
|
|
4461
|
|
|
|
|
|
|
|
4462
|
|
|
|
|
|
|
sub get_system_cluster_node { |
4463
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4464
|
0
|
|
|
|
|
|
my (%params) = @_; |
4465
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4466
|
0
|
|
|
|
|
|
my $url = "/system/cluster/nodes/$params{nodeId}"; |
4467
|
|
|
|
|
|
|
|
4468
|
0
|
|
|
|
|
|
my $args = { |
4469
|
|
|
|
|
|
|
nodeId => { |
4470
|
|
|
|
|
|
|
description => "", |
4471
|
|
|
|
|
|
|
name => "nodeId", |
4472
|
|
|
|
|
|
|
paramType => "path", |
4473
|
|
|
|
|
|
|
required => 1, |
4474
|
|
|
|
|
|
|
type => "String" |
4475
|
|
|
|
|
|
|
} |
4476
|
|
|
|
|
|
|
}; |
4477
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4478
|
|
|
|
|
|
|
|
4479
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4480
|
0
|
0
|
0
|
|
|
|
die "get_system_cluster_node is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4481
|
|
|
|
|
|
|
|
4482
|
|
|
|
|
|
|
# validate the type of the parameter |
4483
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4484
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to get_system_cluster_node ($err)" if ($err); |
4485
|
|
|
|
|
|
|
|
4486
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4487
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4488
|
0
|
|
|
|
|
|
next; |
4489
|
|
|
|
|
|
|
} |
4490
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4491
|
0
|
0
|
|
|
|
|
die "body has already been defined in get_system_cluster_node for $args->{$a}->{name}" if ($body); |
4492
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4493
|
|
|
|
|
|
|
} |
4494
|
|
|
|
|
|
|
else { |
4495
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4496
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4497
|
|
|
|
|
|
|
} |
4498
|
|
|
|
|
|
|
} |
4499
|
|
|
|
|
|
|
|
4500
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4501
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4502
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4503
|
|
|
|
|
|
|
} |
4504
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4505
|
|
|
|
|
|
|
} |
4506
|
|
|
|
|
|
|
|
4507
|
|
|
|
|
|
|
|
4508
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4509
|
|
|
|
|
|
|
|
4510
|
|
|
|
|
|
|
|
4511
|
|
|
|
|
|
|
sub system_deflector_deflector { |
4512
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4513
|
0
|
|
|
|
|
|
my (%params) = @_; |
4514
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4515
|
0
|
|
|
|
|
|
my $url = "/system/deflector"; |
4516
|
|
|
|
|
|
|
|
4517
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4518
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4519
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4520
|
|
|
|
|
|
|
} |
4521
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4522
|
|
|
|
|
|
|
} |
4523
|
|
|
|
|
|
|
|
4524
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4525
|
|
|
|
|
|
|
|
4526
|
|
|
|
|
|
|
|
4527
|
|
|
|
|
|
|
sub system_deflector_config { |
4528
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4529
|
0
|
|
|
|
|
|
my (%params) = @_; |
4530
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4531
|
0
|
|
|
|
|
|
my $url = "/system/deflector/config"; |
4532
|
|
|
|
|
|
|
|
4533
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4534
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4535
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4536
|
|
|
|
|
|
|
} |
4537
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4538
|
|
|
|
|
|
|
} |
4539
|
|
|
|
|
|
|
|
4540
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4541
|
|
|
|
|
|
|
|
4542
|
|
|
|
|
|
|
|
4543
|
|
|
|
|
|
|
sub system_deflector_cycle { |
4544
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4545
|
0
|
|
|
|
|
|
my (%params) = @_; |
4546
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4547
|
0
|
|
|
|
|
|
my $url = "/system/deflector/cycle"; |
4548
|
|
|
|
|
|
|
|
4549
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4550
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4551
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4552
|
|
|
|
|
|
|
} |
4553
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
4554
|
|
|
|
|
|
|
} |
4555
|
|
|
|
|
|
|
|
4556
|
|
|
|
|
|
|
|
4557
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4558
|
|
|
|
|
|
|
|
4559
|
|
|
|
|
|
|
|
4560
|
|
|
|
|
|
|
sub system_index_ranges_list { |
4561
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4562
|
0
|
|
|
|
|
|
my (%params) = @_; |
4563
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4564
|
0
|
|
|
|
|
|
my $url = "/system/indices/ranges"; |
4565
|
|
|
|
|
|
|
|
4566
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4567
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4568
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4569
|
|
|
|
|
|
|
} |
4570
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4571
|
|
|
|
|
|
|
} |
4572
|
|
|
|
|
|
|
|
4573
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4574
|
|
|
|
|
|
|
|
4575
|
|
|
|
|
|
|
|
4576
|
|
|
|
|
|
|
sub system_index_ranges_rebuild { |
4577
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4578
|
0
|
|
|
|
|
|
my (%params) = @_; |
4579
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4580
|
0
|
|
|
|
|
|
my $url = "/system/indices/ranges/rebuild"; |
4581
|
|
|
|
|
|
|
|
4582
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4583
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4584
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4585
|
|
|
|
|
|
|
} |
4586
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
4587
|
|
|
|
|
|
|
} |
4588
|
|
|
|
|
|
|
|
4589
|
|
|
|
|
|
|
|
4590
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4591
|
|
|
|
|
|
|
|
4592
|
|
|
|
|
|
|
|
4593
|
|
|
|
|
|
|
sub system_inputs_list { |
4594
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4595
|
0
|
|
|
|
|
|
my (%params) = @_; |
4596
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4597
|
0
|
|
|
|
|
|
my $url = "/system/inputs"; |
4598
|
|
|
|
|
|
|
|
4599
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4600
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4601
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4602
|
|
|
|
|
|
|
} |
4603
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4604
|
|
|
|
|
|
|
} |
4605
|
|
|
|
|
|
|
|
4606
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4607
|
|
|
|
|
|
|
|
4608
|
|
|
|
|
|
|
|
4609
|
|
|
|
|
|
|
sub system_inputs_create { |
4610
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4611
|
0
|
|
|
|
|
|
my (%params) = @_; |
4612
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4613
|
0
|
|
|
|
|
|
my $url = "/system/inputs"; |
4614
|
|
|
|
|
|
|
|
4615
|
0
|
|
|
|
|
|
my $args = { |
4616
|
|
|
|
|
|
|
"JSON body" => { |
4617
|
|
|
|
|
|
|
description => "", |
4618
|
|
|
|
|
|
|
name => "JSON body", |
4619
|
|
|
|
|
|
|
paramType => "body", |
4620
|
|
|
|
|
|
|
required => 1, |
4621
|
|
|
|
|
|
|
type => "String" |
4622
|
|
|
|
|
|
|
} |
4623
|
|
|
|
|
|
|
}; |
4624
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4625
|
|
|
|
|
|
|
|
4626
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4627
|
0
|
0
|
0
|
|
|
|
die "system_inputs_create is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4628
|
|
|
|
|
|
|
|
4629
|
|
|
|
|
|
|
# validate the type of the parameter |
4630
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4631
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_inputs_create ($err)" if ($err); |
4632
|
|
|
|
|
|
|
|
4633
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4634
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4635
|
0
|
|
|
|
|
|
next; |
4636
|
|
|
|
|
|
|
} |
4637
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4638
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_inputs_create for $args->{$a}->{name}" if ($body); |
4639
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4640
|
|
|
|
|
|
|
} |
4641
|
|
|
|
|
|
|
else { |
4642
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4643
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4644
|
|
|
|
|
|
|
} |
4645
|
|
|
|
|
|
|
} |
4646
|
|
|
|
|
|
|
|
4647
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4648
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4649
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4650
|
|
|
|
|
|
|
} |
4651
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
4652
|
|
|
|
|
|
|
} |
4653
|
|
|
|
|
|
|
|
4654
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4655
|
|
|
|
|
|
|
|
4656
|
|
|
|
|
|
|
|
4657
|
|
|
|
|
|
|
sub system_inputs_types { |
4658
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4659
|
0
|
|
|
|
|
|
my (%params) = @_; |
4660
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4661
|
0
|
|
|
|
|
|
my $url = "/system/inputs/types"; |
4662
|
|
|
|
|
|
|
|
4663
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4664
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4665
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4666
|
|
|
|
|
|
|
} |
4667
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4668
|
|
|
|
|
|
|
} |
4669
|
|
|
|
|
|
|
|
4670
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4671
|
|
|
|
|
|
|
|
4672
|
|
|
|
|
|
|
|
4673
|
|
|
|
|
|
|
sub system_inputs_info { |
4674
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4675
|
0
|
|
|
|
|
|
my (%params) = @_; |
4676
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4677
|
0
|
|
|
|
|
|
my $url = "/system/inputs/types/$params{inputType}"; |
4678
|
|
|
|
|
|
|
|
4679
|
0
|
|
|
|
|
|
my $args = { |
4680
|
|
|
|
|
|
|
inputType => { |
4681
|
|
|
|
|
|
|
description => "", |
4682
|
|
|
|
|
|
|
name => "inputType", |
4683
|
|
|
|
|
|
|
paramType => "path", |
4684
|
|
|
|
|
|
|
required => 1, |
4685
|
|
|
|
|
|
|
type => "String" |
4686
|
|
|
|
|
|
|
} |
4687
|
|
|
|
|
|
|
}; |
4688
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4689
|
|
|
|
|
|
|
|
4690
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4691
|
0
|
0
|
0
|
|
|
|
die "system_inputs_info is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4692
|
|
|
|
|
|
|
|
4693
|
|
|
|
|
|
|
# validate the type of the parameter |
4694
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4695
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_inputs_info ($err)" if ($err); |
4696
|
|
|
|
|
|
|
|
4697
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4698
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4699
|
0
|
|
|
|
|
|
next; |
4700
|
|
|
|
|
|
|
} |
4701
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4702
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_inputs_info for $args->{$a}->{name}" if ($body); |
4703
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4704
|
|
|
|
|
|
|
} |
4705
|
|
|
|
|
|
|
else { |
4706
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4707
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4708
|
|
|
|
|
|
|
} |
4709
|
|
|
|
|
|
|
} |
4710
|
|
|
|
|
|
|
|
4711
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4712
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4713
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4714
|
|
|
|
|
|
|
} |
4715
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4716
|
|
|
|
|
|
|
} |
4717
|
|
|
|
|
|
|
|
4718
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4719
|
|
|
|
|
|
|
|
4720
|
|
|
|
|
|
|
|
4721
|
|
|
|
|
|
|
sub system_inputs_single { |
4722
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4723
|
0
|
|
|
|
|
|
my (%params) = @_; |
4724
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4725
|
0
|
|
|
|
|
|
my $url = "/system/inputs/$params{inputId}"; |
4726
|
|
|
|
|
|
|
|
4727
|
0
|
|
|
|
|
|
my $args = { |
4728
|
|
|
|
|
|
|
inputId => { |
4729
|
|
|
|
|
|
|
description => "", |
4730
|
|
|
|
|
|
|
name => "inputId", |
4731
|
|
|
|
|
|
|
paramType => "path", |
4732
|
|
|
|
|
|
|
required => 1, |
4733
|
|
|
|
|
|
|
type => "String" |
4734
|
|
|
|
|
|
|
} |
4735
|
|
|
|
|
|
|
}; |
4736
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4737
|
|
|
|
|
|
|
|
4738
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4739
|
0
|
0
|
0
|
|
|
|
die "system_inputs_single is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4740
|
|
|
|
|
|
|
|
4741
|
|
|
|
|
|
|
# validate the type of the parameter |
4742
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4743
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_inputs_single ($err)" if ($err); |
4744
|
|
|
|
|
|
|
|
4745
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4746
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4747
|
0
|
|
|
|
|
|
next; |
4748
|
|
|
|
|
|
|
} |
4749
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4750
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_inputs_single for $args->{$a}->{name}" if ($body); |
4751
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4752
|
|
|
|
|
|
|
} |
4753
|
|
|
|
|
|
|
else { |
4754
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4755
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4756
|
|
|
|
|
|
|
} |
4757
|
|
|
|
|
|
|
} |
4758
|
|
|
|
|
|
|
|
4759
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4760
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4761
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4762
|
|
|
|
|
|
|
} |
4763
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4764
|
|
|
|
|
|
|
} |
4765
|
|
|
|
|
|
|
|
4766
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4767
|
|
|
|
|
|
|
|
4768
|
|
|
|
|
|
|
|
4769
|
|
|
|
|
|
|
sub system_inputs_terminate { |
4770
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4771
|
0
|
|
|
|
|
|
my (%params) = @_; |
4772
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4773
|
0
|
|
|
|
|
|
my $url = "/system/inputs/$params{inputId}"; |
4774
|
|
|
|
|
|
|
|
4775
|
0
|
|
|
|
|
|
my $args = { |
4776
|
|
|
|
|
|
|
inputId => { |
4777
|
|
|
|
|
|
|
description => "", |
4778
|
|
|
|
|
|
|
name => "inputId", |
4779
|
|
|
|
|
|
|
paramType => "path", |
4780
|
|
|
|
|
|
|
required => 1, |
4781
|
|
|
|
|
|
|
type => "String" |
4782
|
|
|
|
|
|
|
} |
4783
|
|
|
|
|
|
|
}; |
4784
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4785
|
|
|
|
|
|
|
|
4786
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4787
|
0
|
0
|
0
|
|
|
|
die "system_inputs_terminate is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4788
|
|
|
|
|
|
|
|
4789
|
|
|
|
|
|
|
# validate the type of the parameter |
4790
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4791
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_inputs_terminate ($err)" if ($err); |
4792
|
|
|
|
|
|
|
|
4793
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4794
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4795
|
0
|
|
|
|
|
|
next; |
4796
|
|
|
|
|
|
|
} |
4797
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4798
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_inputs_terminate for $args->{$a}->{name}" if ($body); |
4799
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4800
|
|
|
|
|
|
|
} |
4801
|
|
|
|
|
|
|
else { |
4802
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4803
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4804
|
|
|
|
|
|
|
} |
4805
|
|
|
|
|
|
|
} |
4806
|
|
|
|
|
|
|
|
4807
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4808
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4809
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4810
|
|
|
|
|
|
|
} |
4811
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
4812
|
|
|
|
|
|
|
} |
4813
|
|
|
|
|
|
|
|
4814
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4815
|
|
|
|
|
|
|
|
4816
|
|
|
|
|
|
|
|
4817
|
|
|
|
|
|
|
sub system_inputs_launch_existing { |
4818
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4819
|
0
|
|
|
|
|
|
my (%params) = @_; |
4820
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4821
|
0
|
|
|
|
|
|
my $url = "/system/inputs/$params{inputId}/launch"; |
4822
|
|
|
|
|
|
|
|
4823
|
0
|
|
|
|
|
|
my $args = { |
4824
|
|
|
|
|
|
|
inputId => { |
4825
|
|
|
|
|
|
|
description => "", |
4826
|
|
|
|
|
|
|
name => "inputId", |
4827
|
|
|
|
|
|
|
paramType => "path", |
4828
|
|
|
|
|
|
|
required => 1, |
4829
|
|
|
|
|
|
|
type => "String" |
4830
|
|
|
|
|
|
|
} |
4831
|
|
|
|
|
|
|
}; |
4832
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4833
|
|
|
|
|
|
|
|
4834
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4835
|
0
|
0
|
0
|
|
|
|
die "system_inputs_launch_existing is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4836
|
|
|
|
|
|
|
|
4837
|
|
|
|
|
|
|
# validate the type of the parameter |
4838
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4839
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_inputs_launch_existing ($err)" if ($err); |
4840
|
|
|
|
|
|
|
|
4841
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4842
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4843
|
0
|
|
|
|
|
|
next; |
4844
|
|
|
|
|
|
|
} |
4845
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4846
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_inputs_launch_existing for $args->{$a}->{name}" if ($body); |
4847
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4848
|
|
|
|
|
|
|
} |
4849
|
|
|
|
|
|
|
else { |
4850
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4851
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4852
|
|
|
|
|
|
|
} |
4853
|
|
|
|
|
|
|
} |
4854
|
|
|
|
|
|
|
|
4855
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4856
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4857
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4858
|
|
|
|
|
|
|
} |
4859
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4860
|
|
|
|
|
|
|
} |
4861
|
|
|
|
|
|
|
|
4862
|
|
|
|
|
|
|
|
4863
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4864
|
|
|
|
|
|
|
|
4865
|
|
|
|
|
|
|
|
4866
|
|
|
|
|
|
|
sub system_jobs_trigger { |
4867
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4868
|
0
|
|
|
|
|
|
my (%params) = @_; |
4869
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4870
|
0
|
|
|
|
|
|
my $url = "/system/jobs"; |
4871
|
|
|
|
|
|
|
|
4872
|
0
|
|
|
|
|
|
my $args = { |
4873
|
|
|
|
|
|
|
"JSON body" => { |
4874
|
|
|
|
|
|
|
description => "", |
4875
|
|
|
|
|
|
|
name => "JSON body", |
4876
|
|
|
|
|
|
|
paramType => "body", |
4877
|
|
|
|
|
|
|
required => 1, |
4878
|
|
|
|
|
|
|
type => "String" |
4879
|
|
|
|
|
|
|
} |
4880
|
|
|
|
|
|
|
}; |
4881
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4882
|
|
|
|
|
|
|
|
4883
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4884
|
0
|
0
|
0
|
|
|
|
die "system_jobs_trigger is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4885
|
|
|
|
|
|
|
|
4886
|
|
|
|
|
|
|
# validate the type of the parameter |
4887
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4888
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_jobs_trigger ($err)" if ($err); |
4889
|
|
|
|
|
|
|
|
4890
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4891
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4892
|
0
|
|
|
|
|
|
next; |
4893
|
|
|
|
|
|
|
} |
4894
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4895
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_jobs_trigger for $args->{$a}->{name}" if ($body); |
4896
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4897
|
|
|
|
|
|
|
} |
4898
|
|
|
|
|
|
|
else { |
4899
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4900
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4901
|
|
|
|
|
|
|
} |
4902
|
|
|
|
|
|
|
} |
4903
|
|
|
|
|
|
|
|
4904
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4905
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4906
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4907
|
|
|
|
|
|
|
} |
4908
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
4909
|
|
|
|
|
|
|
} |
4910
|
|
|
|
|
|
|
|
4911
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4912
|
|
|
|
|
|
|
|
4913
|
|
|
|
|
|
|
|
4914
|
|
|
|
|
|
|
sub system_jobs_list { |
4915
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4916
|
0
|
|
|
|
|
|
my (%params) = @_; |
4917
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4918
|
0
|
|
|
|
|
|
my $url = "/system/jobs"; |
4919
|
|
|
|
|
|
|
|
4920
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4921
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4922
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4923
|
|
|
|
|
|
|
} |
4924
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4925
|
|
|
|
|
|
|
} |
4926
|
|
|
|
|
|
|
|
4927
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4928
|
|
|
|
|
|
|
|
4929
|
|
|
|
|
|
|
|
4930
|
|
|
|
|
|
|
sub system_jobs_get { |
4931
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4932
|
0
|
|
|
|
|
|
my (%params) = @_; |
4933
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4934
|
0
|
|
|
|
|
|
my $url = "/system/jobs/$params{jobId}"; |
4935
|
|
|
|
|
|
|
|
4936
|
0
|
|
|
|
|
|
my $args = { |
4937
|
|
|
|
|
|
|
jobId => { |
4938
|
|
|
|
|
|
|
description => "", |
4939
|
|
|
|
|
|
|
name => "jobId", |
4940
|
|
|
|
|
|
|
paramType => "path", |
4941
|
|
|
|
|
|
|
required => 1, |
4942
|
|
|
|
|
|
|
type => "String" |
4943
|
|
|
|
|
|
|
} |
4944
|
|
|
|
|
|
|
}; |
4945
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
4946
|
|
|
|
|
|
|
|
4947
|
|
|
|
|
|
|
# check if the parameters exist if needed |
4948
|
0
|
0
|
0
|
|
|
|
die "system_jobs_get is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
4949
|
|
|
|
|
|
|
|
4950
|
|
|
|
|
|
|
# validate the type of the parameter |
4951
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
4952
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_jobs_get ($err)" if ($err); |
4953
|
|
|
|
|
|
|
|
4954
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
4955
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
4956
|
0
|
|
|
|
|
|
next; |
4957
|
|
|
|
|
|
|
} |
4958
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
4959
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_jobs_get for $args->{$a}->{name}" if ($body); |
4960
|
0
|
|
|
|
|
|
$body = $params{$a}; |
4961
|
|
|
|
|
|
|
} |
4962
|
|
|
|
|
|
|
else { |
4963
|
|
|
|
|
|
|
# we only want to send data that is allowed |
4964
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
4965
|
|
|
|
|
|
|
} |
4966
|
|
|
|
|
|
|
} |
4967
|
|
|
|
|
|
|
|
4968
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4969
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4970
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4971
|
|
|
|
|
|
|
} |
4972
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4973
|
|
|
|
|
|
|
} |
4974
|
|
|
|
|
|
|
|
4975
|
|
|
|
|
|
|
|
4976
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4977
|
|
|
|
|
|
|
|
4978
|
|
|
|
|
|
|
|
4979
|
|
|
|
|
|
|
sub system_l_d_a_p_get_ldap_settings { |
4980
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4981
|
0
|
|
|
|
|
|
my (%params) = @_; |
4982
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4983
|
0
|
|
|
|
|
|
my $url = "/system/ldap/settings"; |
4984
|
|
|
|
|
|
|
|
4985
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
4986
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
4987
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
4988
|
|
|
|
|
|
|
} |
4989
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
4990
|
|
|
|
|
|
|
} |
4991
|
|
|
|
|
|
|
|
4992
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
4993
|
|
|
|
|
|
|
|
4994
|
|
|
|
|
|
|
|
4995
|
|
|
|
|
|
|
sub system_l_d_a_p_update_ldap_settings { |
4996
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
4997
|
0
|
|
|
|
|
|
my (%params) = @_; |
4998
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
4999
|
0
|
|
|
|
|
|
my $url = "/system/ldap/settings"; |
5000
|
|
|
|
|
|
|
|
5001
|
0
|
|
|
|
|
|
my $args = { |
5002
|
|
|
|
|
|
|
"JSON body" => { |
5003
|
|
|
|
|
|
|
description => "", |
5004
|
|
|
|
|
|
|
name => "JSON body", |
5005
|
|
|
|
|
|
|
paramType => "body", |
5006
|
|
|
|
|
|
|
required => 1, |
5007
|
|
|
|
|
|
|
type => "String" |
5008
|
|
|
|
|
|
|
} |
5009
|
|
|
|
|
|
|
}; |
5010
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5011
|
|
|
|
|
|
|
|
5012
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5013
|
0
|
0
|
0
|
|
|
|
die "system_l_d_a_p_update_ldap_settings is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5014
|
|
|
|
|
|
|
|
5015
|
|
|
|
|
|
|
# validate the type of the parameter |
5016
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5017
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_l_d_a_p_update_ldap_settings ($err)" if ($err); |
5018
|
|
|
|
|
|
|
|
5019
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5020
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5021
|
0
|
|
|
|
|
|
next; |
5022
|
|
|
|
|
|
|
} |
5023
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5024
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_l_d_a_p_update_ldap_settings for $args->{$a}->{name}" if ($body); |
5025
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5026
|
|
|
|
|
|
|
} |
5027
|
|
|
|
|
|
|
else { |
5028
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5029
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5030
|
|
|
|
|
|
|
} |
5031
|
|
|
|
|
|
|
} |
5032
|
|
|
|
|
|
|
|
5033
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5034
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5035
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5036
|
|
|
|
|
|
|
} |
5037
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
5038
|
|
|
|
|
|
|
} |
5039
|
|
|
|
|
|
|
|
5040
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5041
|
|
|
|
|
|
|
|
5042
|
|
|
|
|
|
|
|
5043
|
|
|
|
|
|
|
sub system_l_d_a_p_delete_ldap_settings { |
5044
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5045
|
0
|
|
|
|
|
|
my (%params) = @_; |
5046
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5047
|
0
|
|
|
|
|
|
my $url = "/system/ldap/settings"; |
5048
|
|
|
|
|
|
|
|
5049
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5050
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5051
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5052
|
|
|
|
|
|
|
} |
5053
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
5054
|
|
|
|
|
|
|
} |
5055
|
|
|
|
|
|
|
|
5056
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5057
|
|
|
|
|
|
|
|
5058
|
|
|
|
|
|
|
|
5059
|
|
|
|
|
|
|
sub system_l_d_a_p_test_ldap_configuration { |
5060
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5061
|
0
|
|
|
|
|
|
my (%params) = @_; |
5062
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5063
|
0
|
|
|
|
|
|
my $url = "/system/ldap/test"; |
5064
|
|
|
|
|
|
|
|
5065
|
0
|
|
|
|
|
|
my $args = { |
5066
|
|
|
|
|
|
|
"Configuration to test" => { |
5067
|
|
|
|
|
|
|
description => "", |
5068
|
|
|
|
|
|
|
name => "Configuration to test", |
5069
|
|
|
|
|
|
|
paramType => "body", |
5070
|
|
|
|
|
|
|
required => 1, |
5071
|
|
|
|
|
|
|
type => "LdapTestConfigRequest" |
5072
|
|
|
|
|
|
|
} |
5073
|
|
|
|
|
|
|
}; |
5074
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5075
|
|
|
|
|
|
|
|
5076
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5077
|
0
|
0
|
0
|
|
|
|
die "system_l_d_a_p_test_ldap_configuration is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5078
|
|
|
|
|
|
|
|
5079
|
|
|
|
|
|
|
# validate the type of the parameter |
5080
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5081
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_l_d_a_p_test_ldap_configuration ($err)" if ($err); |
5082
|
|
|
|
|
|
|
|
5083
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5084
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5085
|
0
|
|
|
|
|
|
next; |
5086
|
|
|
|
|
|
|
} |
5087
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5088
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_l_d_a_p_test_ldap_configuration for $args->{$a}->{name}" if ($body); |
5089
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5090
|
|
|
|
|
|
|
} |
5091
|
|
|
|
|
|
|
else { |
5092
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5093
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5094
|
|
|
|
|
|
|
} |
5095
|
|
|
|
|
|
|
} |
5096
|
|
|
|
|
|
|
|
5097
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5098
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5099
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5100
|
|
|
|
|
|
|
} |
5101
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
5102
|
|
|
|
|
|
|
} |
5103
|
|
|
|
|
|
|
|
5104
|
|
|
|
|
|
|
|
5105
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5106
|
|
|
|
|
|
|
|
5107
|
|
|
|
|
|
|
|
5108
|
|
|
|
|
|
|
sub system_loggers_loggers { |
5109
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5110
|
0
|
|
|
|
|
|
my (%params) = @_; |
5111
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5112
|
0
|
|
|
|
|
|
my $url = "/system/loggers"; |
5113
|
|
|
|
|
|
|
|
5114
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5115
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5116
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5117
|
|
|
|
|
|
|
} |
5118
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5119
|
|
|
|
|
|
|
} |
5120
|
|
|
|
|
|
|
|
5121
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5122
|
|
|
|
|
|
|
|
5123
|
|
|
|
|
|
|
|
5124
|
|
|
|
|
|
|
sub system_loggers_subsytems { |
5125
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5126
|
0
|
|
|
|
|
|
my (%params) = @_; |
5127
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5128
|
0
|
|
|
|
|
|
my $url = "/system/loggers/subsystems"; |
5129
|
|
|
|
|
|
|
|
5130
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5131
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5132
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5133
|
|
|
|
|
|
|
} |
5134
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5135
|
|
|
|
|
|
|
} |
5136
|
|
|
|
|
|
|
|
5137
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5138
|
|
|
|
|
|
|
|
5139
|
|
|
|
|
|
|
|
5140
|
|
|
|
|
|
|
sub system_loggers_set_subsystem_logger_level { |
5141
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5142
|
0
|
|
|
|
|
|
my (%params) = @_; |
5143
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5144
|
0
|
|
|
|
|
|
my $url = "/system/loggers/subsystems/$params{subsystem}/level/$params{level}"; |
5145
|
|
|
|
|
|
|
|
5146
|
0
|
|
|
|
|
|
my $args = { |
5147
|
|
|
|
|
|
|
level => { |
5148
|
|
|
|
|
|
|
description => "", |
5149
|
|
|
|
|
|
|
name => "level", |
5150
|
|
|
|
|
|
|
paramType => "path", |
5151
|
|
|
|
|
|
|
required => 1, |
5152
|
|
|
|
|
|
|
type => "String" |
5153
|
|
|
|
|
|
|
}, |
5154
|
|
|
|
|
|
|
subsystem => { |
5155
|
|
|
|
|
|
|
description => "", |
5156
|
|
|
|
|
|
|
name => "subsystem", |
5157
|
|
|
|
|
|
|
paramType => "path", |
5158
|
|
|
|
|
|
|
required => 1, |
5159
|
|
|
|
|
|
|
type => "String" |
5160
|
|
|
|
|
|
|
} |
5161
|
|
|
|
|
|
|
}; |
5162
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5163
|
|
|
|
|
|
|
|
5164
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5165
|
0
|
0
|
0
|
|
|
|
die "system_loggers_set_subsystem_logger_level is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5166
|
|
|
|
|
|
|
|
5167
|
|
|
|
|
|
|
# validate the type of the parameter |
5168
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5169
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_loggers_set_subsystem_logger_level ($err)" if ($err); |
5170
|
|
|
|
|
|
|
|
5171
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5172
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5173
|
0
|
|
|
|
|
|
next; |
5174
|
|
|
|
|
|
|
} |
5175
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5176
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_loggers_set_subsystem_logger_level for $args->{$a}->{name}" if ($body); |
5177
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5178
|
|
|
|
|
|
|
} |
5179
|
|
|
|
|
|
|
else { |
5180
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5181
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5182
|
|
|
|
|
|
|
} |
5183
|
|
|
|
|
|
|
} |
5184
|
|
|
|
|
|
|
|
5185
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5186
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5187
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5188
|
|
|
|
|
|
|
} |
5189
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
5190
|
|
|
|
|
|
|
} |
5191
|
|
|
|
|
|
|
|
5192
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5193
|
|
|
|
|
|
|
|
5194
|
|
|
|
|
|
|
|
5195
|
|
|
|
|
|
|
sub system_loggers_set_single_logger_level { |
5196
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5197
|
0
|
|
|
|
|
|
my (%params) = @_; |
5198
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5199
|
0
|
|
|
|
|
|
my $url = "/system/loggers/$params{loggerName}/level/$params{level}"; |
5200
|
|
|
|
|
|
|
|
5201
|
0
|
|
|
|
|
|
my $args = { |
5202
|
|
|
|
|
|
|
level => { |
5203
|
|
|
|
|
|
|
description => "", |
5204
|
|
|
|
|
|
|
name => "level", |
5205
|
|
|
|
|
|
|
paramType => "path", |
5206
|
|
|
|
|
|
|
required => 1, |
5207
|
|
|
|
|
|
|
type => "String" |
5208
|
|
|
|
|
|
|
}, |
5209
|
|
|
|
|
|
|
loggerName => { |
5210
|
|
|
|
|
|
|
description => "", |
5211
|
|
|
|
|
|
|
name => "loggerName", |
5212
|
|
|
|
|
|
|
paramType => "path", |
5213
|
|
|
|
|
|
|
required => 1, |
5214
|
|
|
|
|
|
|
type => "String" |
5215
|
|
|
|
|
|
|
} |
5216
|
|
|
|
|
|
|
}; |
5217
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5218
|
|
|
|
|
|
|
|
5219
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5220
|
0
|
0
|
0
|
|
|
|
die "system_loggers_set_single_logger_level is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5221
|
|
|
|
|
|
|
|
5222
|
|
|
|
|
|
|
# validate the type of the parameter |
5223
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5224
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_loggers_set_single_logger_level ($err)" if ($err); |
5225
|
|
|
|
|
|
|
|
5226
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5227
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5228
|
0
|
|
|
|
|
|
next; |
5229
|
|
|
|
|
|
|
} |
5230
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5231
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_loggers_set_single_logger_level for $args->{$a}->{name}" if ($body); |
5232
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5233
|
|
|
|
|
|
|
} |
5234
|
|
|
|
|
|
|
else { |
5235
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5236
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5237
|
|
|
|
|
|
|
} |
5238
|
|
|
|
|
|
|
} |
5239
|
|
|
|
|
|
|
|
5240
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5241
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5242
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5243
|
|
|
|
|
|
|
} |
5244
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
5245
|
|
|
|
|
|
|
} |
5246
|
|
|
|
|
|
|
|
5247
|
|
|
|
|
|
|
|
5248
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5249
|
|
|
|
|
|
|
|
5250
|
|
|
|
|
|
|
|
5251
|
|
|
|
|
|
|
sub system_messages_all { |
5252
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5253
|
0
|
|
|
|
|
|
my (%params) = @_; |
5254
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5255
|
0
|
|
|
|
|
|
my $url = "/system/messages"; |
5256
|
|
|
|
|
|
|
|
5257
|
0
|
|
|
|
|
|
my $args = { |
5258
|
|
|
|
|
|
|
page => { |
5259
|
|
|
|
|
|
|
description => "Page", |
5260
|
|
|
|
|
|
|
name => "page", |
5261
|
|
|
|
|
|
|
paramType => "query", |
5262
|
|
|
|
|
|
|
required => 0, |
5263
|
|
|
|
|
|
|
type => "Integer" |
5264
|
|
|
|
|
|
|
} |
5265
|
|
|
|
|
|
|
}; |
5266
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5267
|
|
|
|
|
|
|
|
5268
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5269
|
0
|
0
|
0
|
|
|
|
die "system_messages_all is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5270
|
|
|
|
|
|
|
|
5271
|
|
|
|
|
|
|
# validate the type of the parameter |
5272
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5273
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_messages_all ($err)" if ($err); |
5274
|
|
|
|
|
|
|
|
5275
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5276
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5277
|
0
|
|
|
|
|
|
next; |
5278
|
|
|
|
|
|
|
} |
5279
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5280
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_messages_all for $args->{$a}->{name}" if ($body); |
5281
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5282
|
|
|
|
|
|
|
} |
5283
|
|
|
|
|
|
|
else { |
5284
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5285
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5286
|
|
|
|
|
|
|
} |
5287
|
|
|
|
|
|
|
} |
5288
|
|
|
|
|
|
|
|
5289
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5290
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5291
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5292
|
|
|
|
|
|
|
} |
5293
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5294
|
|
|
|
|
|
|
} |
5295
|
|
|
|
|
|
|
|
5296
|
|
|
|
|
|
|
|
5297
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5298
|
|
|
|
|
|
|
|
5299
|
|
|
|
|
|
|
|
5300
|
|
|
|
|
|
|
sub system_metrics_metrics { |
5301
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5302
|
0
|
|
|
|
|
|
my (%params) = @_; |
5303
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5304
|
0
|
|
|
|
|
|
my $url = "/system/metrics"; |
5305
|
|
|
|
|
|
|
|
5306
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5307
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5308
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5309
|
|
|
|
|
|
|
} |
5310
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5311
|
|
|
|
|
|
|
} |
5312
|
|
|
|
|
|
|
|
5313
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5314
|
|
|
|
|
|
|
|
5315
|
|
|
|
|
|
|
|
5316
|
|
|
|
|
|
|
sub system_metrics_metric_names { |
5317
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5318
|
0
|
|
|
|
|
|
my (%params) = @_; |
5319
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5320
|
0
|
|
|
|
|
|
my $url = "/system/metrics/names"; |
5321
|
|
|
|
|
|
|
|
5322
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5323
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5324
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5325
|
|
|
|
|
|
|
} |
5326
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5327
|
|
|
|
|
|
|
} |
5328
|
|
|
|
|
|
|
|
5329
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5330
|
|
|
|
|
|
|
|
5331
|
|
|
|
|
|
|
|
5332
|
|
|
|
|
|
|
sub system_metrics_by_namespace { |
5333
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5334
|
0
|
|
|
|
|
|
my (%params) = @_; |
5335
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5336
|
0
|
|
|
|
|
|
my $url = "/system/metrics/namespace/$params{namespace}"; |
5337
|
|
|
|
|
|
|
|
5338
|
0
|
|
|
|
|
|
my $args = { |
5339
|
|
|
|
|
|
|
namespace => { |
5340
|
|
|
|
|
|
|
description => "", |
5341
|
|
|
|
|
|
|
name => "namespace", |
5342
|
|
|
|
|
|
|
paramType => "path", |
5343
|
|
|
|
|
|
|
required => 1, |
5344
|
|
|
|
|
|
|
type => "String" |
5345
|
|
|
|
|
|
|
} |
5346
|
|
|
|
|
|
|
}; |
5347
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5348
|
|
|
|
|
|
|
|
5349
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5350
|
0
|
0
|
0
|
|
|
|
die "system_metrics_by_namespace is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5351
|
|
|
|
|
|
|
|
5352
|
|
|
|
|
|
|
# validate the type of the parameter |
5353
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5354
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_metrics_by_namespace ($err)" if ($err); |
5355
|
|
|
|
|
|
|
|
5356
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5357
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5358
|
0
|
|
|
|
|
|
next; |
5359
|
|
|
|
|
|
|
} |
5360
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5361
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_metrics_by_namespace for $args->{$a}->{name}" if ($body); |
5362
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5363
|
|
|
|
|
|
|
} |
5364
|
|
|
|
|
|
|
else { |
5365
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5366
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5367
|
|
|
|
|
|
|
} |
5368
|
|
|
|
|
|
|
} |
5369
|
|
|
|
|
|
|
|
5370
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5371
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5372
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5373
|
|
|
|
|
|
|
} |
5374
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5375
|
|
|
|
|
|
|
} |
5376
|
|
|
|
|
|
|
|
5377
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5378
|
|
|
|
|
|
|
|
5379
|
|
|
|
|
|
|
|
5380
|
|
|
|
|
|
|
sub system_metrics_single_metric { |
5381
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5382
|
0
|
|
|
|
|
|
my (%params) = @_; |
5383
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5384
|
0
|
|
|
|
|
|
my $url = "/system/metrics/$params{metricName}"; |
5385
|
|
|
|
|
|
|
|
5386
|
0
|
|
|
|
|
|
my $args = { |
5387
|
|
|
|
|
|
|
metricName => { |
5388
|
|
|
|
|
|
|
description => "", |
5389
|
|
|
|
|
|
|
name => "metricName", |
5390
|
|
|
|
|
|
|
paramType => "path", |
5391
|
|
|
|
|
|
|
required => 1, |
5392
|
|
|
|
|
|
|
type => "String" |
5393
|
|
|
|
|
|
|
} |
5394
|
|
|
|
|
|
|
}; |
5395
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5396
|
|
|
|
|
|
|
|
5397
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5398
|
0
|
0
|
0
|
|
|
|
die "system_metrics_single_metric is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5399
|
|
|
|
|
|
|
|
5400
|
|
|
|
|
|
|
# validate the type of the parameter |
5401
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5402
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_metrics_single_metric ($err)" if ($err); |
5403
|
|
|
|
|
|
|
|
5404
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5405
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5406
|
0
|
|
|
|
|
|
next; |
5407
|
|
|
|
|
|
|
} |
5408
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5409
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_metrics_single_metric for $args->{$a}->{name}" if ($body); |
5410
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5411
|
|
|
|
|
|
|
} |
5412
|
|
|
|
|
|
|
else { |
5413
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5414
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5415
|
|
|
|
|
|
|
} |
5416
|
|
|
|
|
|
|
} |
5417
|
|
|
|
|
|
|
|
5418
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5419
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5420
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5421
|
|
|
|
|
|
|
} |
5422
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5423
|
|
|
|
|
|
|
} |
5424
|
|
|
|
|
|
|
|
5425
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5426
|
|
|
|
|
|
|
|
5427
|
|
|
|
|
|
|
|
5428
|
|
|
|
|
|
|
sub system_metrics_historic_single_metric { |
5429
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5430
|
0
|
|
|
|
|
|
my (%params) = @_; |
5431
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5432
|
0
|
|
|
|
|
|
my $url = "/system/metrics/$params{metricName}/history"; |
5433
|
|
|
|
|
|
|
|
5434
|
0
|
|
|
|
|
|
my $args = { |
5435
|
|
|
|
|
|
|
after => { |
5436
|
|
|
|
|
|
|
description => "Only values for after this UTC timestamp (1970 epoch)", |
5437
|
|
|
|
|
|
|
name => "after", |
5438
|
|
|
|
|
|
|
paramType => "body", |
5439
|
|
|
|
|
|
|
required => 0, |
5440
|
|
|
|
|
|
|
type => "Long" |
5441
|
|
|
|
|
|
|
}, |
5442
|
|
|
|
|
|
|
metricName => { |
5443
|
|
|
|
|
|
|
description => "", |
5444
|
|
|
|
|
|
|
name => "metricName", |
5445
|
|
|
|
|
|
|
paramType => "path", |
5446
|
|
|
|
|
|
|
required => 1, |
5447
|
|
|
|
|
|
|
type => "String" |
5448
|
|
|
|
|
|
|
} |
5449
|
|
|
|
|
|
|
}; |
5450
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5451
|
|
|
|
|
|
|
|
5452
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5453
|
0
|
0
|
0
|
|
|
|
die "system_metrics_historic_single_metric is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5454
|
|
|
|
|
|
|
|
5455
|
|
|
|
|
|
|
# validate the type of the parameter |
5456
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5457
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_metrics_historic_single_metric ($err)" if ($err); |
5458
|
|
|
|
|
|
|
|
5459
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5460
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5461
|
0
|
|
|
|
|
|
next; |
5462
|
|
|
|
|
|
|
} |
5463
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5464
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_metrics_historic_single_metric for $args->{$a}->{name}" if ($body); |
5465
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5466
|
|
|
|
|
|
|
} |
5467
|
|
|
|
|
|
|
else { |
5468
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5469
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5470
|
|
|
|
|
|
|
} |
5471
|
|
|
|
|
|
|
} |
5472
|
|
|
|
|
|
|
|
5473
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5474
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5475
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5476
|
|
|
|
|
|
|
} |
5477
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5478
|
|
|
|
|
|
|
} |
5479
|
|
|
|
|
|
|
|
5480
|
|
|
|
|
|
|
|
5481
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5482
|
|
|
|
|
|
|
|
5483
|
|
|
|
|
|
|
|
5484
|
|
|
|
|
|
|
sub system_notifications_list_notifications { |
5485
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5486
|
0
|
|
|
|
|
|
my (%params) = @_; |
5487
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5488
|
0
|
|
|
|
|
|
my $url = "/system/notifications"; |
5489
|
|
|
|
|
|
|
|
5490
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5491
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5492
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5493
|
|
|
|
|
|
|
} |
5494
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5495
|
|
|
|
|
|
|
} |
5496
|
|
|
|
|
|
|
|
5497
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5498
|
|
|
|
|
|
|
|
5499
|
|
|
|
|
|
|
|
5500
|
|
|
|
|
|
|
sub system_notifications_delete_notification { |
5501
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5502
|
0
|
|
|
|
|
|
my (%params) = @_; |
5503
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5504
|
0
|
|
|
|
|
|
my $url = "/system/notifications/$params{notificationType}"; |
5505
|
|
|
|
|
|
|
|
5506
|
0
|
|
|
|
|
|
my $args = { |
5507
|
|
|
|
|
|
|
notificationType => { |
5508
|
|
|
|
|
|
|
description => "", |
5509
|
|
|
|
|
|
|
name => "notificationType", |
5510
|
|
|
|
|
|
|
paramType => "path", |
5511
|
|
|
|
|
|
|
required => 0, |
5512
|
|
|
|
|
|
|
type => "String" |
5513
|
|
|
|
|
|
|
} |
5514
|
|
|
|
|
|
|
}; |
5515
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5516
|
|
|
|
|
|
|
|
5517
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5518
|
0
|
0
|
0
|
|
|
|
die "system_notifications_delete_notification is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5519
|
|
|
|
|
|
|
|
5520
|
|
|
|
|
|
|
# validate the type of the parameter |
5521
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5522
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_notifications_delete_notification ($err)" if ($err); |
5523
|
|
|
|
|
|
|
|
5524
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5525
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5526
|
0
|
|
|
|
|
|
next; |
5527
|
|
|
|
|
|
|
} |
5528
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5529
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_notifications_delete_notification for $args->{$a}->{name}" if ($body); |
5530
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5531
|
|
|
|
|
|
|
} |
5532
|
|
|
|
|
|
|
else { |
5533
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5534
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5535
|
|
|
|
|
|
|
} |
5536
|
|
|
|
|
|
|
} |
5537
|
|
|
|
|
|
|
|
5538
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5539
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5540
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5541
|
|
|
|
|
|
|
} |
5542
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
5543
|
|
|
|
|
|
|
} |
5544
|
|
|
|
|
|
|
|
5545
|
|
|
|
|
|
|
|
5546
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5547
|
|
|
|
|
|
|
|
5548
|
|
|
|
|
|
|
|
5549
|
|
|
|
|
|
|
sub system_radios_radios { |
5550
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5551
|
0
|
|
|
|
|
|
my (%params) = @_; |
5552
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5553
|
0
|
|
|
|
|
|
my $url = "/system/radios"; |
5554
|
|
|
|
|
|
|
|
5555
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5556
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5557
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5558
|
|
|
|
|
|
|
} |
5559
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5560
|
|
|
|
|
|
|
} |
5561
|
|
|
|
|
|
|
|
5562
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5563
|
|
|
|
|
|
|
|
5564
|
|
|
|
|
|
|
|
5565
|
|
|
|
|
|
|
sub system_radios_radio { |
5566
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5567
|
0
|
|
|
|
|
|
my (%params) = @_; |
5568
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5569
|
0
|
|
|
|
|
|
my $url = "/system/radios/$params{radioId}"; |
5570
|
|
|
|
|
|
|
|
5571
|
0
|
|
|
|
|
|
my $args = { |
5572
|
|
|
|
|
|
|
radioId => { |
5573
|
|
|
|
|
|
|
description => "", |
5574
|
|
|
|
|
|
|
name => "radioId", |
5575
|
|
|
|
|
|
|
paramType => "path", |
5576
|
|
|
|
|
|
|
required => 1, |
5577
|
|
|
|
|
|
|
type => "String" |
5578
|
|
|
|
|
|
|
} |
5579
|
|
|
|
|
|
|
}; |
5580
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5581
|
|
|
|
|
|
|
|
5582
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5583
|
0
|
0
|
0
|
|
|
|
die "system_radios_radio is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5584
|
|
|
|
|
|
|
|
5585
|
|
|
|
|
|
|
# validate the type of the parameter |
5586
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5587
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_radios_radio ($err)" if ($err); |
5588
|
|
|
|
|
|
|
|
5589
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5590
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5591
|
0
|
|
|
|
|
|
next; |
5592
|
|
|
|
|
|
|
} |
5593
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5594
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_radios_radio for $args->{$a}->{name}" if ($body); |
5595
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5596
|
|
|
|
|
|
|
} |
5597
|
|
|
|
|
|
|
else { |
5598
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5599
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5600
|
|
|
|
|
|
|
} |
5601
|
|
|
|
|
|
|
} |
5602
|
|
|
|
|
|
|
|
5603
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5604
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5605
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5606
|
|
|
|
|
|
|
} |
5607
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5608
|
|
|
|
|
|
|
} |
5609
|
|
|
|
|
|
|
|
5610
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5611
|
|
|
|
|
|
|
|
5612
|
|
|
|
|
|
|
|
5613
|
|
|
|
|
|
|
sub system_radios_register_input { |
5614
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5615
|
0
|
|
|
|
|
|
my (%params) = @_; |
5616
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5617
|
0
|
|
|
|
|
|
my $url = "/system/radios/$params{radioId}/inputs"; |
5618
|
|
|
|
|
|
|
|
5619
|
0
|
|
|
|
|
|
my $args = { |
5620
|
|
|
|
|
|
|
"JSON body" => { |
5621
|
|
|
|
|
|
|
description => "", |
5622
|
|
|
|
|
|
|
name => "JSON body", |
5623
|
|
|
|
|
|
|
paramType => "body", |
5624
|
|
|
|
|
|
|
required => 1, |
5625
|
|
|
|
|
|
|
type => "String" |
5626
|
|
|
|
|
|
|
}, |
5627
|
|
|
|
|
|
|
radioId => { |
5628
|
|
|
|
|
|
|
description => "", |
5629
|
|
|
|
|
|
|
name => "radioId", |
5630
|
|
|
|
|
|
|
paramType => "path", |
5631
|
|
|
|
|
|
|
required => 1, |
5632
|
|
|
|
|
|
|
type => "String" |
5633
|
|
|
|
|
|
|
} |
5634
|
|
|
|
|
|
|
}; |
5635
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5636
|
|
|
|
|
|
|
|
5637
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5638
|
0
|
0
|
0
|
|
|
|
die "system_radios_register_input is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5639
|
|
|
|
|
|
|
|
5640
|
|
|
|
|
|
|
# validate the type of the parameter |
5641
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5642
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_radios_register_input ($err)" if ($err); |
5643
|
|
|
|
|
|
|
|
5644
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5645
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5646
|
0
|
|
|
|
|
|
next; |
5647
|
|
|
|
|
|
|
} |
5648
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5649
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_radios_register_input for $args->{$a}->{name}" if ($body); |
5650
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5651
|
|
|
|
|
|
|
} |
5652
|
|
|
|
|
|
|
else { |
5653
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5654
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5655
|
|
|
|
|
|
|
} |
5656
|
|
|
|
|
|
|
} |
5657
|
|
|
|
|
|
|
|
5658
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5659
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5660
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5661
|
|
|
|
|
|
|
} |
5662
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
5663
|
|
|
|
|
|
|
} |
5664
|
|
|
|
|
|
|
|
5665
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5666
|
|
|
|
|
|
|
|
5667
|
|
|
|
|
|
|
|
5668
|
|
|
|
|
|
|
sub system_radios_persisted_inputs { |
5669
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5670
|
0
|
|
|
|
|
|
my (%params) = @_; |
5671
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5672
|
0
|
|
|
|
|
|
my $url = "/system/radios/$params{radioId}/inputs"; |
5673
|
|
|
|
|
|
|
|
5674
|
0
|
|
|
|
|
|
my $args = { |
5675
|
|
|
|
|
|
|
radioId => { |
5676
|
|
|
|
|
|
|
description => "", |
5677
|
|
|
|
|
|
|
name => "radioId", |
5678
|
|
|
|
|
|
|
paramType => "path", |
5679
|
|
|
|
|
|
|
required => 1, |
5680
|
|
|
|
|
|
|
type => "String" |
5681
|
|
|
|
|
|
|
} |
5682
|
|
|
|
|
|
|
}; |
5683
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5684
|
|
|
|
|
|
|
|
5685
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5686
|
0
|
0
|
0
|
|
|
|
die "system_radios_persisted_inputs is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5687
|
|
|
|
|
|
|
|
5688
|
|
|
|
|
|
|
# validate the type of the parameter |
5689
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5690
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_radios_persisted_inputs ($err)" if ($err); |
5691
|
|
|
|
|
|
|
|
5692
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5693
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5694
|
0
|
|
|
|
|
|
next; |
5695
|
|
|
|
|
|
|
} |
5696
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5697
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_radios_persisted_inputs for $args->{$a}->{name}" if ($body); |
5698
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5699
|
|
|
|
|
|
|
} |
5700
|
|
|
|
|
|
|
else { |
5701
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5702
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5703
|
|
|
|
|
|
|
} |
5704
|
|
|
|
|
|
|
} |
5705
|
|
|
|
|
|
|
|
5706
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5707
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5708
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5709
|
|
|
|
|
|
|
} |
5710
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5711
|
|
|
|
|
|
|
} |
5712
|
|
|
|
|
|
|
|
5713
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5714
|
|
|
|
|
|
|
|
5715
|
|
|
|
|
|
|
|
5716
|
|
|
|
|
|
|
sub system_radios_unregister_input { |
5717
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5718
|
0
|
|
|
|
|
|
my (%params) = @_; |
5719
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5720
|
0
|
|
|
|
|
|
my $url = "/system/radios/$params{radioId}/inputs/$params{inputId}"; |
5721
|
|
|
|
|
|
|
|
5722
|
0
|
|
|
|
|
|
my $args = { |
5723
|
|
|
|
|
|
|
inputId => { |
5724
|
|
|
|
|
|
|
description => "", |
5725
|
|
|
|
|
|
|
name => "inputId", |
5726
|
|
|
|
|
|
|
paramType => "path", |
5727
|
|
|
|
|
|
|
required => 1, |
5728
|
|
|
|
|
|
|
type => "String" |
5729
|
|
|
|
|
|
|
}, |
5730
|
|
|
|
|
|
|
radioId => { |
5731
|
|
|
|
|
|
|
description => "", |
5732
|
|
|
|
|
|
|
name => "radioId", |
5733
|
|
|
|
|
|
|
paramType => "path", |
5734
|
|
|
|
|
|
|
required => 1, |
5735
|
|
|
|
|
|
|
type => "String" |
5736
|
|
|
|
|
|
|
} |
5737
|
|
|
|
|
|
|
}; |
5738
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5739
|
|
|
|
|
|
|
|
5740
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5741
|
0
|
0
|
0
|
|
|
|
die "system_radios_unregister_input is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5742
|
|
|
|
|
|
|
|
5743
|
|
|
|
|
|
|
# validate the type of the parameter |
5744
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5745
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_radios_unregister_input ($err)" if ($err); |
5746
|
|
|
|
|
|
|
|
5747
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5748
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5749
|
0
|
|
|
|
|
|
next; |
5750
|
|
|
|
|
|
|
} |
5751
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5752
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_radios_unregister_input for $args->{$a}->{name}" if ($body); |
5753
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5754
|
|
|
|
|
|
|
} |
5755
|
|
|
|
|
|
|
else { |
5756
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5757
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5758
|
|
|
|
|
|
|
} |
5759
|
|
|
|
|
|
|
} |
5760
|
|
|
|
|
|
|
|
5761
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5762
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5763
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5764
|
|
|
|
|
|
|
} |
5765
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
5766
|
|
|
|
|
|
|
} |
5767
|
|
|
|
|
|
|
|
5768
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5769
|
|
|
|
|
|
|
|
5770
|
|
|
|
|
|
|
|
5771
|
|
|
|
|
|
|
sub system_radios_ping { |
5772
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5773
|
0
|
|
|
|
|
|
my (%params) = @_; |
5774
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5775
|
0
|
|
|
|
|
|
my $url = "/system/radios/$params{radioId}/ping"; |
5776
|
|
|
|
|
|
|
|
5777
|
0
|
|
|
|
|
|
my $args = { |
5778
|
|
|
|
|
|
|
"JSON body" => { |
5779
|
|
|
|
|
|
|
description => "", |
5780
|
|
|
|
|
|
|
name => "JSON body", |
5781
|
|
|
|
|
|
|
paramType => "body", |
5782
|
|
|
|
|
|
|
required => 1, |
5783
|
|
|
|
|
|
|
type => "String" |
5784
|
|
|
|
|
|
|
}, |
5785
|
|
|
|
|
|
|
radioId => { |
5786
|
|
|
|
|
|
|
description => "", |
5787
|
|
|
|
|
|
|
name => "radioId", |
5788
|
|
|
|
|
|
|
paramType => "path", |
5789
|
|
|
|
|
|
|
required => 1, |
5790
|
|
|
|
|
|
|
type => "String" |
5791
|
|
|
|
|
|
|
} |
5792
|
|
|
|
|
|
|
}; |
5793
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5794
|
|
|
|
|
|
|
|
5795
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5796
|
0
|
0
|
0
|
|
|
|
die "system_radios_ping is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5797
|
|
|
|
|
|
|
|
5798
|
|
|
|
|
|
|
# validate the type of the parameter |
5799
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5800
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_radios_ping ($err)" if ($err); |
5801
|
|
|
|
|
|
|
|
5802
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5803
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5804
|
0
|
|
|
|
|
|
next; |
5805
|
|
|
|
|
|
|
} |
5806
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5807
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_radios_ping for $args->{$a}->{name}" if ($body); |
5808
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5809
|
|
|
|
|
|
|
} |
5810
|
|
|
|
|
|
|
else { |
5811
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5812
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5813
|
|
|
|
|
|
|
} |
5814
|
|
|
|
|
|
|
} |
5815
|
|
|
|
|
|
|
|
5816
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5817
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5818
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5819
|
|
|
|
|
|
|
} |
5820
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
5821
|
|
|
|
|
|
|
} |
5822
|
|
|
|
|
|
|
|
5823
|
|
|
|
|
|
|
|
5824
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5825
|
|
|
|
|
|
|
|
5826
|
|
|
|
|
|
|
|
5827
|
|
|
|
|
|
|
sub system_sessions_new_session { |
5828
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5829
|
0
|
|
|
|
|
|
my (%params) = @_; |
5830
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5831
|
0
|
|
|
|
|
|
my $url = "/system/sessions"; |
5832
|
|
|
|
|
|
|
|
5833
|
0
|
|
|
|
|
|
my $args = { |
5834
|
|
|
|
|
|
|
"Login request" => { |
5835
|
|
|
|
|
|
|
description => "Username and credentials", |
5836
|
|
|
|
|
|
|
name => "Login request", |
5837
|
|
|
|
|
|
|
paramType => "body", |
5838
|
|
|
|
|
|
|
required => 1, |
5839
|
|
|
|
|
|
|
type => "SessionCreateRequest" |
5840
|
|
|
|
|
|
|
} |
5841
|
|
|
|
|
|
|
}; |
5842
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5843
|
|
|
|
|
|
|
|
5844
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5845
|
0
|
0
|
0
|
|
|
|
die "system_sessions_new_session is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5846
|
|
|
|
|
|
|
|
5847
|
|
|
|
|
|
|
# validate the type of the parameter |
5848
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5849
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_sessions_new_session ($err)" if ($err); |
5850
|
|
|
|
|
|
|
|
5851
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5852
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5853
|
0
|
|
|
|
|
|
next; |
5854
|
|
|
|
|
|
|
} |
5855
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5856
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_sessions_new_session for $args->{$a}->{name}" if ($body); |
5857
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5858
|
|
|
|
|
|
|
} |
5859
|
|
|
|
|
|
|
else { |
5860
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5861
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5862
|
|
|
|
|
|
|
} |
5863
|
|
|
|
|
|
|
} |
5864
|
|
|
|
|
|
|
|
5865
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5866
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5867
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5868
|
|
|
|
|
|
|
} |
5869
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
5870
|
|
|
|
|
|
|
} |
5871
|
|
|
|
|
|
|
|
5872
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5873
|
|
|
|
|
|
|
|
5874
|
|
|
|
|
|
|
|
5875
|
|
|
|
|
|
|
sub system_sessions_terminate_session { |
5876
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5877
|
0
|
|
|
|
|
|
my (%params) = @_; |
5878
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5879
|
0
|
|
|
|
|
|
my $url = "/system/sessions/$params{sessionId}"; |
5880
|
|
|
|
|
|
|
|
5881
|
0
|
|
|
|
|
|
my $args = { |
5882
|
|
|
|
|
|
|
sessionId => { |
5883
|
|
|
|
|
|
|
description => "", |
5884
|
|
|
|
|
|
|
name => "sessionId", |
5885
|
|
|
|
|
|
|
paramType => "path", |
5886
|
|
|
|
|
|
|
required => 1, |
5887
|
|
|
|
|
|
|
type => "String" |
5888
|
|
|
|
|
|
|
} |
5889
|
|
|
|
|
|
|
}; |
5890
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5891
|
|
|
|
|
|
|
|
5892
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5893
|
0
|
0
|
0
|
|
|
|
die "system_sessions_terminate_session is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5894
|
|
|
|
|
|
|
|
5895
|
|
|
|
|
|
|
# validate the type of the parameter |
5896
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5897
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to system_sessions_terminate_session ($err)" if ($err); |
5898
|
|
|
|
|
|
|
|
5899
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5900
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5901
|
0
|
|
|
|
|
|
next; |
5902
|
|
|
|
|
|
|
} |
5903
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5904
|
0
|
0
|
|
|
|
|
die "body has already been defined in system_sessions_terminate_session for $args->{$a}->{name}" if ($body); |
5905
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5906
|
|
|
|
|
|
|
} |
5907
|
|
|
|
|
|
|
else { |
5908
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5909
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5910
|
|
|
|
|
|
|
} |
5911
|
|
|
|
|
|
|
} |
5912
|
|
|
|
|
|
|
|
5913
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5914
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5915
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5916
|
|
|
|
|
|
|
} |
5917
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
5918
|
|
|
|
|
|
|
} |
5919
|
|
|
|
|
|
|
|
5920
|
|
|
|
|
|
|
|
5921
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5922
|
|
|
|
|
|
|
|
5923
|
|
|
|
|
|
|
|
5924
|
|
|
|
|
|
|
sub system_throughput_total { |
5925
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5926
|
0
|
|
|
|
|
|
my (%params) = @_; |
5927
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5928
|
0
|
|
|
|
|
|
my $url = "/system/throughput"; |
5929
|
|
|
|
|
|
|
|
5930
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5931
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5932
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5933
|
|
|
|
|
|
|
} |
5934
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5935
|
|
|
|
|
|
|
} |
5936
|
|
|
|
|
|
|
|
5937
|
|
|
|
|
|
|
|
5938
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5939
|
|
|
|
|
|
|
|
5940
|
|
|
|
|
|
|
|
5941
|
|
|
|
|
|
|
sub users_list_users { |
5942
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5943
|
0
|
|
|
|
|
|
my (%params) = @_; |
5944
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5945
|
0
|
|
|
|
|
|
my $url = "/users"; |
5946
|
|
|
|
|
|
|
|
5947
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5948
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5949
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5950
|
|
|
|
|
|
|
} |
5951
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
5952
|
|
|
|
|
|
|
} |
5953
|
|
|
|
|
|
|
|
5954
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
5955
|
|
|
|
|
|
|
|
5956
|
|
|
|
|
|
|
|
5957
|
|
|
|
|
|
|
sub users_create { |
5958
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5959
|
0
|
|
|
|
|
|
my (%params) = @_; |
5960
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
5961
|
0
|
|
|
|
|
|
my $url = "/users"; |
5962
|
|
|
|
|
|
|
|
5963
|
0
|
|
|
|
|
|
my $args = { |
5964
|
|
|
|
|
|
|
"JSON body" => { |
5965
|
|
|
|
|
|
|
description => "", |
5966
|
|
|
|
|
|
|
name => "JSON body", |
5967
|
|
|
|
|
|
|
paramType => "body", |
5968
|
|
|
|
|
|
|
required => 1, |
5969
|
|
|
|
|
|
|
type => "String" |
5970
|
|
|
|
|
|
|
} |
5971
|
|
|
|
|
|
|
}; |
5972
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
5973
|
|
|
|
|
|
|
|
5974
|
|
|
|
|
|
|
# check if the parameters exist if needed |
5975
|
0
|
0
|
0
|
|
|
|
die "users_create is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
5976
|
|
|
|
|
|
|
|
5977
|
|
|
|
|
|
|
# validate the type of the parameter |
5978
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
5979
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to users_create ($err)" if ($err); |
5980
|
|
|
|
|
|
|
|
5981
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
5982
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
5983
|
0
|
|
|
|
|
|
next; |
5984
|
|
|
|
|
|
|
} |
5985
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
5986
|
0
|
0
|
|
|
|
|
die "body has already been defined in users_create for $args->{$a}->{name}" if ($body); |
5987
|
0
|
|
|
|
|
|
$body = $params{$a}; |
5988
|
|
|
|
|
|
|
} |
5989
|
|
|
|
|
|
|
else { |
5990
|
|
|
|
|
|
|
# we only want to send data that is allowed |
5991
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
5992
|
|
|
|
|
|
|
} |
5993
|
|
|
|
|
|
|
} |
5994
|
|
|
|
|
|
|
|
5995
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
5996
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
5997
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
5998
|
|
|
|
|
|
|
} |
5999
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
6000
|
|
|
|
|
|
|
} |
6001
|
|
|
|
|
|
|
|
6002
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
6003
|
|
|
|
|
|
|
|
6004
|
|
|
|
|
|
|
|
6005
|
|
|
|
|
|
|
sub users_change_user { |
6006
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
6007
|
0
|
|
|
|
|
|
my (%params) = @_; |
6008
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
6009
|
0
|
|
|
|
|
|
my $url = "/users/$params{username}"; |
6010
|
|
|
|
|
|
|
|
6011
|
0
|
|
|
|
|
|
my $args = { |
6012
|
|
|
|
|
|
|
username => { |
6013
|
|
|
|
|
|
|
description => "The name of the user to modify.", |
6014
|
|
|
|
|
|
|
name => "username", |
6015
|
|
|
|
|
|
|
paramType => "path", |
6016
|
|
|
|
|
|
|
required => 1, |
6017
|
|
|
|
|
|
|
type => "String" |
6018
|
|
|
|
|
|
|
} |
6019
|
|
|
|
|
|
|
}; |
6020
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
6021
|
|
|
|
|
|
|
|
6022
|
|
|
|
|
|
|
# check if the parameters exist if needed |
6023
|
0
|
0
|
0
|
|
|
|
die "users_change_user is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
6024
|
|
|
|
|
|
|
|
6025
|
|
|
|
|
|
|
# validate the type of the parameter |
6026
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
6027
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to users_change_user ($err)" if ($err); |
6028
|
|
|
|
|
|
|
|
6029
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
6030
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
6031
|
0
|
|
|
|
|
|
next; |
6032
|
|
|
|
|
|
|
} |
6033
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
6034
|
0
|
0
|
|
|
|
|
die "body has already been defined in users_change_user for $args->{$a}->{name}" if ($body); |
6035
|
0
|
|
|
|
|
|
$body = $params{$a}; |
6036
|
|
|
|
|
|
|
} |
6037
|
|
|
|
|
|
|
else { |
6038
|
|
|
|
|
|
|
# we only want to send data that is allowed |
6039
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
6040
|
|
|
|
|
|
|
} |
6041
|
|
|
|
|
|
|
} |
6042
|
|
|
|
|
|
|
|
6043
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
6044
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
6045
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
6046
|
|
|
|
|
|
|
} |
6047
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
6048
|
|
|
|
|
|
|
} |
6049
|
|
|
|
|
|
|
|
6050
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
6051
|
|
|
|
|
|
|
|
6052
|
|
|
|
|
|
|
|
6053
|
|
|
|
|
|
|
sub users_delete_user { |
6054
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
6055
|
0
|
|
|
|
|
|
my (%params) = @_; |
6056
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
6057
|
0
|
|
|
|
|
|
my $url = "/users/$params{username}"; |
6058
|
|
|
|
|
|
|
|
6059
|
0
|
|
|
|
|
|
my $args = { |
6060
|
|
|
|
|
|
|
username => { |
6061
|
|
|
|
|
|
|
description => "The name of the user to delete.", |
6062
|
|
|
|
|
|
|
name => "username", |
6063
|
|
|
|
|
|
|
paramType => "path", |
6064
|
|
|
|
|
|
|
required => 1, |
6065
|
|
|
|
|
|
|
type => "String" |
6066
|
|
|
|
|
|
|
} |
6067
|
|
|
|
|
|
|
}; |
6068
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
6069
|
|
|
|
|
|
|
|
6070
|
|
|
|
|
|
|
# check if the parameters exist if needed |
6071
|
0
|
0
|
0
|
|
|
|
die "users_delete_user is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
6072
|
|
|
|
|
|
|
|
6073
|
|
|
|
|
|
|
# validate the type of the parameter |
6074
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
6075
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to users_delete_user ($err)" if ($err); |
6076
|
|
|
|
|
|
|
|
6077
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
6078
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
6079
|
0
|
|
|
|
|
|
next; |
6080
|
|
|
|
|
|
|
} |
6081
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
6082
|
0
|
0
|
|
|
|
|
die "body has already been defined in users_delete_user for $args->{$a}->{name}" if ($body); |
6083
|
0
|
|
|
|
|
|
$body = $params{$a}; |
6084
|
|
|
|
|
|
|
} |
6085
|
|
|
|
|
|
|
else { |
6086
|
|
|
|
|
|
|
# we only want to send data that is allowed |
6087
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
6088
|
|
|
|
|
|
|
} |
6089
|
|
|
|
|
|
|
} |
6090
|
|
|
|
|
|
|
|
6091
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
6092
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
6093
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
6094
|
|
|
|
|
|
|
} |
6095
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
6096
|
|
|
|
|
|
|
} |
6097
|
|
|
|
|
|
|
|
6098
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
6099
|
|
|
|
|
|
|
|
6100
|
|
|
|
|
|
|
|
6101
|
|
|
|
|
|
|
sub users_get { |
6102
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
6103
|
0
|
|
|
|
|
|
my (%params) = @_; |
6104
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
6105
|
0
|
|
|
|
|
|
my $url = "/users/$params{username}"; |
6106
|
|
|
|
|
|
|
|
6107
|
0
|
|
|
|
|
|
my $args = { |
6108
|
|
|
|
|
|
|
username => { |
6109
|
|
|
|
|
|
|
description => "The username to return information for.", |
6110
|
|
|
|
|
|
|
name => "username", |
6111
|
|
|
|
|
|
|
paramType => "path", |
6112
|
|
|
|
|
|
|
required => 1, |
6113
|
|
|
|
|
|
|
type => "String" |
6114
|
|
|
|
|
|
|
} |
6115
|
|
|
|
|
|
|
}; |
6116
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
6117
|
|
|
|
|
|
|
|
6118
|
|
|
|
|
|
|
# check if the parameters exist if needed |
6119
|
0
|
0
|
0
|
|
|
|
die "users_get is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
6120
|
|
|
|
|
|
|
|
6121
|
|
|
|
|
|
|
# validate the type of the parameter |
6122
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
6123
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to users_get ($err)" if ($err); |
6124
|
|
|
|
|
|
|
|
6125
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
6126
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
6127
|
0
|
|
|
|
|
|
next; |
6128
|
|
|
|
|
|
|
} |
6129
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
6130
|
0
|
0
|
|
|
|
|
die "body has already been defined in users_get for $args->{$a}->{name}" if ($body); |
6131
|
0
|
|
|
|
|
|
$body = $params{$a}; |
6132
|
|
|
|
|
|
|
} |
6133
|
|
|
|
|
|
|
else { |
6134
|
|
|
|
|
|
|
# we only want to send data that is allowed |
6135
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
6136
|
|
|
|
|
|
|
} |
6137
|
|
|
|
|
|
|
} |
6138
|
|
|
|
|
|
|
|
6139
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
6140
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
6141
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
6142
|
|
|
|
|
|
|
} |
6143
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
6144
|
|
|
|
|
|
|
} |
6145
|
|
|
|
|
|
|
|
6146
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
6147
|
|
|
|
|
|
|
|
6148
|
|
|
|
|
|
|
|
6149
|
|
|
|
|
|
|
sub users_change_password { |
6150
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
6151
|
0
|
|
|
|
|
|
my (%params) = @_; |
6152
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
6153
|
0
|
|
|
|
|
|
my $url = "/users/$params{username}/password"; |
6154
|
|
|
|
|
|
|
|
6155
|
0
|
|
|
|
|
|
my $args = { |
6156
|
|
|
|
|
|
|
"JSON body" => { |
6157
|
|
|
|
|
|
|
description => "The hashed old and new passwords.", |
6158
|
|
|
|
|
|
|
name => "JSON body", |
6159
|
|
|
|
|
|
|
paramType => "body", |
6160
|
|
|
|
|
|
|
required => 1, |
6161
|
|
|
|
|
|
|
type => "String" |
6162
|
|
|
|
|
|
|
}, |
6163
|
|
|
|
|
|
|
username => { |
6164
|
|
|
|
|
|
|
description => "The name of the user whose password to change.", |
6165
|
|
|
|
|
|
|
name => "username", |
6166
|
|
|
|
|
|
|
paramType => "path", |
6167
|
|
|
|
|
|
|
required => 1, |
6168
|
|
|
|
|
|
|
type => "String" |
6169
|
|
|
|
|
|
|
} |
6170
|
|
|
|
|
|
|
}; |
6171
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
6172
|
|
|
|
|
|
|
|
6173
|
|
|
|
|
|
|
# check if the parameters exist if needed |
6174
|
0
|
0
|
0
|
|
|
|
die "users_change_password is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
6175
|
|
|
|
|
|
|
|
6176
|
|
|
|
|
|
|
# validate the type of the parameter |
6177
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
6178
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to users_change_password ($err)" if ($err); |
6179
|
|
|
|
|
|
|
|
6180
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
6181
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
6182
|
0
|
|
|
|
|
|
next; |
6183
|
|
|
|
|
|
|
} |
6184
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
6185
|
0
|
0
|
|
|
|
|
die "body has already been defined in users_change_password for $args->{$a}->{name}" if ($body); |
6186
|
0
|
|
|
|
|
|
$body = $params{$a}; |
6187
|
|
|
|
|
|
|
} |
6188
|
|
|
|
|
|
|
else { |
6189
|
|
|
|
|
|
|
# we only want to send data that is allowed |
6190
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
6191
|
|
|
|
|
|
|
} |
6192
|
|
|
|
|
|
|
} |
6193
|
|
|
|
|
|
|
|
6194
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
6195
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
6196
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
6197
|
|
|
|
|
|
|
} |
6198
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
6199
|
|
|
|
|
|
|
} |
6200
|
|
|
|
|
|
|
|
6201
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
6202
|
|
|
|
|
|
|
|
6203
|
|
|
|
|
|
|
|
6204
|
|
|
|
|
|
|
sub users_edit_permissions { |
6205
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
6206
|
0
|
|
|
|
|
|
my (%params) = @_; |
6207
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
6208
|
0
|
|
|
|
|
|
my $url = "/users/$params{username}/permissions"; |
6209
|
|
|
|
|
|
|
|
6210
|
0
|
|
|
|
|
|
my $args = { |
6211
|
|
|
|
|
|
|
"JSON body" => { |
6212
|
|
|
|
|
|
|
description => "The list of permissions to assign to the user.", |
6213
|
|
|
|
|
|
|
name => "JSON body", |
6214
|
|
|
|
|
|
|
paramType => "body", |
6215
|
|
|
|
|
|
|
required => 1, |
6216
|
|
|
|
|
|
|
type => "String" |
6217
|
|
|
|
|
|
|
}, |
6218
|
|
|
|
|
|
|
username => { |
6219
|
|
|
|
|
|
|
description => "The name of the user to modify.", |
6220
|
|
|
|
|
|
|
name => "username", |
6221
|
|
|
|
|
|
|
paramType => "path", |
6222
|
|
|
|
|
|
|
required => 1, |
6223
|
|
|
|
|
|
|
type => "String" |
6224
|
|
|
|
|
|
|
} |
6225
|
|
|
|
|
|
|
}; |
6226
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
6227
|
|
|
|
|
|
|
|
6228
|
|
|
|
|
|
|
# check if the parameters exist if needed |
6229
|
0
|
0
|
0
|
|
|
|
die "users_edit_permissions is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
6230
|
|
|
|
|
|
|
|
6231
|
|
|
|
|
|
|
# validate the type of the parameter |
6232
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
6233
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to users_edit_permissions ($err)" if ($err); |
6234
|
|
|
|
|
|
|
|
6235
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
6236
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
6237
|
0
|
|
|
|
|
|
next; |
6238
|
|
|
|
|
|
|
} |
6239
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
6240
|
0
|
0
|
|
|
|
|
die "body has already been defined in users_edit_permissions for $args->{$a}->{name}" if ($body); |
6241
|
0
|
|
|
|
|
|
$body = $params{$a}; |
6242
|
|
|
|
|
|
|
} |
6243
|
|
|
|
|
|
|
else { |
6244
|
|
|
|
|
|
|
# we only want to send data that is allowed |
6245
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
6246
|
|
|
|
|
|
|
} |
6247
|
|
|
|
|
|
|
} |
6248
|
|
|
|
|
|
|
|
6249
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
6250
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
6251
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
6252
|
|
|
|
|
|
|
} |
6253
|
0
|
|
|
|
|
|
return $self->_action_url( 'put', $url, \%clean_data, $body ); |
6254
|
|
|
|
|
|
|
} |
6255
|
|
|
|
|
|
|
|
6256
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
6257
|
|
|
|
|
|
|
|
6258
|
|
|
|
|
|
|
|
6259
|
|
|
|
|
|
|
sub users_delete_permissions { |
6260
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
6261
|
0
|
|
|
|
|
|
my (%params) = @_; |
6262
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
6263
|
0
|
|
|
|
|
|
my $url = "/users/$params{username}/permissions"; |
6264
|
|
|
|
|
|
|
|
6265
|
0
|
|
|
|
|
|
my $args = { |
6266
|
|
|
|
|
|
|
username => { |
6267
|
|
|
|
|
|
|
description => "The name of the user to modify.", |
6268
|
|
|
|
|
|
|
name => "username", |
6269
|
|
|
|
|
|
|
paramType => "path", |
6270
|
|
|
|
|
|
|
required => 1, |
6271
|
|
|
|
|
|
|
type => "String" |
6272
|
|
|
|
|
|
|
} |
6273
|
|
|
|
|
|
|
}; |
6274
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
6275
|
|
|
|
|
|
|
|
6276
|
|
|
|
|
|
|
# check if the parameters exist if needed |
6277
|
0
|
0
|
0
|
|
|
|
die "users_delete_permissions is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
6278
|
|
|
|
|
|
|
|
6279
|
|
|
|
|
|
|
# validate the type of the parameter |
6280
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
6281
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to users_delete_permissions ($err)" if ($err); |
6282
|
|
|
|
|
|
|
|
6283
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
6284
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
6285
|
0
|
|
|
|
|
|
next; |
6286
|
|
|
|
|
|
|
} |
6287
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
6288
|
0
|
0
|
|
|
|
|
die "body has already been defined in users_delete_permissions for $args->{$a}->{name}" if ($body); |
6289
|
0
|
|
|
|
|
|
$body = $params{$a}; |
6290
|
|
|
|
|
|
|
} |
6291
|
|
|
|
|
|
|
else { |
6292
|
|
|
|
|
|
|
# we only want to send data that is allowed |
6293
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
6294
|
|
|
|
|
|
|
} |
6295
|
|
|
|
|
|
|
} |
6296
|
|
|
|
|
|
|
|
6297
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
6298
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
6299
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
6300
|
|
|
|
|
|
|
} |
6301
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
6302
|
|
|
|
|
|
|
} |
6303
|
|
|
|
|
|
|
|
6304
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
6305
|
|
|
|
|
|
|
|
6306
|
|
|
|
|
|
|
|
6307
|
|
|
|
|
|
|
sub users_list_tokens { |
6308
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
6309
|
0
|
|
|
|
|
|
my (%params) = @_; |
6310
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
6311
|
0
|
|
|
|
|
|
my $url = "/users/$params{username}/tokens"; |
6312
|
|
|
|
|
|
|
|
6313
|
0
|
|
|
|
|
|
my $args = { |
6314
|
|
|
|
|
|
|
username => { |
6315
|
|
|
|
|
|
|
description => "", |
6316
|
|
|
|
|
|
|
name => "username", |
6317
|
|
|
|
|
|
|
paramType => "path", |
6318
|
|
|
|
|
|
|
required => 1, |
6319
|
|
|
|
|
|
|
type => "String" |
6320
|
|
|
|
|
|
|
} |
6321
|
|
|
|
|
|
|
}; |
6322
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
6323
|
|
|
|
|
|
|
|
6324
|
|
|
|
|
|
|
# check if the parameters exist if needed |
6325
|
0
|
0
|
0
|
|
|
|
die "users_list_tokens is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
6326
|
|
|
|
|
|
|
|
6327
|
|
|
|
|
|
|
# validate the type of the parameter |
6328
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
6329
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to users_list_tokens ($err)" if ($err); |
6330
|
|
|
|
|
|
|
|
6331
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
6332
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
6333
|
0
|
|
|
|
|
|
next; |
6334
|
|
|
|
|
|
|
} |
6335
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
6336
|
0
|
0
|
|
|
|
|
die "body has already been defined in users_list_tokens for $args->{$a}->{name}" if ($body); |
6337
|
0
|
|
|
|
|
|
$body = $params{$a}; |
6338
|
|
|
|
|
|
|
} |
6339
|
|
|
|
|
|
|
else { |
6340
|
|
|
|
|
|
|
# we only want to send data that is allowed |
6341
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
6342
|
|
|
|
|
|
|
} |
6343
|
|
|
|
|
|
|
} |
6344
|
|
|
|
|
|
|
|
6345
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
6346
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
6347
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
6348
|
|
|
|
|
|
|
} |
6349
|
0
|
|
|
|
|
|
return $self->_action_url( 'get', $url, \%clean_data, $body ); |
6350
|
|
|
|
|
|
|
} |
6351
|
|
|
|
|
|
|
|
6352
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
6353
|
|
|
|
|
|
|
|
6354
|
|
|
|
|
|
|
|
6355
|
|
|
|
|
|
|
sub users_generate_new_token { |
6356
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
6357
|
0
|
|
|
|
|
|
my (%params) = @_; |
6358
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
6359
|
0
|
|
|
|
|
|
my $url = "/users/$params{username}/tokens/$params{name}"; |
6360
|
|
|
|
|
|
|
|
6361
|
0
|
|
|
|
|
|
my $args = { |
6362
|
|
|
|
|
|
|
name => { |
6363
|
|
|
|
|
|
|
description => "Descriptive name for this token (e.g. 'cronjob') ", |
6364
|
|
|
|
|
|
|
name => "name", |
6365
|
|
|
|
|
|
|
paramType => "path", |
6366
|
|
|
|
|
|
|
required => 1, |
6367
|
|
|
|
|
|
|
type => "String" |
6368
|
|
|
|
|
|
|
}, |
6369
|
|
|
|
|
|
|
username => { |
6370
|
|
|
|
|
|
|
description => "", |
6371
|
|
|
|
|
|
|
name => "username", |
6372
|
|
|
|
|
|
|
paramType => "path", |
6373
|
|
|
|
|
|
|
required => 1, |
6374
|
|
|
|
|
|
|
type => "String" |
6375
|
|
|
|
|
|
|
} |
6376
|
|
|
|
|
|
|
}; |
6377
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
6378
|
|
|
|
|
|
|
|
6379
|
|
|
|
|
|
|
# check if the parameters exist if needed |
6380
|
0
|
0
|
0
|
|
|
|
die "users_generate_new_token is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
6381
|
|
|
|
|
|
|
|
6382
|
|
|
|
|
|
|
# validate the type of the parameter |
6383
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
6384
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to users_generate_new_token ($err)" if ($err); |
6385
|
|
|
|
|
|
|
|
6386
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
6387
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
6388
|
0
|
|
|
|
|
|
next; |
6389
|
|
|
|
|
|
|
} |
6390
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
6391
|
0
|
0
|
|
|
|
|
die "body has already been defined in users_generate_new_token for $args->{$a}->{name}" if ($body); |
6392
|
0
|
|
|
|
|
|
$body = $params{$a}; |
6393
|
|
|
|
|
|
|
} |
6394
|
|
|
|
|
|
|
else { |
6395
|
|
|
|
|
|
|
# we only want to send data that is allowed |
6396
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
6397
|
|
|
|
|
|
|
} |
6398
|
|
|
|
|
|
|
} |
6399
|
|
|
|
|
|
|
|
6400
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
6401
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
6402
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
6403
|
|
|
|
|
|
|
} |
6404
|
0
|
|
|
|
|
|
return $self->_action_url( 'post', $url, \%clean_data, $body ); |
6405
|
|
|
|
|
|
|
} |
6406
|
|
|
|
|
|
|
|
6407
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
6408
|
|
|
|
|
|
|
|
6409
|
|
|
|
|
|
|
|
6410
|
|
|
|
|
|
|
sub users_revoke_token { |
6411
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
6412
|
0
|
|
|
|
|
|
my (%params) = @_; |
6413
|
0
|
|
|
|
|
|
my ( %clean_data, $body ); |
6414
|
0
|
|
|
|
|
|
my $url = "/users/$params{username}/tokens/$params{token}"; |
6415
|
|
|
|
|
|
|
|
6416
|
0
|
|
|
|
|
|
my $args = { |
6417
|
|
|
|
|
|
|
"access token" => { |
6418
|
|
|
|
|
|
|
description => "", |
6419
|
|
|
|
|
|
|
name => "access token", |
6420
|
|
|
|
|
|
|
paramType => "path", |
6421
|
|
|
|
|
|
|
required => 1, |
6422
|
|
|
|
|
|
|
type => "String" |
6423
|
|
|
|
|
|
|
}, |
6424
|
|
|
|
|
|
|
username => { |
6425
|
|
|
|
|
|
|
description => "", |
6426
|
|
|
|
|
|
|
name => "username", |
6427
|
|
|
|
|
|
|
paramType => "path", |
6428
|
|
|
|
|
|
|
required => 1, |
6429
|
|
|
|
|
|
|
type => "String" |
6430
|
|
|
|
|
|
|
} |
6431
|
|
|
|
|
|
|
}; |
6432
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$args} ) { |
|
0
|
|
|
|
|
|
|
6433
|
|
|
|
|
|
|
|
6434
|
|
|
|
|
|
|
# check if the parameters exist if needed |
6435
|
0
|
0
|
0
|
|
|
|
die "users_revoke_token is missing required parameter $a" if ( $args->{$a}->{required} && !$params{$a} ); |
6436
|
|
|
|
|
|
|
|
6437
|
|
|
|
|
|
|
# validate the type of the parameter |
6438
|
0
|
|
|
|
|
|
my $err = _validate_parameter( $params{$a}, $args->{$a} ); |
6439
|
0
|
0
|
|
|
|
|
die "Bad argument $params{$a} to users_revoke_token ($err)" if ($err); |
6440
|
|
|
|
|
|
|
|
6441
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'path' ) { |
6442
|
0
|
|
|
|
|
|
$url =~ s/\$params\{$a\}/$params{$a}/; |
6443
|
0
|
|
|
|
|
|
next; |
6444
|
|
|
|
|
|
|
} |
6445
|
0
|
0
|
|
|
|
|
if ( $args->{$a}->{paramType} eq 'body' ) { |
6446
|
0
|
0
|
|
|
|
|
die "body has already been defined in users_revoke_token for $args->{$a}->{name}" if ($body); |
6447
|
0
|
|
|
|
|
|
$body = $params{$a}; |
6448
|
|
|
|
|
|
|
} |
6449
|
|
|
|
|
|
|
else { |
6450
|
|
|
|
|
|
|
# we only want to send data that is allowed |
6451
|
0
|
0
|
|
|
|
|
$clean_data{$a} = $params{$a} if ( defined $params{$a} ); |
6452
|
|
|
|
|
|
|
} |
6453
|
|
|
|
|
|
|
} |
6454
|
|
|
|
|
|
|
|
6455
|
|
|
|
|
|
|
# if the body data does not look right, then convert it to JSON |
6456
|
0
|
0
|
|
|
|
|
if ( ref($body) ne 'SCALAR' ) { |
6457
|
0
|
0
|
|
|
|
|
$body = to_json($body) if ($body); |
6458
|
|
|
|
|
|
|
} |
6459
|
0
|
|
|
|
|
|
return $self->_action_url( 'delete', $url, \%clean_data, $body ); |
6460
|
|
|
|
|
|
|
} |
6461
|
|
|
|
|
|
|
|
6462
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
6463
|
|
|
|
|
|
|
1; |
6464
|
|
|
|
|
|
|
|
6465
|
|
|
|
|
|
|
__END__ |