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

org.cdk8s.plus.Container Maven / Gradle / Ivy

There is a newer version: 0.33.0
Show newest version
package org.cdk8s.plus;

/**
 * A single application container that you want to run within a pod.
 * 

* EXPERIMENTAL */ @javax.annotation.Generated(value = "jsii-pacmak/1.7.0 (build 179a3a5)", date = "2020-06-29T13:29:38.480Z") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @software.amazon.jsii.Jsii(module = org.cdk8s.plus.$Module.class, fqn = "cdk8s-plus.Container") public class Container extends software.amazon.jsii.JsiiObject { protected Container(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected Container(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } /** * EXPERIMENTAL *

* @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Container(final @org.jetbrains.annotations.NotNull org.cdk8s.plus.ContainerProps props) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(props, "props is required") }); } /** * Add an environment value to the container. *

* The variable value can come * from various dynamic sources such a secrets of config maps. *

* EXPERIMENTAL *

* @see EnvValue.fromXXX * @param name - The variable name. This parameter is required. * @param value - The variable value. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public void addEnv(final @org.jetbrains.annotations.NotNull java.lang.String name, final @org.jetbrains.annotations.NotNull org.cdk8s.plus.EnvValue value) { this.jsiiCall("addEnv", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(name, "name is required"), java.util.Objects.requireNonNull(value, "value is required") }); } /** * Mount a volume to a specific path so that it is accessible by the container. *

* Every pod that is configured to use this container will autmoatically have access to the volume. *

* EXPERIMENTAL *

* @param path - The desired path in the container. This parameter is required. * @param volume - The volume to mount. This parameter is required. * @param options */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public void mount(final @org.jetbrains.annotations.NotNull java.lang.String path, final @org.jetbrains.annotations.NotNull org.cdk8s.plus.Volume volume, final @org.jetbrains.annotations.Nullable org.cdk8s.plus.MountOptions options) { this.jsiiCall("mount", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(path, "path is required"), java.util.Objects.requireNonNull(volume, "volume is required"), options }); } /** * Mount a volume to a specific path so that it is accessible by the container. *

* Every pod that is configured to use this container will autmoatically have access to the volume. *

* EXPERIMENTAL *

* @param path - The desired path in the container. This parameter is required. * @param volume - The volume to mount. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public void mount(final @org.jetbrains.annotations.NotNull java.lang.String path, final @org.jetbrains.annotations.NotNull org.cdk8s.plus.Volume volume) { this.jsiiCall("mount", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(path, "path is required"), java.util.Objects.requireNonNull(volume, "volume is required") }); } /** * The environment variables for this container. *

* Returns a copy. To add environment variables use addEnv(). *

* EXPERIMENTAL */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull java.util.Map getEnv() { return java.util.Collections.unmodifiableMap(this.jsiiGet("env", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus.EnvValue.class)))); } /** * The container image. *

* EXPERIMENTAL */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull java.lang.String getImage() { return this.jsiiGet("image", java.lang.String.class); } /** * Volume mounts configured for this container. *

* EXPERIMENTAL */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull java.util.List getMounts() { return java.util.Collections.unmodifiableList(this.jsiiGet("mounts", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus.VolumeMount.class)))); } /** * The name of the container. *

* EXPERIMENTAL */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull java.lang.String getName() { return this.jsiiGet("name", java.lang.String.class); } /** * Entrypoint array (the command to execute when the container starts). *

* EXPERIMENTAL *

* @return a copy of the entrypoint array, cannot be modified */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.Nullable java.util.List getCommand() { return java.util.Optional.ofNullable((java.util.List)(this.jsiiGet("command", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class))))).map(java.util.Collections::unmodifiableList).orElse(null); } /** * The port this container exposes. *

* EXPERIMENTAL */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.Nullable java.lang.Number getPort() { return this.jsiiGet("port", java.lang.Number.class); } /** * The working directory inside the container. *

* EXPERIMENTAL */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.Nullable java.lang.String getWorkingDir() { return this.jsiiGet("workingDir", java.lang.String.class); } /** * A fluent builder for {@link org.cdk8s.plus.Container}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public static final class Builder implements software.amazon.jsii.Builder { /** * EXPERIMENTAL *

* @return a new instance of {@link Builder}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public static Builder create() { return new Builder(); } private final org.cdk8s.plus.ContainerProps.Builder props; private Builder() { this.props = new org.cdk8s.plus.ContainerProps.Builder(); } /** * Docker image name. *

* EXPERIMENTAL *

* @return {@code this} * @param image Docker image name. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder image(final java.lang.String image) { this.props.image(image); return this; } /** * Entrypoint array. *

* Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. * If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). * Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. * More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell *

* Default: - The docker image's ENTRYPOINT. *

* EXPERIMENTAL *

* @return {@code this} * @param command Entrypoint array. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder command(final java.util.List command) { this.props.command(command); return this; } /** * List of environment variables to set in the container. *

* Cannot be updated. *

* Default: - No environment variables. *

* EXPERIMENTAL *

* @return {@code this} * @param env List of environment variables to set in the container. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder env(final java.util.Map env) { this.props.env(env); return this; } /** * Name of the container specified as a DNS_LABEL. *

* Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated. *

* Default: 'main' *

* EXPERIMENTAL *

* @return {@code this} * @param name Name of the container specified as a DNS_LABEL. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder name(final java.lang.String name) { this.props.name(name); return this; } /** * Number of port to expose on the pod's IP address. *

* This must be a valid port number, 0 < x < 65536. *

* Default: - No port is exposed. *

* EXPERIMENTAL *

* @return {@code this} * @param port Number of port to expose on the pod's IP address. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder port(final java.lang.Number port) { this.props.port(port); return this; } /** * Pod volumes to mount into the container's filesystem. *

* Cannot be updated. *

* EXPERIMENTAL *

* @return {@code this} * @param volumeMounts Pod volumes to mount into the container's filesystem. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder volumeMounts(final java.util.List volumeMounts) { this.props.volumeMounts(volumeMounts); return this; } /** * Container's working directory. *

* If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated. *

* Default: - The container runtime's default. *

* EXPERIMENTAL *

* @return {@code this} * @param workingDir Container's working directory. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder workingDir(final java.lang.String workingDir) { this.props.workingDir(workingDir); return this; } /** * @returns a newly built instance of {@link org.cdk8s.plus.Container}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public org.cdk8s.plus.Container build() { return new org.cdk8s.plus.Container( this.props.build() ); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy