Class TaskContainerProperties
- java.lang.Object
-
- software.amazon.awssdk.services.batch.model.TaskContainerProperties
-
- All Implemented Interfaces:
Serializable
,SdkPojo
,ToCopyableBuilder<TaskContainerProperties.Builder,TaskContainerProperties>
@Generated("software.amazon.awssdk:codegen") public final class TaskContainerProperties extends Object implements SdkPojo, Serializable, ToCopyableBuilder<TaskContainerProperties.Builder,TaskContainerProperties>
Container properties are used for Amazon ECS-based job definitions. These properties to describe the container that's launched as part of a job.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TaskContainerProperties.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TaskContainerProperties.Builder
builder()
List<String>
command()
The command that's passed to the container.List<TaskContainerDependency>
dependsOn()
A list of containers that this container depends on.List<KeyValuePair>
environment()
The environment variables to pass to a container.boolean
equals(Object obj)
boolean
equalsBySdkFields(Object obj)
Boolean
essential()
If the essential parameter of a container is marked astrue
, and that container fails or stops for any reason, all other containers that are part of the task are stopped.<T> Optional<T>
getValueForField(String fieldName, Class<T> clazz)
boolean
hasCommand()
For responses, this returns true if the service returned a value for the Command property.boolean
hasDependsOn()
For responses, this returns true if the service returned a value for the DependsOn property.boolean
hasEnvironment()
For responses, this returns true if the service returned a value for the Environment property.int
hashCode()
boolean
hasMountPoints()
For responses, this returns true if the service returned a value for the MountPoints property.boolean
hasResourceRequirements()
For responses, this returns true if the service returned a value for the ResourceRequirements property.boolean
hasSecrets()
For responses, this returns true if the service returned a value for the Secrets property.boolean
hasUlimits()
For responses, this returns true if the service returned a value for the Ulimits property.String
image()
The image used to start a container.LinuxParameters
linuxParameters()
Linux-specific modifications that are applied to the container, such as Linux kernel capabilities.LogConfiguration
logConfiguration()
The log configuration specification for the container.List<MountPoint>
mountPoints()
The mount points for data volumes in your container.String
name()
The name of a container.Boolean
privileged()
When this parameter istrue
, the container is given elevated privileges on the host container instance (similar to theroot
user).Boolean
readonlyRootFilesystem()
When this parameter is true, the container is given read-only access to its root file system.RepositoryCredentials
repositoryCredentials()
The private repository authentication credentials to use.List<ResourceRequirement>
resourceRequirements()
The type and amount of a resource to assign to a container.List<SdkField<?>>
sdkFields()
List<Secret>
secrets()
The secrets to pass to the container.static Class<? extends TaskContainerProperties.Builder>
serializableBuilderClass()
TaskContainerProperties.Builder
toBuilder()
String
toString()
Returns a string representation of this object.List<Ulimit>
ulimits()
A list ofulimits
to set in the container.String
user()
The user to use inside the container.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
-
-
-
Method Detail
-
hasCommand
public final boolean hasCommand()
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 theisEmpty()
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.
-
command
public final List<String> command()
The command that's passed to the container. This parameter maps to
Cmd
in the Create a container section of the Docker Remote API and theCOMMAND
parameter to docker run. For more information, see Dockerfile reference: CMD.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
hasCommand()
method.- Returns:
- The command that's passed to the container. This parameter maps to
Cmd
in the Create a container section of the Docker Remote API and theCOMMAND
parameter to docker run. For more information, see Dockerfile reference: CMD.
-
hasDependsOn
public final boolean hasDependsOn()
For responses, this returns true if the service returned a value for the DependsOn property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()
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.
-
dependsOn
public final List<TaskContainerDependency> dependsOn()
A list of containers that this container depends on.
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
hasDependsOn()
method.- Returns:
- A list of containers that this container depends on.
-
hasEnvironment
public final boolean hasEnvironment()
For responses, this returns true if the service returned a value for the Environment property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()
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.
-
environment
public final List<KeyValuePair> environment()
The environment variables to pass to a container. This parameter maps to Env inthe Create a container section of the Docker Remote API and the
--env
parameter to docker run.We don't recommend using plaintext environment variables for sensitive information, such as credential data.
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
hasEnvironment()
method.- Returns:
- The environment variables to pass to a container. This parameter maps to Env inthe Create a container section of the
Docker Remote API and the
--env
parameter to docker run.We don't recommend using plaintext environment variables for sensitive information, such as credential data.
Environment variables cannot start with
AWS_BATCH
. This naming convention is reserved for variables that Batch sets.
-
essential
public final Boolean 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 theessential
parameter of a container is marked as false, its failure doesn't affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential.All jobs must have at least one essential container. If you have an application that's composed of multiple containers, group containers that are used for a common purpose into components, and separate the different components into multiple task definitions. For more information, see Application Architecture in the Amazon Elastic Container Service Developer Guide.
- Returns:
- 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 theessential
parameter of a container is marked as false, its failure doesn't affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential.All jobs must have at least one essential container. If you have an application that's composed of multiple containers, group containers that are used for a common purpose into components, and separate the different components into multiple task definitions. For more information, see Application Architecture in the Amazon Elastic Container Service Developer Guide.
-
image
public final String image()
The image used to start a container. This string is passed directly to the Docker daemon. By default, images in the Docker Hub registry are available. Other repositories are specified with either
repository-url/image:tag
orrepository-url/image@digest
. Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed. This parameter maps toImage
in the Create a container section of the Docker Remote API and theIMAGE
parameter of the docker run .- Returns:
- The image used to start a container. This string is passed directly to the Docker daemon. By default,
images in the Docker Hub registry are available. Other repositories are specified with either
repository-url/image:tag
orrepository-url/image@digest
. Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed. This parameter maps toImage
in the Create a container section of the Docker Remote API and theIMAGE
parameter of the docker run .
-
linuxParameters
public final LinuxParameters linuxParameters()
Linux-specific modifications that are applied to the container, such as Linux kernel capabilities. For more information, see KernelCapabilities .
- Returns:
- Linux-specific modifications that are applied to the container, such as Linux kernel capabilities. For more information, see KernelCapabilities.
-
logConfiguration
public final LogConfiguration logConfiguration()
The log configuration specification for the container.
This parameter maps to
LogConfig
in the Create a container section of the Docker Remote API and the--log-driver
option to docker run.By default, containers use the same logging driver that the Docker daemon uses. However the container can use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information about the options for different supported log drivers, see Configure logging drivers in the Docker documentation.
Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the
LogConfiguration
data type). Additional log drivers may be available in future releases of the Amazon ECS container agent.This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version
--format '{{.Server.APIVersion}}'
The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the
ECS_AVAILABLE_LOGGING_DRIVERS
environment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS container agent configuration in the Amazon Elastic Container Service Developer Guide.- Returns:
- The log configuration specification for the container.
This parameter maps to
LogConfig
in the Create a container section of the Docker Remote API and the--log-driver
option to docker run.By default, containers use the same logging driver that the Docker daemon uses. However the container can use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information about the options for different supported log drivers, see Configure logging drivers in the Docker documentation.
Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the
LogConfiguration
data type). Additional log drivers may be available in future releases of the Amazon ECS container agent.This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version
--format '{{.Server.APIVersion}}'
The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the
ECS_AVAILABLE_LOGGING_DRIVERS
environment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS container agent configuration in the Amazon Elastic Container Service Developer Guide.
-
hasMountPoints
public final boolean hasMountPoints()
For responses, this returns true if the service returned a value for the MountPoints property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()
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.
-
mountPoints
public final List<MountPoint> mountPoints()
The mount points for data volumes in your container.
This parameter maps to
Volumes
in the Create a container section of the Docker Remote API and the --volume option to docker run.Windows containers can mount whole directories on the same drive as
$env:ProgramData
. Windows containers can't mount directories on a different drive, and mount point can't be across drives.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
hasMountPoints()
method.- Returns:
- The mount points for data volumes in your container.
This parameter maps to
Volumes
in the Create a container section of the Docker Remote API and the --volume option to docker run.Windows containers can mount whole directories on the same drive as
$env:ProgramData
. Windows containers can't mount directories on a different drive, and mount point can't be across drives.
-
name
public final String name()
The name of a container. The name can be used as a unique identifier to target your
dependsOn
andOverrides
objects.- Returns:
- The name of a container. The name can be used as a unique identifier to target your
dependsOn
andOverrides
objects.
-
privileged
public final Boolean privileged()
When this parameter is
true
, the container is given elevated privileges on the host container instance (similar to theroot
user). This parameter maps toPrivileged
in the Create a container section of the Docker Remote API and the--privileged
option to docker run.This parameter is not supported for Windows containers or tasks run on Fargate.
- Returns:
- When this parameter is
true
, the container is given elevated privileges on the host container instance (similar to theroot
user). This parameter maps toPrivileged
in the Create a container section of the Docker Remote API and the--privileged
option to docker run.This parameter is not supported for Windows containers or tasks run on Fargate.
-
readonlyRootFilesystem
public final Boolean readonlyRootFilesystem()
When this parameter is true, the container is given read-only access to its root file system. This parameter maps to
ReadonlyRootfs
in the Create a container section of the Docker Remote API and the--read-only
option to docker run.This parameter is not supported for Windows containers.
- Returns:
- When this parameter is true, the container is given read-only access to its root file system. This
parameter maps to
ReadonlyRootfs
in the Create a container section of the Docker Remote API and the--read-only
option to docker run.This parameter is not supported for Windows containers.
-
repositoryCredentials
public final RepositoryCredentials repositoryCredentials()
The private repository authentication credentials to use.
- Returns:
- The private repository authentication credentials to use.
-
hasResourceRequirements
public final boolean hasResourceRequirements()
For responses, this returns true if the service returned a value for the ResourceRequirements property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()
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.
-
resourceRequirements
public final List<ResourceRequirement> resourceRequirements()
The type and amount of a resource to assign to a container. The only supported resource is a GPU.
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
hasResourceRequirements()
method.- Returns:
- The type and amount of a resource to assign to a container. The only supported resource is a GPU.
-
hasSecrets
public final boolean hasSecrets()
For responses, this returns true if the service returned a value for the Secrets property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()
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.
-
secrets
public final List<Secret> secrets()
The secrets to pass to the container. For more information, see Specifying Sensitive Data in the Amazon Elastic Container Service Developer Guide.
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
hasSecrets()
method.- Returns:
- The secrets to pass to the container. For more information, see Specifying Sensitive Data in the Amazon Elastic Container Service Developer Guide.
-
hasUlimits
public final boolean hasUlimits()
For responses, this returns true if the service returned a value for the Ulimits property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()
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.
-
ulimits
public final List<Ulimit> ulimits()
A list of
ulimits
to set in the container. If aulimit
value is specified in a task definition, it overrides the default values set by Docker. This parameter maps toUlimits
in the Create a container section of the Docker Remote API and the--ulimit
option to docker run.Amazon ECS tasks hosted on Fargate use the default resource limit values set by the operating system with the exception of the nofile resource limit parameter which Fargate overrides. The
nofile
resource limit sets a restriction on the number of open files that a container can use. The defaultnofile
soft limit is1024
and the default hard limit is65535
.This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version
--format '{{.Server.APIVersion}}'
This parameter is not supported for Windows containers.
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
hasUlimits()
method.- Returns:
- A list of
ulimits
to set in the container. If aulimit
value is specified in a task definition, it overrides the default values set by Docker. This parameter maps toUlimits
in the Create a container section of the Docker Remote API and the--ulimit
option to docker run.Amazon ECS tasks hosted on Fargate use the default resource limit values set by the operating system with the exception of the nofile resource limit parameter which Fargate overrides. The
nofile
resource limit sets a restriction on the number of open files that a container can use. The defaultnofile
soft limit is1024
and the default hard limit is65535
.This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version
--format '{{.Server.APIVersion}}'
This parameter is not supported for Windows containers.
-
user
public final String user()
The user to use inside the container. This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run.
When running tasks using the
host
network mode, don't run containers using theroot user (UID 0)
. We recommend using a non-root user for better security.You can specify the
user
using the following formats. If specifying a UID or GID, you must specify it as a positive integer.-
user
-
user:group
-
uid
-
uid:gid
-
user:gi
-
uid:group
This parameter is not supported for Windows containers.
- Returns:
- The user to use inside the container. This parameter maps to User in the Create a container section of
the Docker Remote API and the --user option to docker run.
When running tasks using the
host
network mode, don't run containers using theroot user (UID 0)
. We recommend using a non-root user for better security.You can specify the
user
using the following formats. If specifying a UID or GID, you must specify it as a positive integer.-
user
-
user:group
-
uid
-
uid:gid
-
user:gi
-
uid:group
This parameter is not supported for Windows containers.
-
-
-
toBuilder
public TaskContainerProperties.Builder toBuilder()
- Specified by:
toBuilder
in interfaceToCopyableBuilder<TaskContainerProperties.Builder,TaskContainerProperties>
-
builder
public static TaskContainerProperties.Builder builder()
-
serializableBuilderClass
public static Class<? extends TaskContainerProperties.Builder> serializableBuilderClass()
-
equalsBySdkFields
public final boolean equalsBySdkFields(Object obj)
- Specified by:
equalsBySdkFields
in interfaceSdkPojo
-
toString
public final String toString()
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.
-
-