Fastly/Object/LoggingCloudfilesResponse.pm untested

filter: Statementstmt 0.0% 0 / 119 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 22 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 167 CC 7 SCAR 19.7
CC
7
Cov
0%
from_hash
20.0
_deserialize
20.0
new
2.0
CRAP 7.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::Object::LoggingCloudfilesResponse;
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::LoggingCloudfilesAdditional;
32 use WebService::Fastly::Object::LoggingCommonResponse;
33 use WebService::Fastly::Object::LoggingGenericCommonResponse;
34 use WebService::Fastly::Object::ServiceIdAndVersionString;
35 use WebService::Fastly::Object::Timestamps;
36  
37 use base ("Class::Accessor", "Class::Data::Inheritable");
38  
39 #
40 #
41 #
42 # NOTE: This class is auto generated. Do not edit the class manually.
43 #
44  
45 =begin comment
46  
47 Fastly API
48  
49 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/)
50  
51 The version of the API Spec document: 1.0.0
52 Contact: oss@fastly.com
53  
54 =end comment
55  
56 =cut
57  
58 #
59 # NOTE: This class is auto generated.
60 # Do not edit the class manually.
61 #
62 __PACKAGE__->mk_classdata('attribute_map' => {});
63 __PACKAGE__->mk_classdata('openapi_types' => {});
64 __PACKAGE__->mk_classdata('method_documentation' => {});
65 __PACKAGE__->mk_classdata('class_documentation' => {});
66 __PACKAGE__->mk_classdata('openapi_nullable' => {});
67  
68 # new plain object
69 sub new {
70 my ($class, %args) = @_;
71  
72 my $self = bless {}, $class;
73  
74 $self->init(%args);
75  
76 return $self;
77 }
78  
79 # initialize the object
80 sub init
81 {
82 my ($self, %args) = @_;
83  
84 foreach my $attribute (keys %{$self->attribute_map}) {
85 my $args_key = $self->attribute_map->{$attribute};
86 $self->$attribute( $args{ $args_key } );
87 }
88 }
89  
90 # return perl hash
91 sub to_hash {
92 my $self = shift;
93 my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
94  
95 return $_hash;
96 }
97  
98 # used by JSON for serialization
99 sub TO_JSON {
100 my $self = shift;
101 my $_data = {};
102 foreach my $_key (keys %{$self->attribute_map}) {
103 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
104 }
105  
106 return $_data;
107 }
108  
109 # from Perl hashref
110 sub from_hash {
111 my ($self, $hash) = @_;
112  
113 # loop through attributes and use openapi_types to deserialize the data
114 while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
115 my $_json_attribute = $self->attribute_map->{$_key};
116 my $_is_nullable = ($self->openapi_nullable->{$_key} || 'false') eq 'true';
117 if ($_type =~ /^array\[(.+)\]$/i) { # array
118 my $_subclass = $1;
119 my @_array = ();
120 foreach my $_element (@{$hash->{$_json_attribute}}) {
121 push @_array, $self->_deserialize($_subclass, $_element, $_is_nullable);
122 }
123 $self->{$_key} = \@_array;
124 } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
125 my $_subclass = $1;
126 my %_hash = ();
127 while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) {
128 $_hash{$_key} = $self->_deserialize($_subclass, $_element, $_is_nullable);
129 }
130 $self->{$_key} = \%_hash;
131 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
132 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}, $_is_nullable);
133 } else {
134 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
135 }
136 }
137  
138 return $self;
139 }
140  
141 # deserialize non-array data
142 sub _deserialize {
143 my ($self, $type, $data, $is_nullable) = @_;
144 $log->debugf("deserializing %s with %s",Dumper($data), $type);
145  
146 if (!(defined $data) && $is_nullable) {
147 return undef;
148 }
149 if ($type eq 'DateTime') {
150 return DateTime->from_epoch(epoch => str2time($data));
151 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
152 return $data;
153 } else { # hash(model)
154 my $_instance = eval "WebService::Fastly::Object::$type->new()";
155 return $_instance->from_hash($data);
156 }
157 }
158  
159  
160 __PACKAGE__->class_documentation({description => '',
161 class => 'LoggingCloudfilesResponse',
162 required => [], # TODO
163 } );
164  
165 __PACKAGE__->method_documentation({
166 'name' => {
167 datatype => 'string',
168 base_name => 'name',
169 description => 'The name for the real-time logging configuration.',
170 format => '',
171 read_only => 'false',
172 },
173 'placement' => {
174 datatype => 'string',
175 base_name => 'placement',
176 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`. ',
177 format => '',
178 read_only => 'false',
179 },
180 'response_condition' => {
181 datatype => 'string',
182 base_name => 'response_condition',
183 description => 'The name of an existing condition in the configured endpoint, or leave blank to always execute.',
184 format => '',
185 read_only => 'false',
186 },
187 'format' => {
188 datatype => 'string',
189 base_name => 'format',
190 description => 'A Fastly [log format string](https://www.fastly.com/documentation/guides/integrations/streaming-logs/custom-log-formats/).',
191 format => '',
192 read_only => 'false',
193 },
194 'log_processing_region' => {
195 datatype => 'string',
196 base_name => 'log_processing_region',
197 description => 'The geographic region where the logs will be processed before streaming. Valid values are `us`, `eu`, and `none` for global.',
198 format => '',
199 read_only => 'false',
200 },
201 'format_version' => {
202 datatype => 'string',
203 base_name => 'format_version',
204 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`. ',
205 format => '',
206 read_only => 'false',
207 },
208 'message_type' => {
209 datatype => 'string',
210 base_name => 'message_type',
211 description => 'How the message should be formatted.',
212 format => '',
213 read_only => 'false',
214 },
215 'timestamp_format' => {
216 datatype => 'string',
217 base_name => 'timestamp_format',
218 description => 'A timestamp format',
219 format => '',
220 read_only => 'true',
221 },
222 'compression_codec' => {
223 datatype => 'string',
224 base_name => 'compression_codec',
225 description => 'The codec used for compressing your logs. Valid values are `zstd`, `snappy`, and `gzip`. Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error.',
226 format => '',
227 read_only => 'false',
228 },
229 'period' => {
230 datatype => 'string',
231 base_name => 'period',
232 description => 'How frequently log files are finalized so they can be available for reading (in seconds).',
233 format => '',
234 read_only => 'false',
235 },
236 'gzip_level' => {
237 datatype => 'string',
238 base_name => 'gzip_level',
239 description => 'The level of gzip encoding when sending logs (default `0`, no compression). Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error.',
240 format => '',
241 read_only => 'false',
242 },
243 'created_at' => {
244 datatype => 'DateTime',
245 base_name => 'created_at',
246 description => 'Date and time in ISO 8601 format.',
247 format => 'date-time',
248 read_only => 'true',
249 },
250 'deleted_at' => {
251 datatype => 'DateTime',
252 base_name => 'deleted_at',
253 description => 'Date and time in ISO 8601 format.',
254 format => 'date-time',
255 read_only => 'true',
256 },
257 'updated_at' => {
258 datatype => 'DateTime',
259 base_name => 'updated_at',
260 description => 'Date and time in ISO 8601 format.',
261 format => 'date-time',
262 read_only => 'true',
263 },
264 'service_id' => {
265 datatype => 'string',
266 base_name => 'service_id',
267 description => '',
268 format => '',
269 read_only => 'true',
270 },
271 'version' => {
272 datatype => 'string',
273 base_name => 'version',
274 description => '',
275 format => '',
276 read_only => 'true',
277 },
278 'access_key' => {
279 datatype => 'string',
280 base_name => 'access_key',
281 description => 'Your Cloud Files account access key.',
282 format => '',
283 read_only => 'false',
284 },
285 'bucket_name' => {
286 datatype => 'string',
287 base_name => 'bucket_name',
288 description => 'The name of your Cloud Files container.',
289 format => '',
290 read_only => 'false',
291 },
292 'path' => {
293 datatype => 'string',
294 base_name => 'path',
295 description => 'The path to upload logs to.',
296 format => '',
297 read_only => 'false',
298 },
299 'region' => {
300 datatype => 'string',
301 base_name => 'region',
302 description => 'The region to stream logs to.',
303 format => '',
304 read_only => 'false',
305 },
306 'public_key' => {
307 datatype => 'string',
308 base_name => 'public_key',
309 description => 'A PGP public key that Fastly will use to encrypt your log files before writing them to disk.',
310 format => '',
311 read_only => 'false',
312 },
313 'user' => {
314 datatype => 'string',
315 base_name => 'user',
316 description => 'The username for your Cloud Files account.',
317 format => '',
318 read_only => 'false',
319 },
320 });
321  
322 __PACKAGE__->openapi_types( {
323 'name' => 'string',
324 'placement' => 'string',
325 'response_condition' => 'string',
326 'format' => 'string',
327 'log_processing_region' => 'string',
328 'format_version' => 'string',
329 'message_type' => 'string',
330 'timestamp_format' => 'string',
331 'compression_codec' => 'string',
332 'period' => 'string',
333 'gzip_level' => 'string',
334 'created_at' => 'DateTime',
335 'deleted_at' => 'DateTime',
336 'updated_at' => 'DateTime',
337 'service_id' => 'string',
338 'version' => 'string',
339 'access_key' => 'string',
340 'bucket_name' => 'string',
341 'path' => 'string',
342 'region' => 'string',
343 'public_key' => 'string',
344 'user' => 'string'
345 } );
346  
347 __PACKAGE__->attribute_map( {
348 'name' => 'name',
349 'placement' => 'placement',
350 'response_condition' => 'response_condition',
351 'format' => 'format',
352 'log_processing_region' => 'log_processing_region',
353 'format_version' => 'format_version',
354 'message_type' => 'message_type',
355 'timestamp_format' => 'timestamp_format',
356 'compression_codec' => 'compression_codec',
357 'period' => 'period',
358 'gzip_level' => 'gzip_level',
359 'created_at' => 'created_at',
360 'deleted_at' => 'deleted_at',
361 'updated_at' => 'updated_at',
362 'service_id' => 'service_id',
363 'version' => 'version',
364 'access_key' => 'access_key',
365 'bucket_name' => 'bucket_name',
366 'path' => 'path',
367 'region' => 'region',
368 'public_key' => 'public_key',
369 'user' => 'user'
370 } );
371  
372 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
373  
374 __PACKAGE__->openapi_nullable( {
375 'placement' => 'true',
376 'response_condition' => 'true',
377 'timestamp_format' => 'true',
378 'created_at' => 'true',
379 'deleted_at' => 'true',
380 'updated_at' => 'true',
381 'path' => 'true',
382 'region' => 'true',
383 'public_key' => 'true',
384 } );
385  
386  
387 1;