// // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // namespace k8s.Models { using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; /// /// Pod Security Policy Spec defines the policy enforced. /// public partial class Extensionsv1beta1PodSecurityPolicySpec { /// /// Initializes a new instance of the /// Extensionsv1beta1PodSecurityPolicySpec class. /// public Extensionsv1beta1PodSecurityPolicySpec() { CustomInit(); } /// /// Initializes a new instance of the /// Extensionsv1beta1PodSecurityPolicySpec class. /// /// FSGroup is the strategy that will dictate /// what fs group is used by the SecurityContext. /// runAsUser is the strategy that will dictate /// the allowable RunAsUser values that may be set. /// seLinux is the strategy that will dictate the /// allowable labels that may be set. /// SupplementalGroups is the strategy /// that will dictate what supplemental groups are used by the /// SecurityContext. /// AllowPrivilegeEscalation /// determines if a pod can request to allow privilege escalation. If /// unspecified, defaults to true. /// AllowedCapabilities is a list of /// capabilities that can be requested to add to the container. /// Capabilities in this field may be added at the pod author's /// discretion. You must not list a capability in both /// AllowedCapabilities and RequiredDropCapabilities. /// AllowedFlexVolumes is a whitelist /// of allowed Flexvolumes. Empty or nil indicates that all /// Flexvolumes may be used. This parameter is effective only when the /// usage of the Flexvolumes is allowed in the "Volumes" field. /// is a white list of allowed host /// paths. Empty indicates that all host paths may be used. /// DefaultAddCapabilities is the /// default set of capabilities that will be added to the container /// unless the pod spec specifically drops the capability. You may not /// list a capability in both DefaultAddCapabilities and /// RequiredDropCapabilities. Capabilities added here are implicitly /// allowed, and need not be included in the AllowedCapabilities /// list. /// DefaultAllowPrivilegeEscalation /// controls the default setting for whether a process can gain more /// privileges than its parent process. /// hostIPC determines if the policy allows the /// use of HostIPC in the pod spec. /// hostNetwork determines if the policy /// allows the use of HostNetwork in the pod spec. /// hostPID determines if the policy allows the /// use of HostPID in the pod spec. /// hostPorts determines which host port ranges /// are allowed to be exposed. /// privileged determines if a pod can request /// to be run as privileged. /// ReadOnlyRootFilesystem when /// set to true will force containers to run with a read only root file /// system. If the container specifically requests to run with a /// non-read only root file system the PSP should deny the pod. If set /// to false the container may run with a read only root file system if /// it wishes but it will not be forced to. /// RequiredDropCapabilities are /// the capabilities that will be dropped from the container. These /// are required to be dropped and cannot be added. /// volumes is a white list of allowed volume /// plugins. Empty indicates that all plugins may be used. public Extensionsv1beta1PodSecurityPolicySpec(Extensionsv1beta1FSGroupStrategyOptions fsGroup, Extensionsv1beta1RunAsUserStrategyOptions runAsUser, Extensionsv1beta1SELinuxStrategyOptions seLinux, Extensionsv1beta1SupplementalGroupsStrategyOptions supplementalGroups, bool? allowPrivilegeEscalation = default(bool?), IList allowedCapabilities = default(IList), IList allowedFlexVolumes = default(IList), IList allowedHostPaths = default(IList), IList defaultAddCapabilities = default(IList), bool? defaultAllowPrivilegeEscalation = default(bool?), bool? hostIPC = default(bool?), bool? hostNetwork = default(bool?), bool? hostPID = default(bool?), IList hostPorts = default(IList), bool? privileged = default(bool?), bool? readOnlyRootFilesystem = default(bool?), IList requiredDropCapabilities = default(IList), IList volumes = default(IList)) { AllowPrivilegeEscalation = allowPrivilegeEscalation; AllowedCapabilities = allowedCapabilities; AllowedFlexVolumes = allowedFlexVolumes; AllowedHostPaths = allowedHostPaths; DefaultAddCapabilities = defaultAddCapabilities; DefaultAllowPrivilegeEscalation = defaultAllowPrivilegeEscalation; FsGroup = fsGroup; HostIPC = hostIPC; HostNetwork = hostNetwork; HostPID = hostPID; HostPorts = hostPorts; Privileged = privileged; ReadOnlyRootFilesystem = readOnlyRootFilesystem; RequiredDropCapabilities = requiredDropCapabilities; RunAsUser = runAsUser; SeLinux = seLinux; SupplementalGroups = supplementalGroups; Volumes = volumes; CustomInit(); } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); /// /// Gets or sets allowPrivilegeEscalation determines if a pod can /// request to allow privilege escalation. If unspecified, defaults to /// true. /// [JsonProperty(PropertyName = "allowPrivilegeEscalation")] public bool? AllowPrivilegeEscalation { get; set; } /// /// Gets or sets allowedCapabilities is a list of capabilities that can /// be requested to add to the container. Capabilities in this field /// may be added at the pod author's discretion. You must not list a /// capability in both AllowedCapabilities and /// RequiredDropCapabilities. /// [JsonProperty(PropertyName = "allowedCapabilities")] public IList AllowedCapabilities { get; set; } /// /// Gets or sets allowedFlexVolumes is a whitelist of allowed /// Flexvolumes. Empty or nil indicates that all Flexvolumes may be /// used. This parameter is effective only when the usage of the /// Flexvolumes is allowed in the "Volumes" field. /// [JsonProperty(PropertyName = "allowedFlexVolumes")] public IList AllowedFlexVolumes { get; set; } /// /// Gets or sets is a white list of allowed host paths. Empty indicates /// that all host paths may be used. /// [JsonProperty(PropertyName = "allowedHostPaths")] public IList AllowedHostPaths { get; set; } /// /// Gets or sets defaultAddCapabilities is the default set of /// capabilities that will be added to the container unless the pod /// spec specifically drops the capability. You may not list a /// capability in both DefaultAddCapabilities and /// RequiredDropCapabilities. Capabilities added here are implicitly /// allowed, and need not be included in the AllowedCapabilities list. /// [JsonProperty(PropertyName = "defaultAddCapabilities")] public IList DefaultAddCapabilities { get; set; } /// /// Gets or sets defaultAllowPrivilegeEscalation controls the default /// setting for whether a process can gain more privileges than its /// parent process. /// [JsonProperty(PropertyName = "defaultAllowPrivilegeEscalation")] public bool? DefaultAllowPrivilegeEscalation { get; set; } /// /// Gets or sets fSGroup is the strategy that will dictate what fs /// group is used by the SecurityContext. /// [JsonProperty(PropertyName = "fsGroup")] public Extensionsv1beta1FSGroupStrategyOptions FsGroup { get; set; } /// /// Gets or sets hostIPC determines if the policy allows the use of /// HostIPC in the pod spec. /// [JsonProperty(PropertyName = "hostIPC")] public bool? HostIPC { get; set; } /// /// Gets or sets hostNetwork determines if the policy allows the use of /// HostNetwork in the pod spec. /// [JsonProperty(PropertyName = "hostNetwork")] public bool? HostNetwork { get; set; } /// /// Gets or sets hostPID determines if the policy allows the use of /// HostPID in the pod spec. /// [JsonProperty(PropertyName = "hostPID")] public bool? HostPID { get; set; } /// /// Gets or sets hostPorts determines which host port ranges are /// allowed to be exposed. /// [JsonProperty(PropertyName = "hostPorts")] public IList HostPorts { get; set; } /// /// Gets or sets privileged determines if a pod can request to be run /// as privileged. /// [JsonProperty(PropertyName = "privileged")] public bool? Privileged { get; set; } /// /// Gets or sets readOnlyRootFilesystem when set to true will force /// containers to run with a read only root file system. If the /// container specifically requests to run with a non-read only root /// file system the PSP should deny the pod. If set to false the /// container may run with a read only root file system if it wishes /// but it will not be forced to. /// [JsonProperty(PropertyName = "readOnlyRootFilesystem")] public bool? ReadOnlyRootFilesystem { get; set; } /// /// Gets or sets requiredDropCapabilities are the capabilities that /// will be dropped from the container. These are required to be /// dropped and cannot be added. /// [JsonProperty(PropertyName = "requiredDropCapabilities")] public IList RequiredDropCapabilities { get; set; } /// /// Gets or sets runAsUser is the strategy that will dictate the /// allowable RunAsUser values that may be set. /// [JsonProperty(PropertyName = "runAsUser")] public Extensionsv1beta1RunAsUserStrategyOptions RunAsUser { get; set; } /// /// Gets or sets seLinux is the strategy that will dictate the /// allowable labels that may be set. /// [JsonProperty(PropertyName = "seLinux")] public Extensionsv1beta1SELinuxStrategyOptions SeLinux { get; set; } /// /// Gets or sets supplementalGroups is the strategy that will dictate /// what supplemental groups are used by the SecurityContext. /// [JsonProperty(PropertyName = "supplementalGroups")] public Extensionsv1beta1SupplementalGroupsStrategyOptions SupplementalGroups { get; set; } /// /// Gets or sets volumes is a white list of allowed volume plugins. /// Empty indicates that all plugins may be used. /// [JsonProperty(PropertyName = "volumes")] public IList Volumes { get; set; } /// /// Validate the object. /// /// /// Thrown if validation fails /// public virtual void Validate() { if (FsGroup == null) { throw new ValidationException(ValidationRules.CannotBeNull, "FsGroup"); } if (RunAsUser == null) { throw new ValidationException(ValidationRules.CannotBeNull, "RunAsUser"); } if (SeLinux == null) { throw new ValidationException(ValidationRules.CannotBeNull, "SeLinux"); } if (SupplementalGroups == null) { throw new ValidationException(ValidationRules.CannotBeNull, "SupplementalGroups"); } if (AllowedFlexVolumes != null) { foreach (var element in AllowedFlexVolumes) { if (element != null) { element.Validate(); } } } if (HostPorts != null) { foreach (var element1 in HostPorts) { if (element1 != null) { element1.Validate(); } } } if (RunAsUser != null) { RunAsUser.Validate(); } if (SeLinux != null) { SeLinux.Validate(); } } } }