Fastly/ConfigStoreItemApi.pm untested

filter: Statementstmt 0.0% 0 / 268 Branchbran 0.0% 0 / 88 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 17 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 390 CC 45 SCAR 39.7
CC
45
Cov
0%
update_config_store_item
90.0
upsert_config_store_item
90.0
create_config_store_item
56.0
CRAP 52.9
1 =begin comment
2  
3 Fastly API
4  
5 Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
6  
7 The version of the API Spec document: 1.0.0
8 Contact: oss@fastly.com
9  
10 =end comment
11  
12 =cut
13  
14 #
15 # NOTE: This class is auto generated.
16 # Do not edit the class manually.
17 #
18 package WebService::Fastly::ConfigStoreItemApi;
19  
20 require 5.6.0;
21 use strict;
22 use warnings;
23 use utf8;
24 use Exporter;
25 use Carp qw( croak );
26 use Log::Any qw($log);
27  
28 use WebService::Fastly::ApiClient;
29  
30 use base "Class::Data::Inheritable";
31  
32 __PACKAGE__->mk_classdata('method_documentation' => {});
33  
34 sub new {
35 my $class = shift;
36 my $api_client;
37  
38 if ($_[0] && ref $_[0] && ref $_[0] eq 'WebService::Fastly::ApiClient' ) {
39 $api_client = $_[0];
40 } else {
41 $api_client = WebService::Fastly::ApiClient->new(@_);
42 }
43  
44 bless { api_client => $api_client }, $class;
45  
46 }
47  
48  
49 #
50 # bulk_update_config_store_item
51 #
52 # Update multiple entries in a config store
53 #
54 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
55 # @param BulkUpdateConfigStoreListRequest $bulk_update_config_store_list_request (optional)
56 {
57 my $params = {
58 'config_store_id' => {
59 data_type => 'string',
60 description => 'An alphanumeric string identifying the config store.',
61 required => '1',
62 },
63 'bulk_update_config_store_list_request' => {
64 data_type => 'BulkUpdateConfigStoreListRequest',
65 description => '',
66 required => '0',
67 },
68 };
69 __PACKAGE__->method_documentation->{ 'bulk_update_config_store_item' } = {
70 summary => 'Update multiple entries in a config store',
71 params => $params,
72 returns => 'InlineResponse200',
73 };
74 }
75 # @return InlineResponse200
76 #
77 sub bulk_update_config_store_item {
78 my ($self, %args) = @_;
79  
80 # verify the required parameter 'config_store_id' is set
81 unless (exists $args{'config_store_id'}) {
82 croak("Missing the required parameter 'config_store_id' when calling bulk_update_config_store_item");
83 }
84  
85 # parse inputs
86 my $_resource_path = '/resources/stores/config/{config_store_id}/items';
87  
88 my $_method = 'PATCH';
89 my $query_params = {};
90 my $header_params = {};
91 my $form_params = {};
92  
93 # 'Accept' and 'Content-Type' header
94 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
95 if ($_header_accept) {
96 $header_params->{'Accept'} = $_header_accept;
97 }
98 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
99  
100 # path params
101 if ( exists $args{'config_store_id'}) {
102 my $_base_variable = "{" . "config_store_id" . "}";
103 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
104 $_resource_path =~ s/$_base_variable/$_base_value/g;
105 }
106  
107 my $_body_data;
108 # body params
109 if ( exists $args{'bulk_update_config_store_list_request'}) {
110 $_body_data = $args{'bulk_update_config_store_list_request'};
111 }
112  
113 # authentication setting, if any
114 my $auth_settings = [qw(token )];
115  
116 # make the API Call
117 my $response = $self->{api_client}->call_api($_resource_path, $_method,
118 $query_params, $form_params,
119 $header_params, $_body_data, $auth_settings);
120 if (!$response) {
121 return;
122 }
123 my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
124 return $_response_object;
125 }
126  
127 #
128 # create_config_store_item
129 #
130 # Create an entry in a config store
131 #
132 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
133 # @param string $item_key Item key, maximum 256 characters. (optional)
134 # @param string $item_value Item value, maximum 8000 characters. (optional)
135 {
136 my $params = {
137 'config_store_id' => {
138 data_type => 'string',
139 description => 'An alphanumeric string identifying the config store.',
140 required => '1',
141 },
142 'item_key' => {
143 data_type => 'string',
144 description => 'Item key, maximum 256 characters.',
145 required => '0',
146 },
147 'item_value' => {
148 data_type => 'string',
149 description => 'Item value, maximum 8000 characters.',
150 required => '0',
151 },
152 };
153 __PACKAGE__->method_documentation->{ 'create_config_store_item' } = {
154 summary => 'Create an entry in a config store',
155 params => $params,
156 returns => 'ConfigStoreItemResponse',
157 };
158 }
159 # @return ConfigStoreItemResponse
160 #
161 sub create_config_store_item {
162 my ($self, %args) = @_;
163  
164 # verify the required parameter 'config_store_id' is set
165 unless (exists $args{'config_store_id'}) {
166 croak("Missing the required parameter 'config_store_id' when calling create_config_store_item");
167 }
168  
169 # parse inputs
170 my $_resource_path = '/resources/stores/config/{config_store_id}/item';
171  
172 my $_method = 'POST';
173 my $query_params = {};
174 my $header_params = {};
175 my $form_params = {};
176  
177 # 'Accept' and 'Content-Type' header
178 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
179 if ($_header_accept) {
180 $header_params->{'Accept'} = $_header_accept;
181 }
182 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
183  
184 # path params
185 if ( exists $args{'config_store_id'}) {
186 my $_base_variable = "{" . "config_store_id" . "}";
187 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
188 $_resource_path =~ s/$_base_variable/$_base_value/g;
189 }
190  
191 # form params
192 if ( exists $args{'item_key'} ) {
193 $form_params->{'item_key'} = $self->{api_client}->to_form_value($args{'item_key'});
194 }
195  
196 # form params
197 if ( exists $args{'item_value'} ) {
198 $form_params->{'item_value'} = $self->{api_client}->to_form_value($args{'item_value'});
199 }
200  
201 my $_body_data;
202 # authentication setting, if any
203 my $auth_settings = [qw(token )];
204  
205 # make the API Call
206 my $response = $self->{api_client}->call_api($_resource_path, $_method,
207 $query_params, $form_params,
208 $header_params, $_body_data, $auth_settings);
209 if (!$response) {
210 return;
211 }
212 my $_response_object = $self->{api_client}->deserialize('ConfigStoreItemResponse', $response);
213 return $_response_object;
214 }
215  
216 #
217 # delete_config_store_item
218 #
219 # Delete an item from a config store
220 #
221 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
222 # @param string $config_store_item_key Item key, maximum 256 characters. (required)
223 {
224 my $params = {
225 'config_store_id' => {
226 data_type => 'string',
227 description => 'An alphanumeric string identifying the config store.',
228 required => '1',
229 },
230 'config_store_item_key' => {
231 data_type => 'string',
232 description => 'Item key, maximum 256 characters.',
233 required => '1',
234 },
235 };
236 __PACKAGE__->method_documentation->{ 'delete_config_store_item' } = {
237 summary => 'Delete an item from a config store',
238 params => $params,
239 returns => 'InlineResponse200',
240 };
241 }
242 # @return InlineResponse200
243 #
244 sub delete_config_store_item {
245 my ($self, %args) = @_;
246  
247 # verify the required parameter 'config_store_id' is set
248 unless (exists $args{'config_store_id'}) {
249 croak("Missing the required parameter 'config_store_id' when calling delete_config_store_item");
250 }
251  
252 # verify the required parameter 'config_store_item_key' is set
253 unless (exists $args{'config_store_item_key'}) {
254 croak("Missing the required parameter 'config_store_item_key' when calling delete_config_store_item");
255 }
256  
257 # parse inputs
258 my $_resource_path = '/resources/stores/config/{config_store_id}/item/{config_store_item_key}';
259  
260 my $_method = 'DELETE';
261 my $query_params = {};
262 my $header_params = {};
263 my $form_params = {};
264  
265 # 'Accept' and 'Content-Type' header
266 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
267 if ($_header_accept) {
268 $header_params->{'Accept'} = $_header_accept;
269 }
270 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
271  
272 # path params
273 if ( exists $args{'config_store_id'}) {
274 my $_base_variable = "{" . "config_store_id" . "}";
275 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
276 $_resource_path =~ s/$_base_variable/$_base_value/g;
277 }
278  
279 # path params
280 if ( exists $args{'config_store_item_key'}) {
281 my $_base_variable = "{" . "config_store_item_key" . "}";
282 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_item_key'});
283 $_resource_path =~ s/$_base_variable/$_base_value/g;
284 }
285  
286 my $_body_data;
287 # authentication setting, if any
288 my $auth_settings = [qw(token )];
289  
290 # make the API Call
291 my $response = $self->{api_client}->call_api($_resource_path, $_method,
292 $query_params, $form_params,
293 $header_params, $_body_data, $auth_settings);
294 if (!$response) {
295 return;
296 }
297 my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
298 return $_response_object;
299 }
300  
301 #
302 # get_config_store_item
303 #
304 # Get an item from a config store
305 #
306 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
307 # @param string $config_store_item_key Item key, maximum 256 characters. (required)
308 {
309 my $params = {
310 'config_store_id' => {
311 data_type => 'string',
312 description => 'An alphanumeric string identifying the config store.',
313 required => '1',
314 },
315 'config_store_item_key' => {
316 data_type => 'string',
317 description => 'Item key, maximum 256 characters.',
318 required => '1',
319 },
320 };
321 __PACKAGE__->method_documentation->{ 'get_config_store_item' } = {
322 summary => 'Get an item from a config store',
323 params => $params,
324 returns => 'ConfigStoreItemResponse',
325 };
326 }
327 # @return ConfigStoreItemResponse
328 #
329 sub get_config_store_item {
330 my ($self, %args) = @_;
331  
332 # verify the required parameter 'config_store_id' is set
333 unless (exists $args{'config_store_id'}) {
334 croak("Missing the required parameter 'config_store_id' when calling get_config_store_item");
335 }
336  
337 # verify the required parameter 'config_store_item_key' is set
338 unless (exists $args{'config_store_item_key'}) {
339 croak("Missing the required parameter 'config_store_item_key' when calling get_config_store_item");
340 }
341  
342 # parse inputs
343 my $_resource_path = '/resources/stores/config/{config_store_id}/item/{config_store_item_key}';
344  
345 my $_method = 'GET';
346 my $query_params = {};
347 my $header_params = {};
348 my $form_params = {};
349  
350 # 'Accept' and 'Content-Type' header
351 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
352 if ($_header_accept) {
353 $header_params->{'Accept'} = $_header_accept;
354 }
355 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
356  
357 # path params
358 if ( exists $args{'config_store_id'}) {
359 my $_base_variable = "{" . "config_store_id" . "}";
360 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
361 $_resource_path =~ s/$_base_variable/$_base_value/g;
362 }
363  
364 # path params
365 if ( exists $args{'config_store_item_key'}) {
366 my $_base_variable = "{" . "config_store_item_key" . "}";
367 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_item_key'});
368 $_resource_path =~ s/$_base_variable/$_base_value/g;
369 }
370  
371 my $_body_data;
372 # authentication setting, if any
373 my $auth_settings = [qw(token )];
374  
375 # make the API Call
376 my $response = $self->{api_client}->call_api($_resource_path, $_method,
377 $query_params, $form_params,
378 $header_params, $_body_data, $auth_settings);
379 if (!$response) {
380 return;
381 }
382 my $_response_object = $self->{api_client}->deserialize('ConfigStoreItemResponse', $response);
383 return $_response_object;
384 }
385  
386 #
387 # list_config_store_items
388 #
389 # List items in a config store
390 #
391 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
392 {
393 my $params = {
394 'config_store_id' => {
395 data_type => 'string',
396 description => 'An alphanumeric string identifying the config store.',
397 required => '1',
398 },
399 };
400 __PACKAGE__->method_documentation->{ 'list_config_store_items' } = {
401 summary => 'List items in a config store',
402 params => $params,
403 returns => 'ARRAY[ConfigStoreItemResponse]',
404 };
405 }
406 # @return ARRAY[ConfigStoreItemResponse]
407 #
408 sub list_config_store_items {
409 my ($self, %args) = @_;
410  
411 # verify the required parameter 'config_store_id' is set
412 unless (exists $args{'config_store_id'}) {
413 croak("Missing the required parameter 'config_store_id' when calling list_config_store_items");
414 }
415  
416 # parse inputs
417 my $_resource_path = '/resources/stores/config/{config_store_id}/items';
418  
419 my $_method = 'GET';
420 my $query_params = {};
421 my $header_params = {};
422 my $form_params = {};
423  
424 # 'Accept' and 'Content-Type' header
425 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
426 if ($_header_accept) {
427 $header_params->{'Accept'} = $_header_accept;
428 }
429 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
430  
431 # path params
432 if ( exists $args{'config_store_id'}) {
433 my $_base_variable = "{" . "config_store_id" . "}";
434 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
435 $_resource_path =~ s/$_base_variable/$_base_value/g;
436 }
437  
438 my $_body_data;
439 # authentication setting, if any
440 my $auth_settings = [qw(token )];
441  
442 # make the API Call
443 my $response = $self->{api_client}->call_api($_resource_path, $_method,
444 $query_params, $form_params,
445 $header_params, $_body_data, $auth_settings);
446 if (!$response) {
447 return;
448 }
449 my $_response_object = $self->{api_client}->deserialize('ARRAY[ConfigStoreItemResponse]', $response);
450 return $_response_object;
451 }
452  
453 #
454 # update_config_store_item
455 #
456 # Update an entry in a config store
457 #
458 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
459 # @param string $config_store_item_key Item key, maximum 256 characters. (required)
460 # @param string $item_key Item key, maximum 256 characters. (optional)
461 # @param string $item_value Item value, maximum 8000 characters. (optional)
462 {
463 my $params = {
464 'config_store_id' => {
465 data_type => 'string',
466 description => 'An alphanumeric string identifying the config store.',
467 required => '1',
468 },
469 'config_store_item_key' => {
470 data_type => 'string',
471 description => 'Item key, maximum 256 characters.',
472 required => '1',
473 },
474 'item_key' => {
475 data_type => 'string',
476 description => 'Item key, maximum 256 characters.',
477 required => '0',
478 },
479 'item_value' => {
480 data_type => 'string',
481 description => 'Item value, maximum 8000 characters.',
482 required => '0',
483 },
484 };
485 __PACKAGE__->method_documentation->{ 'update_config_store_item' } = {
486 summary => 'Update an entry in a config store',
487 params => $params,
488 returns => 'ConfigStoreItemResponse',
489 };
490 }
491 # @return ConfigStoreItemResponse
492 #
493 sub update_config_store_item {
494 my ($self, %args) = @_;
495  
496 # verify the required parameter 'config_store_id' is set
497 unless (exists $args{'config_store_id'}) {
498 croak("Missing the required parameter 'config_store_id' when calling update_config_store_item");
499 }
500  
501 # verify the required parameter 'config_store_item_key' is set
502 unless (exists $args{'config_store_item_key'}) {
503 croak("Missing the required parameter 'config_store_item_key' when calling update_config_store_item");
504 }
505  
506 # parse inputs
507 my $_resource_path = '/resources/stores/config/{config_store_id}/item/{config_store_item_key}';
508  
509 my $_method = 'PATCH';
510 my $query_params = {};
511 my $header_params = {};
512 my $form_params = {};
513  
514 # 'Accept' and 'Content-Type' header
515 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
516 if ($_header_accept) {
517 $header_params->{'Accept'} = $_header_accept;
518 }
519 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
520  
521 # path params
522 if ( exists $args{'config_store_id'}) {
523 my $_base_variable = "{" . "config_store_id" . "}";
524 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
525 $_resource_path =~ s/$_base_variable/$_base_value/g;
526 }
527  
528 # path params
529 if ( exists $args{'config_store_item_key'}) {
530 my $_base_variable = "{" . "config_store_item_key" . "}";
531 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_item_key'});
532 $_resource_path =~ s/$_base_variable/$_base_value/g;
533 }
534  
535 # form params
536 if ( exists $args{'item_key'} ) {
537 $form_params->{'item_key'} = $self->{api_client}->to_form_value($args{'item_key'});
538 }
539  
540 # form params
541 if ( exists $args{'item_value'} ) {
542 $form_params->{'item_value'} = $self->{api_client}->to_form_value($args{'item_value'});
543 }
544  
545 my $_body_data;
546 # authentication setting, if any
547 my $auth_settings = [qw(token )];
548  
549 # make the API Call
550 my $response = $self->{api_client}->call_api($_resource_path, $_method,
551 $query_params, $form_params,
552 $header_params, $_body_data, $auth_settings);
553 if (!$response) {
554 return;
555 }
556 my $_response_object = $self->{api_client}->deserialize('ConfigStoreItemResponse', $response);
557 return $_response_object;
558 }
559  
560 #
561 # upsert_config_store_item
562 #
563 # Insert or update an entry in a config store
564 #
565 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
566 # @param string $config_store_item_key Item key, maximum 256 characters. (required)
567 # @param string $item_key Item key, maximum 256 characters. (optional)
568 # @param string $item_value Item value, maximum 8000 characters. (optional)
569 {
570 my $params = {
571 'config_store_id' => {
572 data_type => 'string',
573 description => 'An alphanumeric string identifying the config store.',
574 required => '1',
575 },
576 'config_store_item_key' => {
577 data_type => 'string',
578 description => 'Item key, maximum 256 characters.',
579 required => '1',
580 },
581 'item_key' => {
582 data_type => 'string',
583 description => 'Item key, maximum 256 characters.',
584 required => '0',
585 },
586 'item_value' => {
587 data_type => 'string',
588 description => 'Item value, maximum 8000 characters.',
589 required => '0',
590 },
591 };
592 __PACKAGE__->method_documentation->{ 'upsert_config_store_item' } = {
593 summary => 'Insert or update an entry in a config store',
594 params => $params,
595 returns => 'ConfigStoreItemResponse',
596 };
597 }
598 # @return ConfigStoreItemResponse
599 #
600 sub upsert_config_store_item {
601 my ($self, %args) = @_;
602  
603 # verify the required parameter 'config_store_id' is set
604 unless (exists $args{'config_store_id'}) {
605 croak("Missing the required parameter 'config_store_id' when calling upsert_config_store_item");
606 }
607  
608 # verify the required parameter 'config_store_item_key' is set
609 unless (exists $args{'config_store_item_key'}) {
610 croak("Missing the required parameter 'config_store_item_key' when calling upsert_config_store_item");
611 }
612  
613 # parse inputs
614 my $_resource_path = '/resources/stores/config/{config_store_id}/item/{config_store_item_key}';
615  
616 my $_method = 'PUT';
617 my $query_params = {};
618 my $header_params = {};
619 my $form_params = {};
620  
621 # 'Accept' and 'Content-Type' header
622 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
623 if ($_header_accept) {
624 $header_params->{'Accept'} = $_header_accept;
625 }
626 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
627  
628 # path params
629 if ( exists $args{'config_store_id'}) {
630 my $_base_variable = "{" . "config_store_id" . "}";
631 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
632 $_resource_path =~ s/$_base_variable/$_base_value/g;
633 }
634  
635 # path params
636 if ( exists $args{'config_store_item_key'}) {
637 my $_base_variable = "{" . "config_store_item_key" . "}";
638 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_item_key'});
639 $_resource_path =~ s/$_base_variable/$_base_value/g;
640 }
641  
642 # form params
643 if ( exists $args{'item_key'} ) {
644 $form_params->{'item_key'} = $self->{api_client}->to_form_value($args{'item_key'});
645 }
646  
647 # form params
648 if ( exists $args{'item_value'} ) {
649 $form_params->{'item_value'} = $self->{api_client}->to_form_value($args{'item_value'});
650 }
651  
652 my $_body_data;
653 # authentication setting, if any
654 my $auth_settings = [qw(token )];
655  
656 # make the API Call
657 my $response = $self->{api_client}->call_api($_resource_path, $_method,
658 $query_params, $form_params,
659 $header_params, $_body_data, $auth_settings);
660 if (!$response) {
661 return;
662 }
663 my $_response_object = $self->{api_client}->deserialize('ConfigStoreItemResponse', $response);
664 return $_response_object;
665 }
666  
667 1;