k8s.io/client-go@v0.22.2/applyconfigurations/core/v1/podsecuritycontext.go (about)

     1  /*
     2  Copyright The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  // Code generated by applyconfiguration-gen. DO NOT EDIT.
    18  
    19  package v1
    20  
    21  import (
    22  	corev1 "k8s.io/api/core/v1"
    23  )
    24  
    25  // PodSecurityContextApplyConfiguration represents an declarative configuration of the PodSecurityContext type for use
    26  // with apply.
    27  type PodSecurityContextApplyConfiguration struct {
    28  	SELinuxOptions      *SELinuxOptionsApplyConfiguration                `json:"seLinuxOptions,omitempty"`
    29  	WindowsOptions      *WindowsSecurityContextOptionsApplyConfiguration `json:"windowsOptions,omitempty"`
    30  	RunAsUser           *int64                                           `json:"runAsUser,omitempty"`
    31  	RunAsGroup          *int64                                           `json:"runAsGroup,omitempty"`
    32  	RunAsNonRoot        *bool                                            `json:"runAsNonRoot,omitempty"`
    33  	SupplementalGroups  []int64                                          `json:"supplementalGroups,omitempty"`
    34  	FSGroup             *int64                                           `json:"fsGroup,omitempty"`
    35  	Sysctls             []SysctlApplyConfiguration                       `json:"sysctls,omitempty"`
    36  	FSGroupChangePolicy *corev1.PodFSGroupChangePolicy                   `json:"fsGroupChangePolicy,omitempty"`
    37  	SeccompProfile      *SeccompProfileApplyConfiguration                `json:"seccompProfile,omitempty"`
    38  }
    39  
    40  // PodSecurityContextApplyConfiguration constructs an declarative configuration of the PodSecurityContext type for use with
    41  // apply.
    42  func PodSecurityContext() *PodSecurityContextApplyConfiguration {
    43  	return &PodSecurityContextApplyConfiguration{}
    44  }
    45  
    46  // WithSELinuxOptions sets the SELinuxOptions field in the declarative configuration to the given value
    47  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    48  // If called multiple times, the SELinuxOptions field is set to the value of the last call.
    49  func (b *PodSecurityContextApplyConfiguration) WithSELinuxOptions(value *SELinuxOptionsApplyConfiguration) *PodSecurityContextApplyConfiguration {
    50  	b.SELinuxOptions = value
    51  	return b
    52  }
    53  
    54  // WithWindowsOptions sets the WindowsOptions field in the declarative configuration to the given value
    55  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    56  // If called multiple times, the WindowsOptions field is set to the value of the last call.
    57  func (b *PodSecurityContextApplyConfiguration) WithWindowsOptions(value *WindowsSecurityContextOptionsApplyConfiguration) *PodSecurityContextApplyConfiguration {
    58  	b.WindowsOptions = value
    59  	return b
    60  }
    61  
    62  // WithRunAsUser sets the RunAsUser field in the declarative configuration to the given value
    63  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    64  // If called multiple times, the RunAsUser field is set to the value of the last call.
    65  func (b *PodSecurityContextApplyConfiguration) WithRunAsUser(value int64) *PodSecurityContextApplyConfiguration {
    66  	b.RunAsUser = &value
    67  	return b
    68  }
    69  
    70  // WithRunAsGroup sets the RunAsGroup field in the declarative configuration to the given value
    71  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    72  // If called multiple times, the RunAsGroup field is set to the value of the last call.
    73  func (b *PodSecurityContextApplyConfiguration) WithRunAsGroup(value int64) *PodSecurityContextApplyConfiguration {
    74  	b.RunAsGroup = &value
    75  	return b
    76  }
    77  
    78  // WithRunAsNonRoot sets the RunAsNonRoot field in the declarative configuration to the given value
    79  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    80  // If called multiple times, the RunAsNonRoot field is set to the value of the last call.
    81  func (b *PodSecurityContextApplyConfiguration) WithRunAsNonRoot(value bool) *PodSecurityContextApplyConfiguration {
    82  	b.RunAsNonRoot = &value
    83  	return b
    84  }
    85  
    86  // WithSupplementalGroups adds the given value to the SupplementalGroups field in the declarative configuration
    87  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
    88  // If called multiple times, values provided by each call will be appended to the SupplementalGroups field.
    89  func (b *PodSecurityContextApplyConfiguration) WithSupplementalGroups(values ...int64) *PodSecurityContextApplyConfiguration {
    90  	for i := range values {
    91  		b.SupplementalGroups = append(b.SupplementalGroups, values[i])
    92  	}
    93  	return b
    94  }
    95  
    96  // WithFSGroup sets the FSGroup field in the declarative configuration to the given value
    97  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    98  // If called multiple times, the FSGroup field is set to the value of the last call.
    99  func (b *PodSecurityContextApplyConfiguration) WithFSGroup(value int64) *PodSecurityContextApplyConfiguration {
   100  	b.FSGroup = &value
   101  	return b
   102  }
   103  
   104  // WithSysctls adds the given value to the Sysctls field in the declarative configuration
   105  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
   106  // If called multiple times, values provided by each call will be appended to the Sysctls field.
   107  func (b *PodSecurityContextApplyConfiguration) WithSysctls(values ...*SysctlApplyConfiguration) *PodSecurityContextApplyConfiguration {
   108  	for i := range values {
   109  		if values[i] == nil {
   110  			panic("nil value passed to WithSysctls")
   111  		}
   112  		b.Sysctls = append(b.Sysctls, *values[i])
   113  	}
   114  	return b
   115  }
   116  
   117  // WithFSGroupChangePolicy sets the FSGroupChangePolicy field in the declarative configuration to the given value
   118  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   119  // If called multiple times, the FSGroupChangePolicy field is set to the value of the last call.
   120  func (b *PodSecurityContextApplyConfiguration) WithFSGroupChangePolicy(value corev1.PodFSGroupChangePolicy) *PodSecurityContextApplyConfiguration {
   121  	b.FSGroupChangePolicy = &value
   122  	return b
   123  }
   124  
   125  // WithSeccompProfile sets the SeccompProfile field in the declarative configuration to the given value
   126  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   127  // If called multiple times, the SeccompProfile field is set to the value of the last call.
   128  func (b *PodSecurityContextApplyConfiguration) WithSeccompProfile(value *SeccompProfileApplyConfiguration) *PodSecurityContextApplyConfiguration {
   129  	b.SeccompProfile = value
   130  	return b
   131  }