All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cdk8s.plus23.WorkloadProps Maven / Gradle / Ivy

package org.cdk8s.plus23;

/**
 * Properties for `Workload`.
 */
@javax.annotation.Generated(value = "jsii-pacmak/1.75.0 (build 63bb957)", date = "2023-02-21T09:46:03.707Z")
@software.amazon.jsii.Jsii(module = org.cdk8s.plus23.$Module.class, fqn = "cdk8s-plus-23.WorkloadProps")
@software.amazon.jsii.Jsii.Proxy(WorkloadProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface WorkloadProps extends software.amazon.jsii.JsiiSerializable, org.cdk8s.plus23.AbstractPodProps {

    /**
     * The pod metadata of this workload.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    default @org.jetbrains.annotations.Nullable org.cdk8s.ApiObjectMetadata getPodMetadata() {
        return null;
    }

    /**
     * Automatically allocates a pod label selector for this workload and add it to the pod metadata.
     * 

* This ensures this workload manages pods created by * its pod template. *

* Default: true */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable java.lang.Boolean getSelect() { return null; } /** * Automatically spread pods across hostname and zones. *

* Default: false *

* @see https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#internal-default-constraints */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable java.lang.Boolean getSpread() { return null; } /** * @return a {@link Builder} of {@link WorkloadProps} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) static Builder builder() { return new Builder(); } /** * A builder for {@link WorkloadProps} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static final class Builder implements software.amazon.jsii.Builder { org.cdk8s.ApiObjectMetadata podMetadata; java.lang.Boolean select; java.lang.Boolean spread; java.lang.Boolean automountServiceAccountToken; java.util.List containers; org.cdk8s.plus23.PodDnsProps dns; org.cdk8s.plus23.DockerConfigSecret dockerRegistryAuth; java.util.List hostAliases; java.util.List initContainers; java.lang.Boolean isolate; org.cdk8s.plus23.RestartPolicy restartPolicy; org.cdk8s.plus23.PodSecurityContextProps securityContext; org.cdk8s.plus23.IServiceAccount serviceAccount; java.util.List volumes; org.cdk8s.ApiObjectMetadata metadata; /** * Sets the value of {@link WorkloadProps#getPodMetadata} * @param podMetadata The pod metadata of this workload. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder podMetadata(org.cdk8s.ApiObjectMetadata podMetadata) { this.podMetadata = podMetadata; return this; } /** * Sets the value of {@link WorkloadProps#getSelect} * @param select Automatically allocates a pod label selector for this workload and add it to the pod metadata. * This ensures this workload manages pods created by * its pod template. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder select(java.lang.Boolean select) { this.select = select; return this; } /** * Sets the value of {@link WorkloadProps#getSpread} * @param spread Automatically spread pods across hostname and zones. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder spread(java.lang.Boolean spread) { this.spread = spread; return this; } /** * Sets the value of {@link WorkloadProps#getAutomountServiceAccountToken} * @param automountServiceAccountToken Indicates whether a service account token should be automatically mounted. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder automountServiceAccountToken(java.lang.Boolean automountServiceAccountToken) { this.automountServiceAccountToken = automountServiceAccountToken; return this; } /** * Sets the value of {@link WorkloadProps#getContainers} * @param containers 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() * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @SuppressWarnings("unchecked") public Builder containers(java.util.List containers) { this.containers = (java.util.List)containers; return this; } /** * Sets the value of {@link WorkloadProps#getDns} * @param dns DNS settings for the pod. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder dns(org.cdk8s.plus23.PodDnsProps dns) { this.dns = dns; return this; } /** * Sets the value of {@link WorkloadProps#getDockerRegistryAuth} * @param dockerRegistryAuth A secret containing docker credentials for authenticating to a registry. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder dockerRegistryAuth(org.cdk8s.plus23.DockerConfigSecret dockerRegistryAuth) { this.dockerRegistryAuth = dockerRegistryAuth; return this; } /** * Sets the value of {@link WorkloadProps#getHostAliases} * @param hostAliases HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @SuppressWarnings("unchecked") public Builder hostAliases(java.util.List hostAliases) { this.hostAliases = (java.util.List)hostAliases; return this; } /** * Sets the value of {@link WorkloadProps#getInitContainers} * @param initContainers 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. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @SuppressWarnings("unchecked") public Builder initContainers(java.util.List initContainers) { this.initContainers = (java.util.List)initContainers; return this; } /** * Sets the value of {@link WorkloadProps#getIsolate} * @param isolate 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. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder isolate(java.lang.Boolean isolate) { this.isolate = isolate; return this; } /** * Sets the value of {@link WorkloadProps#getRestartPolicy} * @param restartPolicy Restart policy for all containers within the pod. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder restartPolicy(org.cdk8s.plus23.RestartPolicy restartPolicy) { this.restartPolicy = restartPolicy; return this; } /** * Sets the value of {@link WorkloadProps#getSecurityContext} * @param securityContext SecurityContext holds pod-level security attributes and common container settings. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder securityContext(org.cdk8s.plus23.PodSecurityContextProps securityContext) { this.securityContext = securityContext; return this; } /** * Sets the value of {@link WorkloadProps#getServiceAccount} * @param serviceAccount 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). * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder serviceAccount(org.cdk8s.plus23.IServiceAccount serviceAccount) { this.serviceAccount = serviceAccount; return this; } /** * Sets the value of {@link WorkloadProps#getVolumes} * @param volumes List of volumes that can be mounted by containers belonging to the pod. * You can also add volumes later using podSpec.addVolume() * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @SuppressWarnings("unchecked") public Builder volumes(java.util.List volumes) { this.volumes = (java.util.List)volumes; return this; } /** * Sets the value of {@link WorkloadProps#getMetadata} * @param metadata Metadata that all persisted resources must have, which includes all objects users must create. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder metadata(org.cdk8s.ApiObjectMetadata metadata) { this.metadata = metadata; return this; } /** * Builds the configured instance. * @return a new instance of {@link WorkloadProps} * @throws NullPointerException if any required attribute was not provided */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public WorkloadProps build() { return new Jsii$Proxy(this); } } /** * An implementation for {@link WorkloadProps} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements WorkloadProps { private final org.cdk8s.ApiObjectMetadata podMetadata; private final java.lang.Boolean select; private final java.lang.Boolean spread; private final java.lang.Boolean automountServiceAccountToken; private final java.util.List containers; private final org.cdk8s.plus23.PodDnsProps dns; private final org.cdk8s.plus23.DockerConfigSecret dockerRegistryAuth; private final java.util.List hostAliases; private final java.util.List initContainers; private final java.lang.Boolean isolate; private final org.cdk8s.plus23.RestartPolicy restartPolicy; private final org.cdk8s.plus23.PodSecurityContextProps securityContext; private final org.cdk8s.plus23.IServiceAccount serviceAccount; private final java.util.List volumes; private final org.cdk8s.ApiObjectMetadata metadata; /** * Constructor that initializes the object based on values retrieved from the JsiiObject. * @param objRef Reference to the JSII managed object. */ protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); this.podMetadata = software.amazon.jsii.Kernel.get(this, "podMetadata", software.amazon.jsii.NativeType.forClass(org.cdk8s.ApiObjectMetadata.class)); this.select = software.amazon.jsii.Kernel.get(this, "select", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class)); this.spread = software.amazon.jsii.Kernel.get(this, "spread", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class)); this.automountServiceAccountToken = software.amazon.jsii.Kernel.get(this, "automountServiceAccountToken", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class)); this.containers = software.amazon.jsii.Kernel.get(this, "containers", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.ContainerProps.class))); this.dns = software.amazon.jsii.Kernel.get(this, "dns", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.PodDnsProps.class)); this.dockerRegistryAuth = software.amazon.jsii.Kernel.get(this, "dockerRegistryAuth", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.DockerConfigSecret.class)); this.hostAliases = software.amazon.jsii.Kernel.get(this, "hostAliases", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.HostAlias.class))); this.initContainers = software.amazon.jsii.Kernel.get(this, "initContainers", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.ContainerProps.class))); this.isolate = software.amazon.jsii.Kernel.get(this, "isolate", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class)); this.restartPolicy = software.amazon.jsii.Kernel.get(this, "restartPolicy", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.RestartPolicy.class)); this.securityContext = software.amazon.jsii.Kernel.get(this, "securityContext", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.PodSecurityContextProps.class)); this.serviceAccount = software.amazon.jsii.Kernel.get(this, "serviceAccount", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.IServiceAccount.class)); this.volumes = software.amazon.jsii.Kernel.get(this, "volumes", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.Volume.class))); this.metadata = software.amazon.jsii.Kernel.get(this, "metadata", software.amazon.jsii.NativeType.forClass(org.cdk8s.ApiObjectMetadata.class)); } /** * Constructor that initializes the object based on literal property values passed by the {@link Builder}. */ @SuppressWarnings("unchecked") protected Jsii$Proxy(final Builder builder) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); this.podMetadata = builder.podMetadata; this.select = builder.select; this.spread = builder.spread; this.automountServiceAccountToken = builder.automountServiceAccountToken; this.containers = (java.util.List)builder.containers; this.dns = builder.dns; this.dockerRegistryAuth = builder.dockerRegistryAuth; this.hostAliases = (java.util.List)builder.hostAliases; this.initContainers = (java.util.List)builder.initContainers; this.isolate = builder.isolate; this.restartPolicy = builder.restartPolicy; this.securityContext = builder.securityContext; this.serviceAccount = builder.serviceAccount; this.volumes = (java.util.List)builder.volumes; this.metadata = builder.metadata; } @Override public final org.cdk8s.ApiObjectMetadata getPodMetadata() { return this.podMetadata; } @Override public final java.lang.Boolean getSelect() { return this.select; } @Override public final java.lang.Boolean getSpread() { return this.spread; } @Override public final java.lang.Boolean getAutomountServiceAccountToken() { return this.automountServiceAccountToken; } @Override public final java.util.List getContainers() { return this.containers; } @Override public final org.cdk8s.plus23.PodDnsProps getDns() { return this.dns; } @Override public final org.cdk8s.plus23.DockerConfigSecret getDockerRegistryAuth() { return this.dockerRegistryAuth; } @Override public final java.util.List getHostAliases() { return this.hostAliases; } @Override public final java.util.List getInitContainers() { return this.initContainers; } @Override public final java.lang.Boolean getIsolate() { return this.isolate; } @Override public final org.cdk8s.plus23.RestartPolicy getRestartPolicy() { return this.restartPolicy; } @Override public final org.cdk8s.plus23.PodSecurityContextProps getSecurityContext() { return this.securityContext; } @Override public final org.cdk8s.plus23.IServiceAccount getServiceAccount() { return this.serviceAccount; } @Override public final java.util.List getVolumes() { return this.volumes; } @Override public final org.cdk8s.ApiObjectMetadata getMetadata() { return this.metadata; } @Override @software.amazon.jsii.Internal public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); if (this.getPodMetadata() != null) { data.set("podMetadata", om.valueToTree(this.getPodMetadata())); } if (this.getSelect() != null) { data.set("select", om.valueToTree(this.getSelect())); } if (this.getSpread() != null) { data.set("spread", om.valueToTree(this.getSpread())); } if (this.getAutomountServiceAccountToken() != null) { data.set("automountServiceAccountToken", om.valueToTree(this.getAutomountServiceAccountToken())); } if (this.getContainers() != null) { data.set("containers", om.valueToTree(this.getContainers())); } if (this.getDns() != null) { data.set("dns", om.valueToTree(this.getDns())); } if (this.getDockerRegistryAuth() != null) { data.set("dockerRegistryAuth", om.valueToTree(this.getDockerRegistryAuth())); } if (this.getHostAliases() != null) { data.set("hostAliases", om.valueToTree(this.getHostAliases())); } if (this.getInitContainers() != null) { data.set("initContainers", om.valueToTree(this.getInitContainers())); } if (this.getIsolate() != null) { data.set("isolate", om.valueToTree(this.getIsolate())); } if (this.getRestartPolicy() != null) { data.set("restartPolicy", om.valueToTree(this.getRestartPolicy())); } if (this.getSecurityContext() != null) { data.set("securityContext", om.valueToTree(this.getSecurityContext())); } if (this.getServiceAccount() != null) { data.set("serviceAccount", om.valueToTree(this.getServiceAccount())); } if (this.getVolumes() != null) { data.set("volumes", om.valueToTree(this.getVolumes())); } if (this.getMetadata() != null) { data.set("metadata", om.valueToTree(this.getMetadata())); } final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); struct.set("fqn", om.valueToTree("cdk8s-plus-23.WorkloadProps")); struct.set("data", data); final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); obj.set("$jsii.struct", struct); return obj; } @Override public final boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; WorkloadProps.Jsii$Proxy that = (WorkloadProps.Jsii$Proxy) o; if (this.podMetadata != null ? !this.podMetadata.equals(that.podMetadata) : that.podMetadata != null) return false; if (this.select != null ? !this.select.equals(that.select) : that.select != null) return false; if (this.spread != null ? !this.spread.equals(that.spread) : that.spread != null) return false; if (this.automountServiceAccountToken != null ? !this.automountServiceAccountToken.equals(that.automountServiceAccountToken) : that.automountServiceAccountToken != null) return false; if (this.containers != null ? !this.containers.equals(that.containers) : that.containers != null) return false; if (this.dns != null ? !this.dns.equals(that.dns) : that.dns != null) return false; if (this.dockerRegistryAuth != null ? !this.dockerRegistryAuth.equals(that.dockerRegistryAuth) : that.dockerRegistryAuth != null) return false; if (this.hostAliases != null ? !this.hostAliases.equals(that.hostAliases) : that.hostAliases != null) return false; if (this.initContainers != null ? !this.initContainers.equals(that.initContainers) : that.initContainers != null) return false; if (this.isolate != null ? !this.isolate.equals(that.isolate) : that.isolate != null) return false; if (this.restartPolicy != null ? !this.restartPolicy.equals(that.restartPolicy) : that.restartPolicy != null) return false; if (this.securityContext != null ? !this.securityContext.equals(that.securityContext) : that.securityContext != null) return false; if (this.serviceAccount != null ? !this.serviceAccount.equals(that.serviceAccount) : that.serviceAccount != null) return false; if (this.volumes != null ? !this.volumes.equals(that.volumes) : that.volumes != null) return false; return this.metadata != null ? this.metadata.equals(that.metadata) : that.metadata == null; } @Override public final int hashCode() { int result = this.podMetadata != null ? this.podMetadata.hashCode() : 0; result = 31 * result + (this.select != null ? this.select.hashCode() : 0); result = 31 * result + (this.spread != null ? this.spread.hashCode() : 0); result = 31 * result + (this.automountServiceAccountToken != null ? this.automountServiceAccountToken.hashCode() : 0); result = 31 * result + (this.containers != null ? this.containers.hashCode() : 0); result = 31 * result + (this.dns != null ? this.dns.hashCode() : 0); result = 31 * result + (this.dockerRegistryAuth != null ? this.dockerRegistryAuth.hashCode() : 0); result = 31 * result + (this.hostAliases != null ? this.hostAliases.hashCode() : 0); result = 31 * result + (this.initContainers != null ? this.initContainers.hashCode() : 0); result = 31 * result + (this.isolate != null ? this.isolate.hashCode() : 0); result = 31 * result + (this.restartPolicy != null ? this.restartPolicy.hashCode() : 0); result = 31 * result + (this.securityContext != null ? this.securityContext.hashCode() : 0); result = 31 * result + (this.serviceAccount != null ? this.serviceAccount.hashCode() : 0); result = 31 * result + (this.volumes != null ? this.volumes.hashCode() : 0); result = 31 * result + (this.metadata != null ? this.metadata.hashCode() : 0); return result; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy