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

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::V1Capabilities;
use Kubernetes::Object::V1SELinuxOptions;

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


#
#SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext.  When both are set, the values in SecurityContext take precedence.
#
# 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 => 'SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext.  When both are set, the values in SecurityContext take precedence.',
                                  class => 'V1SecurityContext',
                                  required => [], # TODO
}                                 );

__PACKAGE__->method_documentation({
    'allow_privilege_escalation' => {
    	datatype => 'boolean',
    	base_name => 'allowPrivilegeEscalation',
    	description => 'AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN',
    	format => '',
    	read_only => '',
    		},
    'capabilities' => {
    	datatype => 'V1Capabilities',
    	base_name => 'capabilities',
    	description => '',
    	format => '',
    	read_only => '',
    		},
    'privileged' => {
    	datatype => 'boolean',
    	base_name => 'privileged',
    	description => 'Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.',
    	format => '',
    	read_only => '',
    		},
    'proc_mount' => {
    	datatype => 'string',
    	base_name => 'procMount',
    	description => 'procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled.',
    	format => '',
    	read_only => '',
    		},
    'read_only_root_filesystem' => {
    	datatype => 'boolean',
    	base_name => 'readOnlyRootFilesystem',
    	description => 'Whether this container has a read-only root filesystem. Default is false.',
    	format => '',
    	read_only => '',
    		},
    'run_as_group' => {
    	datatype => 'int',
    	base_name => 'runAsGroup',
    	description => 'The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext.  If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.',
    	format => '',
    	read_only => '',
    		},
    'run_as_non_root' => {
    	datatype => 'boolean',
    	base_name => 'runAsNonRoot',
    	description => 'Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext.  If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.',
    	format => '',
    	read_only => '',
    		},
    'run_as_user' => {
    	datatype => 'int',
    	base_name => 'runAsUser',
    	description => 'The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext.  If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.',
    	format => '',
    	read_only => '',
    		},
    'se_linux_options' => {
    	datatype => 'V1SELinuxOptions',
    	base_name => 'seLinuxOptions',
    	description => '',
    	format => '',
    	read_only => '',
    		},
});

__PACKAGE__->openapi_types( {
    'allow_privilege_escalation' => 'boolean',
    'capabilities' => 'V1Capabilities',
    'privileged' => 'boolean',
    'proc_mount' => 'string',
    'read_only_root_filesystem' => 'boolean',
    'run_as_group' => 'int',
    'run_as_non_root' => 'boolean',
    'run_as_user' => 'int',
    'se_linux_options' => 'V1SELinuxOptions'
} );

__PACKAGE__->attribute_map( {
    'allow_privilege_escalation' => 'allowPrivilegeEscalation',
    'capabilities' => 'capabilities',
    'privileged' => 'privileged',
    'proc_mount' => 'procMount',
    'read_only_root_filesystem' => 'readOnlyRootFilesystem',
    'run_as_group' => 'runAsGroup',
    'run_as_non_root' => 'runAsNonRoot',
    'run_as_user' => 'runAsUser',
    'se_linux_options' => 'seLinuxOptions'
} );

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


1;
