Class EcsEc2ContainerDefinitionProps.Builder
java.lang.Object
software.amazon.awscdk.services.batch.EcsEc2ContainerDefinitionProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<EcsEc2ContainerDefinitionProps>
- Enclosing interface:
EcsEc2ContainerDefinitionProps
@Stability(Stable)
public static final class EcsEc2ContainerDefinitionProps.Builder
extends Object
implements software.amazon.jsii.Builder<EcsEc2ContainerDefinitionProps>
A builder for
EcsEc2ContainerDefinitionProps
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the configured instance.Sets the value ofEcsContainerDefinitionProps.getCommand()
Sets the value ofEcsContainerDefinitionProps.getCpu()
environment
(Map<String, String> environment) Sets the value ofEcsContainerDefinitionProps.getEnvironment()
executionRole
(IRole executionRole) Sets the value ofEcsContainerDefinitionProps.getExecutionRole()
Sets the value ofEcsEc2ContainerDefinitionProps.getGpu()
image
(ContainerImage image) Sets the value ofEcsContainerDefinitionProps.getImage()
Sets the value ofEcsContainerDefinitionProps.getJobRole()
linuxParameters
(LinuxParameters linuxParameters) Sets the value ofEcsContainerDefinitionProps.getLinuxParameters()
Sets the value ofEcsContainerDefinitionProps.getLogging()
Sets the value ofEcsContainerDefinitionProps.getMemory()
privileged
(Boolean privileged) Sets the value ofEcsEc2ContainerDefinitionProps.getPrivileged()
readonlyRootFilesystem
(Boolean readonlyRootFilesystem) Sets the value ofEcsContainerDefinitionProps.getReadonlyRootFilesystem()
Sets the value ofEcsContainerDefinitionProps.getSecrets()
Sets the value ofEcsEc2ContainerDefinitionProps.getUlimits()
Sets the value ofEcsContainerDefinitionProps.getUser()
Sets the value ofEcsContainerDefinitionProps.getVolumes()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
gpu
Sets the value ofEcsEc2ContainerDefinitionProps.getGpu()
- Parameters:
gpu
- The number of physical GPUs to reserve for the container. Make sure that the number of GPUs reserved for all containers in a job doesn't exceed the number of available GPUs on the compute resource that the job is launched on.- Returns:
this
-
privileged
Sets the value ofEcsEc2ContainerDefinitionProps.getPrivileged()
- Parameters:
privileged
- When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user).- Returns:
this
-
ulimits
@Stability(Stable) public EcsEc2ContainerDefinitionProps.Builder ulimits(List<? extends Ulimit> ulimits) Sets the value ofEcsEc2ContainerDefinitionProps.getUlimits()
- Parameters:
ulimits
- Limits to set for the user this docker container will run as.- Returns:
this
-
cpu
Sets the value ofEcsContainerDefinitionProps.getCpu()
- Parameters:
cpu
- The number of vCPUs reserved for the container. This parameter is required. Each vCPU is equivalent to 1,024 CPU shares. For containers running on EC2 resources, you must specify at least one vCPU.- Returns:
this
-
image
Sets the value ofEcsContainerDefinitionProps.getImage()
- Parameters:
image
- The image that this container will run. This parameter is required.- Returns:
this
-
memory
Sets the value ofEcsContainerDefinitionProps.getMemory()
- Parameters:
memory
- The memory hard limit present to the container. This parameter is required. If your container attempts to exceed the memory specified, the container is terminated. You must specify at least 4 MiB of memory for a job.- Returns:
this
-
command
Sets the value ofEcsContainerDefinitionProps.getCommand()
- Parameters:
command
- The command that's passed to the container.- Returns:
this
-
environment
@Stability(Stable) public EcsEc2ContainerDefinitionProps.Builder environment(Map<String, String> environment) Sets the value ofEcsContainerDefinitionProps.getEnvironment()
- Parameters:
environment
- The environment variables to pass to a container. Cannot start withAWS_BATCH
. We don't recommend using plaintext environment variables for sensitive information, such as credential data.- Returns:
this
-
executionRole
Sets the value ofEcsContainerDefinitionProps.getExecutionRole()
- Parameters:
executionRole
- The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.- Returns:
this
-
jobRole
Sets the value ofEcsContainerDefinitionProps.getJobRole()
- Parameters:
jobRole
- The role that the container can assume.- Returns:
this
-
linuxParameters
@Stability(Stable) public EcsEc2ContainerDefinitionProps.Builder linuxParameters(LinuxParameters linuxParameters) Sets the value ofEcsContainerDefinitionProps.getLinuxParameters()
- Parameters:
linuxParameters
- Linux-specific modifications that are applied to the container, such as details for device mappings.- Returns:
this
-
logging
Sets the value ofEcsContainerDefinitionProps.getLogging()
- Parameters:
logging
- The loging configuration for this Job.- Returns:
this
-
readonlyRootFilesystem
@Stability(Stable) public EcsEc2ContainerDefinitionProps.Builder readonlyRootFilesystem(Boolean readonlyRootFilesystem) Sets the value ofEcsContainerDefinitionProps.getReadonlyRootFilesystem()
- Parameters:
readonlyRootFilesystem
- Gives the container readonly access to its root filesystem.- Returns:
this
-
secrets
@Stability(Stable) public EcsEc2ContainerDefinitionProps.Builder secrets(Map<String, ? extends Secret> secrets) Sets the value ofEcsContainerDefinitionProps.getSecrets()
- Parameters:
secrets
- A map from environment variable names to the secrets for the container. Allows your job definitions to reference the secret by the environment variable name defined in this property.- Returns:
this
-
user
Sets the value ofEcsContainerDefinitionProps.getUser()
- Parameters:
user
- The user name to use inside the container.- Returns:
this
-
volumes
@Stability(Stable) public EcsEc2ContainerDefinitionProps.Builder volumes(List<? extends EcsVolume> volumes) Sets the value ofEcsContainerDefinitionProps.getVolumes()
- Parameters:
volumes
- The volumes to mount to this container. Automatically added to the job definition.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<EcsEc2ContainerDefinitionProps>
- Returns:
- a new instance of
EcsEc2ContainerDefinitionProps
- Throws:
NullPointerException
- if any required attribute was not provided
-