Fastly/AiRuntimeControlVirtualKeysApi.pm untested

filter: Statementstmt 0.0% 0 / 267 Branchbran 0.0% 0 / 80 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 9 totaltotal 0.0% 0 / 383 CC 41 SCAR 36.2
CC
41
Cov
0%
arc_list_virtual_keys
72.0
arc_update_virtual_key
56.0
arc_update_virtual_key_failover
56.0
CRAP 37.4
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::AiRuntimeControlVirtualKeysApi;
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 # arc_create_virtual_key
51 #
52 # Create a virtual key
53 #
54 # @param ArcVirtualKey $arc_virtual_key (required)
55 {
56 my $params = {
57 'arc_virtual_key' => {
58 data_type => 'ArcVirtualKey',
59 description => '',
60 required => '1',
61 },
62 };
63 __PACKAGE__->method_documentation->{ 'arc_create_virtual_key' } = {
64 summary => 'Create a virtual key',
65 params => $params,
66 returns => 'ArcCreateVirtualKeyResponse',
67 };
68 }
69 # @return ArcCreateVirtualKeyResponse
70 #
71 sub arc_create_virtual_key {
72 my ($self, %args) = @_;
73  
74 # verify the required parameter 'arc_virtual_key' is set
75 unless (exists $args{'arc_virtual_key'}) {
76 croak("Missing the required parameter 'arc_virtual_key' when calling arc_create_virtual_key");
77 }
78  
79 # parse inputs
80 my $_resource_path = '/ai-runtime-control/v1/keys';
81  
82 my $_method = 'POST';
83 my $query_params = {};
84 my $header_params = {};
85 my $form_params = {};
86  
87 # 'Accept' and 'Content-Type' header
88 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
89 if ($_header_accept) {
90 $header_params->{'Accept'} = $_header_accept;
91 }
92 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
93  
94 my $_body_data;
95 # body params
96 if ( exists $args{'arc_virtual_key'}) {
97 $_body_data = $args{'arc_virtual_key'};
98 }
99  
100 # authentication setting, if any
101 my $auth_settings = [qw(token )];
102  
103 # make the API Call
104 my $response = $self->{api_client}->call_api($_resource_path, $_method,
105 $query_params, $form_params,
106 $header_params, $_body_data, $auth_settings);
107 if (!$response) {
108 return;
109 }
110 my $_response_object = $self->{api_client}->deserialize('ArcCreateVirtualKeyResponse', $response);
111 return $_response_object;
112 }
113  
114 #
115 # arc_delete_virtual_key
116 #
117 # Delete a virtual key
118 #
119 # @param string $key_id The ID of the virtual key. (required)
120 {
121 my $params = {
122 'key_id' => {
123 data_type => 'string',
124 description => 'The ID of the virtual key.',
125 required => '1',
126 },
127 };
128 __PACKAGE__->method_documentation->{ 'arc_delete_virtual_key' } = {
129 summary => 'Delete a virtual key',
130 params => $params,
131 returns => undef,
132 };
133 }
134 # @return void
135 #
136 sub arc_delete_virtual_key {
137 my ($self, %args) = @_;
138  
139 # verify the required parameter 'key_id' is set
140 unless (exists $args{'key_id'}) {
141 croak("Missing the required parameter 'key_id' when calling arc_delete_virtual_key");
142 }
143  
144 # parse inputs
145 my $_resource_path = '/ai-runtime-control/v1/keys/{key_id}';
146  
147 my $_method = 'DELETE';
148 my $query_params = {};
149 my $header_params = {};
150 my $form_params = {};
151  
152 # 'Accept' and 'Content-Type' header
153 my $_header_accept = $self->{api_client}->select_header_accept('application/problem+json');
154 if ($_header_accept) {
155 $header_params->{'Accept'} = $_header_accept;
156 }
157 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
158  
159 # path params
160 if ( exists $args{'key_id'}) {
161 my $_base_variable = "{" . "key_id" . "}";
162 my $_base_value = $self->{api_client}->to_path_value($args{'key_id'});
163 $_resource_path =~ s/$_base_variable/$_base_value/g;
164 }
165  
166 my $_body_data;
167 # authentication setting, if any
168 my $auth_settings = [qw(token )];
169  
170 # make the API Call
171 $self->{api_client}->call_api($_resource_path, $_method,
172 $query_params, $form_params,
173 $header_params, $_body_data, $auth_settings);
174 return;
175 }
176  
177 #
178 # arc_get_virtual_key
179 #
180 # Get a virtual key
181 #
182 # @param string $key_id The ID of the virtual key. (required)
183 {
184 my $params = {
185 'key_id' => {
186 data_type => 'string',
187 description => 'The ID of the virtual key.',
188 required => '1',
189 },
190 };
191 __PACKAGE__->method_documentation->{ 'arc_get_virtual_key' } = {
192 summary => 'Get a virtual key',
193 params => $params,
194 returns => 'ArcVirtualKeyResponse',
195 };
196 }
197 # @return ArcVirtualKeyResponse
198 #
199 sub arc_get_virtual_key {
200 my ($self, %args) = @_;
201  
202 # verify the required parameter 'key_id' is set
203 unless (exists $args{'key_id'}) {
204 croak("Missing the required parameter 'key_id' when calling arc_get_virtual_key");
205 }
206  
207 # parse inputs
208 my $_resource_path = '/ai-runtime-control/v1/keys/{key_id}';
209  
210 my $_method = 'GET';
211 my $query_params = {};
212 my $header_params = {};
213 my $form_params = {};
214  
215 # 'Accept' and 'Content-Type' header
216 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
217 if ($_header_accept) {
218 $header_params->{'Accept'} = $_header_accept;
219 }
220 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
221  
222 # path params
223 if ( exists $args{'key_id'}) {
224 my $_base_variable = "{" . "key_id" . "}";
225 my $_base_value = $self->{api_client}->to_path_value($args{'key_id'});
226 $_resource_path =~ s/$_base_variable/$_base_value/g;
227 }
228  
229 my $_body_data;
230 # authentication setting, if any
231 my $auth_settings = [qw(token )];
232  
233 # make the API Call
234 my $response = $self->{api_client}->call_api($_resource_path, $_method,
235 $query_params, $form_params,
236 $header_params, $_body_data, $auth_settings);
237 if (!$response) {
238 return;
239 }
240 my $_response_object = $self->{api_client}->deserialize('ArcVirtualKeyResponse', $response);
241 return $_response_object;
242 }
243  
244 #
245 # arc_get_virtual_key_failover
246 #
247 # Get a virtual key's failover policy
248 #
249 # @param string $key_id The ID of the virtual key. (required)
250 {
251 my $params = {
252 'key_id' => {
253 data_type => 'string',
254 description => 'The ID of the virtual key.',
255 required => '1',
256 },
257 };
258 __PACKAGE__->method_documentation->{ 'arc_get_virtual_key_failover' } = {
259 summary => 'Get a virtual key's failover policy',
260 params => $params,
261 returns => 'ArcVirtualKeyFailoverResponse',
262 };
263 }
264 # @return ArcVirtualKeyFailoverResponse
265 #
266 sub arc_get_virtual_key_failover {
267 my ($self, %args) = @_;
268  
269 # verify the required parameter 'key_id' is set
270 unless (exists $args{'key_id'}) {
271 croak("Missing the required parameter 'key_id' when calling arc_get_virtual_key_failover");
272 }
273  
274 # parse inputs
275 my $_resource_path = '/ai-runtime-control/v1/keys/{key_id}/failover';
276  
277 my $_method = 'GET';
278 my $query_params = {};
279 my $header_params = {};
280 my $form_params = {};
281  
282 # 'Accept' and 'Content-Type' header
283 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
284 if ($_header_accept) {
285 $header_params->{'Accept'} = $_header_accept;
286 }
287 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
288  
289 # path params
290 if ( exists $args{'key_id'}) {
291 my $_base_variable = "{" . "key_id" . "}";
292 my $_base_value = $self->{api_client}->to_path_value($args{'key_id'});
293 $_resource_path =~ s/$_base_variable/$_base_value/g;
294 }
295  
296 my $_body_data;
297 # authentication setting, if any
298 my $auth_settings = [qw(token )];
299  
300 # make the API Call
301 my $response = $self->{api_client}->call_api($_resource_path, $_method,
302 $query_params, $form_params,
303 $header_params, $_body_data, $auth_settings);
304 if (!$response) {
305 return;
306 }
307 my $_response_object = $self->{api_client}->deserialize('ArcVirtualKeyFailoverResponse', $response);
308 return $_response_object;
309 }
310  
311 #
312 # arc_list_virtual_keys
313 #
314 # List virtual keys
315 #
316 # @param boolean $include_deleted Include deleted virtual keys in the results. (optional, default to false)
317 # @param string $search Filter results to virtual keys whose name contains this substring. (optional)
318 # @param string $cursor Cursor for pagination. Use the `next_cursor` value from a previous response to request the next page of results, or the `prev_cursor` value to request the previous page. (optional)
319 # @param int $limit Limit how many results are returned. (optional, default to 10)
320 # @param string $sort Sort field. Prefix with `-` for descending order (e.g., `sort=-created_at`). (optional, default to 'created_at')
321 {
322 my $params = {
323 'include_deleted' => {
324 data_type => 'boolean',
325 description => 'Include deleted virtual keys in the results.',
326 required => '0',
327 },
328 'search' => {
329 data_type => 'string',
330 description => 'Filter results to virtual keys whose name contains this substring.',
331 required => '0',
332 },
333 'cursor' => {
334 data_type => 'string',
335 description => 'Cursor for pagination. Use the `next_cursor` value from a previous response to request the next page of results, or the `prev_cursor` value to request the previous page. ',
336 required => '0',
337 },
338 'limit' => {
339 data_type => 'int',
340 description => 'Limit how many results are returned.',
341 required => '0',
342 },
343 'sort' => {
344 data_type => 'string',
345 description => 'Sort field. Prefix with `-` for descending order (e.g., `sort=-created_at`). ',
346 required => '0',
347 },
348 };
349 __PACKAGE__->method_documentation->{ 'arc_list_virtual_keys' } = {
350 summary => 'List virtual keys',
351 params => $params,
352 returns => 'ArcVirtualKeysResponse',
353 };
354 }
355 # @return ArcVirtualKeysResponse
356 #
357 sub arc_list_virtual_keys {
358 my ($self, %args) = @_;
359  
360 # parse inputs
361 my $_resource_path = '/ai-runtime-control/v1/keys';
362  
363 my $_method = 'GET';
364 my $query_params = {};
365 my $header_params = {};
366 my $form_params = {};
367  
368 # 'Accept' and 'Content-Type' header
369 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
370 if ($_header_accept) {
371 $header_params->{'Accept'} = $_header_accept;
372 }
373 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
374  
375 # query params
376 if ( exists $args{'include_deleted'}) {
377 $query_params->{'include_deleted'} = $self->{api_client}->to_query_value($args{'include_deleted'});
378 }
379  
380 # query params
381 if ( exists $args{'search'}) {
382 $query_params->{'search'} = $self->{api_client}->to_query_value($args{'search'});
383 }
384  
385 # query params
386 if ( exists $args{'cursor'}) {
387 $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'});
388 }
389  
390 # query params
391 if ( exists $args{'limit'}) {
392 $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'});
393 }
394  
395 # query params
396 if ( exists $args{'sort'}) {
397 $query_params->{'sort'} = $self->{api_client}->to_query_value($args{'sort'});
398 }
399  
400 my $_body_data;
401 # authentication setting, if any
402 my $auth_settings = [qw(token )];
403  
404 # make the API Call
405 my $response = $self->{api_client}->call_api($_resource_path, $_method,
406 $query_params, $form_params,
407 $header_params, $_body_data, $auth_settings);
408 if (!$response) {
409 return;
410 }
411 my $_response_object = $self->{api_client}->deserialize('ArcVirtualKeysResponse', $response);
412 return $_response_object;
413 }
414  
415 #
416 # arc_rotate_virtual_key
417 #
418 # Rotate a virtual key
419 #
420 # @param string $key_id The ID of the virtual key. (required)
421 # @param ArcRotateVirtualKeyRequest $arc_rotate_virtual_key_request (optional)
422 {
423 my $params = {
424 'key_id' => {
425 data_type => 'string',
426 description => 'The ID of the virtual key.',
427 required => '1',
428 },
429 'arc_rotate_virtual_key_request' => {
430 data_type => 'ArcRotateVirtualKeyRequest',
431 description => '',
432 required => '0',
433 },
434 };
435 __PACKAGE__->method_documentation->{ 'arc_rotate_virtual_key' } = {
436 summary => 'Rotate a virtual key',
437 params => $params,
438 returns => 'ArcRotateVirtualKeyResponse',
439 };
440 }
441 # @return ArcRotateVirtualKeyResponse
442 #
443 sub arc_rotate_virtual_key {
444 my ($self, %args) = @_;
445  
446 # verify the required parameter 'key_id' is set
447 unless (exists $args{'key_id'}) {
448 croak("Missing the required parameter 'key_id' when calling arc_rotate_virtual_key");
449 }
450  
451 # parse inputs
452 my $_resource_path = '/ai-runtime-control/v1/keys/{key_id}/rotate';
453  
454 my $_method = 'POST';
455 my $query_params = {};
456 my $header_params = {};
457 my $form_params = {};
458  
459 # 'Accept' and 'Content-Type' header
460 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
461 if ($_header_accept) {
462 $header_params->{'Accept'} = $_header_accept;
463 }
464 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
465  
466 # path params
467 if ( exists $args{'key_id'}) {
468 my $_base_variable = "{" . "key_id" . "}";
469 my $_base_value = $self->{api_client}->to_path_value($args{'key_id'});
470 $_resource_path =~ s/$_base_variable/$_base_value/g;
471 }
472  
473 my $_body_data;
474 # body params
475 if ( exists $args{'arc_rotate_virtual_key_request'}) {
476 $_body_data = $args{'arc_rotate_virtual_key_request'};
477 }
478  
479 # authentication setting, if any
480 my $auth_settings = [qw(token )];
481  
482 # make the API Call
483 my $response = $self->{api_client}->call_api($_resource_path, $_method,
484 $query_params, $form_params,
485 $header_params, $_body_data, $auth_settings);
486 if (!$response) {
487 return;
488 }
489 my $_response_object = $self->{api_client}->deserialize('ArcRotateVirtualKeyResponse', $response);
490 return $_response_object;
491 }
492  
493 #
494 # arc_update_virtual_key
495 #
496 # Update a virtual key
497 #
498 # @param string $key_id The ID of the virtual key. (required)
499 # @param ArcUpdateVirtualKeyRequest $arc_update_virtual_key_request (required)
500 {
501 my $params = {
502 'key_id' => {
503 data_type => 'string',
504 description => 'The ID of the virtual key.',
505 required => '1',
506 },
507 'arc_update_virtual_key_request' => {
508 data_type => 'ArcUpdateVirtualKeyRequest',
509 description => '',
510 required => '1',
511 },
512 };
513 __PACKAGE__->method_documentation->{ 'arc_update_virtual_key' } = {
514 summary => 'Update a virtual key',
515 params => $params,
516 returns => 'ArcUpdateVirtualKeyResponse',
517 };
518 }
519 # @return ArcUpdateVirtualKeyResponse
520 #
521 sub arc_update_virtual_key {
522 my ($self, %args) = @_;
523  
524 # verify the required parameter 'key_id' is set
525 unless (exists $args{'key_id'}) {
526 croak("Missing the required parameter 'key_id' when calling arc_update_virtual_key");
527 }
528  
529 # verify the required parameter 'arc_update_virtual_key_request' is set
530 unless (exists $args{'arc_update_virtual_key_request'}) {
531 croak("Missing the required parameter 'arc_update_virtual_key_request' when calling arc_update_virtual_key");
532 }
533  
534 # parse inputs
535 my $_resource_path = '/ai-runtime-control/v1/keys/{key_id}';
536  
537 my $_method = 'PATCH';
538 my $query_params = {};
539 my $header_params = {};
540 my $form_params = {};
541  
542 # 'Accept' and 'Content-Type' header
543 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
544 if ($_header_accept) {
545 $header_params->{'Accept'} = $_header_accept;
546 }
547 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
548  
549 # path params
550 if ( exists $args{'key_id'}) {
551 my $_base_variable = "{" . "key_id" . "}";
552 my $_base_value = $self->{api_client}->to_path_value($args{'key_id'});
553 $_resource_path =~ s/$_base_variable/$_base_value/g;
554 }
555  
556 my $_body_data;
557 # body params
558 if ( exists $args{'arc_update_virtual_key_request'}) {
559 $_body_data = $args{'arc_update_virtual_key_request'};
560 }
561  
562 # authentication setting, if any
563 my $auth_settings = [qw(token )];
564  
565 # make the API Call
566 my $response = $self->{api_client}->call_api($_resource_path, $_method,
567 $query_params, $form_params,
568 $header_params, $_body_data, $auth_settings);
569 if (!$response) {
570 return;
571 }
572 my $_response_object = $self->{api_client}->deserialize('ArcUpdateVirtualKeyResponse', $response);
573 return $_response_object;
574 }
575  
576 #
577 # arc_update_virtual_key_failover
578 #
579 # Update a virtual key's failover policy
580 #
581 # @param string $key_id The ID of the virtual key. (required)
582 # @param ArcVirtualKeyFailoverRequest $arc_virtual_key_failover_request (required)
583 {
584 my $params = {
585 'key_id' => {
586 data_type => 'string',
587 description => 'The ID of the virtual key.',
588 required => '1',
589 },
590 'arc_virtual_key_failover_request' => {
591 data_type => 'ArcVirtualKeyFailoverRequest',
592 description => '',
593 required => '1',
594 },
595 };
596 __PACKAGE__->method_documentation->{ 'arc_update_virtual_key_failover' } = {
597 summary => 'Update a virtual key's failover policy',
598 params => $params,
599 returns => 'ArcVirtualKeyFailoverResponse',
600 };
601 }
602 # @return ArcVirtualKeyFailoverResponse
603 #
604 sub arc_update_virtual_key_failover {
605 my ($self, %args) = @_;
606  
607 # verify the required parameter 'key_id' is set
608 unless (exists $args{'key_id'}) {
609 croak("Missing the required parameter 'key_id' when calling arc_update_virtual_key_failover");
610 }
611  
612 # verify the required parameter 'arc_virtual_key_failover_request' is set
613 unless (exists $args{'arc_virtual_key_failover_request'}) {
614 croak("Missing the required parameter 'arc_virtual_key_failover_request' when calling arc_update_virtual_key_failover");
615 }
616  
617 # parse inputs
618 my $_resource_path = '/ai-runtime-control/v1/keys/{key_id}/failover';
619  
620 my $_method = 'PUT';
621 my $query_params = {};
622 my $header_params = {};
623 my $form_params = {};
624  
625 # 'Accept' and 'Content-Type' header
626 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
627 if ($_header_accept) {
628 $header_params->{'Accept'} = $_header_accept;
629 }
630 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
631  
632 # path params
633 if ( exists $args{'key_id'}) {
634 my $_base_variable = "{" . "key_id" . "}";
635 my $_base_value = $self->{api_client}->to_path_value($args{'key_id'});
636 $_resource_path =~ s/$_base_variable/$_base_value/g;
637 }
638  
639 my $_body_data;
640 # body params
641 if ( exists $args{'arc_virtual_key_failover_request'}) {
642 $_body_data = $args{'arc_virtual_key_failover_request'};
643 }
644  
645 # authentication setting, if any
646 my $auth_settings = [qw(token )];
647  
648 # make the API Call
649 my $response = $self->{api_client}->call_api($_resource_path, $_method,
650 $query_params, $form_params,
651 $header_params, $_body_data, $auth_settings);
652 if (!$response) {
653 return;
654 }
655 my $_response_object = $self->{api_client}->deserialize('ArcVirtualKeyFailoverResponse', $response);
656 return $_response_object;
657 }
658  
659 1;