Fastly/RequestSettingsApi.pm untested

filter: Statementstmt 0.0% 0 / 246 Branchbran 0.0% 0 / 98 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 / 374 CC 50 SCAR 52.5
CC
50
Cov
0%
update_request_settings
462.0
delete_request_settings
90.0
get_request_settings
90.0
CRAP 189.6
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::RequestSettingsApi;
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_request_settings
51 #
52 # Create a Request Settings object
53 #
54 # @param string $service_id Alphanumeric string identifying the service. (required)
55 # @param int $version_id Integer identifying a service version. (required)
56 {
57 my $params = {
58 'service_id' => {
59 data_type => 'string',
60 description => 'Alphanumeric string identifying the service.',
61 required => '1',
62 },
63 'version_id' => {
64 data_type => 'int',
65 description => 'Integer identifying a service version.',
66 required => '1',
67 },
68 };
69 __PACKAGE__->method_documentation->{ 'create_request_settings' } = {
70 summary => 'Create a Request Settings object',
71 params => $params,
72 returns => 'RequestSettingsResponse',
73 };
74 }
75 # @return RequestSettingsResponse
76 #
77 sub create_request_settings {
78 my ($self, %args) = @_;
79  
80 # verify the required parameter 'service_id' is set
81 unless (exists $args{'service_id'}) {
82 croak("Missing the required parameter 'service_id' when calling create_request_settings");
83 }
84  
85 # verify the required parameter 'version_id' is set
86 unless (exists $args{'version_id'}) {
87 croak("Missing the required parameter 'version_id' when calling create_request_settings");
88 }
89  
90 # parse inputs
91 my $_resource_path = '/service/{service_id}/version/{version_id}/request_settings';
92  
93 my $_method = 'POST';
94 my $query_params = {};
95 my $header_params = {};
96 my $form_params = {};
97  
98 # 'Accept' and 'Content-Type' header
99 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
100 if ($_header_accept) {
101 $header_params->{'Accept'} = $_header_accept;
102 }
103 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
104  
105 # path params
106 if ( exists $args{'service_id'}) {
107 my $_base_variable = "{" . "service_id" . "}";
108 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
109 $_resource_path =~ s/$_base_variable/$_base_value/g;
110 }
111  
112 # path params
113 if ( exists $args{'version_id'}) {
114 my $_base_variable = "{" . "version_id" . "}";
115 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
116 $_resource_path =~ s/$_base_variable/$_base_value/g;
117 }
118  
119 my $_body_data;
120 # authentication setting, if any
121 my $auth_settings = [qw(token )];
122  
123 # make the API Call
124 my $response = $self->{api_client}->call_api($_resource_path, $_method,
125 $query_params, $form_params,
126 $header_params, $_body_data, $auth_settings);
127 if (!$response) {
128 return;
129 }
130 my $_response_object = $self->{api_client}->deserialize('RequestSettingsResponse', $response);
131 return $_response_object;
132 }
133  
134 #
135 # delete_request_settings
136 #
137 # Delete a Request Settings object
138 #
139 # @param string $service_id Alphanumeric string identifying the service. (required)
140 # @param int $version_id Integer identifying a service version. (required)
141 # @param string $request_settings_name Name for the request settings. (required)
142 {
143 my $params = {
144 'service_id' => {
145 data_type => 'string',
146 description => 'Alphanumeric string identifying the service.',
147 required => '1',
148 },
149 'version_id' => {
150 data_type => 'int',
151 description => 'Integer identifying a service version.',
152 required => '1',
153 },
154 'request_settings_name' => {
155 data_type => 'string',
156 description => 'Name for the request settings.',
157 required => '1',
158 },
159 };
160 __PACKAGE__->method_documentation->{ 'delete_request_settings' } = {
161 summary => 'Delete a Request Settings object',
162 params => $params,
163 returns => 'InlineResponse200',
164 };
165 }
166 # @return InlineResponse200
167 #
168 sub delete_request_settings {
169 my ($self, %args) = @_;
170  
171 # verify the required parameter 'service_id' is set
172 unless (exists $args{'service_id'}) {
173 croak("Missing the required parameter 'service_id' when calling delete_request_settings");
174 }
175  
176 # verify the required parameter 'version_id' is set
177 unless (exists $args{'version_id'}) {
178 croak("Missing the required parameter 'version_id' when calling delete_request_settings");
179 }
180  
181 # verify the required parameter 'request_settings_name' is set
182 unless (exists $args{'request_settings_name'}) {
183 croak("Missing the required parameter 'request_settings_name' when calling delete_request_settings");
184 }
185  
186 # parse inputs
187 my $_resource_path = '/service/{service_id}/version/{version_id}/request_settings/{request_settings_name}';
188  
189 my $_method = 'DELETE';
190 my $query_params = {};
191 my $header_params = {};
192 my $form_params = {};
193  
194 # 'Accept' and 'Content-Type' header
195 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
196 if ($_header_accept) {
197 $header_params->{'Accept'} = $_header_accept;
198 }
199 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
200  
201 # path params
202 if ( exists $args{'service_id'}) {
203 my $_base_variable = "{" . "service_id" . "}";
204 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
205 $_resource_path =~ s/$_base_variable/$_base_value/g;
206 }
207  
208 # path params
209 if ( exists $args{'version_id'}) {
210 my $_base_variable = "{" . "version_id" . "}";
211 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
212 $_resource_path =~ s/$_base_variable/$_base_value/g;
213 }
214  
215 # path params
216 if ( exists $args{'request_settings_name'}) {
217 my $_base_variable = "{" . "request_settings_name" . "}";
218 my $_base_value = $self->{api_client}->to_path_value($args{'request_settings_name'});
219 $_resource_path =~ s/$_base_variable/$_base_value/g;
220 }
221  
222 my $_body_data;
223 # authentication setting, if any
224 my $auth_settings = [qw(token )];
225  
226 # make the API Call
227 my $response = $self->{api_client}->call_api($_resource_path, $_method,
228 $query_params, $form_params,
229 $header_params, $_body_data, $auth_settings);
230 if (!$response) {
231 return;
232 }
233 my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
234 return $_response_object;
235 }
236  
237 #
238 # get_request_settings
239 #
240 # Get a Request Settings object
241 #
242 # @param string $service_id Alphanumeric string identifying the service. (required)
243 # @param int $version_id Integer identifying a service version. (required)
244 # @param string $request_settings_name Name for the request settings. (required)
245 {
246 my $params = {
247 'service_id' => {
248 data_type => 'string',
249 description => 'Alphanumeric string identifying the service.',
250 required => '1',
251 },
252 'version_id' => {
253 data_type => 'int',
254 description => 'Integer identifying a service version.',
255 required => '1',
256 },
257 'request_settings_name' => {
258 data_type => 'string',
259 description => 'Name for the request settings.',
260 required => '1',
261 },
262 };
263 __PACKAGE__->method_documentation->{ 'get_request_settings' } = {
264 summary => 'Get a Request Settings object',
265 params => $params,
266 returns => 'RequestSettingsResponse',
267 };
268 }
269 # @return RequestSettingsResponse
270 #
271 sub get_request_settings {
272 my ($self, %args) = @_;
273  
274 # verify the required parameter 'service_id' is set
275 unless (exists $args{'service_id'}) {
276 croak("Missing the required parameter 'service_id' when calling get_request_settings");
277 }
278  
279 # verify the required parameter 'version_id' is set
280 unless (exists $args{'version_id'}) {
281 croak("Missing the required parameter 'version_id' when calling get_request_settings");
282 }
283  
284 # verify the required parameter 'request_settings_name' is set
285 unless (exists $args{'request_settings_name'}) {
286 croak("Missing the required parameter 'request_settings_name' when calling get_request_settings");
287 }
288  
289 # parse inputs
290 my $_resource_path = '/service/{service_id}/version/{version_id}/request_settings/{request_settings_name}';
291  
292 my $_method = 'GET';
293 my $query_params = {};
294 my $header_params = {};
295 my $form_params = {};
296  
297 # 'Accept' and 'Content-Type' header
298 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
299 if ($_header_accept) {
300 $header_params->{'Accept'} = $_header_accept;
301 }
302 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
303  
304 # path params
305 if ( exists $args{'service_id'}) {
306 my $_base_variable = "{" . "service_id" . "}";
307 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
308 $_resource_path =~ s/$_base_variable/$_base_value/g;
309 }
310  
311 # path params
312 if ( exists $args{'version_id'}) {
313 my $_base_variable = "{" . "version_id" . "}";
314 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
315 $_resource_path =~ s/$_base_variable/$_base_value/g;
316 }
317  
318 # path params
319 if ( exists $args{'request_settings_name'}) {
320 my $_base_variable = "{" . "request_settings_name" . "}";
321 my $_base_value = $self->{api_client}->to_path_value($args{'request_settings_name'});
322 $_resource_path =~ s/$_base_variable/$_base_value/g;
323 }
324  
325 my $_body_data;
326 # authentication setting, if any
327 my $auth_settings = [qw(token )];
328  
329 # make the API Call
330 my $response = $self->{api_client}->call_api($_resource_path, $_method,
331 $query_params, $form_params,
332 $header_params, $_body_data, $auth_settings);
333 if (!$response) {
334 return;
335 }
336 my $_response_object = $self->{api_client}->deserialize('RequestSettingsResponse', $response);
337 return $_response_object;
338 }
339  
340 #
341 # list_request_settings
342 #
343 # List Request Settings objects
344 #
345 # @param string $service_id Alphanumeric string identifying the service. (required)
346 # @param int $version_id Integer identifying a service version. (required)
347 {
348 my $params = {
349 'service_id' => {
350 data_type => 'string',
351 description => 'Alphanumeric string identifying the service.',
352 required => '1',
353 },
354 'version_id' => {
355 data_type => 'int',
356 description => 'Integer identifying a service version.',
357 required => '1',
358 },
359 };
360 __PACKAGE__->method_documentation->{ 'list_request_settings' } = {
361 summary => 'List Request Settings objects',
362 params => $params,
363 returns => 'ARRAY[RequestSettingsResponse]',
364 };
365 }
366 # @return ARRAY[RequestSettingsResponse]
367 #
368 sub list_request_settings {
369 my ($self, %args) = @_;
370  
371 # verify the required parameter 'service_id' is set
372 unless (exists $args{'service_id'}) {
373 croak("Missing the required parameter 'service_id' when calling list_request_settings");
374 }
375  
376 # verify the required parameter 'version_id' is set
377 unless (exists $args{'version_id'}) {
378 croak("Missing the required parameter 'version_id' when calling list_request_settings");
379 }
380  
381 # parse inputs
382 my $_resource_path = '/service/{service_id}/version/{version_id}/request_settings';
383  
384 my $_method = 'GET';
385 my $query_params = {};
386 my $header_params = {};
387 my $form_params = {};
388  
389 # 'Accept' and 'Content-Type' header
390 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
391 if ($_header_accept) {
392 $header_params->{'Accept'} = $_header_accept;
393 }
394 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
395  
396 # path params
397 if ( exists $args{'service_id'}) {
398 my $_base_variable = "{" . "service_id" . "}";
399 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
400 $_resource_path =~ s/$_base_variable/$_base_value/g;
401 }
402  
403 # path params
404 if ( exists $args{'version_id'}) {
405 my $_base_variable = "{" . "version_id" . "}";
406 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
407 $_resource_path =~ s/$_base_variable/$_base_value/g;
408 }
409  
410 my $_body_data;
411 # authentication setting, if any
412 my $auth_settings = [qw(token )];
413  
414 # make the API Call
415 my $response = $self->{api_client}->call_api($_resource_path, $_method,
416 $query_params, $form_params,
417 $header_params, $_body_data, $auth_settings);
418 if (!$response) {
419 return;
420 }
421 my $_response_object = $self->{api_client}->deserialize('ARRAY[RequestSettingsResponse]', $response);
422 return $_response_object;
423 }
424  
425 #
426 # update_request_settings
427 #
428 # Update a Request Settings object
429 #
430 # @param string $service_id Alphanumeric string identifying the service. (required)
431 # @param int $version_id Integer identifying a service version. (required)
432 # @param string $request_settings_name Name for the request settings. (required)
433 # @param string $action Allows you to terminate request handling and immediately perform an action. (optional)
434 # @param string $default_host Sets the host header. (optional)
435 # @param string $hash_keys Comma separated list of varnish request object fields that should be in the hash key. (optional)
436 # @param string $name Name for the request settings. (optional)
437 # @param string $request_condition Condition which, if met, will select this configuration during a request. Optional. (optional)
438 # @param string $xff Short for X-Forwarded-For. (optional)
439 # @param int $bypass_busy_wait Disable collapsed forwarding, so you don't wait for other objects to origin. (optional)
440 # @param int $force_miss Allows you to force a cache miss for the request. Replaces the item in the cache if the content is cacheable. (optional)
441 # @param int $force_ssl Forces the request use SSL (redirects a non-SSL to SSL). (optional)
442 # @param int $geo_headers Injects Fastly-Geo-Country, Fastly-Geo-City, and Fastly-Geo-Region into the request headers. (optional)
443 # @param int $max_stale_age How old an object is allowed to be to serve stale-if-error or stale-while-revalidate. (optional)
444 # @param int $timer_support Injects the X-Timer info into the request for viewing origin fetch durations. (optional)
445 {
446 my $params = {
447 'service_id' => {
448 data_type => 'string',
449 description => 'Alphanumeric string identifying the service.',
450 required => '1',
451 },
452 'version_id' => {
453 data_type => 'int',
454 description => 'Integer identifying a service version.',
455 required => '1',
456 },
457 'request_settings_name' => {
458 data_type => 'string',
459 description => 'Name for the request settings.',
460 required => '1',
461 },
462 'action' => {
463 data_type => 'string',
464 description => 'Allows you to terminate request handling and immediately perform an action.',
465 required => '0',
466 },
467 'default_host' => {
468 data_type => 'string',
469 description => 'Sets the host header.',
470 required => '0',
471 },
472 'hash_keys' => {
473 data_type => 'string',
474 description => 'Comma separated list of varnish request object fields that should be in the hash key.',
475 required => '0',
476 },
477 'name' => {
478 data_type => 'string',
479 description => 'Name for the request settings.',
480 required => '0',
481 },
482 'request_condition' => {
483 data_type => 'string',
484 description => 'Condition which, if met, will select this configuration during a request. Optional.',
485 required => '0',
486 },
487 'xff' => {
488 data_type => 'string',
489 description => 'Short for X-Forwarded-For.',
490 required => '0',
491 },
492 'bypass_busy_wait' => {
493 data_type => 'int',
494 description => 'Disable collapsed forwarding, so you don't wait for other objects to origin.',
495 required => '0',
496 },
497 'force_miss' => {
498 data_type => 'int',
499 description => 'Allows you to force a cache miss for the request. Replaces the item in the cache if the content is cacheable.',
500 required => '0',
501 },
502 'force_ssl' => {
503 data_type => 'int',
504 description => 'Forces the request use SSL (redirects a non-SSL to SSL).',
505 required => '0',
506 },
507 'geo_headers' => {
508 data_type => 'int',
509 description => 'Injects Fastly-Geo-Country, Fastly-Geo-City, and Fastly-Geo-Region into the request headers.',
510 required => '0',
511 },
512 'max_stale_age' => {
513 data_type => 'int',
514 description => 'How old an object is allowed to be to serve stale-if-error or stale-while-revalidate.',
515 required => '0',
516 },
517 'timer_support' => {
518 data_type => 'int',
519 description => 'Injects the X-Timer info into the request for viewing origin fetch durations.',
520 required => '0',
521 },
522 };
523 __PACKAGE__->method_documentation->{ 'update_request_settings' } = {
524 summary => 'Update a Request Settings object',
525 params => $params,
526 returns => 'RequestSettingsResponse',
527 };
528 }
529 # @return RequestSettingsResponse
530 #
531 sub update_request_settings {
532 my ($self, %args) = @_;
533  
534 # verify the required parameter 'service_id' is set
535 unless (exists $args{'service_id'}) {
536 croak("Missing the required parameter 'service_id' when calling update_request_settings");
537 }
538  
539 # verify the required parameter 'version_id' is set
540 unless (exists $args{'version_id'}) {
541 croak("Missing the required parameter 'version_id' when calling update_request_settings");
542 }
543  
544 # verify the required parameter 'request_settings_name' is set
545 unless (exists $args{'request_settings_name'}) {
546 croak("Missing the required parameter 'request_settings_name' when calling update_request_settings");
547 }
548  
549 # parse inputs
550 my $_resource_path = '/service/{service_id}/version/{version_id}/request_settings/{request_settings_name}';
551  
552 my $_method = 'PUT';
553 my $query_params = {};
554 my $header_params = {};
555 my $form_params = {};
556  
557 # 'Accept' and 'Content-Type' header
558 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
559 if ($_header_accept) {
560 $header_params->{'Accept'} = $_header_accept;
561 }
562 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
563  
564 # path params
565 if ( exists $args{'service_id'}) {
566 my $_base_variable = "{" . "service_id" . "}";
567 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
568 $_resource_path =~ s/$_base_variable/$_base_value/g;
569 }
570  
571 # path params
572 if ( exists $args{'version_id'}) {
573 my $_base_variable = "{" . "version_id" . "}";
574 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
575 $_resource_path =~ s/$_base_variable/$_base_value/g;
576 }
577  
578 # path params
579 if ( exists $args{'request_settings_name'}) {
580 my $_base_variable = "{" . "request_settings_name" . "}";
581 my $_base_value = $self->{api_client}->to_path_value($args{'request_settings_name'});
582 $_resource_path =~ s/$_base_variable/$_base_value/g;
583 }
584  
585 # form params
586 if ( exists $args{'action'} ) {
587 $form_params->{'action'} = $self->{api_client}->to_form_value($args{'action'});
588 }
589  
590 # form params
591 if ( exists $args{'default_host'} ) {
592 $form_params->{'default_host'} = $self->{api_client}->to_form_value($args{'default_host'});
593 }
594  
595 # form params
596 if ( exists $args{'hash_keys'} ) {
597 $form_params->{'hash_keys'} = $self->{api_client}->to_form_value($args{'hash_keys'});
598 }
599  
600 # form params
601 if ( exists $args{'name'} ) {
602 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
603 }
604  
605 # form params
606 if ( exists $args{'request_condition'} ) {
607 $form_params->{'request_condition'} = $self->{api_client}->to_form_value($args{'request_condition'});
608 }
609  
610 # form params
611 if ( exists $args{'xff'} ) {
612 $form_params->{'xff'} = $self->{api_client}->to_form_value($args{'xff'});
613 }
614  
615 # form params
616 if ( exists $args{'bypass_busy_wait'} ) {
617 $form_params->{'bypass_busy_wait'} = $self->{api_client}->to_form_value($args{'bypass_busy_wait'});
618 }
619  
620 # form params
621 if ( exists $args{'force_miss'} ) {
622 $form_params->{'force_miss'} = $self->{api_client}->to_form_value($args{'force_miss'});
623 }
624  
625 # form params
626 if ( exists $args{'force_ssl'} ) {
627 $form_params->{'force_ssl'} = $self->{api_client}->to_form_value($args{'force_ssl'});
628 }
629  
630 # form params
631 if ( exists $args{'geo_headers'} ) {
632 $form_params->{'geo_headers'} = $self->{api_client}->to_form_value($args{'geo_headers'});
633 }
634  
635 # form params
636 if ( exists $args{'max_stale_age'} ) {
637 $form_params->{'max_stale_age'} = $self->{api_client}->to_form_value($args{'max_stale_age'});
638 }
639  
640 # form params
641 if ( exists $args{'timer_support'} ) {
642 $form_params->{'timer_support'} = $self->{api_client}->to_form_value($args{'timer_support'});
643 }
644  
645 my $_body_data;
646 # authentication setting, if any
647 my $auth_settings = [qw(token )];
648  
649 # make the API Call
650 my $response = $self->{api_client}->call_api($_resource_path, $_method,
651 $query_params, $form_params,
652 $header_params, $_body_data, $auth_settings);
653 if (!$response) {
654 return;
655 }
656 my $_response_object = $self->{api_client}->deserialize('RequestSettingsResponse', $response);
657 return $_response_object;
658 }
659  
660 1;