Fastly/Object/LoggingSyslogResponse.pm untested

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