Fastly/Object/PoolResponse.pm untested

filter: Statementstmt 0.0% 0 / 122 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 23 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 171 CC 7 SCAR 19.4
CC
7
Cov
0%
from_hash
20.0
_deserialize
20.0
new
2.0
CRAP 7.0
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::Object::PoolResponse;
19  
20 require 5.6.0;
21 use strict;
22 use warnings;
23 use utf8;
24 use JSON::MaybeXS qw(decode_json);
25 use Data::Dumper;
26 use Module::Runtime qw(use_module);
27 use Log::Any qw($log);
28 use Date::Parse;
29 use DateTime;
30  
31 use WebService::Fastly::Object::PoolAdditional;
32 use WebService::Fastly::Object::PoolResponseAllOf;
33 use WebService::Fastly::Object::PoolResponseCommon;
34 use WebService::Fastly::Object::ServiceIdAndVersionString;
35 use WebService::Fastly::Object::Timestamps;
36 use WebService::Fastly::Object::TlsCommonResponse;
37  
38 use base ("Class::Accessor", "Class::Data::Inheritable");
39  
40 #
41 #
42 #
43 # NOTE: This class is auto generated. Do not edit the class manually.
44 #
45  
46 =begin comment
47  
48 Fastly API
49  
50 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/)
51  
52 The version of the API Spec document: 1.0.0
53 Contact: oss@fastly.com
54  
55 =end comment
56  
57 =cut
58  
59 #
60 # NOTE: This class is auto generated.
61 # Do not edit the class manually.
62 #
63 __PACKAGE__->mk_classdata('attribute_map' => {});
64 __PACKAGE__->mk_classdata('openapi_types' => {});
65 __PACKAGE__->mk_classdata('method_documentation' => {});
66 __PACKAGE__->mk_classdata('class_documentation' => {});
67 __PACKAGE__->mk_classdata('openapi_nullable' => {});
68  
69 # new plain object
70 sub new {
71 my ($class, %args) = @_;
72  
73 my $self = bless {}, $class;
74  
75 $self->init(%args);
76  
77 return $self;
78 }
79  
80 # initialize the object
81 sub init
82 {
83 my ($self, %args) = @_;
84  
85 foreach my $attribute (keys %{$self->attribute_map}) {
86 my $args_key = $self->attribute_map->{$attribute};
87 $self->$attribute( $args{ $args_key } );
88 }
89 }
90  
91 # return perl hash
92 sub to_hash {
93 my $self = shift;
94 my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
95  
96 return $_hash;
97 }
98  
99 # used by JSON for serialization
100 sub TO_JSON {
101 my $self = shift;
102 my $_data = {};
103 foreach my $_key (keys %{$self->attribute_map}) {
104 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
105 }
106  
107 return $_data;
108 }
109  
110 # from Perl hashref
111 sub from_hash {
112 my ($self, $hash) = @_;
113  
114 # loop through attributes and use openapi_types to deserialize the data
115 while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
116 my $_json_attribute = $self->attribute_map->{$_key};
117 my $_is_nullable = ($self->openapi_nullable->{$_key} || 'false') eq 'true';
118 if ($_type =~ /^array\[(.+)\]$/i) { # array
119 my $_subclass = $1;
120 my @_array = ();
121 foreach my $_element (@{$hash->{$_json_attribute}}) {
122 push @_array, $self->_deserialize($_subclass, $_element, $_is_nullable);
123 }
124 $self->{$_key} = \@_array;
125 } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
126 my $_subclass = $1;
127 my %_hash = ();
128 while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) {
129 $_hash{$_key} = $self->_deserialize($_subclass, $_element, $_is_nullable);
130 }
131 $self->{$_key} = \%_hash;
132 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
133 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}, $_is_nullable);
134 } else {
135 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
136 }
137 }
138  
139 return $self;
140 }
141  
142 # deserialize non-array data
143 sub _deserialize {
144 my ($self, $type, $data, $is_nullable) = @_;
145 $log->debugf("deserializing %s with %s",Dumper($data), $type);
146  
147 if (!(defined $data) && $is_nullable) {
148 return undef;
149 }
150 if ($type eq 'DateTime') {
151 return DateTime->from_epoch(epoch => str2time($data));
152 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
153 return $data;
154 } else { # hash(model)
155 my $_instance = eval "WebService::Fastly::Object::$type->new()";
156 return $_instance->from_hash($data);
157 }
158 }
159  
160  
161 __PACKAGE__->class_documentation({description => '',
162 class => 'PoolResponse',
163 required => [], # TODO
164 } );
165  
166 __PACKAGE__->method_documentation({
167 'tls_ca_cert' => {
168 datatype => 'string',
169 base_name => 'tls_ca_cert',
170 description => 'A secure certificate to authenticate a server with. Must be in PEM format.',
171 format => '',
172 read_only => 'false',
173 },
174 'tls_client_cert' => {
175 datatype => 'string',
176 base_name => 'tls_client_cert',
177 description => 'The client certificate used to make authenticated requests. Must be in PEM format.',
178 format => '',
179 read_only => 'false',
180 },
181 'tls_client_key' => {
182 datatype => 'string',
183 base_name => 'tls_client_key',
184 description => 'The client private key used to make authenticated requests. Must be in PEM format.',
185 format => '',
186 read_only => 'false',
187 },
188 'tls_cert_hostname' => {
189 datatype => 'string',
190 base_name => 'tls_cert_hostname',
191 description => 'The hostname used to verify a server's certificate. It can either be the Common Name (CN) or a Subject Alternative Name (SAN).',
192 format => '',
193 read_only => 'false',
194 },
195 'use_tls' => {
196 datatype => 'string',
197 base_name => 'use_tls',
198 description => 'Whether to use TLS.',
199 format => '',
200 read_only => 'false',
201 },
202 'created_at' => {
203 datatype => 'DateTime',
204 base_name => 'created_at',
205 description => 'Date and time in ISO 8601 format.',
206 format => 'date-time',
207 read_only => 'true',
208 },
209 'deleted_at' => {
210 datatype => 'DateTime',
211 base_name => 'deleted_at',
212 description => 'Date and time in ISO 8601 format.',
213 format => 'date-time',
214 read_only => 'true',
215 },
216 'updated_at' => {
217 datatype => 'DateTime',
218 base_name => 'updated_at',
219 description => 'Date and time in ISO 8601 format.',
220 format => 'date-time',
221 read_only => 'true',
222 },
223 'service_id' => {
224 datatype => 'string',
225 base_name => 'service_id',
226 description => '',
227 format => '',
228 read_only => 'true',
229 },
230 'version' => {
231 datatype => 'string',
232 base_name => 'version',
233 description => '',
234 format => '',
235 read_only => 'true',
236 },
237 'name' => {
238 datatype => 'string',
239 base_name => 'name',
240 description => 'Name for the Pool.',
241 format => '',
242 read_only => 'false',
243 },
244 'shield' => {
245 datatype => 'string',
246 base_name => 'shield',
247 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.',
248 format => '',
249 read_only => 'false',
250 },
251 'request_condition' => {
252 datatype => 'string',
253 base_name => 'request_condition',
254 description => 'Condition which, if met, will select this configuration during a request. Optional.',
255 format => '',
256 read_only => 'false',
257 },
258 'tls_ciphers' => {
259 datatype => 'string',
260 base_name => 'tls_ciphers',
261 description => 'List of OpenSSL ciphers (see the [openssl.org manpages](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) for details). Optional.',
262 format => '',
263 read_only => 'false',
264 },
265 'tls_sni_hostname' => {
266 datatype => 'string',
267 base_name => 'tls_sni_hostname',
268 description => 'SNI hostname. Optional.',
269 format => '',
270 read_only => 'false',
271 },
272 'min_tls_version' => {
273 datatype => 'int',
274 base_name => 'min_tls_version',
275 description => 'Minimum allowed TLS version on connections to this server. Optional.',
276 format => '',
277 read_only => 'false',
278 },
279 'max_tls_version' => {
280 datatype => 'int',
281 base_name => 'max_tls_version',
282 description => 'Maximum allowed TLS version on connections to this server. Optional.',
283 format => '',
284 read_only => 'false',
285 },
286 'healthcheck' => {
287 datatype => 'string',
288 base_name => 'healthcheck',
289 description => 'Name of the healthcheck to use with this pool. Can be empty and could be reused across multiple backend and pools.',
290 format => '',
291 read_only => 'false',
292 },
293 'comment' => {
294 datatype => 'string',
295 base_name => 'comment',
296 description => 'A freeform descriptive note.',
297 format => '',
298 read_only => 'false',
299 },
300 'type' => {
301 datatype => 'string',
302 base_name => 'type',
303 description => 'What type of load balance group to use.',
304 format => '',
305 read_only => 'false',
306 },
307 'override_host' => {
308 datatype => 'string',
309 base_name => 'override_host',
310 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.',
311 format => '',
312 read_only => 'false',
313 },
314 'between_bytes_timeout' => {
315 datatype => 'string',
316 base_name => 'between_bytes_timeout',
317 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`.',
318 format => '',
319 read_only => 'false',
320 },
321 'connect_timeout' => {
322 datatype => 'string',
323 base_name => 'connect_timeout',
324 description => 'How long to wait for a timeout in milliseconds.',
325 format => '',
326 read_only => 'false',
327 },
328 'first_byte_timeout' => {
329 datatype => 'string',
330 base_name => 'first_byte_timeout',
331 description => 'How long to wait for the first byte in milliseconds.',
332 format => '',
333 read_only => 'false',
334 },
335 'max_conn_default' => {
336 datatype => 'string',
337 base_name => 'max_conn_default',
338 description => 'Maximum number of connections.',
339 format => '',
340 read_only => 'false',
341 },
342 'tls_check_cert' => {
343 datatype => 'string',
344 base_name => 'tls_check_cert',
345 description => 'Be strict on checking TLS certs.',
346 format => '',
347 read_only => 'false',
348 },
349 'id' => {
350 datatype => 'string',
351 base_name => 'id',
352 description => '',
353 format => '',
354 read_only => 'true',
355 },
356 'quorum' => {
357 datatype => 'string',
358 base_name => 'quorum',
359 description => 'Percentage of capacity (`0-100`) that needs to be operationally available for a pool to be considered up.',
360 format => '',
361 read_only => 'false',
362 },
363 });
364  
365 __PACKAGE__->openapi_types( {
366 'tls_ca_cert' => 'string',
367 'tls_client_cert' => 'string',
368 'tls_client_key' => 'string',
369 'tls_cert_hostname' => 'string',
370 'use_tls' => 'string',
371 'created_at' => 'DateTime',
372 'deleted_at' => 'DateTime',
373 'updated_at' => 'DateTime',
374 'service_id' => 'string',
375 'version' => 'string',
376 'name' => 'string',
377 'shield' => 'string',
378 'request_condition' => 'string',
379 'tls_ciphers' => 'string',
380 'tls_sni_hostname' => 'string',
381 'min_tls_version' => 'int',
382 'max_tls_version' => 'int',
383 'healthcheck' => 'string',
384 'comment' => 'string',
385 'type' => 'string',
386 'override_host' => 'string',
387 'between_bytes_timeout' => 'string',
388 'connect_timeout' => 'string',
389 'first_byte_timeout' => 'string',
390 'max_conn_default' => 'string',
391 'tls_check_cert' => 'string',
392 'id' => 'string',
393 'quorum' => 'string'
394 } );
395  
396 __PACKAGE__->attribute_map( {
397 'tls_ca_cert' => 'tls_ca_cert',
398 'tls_client_cert' => 'tls_client_cert',
399 'tls_client_key' => 'tls_client_key',
400 'tls_cert_hostname' => 'tls_cert_hostname',
401 'use_tls' => 'use_tls',
402 'created_at' => 'created_at',
403 'deleted_at' => 'deleted_at',
404 'updated_at' => 'updated_at',
405 'service_id' => 'service_id',
406 'version' => 'version',
407 'name' => 'name',
408 'shield' => 'shield',
409 'request_condition' => 'request_condition',
410 'tls_ciphers' => 'tls_ciphers',
411 'tls_sni_hostname' => 'tls_sni_hostname',
412 'min_tls_version' => 'min_tls_version',
413 'max_tls_version' => 'max_tls_version',
414 'healthcheck' => 'healthcheck',
415 'comment' => 'comment',
416 'type' => 'type',
417 'override_host' => 'override_host',
418 'between_bytes_timeout' => 'between_bytes_timeout',
419 'connect_timeout' => 'connect_timeout',
420 'first_byte_timeout' => 'first_byte_timeout',
421 'max_conn_default' => 'max_conn_default',
422 'tls_check_cert' => 'tls_check_cert',
423 'id' => 'id',
424 'quorum' => 'quorum'
425 } );
426  
427 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
428  
429 __PACKAGE__->openapi_nullable( {
430 'tls_ca_cert' => 'true',
431 'tls_client_cert' => 'true',
432 'tls_client_key' => 'true',
433 'tls_cert_hostname' => 'true',
434 'created_at' => 'true',
435 'deleted_at' => 'true',
436 'updated_at' => 'true',
437 'shield' => 'true',
438 'request_condition' => 'true',
439 'tls_ciphers' => 'true',
440 'tls_sni_hostname' => 'true',
441 'min_tls_version' => 'true',
442 'max_tls_version' => 'true',
443 'healthcheck' => 'true',
444 'comment' => 'true',
445 'override_host' => 'true',
446 'tls_check_cert' => 'true',
447 } );
448  
449  
450 1;