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

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::V1ContainerStatus;
use Kubernetes::Object::V1PodCondition;

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


#
#PodStatus represents information about the status of a pod. Status may trail the actual state of a system, especially if the node that hosts the pod cannot contact the control plane.
#
# 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 => 'PodStatus represents information about the status of a pod. Status may trail the actual state of a system, especially if the node that hosts the pod cannot contact the control plane.',
                                  class => 'V1PodStatus',
                                  required => [], # TODO
}                                 );

__PACKAGE__->method_documentation({
    'conditions' => {
    	datatype => 'ARRAY[V1PodCondition]',
    	base_name => 'conditions',
    	description => 'Current service state of pod. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions',
    	format => '',
    	read_only => '',
    		},
    'container_statuses' => {
    	datatype => 'ARRAY[V1ContainerStatus]',
    	base_name => 'containerStatuses',
    	description => 'The list has one entry per container in the manifest. Each entry is currently the output of &#x60;docker inspect&#x60;. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status',
    	format => '',
    	read_only => '',
    		},
    'host_ip' => {
    	datatype => 'string',
    	base_name => 'hostIP',
    	description => 'IP address of the host to which the pod is assigned. Empty if not yet scheduled.',
    	format => '',
    	read_only => '',
    		},
    'init_container_statuses' => {
    	datatype => 'ARRAY[V1ContainerStatus]',
    	base_name => 'initContainerStatuses',
    	description => 'The list has one entry per init container in the manifest. The most recent successful init container will have ready &#x3D; true, the most recently started container will have startTime set. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status',
    	format => '',
    	read_only => '',
    		},
    'message' => {
    	datatype => 'string',
    	base_name => 'message',
    	description => 'A human readable message indicating details about why the pod is in this condition.',
    	format => '',
    	read_only => '',
    		},
    'nominated_node_name' => {
    	datatype => 'string',
    	base_name => 'nominatedNodeName',
    	description => 'nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be scheduled right away as preemption victims receive their graceful termination periods. This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to give the resources on this node to a higher priority pod that is created after preemption. As a result, this field may be different than PodSpec.nodeName when the pod is scheduled.',
    	format => '',
    	read_only => '',
    		},
    'phase' => {
    	datatype => 'string',
    	base_name => 'phase',
    	description => 'The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. The conditions array, the reason and message fields, and the individual container status arrays contain more detail about the pod&#39;s status. There are five possible phase values:  Pending: The pod has been accepted by the Kubernetes system, but one or more of the container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while. Running: The pod has been bound to a node, and all of the containers have been created. At least one container is still running, or is in the process of starting or restarting. Succeeded: All containers in the pod have terminated in success, and will not be restarted. Failed: All containers in the pod have terminated, and at least one container has terminated in failure. The container either exited with non-zero status or was terminated by the system. Unknown: For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod.  More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase',
    	format => '',
    	read_only => '',
    		},
    'pod_ip' => {
    	datatype => 'string',
    	base_name => 'podIP',
    	description => 'IP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.',
    	format => '',
    	read_only => '',
    		},
    'qos_class' => {
    	datatype => 'string',
    	base_name => 'qosClass',
    	description => 'The Quality of Service (QOS) classification assigned to the pod based on resource requirements See PodQOSClass type for available QOS classes More info: https://git.k8s.io/community/contributors/design-proposals/node/resource-qos.md',
    	format => '',
    	read_only => '',
    		},
    'reason' => {
    	datatype => 'string',
    	base_name => 'reason',
    	description => 'A brief CamelCase message indicating details about why the pod is in this state. e.g. &#39;Evicted&#39;',
    	format => '',
    	read_only => '',
    		},
    'start_time' => {
    	datatype => 'DateTime',
    	base_name => 'startTime',
    	description => 'RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod.',
    	format => '',
    	read_only => '',
    		},
});

__PACKAGE__->openapi_types( {
    'conditions' => 'ARRAY[V1PodCondition]',
    'container_statuses' => 'ARRAY[V1ContainerStatus]',
    'host_ip' => 'string',
    'init_container_statuses' => 'ARRAY[V1ContainerStatus]',
    'message' => 'string',
    'nominated_node_name' => 'string',
    'phase' => 'string',
    'pod_ip' => 'string',
    'qos_class' => 'string',
    'reason' => 'string',
    'start_time' => 'DateTime'
} );

__PACKAGE__->attribute_map( {
    'conditions' => 'conditions',
    'container_statuses' => 'containerStatuses',
    'host_ip' => 'hostIP',
    'init_container_statuses' => 'initContainerStatuses',
    'message' => 'message',
    'nominated_node_name' => 'nominatedNodeName',
    'phase' => 'phase',
    'pod_ip' => 'podIP',
    'qos_class' => 'qosClass',
    'reason' => 'reason',
    'start_time' => 'startTime'
} );

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


1;
