Fastly/Object/LoggingHttpsResponse.pm untested

filter: Statementstmt 0.0% 0 / 125 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 24 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 175 CC 7 SCAR 19.2
CC
7
Cov
0%
from_hash
20.0
_deserialize
20.0
new
2.0
CRAP 6.8
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::LoggingHttpsResponse;
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::LoggingCommonResponse;
32 use WebService::Fastly::Object::LoggingHttpsAdditional;
33 use WebService::Fastly::Object::LoggingMessageType;
34 use WebService::Fastly::Object::LoggingRequestCapsCommon;
35 use WebService::Fastly::Object::LoggingTlsCommon;
36 use WebService::Fastly::Object::ServiceIdAndVersionString;
37 use WebService::Fastly::Object::Timestamps;
38  
39 use base ("Class::Accessor", "Class::Data::Inheritable");
40  
41 #
42 #
43 #
44 # NOTE: This class is auto generated. Do not edit the class manually.
45 #
46  
47 =begin comment
48  
49 Fastly API
50  
51 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/)
52  
53 The version of the API Spec document: 1.0.0
54 Contact: oss@fastly.com
55  
56 =end comment
57  
58 =cut
59  
60 #
61 # NOTE: This class is auto generated.
62 # Do not edit the class manually.
63 #
64 __PACKAGE__->mk_classdata('attribute_map' => {});
65 __PACKAGE__->mk_classdata('openapi_types' => {});
66 __PACKAGE__->mk_classdata('method_documentation' => {});
67 __PACKAGE__->mk_classdata('class_documentation' => {});
68 __PACKAGE__->mk_classdata('openapi_nullable' => {});
69  
70 # new plain object
71 sub new {
72 my ($class, %args) = @_;
73  
74 my $self = bless {}, $class;
75  
76 $self->init(%args);
77  
78 return $self;
79 }
80  
81 # initialize the object
82 sub init
83 {
84 my ($self, %args) = @_;
85  
86 foreach my $attribute (keys %{$self->attribute_map}) {
87 my $args_key = $self->attribute_map->{$attribute};
88 $self->$attribute( $args{ $args_key } );
89 }
90 }
91  
92 # return perl hash
93 sub to_hash {
94 my $self = shift;
95 my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
96  
97 return $_hash;
98 }
99  
100 # used by JSON for serialization
101 sub TO_JSON {
102 my $self = shift;
103 my $_data = {};
104 foreach my $_key (keys %{$self->attribute_map}) {
105 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
106 }
107  
108 return $_data;
109 }
110  
111 # from Perl hashref
112 sub from_hash {
113 my ($self, $hash) = @_;
114  
115 # loop through attributes and use openapi_types to deserialize the data
116 while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
117 my $_json_attribute = $self->attribute_map->{$_key};
118 my $_is_nullable = ($self->openapi_nullable->{$_key} || 'false') eq 'true';
119 if ($_type =~ /^array\[(.+)\]$/i) { # array
120 my $_subclass = $1;
121 my @_array = ();
122 foreach my $_element (@{$hash->{$_json_attribute}}) {
123 push @_array, $self->_deserialize($_subclass, $_element, $_is_nullable);
124 }
125 $self->{$_key} = \@_array;
126 } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
127 my $_subclass = $1;
128 my %_hash = ();
129 while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) {
130 $_hash{$_key} = $self->_deserialize($_subclass, $_element, $_is_nullable);
131 }
132 $self->{$_key} = \%_hash;
133 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
134 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}, $_is_nullable);
135 } else {
136 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
137 }
138 }
139  
140 return $self;
141 }
142  
143 # deserialize non-array data
144 sub _deserialize {
145 my ($self, $type, $data, $is_nullable) = @_;
146 $log->debugf("deserializing %s with %s",Dumper($data), $type);
147  
148 if (!(defined $data) && $is_nullable) {
149 return undef;
150 }
151 if ($type eq 'DateTime') {
152 return DateTime->from_epoch(epoch => str2time($data));
153 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
154 return $data;
155 } else { # hash(model)
156 my $_instance = eval "WebService::Fastly::Object::$type->new()";
157 return $_instance->from_hash($data);
158 }
159 }
160  
161  
162 __PACKAGE__->class_documentation({description => '',
163 class => 'LoggingHttpsResponse',
164 required => [], # TODO
165 } );
166  
167 __PACKAGE__->method_documentation({
168 'name' => {
169 datatype => 'string',
170 base_name => 'name',
171 description => 'The name for the real-time logging configuration.',
172 format => '',
173 read_only => 'false',
174 },
175 'placement' => {
176 datatype => 'string',
177 base_name => 'placement',
178 description => 'Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. ',
179 format => '',
180 read_only => 'false',
181 },
182 'response_condition' => {
183 datatype => 'string',
184 base_name => 'response_condition',
185 description => 'The name of an existing condition in the configured endpoint, or leave blank to always execute.',
186 format => '',
187 read_only => 'false',
188 },
189 'format' => {
190 datatype => 'string',
191 base_name => 'format',
192 description => 'A Fastly [log format string](https://www.fastly.com/documentation/guides/integrations/streaming-logs/custom-log-formats/).',
193 format => '',
194 read_only => 'false',
195 },
196 'log_processing_region' => {
197 datatype => 'string',
198 base_name => 'log_processing_region',
199 description => 'The geographic region where the logs will be processed before streaming. Valid values are `us`, `eu`, and `none` for global.',
200 format => '',
201 read_only => 'false',
202 },
203 'format_version' => {
204 datatype => 'string',
205 base_name => 'format_version',
206 description => 'The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. ',
207 format => '',
208 read_only => 'false',
209 },
210 'tls_ca_cert' => {
211 datatype => 'string',
212 base_name => 'tls_ca_cert',
213 description => 'A secure certificate to authenticate a server with. Must be in PEM format.',
214 format => '',
215 read_only => 'false',
216 },
217 'tls_client_cert' => {
218 datatype => 'string',
219 base_name => 'tls_client_cert',
220 description => 'The client certificate used to make authenticated requests. Must be in PEM format.',
221 format => '',
222 read_only => 'false',
223 },
224 'tls_client_key' => {
225 datatype => 'string',
226 base_name => 'tls_client_key',
227 description => 'The client private key used to make authenticated requests. Must be in PEM format.',
228 format => '',
229 read_only => 'false',
230 },
231 'tls_hostname' => {
232 datatype => 'string',
233 base_name => 'tls_hostname',
234 description => 'The hostname to verify the server's certificate. This should be one of the Subject Alternative Name (SAN) fields for the certificate. Common Names (CN) are not supported.',
235 format => '',
236 read_only => 'false',
237 },
238 'request_max_entries' => {
239 datatype => 'int',
240 base_name => 'request_max_entries',
241 description => 'The maximum number of logs sent in one request. Defaults `0` (10k).',
242 format => '',
243 read_only => 'false',
244 },
245 'request_max_bytes' => {
246 datatype => 'int',
247 base_name => 'request_max_bytes',
248 description => 'The maximum number of bytes sent in one request. Defaults `0` (100MB).',
249 format => '',
250 read_only => 'false',
251 },
252 'url' => {
253 datatype => 'string',
254 base_name => 'url',
255 description => 'The URL to send logs to. Must use HTTPS. Required.',
256 format => '',
257 read_only => 'false',
258 },
259 'content_type' => {
260 datatype => 'string',
261 base_name => 'content_type',
262 description => 'Content type of the header sent with the request.',
263 format => '',
264 read_only => 'false',
265 },
266 'header_name' => {
267 datatype => 'string',
268 base_name => 'header_name',
269 description => 'Name of the custom header sent with the request.',
270 format => '',
271 read_only => 'false',
272 },
273 'message_type' => {
274 datatype => 'LoggingMessageType',
275 base_name => 'message_type',
276 description => '',
277 format => '',
278 read_only => 'false',
279 },
280 'header_value' => {
281 datatype => 'string',
282 base_name => 'header_value',
283 description => 'Value of the custom header sent with the request.',
284 format => '',
285 read_only => 'false',
286 },
287 'method' => {
288 datatype => 'string',
289 base_name => 'method',
290 description => 'HTTP method used for request.',
291 format => '',
292 read_only => 'false',
293 },
294 'json_format' => {
295 datatype => 'string',
296 base_name => 'json_format',
297 description => 'Enforces valid JSON formatting for log entries.',
298 format => '',
299 read_only => 'false',
300 },
301 'period' => {
302 datatype => 'int',
303 base_name => 'period',
304 description => 'How frequently, in seconds, batches of log data are sent to the HTTPS endpoint. A value of `0` sends logs at the same interval as the default, which is `5` seconds.',
305 format => '',
306 read_only => 'false',
307 },
308 'created_at' => {
309 datatype => 'DateTime',
310 base_name => 'created_at',
311 description => 'Date and time in ISO 8601 format.',
312 format => 'date-time',
313 read_only => 'true',
314 },
315 'deleted_at' => {
316 datatype => 'DateTime',
317 base_name => 'deleted_at',
318 description => 'Date and time in ISO 8601 format.',
319 format => 'date-time',
320 read_only => 'true',
321 },
322 'updated_at' => {
323 datatype => 'DateTime',
324 base_name => 'updated_at',
325 description => 'Date and time in ISO 8601 format.',
326 format => 'date-time',
327 read_only => 'true',
328 },
329 'service_id' => {
330 datatype => 'string',
331 base_name => 'service_id',
332 description => '',
333 format => '',
334 read_only => 'true',
335 },
336 'version' => {
337 datatype => 'string',
338 base_name => 'version',
339 description => '',
340 format => '',
341 read_only => 'true',
342 },
343 });
344  
345 __PACKAGE__->openapi_types( {
346 'name' => 'string',
347 'placement' => 'string',
348 'response_condition' => 'string',
349 'format' => 'string',
350 'log_processing_region' => 'string',
351 'format_version' => 'string',
352 'tls_ca_cert' => 'string',
353 'tls_client_cert' => 'string',
354 'tls_client_key' => 'string',
355 'tls_hostname' => 'string',
356 'request_max_entries' => 'int',
357 'request_max_bytes' => 'int',
358 'url' => 'string',
359 'content_type' => 'string',
360 'header_name' => 'string',
361 'message_type' => 'LoggingMessageType',
362 'header_value' => 'string',
363 'method' => 'string',
364 'json_format' => 'string',
365 'period' => 'int',
366 'created_at' => 'DateTime',
367 'deleted_at' => 'DateTime',
368 'updated_at' => 'DateTime',
369 'service_id' => 'string',
370 'version' => 'string'
371 } );
372  
373 __PACKAGE__->attribute_map( {
374 'name' => 'name',
375 'placement' => 'placement',
376 'response_condition' => 'response_condition',
377 'format' => 'format',
378 'log_processing_region' => 'log_processing_region',
379 'format_version' => 'format_version',
380 'tls_ca_cert' => 'tls_ca_cert',
381 'tls_client_cert' => 'tls_client_cert',
382 'tls_client_key' => 'tls_client_key',
383 'tls_hostname' => 'tls_hostname',
384 'request_max_entries' => 'request_max_entries',
385 'request_max_bytes' => 'request_max_bytes',
386 'url' => 'url',
387 'content_type' => 'content_type',
388 'header_name' => 'header_name',
389 'message_type' => 'message_type',
390 'header_value' => 'header_value',
391 'method' => 'method',
392 'json_format' => 'json_format',
393 'period' => 'period',
394 'created_at' => 'created_at',
395 'deleted_at' => 'deleted_at',
396 'updated_at' => 'updated_at',
397 'service_id' => 'service_id',
398 'version' => 'version'
399 } );
400  
401 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
402  
403 __PACKAGE__->openapi_nullable( {
404 'placement' => 'true',
405 'response_condition' => 'true',
406 'tls_ca_cert' => 'true',
407 'tls_client_cert' => 'true',
408 'tls_client_key' => 'true',
409 'tls_hostname' => 'true',
410 'content_type' => 'true',
411 'header_name' => 'true',
412 'header_value' => 'true',
413 'created_at' => 'true',
414 'deleted_at' => 'true',
415 'updated_at' => 'true',
416 } );
417  
418  
419 1;