Files
perl/lib/Kubernetes/Object/V1beta1JSONSchemaProps.pm

484 lines
13 KiB
Perl
Raw Normal View History

2019-03-23 16:42:23 +08:00
=begin comment
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
OpenAPI spec version: v1.13.5
Generated by: https://openapi-generator.tech
=end comment
=cut
#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# Do not edit the class manually.
# Ref: https://openapi-generator.tech
#
package Kubernetes::Object::V1beta1JSONSchemaProps;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::Parse;
use DateTime;
use Kubernetes::Object::V1beta1ExternalDocumentation;
use Kubernetes::Object::V1beta1JSONSchemaProps;
use base ("Class::Accessor", "Class::Data::Inheritable");
#
#JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/).
#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually.
# REF: https://openapi-generator.tech
#
=begin comment
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
OpenAPI spec version: v1.13.5
Generated by: https://openapi-generator.tech
=end comment
=cut
#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# Do not edit the class manually.
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
# new object
sub new {
my ($class, %args) = @_;
my $self = bless {}, $class;
foreach my $attribute (keys %{$class->attribute_map}) {
my $args_key = $class->attribute_map->{$attribute};
$self->$attribute( $args{ $args_key } );
}
return $self;
}
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
foreach my $_key (keys %{$self->attribute_map}) {
if (defined $self->{$_key}) {
$_data->{$self->attribute_map->{$_key}} = $self->{$_key};
}
}
return $_data;
}
# from Perl hashref
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
my @_array = ();
foreach my $_element (@{$hash->{$_json_attribute}}) {
push @_array, $self->_deserialize($_subclass, $_element);
}
$self->{$_key} = \@_array;
} elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
$self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
} 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) = @_;
$log->debugf("deserializing %s with %s",Dumper($data), $type);
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 "Kubernetes::Object::$type->new()";
return $_instance->from_hash($data);
}
}
__PACKAGE__->class_documentation({description => 'JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/).',
class => 'V1beta1JSONSchemaProps',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
'__ref' => {
datatype => 'string',
base_name => '$ref',
description => '',
format => '',
read_only => '',
},
'__schema' => {
datatype => 'string',
base_name => '$schema',
description => '',
format => '',
read_only => '',
},
'additional_items' => {
datatype => 'object',
base_name => 'additionalItems',
description => 'JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value. Defaults to true for the boolean property.',
format => '',
read_only => '',
},
'additional_properties' => {
datatype => 'object',
base_name => 'additionalProperties',
description => 'JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value. Defaults to true for the boolean property.',
format => '',
read_only => '',
},
'all_of' => {
datatype => 'ARRAY[V1beta1JSONSchemaProps]',
base_name => 'allOf',
description => '',
format => '',
read_only => '',
},
'any_of' => {
datatype => 'ARRAY[V1beta1JSONSchemaProps]',
base_name => 'anyOf',
description => '',
format => '',
read_only => '',
},
'default' => {
datatype => 'object',
base_name => 'default',
description => 'JSON represents any valid JSON value. These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil.',
format => '',
read_only => '',
},
'definitions' => {
datatype => 'HASH[string,V1beta1JSONSchemaProps]',
base_name => 'definitions',
description => '',
format => '',
read_only => '',
},
'dependencies' => {
datatype => 'HASH[string,object]',
base_name => 'dependencies',
description => '',
format => '',
read_only => '',
},
'description' => {
datatype => 'string',
base_name => 'description',
description => '',
format => '',
read_only => '',
},
'enum' => {
datatype => 'ARRAY[object]',
base_name => 'enum',
description => '',
format => '',
read_only => '',
},
'example' => {
datatype => 'object',
base_name => 'example',
description => 'JSON represents any valid JSON value. These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil.',
format => '',
read_only => '',
},
'exclusive_maximum' => {
datatype => 'boolean',
base_name => 'exclusiveMaximum',
description => '',
format => '',
read_only => '',
},
'exclusive_minimum' => {
datatype => 'boolean',
base_name => 'exclusiveMinimum',
description => '',
format => '',
read_only => '',
},
'external_docs' => {
datatype => 'V1beta1ExternalDocumentation',
base_name => 'externalDocs',
description => '',
format => '',
read_only => '',
},
'format' => {
datatype => 'string',
base_name => 'format',
description => '',
format => '',
read_only => '',
},
'id' => {
datatype => 'string',
base_name => 'id',
description => '',
format => '',
read_only => '',
},
'items' => {
datatype => 'object',
base_name => 'items',
description => 'JSONSchemaPropsOrArray represents a value that can either be a JSONSchemaProps or an array of JSONSchemaProps. Mainly here for serialization purposes.',
format => '',
read_only => '',
},
'max_items' => {
datatype => 'int',
base_name => 'maxItems',
description => '',
format => '',
read_only => '',
},
'max_length' => {
datatype => 'int',
base_name => 'maxLength',
description => '',
format => '',
read_only => '',
},
'max_properties' => {
datatype => 'int',
base_name => 'maxProperties',
description => '',
format => '',
read_only => '',
},
'maximum' => {
datatype => 'double',
base_name => 'maximum',
description => '',
format => '',
read_only => '',
},
'min_items' => {
datatype => 'int',
base_name => 'minItems',
description => '',
format => '',
read_only => '',
},
'min_length' => {
datatype => 'int',
base_name => 'minLength',
description => '',
format => '',
read_only => '',
},
'min_properties' => {
datatype => 'int',
base_name => 'minProperties',
description => '',
format => '',
read_only => '',
},
'minimum' => {
datatype => 'double',
base_name => 'minimum',
description => '',
format => '',
read_only => '',
},
'multiple_of' => {
datatype => 'double',
base_name => 'multipleOf',
description => '',
format => '',
read_only => '',
},
'not' => {
datatype => 'V1beta1JSONSchemaProps',
base_name => 'not',
description => '',
format => '',
read_only => '',
},
'one_of' => {
datatype => 'ARRAY[V1beta1JSONSchemaProps]',
base_name => 'oneOf',
description => '',
format => '',
read_only => '',
},
'pattern' => {
datatype => 'string',
base_name => 'pattern',
description => '',
format => '',
read_only => '',
},
'pattern_properties' => {
datatype => 'HASH[string,V1beta1JSONSchemaProps]',
base_name => 'patternProperties',
description => '',
format => '',
read_only => '',
},
'properties' => {
datatype => 'HASH[string,V1beta1JSONSchemaProps]',
base_name => 'properties',
description => '',
format => '',
read_only => '',
},
'required' => {
datatype => 'ARRAY[string]',
base_name => 'required',
description => '',
format => '',
read_only => '',
},
'title' => {
datatype => 'string',
base_name => 'title',
description => '',
format => '',
read_only => '',
},
'type' => {
datatype => 'string',
base_name => 'type',
description => '',
format => '',
read_only => '',
},
'unique_items' => {
datatype => 'boolean',
base_name => 'uniqueItems',
description => '',
format => '',
read_only => '',
},
});
__PACKAGE__->openapi_types( {
'__ref' => 'string',
'__schema' => 'string',
'additional_items' => 'object',
'additional_properties' => 'object',
'all_of' => 'ARRAY[V1beta1JSONSchemaProps]',
'any_of' => 'ARRAY[V1beta1JSONSchemaProps]',
'default' => 'object',
'definitions' => 'HASH[string,V1beta1JSONSchemaProps]',
'dependencies' => 'HASH[string,object]',
'description' => 'string',
'enum' => 'ARRAY[object]',
'example' => 'object',
'exclusive_maximum' => 'boolean',
'exclusive_minimum' => 'boolean',
'external_docs' => 'V1beta1ExternalDocumentation',
'format' => 'string',
'id' => 'string',
'items' => 'object',
'max_items' => 'int',
'max_length' => 'int',
'max_properties' => 'int',
'maximum' => 'double',
'min_items' => 'int',
'min_length' => 'int',
'min_properties' => 'int',
'minimum' => 'double',
'multiple_of' => 'double',
'not' => 'V1beta1JSONSchemaProps',
'one_of' => 'ARRAY[V1beta1JSONSchemaProps]',
'pattern' => 'string',
'pattern_properties' => 'HASH[string,V1beta1JSONSchemaProps]',
'properties' => 'HASH[string,V1beta1JSONSchemaProps]',
'required' => 'ARRAY[string]',
'title' => 'string',
'type' => 'string',
'unique_items' => 'boolean'
} );
__PACKAGE__->attribute_map( {
'__ref' => '$ref',
'__schema' => '$schema',
'additional_items' => 'additionalItems',
'additional_properties' => 'additionalProperties',
'all_of' => 'allOf',
'any_of' => 'anyOf',
'default' => 'default',
'definitions' => 'definitions',
'dependencies' => 'dependencies',
'description' => 'description',
'enum' => 'enum',
'example' => 'example',
'exclusive_maximum' => 'exclusiveMaximum',
'exclusive_minimum' => 'exclusiveMinimum',
'external_docs' => 'externalDocs',
'format' => 'format',
'id' => 'id',
'items' => 'items',
'max_items' => 'maxItems',
'max_length' => 'maxLength',
'max_properties' => 'maxProperties',
'maximum' => 'maximum',
'min_items' => 'minItems',
'min_length' => 'minLength',
'min_properties' => 'minProperties',
'minimum' => 'minimum',
'multiple_of' => 'multipleOf',
'not' => 'not',
'one_of' => 'oneOf',
'pattern' => 'pattern',
'pattern_properties' => 'patternProperties',
'properties' => 'properties',
'required' => 'required',
'title' => 'title',
'type' => 'type',
'unique_items' => 'uniqueItems'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;