Class ContainerDefinitionOptions.Builder
java.lang.Object
software.amazon.awscdk.services.ecs.ContainerDefinitionOptions.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<ContainerDefinitionOptions>
- Enclosing interface:
- ContainerDefinitionOptions
@Stability(Stable)
public static final class ContainerDefinitionOptions.Builder
extends Object
implements software.amazon.jsii.Builder<ContainerDefinitionOptions>
A builder for
ContainerDefinitionOptions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the configured instance.Sets the value ofContainerDefinitionOptions.getCommand()
containerName
(String containerName) Sets the value ofContainerDefinitionOptions.getContainerName()
Sets the value ofContainerDefinitionOptions.getCpu()
disableNetworking
(Boolean disableNetworking) Sets the value ofContainerDefinitionOptions.getDisableNetworking()
dnsSearchDomains
(List<String> dnsSearchDomains) Sets the value ofContainerDefinitionOptions.getDnsSearchDomains()
dnsServers
(List<String> dnsServers) Sets the value ofContainerDefinitionOptions.getDnsServers()
dockerLabels
(Map<String, String> dockerLabels) Sets the value ofContainerDefinitionOptions.getDockerLabels()
dockerSecurityOptions
(List<String> dockerSecurityOptions) Sets the value ofContainerDefinitionOptions.getDockerSecurityOptions()
entryPoint
(List<String> entryPoint) Sets the value ofContainerDefinitionOptions.getEntryPoint()
environment
(Map<String, String> environment) Sets the value ofContainerDefinitionOptions.getEnvironment()
environmentFiles
(List<? extends EnvironmentFile> environmentFiles) Sets the value ofContainerDefinitionOptions.getEnvironmentFiles()
Sets the value ofContainerDefinitionOptions.getEssential()
extraHosts
(Map<String, String> extraHosts) Sets the value ofContainerDefinitionOptions.getExtraHosts()
Sets the value ofContainerDefinitionOptions.getGpuCount()
healthCheck
(HealthCheck healthCheck) Sets the value ofContainerDefinitionOptions.getHealthCheck()
Sets the value ofContainerDefinitionOptions.getHostname()
image
(ContainerImage image) Sets the value ofContainerDefinitionOptions.getImage()
inferenceAcceleratorResources
(List<String> inferenceAcceleratorResources) Sets the value ofContainerDefinitionOptions.getInferenceAcceleratorResources()
linuxParameters
(LinuxParameters linuxParameters) Sets the value ofContainerDefinitionOptions.getLinuxParameters()
Sets the value ofContainerDefinitionOptions.getLogging()
memoryLimitMiB
(Number memoryLimitMiB) Sets the value ofContainerDefinitionOptions.getMemoryLimitMiB()
memoryReservationMiB
(Number memoryReservationMiB) Sets the value ofContainerDefinitionOptions.getMemoryReservationMiB()
portMappings
(List<? extends PortMapping> portMappings) Sets the value ofContainerDefinitionOptions.getPortMappings()
privileged
(Boolean privileged) Sets the value ofContainerDefinitionOptions.getPrivileged()
readonlyRootFilesystem
(Boolean readonlyRootFilesystem) Sets the value ofContainerDefinitionOptions.getReadonlyRootFilesystem()
Sets the value ofContainerDefinitionOptions.getSecrets()
startTimeout
(Duration startTimeout) Sets the value ofContainerDefinitionOptions.getStartTimeout()
stopTimeout
(Duration stopTimeout) Sets the value ofContainerDefinitionOptions.getStopTimeout()
systemControls
(List<? extends SystemControl> systemControls) Sets the value ofContainerDefinitionOptions.getSystemControls()
Sets the value ofContainerDefinitionOptions.getUser()
workingDirectory
(String workingDirectory) Sets the value ofContainerDefinitionOptions.getWorkingDirectory()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
image
Sets the value ofContainerDefinitionOptions.getImage()
- Parameters:
image
- The image used to start a container. This parameter is required. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with either repository-url/image:tag or repository-url/image@digest. TODO: Update these to specify using classes of IContainerImage- Returns:
this
-
command
Sets the value ofContainerDefinitionOptions.getCommand()
- Parameters:
command
- The command that is passed to the container. If you provide a shell command as a single string, you have to quote command-line arguments.- Returns:
this
-
containerName
Sets the value ofContainerDefinitionOptions.getContainerName()
- Parameters:
containerName
- The name of the container.- Returns:
this
-
cpu
Sets the value ofContainerDefinitionOptions.getCpu()
- Parameters:
cpu
- The minimum number of CPU units to reserve for the container.- Returns:
this
-
disableNetworking
@Stability(Stable) public ContainerDefinitionOptions.Builder disableNetworking(Boolean disableNetworking) Sets the value ofContainerDefinitionOptions.getDisableNetworking()
- Parameters:
disableNetworking
- Specifies whether networking is disabled within the container. When this parameter is true, networking is disabled within the container.- Returns:
this
-
dnsSearchDomains
@Stability(Stable) public ContainerDefinitionOptions.Builder dnsSearchDomains(List<String> dnsSearchDomains) Sets the value ofContainerDefinitionOptions.getDnsSearchDomains()
- Parameters:
dnsSearchDomains
- A list of DNS search domains that are presented to the container.- Returns:
this
-
dnsServers
Sets the value ofContainerDefinitionOptions.getDnsServers()
- Parameters:
dnsServers
- A list of DNS servers that are presented to the container.- Returns:
this
-
dockerLabels
@Stability(Stable) public ContainerDefinitionOptions.Builder dockerLabels(Map<String, String> dockerLabels) Sets the value ofContainerDefinitionOptions.getDockerLabels()
- Parameters:
dockerLabels
- A key/value map of labels to add to the container.- Returns:
this
-
dockerSecurityOptions
@Stability(Stable) public ContainerDefinitionOptions.Builder dockerSecurityOptions(List<String> dockerSecurityOptions) Sets the value ofContainerDefinitionOptions.getDockerSecurityOptions()
- Parameters:
dockerSecurityOptions
- A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems.- Returns:
this
-
entryPoint
Sets the value ofContainerDefinitionOptions.getEntryPoint()
- Parameters:
entryPoint
- The ENTRYPOINT value to pass to the container.- Returns:
this
-
environment
@Stability(Stable) public ContainerDefinitionOptions.Builder environment(Map<String, String> environment) Sets the value ofContainerDefinitionOptions.getEnvironment()
- Parameters:
environment
- The environment variables to pass to the container.- Returns:
this
-
environmentFiles
@Stability(Stable) public ContainerDefinitionOptions.Builder environmentFiles(List<? extends EnvironmentFile> environmentFiles) Sets the value ofContainerDefinitionOptions.getEnvironmentFiles()
- Parameters:
environmentFiles
- The environment files to pass to the container.- Returns:
this
-
essential
Sets the value ofContainerDefinitionOptions.getEssential()
- Parameters:
essential
- Specifies whether the container is marked essential. If the essential parameter of a container is marked as true, and that container fails or stops for any reason, all other containers that are part of the task are stopped. If the essential parameter of a container is marked as false, then its failure does not affect the rest of the containers in a task. All tasks must have at least one essential container.If this parameter is omitted, a container is assumed to be essential.
- Returns:
this
-
extraHosts
@Stability(Stable) public ContainerDefinitionOptions.Builder extraHosts(Map<String, String> extraHosts) Sets the value ofContainerDefinitionOptions.getExtraHosts()
- Parameters:
extraHosts
- A list of hostnames and IP address mappings to append to the /etc/hosts file on the container.- Returns:
this
-
gpuCount
Sets the value ofContainerDefinitionOptions.getGpuCount()
- Parameters:
gpuCount
- The number of GPUs assigned to the container.- Returns:
this
-
healthCheck
Sets the value ofContainerDefinitionOptions.getHealthCheck()
- Parameters:
healthCheck
- The health check command and associated configuration parameters for the container.- Returns:
this
-
hostname
Sets the value ofContainerDefinitionOptions.getHostname()
- Parameters:
hostname
- The hostname to use for your container.- Returns:
this
-
inferenceAcceleratorResources
@Stability(Stable) public ContainerDefinitionOptions.Builder inferenceAcceleratorResources(List<String> inferenceAcceleratorResources) Sets the value ofContainerDefinitionOptions.getInferenceAcceleratorResources()
- Parameters:
inferenceAcceleratorResources
- The inference accelerators referenced by the container.- Returns:
this
-
linuxParameters
@Stability(Stable) public ContainerDefinitionOptions.Builder linuxParameters(LinuxParameters linuxParameters) Sets the value ofContainerDefinitionOptions.getLinuxParameters()
- Parameters:
linuxParameters
- Linux-specific modifications that are applied to the container, such as Linux kernel capabilities. For more information see KernelCapabilities.- Returns:
this
-
logging
Sets the value ofContainerDefinitionOptions.getLogging()
- Parameters:
logging
- The log configuration specification for the container.- Returns:
this
-
memoryLimitMiB
Sets the value ofContainerDefinitionOptions.getMemoryLimitMiB()
- Parameters:
memoryLimitMiB
- The amount (in MiB) of memory to present to the container. If your container attempts to exceed the allocated memory, the container is terminated.At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
- Returns:
this
-
memoryReservationMiB
@Stability(Stable) public ContainerDefinitionOptions.Builder memoryReservationMiB(Number memoryReservationMiB) Sets the value ofContainerDefinitionOptions.getMemoryReservationMiB()
- Parameters:
memoryReservationMiB
- The soft limit (in MiB) of memory to reserve for the container. When system memory is under heavy contention, Docker attempts to keep the container memory to this soft limit. However, your container can consume more memory when it needs to, up to either the hard limit specified with the memory parameter (if applicable), or all of the available memory on the container instance, whichever comes first.At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
- Returns:
this
-
portMappings
@Stability(Stable) public ContainerDefinitionOptions.Builder portMappings(List<? extends PortMapping> portMappings) Sets the value ofContainerDefinitionOptions.getPortMappings()
- Parameters:
portMappings
- The port mappings to add to the container definition.- Returns:
this
-
privileged
Sets the value ofContainerDefinitionOptions.getPrivileged()
- Parameters:
privileged
- Specifies whether the container is marked as privileged. When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user).- Returns:
this
-
readonlyRootFilesystem
@Stability(Stable) public ContainerDefinitionOptions.Builder readonlyRootFilesystem(Boolean readonlyRootFilesystem) Sets the value ofContainerDefinitionOptions.getReadonlyRootFilesystem()
- Parameters:
readonlyRootFilesystem
- When this parameter is true, the container is given read-only access to its root file system.- Returns:
this
-
secrets
@Stability(Stable) public ContainerDefinitionOptions.Builder secrets(Map<String, ? extends Secret> secrets) Sets the value ofContainerDefinitionOptions.getSecrets()
- Parameters:
secrets
- The secret environment variables to pass to the container.- Returns:
this
-
startTimeout
Sets the value ofContainerDefinitionOptions.getStartTimeout()
- Parameters:
startTimeout
- Time duration (in seconds) to wait before giving up on resolving dependencies for a container.- Returns:
this
-
stopTimeout
Sets the value ofContainerDefinitionOptions.getStopTimeout()
- Parameters:
stopTimeout
- Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own.- Returns:
this
-
systemControls
@Stability(Stable) public ContainerDefinitionOptions.Builder systemControls(List<? extends SystemControl> systemControls) Sets the value ofContainerDefinitionOptions.getSystemControls()
- Parameters:
systemControls
- A list of namespaced kernel parameters to set in the container.- Returns:
this
-
user
Sets the value ofContainerDefinitionOptions.getUser()
- Parameters:
user
- The user name to use inside the container.- Returns:
this
-
workingDirectory
@Stability(Stable) public ContainerDefinitionOptions.Builder workingDirectory(String workingDirectory) Sets the value ofContainerDefinitionOptions.getWorkingDirectory()
- Parameters:
workingDirectory
- The working directory in which to run commands inside the container.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<ContainerDefinitionOptions>
- Returns:
- a new instance of
ContainerDefinitionOptions
- Throws:
NullPointerException
- if any required attribute was not provided
-