
org.cdk8s.plus23.Pod Maven / Gradle / Ivy
package org.cdk8s.plus23;
/**
* Pod is a collection of containers that can run on a host.
*
* This resource is
* created by clients and scheduled onto hosts.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.75.0 (build 63bb957)", date = "2023-02-21T09:46:03.664Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = org.cdk8s.plus23.$Module.class, fqn = "cdk8s-plus-23.Pod")
public class Pod extends org.cdk8s.plus23.AbstractPod {
protected Pod(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Pod(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
static {
ADDRESS_LABEL = software.amazon.jsii.JsiiObject.jsiiStaticGet(org.cdk8s.plus23.Pod.class, "ADDRESS_LABEL", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Pod(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable org.cdk8s.plus23.PodProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), props });
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Pod(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* This label is autoamtically added by cdk8s to any pod.
*
* It provides
* a unique and stable identifier for the pod.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public final static java.lang.String ADDRESS_LABEL;
/**
* The underlying cdk8s API object.
*
* @see base.Resource.apiObject
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
protected @org.jetbrains.annotations.NotNull org.cdk8s.ApiObject getApiObject() {
return software.amazon.jsii.Kernel.get(this, "apiObject", software.amazon.jsii.NativeType.forClass(org.cdk8s.ApiObject.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull org.cdk8s.plus23.PodConnections getConnections() {
return software.amazon.jsii.Kernel.get(this, "connections", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.PodConnections.class));
}
/**
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull org.cdk8s.ApiObjectMetadataDefinition getPodMetadata() {
return software.amazon.jsii.Kernel.get(this, "podMetadata", software.amazon.jsii.NativeType.forClass(org.cdk8s.ApiObjectMetadataDefinition.class));
}
/**
* The name of a resource type as it appears in the relevant API endpoint.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.String getResourceType() {
return software.amazon.jsii.Kernel.get(this, "resourceType", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull org.cdk8s.plus23.PodScheduling getScheduling() {
return software.amazon.jsii.Kernel.get(this, "scheduling", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.PodScheduling.class));
}
/**
* A fluent builder for {@link org.cdk8s.plus23.Pod}.
*/
@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}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private org.cdk8s.plus23.PodProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
}
/**
* Metadata that all persisted resources must have, which includes all objects users must create.
*
* @return {@code this}
* @param metadata Metadata that all persisted resources must have, which includes all objects users must create. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder metadata(final org.cdk8s.ApiObjectMetadata metadata) {
this.props().metadata(metadata);
return this;
}
/**
* Indicates whether a service account token should be automatically mounted.
*
* Default: false
*
* @return {@code this}
* @see https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
* @param automountServiceAccountToken Indicates whether a service account token should be automatically mounted. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder automountServiceAccountToken(final java.lang.Boolean automountServiceAccountToken) {
this.props().automountServiceAccountToken(automountServiceAccountToken);
return this;
}
/**
* List of containers belonging to the pod.
*
* Containers cannot currently be
* added or removed. There must be at least one container in a Pod.
*
* You can add additionnal containers using podSpec.addContainer()
*
* Default: - No containers. Note that a pod spec must include at least one container.
*
* @return {@code this}
* @param containers List of containers belonging to the pod. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder containers(final java.util.List extends org.cdk8s.plus23.ContainerProps> containers) {
this.props().containers(containers);
return this;
}
/**
* DNS settings for the pod.
*
* Default: policy: DnsPolicy.CLUSTER_FIRST
* hostnameAsFQDN: false
*
* @return {@code this}
* @see https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
* @param dns DNS settings for the pod. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder dns(final org.cdk8s.plus23.PodDnsProps dns) {
this.props().dns(dns);
return this;
}
/**
* A secret containing docker credentials for authenticating to a registry.
*
* Default: - No auth. Images are assumed to be publicly available.
*
* @return {@code this}
* @param dockerRegistryAuth A secret containing docker credentials for authenticating to a registry. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder dockerRegistryAuth(final org.cdk8s.plus23.DockerConfigSecret dockerRegistryAuth) {
this.props().dockerRegistryAuth(dockerRegistryAuth);
return this;
}
/**
* HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.
*
* @return {@code this}
* @param hostAliases HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder hostAliases(final java.util.List extends org.cdk8s.plus23.HostAlias> hostAliases) {
this.props().hostAliases(hostAliases);
return this;
}
/**
* List of initialization containers belonging to the pod.
*
* Init containers are executed in order prior to containers being started.
* If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy.
* The name for an init container or normal container must be unique among all containers.
* Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes.
* The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit
* for each resource type, and then using the max of of that value or the sum of the normal containers.
* Limits are applied to init containers in a similar fashion.
*
* Init containers cannot currently be added ,removed or updated.
*
* Default: - No init containers.
*
* @return {@code this}
* @see https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
* @param initContainers List of initialization containers belonging to the pod. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder initContainers(final java.util.List extends org.cdk8s.plus23.ContainerProps> initContainers) {
this.props().initContainers(initContainers);
return this;
}
/**
* Isolates the pod.
*
* This will prevent any ingress or egress connections to / from this pod.
* You can however allow explicit connections post instantiation by using the .connections
property.
*
* Default: false
*
* @return {@code this}
* @param isolate Isolates the pod. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder isolate(final java.lang.Boolean isolate) {
this.props().isolate(isolate);
return this;
}
/**
* Restart policy for all containers within the pod.
*
* Default: RestartPolicy.ALWAYS
*
* @return {@code this}
* @see https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
* @param restartPolicy Restart policy for all containers within the pod. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder restartPolicy(final org.cdk8s.plus23.RestartPolicy restartPolicy) {
this.props().restartPolicy(restartPolicy);
return this;
}
/**
* SecurityContext holds pod-level security attributes and common container settings.
*
* Default: fsGroupChangePolicy: FsGroupChangePolicy.FsGroupChangePolicy.ALWAYS
* ensureNonRoot: true
*
* @return {@code this}
* @param securityContext SecurityContext holds pod-level security attributes and common container settings. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder securityContext(final org.cdk8s.plus23.PodSecurityContextProps securityContext) {
this.props().securityContext(securityContext);
return this;
}
/**
* A service account provides an identity for processes that run in a Pod.
*
* When you (a human) access the cluster (for example, using kubectl), you are
* authenticated by the apiserver as a particular User Account (currently this
* is usually admin, unless your cluster administrator has customized your
* cluster). Processes in containers inside pods can also contact the
* apiserver. When they do, they are authenticated as a particular Service
* Account (for example, default).
*
* Default: - No service account.
*
* @return {@code this}
* @see https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
* @param serviceAccount A service account provides an identity for processes that run in a Pod. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder serviceAccount(final org.cdk8s.plus23.IServiceAccount serviceAccount) {
this.props().serviceAccount(serviceAccount);
return this;
}
/**
* List of volumes that can be mounted by containers belonging to the pod.
*
* You can also add volumes later using podSpec.addVolume()
*
* Default: - No volumes.
*
* @return {@code this}
* @see https://kubernetes.io/docs/concepts/storage/volumes
* @param volumes List of volumes that can be mounted by containers belonging to the pod. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder volumes(final java.util.List extends org.cdk8s.plus23.Volume> volumes) {
this.props().volumes(volumes);
return this;
}
/**
* @returns a newly built instance of {@link org.cdk8s.plus23.Pod}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public org.cdk8s.plus23.Pod build() {
return new org.cdk8s.plus23.Pod(
this.scope,
this.id,
this.props != null ? this.props.build() : null
);
}
private org.cdk8s.plus23.PodProps.Builder props() {
if (this.props == null) {
this.props = new org.cdk8s.plus23.PodProps.Builder();
}
return this.props;
}
}
}