Fastly/BackendApi.pm untested

filter: Statementstmt 0.0% 0 / 398 Branchbran 0.0% 0 / 250 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 / 678 CC 126 SCAR 76.3
CC
126
Cov
0%
update_backend
2862.0
create_backend
2652.0
delete_backend
90.0
CRAP 2064.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::BackendApi;
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_backend
51 #
52 # Create a backend
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 $address A hostname, IPv4, or IPv6 address for the backend. This is the preferred way to specify the location of your backend. (optional)
57 # @param boolean $auto_loadbalance Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don't have a `request_condition` will be selected based on their `weight`. (optional)
58 # @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)
59 # @param string $client_cert Unused. (optional)
60 # @param string $comment A freeform descriptive note. (optional)
61 # @param int $connect_timeout Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. (optional)
62 # @param int $first_byte_timeout Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. (optional)
63 # @param int $fetch_timeout Maximum duration in milliseconds to wait for the entire response to be received after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.fetch_timeout`. (optional)
64 # @param string $healthcheck The name of the healthcheck to use with this backend. (optional)
65 # @param string $hostname The hostname of the backend. May be used as an alternative to `address` to set the backend location. (optional)
66 # @param string $iam_external_id If the backend is using IAM authentication and the IAM system policy requires a matching external identifier, it should match this value. Your Fastly customer ID will be used if this attribute is not set. (optional)
67 # @param string $iam_product If the backend is using IAM authentication, the IAM signature will use this as the product element. (optional)
68 # @param string $iam_region If the backend is using IAM authentication, this region will be used for signing and access. (optional)
69 # @param string $iam_role If the backend is using IAM authentication, the fully qualified role string supplied by the storage vendor. (optional)
70 # @param string $iam_vendor A label that identifies the storage vendor. Providing a value in this field enables IAM usage, and all other IAM fields depend on its value. (optional)
71 # @param string $ipv4 IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. (optional)
72 # @param string $ipv6 IPv6 address of the backend. May be used as an alternative to `address` to set the backend location. (optional)
73 # @param int $keepalive_time How long (in seconds) to keep a persistent connection to the backend between requests. By default, Fastly keeps connections open as long as it can. (optional)
74 # @param int $max_conn Maximum number of concurrent connections this backend will accept. (optional)
75 # @param int $max_lifetime Maximum time from creation (in milliseconds) that a pooled HTTP keepalive connection will be eligible for reuse; 0 is treated as unlimited. (optional)
76 # @param string $max_tls_version Maximum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated. (optional)
77 # @param string $min_tls_version Minimum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated. (optional)
78 # @param int $max_use Maximum number of requests allowed over a single, pooled HTTP keepalive connection to this backend; 0 is treated as unlimited. (optional)
79 # @param string $name The name of the backend. (optional)
80 # @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional)
81 # @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional)
82 # @param boolean $prefer_ipv6 Prefer IPv6 connections to origins for hostname backends. Default is 'false' for Delivery services and 'true' for Compute services. (optional)
83 # @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional)
84 # @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional)
85 # @param string $shield Identifier of the POP to use as a [shield](https://www.fastly.com/documentation/guides/getting-started/hosts/shielding/). (optional)
86 # @param string $ssl_ca_cert CA certificate attached to origin. (optional)
87 # @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional)
88 # @param boolean $ssl_check_cert Be strict on checking SSL certs. (optional, default to true)
89 # @param string $ssl_ciphers List of [OpenSSL ciphers](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated. (optional)
90 # @param string $ssl_client_cert Client certificate attached to origin. (optional)
91 # @param string $ssl_client_key Client key attached to origin. (optional)
92 # @param string $ssl_hostname Use `ssl_cert_hostname` and `ssl_sni_hostname` to configure certificate validation. (optional)
93 # @param string $ssl_sni_hostname Overrides `ssl_hostname`, but only for SNI in the handshake. Does not affect cert validation at all. (optional)
94 # @param boolean $tcp_keepalive_enable Whether to enable TCP keepalives for backend connections. Varnish defaults to using keepalives if this is unspecified. (optional)
95 # @param int $tcp_keepalive_interval Interval in seconds between subsequent keepalive probes. (optional, default to 10)
96 # @param int $tcp_keepalive_probes Number of unacknowledged probes to send before considering the connection dead. (optional, default to 3)
97 # @param int $tcp_keepalive_time Interval in seconds between the last data packet sent and the first keepalive probe. (optional, default to 300)
98 # @param boolean $use_ssl Whether or not to require TLS for connections to this backend. (optional)
99 # @param int $weight Weight used to load balance this backend against others. May be any positive integer. If `auto_loadbalance` is true, the chance of this backend being selected is equal to its own weight over the sum of all weights for backends that have `auto_loadbalance` set to true. (optional)
100 {
101 my $params = {
102 'service_id' => {
103 data_type => 'string',
104 description => 'Alphanumeric string identifying the service.',
105 required => '1',
106 },
107 'version_id' => {
108 data_type => 'int',
109 description => 'Integer identifying a service version.',
110 required => '1',
111 },
112 'address' => {
113 data_type => 'string',
114 description => 'A hostname, IPv4, or IPv6 address for the backend. This is the preferred way to specify the location of your backend.',
115 required => '0',
116 },
117 'auto_loadbalance' => {
118 data_type => 'boolean',
119 description => 'Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don't have a `request_condition` will be selected based on their `weight`.',
120 required => '0',
121 },
122 'between_bytes_timeout' => {
123 data_type => 'int',
124 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`.',
125 required => '0',
126 },
127 'client_cert' => {
128 data_type => 'string',
129 description => 'Unused.',
130 required => '0',
131 },
132 'comment' => {
133 data_type => 'string',
134 description => 'A freeform descriptive note.',
135 required => '0',
136 },
137 'connect_timeout' => {
138 data_type => 'int',
139 description => 'Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`.',
140 required => '0',
141 },
142 'first_byte_timeout' => {
143 data_type => 'int',
144 description => 'Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`.',
145 required => '0',
146 },
147 'fetch_timeout' => {
148 data_type => 'int',
149 description => 'Maximum duration in milliseconds to wait for the entire response to be received after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.fetch_timeout`.',
150 required => '0',
151 },
152 'healthcheck' => {
153 data_type => 'string',
154 description => 'The name of the healthcheck to use with this backend.',
155 required => '0',
156 },
157 'hostname' => {
158 data_type => 'string',
159 description => 'The hostname of the backend. May be used as an alternative to `address` to set the backend location.',
160 required => '0',
161 },
162 'iam_external_id' => {
163 data_type => 'string',
164 description => 'If the backend is using IAM authentication and the IAM system policy requires a matching external identifier, it should match this value. Your Fastly customer ID will be used if this attribute is not set.',
165 required => '0',
166 },
167 'iam_product' => {
168 data_type => 'string',
169 description => 'If the backend is using IAM authentication, the IAM signature will use this as the product element.',
170 required => '0',
171 },
172 'iam_region' => {
173 data_type => 'string',
174 description => 'If the backend is using IAM authentication, this region will be used for signing and access.',
175 required => '0',
176 },
177 'iam_role' => {
178 data_type => 'string',
179 description => 'If the backend is using IAM authentication, the fully qualified role string supplied by the storage vendor.',
180 required => '0',
181 },
182 'iam_vendor' => {
183 data_type => 'string',
184 description => 'A label that identifies the storage vendor. Providing a value in this field enables IAM usage, and all other IAM fields depend on its value.',
185 required => '0',
186 },
187 'ipv4' => {
188 data_type => 'string',
189 description => 'IPv4 address of the backend. May be used as an alternative to `address` to set the backend location.',
190 required => '0',
191 },
192 'ipv6' => {
193 data_type => 'string',
194 description => 'IPv6 address of the backend. May be used as an alternative to `address` to set the backend location.',
195 required => '0',
196 },
197 'keepalive_time' => {
198 data_type => 'int',
199 description => 'How long (in seconds) to keep a persistent connection to the backend between requests. By default, Fastly keeps connections open as long as it can.',
200 required => '0',
201 },
202 'max_conn' => {
203 data_type => 'int',
204 description => 'Maximum number of concurrent connections this backend will accept.',
205 required => '0',
206 },
207 'max_lifetime' => {
208 data_type => 'int',
209 description => 'Maximum time from creation (in milliseconds) that a pooled HTTP keepalive connection will be eligible for reuse; 0 is treated as unlimited.',
210 required => '0',
211 },
212 'max_tls_version' => {
213 data_type => 'string',
214 description => 'Maximum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.',
215 required => '0',
216 },
217 'min_tls_version' => {
218 data_type => 'string',
219 description => 'Minimum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.',
220 required => '0',
221 },
222 'max_use' => {
223 data_type => 'int',
224 description => 'Maximum number of requests allowed over a single, pooled HTTP keepalive connection to this backend; 0 is treated as unlimited.',
225 required => '0',
226 },
227 'name' => {
228 data_type => 'string',
229 description => 'The name of the backend.',
230 required => '0',
231 },
232 'override_host' => {
233 data_type => 'string',
234 description => 'If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL.',
235 required => '0',
236 },
237 'port' => {
238 data_type => 'int',
239 description => 'Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request.',
240 required => '0',
241 },
242 'prefer_ipv6' => {
243 data_type => 'boolean',
244 description => 'Prefer IPv6 connections to origins for hostname backends. Default is 'false' for Delivery services and 'true' for Compute services.',
245 required => '0',
246 },
247 'request_condition' => {
248 data_type => 'string',
249 description => 'Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests.',
250 required => '0',
251 },
252 'share_key' => {
253 data_type => 'string',
254 description => 'Value that when shared across backends will enable those backends to share the same health check.',
255 required => '0',
256 },
257 'shield' => {
258 data_type => 'string',
259 description => 'Identifier of the POP to use as a [shield](https://www.fastly.com/documentation/guides/getting-started/hosts/shielding/).',
260 required => '0',
261 },
262 'ssl_ca_cert' => {
263 data_type => 'string',
264 description => 'CA certificate attached to origin.',
265 required => '0',
266 },
267 'ssl_cert_hostname' => {
268 data_type => 'string',
269 description => 'Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all.',
270 required => '0',
271 },
272 'ssl_check_cert' => {
273 data_type => 'boolean',
274 description => 'Be strict on checking SSL certs.',
275 required => '0',
276 },
277 'ssl_ciphers' => {
278 data_type => 'string',
279 description => 'List of [OpenSSL ciphers](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.',
280 required => '0',
281 },
282 'ssl_client_cert' => {
283 data_type => 'string',
284 description => 'Client certificate attached to origin.',
285 required => '0',
286 },
287 'ssl_client_key' => {
288 data_type => 'string',
289 description => 'Client key attached to origin.',
290 required => '0',
291 },
292 'ssl_hostname' => {
293 data_type => 'string',
294 description => 'Use `ssl_cert_hostname` and `ssl_sni_hostname` to configure certificate validation.',
295 required => '0',
296 },
297 'ssl_sni_hostname' => {
298 data_type => 'string',
299 description => 'Overrides `ssl_hostname`, but only for SNI in the handshake. Does not affect cert validation at all.',
300 required => '0',
301 },
302 'tcp_keepalive_enable' => {
303 data_type => 'boolean',
304 description => 'Whether to enable TCP keepalives for backend connections. Varnish defaults to using keepalives if this is unspecified.',
305 required => '0',
306 },
307 'tcp_keepalive_interval' => {
308 data_type => 'int',
309 description => 'Interval in seconds between subsequent keepalive probes.',
310 required => '0',
311 },
312 'tcp_keepalive_probes' => {
313 data_type => 'int',
314 description => 'Number of unacknowledged probes to send before considering the connection dead.',
315 required => '0',
316 },
317 'tcp_keepalive_time' => {
318 data_type => 'int',
319 description => 'Interval in seconds between the last data packet sent and the first keepalive probe.',
320 required => '0',
321 },
322 'use_ssl' => {
323 data_type => 'boolean',
324 description => 'Whether or not to require TLS for connections to this backend.',
325 required => '0',
326 },
327 'weight' => {
328 data_type => 'int',
329 description => 'Weight used to load balance this backend against others. May be any positive integer. If `auto_loadbalance` is true, the chance of this backend being selected is equal to its own weight over the sum of all weights for backends that have `auto_loadbalance` set to true.',
330 required => '0',
331 },
332 };
333 __PACKAGE__->method_documentation->{ 'create_backend' } = {
334 summary => 'Create a backend',
335 params => $params,
336 returns => 'BackendResponse',
337 };
338 }
339 # @return BackendResponse
340 #
341 sub create_backend {
342 my ($self, %args) = @_;
343  
344 # verify the required parameter 'service_id' is set
345 unless (exists $args{'service_id'}) {
346 croak("Missing the required parameter 'service_id' when calling create_backend");
347 }
348  
349 # verify the required parameter 'version_id' is set
350 unless (exists $args{'version_id'}) {
351 croak("Missing the required parameter 'version_id' when calling create_backend");
352 }
353  
354 # parse inputs
355 my $_resource_path = '/service/{service_id}/version/{version_id}/backend';
356  
357 my $_method = 'POST';
358 my $query_params = {};
359 my $header_params = {};
360 my $form_params = {};
361  
362 # 'Accept' and 'Content-Type' header
363 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
364 if ($_header_accept) {
365 $header_params->{'Accept'} = $_header_accept;
366 }
367 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
368  
369 # path params
370 if ( exists $args{'service_id'}) {
371 my $_base_variable = "{" . "service_id" . "}";
372 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
373 $_resource_path =~ s/$_base_variable/$_base_value/g;
374 }
375  
376 # path params
377 if ( exists $args{'version_id'}) {
378 my $_base_variable = "{" . "version_id" . "}";
379 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
380 $_resource_path =~ s/$_base_variable/$_base_value/g;
381 }
382  
383 # form params
384 if ( exists $args{'address'} ) {
385 $form_params->{'address'} = $self->{api_client}->to_form_value($args{'address'});
386 }
387  
388 # form params
389 if ( exists $args{'auto_loadbalance'} ) {
390 $form_params->{'auto_loadbalance'} = $self->{api_client}->to_form_value($args{'auto_loadbalance'});
391 }
392  
393 # form params
394 if ( exists $args{'between_bytes_timeout'} ) {
395 $form_params->{'between_bytes_timeout'} = $self->{api_client}->to_form_value($args{'between_bytes_timeout'});
396 }
397  
398 # form params
399 if ( exists $args{'client_cert'} ) {
400 $form_params->{'client_cert'} = $self->{api_client}->to_form_value($args{'client_cert'});
401 }
402  
403 # form params
404 if ( exists $args{'comment'} ) {
405 $form_params->{'comment'} = $self->{api_client}->to_form_value($args{'comment'});
406 }
407  
408 # form params
409 if ( exists $args{'connect_timeout'} ) {
410 $form_params->{'connect_timeout'} = $self->{api_client}->to_form_value($args{'connect_timeout'});
411 }
412  
413 # form params
414 if ( exists $args{'first_byte_timeout'} ) {
415 $form_params->{'first_byte_timeout'} = $self->{api_client}->to_form_value($args{'first_byte_timeout'});
416 }
417  
418 # form params
419 if ( exists $args{'fetch_timeout'} ) {
420 $form_params->{'fetch_timeout'} = $self->{api_client}->to_form_value($args{'fetch_timeout'});
421 }
422  
423 # form params
424 if ( exists $args{'healthcheck'} ) {
425 $form_params->{'healthcheck'} = $self->{api_client}->to_form_value($args{'healthcheck'});
426 }
427  
428 # form params
429 if ( exists $args{'hostname'} ) {
430 $form_params->{'hostname'} = $self->{api_client}->to_form_value($args{'hostname'});
431 }
432  
433 # form params
434 if ( exists $args{'iam_external_id'} ) {
435 $form_params->{'iam_external_id'} = $self->{api_client}->to_form_value($args{'iam_external_id'});
436 }
437  
438 # form params
439 if ( exists $args{'iam_product'} ) {
440 $form_params->{'iam_product'} = $self->{api_client}->to_form_value($args{'iam_product'});
441 }
442  
443 # form params
444 if ( exists $args{'iam_region'} ) {
445 $form_params->{'iam_region'} = $self->{api_client}->to_form_value($args{'iam_region'});
446 }
447  
448 # form params
449 if ( exists $args{'iam_role'} ) {
450 $form_params->{'iam_role'} = $self->{api_client}->to_form_value($args{'iam_role'});
451 }
452  
453 # form params
454 if ( exists $args{'iam_vendor'} ) {
455 $form_params->{'iam_vendor'} = $self->{api_client}->to_form_value($args{'iam_vendor'});
456 }
457  
458 # form params
459 if ( exists $args{'ipv4'} ) {
460 $form_params->{'ipv4'} = $self->{api_client}->to_form_value($args{'ipv4'});
461 }
462  
463 # form params
464 if ( exists $args{'ipv6'} ) {
465 $form_params->{'ipv6'} = $self->{api_client}->to_form_value($args{'ipv6'});
466 }
467  
468 # form params
469 if ( exists $args{'keepalive_time'} ) {
470 $form_params->{'keepalive_time'} = $self->{api_client}->to_form_value($args{'keepalive_time'});
471 }
472  
473 # form params
474 if ( exists $args{'max_conn'} ) {
475 $form_params->{'max_conn'} = $self->{api_client}->to_form_value($args{'max_conn'});
476 }
477  
478 # form params
479 if ( exists $args{'max_lifetime'} ) {
480 $form_params->{'max_lifetime'} = $self->{api_client}->to_form_value($args{'max_lifetime'});
481 }
482  
483 # form params
484 if ( exists $args{'max_tls_version'} ) {
485 $form_params->{'max_tls_version'} = $self->{api_client}->to_form_value($args{'max_tls_version'});
486 }
487  
488 # form params
489 if ( exists $args{'min_tls_version'} ) {
490 $form_params->{'min_tls_version'} = $self->{api_client}->to_form_value($args{'min_tls_version'});
491 }
492  
493 # form params
494 if ( exists $args{'max_use'} ) {
495 $form_params->{'max_use'} = $self->{api_client}->to_form_value($args{'max_use'});
496 }
497  
498 # form params
499 if ( exists $args{'name'} ) {
500 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
501 }
502  
503 # form params
504 if ( exists $args{'override_host'} ) {
505 $form_params->{'override_host'} = $self->{api_client}->to_form_value($args{'override_host'});
506 }
507  
508 # form params
509 if ( exists $args{'port'} ) {
510 $form_params->{'port'} = $self->{api_client}->to_form_value($args{'port'});
511 }
512  
513 # form params
514 if ( exists $args{'prefer_ipv6'} ) {
515 $form_params->{'prefer_ipv6'} = $self->{api_client}->to_form_value($args{'prefer_ipv6'});
516 }
517  
518 # form params
519 if ( exists $args{'request_condition'} ) {
520 $form_params->{'request_condition'} = $self->{api_client}->to_form_value($args{'request_condition'});
521 }
522  
523 # form params
524 if ( exists $args{'share_key'} ) {
525 $form_params->{'share_key'} = $self->{api_client}->to_form_value($args{'share_key'});
526 }
527  
528 # form params
529 if ( exists $args{'shield'} ) {
530 $form_params->{'shield'} = $self->{api_client}->to_form_value($args{'shield'});
531 }
532  
533 # form params
534 if ( exists $args{'ssl_ca_cert'} ) {
535 $form_params->{'ssl_ca_cert'} = $self->{api_client}->to_form_value($args{'ssl_ca_cert'});
536 }
537  
538 # form params
539 if ( exists $args{'ssl_cert_hostname'} ) {
540 $form_params->{'ssl_cert_hostname'} = $self->{api_client}->to_form_value($args{'ssl_cert_hostname'});
541 }
542  
543 # form params
544 if ( exists $args{'ssl_check_cert'} ) {
545 $form_params->{'ssl_check_cert'} = $self->{api_client}->to_form_value($args{'ssl_check_cert'});
546 }
547  
548 # form params
549 if ( exists $args{'ssl_ciphers'} ) {
550 $form_params->{'ssl_ciphers'} = $self->{api_client}->to_form_value($args{'ssl_ciphers'});
551 }
552  
553 # form params
554 if ( exists $args{'ssl_client_cert'} ) {
555 $form_params->{'ssl_client_cert'} = $self->{api_client}->to_form_value($args{'ssl_client_cert'});
556 }
557  
558 # form params
559 if ( exists $args{'ssl_client_key'} ) {
560 $form_params->{'ssl_client_key'} = $self->{api_client}->to_form_value($args{'ssl_client_key'});
561 }
562  
563 # form params
564 if ( exists $args{'ssl_hostname'} ) {
565 $form_params->{'ssl_hostname'} = $self->{api_client}->to_form_value($args{'ssl_hostname'});
566 }
567  
568 # form params
569 if ( exists $args{'ssl_sni_hostname'} ) {
570 $form_params->{'ssl_sni_hostname'} = $self->{api_client}->to_form_value($args{'ssl_sni_hostname'});
571 }
572  
573 # form params
574 if ( exists $args{'tcp_keepalive_enable'} ) {
575 $form_params->{'tcp_keepalive_enable'} = $self->{api_client}->to_form_value($args{'tcp_keepalive_enable'});
576 }
577  
578 # form params
579 if ( exists $args{'tcp_keepalive_interval'} ) {
580 $form_params->{'tcp_keepalive_interval'} = $self->{api_client}->to_form_value($args{'tcp_keepalive_interval'});
581 }
582  
583 # form params
584 if ( exists $args{'tcp_keepalive_probes'} ) {
585 $form_params->{'tcp_keepalive_probes'} = $self->{api_client}->to_form_value($args{'tcp_keepalive_probes'});
586 }
587  
588 # form params
589 if ( exists $args{'tcp_keepalive_time'} ) {
590 $form_params->{'tcp_keepalive_time'} = $self->{api_client}->to_form_value($args{'tcp_keepalive_time'});
591 }
592  
593 # form params
594 if ( exists $args{'use_ssl'} ) {
595 $form_params->{'use_ssl'} = $self->{api_client}->to_form_value($args{'use_ssl'});
596 }
597  
598 # form params
599 if ( exists $args{'weight'} ) {
600 $form_params->{'weight'} = $self->{api_client}->to_form_value($args{'weight'});
601 }
602  
603 my $_body_data;
604 # authentication setting, if any
605 my $auth_settings = [qw(token )];
606  
607 # make the API Call
608 my $response = $self->{api_client}->call_api($_resource_path, $_method,
609 $query_params, $form_params,
610 $header_params, $_body_data, $auth_settings);
611 if (!$response) {
612 return;
613 }
614 my $_response_object = $self->{api_client}->deserialize('BackendResponse', $response);
615 return $_response_object;
616 }
617  
618 #
619 # delete_backend
620 #
621 # Delete a backend
622 #
623 # @param string $service_id Alphanumeric string identifying the service. (required)
624 # @param int $version_id Integer identifying a service version. (required)
625 # @param string $backend_name The name of the backend. (required)
626 {
627 my $params = {
628 'service_id' => {
629 data_type => 'string',
630 description => 'Alphanumeric string identifying the service.',
631 required => '1',
632 },
633 'version_id' => {
634 data_type => 'int',
635 description => 'Integer identifying a service version.',
636 required => '1',
637 },
638 'backend_name' => {
639 data_type => 'string',
640 description => 'The name of the backend.',
641 required => '1',
642 },
643 };
644 __PACKAGE__->method_documentation->{ 'delete_backend' } = {
645 summary => 'Delete a backend',
646 params => $params,
647 returns => 'InlineResponse200',
648 };
649 }
650 # @return InlineResponse200
651 #
652 sub delete_backend {
653 my ($self, %args) = @_;
654  
655 # verify the required parameter 'service_id' is set
656 unless (exists $args{'service_id'}) {
657 croak("Missing the required parameter 'service_id' when calling delete_backend");
658 }
659  
660 # verify the required parameter 'version_id' is set
661 unless (exists $args{'version_id'}) {
662 croak("Missing the required parameter 'version_id' when calling delete_backend");
663 }
664  
665 # verify the required parameter 'backend_name' is set
666 unless (exists $args{'backend_name'}) {
667 croak("Missing the required parameter 'backend_name' when calling delete_backend");
668 }
669  
670 # parse inputs
671 my $_resource_path = '/service/{service_id}/version/{version_id}/backend/{backend_name}';
672  
673 my $_method = 'DELETE';
674 my $query_params = {};
675 my $header_params = {};
676 my $form_params = {};
677  
678 # 'Accept' and 'Content-Type' header
679 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
680 if ($_header_accept) {
681 $header_params->{'Accept'} = $_header_accept;
682 }
683 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
684  
685 # path params
686 if ( exists $args{'service_id'}) {
687 my $_base_variable = "{" . "service_id" . "}";
688 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
689 $_resource_path =~ s/$_base_variable/$_base_value/g;
690 }
691  
692 # path params
693 if ( exists $args{'version_id'}) {
694 my $_base_variable = "{" . "version_id" . "}";
695 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
696 $_resource_path =~ s/$_base_variable/$_base_value/g;
697 }
698  
699 # path params
700 if ( exists $args{'backend_name'}) {
701 my $_base_variable = "{" . "backend_name" . "}";
702 my $_base_value = $self->{api_client}->to_path_value($args{'backend_name'});
703 $_resource_path =~ s/$_base_variable/$_base_value/g;
704 }
705  
706 my $_body_data;
707 # authentication setting, if any
708 my $auth_settings = [qw(token )];
709  
710 # make the API Call
711 my $response = $self->{api_client}->call_api($_resource_path, $_method,
712 $query_params, $form_params,
713 $header_params, $_body_data, $auth_settings);
714 if (!$response) {
715 return;
716 }
717 my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
718 return $_response_object;
719 }
720  
721 #
722 # get_backend
723 #
724 # Describe a backend
725 #
726 # @param string $service_id Alphanumeric string identifying the service. (required)
727 # @param int $version_id Integer identifying a service version. (required)
728 # @param string $backend_name The name of the backend. (required)
729 {
730 my $params = {
731 'service_id' => {
732 data_type => 'string',
733 description => 'Alphanumeric string identifying the service.',
734 required => '1',
735 },
736 'version_id' => {
737 data_type => 'int',
738 description => 'Integer identifying a service version.',
739 required => '1',
740 },
741 'backend_name' => {
742 data_type => 'string',
743 description => 'The name of the backend.',
744 required => '1',
745 },
746 };
747 __PACKAGE__->method_documentation->{ 'get_backend' } = {
748 summary => 'Describe a backend',
749 params => $params,
750 returns => 'BackendResponse',
751 };
752 }
753 # @return BackendResponse
754 #
755 sub get_backend {
756 my ($self, %args) = @_;
757  
758 # verify the required parameter 'service_id' is set
759 unless (exists $args{'service_id'}) {
760 croak("Missing the required parameter 'service_id' when calling get_backend");
761 }
762  
763 # verify the required parameter 'version_id' is set
764 unless (exists $args{'version_id'}) {
765 croak("Missing the required parameter 'version_id' when calling get_backend");
766 }
767  
768 # verify the required parameter 'backend_name' is set
769 unless (exists $args{'backend_name'}) {
770 croak("Missing the required parameter 'backend_name' when calling get_backend");
771 }
772  
773 # parse inputs
774 my $_resource_path = '/service/{service_id}/version/{version_id}/backend/{backend_name}';
775  
776 my $_method = 'GET';
777 my $query_params = {};
778 my $header_params = {};
779 my $form_params = {};
780  
781 # 'Accept' and 'Content-Type' header
782 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
783 if ($_header_accept) {
784 $header_params->{'Accept'} = $_header_accept;
785 }
786 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
787  
788 # path params
789 if ( exists $args{'service_id'}) {
790 my $_base_variable = "{" . "service_id" . "}";
791 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
792 $_resource_path =~ s/$_base_variable/$_base_value/g;
793 }
794  
795 # path params
796 if ( exists $args{'version_id'}) {
797 my $_base_variable = "{" . "version_id" . "}";
798 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
799 $_resource_path =~ s/$_base_variable/$_base_value/g;
800 }
801  
802 # path params
803 if ( exists $args{'backend_name'}) {
804 my $_base_variable = "{" . "backend_name" . "}";
805 my $_base_value = $self->{api_client}->to_path_value($args{'backend_name'});
806 $_resource_path =~ s/$_base_variable/$_base_value/g;
807 }
808  
809 my $_body_data;
810 # authentication setting, if any
811 my $auth_settings = [qw(token )];
812  
813 # make the API Call
814 my $response = $self->{api_client}->call_api($_resource_path, $_method,
815 $query_params, $form_params,
816 $header_params, $_body_data, $auth_settings);
817 if (!$response) {
818 return;
819 }
820 my $_response_object = $self->{api_client}->deserialize('BackendResponse', $response);
821 return $_response_object;
822 }
823  
824 #
825 # list_backends
826 #
827 # List backends
828 #
829 # @param string $service_id Alphanumeric string identifying the service. (required)
830 # @param int $version_id Integer identifying a service version. (required)
831 {
832 my $params = {
833 'service_id' => {
834 data_type => 'string',
835 description => 'Alphanumeric string identifying the service.',
836 required => '1',
837 },
838 'version_id' => {
839 data_type => 'int',
840 description => 'Integer identifying a service version.',
841 required => '1',
842 },
843 };
844 __PACKAGE__->method_documentation->{ 'list_backends' } = {
845 summary => 'List backends',
846 params => $params,
847 returns => 'ARRAY[BackendResponse]',
848 };
849 }
850 # @return ARRAY[BackendResponse]
851 #
852 sub list_backends {
853 my ($self, %args) = @_;
854  
855 # verify the required parameter 'service_id' is set
856 unless (exists $args{'service_id'}) {
857 croak("Missing the required parameter 'service_id' when calling list_backends");
858 }
859  
860 # verify the required parameter 'version_id' is set
861 unless (exists $args{'version_id'}) {
862 croak("Missing the required parameter 'version_id' when calling list_backends");
863 }
864  
865 # parse inputs
866 my $_resource_path = '/service/{service_id}/version/{version_id}/backend';
867  
868 my $_method = 'GET';
869 my $query_params = {};
870 my $header_params = {};
871 my $form_params = {};
872  
873 # 'Accept' and 'Content-Type' header
874 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
875 if ($_header_accept) {
876 $header_params->{'Accept'} = $_header_accept;
877 }
878 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
879  
880 # path params
881 if ( exists $args{'service_id'}) {
882 my $_base_variable = "{" . "service_id" . "}";
883 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
884 $_resource_path =~ s/$_base_variable/$_base_value/g;
885 }
886  
887 # path params
888 if ( exists $args{'version_id'}) {
889 my $_base_variable = "{" . "version_id" . "}";
890 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
891 $_resource_path =~ s/$_base_variable/$_base_value/g;
892 }
893  
894 my $_body_data;
895 # authentication setting, if any
896 my $auth_settings = [qw(token )];
897  
898 # make the API Call
899 my $response = $self->{api_client}->call_api($_resource_path, $_method,
900 $query_params, $form_params,
901 $header_params, $_body_data, $auth_settings);
902 if (!$response) {
903 return;
904 }
905 my $_response_object = $self->{api_client}->deserialize('ARRAY[BackendResponse]', $response);
906 return $_response_object;
907 }
908  
909 #
910 # update_backend
911 #
912 # Update a backend
913 #
914 # @param string $service_id Alphanumeric string identifying the service. (required)
915 # @param int $version_id Integer identifying a service version. (required)
916 # @param string $backend_name The name of the backend. (required)
917 # @param string $address A hostname, IPv4, or IPv6 address for the backend. This is the preferred way to specify the location of your backend. (optional)
918 # @param boolean $auto_loadbalance Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don't have a `request_condition` will be selected based on their `weight`. (optional)
919 # @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)
920 # @param string $client_cert Unused. (optional)
921 # @param string $comment A freeform descriptive note. (optional)
922 # @param int $connect_timeout Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. (optional)
923 # @param int $first_byte_timeout Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. (optional)
924 # @param int $fetch_timeout Maximum duration in milliseconds to wait for the entire response to be received after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.fetch_timeout`. (optional)
925 # @param string $healthcheck The name of the healthcheck to use with this backend. (optional)
926 # @param string $hostname The hostname of the backend. May be used as an alternative to `address` to set the backend location. (optional)
927 # @param string $iam_external_id If the backend is using IAM authentication and the IAM system policy requires a matching external identifier, it should match this value. Your Fastly customer ID will be used if this attribute is not set. (optional)
928 # @param string $iam_product If the backend is using IAM authentication, the IAM signature will use this as the product element. (optional)
929 # @param string $iam_region If the backend is using IAM authentication, this region will be used for signing and access. (optional)
930 # @param string $iam_role If the backend is using IAM authentication, the fully qualified role string supplied by the storage vendor. (optional)
931 # @param string $iam_vendor A label that identifies the storage vendor. Providing a value in this field enables IAM usage, and all other IAM fields depend on its value. (optional)
932 # @param string $ipv4 IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. (optional)
933 # @param string $ipv6 IPv6 address of the backend. May be used as an alternative to `address` to set the backend location. (optional)
934 # @param int $keepalive_time How long (in seconds) to keep a persistent connection to the backend between requests. By default, Fastly keeps connections open as long as it can. (optional)
935 # @param int $max_conn Maximum number of concurrent connections this backend will accept. (optional)
936 # @param int $max_lifetime Maximum time from creation (in milliseconds) that a pooled HTTP keepalive connection will be eligible for reuse; 0 is treated as unlimited. (optional)
937 # @param string $max_tls_version Maximum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated. (optional)
938 # @param string $min_tls_version Minimum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated. (optional)
939 # @param int $max_use Maximum number of requests allowed over a single, pooled HTTP keepalive connection to this backend; 0 is treated as unlimited. (optional)
940 # @param string $name The name of the backend. (optional)
941 # @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional)
942 # @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional)
943 # @param boolean $prefer_ipv6 Prefer IPv6 connections to origins for hostname backends. Default is 'false' for Delivery services and 'true' for Compute services. (optional)
944 # @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional)
945 # @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional)
946 # @param string $shield Identifier of the POP to use as a [shield](https://www.fastly.com/documentation/guides/getting-started/hosts/shielding/). (optional)
947 # @param string $ssl_ca_cert CA certificate attached to origin. (optional)
948 # @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional)
949 # @param boolean $ssl_check_cert Be strict on checking SSL certs. (optional, default to true)
950 # @param string $ssl_ciphers List of [OpenSSL ciphers](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated. (optional)
951 # @param string $ssl_client_cert Client certificate attached to origin. (optional)
952 # @param string $ssl_client_key Client key attached to origin. (optional)
953 # @param string $ssl_hostname Use `ssl_cert_hostname` and `ssl_sni_hostname` to configure certificate validation. (optional)
954 # @param string $ssl_sni_hostname Overrides `ssl_hostname`, but only for SNI in the handshake. Does not affect cert validation at all. (optional)
955 # @param boolean $tcp_keepalive_enable Whether to enable TCP keepalives for backend connections. Varnish defaults to using keepalives if this is unspecified. (optional)
956 # @param int $tcp_keepalive_interval Interval in seconds between subsequent keepalive probes. (optional, default to 10)
957 # @param int $tcp_keepalive_probes Number of unacknowledged probes to send before considering the connection dead. (optional, default to 3)
958 # @param int $tcp_keepalive_time Interval in seconds between the last data packet sent and the first keepalive probe. (optional, default to 300)
959 # @param boolean $use_ssl Whether or not to require TLS for connections to this backend. (optional)
960 # @param int $weight Weight used to load balance this backend against others. May be any positive integer. If `auto_loadbalance` is true, the chance of this backend being selected is equal to its own weight over the sum of all weights for backends that have `auto_loadbalance` set to true. (optional)
961 {
962 my $params = {
963 'service_id' => {
964 data_type => 'string',
965 description => 'Alphanumeric string identifying the service.',
966 required => '1',
967 },
968 'version_id' => {
969 data_type => 'int',
970 description => 'Integer identifying a service version.',
971 required => '1',
972 },
973 'backend_name' => {
974 data_type => 'string',
975 description => 'The name of the backend.',
976 required => '1',
977 },
978 'address' => {
979 data_type => 'string',
980 description => 'A hostname, IPv4, or IPv6 address for the backend. This is the preferred way to specify the location of your backend.',
981 required => '0',
982 },
983 'auto_loadbalance' => {
984 data_type => 'boolean',
985 description => 'Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don't have a `request_condition` will be selected based on their `weight`.',
986 required => '0',
987 },
988 'between_bytes_timeout' => {
989 data_type => 'int',
990 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`.',
991 required => '0',
992 },
993 'client_cert' => {
994 data_type => 'string',
995 description => 'Unused.',
996 required => '0',
997 },
998 'comment' => {
999 data_type => 'string',
1000 description => 'A freeform descriptive note.',
1001 required => '0',
1002 },
1003 'connect_timeout' => {
1004 data_type => 'int',
1005 description => 'Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`.',
1006 required => '0',
1007 },
1008 'first_byte_timeout' => {
1009 data_type => 'int',
1010 description => 'Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`.',
1011 required => '0',
1012 },
1013 'fetch_timeout' => {
1014 data_type => 'int',
1015 description => 'Maximum duration in milliseconds to wait for the entire response to be received after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.fetch_timeout`.',
1016 required => '0',
1017 },
1018 'healthcheck' => {
1019 data_type => 'string',
1020 description => 'The name of the healthcheck to use with this backend.',
1021 required => '0',
1022 },
1023 'hostname' => {
1024 data_type => 'string',
1025 description => 'The hostname of the backend. May be used as an alternative to `address` to set the backend location.',
1026 required => '0',
1027 },
1028 'iam_external_id' => {
1029 data_type => 'string',
1030 description => 'If the backend is using IAM authentication and the IAM system policy requires a matching external identifier, it should match this value. Your Fastly customer ID will be used if this attribute is not set.',
1031 required => '0',
1032 },
1033 'iam_product' => {
1034 data_type => 'string',
1035 description => 'If the backend is using IAM authentication, the IAM signature will use this as the product element.',
1036 required => '0',
1037 },
1038 'iam_region' => {
1039 data_type => 'string',
1040 description => 'If the backend is using IAM authentication, this region will be used for signing and access.',
1041 required => '0',
1042 },
1043 'iam_role' => {
1044 data_type => 'string',
1045 description => 'If the backend is using IAM authentication, the fully qualified role string supplied by the storage vendor.',
1046 required => '0',
1047 },
1048 'iam_vendor' => {
1049 data_type => 'string',
1050 description => 'A label that identifies the storage vendor. Providing a value in this field enables IAM usage, and all other IAM fields depend on its value.',
1051 required => '0',
1052 },
1053 'ipv4' => {
1054 data_type => 'string',
1055 description => 'IPv4 address of the backend. May be used as an alternative to `address` to set the backend location.',
1056 required => '0',
1057 },
1058 'ipv6' => {
1059 data_type => 'string',
1060 description => 'IPv6 address of the backend. May be used as an alternative to `address` to set the backend location.',
1061 required => '0',
1062 },
1063 'keepalive_time' => {
1064 data_type => 'int',
1065 description => 'How long (in seconds) to keep a persistent connection to the backend between requests. By default, Fastly keeps connections open as long as it can.',
1066 required => '0',
1067 },
1068 'max_conn' => {
1069 data_type => 'int',
1070 description => 'Maximum number of concurrent connections this backend will accept.',
1071 required => '0',
1072 },
1073 'max_lifetime' => {
1074 data_type => 'int',
1075 description => 'Maximum time from creation (in milliseconds) that a pooled HTTP keepalive connection will be eligible for reuse; 0 is treated as unlimited.',
1076 required => '0',
1077 },
1078 'max_tls_version' => {
1079 data_type => 'string',
1080 description => 'Maximum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.',
1081 required => '0',
1082 },
1083 'min_tls_version' => {
1084 data_type => 'string',
1085 description => 'Minimum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.',
1086 required => '0',
1087 },
1088 'max_use' => {
1089 data_type => 'int',
1090 description => 'Maximum number of requests allowed over a single, pooled HTTP keepalive connection to this backend; 0 is treated as unlimited.',
1091 required => '0',
1092 },
1093 'name' => {
1094 data_type => 'string',
1095 description => 'The name of the backend.',
1096 required => '0',
1097 },
1098 'override_host' => {
1099 data_type => 'string',
1100 description => 'If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL.',
1101 required => '0',
1102 },
1103 'port' => {
1104 data_type => 'int',
1105 description => 'Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request.',
1106 required => '0',
1107 },
1108 'prefer_ipv6' => {
1109 data_type => 'boolean',
1110 description => 'Prefer IPv6 connections to origins for hostname backends. Default is 'false' for Delivery services and 'true' for Compute services.',
1111 required => '0',
1112 },
1113 'request_condition' => {
1114 data_type => 'string',
1115 description => 'Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests.',
1116 required => '0',
1117 },
1118 'share_key' => {
1119 data_type => 'string',
1120 description => 'Value that when shared across backends will enable those backends to share the same health check.',
1121 required => '0',
1122 },
1123 'shield' => {
1124 data_type => 'string',
1125 description => 'Identifier of the POP to use as a [shield](https://www.fastly.com/documentation/guides/getting-started/hosts/shielding/).',
1126 required => '0',
1127 },
1128 'ssl_ca_cert' => {
1129 data_type => 'string',
1130 description => 'CA certificate attached to origin.',
1131 required => '0',
1132 },
1133 'ssl_cert_hostname' => {
1134 data_type => 'string',
1135 description => 'Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all.',
1136 required => '0',
1137 },
1138 'ssl_check_cert' => {
1139 data_type => 'boolean',
1140 description => 'Be strict on checking SSL certs.',
1141 required => '0',
1142 },
1143 'ssl_ciphers' => {
1144 data_type => 'string',
1145 description => 'List of [OpenSSL ciphers](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.',
1146 required => '0',
1147 },
1148 'ssl_client_cert' => {
1149 data_type => 'string',
1150 description => 'Client certificate attached to origin.',
1151 required => '0',
1152 },
1153 'ssl_client_key' => {
1154 data_type => 'string',
1155 description => 'Client key attached to origin.',
1156 required => '0',
1157 },
1158 'ssl_hostname' => {
1159 data_type => 'string',
1160 description => 'Use `ssl_cert_hostname` and `ssl_sni_hostname` to configure certificate validation.',
1161 required => '0',
1162 },
1163 'ssl_sni_hostname' => {
1164 data_type => 'string',
1165 description => 'Overrides `ssl_hostname`, but only for SNI in the handshake. Does not affect cert validation at all.',
1166 required => '0',
1167 },
1168 'tcp_keepalive_enable' => {
1169 data_type => 'boolean',
1170 description => 'Whether to enable TCP keepalives for backend connections. Varnish defaults to using keepalives if this is unspecified.',
1171 required => '0',
1172 },
1173 'tcp_keepalive_interval' => {
1174 data_type => 'int',
1175 description => 'Interval in seconds between subsequent keepalive probes.',
1176 required => '0',
1177 },
1178 'tcp_keepalive_probes' => {
1179 data_type => 'int',
1180 description => 'Number of unacknowledged probes to send before considering the connection dead.',
1181 required => '0',
1182 },
1183 'tcp_keepalive_time' => {
1184 data_type => 'int',
1185 description => 'Interval in seconds between the last data packet sent and the first keepalive probe.',
1186 required => '0',
1187 },
1188 'use_ssl' => {
1189 data_type => 'boolean',
1190 description => 'Whether or not to require TLS for connections to this backend.',
1191 required => '0',
1192 },
1193 'weight' => {
1194 data_type => 'int',
1195 description => 'Weight used to load balance this backend against others. May be any positive integer. If `auto_loadbalance` is true, the chance of this backend being selected is equal to its own weight over the sum of all weights for backends that have `auto_loadbalance` set to true.',
1196 required => '0',
1197 },
1198 };
1199 __PACKAGE__->method_documentation->{ 'update_backend' } = {
1200 summary => 'Update a backend',
1201 params => $params,
1202 returns => 'BackendResponse',
1203 };
1204 }
1205 # @return BackendResponse
1206 #
1207 sub update_backend {
1208 my ($self, %args) = @_;
1209  
1210 # verify the required parameter 'service_id' is set
1211 unless (exists $args{'service_id'}) {
1212 croak("Missing the required parameter 'service_id' when calling update_backend");
1213 }
1214  
1215 # verify the required parameter 'version_id' is set
1216 unless (exists $args{'version_id'}) {
1217 croak("Missing the required parameter 'version_id' when calling update_backend");
1218 }
1219  
1220 # verify the required parameter 'backend_name' is set
1221 unless (exists $args{'backend_name'}) {
1222 croak("Missing the required parameter 'backend_name' when calling update_backend");
1223 }
1224  
1225 # parse inputs
1226 my $_resource_path = '/service/{service_id}/version/{version_id}/backend/{backend_name}';
1227  
1228 my $_method = 'PUT';
1229 my $query_params = {};
1230 my $header_params = {};
1231 my $form_params = {};
1232  
1233 # 'Accept' and 'Content-Type' header
1234 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
1235 if ($_header_accept) {
1236 $header_params->{'Accept'} = $_header_accept;
1237 }
1238 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
1239  
1240 # path params
1241 if ( exists $args{'service_id'}) {
1242 my $_base_variable = "{" . "service_id" . "}";
1243 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
1244 $_resource_path =~ s/$_base_variable/$_base_value/g;
1245 }
1246  
1247 # path params
1248 if ( exists $args{'version_id'}) {
1249 my $_base_variable = "{" . "version_id" . "}";
1250 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
1251 $_resource_path =~ s/$_base_variable/$_base_value/g;
1252 }
1253  
1254 # path params
1255 if ( exists $args{'backend_name'}) {
1256 my $_base_variable = "{" . "backend_name" . "}";
1257 my $_base_value = $self->{api_client}->to_path_value($args{'backend_name'});
1258 $_resource_path =~ s/$_base_variable/$_base_value/g;
1259 }
1260  
1261 # form params
1262 if ( exists $args{'address'} ) {
1263 $form_params->{'address'} = $self->{api_client}->to_form_value($args{'address'});
1264 }
1265  
1266 # form params
1267 if ( exists $args{'auto_loadbalance'} ) {
1268 $form_params->{'auto_loadbalance'} = $self->{api_client}->to_form_value($args{'auto_loadbalance'});
1269 }
1270  
1271 # form params
1272 if ( exists $args{'between_bytes_timeout'} ) {
1273 $form_params->{'between_bytes_timeout'} = $self->{api_client}->to_form_value($args{'between_bytes_timeout'});
1274 }
1275  
1276 # form params
1277 if ( exists $args{'client_cert'} ) {
1278 $form_params->{'client_cert'} = $self->{api_client}->to_form_value($args{'client_cert'});
1279 }
1280  
1281 # form params
1282 if ( exists $args{'comment'} ) {
1283 $form_params->{'comment'} = $self->{api_client}->to_form_value($args{'comment'});
1284 }
1285  
1286 # form params
1287 if ( exists $args{'connect_timeout'} ) {
1288 $form_params->{'connect_timeout'} = $self->{api_client}->to_form_value($args{'connect_timeout'});
1289 }
1290  
1291 # form params
1292 if ( exists $args{'first_byte_timeout'} ) {
1293 $form_params->{'first_byte_timeout'} = $self->{api_client}->to_form_value($args{'first_byte_timeout'});
1294 }
1295  
1296 # form params
1297 if ( exists $args{'fetch_timeout'} ) {
1298 $form_params->{'fetch_timeout'} = $self->{api_client}->to_form_value($args{'fetch_timeout'});
1299 }
1300  
1301 # form params
1302 if ( exists $args{'healthcheck'} ) {
1303 $form_params->{'healthcheck'} = $self->{api_client}->to_form_value($args{'healthcheck'});
1304 }
1305  
1306 # form params
1307 if ( exists $args{'hostname'} ) {
1308 $form_params->{'hostname'} = $self->{api_client}->to_form_value($args{'hostname'});
1309 }
1310  
1311 # form params
1312 if ( exists $args{'iam_external_id'} ) {
1313 $form_params->{'iam_external_id'} = $self->{api_client}->to_form_value($args{'iam_external_id'});
1314 }
1315  
1316 # form params
1317 if ( exists $args{'iam_product'} ) {
1318 $form_params->{'iam_product'} = $self->{api_client}->to_form_value($args{'iam_product'});
1319 }
1320  
1321 # form params
1322 if ( exists $args{'iam_region'} ) {
1323 $form_params->{'iam_region'} = $self->{api_client}->to_form_value($args{'iam_region'});
1324 }
1325  
1326 # form params
1327 if ( exists $args{'iam_role'} ) {
1328 $form_params->{'iam_role'} = $self->{api_client}->to_form_value($args{'iam_role'});
1329 }
1330  
1331 # form params
1332 if ( exists $args{'iam_vendor'} ) {
1333 $form_params->{'iam_vendor'} = $self->{api_client}->to_form_value($args{'iam_vendor'});
1334 }
1335  
1336 # form params
1337 if ( exists $args{'ipv4'} ) {
1338 $form_params->{'ipv4'} = $self->{api_client}->to_form_value($args{'ipv4'});
1339 }
1340  
1341 # form params
1342 if ( exists $args{'ipv6'} ) {
1343 $form_params->{'ipv6'} = $self->{api_client}->to_form_value($args{'ipv6'});
1344 }
1345  
1346 # form params
1347 if ( exists $args{'keepalive_time'} ) {
1348 $form_params->{'keepalive_time'} = $self->{api_client}->to_form_value($args{'keepalive_time'});
1349 }
1350  
1351 # form params
1352 if ( exists $args{'max_conn'} ) {
1353 $form_params->{'max_conn'} = $self->{api_client}->to_form_value($args{'max_conn'});
1354 }
1355  
1356 # form params
1357 if ( exists $args{'max_lifetime'} ) {
1358 $form_params->{'max_lifetime'} = $self->{api_client}->to_form_value($args{'max_lifetime'});
1359 }
1360  
1361 # form params
1362 if ( exists $args{'max_tls_version'} ) {
1363 $form_params->{'max_tls_version'} = $self->{api_client}->to_form_value($args{'max_tls_version'});
1364 }
1365  
1366 # form params
1367 if ( exists $args{'min_tls_version'} ) {
1368 $form_params->{'min_tls_version'} = $self->{api_client}->to_form_value($args{'min_tls_version'});
1369 }
1370  
1371 # form params
1372 if ( exists $args{'max_use'} ) {
1373 $form_params->{'max_use'} = $self->{api_client}->to_form_value($args{'max_use'});
1374 }
1375  
1376 # form params
1377 if ( exists $args{'name'} ) {
1378 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
1379 }
1380  
1381 # form params
1382 if ( exists $args{'override_host'} ) {
1383 $form_params->{'override_host'} = $self->{api_client}->to_form_value($args{'override_host'});
1384 }
1385  
1386 # form params
1387 if ( exists $args{'port'} ) {
1388 $form_params->{'port'} = $self->{api_client}->to_form_value($args{'port'});
1389 }
1390  
1391 # form params
1392 if ( exists $args{'prefer_ipv6'} ) {
1393 $form_params->{'prefer_ipv6'} = $self->{api_client}->to_form_value($args{'prefer_ipv6'});
1394 }
1395  
1396 # form params
1397 if ( exists $args{'request_condition'} ) {
1398 $form_params->{'request_condition'} = $self->{api_client}->to_form_value($args{'request_condition'});
1399 }
1400  
1401 # form params
1402 if ( exists $args{'share_key'} ) {
1403 $form_params->{'share_key'} = $self->{api_client}->to_form_value($args{'share_key'});
1404 }
1405  
1406 # form params
1407 if ( exists $args{'shield'} ) {
1408 $form_params->{'shield'} = $self->{api_client}->to_form_value($args{'shield'});
1409 }
1410  
1411 # form params
1412 if ( exists $args{'ssl_ca_cert'} ) {
1413 $form_params->{'ssl_ca_cert'} = $self->{api_client}->to_form_value($args{'ssl_ca_cert'});
1414 }
1415  
1416 # form params
1417 if ( exists $args{'ssl_cert_hostname'} ) {
1418 $form_params->{'ssl_cert_hostname'} = $self->{api_client}->to_form_value($args{'ssl_cert_hostname'});
1419 }
1420  
1421 # form params
1422 if ( exists $args{'ssl_check_cert'} ) {
1423 $form_params->{'ssl_check_cert'} = $self->{api_client}->to_form_value($args{'ssl_check_cert'});
1424 }
1425  
1426 # form params
1427 if ( exists $args{'ssl_ciphers'} ) {
1428 $form_params->{'ssl_ciphers'} = $self->{api_client}->to_form_value($args{'ssl_ciphers'});
1429 }
1430  
1431 # form params
1432 if ( exists $args{'ssl_client_cert'} ) {
1433 $form_params->{'ssl_client_cert'} = $self->{api_client}->to_form_value($args{'ssl_client_cert'});
1434 }
1435  
1436 # form params
1437 if ( exists $args{'ssl_client_key'} ) {
1438 $form_params->{'ssl_client_key'} = $self->{api_client}->to_form_value($args{'ssl_client_key'});
1439 }
1440  
1441 # form params
1442 if ( exists $args{'ssl_hostname'} ) {
1443 $form_params->{'ssl_hostname'} = $self->{api_client}->to_form_value($args{'ssl_hostname'});
1444 }
1445  
1446 # form params
1447 if ( exists $args{'ssl_sni_hostname'} ) {
1448 $form_params->{'ssl_sni_hostname'} = $self->{api_client}->to_form_value($args{'ssl_sni_hostname'});
1449 }
1450  
1451 # form params
1452 if ( exists $args{'tcp_keepalive_enable'} ) {
1453 $form_params->{'tcp_keepalive_enable'} = $self->{api_client}->to_form_value($args{'tcp_keepalive_enable'});
1454 }
1455  
1456 # form params
1457 if ( exists $args{'tcp_keepalive_interval'} ) {
1458 $form_params->{'tcp_keepalive_interval'} = $self->{api_client}->to_form_value($args{'tcp_keepalive_interval'});
1459 }
1460  
1461 # form params
1462 if ( exists $args{'tcp_keepalive_probes'} ) {
1463 $form_params->{'tcp_keepalive_probes'} = $self->{api_client}->to_form_value($args{'tcp_keepalive_probes'});
1464 }
1465  
1466 # form params
1467 if ( exists $args{'tcp_keepalive_time'} ) {
1468 $form_params->{'tcp_keepalive_time'} = $self->{api_client}->to_form_value($args{'tcp_keepalive_time'});
1469 }
1470  
1471 # form params
1472 if ( exists $args{'use_ssl'} ) {
1473 $form_params->{'use_ssl'} = $self->{api_client}->to_form_value($args{'use_ssl'});
1474 }
1475  
1476 # form params
1477 if ( exists $args{'weight'} ) {
1478 $form_params->{'weight'} = $self->{api_client}->to_form_value($args{'weight'});
1479 }
1480  
1481 my $_body_data;
1482 # authentication setting, if any
1483 my $auth_settings = [qw(token )];
1484  
1485 # make the API Call
1486 my $response = $self->{api_client}->call_api($_resource_path, $_method,
1487 $query_params, $form_params,
1488 $header_params, $_body_data, $auth_settings);
1489 if (!$response) {
1490 return;
1491 }
1492 my $_response_object = $self->{api_client}->deserialize('BackendResponse', $response);
1493 return $_response_object;
1494 }
1495  
1496 1;