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

software.amazon.awssdk.services.batch.model.EksContainer Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Batch module holds the client classes that are used for communicating with AWS Batch.

There is a newer version: 2.28.4
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.batch.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* EKS container properties are used in job definitions for Amazon EKS based job definitions to describe the properties * for a container node in the pod that's launched as part of a job. This can't be specified for Amazon ECS based job * definitions. *

*/ @Generated("software.amazon.awssdk:codegen") public final class EksContainer implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name") .getter(getter(EksContainer::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build(); private static final SdkField IMAGE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("image") .getter(getter(EksContainer::image)).setter(setter(Builder::image)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("image").build()).build(); private static final SdkField IMAGE_PULL_POLICY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("imagePullPolicy").getter(getter(EksContainer::imagePullPolicy)).setter(setter(Builder::imagePullPolicy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("imagePullPolicy").build()).build(); private static final SdkField> COMMAND_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("command") .getter(getter(EksContainer::command)) .setter(setter(Builder::command)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("command").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> ARGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("args") .getter(getter(EksContainer::args)) .setter(setter(Builder::args)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("args").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> ENV_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("env") .getter(getter(EksContainer::env)) .setter(setter(Builder::env)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("env").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(EksContainerEnvironmentVariable::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField RESOURCES_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("resources") .getter(getter(EksContainer::resources)).setter(setter(Builder::resources)) .constructor(EksContainerResourceRequirements::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resources").build()).build(); private static final SdkField> VOLUME_MOUNTS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("volumeMounts") .getter(getter(EksContainer::volumeMounts)) .setter(setter(Builder::volumeMounts)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("volumeMounts").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(EksContainerVolumeMount::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField SECURITY_CONTEXT_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("securityContext") .getter(getter(EksContainer::securityContext)).setter(setter(Builder::securityContext)) .constructor(EksContainerSecurityContext::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("securityContext").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, IMAGE_FIELD, IMAGE_PULL_POLICY_FIELD, COMMAND_FIELD, ARGS_FIELD, ENV_FIELD, RESOURCES_FIELD, VOLUME_MOUNTS_FIELD, SECURITY_CONTEXT_FIELD)); private static final long serialVersionUID = 1L; private final String name; private final String image; private final String imagePullPolicy; private final List command; private final List args; private final List env; private final EksContainerResourceRequirements resources; private final List volumeMounts; private final EksContainerSecurityContext securityContext; private EksContainer(BuilderImpl builder) { this.name = builder.name; this.image = builder.image; this.imagePullPolicy = builder.imagePullPolicy; this.command = builder.command; this.args = builder.args; this.env = builder.env; this.resources = builder.resources; this.volumeMounts = builder.volumeMounts; this.securityContext = builder.securityContext; } /** *

* The name of the container. If the name isn't specified, the default name "Default" is used. Each * container in a pod must have a unique name. *

* * @return The name of the container. If the name isn't specified, the default name "Default" is used. * Each container in a pod must have a unique name. */ public final String name() { return name; } /** *

* The Docker image used to start the container. *

* * @return The Docker image used to start the container. */ public final String image() { return image; } /** *

* The image pull policy for the container. Supported values are Always, IfNotPresent, and * Never. This parameter defaults to IfNotPresent. However, if the :latest * tag is specified, it defaults to Always. For more information, see Updating images in the * Kubernetes documentation. *

* * @return The image pull policy for the container. Supported values are Always, * IfNotPresent, and Never. This parameter defaults to IfNotPresent. * However, if the :latest tag is specified, it defaults to Always. For more * information, see Updating images in the * Kubernetes documentation. */ public final String imagePullPolicy() { return imagePullPolicy; } /** * For responses, this returns true if the service returned a value for the Command property. This DOES NOT check * that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is * useful because the SDK will never return a null collection or map, but you may need to differentiate between the * service returning nothing (or null) and the service returning an empty collection or map. For requests, this * returns true if a value for the property was specified in the request builder, and false if a value was not * specified. */ public final boolean hasCommand() { return command != null && !(command instanceof SdkAutoConstructList); } /** *

* The entrypoint for the container. This isn't run within a shell. If this isn't specified, the * ENTRYPOINT of the container image is used. Environment variable references are expanded using the * container's environment. *

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For example, if * the reference is to "$(NAME1)" and the NAME1 environment variable doesn't exist, the * command string will remain "$(NAME1)." $$ is replaced with $ and the * resulting string isn't expanded. For example, $$(VAR_NAME) will be passed as * $(VAR_NAME) whether or not the VAR_NAME environment variable exists. The entrypoint * can't be updated. For more information, see ENTRYPOINT in the Dockerfile * reference and Define a * command and arguments for a container and Entrypoint * in the Kubernetes documentation. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasCommand} method. *

* * @return The entrypoint for the container. This isn't run within a shell. If this isn't specified, the * ENTRYPOINT of the container image is used. Environment variable references are expanded * using the container's environment.

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For * example, if the reference is to "$(NAME1)" and the NAME1 environment variable * doesn't exist, the command string will remain "$(NAME1)." $$ is replaced with * $ and the resulting string isn't expanded. For example, $$(VAR_NAME) will be * passed as $(VAR_NAME) whether or not the VAR_NAME environment variable exists. * The entrypoint can't be updated. For more information, see ENTRYPOINT in the Dockerfile * reference and Define * a command and arguments for a container and Entrypoint in the Kubernetes documentation. */ public final List command() { return command; } /** * For responses, this returns true if the service returned a value for the Args property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasArgs() { return args != null && !(args instanceof SdkAutoConstructList); } /** *

* An array of arguments to the entrypoint. If this isn't specified, the CMD of the container image is * used. This corresponds to the args member in the Entrypoint * portion of the Pod * in Kubernetes. Environment variable references are expanded using the container's environment. *

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For example, if * the reference is to "$(NAME1)" and the NAME1 environment variable doesn't exist, the * command string will remain "$(NAME1)." $$ is replaced with $, and the * resulting string isn't expanded. For example, $$(VAR_NAME) is passed as $(VAR_NAME) * whether or not the VAR_NAME environment variable exists. For more information, see Dockerfile reference: CMD and Define a * command and arguments for a pod in the Kubernetes documentation. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasArgs} method. *

* * @return An array of arguments to the entrypoint. If this isn't specified, the CMD of the container * image is used. This corresponds to the args member in the Entrypoint portion of the Pod in * Kubernetes. Environment variable references are expanded using the container's environment.

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For * example, if the reference is to "$(NAME1)" and the NAME1 environment variable * doesn't exist, the command string will remain "$(NAME1)." $$ is replaced with * $, and the resulting string isn't expanded. For example, $$(VAR_NAME) is passed * as $(VAR_NAME) whether or not the VAR_NAME environment variable exists. For * more information, see Dockerfile * reference: CMD and Define * a command and arguments for a pod in the Kubernetes documentation. */ public final List args() { return args; } /** * For responses, this returns true if the service returned a value for the Env property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasEnv() { return env != null && !(env instanceof SdkAutoConstructList); } /** *

* The environment variables to pass to a container. *

* *

* Environment variables cannot start with "AWS_BATCH". This naming convention is reserved for * variables that Batch sets. *

*
*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasEnv} method. *

* * @return The environment variables to pass to a container.

*

* Environment variables cannot start with "AWS_BATCH". This naming convention is reserved for * variables that Batch sets. *

*/ public final List env() { return env; } /** *

* The type and amount of resources to assign to a container. The supported resources include memory, * cpu, and nvidia.com/gpu. For more information, see Resource management for * pods and containers in the Kubernetes documentation. *

* * @return The type and amount of resources to assign to a container. The supported resources include * memory, cpu, and nvidia.com/gpu. For more information, see Resource management * for pods and containers in the Kubernetes documentation. */ public final EksContainerResourceRequirements resources() { return resources; } /** * For responses, this returns true if the service returned a value for the VolumeMounts property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasVolumeMounts() { return volumeMounts != null && !(volumeMounts instanceof SdkAutoConstructList); } /** *

* The volume mounts for the container. Batch supports emptyDir, hostPath, and * secret volume types. For more information about volumes and volume mounts in Kubernetes, see Volumes in the Kubernetes documentation. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasVolumeMounts} method. *

* * @return The volume mounts for the container. Batch supports emptyDir, hostPath, and * secret volume types. For more information about volumes and volume mounts in Kubernetes, see * Volumes in the Kubernetes * documentation. */ public final List volumeMounts() { return volumeMounts; } /** *

* The security context for a job. For more information, see Configure a security context * for a pod or container in the Kubernetes documentation. *

* * @return The security context for a job. For more information, see Configure a security * context for a pod or container in the Kubernetes documentation. */ public final EksContainerSecurityContext securityContext() { return securityContext; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(image()); hashCode = 31 * hashCode + Objects.hashCode(imagePullPolicy()); hashCode = 31 * hashCode + Objects.hashCode(hasCommand() ? command() : null); hashCode = 31 * hashCode + Objects.hashCode(hasArgs() ? args() : null); hashCode = 31 * hashCode + Objects.hashCode(hasEnv() ? env() : null); hashCode = 31 * hashCode + Objects.hashCode(resources()); hashCode = 31 * hashCode + Objects.hashCode(hasVolumeMounts() ? volumeMounts() : null); hashCode = 31 * hashCode + Objects.hashCode(securityContext()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof EksContainer)) { return false; } EksContainer other = (EksContainer) obj; return Objects.equals(name(), other.name()) && Objects.equals(image(), other.image()) && Objects.equals(imagePullPolicy(), other.imagePullPolicy()) && hasCommand() == other.hasCommand() && Objects.equals(command(), other.command()) && hasArgs() == other.hasArgs() && Objects.equals(args(), other.args()) && hasEnv() == other.hasEnv() && Objects.equals(env(), other.env()) && Objects.equals(resources(), other.resources()) && hasVolumeMounts() == other.hasVolumeMounts() && Objects.equals(volumeMounts(), other.volumeMounts()) && Objects.equals(securityContext(), other.securityContext()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("EksContainer").add("Name", name()).add("Image", image()) .add("ImagePullPolicy", imagePullPolicy()).add("Command", hasCommand() ? command() : null) .add("Args", hasArgs() ? args() : null).add("Env", hasEnv() ? env() : null).add("Resources", resources()) .add("VolumeMounts", hasVolumeMounts() ? volumeMounts() : null).add("SecurityContext", securityContext()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "name": return Optional.ofNullable(clazz.cast(name())); case "image": return Optional.ofNullable(clazz.cast(image())); case "imagePullPolicy": return Optional.ofNullable(clazz.cast(imagePullPolicy())); case "command": return Optional.ofNullable(clazz.cast(command())); case "args": return Optional.ofNullable(clazz.cast(args())); case "env": return Optional.ofNullable(clazz.cast(env())); case "resources": return Optional.ofNullable(clazz.cast(resources())); case "volumeMounts": return Optional.ofNullable(clazz.cast(volumeMounts())); case "securityContext": return Optional.ofNullable(clazz.cast(securityContext())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((EksContainer) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the container. If the name isn't specified, the default name "Default" is used. Each * container in a pod must have a unique name. *

* * @param name * The name of the container. If the name isn't specified, the default name "Default" is * used. Each container in a pod must have a unique name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The Docker image used to start the container. *

* * @param image * The Docker image used to start the container. * @return Returns a reference to this object so that method calls can be chained together. */ Builder image(String image); /** *

* The image pull policy for the container. Supported values are Always, IfNotPresent, * and Never. This parameter defaults to IfNotPresent. However, if the * :latest tag is specified, it defaults to Always. For more information, see Updating images in the * Kubernetes documentation. *

* * @param imagePullPolicy * The image pull policy for the container. Supported values are Always, * IfNotPresent, and Never. This parameter defaults to * IfNotPresent. However, if the :latest tag is specified, it defaults to * Always. For more information, see Updating images in * the Kubernetes documentation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder imagePullPolicy(String imagePullPolicy); /** *

* The entrypoint for the container. This isn't run within a shell. If this isn't specified, the * ENTRYPOINT of the container image is used. Environment variable references are expanded using * the container's environment. *

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For * example, if the reference is to "$(NAME1)" and the NAME1 environment variable * doesn't exist, the command string will remain "$(NAME1)." $$ is replaced with * $ and the resulting string isn't expanded. For example, $$(VAR_NAME) will be passed * as $(VAR_NAME) whether or not the VAR_NAME environment variable exists. The * entrypoint can't be updated. For more information, see ENTRYPOINT in the Dockerfile * reference and Define a * command and arguments for a container and Entrypoint in the Kubernetes documentation. *

* * @param command * The entrypoint for the container. This isn't run within a shell. If this isn't specified, the * ENTRYPOINT of the container image is used. Environment variable references are expanded * using the container's environment.

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For * example, if the reference is to "$(NAME1)" and the NAME1 environment * variable doesn't exist, the command string will remain "$(NAME1)." $$ is * replaced with $ and the resulting string isn't expanded. For example, * $$(VAR_NAME) will be passed as $(VAR_NAME) whether or not the * VAR_NAME environment variable exists. The entrypoint can't be updated. For more * information, see ENTRYPOINT * in the Dockerfile reference and Define a command and arguments for a container and Entrypoint in the Kubernetes documentation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder command(Collection command); /** *

* The entrypoint for the container. This isn't run within a shell. If this isn't specified, the * ENTRYPOINT of the container image is used. Environment variable references are expanded using * the container's environment. *

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For * example, if the reference is to "$(NAME1)" and the NAME1 environment variable * doesn't exist, the command string will remain "$(NAME1)." $$ is replaced with * $ and the resulting string isn't expanded. For example, $$(VAR_NAME) will be passed * as $(VAR_NAME) whether or not the VAR_NAME environment variable exists. The * entrypoint can't be updated. For more information, see ENTRYPOINT in the Dockerfile * reference and Define a * command and arguments for a container and Entrypoint in the Kubernetes documentation. *

* * @param command * The entrypoint for the container. This isn't run within a shell. If this isn't specified, the * ENTRYPOINT of the container image is used. Environment variable references are expanded * using the container's environment.

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For * example, if the reference is to "$(NAME1)" and the NAME1 environment * variable doesn't exist, the command string will remain "$(NAME1)." $$ is * replaced with $ and the resulting string isn't expanded. For example, * $$(VAR_NAME) will be passed as $(VAR_NAME) whether or not the * VAR_NAME environment variable exists. The entrypoint can't be updated. For more * information, see ENTRYPOINT * in the Dockerfile reference and Define a command and arguments for a container and Entrypoint in the Kubernetes documentation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder command(String... command); /** *

* An array of arguments to the entrypoint. If this isn't specified, the CMD of the container image * is used. This corresponds to the args member in the Entrypoint portion of the Pod in Kubernetes. * Environment variable references are expanded using the container's environment. *

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For * example, if the reference is to "$(NAME1)" and the NAME1 environment variable * doesn't exist, the command string will remain "$(NAME1)." $$ is replaced with * $, and the resulting string isn't expanded. For example, $$(VAR_NAME) is passed as * $(VAR_NAME) whether or not the VAR_NAME environment variable exists. For more * information, see Dockerfile reference: * CMD and Define a * command and arguments for a pod in the Kubernetes documentation. *

* * @param args * An array of arguments to the entrypoint. If this isn't specified, the CMD of the * container image is used. This corresponds to the args member in the Entrypoint portion of the Pod in * Kubernetes. Environment variable references are expanded using the container's environment.

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For * example, if the reference is to "$(NAME1)" and the NAME1 environment * variable doesn't exist, the command string will remain "$(NAME1)." $$ is * replaced with $, and the resulting string isn't expanded. For example, * $$(VAR_NAME) is passed as $(VAR_NAME) whether or not the * VAR_NAME environment variable exists. For more information, see Dockerfile reference: CMD and Define a * command and arguments for a pod in the Kubernetes documentation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder args(Collection args); /** *

* An array of arguments to the entrypoint. If this isn't specified, the CMD of the container image * is used. This corresponds to the args member in the Entrypoint portion of the Pod in Kubernetes. * Environment variable references are expanded using the container's environment. *

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For * example, if the reference is to "$(NAME1)" and the NAME1 environment variable * doesn't exist, the command string will remain "$(NAME1)." $$ is replaced with * $, and the resulting string isn't expanded. For example, $$(VAR_NAME) is passed as * $(VAR_NAME) whether or not the VAR_NAME environment variable exists. For more * information, see Dockerfile reference: * CMD and Define a * command and arguments for a pod in the Kubernetes documentation. *

* * @param args * An array of arguments to the entrypoint. If this isn't specified, the CMD of the * container image is used. This corresponds to the args member in the Entrypoint portion of the Pod in * Kubernetes. Environment variable references are expanded using the container's environment.

*

* If the referenced environment variable doesn't exist, the reference in the command isn't changed. For * example, if the reference is to "$(NAME1)" and the NAME1 environment * variable doesn't exist, the command string will remain "$(NAME1)." $$ is * replaced with $, and the resulting string isn't expanded. For example, * $$(VAR_NAME) is passed as $(VAR_NAME) whether or not the * VAR_NAME environment variable exists. For more information, see Dockerfile reference: CMD and Define a * command and arguments for a pod in the Kubernetes documentation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder args(String... args); /** *

* The environment variables to pass to a container. *

* *

* Environment variables cannot start with "AWS_BATCH". This naming convention is reserved for * variables that Batch sets. *

*
* * @param env * The environment variables to pass to a container.

*

* Environment variables cannot start with "AWS_BATCH". This naming convention is reserved * for variables that Batch sets. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder env(Collection env); /** *

* The environment variables to pass to a container. *

* *

* Environment variables cannot start with "AWS_BATCH". This naming convention is reserved for * variables that Batch sets. *

*
* * @param env * The environment variables to pass to a container.

*

* Environment variables cannot start with "AWS_BATCH". This naming convention is reserved * for variables that Batch sets. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder env(EksContainerEnvironmentVariable... env); /** *

* The environment variables to pass to a container. *

* *

* Environment variables cannot start with "AWS_BATCH". This naming convention is reserved for * variables that Batch sets. *

*
This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.batch.model.EksContainerEnvironmentVariable.Builder} avoiding the need * to create one manually via * {@link software.amazon.awssdk.services.batch.model.EksContainerEnvironmentVariable#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.batch.model.EksContainerEnvironmentVariable.Builder#build()} is called * immediately and its result is passed to {@link #env(List)}. * * @param env * a consumer that will call methods on * {@link software.amazon.awssdk.services.batch.model.EksContainerEnvironmentVariable.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #env(java.util.Collection) */ Builder env(Consumer... env); /** *

* The type and amount of resources to assign to a container. The supported resources include * memory, cpu, and nvidia.com/gpu. For more information, see Resource management for * pods and containers in the Kubernetes documentation. *

* * @param resources * The type and amount of resources to assign to a container. The supported resources include * memory, cpu, and nvidia.com/gpu. For more information, see Resource * management for pods and containers in the Kubernetes documentation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resources(EksContainerResourceRequirements resources); /** *

* The type and amount of resources to assign to a container. The supported resources include * memory, cpu, and nvidia.com/gpu. For more information, see Resource management for * pods and containers in the Kubernetes documentation. *

* This is a convenience method that creates an instance of the {@link EksContainerResourceRequirements.Builder} * avoiding the need to create one manually via {@link EksContainerResourceRequirements#builder()}. * *

* When the {@link Consumer} completes, {@link EksContainerResourceRequirements.Builder#build()} is called * immediately and its result is passed to {@link #resources(EksContainerResourceRequirements)}. * * @param resources * a consumer that will call methods on {@link EksContainerResourceRequirements.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #resources(EksContainerResourceRequirements) */ default Builder resources(Consumer resources) { return resources(EksContainerResourceRequirements.builder().applyMutation(resources).build()); } /** *

* The volume mounts for the container. Batch supports emptyDir, hostPath, and * secret volume types. For more information about volumes and volume mounts in Kubernetes, see Volumes in the Kubernetes * documentation. *

* * @param volumeMounts * The volume mounts for the container. Batch supports emptyDir, hostPath, and * secret volume types. For more information about volumes and volume mounts in Kubernetes, * see Volumes in the Kubernetes * documentation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumeMounts(Collection volumeMounts); /** *

* The volume mounts for the container. Batch supports emptyDir, hostPath, and * secret volume types. For more information about volumes and volume mounts in Kubernetes, see Volumes in the Kubernetes * documentation. *

* * @param volumeMounts * The volume mounts for the container. Batch supports emptyDir, hostPath, and * secret volume types. For more information about volumes and volume mounts in Kubernetes, * see Volumes in the Kubernetes * documentation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumeMounts(EksContainerVolumeMount... volumeMounts); /** *

* The volume mounts for the container. Batch supports emptyDir, hostPath, and * secret volume types. For more information about volumes and volume mounts in Kubernetes, see Volumes in the Kubernetes * documentation. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.batch.model.EksContainerVolumeMount.Builder} avoiding the need to * create one manually via {@link software.amazon.awssdk.services.batch.model.EksContainerVolumeMount#builder()} * . * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.batch.model.EksContainerVolumeMount.Builder#build()} is called * immediately and its result is passed to {@link #volumeMounts(List)}. * * @param volumeMounts * a consumer that will call methods on * {@link software.amazon.awssdk.services.batch.model.EksContainerVolumeMount.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #volumeMounts(java.util.Collection) */ Builder volumeMounts(Consumer... volumeMounts); /** *

* The security context for a job. For more information, see Configure a security * context for a pod or container in the Kubernetes documentation. *

* * @param securityContext * The security context for a job. For more information, see Configure a security * context for a pod or container in the Kubernetes documentation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder securityContext(EksContainerSecurityContext securityContext); /** *

* The security context for a job. For more information, see Configure a security * context for a pod or container in the Kubernetes documentation. *

* This is a convenience method that creates an instance of the {@link EksContainerSecurityContext.Builder} * avoiding the need to create one manually via {@link EksContainerSecurityContext#builder()}. * *

* When the {@link Consumer} completes, {@link EksContainerSecurityContext.Builder#build()} is called * immediately and its result is passed to {@link #securityContext(EksContainerSecurityContext)}. * * @param securityContext * a consumer that will call methods on {@link EksContainerSecurityContext.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #securityContext(EksContainerSecurityContext) */ default Builder securityContext(Consumer securityContext) { return securityContext(EksContainerSecurityContext.builder().applyMutation(securityContext).build()); } } static final class BuilderImpl implements Builder { private String name; private String image; private String imagePullPolicy; private List command = DefaultSdkAutoConstructList.getInstance(); private List args = DefaultSdkAutoConstructList.getInstance(); private List env = DefaultSdkAutoConstructList.getInstance(); private EksContainerResourceRequirements resources; private List volumeMounts = DefaultSdkAutoConstructList.getInstance(); private EksContainerSecurityContext securityContext; private BuilderImpl() { } private BuilderImpl(EksContainer model) { name(model.name); image(model.image); imagePullPolicy(model.imagePullPolicy); command(model.command); args(model.args); env(model.env); resources(model.resources); volumeMounts(model.volumeMounts); securityContext(model.securityContext); } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getImage() { return image; } public final void setImage(String image) { this.image = image; } @Override public final Builder image(String image) { this.image = image; return this; } public final String getImagePullPolicy() { return imagePullPolicy; } public final void setImagePullPolicy(String imagePullPolicy) { this.imagePullPolicy = imagePullPolicy; } @Override public final Builder imagePullPolicy(String imagePullPolicy) { this.imagePullPolicy = imagePullPolicy; return this; } public final Collection getCommand() { if (command instanceof SdkAutoConstructList) { return null; } return command; } public final void setCommand(Collection command) { this.command = StringListCopier.copy(command); } @Override public final Builder command(Collection command) { this.command = StringListCopier.copy(command); return this; } @Override @SafeVarargs public final Builder command(String... command) { command(Arrays.asList(command)); return this; } public final Collection getArgs() { if (args instanceof SdkAutoConstructList) { return null; } return args; } public final void setArgs(Collection args) { this.args = StringListCopier.copy(args); } @Override public final Builder args(Collection args) { this.args = StringListCopier.copy(args); return this; } @Override @SafeVarargs public final Builder args(String... args) { args(Arrays.asList(args)); return this; } public final List getEnv() { List result = EksContainerEnvironmentVariablesCopier.copyToBuilder(this.env); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setEnv(Collection env) { this.env = EksContainerEnvironmentVariablesCopier.copyFromBuilder(env); } @Override public final Builder env(Collection env) { this.env = EksContainerEnvironmentVariablesCopier.copy(env); return this; } @Override @SafeVarargs public final Builder env(EksContainerEnvironmentVariable... env) { env(Arrays.asList(env)); return this; } @Override @SafeVarargs public final Builder env(Consumer... env) { env(Stream.of(env).map(c -> EksContainerEnvironmentVariable.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final EksContainerResourceRequirements.Builder getResources() { return resources != null ? resources.toBuilder() : null; } public final void setResources(EksContainerResourceRequirements.BuilderImpl resources) { this.resources = resources != null ? resources.build() : null; } @Override public final Builder resources(EksContainerResourceRequirements resources) { this.resources = resources; return this; } public final List getVolumeMounts() { List result = EksContainerVolumeMountsCopier.copyToBuilder(this.volumeMounts); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setVolumeMounts(Collection volumeMounts) { this.volumeMounts = EksContainerVolumeMountsCopier.copyFromBuilder(volumeMounts); } @Override public final Builder volumeMounts(Collection volumeMounts) { this.volumeMounts = EksContainerVolumeMountsCopier.copy(volumeMounts); return this; } @Override @SafeVarargs public final Builder volumeMounts(EksContainerVolumeMount... volumeMounts) { volumeMounts(Arrays.asList(volumeMounts)); return this; } @Override @SafeVarargs public final Builder volumeMounts(Consumer... volumeMounts) { volumeMounts(Stream.of(volumeMounts).map(c -> EksContainerVolumeMount.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final EksContainerSecurityContext.Builder getSecurityContext() { return securityContext != null ? securityContext.toBuilder() : null; } public final void setSecurityContext(EksContainerSecurityContext.BuilderImpl securityContext) { this.securityContext = securityContext != null ? securityContext.build() : null; } @Override public final Builder securityContext(EksContainerSecurityContext securityContext) { this.securityContext = securityContext; return this; } @Override public EksContainer build() { return new EksContainer(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy