Fastly/AclEntryApi.pm untested

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