Files
perl/lib/Kubernetes/Object/V1PodSecurityContext.pm
2019-05-16 20:27:55 +08:00

264 lines
8.8 KiB
Perl

=begin comment
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: v1.13.7
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::V1PodSecurityContext;
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::V1SELinuxOptions;
use Kubernetes::Object::V1Sysctl;
use base ( "Class::Accessor", "Class::Data::Inheritable" );
#
#PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.
#
# 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)
The version of the OpenAPI document: v1.13.7
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 plain object
sub new {
my ( $class, %args ) = @_;
my $self = bless {}, $class;
$self->init(%args);
return $self;
}
# initialize the object
sub init {
my ( $self, %args ) = @_;
foreach my $attribute ( keys %{ $self->attribute_map } ) {
my $args_key = $self->attribute_map->{$attribute};
$self->$attribute( $args{$args_key} );
}
}
# return perl hash
sub to_hash {
my $self = shift;
my $_hash = decode_json( JSON->new->convert_blessed->encode($self) );
return $_hash;
}
# 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 = $1;
my @_array = ();
foreach my $_element ( @{ $hash->{$_json_attribute} } ) {
push @_array, $self->_deserialize( $_subclass, $_element );
}
$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 );
}
$self->{$_key} = \%_hash;
}
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 =>
'PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.',
class => 'V1PodSecurityContext',
required => [], # TODO
}
);
__PACKAGE__->method_documentation(
{
'fs_group' => {
datatype => 'int',
base_name => 'fsGroup',
description =>
'A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod: 1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw---- If unset, the Kubelet will not modify the ownership and permissions of any volume.',
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 SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.',
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 SecurityContext. 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 SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.',
format => '',
read_only => '',
},
'se_linux_options' => {
datatype => 'V1SELinuxOptions',
base_name => 'seLinuxOptions',
description => '',
format => '',
read_only => '',
},
'supplemental_groups' => {
datatype => 'ARRAY[int]',
base_name => 'supplementalGroups',
description =>
'A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.',
format => '',
read_only => '',
},
'sysctls' => {
datatype => 'ARRAY[V1Sysctl]',
base_name => 'sysctls',
description =>
'Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch.',
format => '',
read_only => '',
},
}
);
__PACKAGE__->openapi_types(
{
'fs_group' => 'int',
'run_as_group' => 'int',
'run_as_non_root' => 'boolean',
'run_as_user' => 'int',
'se_linux_options' => 'V1SELinuxOptions',
'supplemental_groups' => 'ARRAY[int]',
'sysctls' => 'ARRAY[V1Sysctl]'
}
);
__PACKAGE__->attribute_map(
{
'fs_group' => 'fsGroup',
'run_as_group' => 'runAsGroup',
'run_as_non_root' => 'runAsNonRoot',
'run_as_user' => 'runAsUser',
'se_linux_options' => 'seLinuxOptions',
'supplemental_groups' => 'supplementalGroups',
'sysctls' => 'sysctls'
}
);
__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } );
1;