
org.cdk8s.plus23.PodSecurityContext Maven / Gradle / Ivy
package org.cdk8s.plus23;
/**
* Holds pod-level security attributes and common container settings.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.75.0 (build 63bb957)", date = "2023-02-21T09:46:03.676Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = org.cdk8s.plus23.$Module.class, fqn = "cdk8s-plus-23.PodSecurityContext")
public class PodSecurityContext extends software.amazon.jsii.JsiiObject {
protected PodSecurityContext(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected PodSecurityContext(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public PodSecurityContext(final @org.jetbrains.annotations.Nullable org.cdk8s.plus23.PodSecurityContextProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { props });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public PodSecurityContext() {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.Boolean getEnsureNonRoot() {
return software.amazon.jsii.Kernel.get(this, "ensureNonRoot", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull org.cdk8s.plus23.FsGroupChangePolicy getFsGroupChangePolicy() {
return software.amazon.jsii.Kernel.get(this, "fsGroupChangePolicy", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.FsGroupChangePolicy.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.util.List getSysctls() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "sysctls", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.Sysctl.class))));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.Nullable java.lang.Number getFsGroup() {
return software.amazon.jsii.Kernel.get(this, "fsGroup", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.Nullable java.lang.Number getGroup() {
return software.amazon.jsii.Kernel.get(this, "group", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.Nullable java.lang.Number getUser() {
return software.amazon.jsii.Kernel.get(this, "user", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* A fluent builder for {@link org.cdk8s.plus23.PodSecurityContext}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create() {
return new Builder();
}
private org.cdk8s.plus23.PodSecurityContextProps.Builder props;
private Builder() {
}
/**
* 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.
*
* Default: true
*
* @return {@code this}
* @param ensureNonRoot Indicates that the container must run as a non-root user. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder ensureNonRoot(final java.lang.Boolean ensureNonRoot) {
this.props().ensureNonRoot(ensureNonRoot);
return this;
}
/**
* Modify the ownership and permissions of pod volumes to this GID.
*
* Default: - Volume ownership is not changed.
*
* @return {@code this}
* @param fsGroup Modify the ownership and permissions of pod volumes to this GID. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder fsGroup(final java.lang.Number fsGroup) {
this.props().fsGroup(fsGroup);
return this;
}
/**
* Defines behavior of changing ownership and permission of the volume before being exposed inside Pod.
*
* This field will only apply to volume types which support fsGroup based ownership(and permissions).
* It will have no effect on ephemeral volume types such as: secret, configmaps and emptydir.
*
* Default: FsGroupChangePolicy.ALWAYS
*
* @return {@code this}
* @param fsGroupChangePolicy Defines behavior of changing ownership and permission of the volume before being exposed inside Pod. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder fsGroupChangePolicy(final org.cdk8s.plus23.FsGroupChangePolicy fsGroupChangePolicy) {
this.props().fsGroupChangePolicy(fsGroupChangePolicy);
return this;
}
/**
* The GID to run the entrypoint of the container process.
*
* Default: - Group configured by container runtime
*
* @return {@code this}
* @param group The GID to run the entrypoint of the container process. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder group(final java.lang.Number group) {
this.props().group(group);
return this;
}
/**
* Sysctls hold a list of namespaced sysctls used for the pod.
*
* Pods with unsupported sysctls (by the container runtime) might fail to launch.
*
* Default: - No sysctls
*
* @return {@code this}
* @param sysctls Sysctls hold a list of namespaced sysctls used for the pod. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder sysctls(final java.util.List extends org.cdk8s.plus23.Sysctl> sysctls) {
this.props().sysctls(sysctls);
return this;
}
/**
* The UID to run the entrypoint of the container process.
*
* Default: - User specified in image metadata
*
* @return {@code this}
* @param user The UID to run the entrypoint of the container process. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder user(final java.lang.Number user) {
this.props().user(user);
return this;
}
/**
* @returns a newly built instance of {@link org.cdk8s.plus23.PodSecurityContext}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public org.cdk8s.plus23.PodSecurityContext build() {
return new org.cdk8s.plus23.PodSecurityContext(
this.props != null ? this.props.build() : null
);
}
private org.cdk8s.plus23.PodSecurityContextProps.Builder props() {
if (this.props == null) {
this.props = new org.cdk8s.plus23.PodSecurityContextProps.Builder();
}
return this.props;
}
}
}