WebService-Fastly
view release on metacpan or search on metacpan
lib/WebService/Fastly/Object/LoggingGcsCommon.pm view on Meta::CPAN
my $_is_nullable = ($self->openapi_nullable->{$_key} || 'false') eq 'true';
if ($_type =~ /^array\[(.+)\]$/i) { # array
my $_subclass = $1;
my @_array = ();
foreach my $_element (@{$hash->{$_json_attribute}}) {
push @_array, $self->_deserialize($_subclass, $_element, $_is_nullable);
}
$self->{$_key} = \@_array;
} elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
my $_subclass = $1;
my %_hash = ();
while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) {
$_hash{$_key} = $self->_deserialize($_subclass, $_element, $_is_nullable);
}
$self->{$_key} = \%_hash;
} elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
$self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}, $_is_nullable);
} else {
$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
}
}
return $self;
}
# deserialize non-array data
sub _deserialize {
my ($self, $type, $data, $is_nullable) = @_;
$log->debugf("deserializing %s with %s",Dumper($data), $type);
if (!(defined $data) && $is_nullable) {
return undef;
}
if ($type eq 'DateTime') {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
return $data;
} else { # hash(model)
my $_instance = eval "WebService::Fastly::Object::$type->new()";
return $_instance->from_hash($data);
}
}
__PACKAGE__->class_documentation({description => '',
class => 'LoggingGcsCommon',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
'user' => {
datatype => 'string',
base_name => 'user',
description => 'Your Google Cloud Platform service account email address. The `client_email` field in your service account authentication JSON. Not required if `account_name` is specified.',
format => '',
read_only => 'false',
},
'secret_key' => {
datatype => 'string',
base_name => 'secret_key',
description => 'Your Google Cloud Platform account secret key. The `private_key` field in your service account authentication JSON. Not required if `account_name` is specified.',
format => '',
read_only => 'false',
},
'account_name' => {
datatype => 'string',
base_name => 'account_name',
description => 'The name of the Google Cloud Platform service account associated with the target log collection service. Not required if `user` and `secret_key` are provided.',
format => '',
read_only => 'false',
},
});
__PACKAGE__->openapi_types( {
'user' => 'string',
'secret_key' => 'string',
'account_name' => 'string'
} );
__PACKAGE__->attribute_map( {
'user' => 'user',
'secret_key' => 'secret_key',
'account_name' => 'account_name'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
__PACKAGE__->openapi_nullable( {
} );
1;
( run in 1.489 second using v1.01-cache-2.11-cpan-39bf76dae61 )