=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::V1PodSpec;

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::V1Affinity;
use Kubernetes::Object::V1Container;
use Kubernetes::Object::V1HostAlias;
use Kubernetes::Object::V1LocalObjectReference;
use Kubernetes::Object::V1PodDNSConfig;
use Kubernetes::Object::V1PodReadinessGate;
use Kubernetes::Object::V1PodSecurityContext;
use Kubernetes::Object::V1Toleration;
use Kubernetes::Object::V1Volume;

use base ("Class::Accessor", "Class::Data::Inheritable");


#
#PodSpec is a description of a pod.
#
# 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 => 'PodSpec is a description of a pod.',
                                  class => 'V1PodSpec',
                                  required => [], # TODO
}                                 );

__PACKAGE__->method_documentation({
    'active_deadline_seconds' => {
    	datatype => 'int',
    	base_name => 'activeDeadlineSeconds',
    	description => 'Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer.',
    	format => '',
    	read_only => '',
    		},
    'affinity' => {
    	datatype => 'V1Affinity',
    	base_name => 'affinity',
    	description => '',
    	format => '',
    	read_only => '',
    		},
    'automount_service_account_token' => {
    	datatype => 'boolean',
    	base_name => 'automountServiceAccountToken',
    	description => 'AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.',
    	format => '',
    	read_only => '',
    		},
    'containers' => {
    	datatype => 'ARRAY[V1Container]',
    	base_name => 'containers',
    	description => 'List of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated.',
    	format => '',
    	read_only => '',
    		},
    'dns_config' => {
    	datatype => 'V1PodDNSConfig',
    	base_name => 'dnsConfig',
    	description => '',
    	format => '',
    	read_only => '',
    		},
    'dns_policy' => {
    	datatype => 'string',
    	base_name => 'dnsPolicy',
    	description => 'Set DNS policy for the pod. Defaults to \&quot;ClusterFirst\&quot;. Valid values are &#39;ClusterFirstWithHostNet&#39;, &#39;ClusterFirst&#39;, &#39;Default&#39; or &#39;None&#39;. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to &#39;ClusterFirstWithHostNet&#39;.',
    	format => '',
    	read_only => '',
    		},
    'enable_service_links' => {
    	datatype => 'boolean',
    	base_name => 'enableServiceLinks',
    	description => 'EnableServiceLinks indicates whether information about services should be injected into pod&#39;s environment variables, matching the syntax of Docker links. Optional: Defaults to true.',
    	format => '',
    	read_only => '',
    		},
    'host_aliases' => {
    	datatype => 'ARRAY[V1HostAlias]',
    	base_name => 'hostAliases',
    	description => 'HostAliases is an optional list of hosts and IPs that will be injected into the pod&#39;s hosts file if specified. This is only valid for non-hostNetwork pods.',
    	format => '',
    	read_only => '',
    		},
    'host_ipc' => {
    	datatype => 'boolean',
    	base_name => 'hostIPC',
    	description => 'Use the host&#39;s ipc namespace. Optional: Default to false.',
    	format => '',
    	read_only => '',
    		},
    'host_network' => {
    	datatype => 'boolean',
    	base_name => 'hostNetwork',
    	description => 'Host networking requested for this pod. Use the host&#39;s network namespace. If this option is set, the ports that will be used must be specified. Default to false.',
    	format => '',
    	read_only => '',
    		},
    'host_pid' => {
    	datatype => 'boolean',
    	base_name => 'hostPID',
    	description => 'Use the host&#39;s pid namespace. Optional: Default to false.',
    	format => '',
    	read_only => '',
    		},
    'hostname' => {
    	datatype => 'string',
    	base_name => 'hostname',
    	description => 'Specifies the hostname of the Pod If not specified, the pod&#39;s hostname will be set to a system-defined value.',
    	format => '',
    	read_only => '',
    		},
    'image_pull_secrets' => {
    	datatype => 'ARRAY[V1LocalObjectReference]',
    	base_name => 'imagePullSecrets',
    	description => 'ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. For example, in the case of docker, only DockerConfig type secrets are honored. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod',
    	format => '',
    	read_only => '',
    		},
    'init_containers' => {
    	datatype => 'ARRAY[V1Container]',
    	base_name => 'initContainers',
    	description => 'List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, or Liveness probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/',
    	format => '',
    	read_only => '',
    		},
    'node_name' => {
    	datatype => 'string',
    	base_name => 'nodeName',
    	description => 'NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements.',
    	format => '',
    	read_only => '',
    		},
    'node_selector' => {
    	datatype => 'HASH[string,string]',
    	base_name => 'nodeSelector',
    	description => 'NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node&#39;s labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/',
    	format => '',
    	read_only => '',
    		},
    'priority' => {
    	datatype => 'int',
    	base_name => 'priority',
    	description => 'The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.',
    	format => '',
    	read_only => '',
    		},
    'priority_class_name' => {
    	datatype => 'string',
    	base_name => 'priorityClassName',
    	description => 'If specified, indicates the pod&#39;s priority. \&quot;system-node-critical\&quot; and \&quot;system-cluster-critical\&quot; are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default.',
    	format => '',
    	read_only => '',
    		},
    'readiness_gates' => {
    	datatype => 'ARRAY[V1PodReadinessGate]',
    	base_name => 'readinessGates',
    	description => 'If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to \&quot;True\&quot; More info: https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md',
    	format => '',
    	read_only => '',
    		},
    'restart_policy' => {
    	datatype => 'string',
    	base_name => 'restartPolicy',
    	description => 'Restart policy for all containers within the pod. One of Always, OnFailure, Never. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy',
    	format => '',
    	read_only => '',
    		},
    'runtime_class_name' => {
    	datatype => 'string',
    	base_name => 'runtimeClassName',
    	description => 'RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod.  If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the \&quot;legacy\&quot; RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://github.com/kubernetes/community/blob/master/keps/sig-node/0014-runtime-class.md This is an alpha feature and may change in the future.',
    	format => '',
    	read_only => '',
    		},
    'scheduler_name' => {
    	datatype => 'string',
    	base_name => 'schedulerName',
    	description => 'If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.',
    	format => '',
    	read_only => '',
    		},
    'security_context' => {
    	datatype => 'V1PodSecurityContext',
    	base_name => 'securityContext',
    	description => '',
    	format => '',
    	read_only => '',
    		},
    'service_account' => {
    	datatype => 'string',
    	base_name => 'serviceAccount',
    	description => 'DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.',
    	format => '',
    	read_only => '',
    		},
    'service_account_name' => {
    	datatype => 'string',
    	base_name => 'serviceAccountName',
    	description => 'ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/',
    	format => '',
    	read_only => '',
    		},
    'share_process_namespace' => {
    	datatype => 'boolean',
    	base_name => 'shareProcessNamespace',
    	description => 'Share a single process namespace between all of the containers in a pod. When this is set containers will be able to view and signal processes from other containers in the same pod, and the first process in each container will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both be set. Optional: Default to false. This field is beta-level and may be disabled with the PodShareProcessNamespace feature.',
    	format => '',
    	read_only => '',
    		},
    'subdomain' => {
    	datatype => 'string',
    	base_name => 'subdomain',
    	description => 'If specified, the fully qualified Pod hostname will be \&quot;&lt;hostname&gt;.&lt;subdomain&gt;.&lt;pod namespace&gt;.svc.&lt;cluster domain&gt;\&quot;. If not specified, the pod will not have a domainname at all.',
    	format => '',
    	read_only => '',
    		},
    'termination_grace_period_seconds' => {
    	datatype => 'int',
    	base_name => 'terminationGracePeriodSeconds',
    	description => 'Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.',
    	format => '',
    	read_only => '',
    		},
    'tolerations' => {
    	datatype => 'ARRAY[V1Toleration]',
    	base_name => 'tolerations',
    	description => 'If specified, the pod&#39;s tolerations.',
    	format => '',
    	read_only => '',
    		},
    'volumes' => {
    	datatype => 'ARRAY[V1Volume]',
    	base_name => 'volumes',
    	description => 'List of volumes that can be mounted by containers belonging to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes',
    	format => '',
    	read_only => '',
    		},
});

