Fastly/PoolApi.pm untested

filter: Statementstmt 0.0% 0 / 330 Branchbran 0.0% 0 / 182 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 / 542 CC 92 SCAR 67.5
CC
92
Cov
0%
update_server_pool
1332.0
create_server_pool
1190.0
delete_server_pool
90.0
CRAP 853.3
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::PoolApi;
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_server_pool
51 #
52 # Create a server pool
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 $tls_ca_cert A secure certificate to authenticate a server with. Must be in PEM format. (optional, default to 'null')
57 # @param string $tls_client_cert The client certificate used to make authenticated requests. Must be in PEM format. (optional, default to 'null')
58 # @param string $tls_client_key The client private key used to make authenticated requests. Must be in PEM format. (optional, default to 'null')
59 # @param string $tls_cert_hostname The hostname used to verify a server's certificate. It can either be the Common Name (CN) or a Subject Alternative Name (SAN). (optional, default to 'null')
60 # @param int $use_tls Whether to use TLS. (optional, default to 0)
61 # @param DateTime $created_at Date and time in ISO 8601 format. (optional)
62 # @param DateTime $deleted_at Date and time in ISO 8601 format. (optional)
63 # @param DateTime $updated_at Date and time in ISO 8601 format. (optional)
64 # @param string $service_id (optional)
65 # @param string $version (optional)
66 # @param string $name Name for the Pool. (optional)
67 # @param string $shield Selected POP to serve as a shield for the servers. Defaults to `null` meaning no origin shielding if not set. Refer to the [POPs API endpoint](https://www.fastly.com/documentation/reference/api/utils/pops/) to get a list of available POPs used for shielding. (optional, default to 'null')
68 # @param string $request_condition Condition which, if met, will select this configuration during a request. Optional. (optional)
69 # @param string $tls_ciphers List of OpenSSL ciphers (see the [openssl.org manpages](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) for details). Optional. (optional)
70 # @param string $tls_sni_hostname SNI hostname. Optional. (optional)
71 # @param int $min_tls_version Minimum allowed TLS version on connections to this server. Optional. (optional)
72 # @param int $max_tls_version Maximum allowed TLS version on connections to this server. Optional. (optional)
73 # @param string $healthcheck Name of the healthcheck to use with this pool. Can be empty and could be reused across multiple backend and pools. (optional)
74 # @param string $comment A freeform descriptive note. (optional)
75 # @param string $type What type of load balance group to use. (optional)
76 # @param string $override_host The hostname to [override the Host header](https://www.fastly.com/documentation/guides/full-site-delivery/domains-and-origins/specifying-an-override-host/). Defaults to `null` meaning no override of the Host header will occur. This setting can also be added to a Server definition. If the field is set on a Server definition it will override the Pool setting. (optional, default to 'null')
77 # @param int $between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using `bereq.between_bytes_timeout`. (optional, default to 10000)
78 # @param int $connect_timeout How long to wait for a timeout in milliseconds. Optional. (optional)
79 # @param int $first_byte_timeout How long to wait for the first byte in milliseconds. Optional. (optional)
80 # @param int $max_conn_default Maximum number of connections. Optional. (optional, default to 200)
81 # @param int $quorum Percentage of capacity (`0-100`) that needs to be operationally available for a pool to be considered up. (optional, default to 75)
82 # @param int $tls_check_cert Be strict on checking TLS certs. Optional. (optional)
83 {
84 my $params = {
85 'service_id' => {
86 data_type => 'string',
87 description => 'Alphanumeric string identifying the service.',
88 required => '1',
89 },
90 'version_id' => {
91 data_type => 'int',
92 description => 'Integer identifying a service version.',
93 required => '1',
94 },
95 'tls_ca_cert' => {
96 data_type => 'string',
97 description => 'A secure certificate to authenticate a server with. Must be in PEM format.',
98 required => '0',
99 },
100 'tls_client_cert' => {
101 data_type => 'string',
102 description => 'The client certificate used to make authenticated requests. Must be in PEM format.',
103 required => '0',
104 },
105 'tls_client_key' => {
106 data_type => 'string',
107 description => 'The client private key used to make authenticated requests. Must be in PEM format.',
108 required => '0',
109 },
110 'tls_cert_hostname' => {
111 data_type => 'string',
112 description => 'The hostname used to verify a server's certificate. It can either be the Common Name (CN) or a Subject Alternative Name (SAN).',
113 required => '0',
114 },
115 'use_tls' => {
116 data_type => 'int',
117 description => 'Whether to use TLS.',
118 required => '0',
119 },
120 'created_at' => {
121 data_type => 'DateTime',
122 description => 'Date and time in ISO 8601 format.',
123 required => '0',
124 },
125 'deleted_at' => {
126 data_type => 'DateTime',
127 description => 'Date and time in ISO 8601 format.',
128 required => '0',
129 },
130 'updated_at' => {
131 data_type => 'DateTime',
132 description => 'Date and time in ISO 8601 format.',
133 required => '0',
134 },
135 'service_id' => {
136 data_type => 'string',
137 description => '',
138 required => '0',
139 },
140 'version' => {
141 data_type => 'string',
142 description => '',
143 required => '0',
144 },
145 'name' => {
146 data_type => 'string',
147 description => 'Name for the Pool.',
148 required => '0',
149 },
150 'shield' => {
151 data_type => 'string',
152 description => 'Selected POP to serve as a shield for the servers. Defaults to `null` meaning no origin shielding if not set. Refer to the [POPs API endpoint](https://www.fastly.com/documentation/reference/api/utils/pops/) to get a list of available POPs used for shielding.',
153 required => '0',
154 },
155 'request_condition' => {
156 data_type => 'string',
157 description => 'Condition which, if met, will select this configuration during a request. Optional.',
158 required => '0',
159 },
160 'tls_ciphers' => {
161 data_type => 'string',
162 description => 'List of OpenSSL ciphers (see the [openssl.org manpages](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) for details). Optional.',
163 required => '0',
164 },
165 'tls_sni_hostname' => {
166 data_type => 'string',
167 description => 'SNI hostname. Optional.',
168 required => '0',
169 },
170 'min_tls_version' => {
171 data_type => 'int',
172 description => 'Minimum allowed TLS version on connections to this server. Optional.',
173 required => '0',
174 },
175 'max_tls_version' => {
176 data_type => 'int',
177 description => 'Maximum allowed TLS version on connections to this server. Optional.',
178 required => '0',
179 },
180 'healthcheck' => {
181 data_type => 'string',
182 description => 'Name of the healthcheck to use with this pool. Can be empty and could be reused across multiple backend and pools.',
183 required => '0',
184 },
185 'comment' => {
186 data_type => 'string',
187 description => 'A freeform descriptive note.',
188 required => '0',
189 },
190 'type' => {
191 data_type => 'string',
192 description => 'What type of load balance group to use.',
193 required => '0',
194 },
195 'override_host' => {
196 data_type => 'string',
197 description => 'The hostname to [override the Host header](https://www.fastly.com/documentation/guides/full-site-delivery/domains-and-origins/specifying-an-override-host/). Defaults to `null` meaning no override of the Host header will occur. This setting can also be added to a Server definition. If the field is set on a Server definition it will override the Pool setting.',
198 required => '0',
199 },
200 'between_bytes_timeout' => {
201 data_type => 'int',
202 description => 'Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using `bereq.between_bytes_timeout`.',
203 required => '0',
204 },
205 'connect_timeout' => {
206 data_type => 'int',
207 description => 'How long to wait for a timeout in milliseconds. Optional.',
208 required => '0',
209 },
210 'first_byte_timeout' => {
211 data_type => 'int',
212 description => 'How long to wait for the first byte in milliseconds. Optional.',
213 required => '0',
214 },
215 'max_conn_default' => {
216 data_type => 'int',
217 description => 'Maximum number of connections. Optional.',
218 required => '0',
219 },
220 'quorum' => {
221 data_type => 'int',
222 description => 'Percentage of capacity (`0-100`) that needs to be operationally available for a pool to be considered up.',
223 required => '0',
224 },
225 'tls_check_cert' => {
226 data_type => 'int',
227 description => 'Be strict on checking TLS certs. Optional.',
228 required => '0',
229 },
230 };
231 __PACKAGE__->method_documentation->{ 'create_server_pool' } = {
232 summary => 'Create a server pool',
233 params => $params,
234 returns => 'PoolResponsePost',
235 };
236 }
237 # @return PoolResponsePost
238 #
239 sub create_server_pool {
240 my ($self, %args) = @_;
241  
242 # verify the required parameter 'service_id' is set
243 unless (exists $args{'service_id'}) {
244 croak("Missing the required parameter 'service_id' when calling create_server_pool");
245 }
246  
247 # verify the required parameter 'version_id' is set
248 unless (exists $args{'version_id'}) {
249 croak("Missing the required parameter 'version_id' when calling create_server_pool");
250 }
251  
252 # parse inputs
253 my $_resource_path = '/service/{service_id}/version/{version_id}/pool';
254  
255 my $_method = 'POST';
256 my $query_params = {};
257 my $header_params = {};
258 my $form_params = {};
259  
260 # 'Accept' and 'Content-Type' header
261 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
262 if ($_header_accept) {
263 $header_params->{'Accept'} = $_header_accept;
264 }
265 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
266  
267 # path params
268 if ( exists $args{'service_id'}) {
269 my $_base_variable = "{" . "service_id" . "}";
270 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
271 $_resource_path =~ s/$_base_variable/$_base_value/g;
272 }
273  
274 # path params
275 if ( exists $args{'version_id'}) {
276 my $_base_variable = "{" . "version_id" . "}";
277 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
278 $_resource_path =~ s/$_base_variable/$_base_value/g;
279 }
280  
281 # form params
282 if ( exists $args{'tls_ca_cert'} ) {
283 $form_params->{'tls_ca_cert'} = $self->{api_client}->to_form_value($args{'tls_ca_cert'});
284 }
285  
286 # form params
287 if ( exists $args{'tls_client_cert'} ) {
288 $form_params->{'tls_client_cert'} = $self->{api_client}->to_form_value($args{'tls_client_cert'});
289 }
290  
291 # form params
292 if ( exists $args{'tls_client_key'} ) {
293 $form_params->{'tls_client_key'} = $self->{api_client}->to_form_value($args{'tls_client_key'});
294 }
295  
296 # form params
297 if ( exists $args{'tls_cert_hostname'} ) {
298 $form_params->{'tls_cert_hostname'} = $self->{api_client}->to_form_value($args{'tls_cert_hostname'});
299 }
300  
301 # form params
302 if ( exists $args{'use_tls'} ) {
303 $form_params->{'use_tls'} = $self->{api_client}->to_form_value($args{'use_tls'});
304 }
305  
306 # form params
307 if ( exists $args{'created_at'} ) {
308 $form_params->{'created_at'} = $self->{api_client}->to_form_value($args{'created_at'});
309 }
310  
311 # form params
312 if ( exists $args{'deleted_at'} ) {
313 $form_params->{'deleted_at'} = $self->{api_client}->to_form_value($args{'deleted_at'});
314 }
315  
316 # form params
317 if ( exists $args{'updated_at'} ) {
318 $form_params->{'updated_at'} = $self->{api_client}->to_form_value($args{'updated_at'});
319 }
320  
321 # form params
322 if ( exists $args{'service_id'} ) {
323 $form_params->{'service_id'} = $self->{api_client}->to_form_value($args{'service_id'});
324 }
325  
326 # form params
327 if ( exists $args{'version'} ) {
328 $form_params->{'version'} = $self->{api_client}->to_form_value($args{'version'});
329 }
330  
331 # form params
332 if ( exists $args{'name'} ) {
333 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
334 }
335  
336 # form params
337 if ( exists $args{'shield'} ) {
338 $form_params->{'shield'} = $self->{api_client}->to_form_value($args{'shield'});
339 }
340  
341 # form params
342 if ( exists $args{'request_condition'} ) {
343 $form_params->{'request_condition'} = $self->{api_client}->to_form_value($args{'request_condition'});
344 }
345  
346 # form params
347 if ( exists $args{'tls_ciphers'} ) {
348 $form_params->{'tls_ciphers'} = $self->{api_client}->to_form_value($args{'tls_ciphers'});
349 }
350  
351 # form params
352 if ( exists $args{'tls_sni_hostname'} ) {
353 $form_params->{'tls_sni_hostname'} = $self->{api_client}->to_form_value($args{'tls_sni_hostname'});
354 }
355  
356 # form params
357 if ( exists $args{'min_tls_version'} ) {
358 $form_params->{'min_tls_version'} = $self->{api_client}->to_form_value($args{'min_tls_version'});
359 }
360  
361 # form params
362 if ( exists $args{'max_tls_version'} ) {
363 $form_params->{'max_tls_version'} = $self->{api_client}->to_form_value($args{'max_tls_version'});
364 }
365  
366 # form params
367 if ( exists $args{'healthcheck'} ) {
368 $form_params->{'healthcheck'} = $self->{api_client}->to_form_value($args{'healthcheck'});
369 }
370  
371 # form params
372 if ( exists $args{'comment'} ) {
373 $form_params->{'comment'} = $self->{api_client}->to_form_value($args{'comment'});
374 }
375  
376 # form params
377 if ( exists $args{'type'} ) {
378 $form_params->{'type'} = $self->{api_client}->to_form_value($args{'type'});
379 }
380  
381 # form params
382 if ( exists $args{'override_host'} ) {
383 $form_params->{'override_host'} = $self->{api_client}->to_form_value($args{'override_host'});
384 }
385  
386 # form params
387 if ( exists $args{'between_bytes_timeout'} ) {
388 $form_params->{'between_bytes_timeout'} = $self->{api_client}->to_form_value($args{'between_bytes_timeout'});
389 }
390  
391 # form params
392 if ( exists $args{'connect_timeout'} ) {
393 $form_params->{'connect_timeout'} = $self->{api_client}->to_form_value($args{'connect_timeout'});
394 }
395  
396 # form params
397 if ( exists $args{'first_byte_timeout'} ) {
398 $form_params->{'first_byte_timeout'} = $self->{api_client}->to_form_value($args{'first_byte_timeout'});
399 }
400  
401 # form params
402 if ( exists $args{'max_conn_default'} ) {
403 $form_params->{'max_conn_default'} = $self->{api_client}->to_form_value($args{'max_conn_default'});
404 }
405  
406 # form params
407 if ( exists $args{'quorum'} ) {
408 $form_params->{'quorum'} = $self->{api_client}->to_form_value($args{'quorum'});
409 }
410  
411 # form params
412 if ( exists $args{'tls_check_cert'} ) {
413 $form_params->{'tls_check_cert'} = $self->{api_client}->to_form_value($args{'tls_check_cert'});
414 }
415  
416 my $_body_data;
417 # authentication setting, if any
418 my $auth_settings = [qw(token )];
419  
420 # make the API Call
421 my $response = $self->{api_client}->call_api($_resource_path, $_method,
422 $query_params, $form_params,
423 $header_params, $_body_data, $auth_settings);
424 if (!$response) {
425 return;
426 }
427 my $_response_object = $self->{api_client}->deserialize('PoolResponsePost', $response);
428 return $_response_object;
429 }
430  
431 #
432 # delete_server_pool
433 #
434 # Delete a server pool
435 #
436 # @param string $service_id Alphanumeric string identifying the service. (required)
437 # @param int $version_id Integer identifying a service version. (required)
438 # @param string $pool_name Name for the Pool. (required)
439 {
440 my $params = {
441 'service_id' => {
442 data_type => 'string',
443 description => 'Alphanumeric string identifying the service.',
444 required => '1',
445 },
446 'version_id' => {
447 data_type => 'int',
448 description => 'Integer identifying a service version.',
449 required => '1',
450 },
451 'pool_name' => {
452 data_type => 'string',
453 description => 'Name for the Pool.',
454 required => '1',
455 },
456 };
457 __PACKAGE__->method_documentation->{ 'delete_server_pool' } = {
458 summary => 'Delete a server pool',
459 params => $params,
460 returns => 'InlineResponse200',
461 };
462 }
463 # @return InlineResponse200
464 #
465 sub delete_server_pool {
466 my ($self, %args) = @_;
467  
468 # verify the required parameter 'service_id' is set
469 unless (exists $args{'service_id'}) {
470 croak("Missing the required parameter 'service_id' when calling delete_server_pool");
471 }
472  
473 # verify the required parameter 'version_id' is set
474 unless (exists $args{'version_id'}) {
475 croak("Missing the required parameter 'version_id' when calling delete_server_pool");
476 }
477  
478 # verify the required parameter 'pool_name' is set
479 unless (exists $args{'pool_name'}) {
480 croak("Missing the required parameter 'pool_name' when calling delete_server_pool");
481 }
482  
483 # parse inputs
484 my $_resource_path = '/service/{service_id}/version/{version_id}/pool/{pool_name}';
485  
486 my $_method = 'DELETE';
487 my $query_params = {};
488 my $header_params = {};
489 my $form_params = {};
490  
491 # 'Accept' and 'Content-Type' header
492 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
493 if ($_header_accept) {
494 $header_params->{'Accept'} = $_header_accept;
495 }
496 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
497  
498 # path params
499 if ( exists $args{'service_id'}) {
500 my $_base_variable = "{" . "service_id" . "}";
501 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
502 $_resource_path =~ s/$_base_variable/$_base_value/g;
503 }
504  
505 # path params
506 if ( exists $args{'version_id'}) {
507 my $_base_variable = "{" . "version_id" . "}";
508 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
509 $_resource_path =~ s/$_base_variable/$_base_value/g;
510 }
511  
512 # path params
513 if ( exists $args{'pool_name'}) {
514 my $_base_variable = "{" . "pool_name" . "}";
515 my $_base_value = $self->{api_client}->to_path_value($args{'pool_name'});
516 $_resource_path =~ s/$_base_variable/$_base_value/g;
517 }
518  
519 my $_body_data;
520 # authentication setting, if any
521 my $auth_settings = [qw(token )];
522  
523 # make the API Call
524 my $response = $self->{api_client}->call_api($_resource_path, $_method,
525 $query_params, $form_params,
526 $header_params, $_body_data, $auth_settings);
527 if (!$response) {
528 return;
529 }
530 my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
531 return $_response_object;
532 }
533  
534 #
535 # get_server_pool
536 #
537 # Get a server pool
538 #
539 # @param string $service_id Alphanumeric string identifying the service. (required)
540 # @param int $version_id Integer identifying a service version. (required)
541 # @param string $pool_name Name for the Pool. (required)
542 {
543 my $params = {
544 'service_id' => {
545 data_type => 'string',
546 description => 'Alphanumeric string identifying the service.',
547 required => '1',
548 },
549 'version_id' => {
550 data_type => 'int',
551 description => 'Integer identifying a service version.',
552 required => '1',
553 },
554 'pool_name' => {
555 data_type => 'string',
556 description => 'Name for the Pool.',
557 required => '1',
558 },
559 };
560 __PACKAGE__->method_documentation->{ 'get_server_pool' } = {
561 summary => 'Get a server pool',
562 params => $params,
563 returns => 'PoolResponse',
564 };
565 }
566 # @return PoolResponse
567 #
568 sub get_server_pool {
569 my ($self, %args) = @_;
570  
571 # verify the required parameter 'service_id' is set
572 unless (exists $args{'service_id'}) {
573 croak("Missing the required parameter 'service_id' when calling get_server_pool");
574 }
575  
576 # verify the required parameter 'version_id' is set
577 unless (exists $args{'version_id'}) {
578 croak("Missing the required parameter 'version_id' when calling get_server_pool");
579 }
580  
581 # verify the required parameter 'pool_name' is set
582 unless (exists $args{'pool_name'}) {
583 croak("Missing the required parameter 'pool_name' when calling get_server_pool");
584 }
585  
586 # parse inputs
587 my $_resource_path = '/service/{service_id}/version/{version_id}/pool/{pool_name}';
588  
589 my $_method = 'GET';
590 my $query_params = {};
591 my $header_params = {};
592 my $form_params = {};
593  
594 # 'Accept' and 'Content-Type' header
595 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
596 if ($_header_accept) {
597 $header_params->{'Accept'} = $_header_accept;
598 }
599 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
600  
601 # path params
602 if ( exists $args{'service_id'}) {
603 my $_base_variable = "{" . "service_id" . "}";
604 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
605 $_resource_path =~ s/$_base_variable/$_base_value/g;
606 }
607  
608 # path params
609 if ( exists $args{'version_id'}) {
610 my $_base_variable = "{" . "version_id" . "}";
611 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
612 $_resource_path =~ s/$_base_variable/$_base_value/g;
613 }
614  
615 # path params
616 if ( exists $args{'pool_name'}) {
617 my $_base_variable = "{" . "pool_name" . "}";
618 my $_base_value = $self->{api_client}->to_path_value($args{'pool_name'});
619 $_resource_path =~ s/$_base_variable/$_base_value/g;
620 }
621  
622 my $_body_data;
623 # authentication setting, if any
624 my $auth_settings = [qw(token )];
625  
626 # make the API Call
627 my $response = $self->{api_client}->call_api($_resource_path, $_method,
628 $query_params, $form_params,
629 $header_params, $_body_data, $auth_settings);
630 if (!$response) {
631 return;
632 }
633 my $_response_object = $self->{api_client}->deserialize('PoolResponse', $response);
634 return $_response_object;
635 }
636  
637 #
638 # list_server_pools
639 #
640 # List server pools
641 #
642 # @param string $service_id Alphanumeric string identifying the service. (required)
643 # @param int $version_id Integer identifying a service version. (required)
644 {
645 my $params = {
646 'service_id' => {
647 data_type => 'string',
648 description => 'Alphanumeric string identifying the service.',
649 required => '1',
650 },
651 'version_id' => {
652 data_type => 'int',
653 description => 'Integer identifying a service version.',
654 required => '1',
655 },
656 };
657 __PACKAGE__->method_documentation->{ 'list_server_pools' } = {
658 summary => 'List server pools',
659 params => $params,
660 returns => 'ARRAY[PoolResponse]',
661 };
662 }
663 # @return ARRAY[PoolResponse]
664 #
665 sub list_server_pools {
666 my ($self, %args) = @_;
667  
668 # verify the required parameter 'service_id' is set
669 unless (exists $args{'service_id'}) {
670 croak("Missing the required parameter 'service_id' when calling list_server_pools");
671 }
672  
673 # verify the required parameter 'version_id' is set
674 unless (exists $args{'version_id'}) {
675 croak("Missing the required parameter 'version_id' when calling list_server_pools");
676 }
677  
678 # parse inputs
679 my $_resource_path = '/service/{service_id}/version/{version_id}/pool';
680  
681 my $_method = 'GET';
682 my $query_params = {};
683 my $header_params = {};
684 my $form_params = {};
685  
686 # 'Accept' and 'Content-Type' header
687 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
688 if ($_header_accept) {
689 $header_params->{'Accept'} = $_header_accept;
690 }
691 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
692  
693 # path params
694 if ( exists $args{'service_id'}) {
695 my $_base_variable = "{" . "service_id" . "}";
696 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
697 $_resource_path =~ s/$_base_variable/$_base_value/g;
698 }
699  
700 # path params
701 if ( exists $args{'version_id'}) {
702 my $_base_variable = "{" . "version_id" . "}";
703 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
704 $_resource_path =~ s/$_base_variable/$_base_value/g;
705 }
706  
707 my $_body_data;
708 # authentication setting, if any
709 my $auth_settings = [qw(token )];
710  
711 # make the API Call
712 my $response = $self->{api_client}->call_api($_resource_path, $_method,
713 $query_params, $form_params,
714 $header_params, $_body_data, $auth_settings);
715 if (!$response) {
716 return;
717 }
718 my $_response_object = $self->{api_client}->deserialize('ARRAY[PoolResponse]', $response);
719 return $_response_object;
720 }
721  
722 #
723 # update_server_pool
724 #
725 # Update a server pool
726 #
727 # @param string $service_id Alphanumeric string identifying the service. (required)
728 # @param int $version_id Integer identifying a service version. (required)
729 # @param string $pool_name Name for the Pool. (required)
730 # @param string $tls_ca_cert A secure certificate to authenticate a server with. Must be in PEM format. (optional, default to 'null')
731 # @param string $tls_client_cert The client certificate used to make authenticated requests. Must be in PEM format. (optional, default to 'null')
732 # @param string $tls_client_key The client private key used to make authenticated requests. Must be in PEM format. (optional, default to 'null')
733 # @param string $tls_cert_hostname The hostname used to verify a server's certificate. It can either be the Common Name (CN) or a Subject Alternative Name (SAN). (optional, default to 'null')
734 # @param int $use_tls Whether to use TLS. (optional, default to 0)
735 # @param DateTime $created_at Date and time in ISO 8601 format. (optional)
736 # @param DateTime $deleted_at Date and time in ISO 8601 format. (optional)
737 # @param DateTime $updated_at Date and time in ISO 8601 format. (optional)
738 # @param string $service_id (optional)
739 # @param string $version (optional)
740 # @param string $name Name for the Pool. (optional)
741 # @param string $shield Selected POP to serve as a shield for the servers. Defaults to `null` meaning no origin shielding if not set. Refer to the [POPs API endpoint](https://www.fastly.com/documentation/reference/api/utils/pops/) to get a list of available POPs used for shielding. (optional, default to 'null')
742 # @param string $request_condition Condition which, if met, will select this configuration during a request. Optional. (optional)
743 # @param string $tls_ciphers List of OpenSSL ciphers (see the [openssl.org manpages](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) for details). Optional. (optional)
744 # @param string $tls_sni_hostname SNI hostname. Optional. (optional)
745 # @param int $min_tls_version Minimum allowed TLS version on connections to this server. Optional. (optional)
746 # @param int $max_tls_version Maximum allowed TLS version on connections to this server. Optional. (optional)
747 # @param string $healthcheck Name of the healthcheck to use with this pool. Can be empty and could be reused across multiple backend and pools. (optional)
748 # @param string $comment A freeform descriptive note. (optional)
749 # @param string $type What type of load balance group to use. (optional)
750 # @param string $override_host The hostname to [override the Host header](https://www.fastly.com/documentation/guides/full-site-delivery/domains-and-origins/specifying-an-override-host/). Defaults to `null` meaning no override of the Host header will occur. This setting can also be added to a Server definition. If the field is set on a Server definition it will override the Pool setting. (optional, default to 'null')
751 # @param int $between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using `bereq.between_bytes_timeout`. (optional, default to 10000)
752 # @param int $connect_timeout How long to wait for a timeout in milliseconds. Optional. (optional)
753 # @param int $first_byte_timeout How long to wait for the first byte in milliseconds. Optional. (optional)
754 # @param int $max_conn_default Maximum number of connections. Optional. (optional, default to 200)
755 # @param int $quorum Percentage of capacity (`0-100`) that needs to be operationally available for a pool to be considered up. (optional, default to 75)
756 # @param int $tls_check_cert Be strict on checking TLS certs. Optional. (optional)
757 {
758 my $params = {
759 'service_id' => {
760 data_type => 'string',
761 description => 'Alphanumeric string identifying the service.',
762 required => '1',
763 },
764 'version_id' => {
765 data_type => 'int',
766 description => 'Integer identifying a service version.',
767 required => '1',
768 },
769 'pool_name' => {
770 data_type => 'string',
771 description => 'Name for the Pool.',
772 required => '1',
773 },
774 'tls_ca_cert' => {
775 data_type => 'string',
776 description => 'A secure certificate to authenticate a server with. Must be in PEM format.',
777 required => '0',
778 },
779 'tls_client_cert' => {
780 data_type => 'string',
781 description => 'The client certificate used to make authenticated requests. Must be in PEM format.',
782 required => '0',
783 },
784 'tls_client_key' => {
785 data_type => 'string',
786 description => 'The client private key used to make authenticated requests. Must be in PEM format.',
787 required => '0',
788 },
789 'tls_cert_hostname' => {
790 data_type => 'string',
791 description => 'The hostname used to verify a server's certificate. It can either be the Common Name (CN) or a Subject Alternative Name (SAN).',
792 required => '0',
793 },
794 'use_tls' => {
795 data_type => 'int',
796 description => 'Whether to use TLS.',
797 required => '0',
798 },
799 'created_at' => {
800 data_type => 'DateTime',
801 description => 'Date and time in ISO 8601 format.',
802 required => '0',
803 },
804 'deleted_at' => {
805 data_type => 'DateTime',
806 description => 'Date and time in ISO 8601 format.',
807 required => '0',
808 },
809 'updated_at' => {
810 data_type => 'DateTime',
811 description => 'Date and time in ISO 8601 format.',
812 required => '0',
813 },
814 'service_id' => {
815 data_type => 'string',
816 description => '',
817 required => '0',
818 },
819 'version' => {
820 data_type => 'string',
821 description => '',
822 required => '0',
823 },
824 'name' => {
825 data_type => 'string',
826 description => 'Name for the Pool.',
827 required => '0',
828 },
829 'shield' => {
830 data_type => 'string',
831 description => 'Selected POP to serve as a shield for the servers. Defaults to `null` meaning no origin shielding if not set. Refer to the [POPs API endpoint](https://www.fastly.com/documentation/reference/api/utils/pops/) to get a list of available POPs used for shielding.',
832 required => '0',
833 },
834 'request_condition' => {
835 data_type => 'string',
836 description => 'Condition which, if met, will select this configuration during a request. Optional.',
837 required => '0',
838 },
839 'tls_ciphers' => {
840 data_type => 'string',
841 description => 'List of OpenSSL ciphers (see the [openssl.org manpages](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) for details). Optional.',
842 required => '0',
843 },
844 'tls_sni_hostname' => {
845 data_type => 'string',
846 description => 'SNI hostname. Optional.',
847 required => '0',
848 },
849 'min_tls_version' => {
850 data_type => 'int',
851 description => 'Minimum allowed TLS version on connections to this server. Optional.',
852 required => '0',
853 },
854 'max_tls_version' => {
855 data_type => 'int',
856 description => 'Maximum allowed TLS version on connections to this server. Optional.',
857 required => '0',
858 },
859 'healthcheck' => {
860 data_type => 'string',
861 description => 'Name of the healthcheck to use with this pool. Can be empty and could be reused across multiple backend and pools.',
862 required => '0',
863 },
864 'comment' => {
865 data_type => 'string',
866 description => 'A freeform descriptive note.',
867 required => '0',
868 },
869 'type' => {
870 data_type => 'string',
871 description => 'What type of load balance group to use.',
872 required => '0',
873 },
874 'override_host' => {
875 data_type => 'string',
876 description => 'The hostname to [override the Host header](https://www.fastly.com/documentation/guides/full-site-delivery/domains-and-origins/specifying-an-override-host/). Defaults to `null` meaning no override of the Host header will occur. This setting can also be added to a Server definition. If the field is set on a Server definition it will override the Pool setting.',
877 required => '0',
878 },
879 'between_bytes_timeout' => {
880 data_type => 'int',
881 description => 'Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using `bereq.between_bytes_timeout`.',
882 required => '0',
883 },
884 'connect_timeout' => {
885 data_type => 'int',
886 description => 'How long to wait for a timeout in milliseconds. Optional.',
887 required => '0',
888 },
889 'first_byte_timeout' => {
890 data_type => 'int',
891 description => 'How long to wait for the first byte in milliseconds. Optional.',
892 required => '0',
893 },
894 'max_conn_default' => {
895 data_type => 'int',
896 description => 'Maximum number of connections. Optional.',
897 required => '0',
898 },
899 'quorum' => {
900 data_type => 'int',
901 description => 'Percentage of capacity (`0-100`) that needs to be operationally available for a pool to be considered up.',
902 required => '0',
903 },
904 'tls_check_cert' => {
905 data_type => 'int',
906 description => 'Be strict on checking TLS certs. Optional.',
907 required => '0',
908 },
909 };
910 __PACKAGE__->method_documentation->{ 'update_server_pool' } = {
911 summary => 'Update a server pool',
912 params => $params,
913 returns => 'PoolResponse',
914 };
915 }
916 # @return PoolResponse
917 #
918 sub update_server_pool {
919 my ($self, %args) = @_;
920  
921 # verify the required parameter 'service_id' is set
922 unless (exists $args{'service_id'}) {
923 croak("Missing the required parameter 'service_id' when calling update_server_pool");
924 }
925  
926 # verify the required parameter 'version_id' is set
927 unless (exists $args{'version_id'}) {
928 croak("Missing the required parameter 'version_id' when calling update_server_pool");
929 }
930  
931 # verify the required parameter 'pool_name' is set
932 unless (exists $args{'pool_name'}) {
933 croak("Missing the required parameter 'pool_name' when calling update_server_pool");
934 }
935  
936 # parse inputs
937 my $_resource_path = '/service/{service_id}/version/{version_id}/pool/{pool_name}';
938  
939 my $_method = 'PUT';
940 my $query_params = {};
941 my $header_params = {};
942 my $form_params = {};
943  
944 # 'Accept' and 'Content-Type' header
945 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
946 if ($_header_accept) {
947 $header_params->{'Accept'} = $_header_accept;
948 }
949 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
950  
951 # path params
952 if ( exists $args{'service_id'}) {
953 my $_base_variable = "{" . "service_id" . "}";
954 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
955 $_resource_path =~ s/$_base_variable/$_base_value/g;
956 }
957  
958 # path params
959 if ( exists $args{'version_id'}) {
960 my $_base_variable = "{" . "version_id" . "}";
961 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
962 $_resource_path =~ s/$_base_variable/$_base_value/g;
963 }
964  
965 # path params
966 if ( exists $args{'pool_name'}) {
967 my $_base_variable = "{" . "pool_name" . "}";
968 my $_base_value = $self->{api_client}->to_path_value($args{'pool_name'});
969 $_resource_path =~ s/$_base_variable/$_base_value/g;
970 }
971  
972 # form params
973 if ( exists $args{'tls_ca_cert'} ) {
974 $form_params->{'tls_ca_cert'} = $self->{api_client}->to_form_value($args{'tls_ca_cert'});
975 }
976  
977 # form params
978 if ( exists $args{'tls_client_cert'} ) {
979 $form_params->{'tls_client_cert'} = $self->{api_client}->to_form_value($args{'tls_client_cert'});
980 }
981  
982 # form params
983 if ( exists $args{'tls_client_key'} ) {
984 $form_params->{'tls_client_key'} = $self->{api_client}->to_form_value($args{'tls_client_key'});
985 }
986  
987 # form params
988 if ( exists $args{'tls_cert_hostname'} ) {
989 $form_params->{'tls_cert_hostname'} = $self->{api_client}->to_form_value($args{'tls_cert_hostname'});
990 }
991  
992 # form params
993 if ( exists $args{'use_tls'} ) {
994 $form_params->{'use_tls'} = $self->{api_client}->to_form_value($args{'use_tls'});
995 }
996  
997 # form params
998 if ( exists $args{'created_at'} ) {
999 $form_params->{'created_at'} = $self->{api_client}->to_form_value($args{'created_at'});
1000 }
1001  
1002 # form params
1003 if ( exists $args{'deleted_at'} ) {
1004 $form_params->{'deleted_at'} = $self->{api_client}->to_form_value($args{'deleted_at'});
1005 }
1006  
1007 # form params
1008 if ( exists $args{'updated_at'} ) {
1009 $form_params->{'updated_at'} = $self->{api_client}->to_form_value($args{'updated_at'});
1010 }
1011  
1012 # form params
1013 if ( exists $args{'service_id'} ) {
1014 $form_params->{'service_id'} = $self->{api_client}->to_form_value($args{'service_id'});
1015 }
1016  
1017 # form params
1018 if ( exists $args{'version'} ) {
1019 $form_params->{'version'} = $self->{api_client}->to_form_value($args{'version'});
1020 }
1021  
1022 # form params
1023 if ( exists $args{'name'} ) {
1024 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
1025 }
1026  
1027 # form params
1028 if ( exists $args{'shield'} ) {
1029 $form_params->{'shield'} = $self->{api_client}->to_form_value($args{'shield'});
1030 }
1031  
1032 # form params
1033 if ( exists $args{'request_condition'} ) {
1034 $form_params->{'request_condition'} = $self->{api_client}->to_form_value($args{'request_condition'});
1035 }
1036  
1037 # form params
1038 if ( exists $args{'tls_ciphers'} ) {
1039 $form_params->{'tls_ciphers'} = $self->{api_client}->to_form_value($args{'tls_ciphers'});
1040 }
1041  
1042 # form params
1043 if ( exists $args{'tls_sni_hostname'} ) {
1044 $form_params->{'tls_sni_hostname'} = $self->{api_client}->to_form_value($args{'tls_sni_hostname'});
1045 }
1046  
1047 # form params
1048 if ( exists $args{'min_tls_version'} ) {
1049 $form_params->{'min_tls_version'} = $self->{api_client}->to_form_value($args{'min_tls_version'});
1050 }
1051  
1052 # form params
1053 if ( exists $args{'max_tls_version'} ) {
1054 $form_params->{'max_tls_version'} = $self->{api_client}->to_form_value($args{'max_tls_version'});
1055 }
1056  
1057 # form params
1058 if ( exists $args{'healthcheck'} ) {
1059 $form_params->{'healthcheck'} = $self->{api_client}->to_form_value($args{'healthcheck'});
1060 }
1061  
1062 # form params
1063 if ( exists $args{'comment'} ) {
1064 $form_params->{'comment'} = $self->{api_client}->to_form_value($args{'comment'});
1065 }
1066  
1067 # form params
1068 if ( exists $args{'type'} ) {
1069 $form_params->{'type'} = $self->{api_client}->to_form_value($args{'type'});
1070 }
1071  
1072 # form params
1073 if ( exists $args{'override_host'} ) {
1074 $form_params->{'override_host'} = $self->{api_client}->to_form_value($args{'override_host'});
1075 }
1076  
1077 # form params
1078 if ( exists $args{'between_bytes_timeout'} ) {
1079 $form_params->{'between_bytes_timeout'} = $self->{api_client}->to_form_value($args{'between_bytes_timeout'});
1080 }
1081  
1082 # form params
1083 if ( exists $args{'connect_timeout'} ) {
1084 $form_params->{'connect_timeout'} = $self->{api_client}->to_form_value($args{'connect_timeout'});
1085 }
1086  
1087 # form params
1088 if ( exists $args{'first_byte_timeout'} ) {
1089 $form_params->{'first_byte_timeout'} = $self->{api_client}->to_form_value($args{'first_byte_timeout'});
1090 }
1091  
1092 # form params
1093 if ( exists $args{'max_conn_default'} ) {
1094 $form_params->{'max_conn_default'} = $self->{api_client}->to_form_value($args{'max_conn_default'});
1095 }
1096  
1097 # form params
1098 if ( exists $args{'quorum'} ) {
1099 $form_params->{'quorum'} = $self->{api_client}->to_form_value($args{'quorum'});
1100 }
1101  
1102 # form params
1103 if ( exists $args{'tls_check_cert'} ) {
1104 $form_params->{'tls_check_cert'} = $self->{api_client}->to_form_value($args{'tls_check_cert'});
1105 }
1106  
1107 my $_body_data;
1108 # authentication setting, if any
1109 my $auth_settings = [qw(token )];
1110  
1111 # make the API Call
1112 my $response = $self->{api_client}->call_api($_resource_path, $_method,
1113 $query_params, $form_params,
1114 $header_params, $_body_data, $auth_settings);
1115 if (!$response) {
1116 return;
1117 }
1118 my $_response_object = $self->{api_client}->deserialize('PoolResponse', $response);
1119 return $_response_object;
1120 }
1121  
1122 1;