Fastly/GzipApi.pm untested

filter: Statementstmt 0.0% 0 / 238 Branchbran 0.0% 0 / 90 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 15 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 358 CC 46 SCAR 45.8
CC
46
Cov
0%
update_gzip_config
182.0
create_gzip_config
132.0
delete_gzip_config
90.0
CRAP 97.7
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::GzipApi;
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 # create_gzip_config
51 #
52 # Create a gzip configuration
53 #
54 # @param string $service_id Alphanumeric string identifying the service. (required)
55 # @param int $version_id Integer identifying a service version. (required)
56 # @param string $cache_condition Name of the cache condition controlling when this configuration applies. (optional)
57 # @param string $content_types Space-separated list of content types to compress. If you omit this field a default list will be used. (optional)
58 # @param string $extensions Space-separated list of file extensions to compress. If you omit this field a default list will be used. (optional)
59 # @param string $name Name of the gzip configuration. (optional)
60 {
61 my $params = {
62 'service_id' => {
63 data_type => 'string',
64 description => 'Alphanumeric string identifying the service.',
65 required => '1',
66 },
67 'version_id' => {
68 data_type => 'int',
69 description => 'Integer identifying a service version.',
70 required => '1',
71 },
72 'cache_condition' => {
73 data_type => 'string',
74 description => 'Name of the cache condition controlling when this configuration applies.',
75 required => '0',
76 },
77 'content_types' => {
78 data_type => 'string',
79 description => 'Space-separated list of content types to compress. If you omit this field a default list will be used.',
80 required => '0',
81 },
82 'extensions' => {
83 data_type => 'string',
84 description => 'Space-separated list of file extensions to compress. If you omit this field a default list will be used.',
85 required => '0',
86 },
87 'name' => {
88 data_type => 'string',
89 description => 'Name of the gzip configuration.',
90 required => '0',
91 },
92 };
93 __PACKAGE__->method_documentation->{ 'create_gzip_config' } = {
94 summary => 'Create a gzip configuration',
95 params => $params,
96 returns => 'GzipResponse',
97 };
98 }
99 # @return GzipResponse
100 #
101 sub create_gzip_config {
102 my ($self, %args) = @_;
103  
104 # verify the required parameter 'service_id' is set
105 unless (exists $args{'service_id'}) {
106 croak("Missing the required parameter 'service_id' when calling create_gzip_config");
107 }
108  
109 # verify the required parameter 'version_id' is set
110 unless (exists $args{'version_id'}) {
111 croak("Missing the required parameter 'version_id' when calling create_gzip_config");
112 }
113  
114 # parse inputs
115 my $_resource_path = '/service/{service_id}/version/{version_id}/gzip';
116  
117 my $_method = 'POST';
118 my $query_params = {};
119 my $header_params = {};
120 my $form_params = {};
121  
122 # 'Accept' and 'Content-Type' header
123 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
124 if ($_header_accept) {
125 $header_params->{'Accept'} = $_header_accept;
126 }
127 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
128  
129 # path params
130 if ( exists $args{'service_id'}) {
131 my $_base_variable = "{" . "service_id" . "}";
132 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
133 $_resource_path =~ s/$_base_variable/$_base_value/g;
134 }
135  
136 # path params
137 if ( exists $args{'version_id'}) {
138 my $_base_variable = "{" . "version_id" . "}";
139 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
140 $_resource_path =~ s/$_base_variable/$_base_value/g;
141 }
142  
143 # form params
144 if ( exists $args{'cache_condition'} ) {
145 $form_params->{'cache_condition'} = $self->{api_client}->to_form_value($args{'cache_condition'});
146 }
147  
148 # form params
149 if ( exists $args{'content_types'} ) {
150 $form_params->{'content_types'} = $self->{api_client}->to_form_value($args{'content_types'});
151 }
152  
153 # form params
154 if ( exists $args{'extensions'} ) {
155 $form_params->{'extensions'} = $self->{api_client}->to_form_value($args{'extensions'});
156 }
157  
158 # form params
159 if ( exists $args{'name'} ) {
160 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
161 }
162  
163 my $_body_data;
164 # authentication setting, if any
165 my $auth_settings = [qw(token )];
166  
167 # make the API Call
168 my $response = $self->{api_client}->call_api($_resource_path, $_method,
169 $query_params, $form_params,
170 $header_params, $_body_data, $auth_settings);
171 if (!$response) {
172 return;
173 }
174 my $_response_object = $self->{api_client}->deserialize('GzipResponse', $response);
175 return $_response_object;
176 }
177  
178 #
179 # delete_gzip_config
180 #
181 # Delete a gzip configuration
182 #
183 # @param string $service_id Alphanumeric string identifying the service. (required)
184 # @param int $version_id Integer identifying a service version. (required)
185 # @param string $gzip_name Name of the gzip configuration. (required)
186 {
187 my $params = {
188 'service_id' => {
189 data_type => 'string',
190 description => 'Alphanumeric string identifying the service.',
191 required => '1',
192 },
193 'version_id' => {
194 data_type => 'int',
195 description => 'Integer identifying a service version.',
196 required => '1',
197 },
198 'gzip_name' => {
199 data_type => 'string',
200 description => 'Name of the gzip configuration.',
201 required => '1',
202 },
203 };
204 __PACKAGE__->method_documentation->{ 'delete_gzip_config' } = {
205 summary => 'Delete a gzip configuration',
206 params => $params,
207 returns => 'InlineResponse200',
208 };
209 }
210 # @return InlineResponse200
211 #
212 sub delete_gzip_config {
213 my ($self, %args) = @_;
214  
215 # verify the required parameter 'service_id' is set
216 unless (exists $args{'service_id'}) {
217 croak("Missing the required parameter 'service_id' when calling delete_gzip_config");
218 }
219  
220 # verify the required parameter 'version_id' is set
221 unless (exists $args{'version_id'}) {
222 croak("Missing the required parameter 'version_id' when calling delete_gzip_config");
223 }
224  
225 # verify the required parameter 'gzip_name' is set
226 unless (exists $args{'gzip_name'}) {
227 croak("Missing the required parameter 'gzip_name' when calling delete_gzip_config");
228 }
229  
230 # parse inputs
231 my $_resource_path = '/service/{service_id}/version/{version_id}/gzip/{gzip_name}';
232  
233 my $_method = 'DELETE';
234 my $query_params = {};
235 my $header_params = {};
236 my $form_params = {};
237  
238 # 'Accept' and 'Content-Type' header
239 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
240 if ($_header_accept) {
241 $header_params->{'Accept'} = $_header_accept;
242 }
243 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
244  
245 # path params
246 if ( exists $args{'service_id'}) {
247 my $_base_variable = "{" . "service_id" . "}";
248 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
249 $_resource_path =~ s/$_base_variable/$_base_value/g;
250 }
251  
252 # path params
253 if ( exists $args{'version_id'}) {
254 my $_base_variable = "{" . "version_id" . "}";
255 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
256 $_resource_path =~ s/$_base_variable/$_base_value/g;
257 }
258  
259 # path params
260 if ( exists $args{'gzip_name'}) {
261 my $_base_variable = "{" . "gzip_name" . "}";
262 my $_base_value = $self->{api_client}->to_path_value($args{'gzip_name'});
263 $_resource_path =~ s/$_base_variable/$_base_value/g;
264 }
265  
266 my $_body_data;
267 # authentication setting, if any
268 my $auth_settings = [qw(token )];
269  
270 # make the API Call
271 my $response = $self->{api_client}->call_api($_resource_path, $_method,
272 $query_params, $form_params,
273 $header_params, $_body_data, $auth_settings);
274 if (!$response) {
275 return;
276 }
277 my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
278 return $_response_object;
279 }
280  
281 #
282 # get_gzip_configs
283 #
284 # Get a gzip configuration
285 #
286 # @param string $service_id Alphanumeric string identifying the service. (required)
287 # @param int $version_id Integer identifying a service version. (required)
288 # @param string $gzip_name Name of the gzip configuration. (required)
289 {
290 my $params = {
291 'service_id' => {
292 data_type => 'string',
293 description => 'Alphanumeric string identifying the service.',
294 required => '1',
295 },
296 'version_id' => {
297 data_type => 'int',
298 description => 'Integer identifying a service version.',
299 required => '1',
300 },
301 'gzip_name' => {
302 data_type => 'string',
303 description => 'Name of the gzip configuration.',
304 required => '1',
305 },
306 };
307 __PACKAGE__->method_documentation->{ 'get_gzip_configs' } = {
308 summary => 'Get a gzip configuration',
309 params => $params,
310 returns => 'GzipResponse',
311 };
312 }
313 # @return GzipResponse
314 #
315 sub get_gzip_configs {
316 my ($self, %args) = @_;
317  
318 # verify the required parameter 'service_id' is set
319 unless (exists $args{'service_id'}) {
320 croak("Missing the required parameter 'service_id' when calling get_gzip_configs");
321 }
322  
323 # verify the required parameter 'version_id' is set
324 unless (exists $args{'version_id'}) {
325 croak("Missing the required parameter 'version_id' when calling get_gzip_configs");
326 }
327  
328 # verify the required parameter 'gzip_name' is set
329 unless (exists $args{'gzip_name'}) {
330 croak("Missing the required parameter 'gzip_name' when calling get_gzip_configs");
331 }
332  
333 # parse inputs
334 my $_resource_path = '/service/{service_id}/version/{version_id}/gzip/{gzip_name}';
335  
336 my $_method = 'GET';
337 my $query_params = {};
338 my $header_params = {};
339 my $form_params = {};
340  
341 # 'Accept' and 'Content-Type' header
342 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
343 if ($_header_accept) {
344 $header_params->{'Accept'} = $_header_accept;
345 }
346 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
347  
348 # path params
349 if ( exists $args{'service_id'}) {
350 my $_base_variable = "{" . "service_id" . "}";
351 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
352 $_resource_path =~ s/$_base_variable/$_base_value/g;
353 }
354  
355 # path params
356 if ( exists $args{'version_id'}) {
357 my $_base_variable = "{" . "version_id" . "}";
358 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
359 $_resource_path =~ s/$_base_variable/$_base_value/g;
360 }
361  
362 # path params
363 if ( exists $args{'gzip_name'}) {
364 my $_base_variable = "{" . "gzip_name" . "}";
365 my $_base_value = $self->{api_client}->to_path_value($args{'gzip_name'});
366 $_resource_path =~ s/$_base_variable/$_base_value/g;
367 }
368  
369 my $_body_data;
370 # authentication setting, if any
371 my $auth_settings = [qw(token )];
372  
373 # make the API Call
374 my $response = $self->{api_client}->call_api($_resource_path, $_method,
375 $query_params, $form_params,
376 $header_params, $_body_data, $auth_settings);
377 if (!$response) {
378 return;
379 }
380 my $_response_object = $self->{api_client}->deserialize('GzipResponse', $response);
381 return $_response_object;
382 }
383  
384 #
385 # list_gzip_configs
386 #
387 # List gzip configurations
388 #
389 # @param string $service_id Alphanumeric string identifying the service. (required)
390 # @param int $version_id Integer identifying a service version. (required)
391 {
392 my $params = {
393 'service_id' => {
394 data_type => 'string',
395 description => 'Alphanumeric string identifying the service.',
396 required => '1',
397 },
398 'version_id' => {
399 data_type => 'int',
400 description => 'Integer identifying a service version.',
401 required => '1',
402 },
403 };
404 __PACKAGE__->method_documentation->{ 'list_gzip_configs' } = {
405 summary => 'List gzip configurations',
406 params => $params,
407 returns => 'ARRAY[GzipResponse]',
408 };
409 }
410 # @return ARRAY[GzipResponse]
411 #
412 sub list_gzip_configs {
413 my ($self, %args) = @_;
414  
415 # verify the required parameter 'service_id' is set
416 unless (exists $args{'service_id'}) {
417 croak("Missing the required parameter 'service_id' when calling list_gzip_configs");
418 }
419  
420 # verify the required parameter 'version_id' is set
421 unless (exists $args{'version_id'}) {
422 croak("Missing the required parameter 'version_id' when calling list_gzip_configs");
423 }
424  
425 # parse inputs
426 my $_resource_path = '/service/{service_id}/version/{version_id}/gzip';
427  
428 my $_method = 'GET';
429 my $query_params = {};
430 my $header_params = {};
431 my $form_params = {};
432  
433 # 'Accept' and 'Content-Type' header
434 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
435 if ($_header_accept) {
436 $header_params->{'Accept'} = $_header_accept;
437 }
438 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
439  
440 # path params
441 if ( exists $args{'service_id'}) {
442 my $_base_variable = "{" . "service_id" . "}";
443 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
444 $_resource_path =~ s/$_base_variable/$_base_value/g;
445 }
446  
447 # path params
448 if ( exists $args{'version_id'}) {
449 my $_base_variable = "{" . "version_id" . "}";
450 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
451 $_resource_path =~ s/$_base_variable/$_base_value/g;
452 }
453  
454 my $_body_data;
455 # authentication setting, if any
456 my $auth_settings = [qw(token )];
457  
458 # make the API Call
459 my $response = $self->{api_client}->call_api($_resource_path, $_method,
460 $query_params, $form_params,
461 $header_params, $_body_data, $auth_settings);
462 if (!$response) {
463 return;
464 }
465 my $_response_object = $self->{api_client}->deserialize('ARRAY[GzipResponse]', $response);
466 return $_response_object;
467 }
468  
469 #
470 # update_gzip_config
471 #
472 # Update a gzip configuration
473 #
474 # @param string $service_id Alphanumeric string identifying the service. (required)
475 # @param int $version_id Integer identifying a service version. (required)
476 # @param string $gzip_name Name of the gzip configuration. (required)
477 # @param string $cache_condition Name of the cache condition controlling when this configuration applies. (optional)
478 # @param string $content_types Space-separated list of content types to compress. If you omit this field a default list will be used. (optional)
479 # @param string $extensions Space-separated list of file extensions to compress. If you omit this field a default list will be used. (optional)
480 # @param string $name Name of the gzip configuration. (optional)
481 {
482 my $params = {
483 'service_id' => {
484 data_type => 'string',
485 description => 'Alphanumeric string identifying the service.',
486 required => '1',
487 },
488 'version_id' => {
489 data_type => 'int',
490 description => 'Integer identifying a service version.',
491 required => '1',
492 },
493 'gzip_name' => {
494 data_type => 'string',
495 description => 'Name of the gzip configuration.',
496 required => '1',
497 },
498 'cache_condition' => {
499 data_type => 'string',
500 description => 'Name of the cache condition controlling when this configuration applies.',
501 required => '0',
502 },
503 'content_types' => {
504 data_type => 'string',
505 description => 'Space-separated list of content types to compress. If you omit this field a default list will be used.',
506 required => '0',
507 },
508 'extensions' => {
509 data_type => 'string',
510 description => 'Space-separated list of file extensions to compress. If you omit this field a default list will be used.',
511 required => '0',
512 },
513 'name' => {
514 data_type => 'string',
515 description => 'Name of the gzip configuration.',
516 required => '0',
517 },
518 };
519 __PACKAGE__->method_documentation->{ 'update_gzip_config' } = {
520 summary => 'Update a gzip configuration',
521 params => $params,
522 returns => 'GzipResponse',
523 };
524 }
525 # @return GzipResponse
526 #
527 sub update_gzip_config {
528 my ($self, %args) = @_;
529  
530 # verify the required parameter 'service_id' is set
531 unless (exists $args{'service_id'}) {
532 croak("Missing the required parameter 'service_id' when calling update_gzip_config");
533 }
534  
535 # verify the required parameter 'version_id' is set
536 unless (exists $args{'version_id'}) {
537 croak("Missing the required parameter 'version_id' when calling update_gzip_config");
538 }
539  
540 # verify the required parameter 'gzip_name' is set
541 unless (exists $args{'gzip_name'}) {
542 croak("Missing the required parameter 'gzip_name' when calling update_gzip_config");
543 }
544  
545 # parse inputs
546 my $_resource_path = '/service/{service_id}/version/{version_id}/gzip/{gzip_name}';
547  
548 my $_method = 'PUT';
549 my $query_params = {};
550 my $header_params = {};
551 my $form_params = {};
552  
553 # 'Accept' and 'Content-Type' header
554 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
555 if ($_header_accept) {
556 $header_params->{'Accept'} = $_header_accept;
557 }
558 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
559  
560 # path params
561 if ( exists $args{'service_id'}) {
562 my $_base_variable = "{" . "service_id" . "}";
563 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
564 $_resource_path =~ s/$_base_variable/$_base_value/g;
565 }
566  
567 # path params
568 if ( exists $args{'version_id'}) {
569 my $_base_variable = "{" . "version_id" . "}";
570 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
571 $_resource_path =~ s/$_base_variable/$_base_value/g;
572 }
573  
574 # path params
575 if ( exists $args{'gzip_name'}) {
576 my $_base_variable = "{" . "gzip_name" . "}";
577 my $_base_value = $self->{api_client}->to_path_value($args{'gzip_name'});
578 $_resource_path =~ s/$_base_variable/$_base_value/g;
579 }
580  
581 # form params
582 if ( exists $args{'cache_condition'} ) {
583 $form_params->{'cache_condition'} = $self->{api_client}->to_form_value($args{'cache_condition'});
584 }
585  
586 # form params
587 if ( exists $args{'content_types'} ) {
588 $form_params->{'content_types'} = $self->{api_client}->to_form_value($args{'content_types'});
589 }
590  
591 # form params
592 if ( exists $args{'extensions'} ) {
593 $form_params->{'extensions'} = $self->{api_client}->to_form_value($args{'extensions'});
594 }
595  
596 # form params
597 if ( exists $args{'name'} ) {
598 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
599 }
600  
601 my $_body_data;
602 # authentication setting, if any
603 my $auth_settings = [qw(token )];
604  
605 # make the API Call
606 my $response = $self->{api_client}->call_api($_resource_path, $_method,
607 $query_params, $form_params,
608 $header_params, $_body_data, $auth_settings);
609 if (!$response) {
610 return;
611 }
612 my $_response_object = $self->{api_client}->deserialize('GzipResponse', $response);
613 return $_response_object;
614 }
615  
616 1;