__PACKAGE__->openapi_types( {
    'active_deadline_seconds' => 'int',
    'affinity' => 'V1Affinity',
    'automount_service_account_token' => 'boolean',
    'containers' => 'ARRAY[V1Container]',
    'dns_config' => 'V1PodDNSConfig',
    'dns_policy' => 'string',
    'enable_service_links' => 'boolean',
    'host_aliases' => 'ARRAY[V1HostAlias]',
    'host_ipc' => 'boolean',
    'host_network' => 'boolean',
    'host_pid' => 'boolean',
    'hostname' => 'string',
    'image_pull_secrets' => 'ARRAY[V1LocalObjectReference]',
    'init_containers' => 'ARRAY[V1Container]',
    'node_name' => 'string',
    'node_selector' => 'HASH[string,string]',
    'priority' => 'int',
    'priority_class_name' => 'string',
    'readiness_gates' => 'ARRAY[V1PodReadinessGate]',
    'restart_policy' => 'string',
    'runtime_class_name' => 'string',
    'scheduler_name' => 'string',
    'security_context' => 'V1PodSecurityContext',
    'service_account' => 'string',
    'service_account_name' => 'string',
    'share_process_namespace' => 'boolean',
    'subdomain' => 'string',
    'termination_grace_period_seconds' => 'int',
    'tolerations' => 'ARRAY[V1Toleration]',
    'volumes' => 'ARRAY[V1Volume]'
} );

__PACKAGE__->attribute_map( {
    'active_deadline_seconds' => 'activeDeadlineSeconds',
    'affinity' => 'affinity',
    'automount_service_account_token' => 'automountServiceAccountToken',
    'containers' => 'containers',
    'dns_config' => 'dnsConfig',
    'dns_policy' => 'dnsPolicy',
    'enable_service_links' => 'enableServiceLinks',
    'host_aliases' => 'hostAliases',
    'host_ipc' => 'hostIPC',
    'host_network' => 'hostNetwork',
    'host_pid' => 'hostPID',
    'hostname' => 'hostname',
    'image_pull_secrets' => 'imagePullSecrets',
    'init_containers' => 'initContainers',
    'node_name' => 'nodeName',
    'node_selector' => 'nodeSelector',
    'priority' => 'priority',
    'priority_class_name' => 'priorityClassName',
    'readiness_gates' => 'readinessGates',
    'restart_policy' => 'restartPolicy',
    'runtime_class_name' => 'runtimeClassName',
    'scheduler_name' => 'schedulerName',
    'security_context' => 'securityContext',
    'service_account' => 'serviceAccount',
    'service_account_name' => 'serviceAccountName',
    'share_process_namespace' => 'shareProcessNamespace',
    'subdomain' => 'subdomain',
    'termination_grace_period_seconds' => 'terminationGracePeriodSeconds',
    'tolerations' => 'tolerations',
    'volumes' => 'volumes'
} );

__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});


1;
