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

software.amazon.awssdk.services.batch.model.EcsTaskProperties 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;

/**
 * 

* The properties for a task definition that describes the container and volume definitions of an Amazon ECS task. You * can specify which Docker images to use, the required resources, and other configurations related to launching the * task definition through an Amazon ECS service or task. *

*/ @Generated("software.amazon.awssdk:codegen") public final class EcsTaskProperties implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField> CONTAINERS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("containers") .getter(getter(EcsTaskProperties::containers)) .setter(setter(Builder::containers)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("containers").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(TaskContainerProperties::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField EPHEMERAL_STORAGE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ephemeralStorage") .getter(getter(EcsTaskProperties::ephemeralStorage)).setter(setter(Builder::ephemeralStorage)) .constructor(EphemeralStorage::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ephemeralStorage").build()).build(); private static final SdkField EXECUTION_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("executionRoleArn").getter(getter(EcsTaskProperties::executionRoleArn)) .setter(setter(Builder::executionRoleArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("executionRoleArn").build()).build(); private static final SdkField PLATFORM_VERSION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("platformVersion").getter(getter(EcsTaskProperties::platformVersion)) .setter(setter(Builder::platformVersion)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("platformVersion").build()).build(); private static final SdkField IPC_MODE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ipcMode").getter(getter(EcsTaskProperties::ipcMode)).setter(setter(Builder::ipcMode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ipcMode").build()).build(); private static final SdkField TASK_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("taskRoleArn").getter(getter(EcsTaskProperties::taskRoleArn)).setter(setter(Builder::taskRoleArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskRoleArn").build()).build(); private static final SdkField PID_MODE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("pidMode").getter(getter(EcsTaskProperties::pidMode)).setter(setter(Builder::pidMode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("pidMode").build()).build(); private static final SdkField NETWORK_CONFIGURATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("networkConfiguration") .getter(getter(EcsTaskProperties::networkConfiguration)).setter(setter(Builder::networkConfiguration)) .constructor(NetworkConfiguration::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("networkConfiguration").build()) .build(); private static final SdkField RUNTIME_PLATFORM_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("runtimePlatform") .getter(getter(EcsTaskProperties::runtimePlatform)).setter(setter(Builder::runtimePlatform)) .constructor(RuntimePlatform::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("runtimePlatform").build()).build(); private static final SdkField> VOLUMES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("volumes") .getter(getter(EcsTaskProperties::volumes)) .setter(setter(Builder::volumes)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("volumes").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Volume::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CONTAINERS_FIELD, EPHEMERAL_STORAGE_FIELD, EXECUTION_ROLE_ARN_FIELD, PLATFORM_VERSION_FIELD, IPC_MODE_FIELD, TASK_ROLE_ARN_FIELD, PID_MODE_FIELD, NETWORK_CONFIGURATION_FIELD, RUNTIME_PLATFORM_FIELD, VOLUMES_FIELD)); private static final long serialVersionUID = 1L; private final List containers; private final EphemeralStorage ephemeralStorage; private final String executionRoleArn; private final String platformVersion; private final String ipcMode; private final String taskRoleArn; private final String pidMode; private final NetworkConfiguration networkConfiguration; private final RuntimePlatform runtimePlatform; private final List volumes; private EcsTaskProperties(BuilderImpl builder) { this.containers = builder.containers; this.ephemeralStorage = builder.ephemeralStorage; this.executionRoleArn = builder.executionRoleArn; this.platformVersion = builder.platformVersion; this.ipcMode = builder.ipcMode; this.taskRoleArn = builder.taskRoleArn; this.pidMode = builder.pidMode; this.networkConfiguration = builder.networkConfiguration; this.runtimePlatform = builder.runtimePlatform; this.volumes = builder.volumes; } /** * For responses, this returns true if the service returned a value for the Containers 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 hasContainers() { return containers != null && !(containers instanceof SdkAutoConstructList); } /** *

* This object is a list of 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 {@link #hasContainers} method. *

* * @return This object is a list of containers. */ public final List containers() { return containers; } /** *

* The amount of ephemeral storage to allocate for the task. This parameter is used to expand the total amount of * ephemeral storage available, beyond the default amount, for tasks hosted on Fargate. *

* * @return The amount of ephemeral storage to allocate for the task. This parameter is used to expand the total * amount of ephemeral storage available, beyond the default amount, for tasks hosted on Fargate. */ public final EphemeralStorage ephemeralStorage() { return ephemeralStorage; } /** *

* The Amazon Resource Name (ARN) of the execution role that Batch can assume. For jobs that run on Fargate * resources, you must provide an execution role. For more information, see Batch execution IAM role in * the Batch User Guide. *

* * @return The Amazon Resource Name (ARN) of the execution role that Batch can assume. For jobs that run on Fargate * resources, you must provide an execution role. For more information, see Batch execution IAM * role in the Batch User Guide. */ public final String executionRoleArn() { return executionRoleArn; } /** *

* The Fargate platform version where the jobs are running. A platform version is specified only for jobs that are * running on Fargate resources. If one isn't specified, the LATEST platform version is used by * default. This uses a recent, approved version of the Fargate platform for compute resources. For more * information, see Fargate platform * versions in the Amazon Elastic Container Service Developer Guide. *

* * @return The Fargate platform version where the jobs are running. A platform version is specified only for jobs * that are running on Fargate resources. If one isn't specified, the LATEST platform version * is used by default. This uses a recent, approved version of the Fargate platform for compute resources. * For more information, see Fargate * platform versions in the Amazon Elastic Container Service Developer Guide. */ public final String platformVersion() { return platformVersion; } /** *

* The IPC resource namespace to use for the containers in the task. The valid values are host, * task, or none. *

*

* If host is specified, all containers within the tasks that specified the host IPC mode * on the same container instance share the same IPC resources with the host Amazon EC2 instance. *

*

* If task is specified, all containers within the specified task share the same IPC * resources. *

*

* If none is specified, the IPC resources within the containers of a task are private, and are not * shared with other containers in a task or on the container instance. *

*

* If no value is specified, then the IPC resource namespace sharing depends on the Docker daemon setting on the * container instance. For more information, see IPC settings in the Docker run * reference. *

* * @return The IPC resource namespace to use for the containers in the task. The valid values are host, * task, or none.

*

* If host is specified, all containers within the tasks that specified the host * IPC mode on the same container instance share the same IPC resources with the host Amazon EC2 instance. *

*

* If task is specified, all containers within the specified task share the same * IPC resources. *

*

* If none is specified, the IPC resources within the containers of a task are private, and are * not shared with other containers in a task or on the container instance. *

*

* If no value is specified, then the IPC resource namespace sharing depends on the Docker daemon setting on * the container instance. For more information, see IPC settings in the Docker * run reference. */ public final String ipcMode() { return ipcMode; } /** *

* The Amazon Resource Name (ARN) that's associated with the Amazon ECS task. *

* *

* This is object is comparable to ContainerProperties:jobRoleArn. *

*
* * @return The Amazon Resource Name (ARN) that's associated with the Amazon ECS task.

*

* This is object is comparable to ContainerProperties:jobRoleArn. *

*/ public final String taskRoleArn() { return taskRoleArn; } /** *

* The process namespace to use for the containers in the task. The valid values are host or * task. For example, monitoring sidecars might need pidMode to access information about * other containers running in the same task. *

*

* If host is specified, all containers within the tasks that specified the host PID mode * on the same container instance share the process namespace with the host Amazon EC2 instance. *

*

* If task is specified, all containers within the specified task share the same process namespace. *

*

* If no value is specified, the default is a private namespace for each container. For more information, see PID settings in the Docker run * reference. *

* * @return The process namespace to use for the containers in the task. The valid values are host or * task. For example, monitoring sidecars might need pidMode to access information * about other containers running in the same task.

*

* If host is specified, all containers within the tasks that specified the host * PID mode on the same container instance share the process namespace with the host Amazon EC2 instance. *

*

* If task is specified, all containers within the specified task share the same process * namespace. *

*

* If no value is specified, the default is a private namespace for each container. For more information, * see PID settings in the * Docker run reference. */ public final String pidMode() { return pidMode; } /** *

* The network configuration for jobs that are running on Fargate resources. Jobs that are running on Amazon EC2 * resources must not specify this parameter. *

* * @return The network configuration for jobs that are running on Fargate resources. Jobs that are running on Amazon * EC2 resources must not specify this parameter. */ public final NetworkConfiguration networkConfiguration() { return networkConfiguration; } /** *

* An object that represents the compute environment architecture for Batch jobs on Fargate. *

* * @return An object that represents the compute environment architecture for Batch jobs on Fargate. */ public final RuntimePlatform runtimePlatform() { return runtimePlatform; } /** * For responses, this returns true if the service returned a value for the Volumes 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 hasVolumes() { return volumes != null && !(volumes instanceof SdkAutoConstructList); } /** *

* A list of volumes that are associated with the job. *

*

* 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 #hasVolumes} method. *

* * @return A list of volumes that are associated with the job. */ public final List volumes() { return volumes; } @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(hasContainers() ? containers() : null); hashCode = 31 * hashCode + Objects.hashCode(ephemeralStorage()); hashCode = 31 * hashCode + Objects.hashCode(executionRoleArn()); hashCode = 31 * hashCode + Objects.hashCode(platformVersion()); hashCode = 31 * hashCode + Objects.hashCode(ipcMode()); hashCode = 31 * hashCode + Objects.hashCode(taskRoleArn()); hashCode = 31 * hashCode + Objects.hashCode(pidMode()); hashCode = 31 * hashCode + Objects.hashCode(networkConfiguration()); hashCode = 31 * hashCode + Objects.hashCode(runtimePlatform()); hashCode = 31 * hashCode + Objects.hashCode(hasVolumes() ? volumes() : null); 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 EcsTaskProperties)) { return false; } EcsTaskProperties other = (EcsTaskProperties) obj; return hasContainers() == other.hasContainers() && Objects.equals(containers(), other.containers()) && Objects.equals(ephemeralStorage(), other.ephemeralStorage()) && Objects.equals(executionRoleArn(), other.executionRoleArn()) && Objects.equals(platformVersion(), other.platformVersion()) && Objects.equals(ipcMode(), other.ipcMode()) && Objects.equals(taskRoleArn(), other.taskRoleArn()) && Objects.equals(pidMode(), other.pidMode()) && Objects.equals(networkConfiguration(), other.networkConfiguration()) && Objects.equals(runtimePlatform(), other.runtimePlatform()) && hasVolumes() == other.hasVolumes() && Objects.equals(volumes(), other.volumes()); } /** * 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("EcsTaskProperties").add("Containers", hasContainers() ? containers() : null) .add("EphemeralStorage", ephemeralStorage()).add("ExecutionRoleArn", executionRoleArn()) .add("PlatformVersion", platformVersion()).add("IpcMode", ipcMode()).add("TaskRoleArn", taskRoleArn()) .add("PidMode", pidMode()).add("NetworkConfiguration", networkConfiguration()) .add("RuntimePlatform", runtimePlatform()).add("Volumes", hasVolumes() ? volumes() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "containers": return Optional.ofNullable(clazz.cast(containers())); case "ephemeralStorage": return Optional.ofNullable(clazz.cast(ephemeralStorage())); case "executionRoleArn": return Optional.ofNullable(clazz.cast(executionRoleArn())); case "platformVersion": return Optional.ofNullable(clazz.cast(platformVersion())); case "ipcMode": return Optional.ofNullable(clazz.cast(ipcMode())); case "taskRoleArn": return Optional.ofNullable(clazz.cast(taskRoleArn())); case "pidMode": return Optional.ofNullable(clazz.cast(pidMode())); case "networkConfiguration": return Optional.ofNullable(clazz.cast(networkConfiguration())); case "runtimePlatform": return Optional.ofNullable(clazz.cast(runtimePlatform())); case "volumes": return Optional.ofNullable(clazz.cast(volumes())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((EcsTaskProperties) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* This object is a list of containers. *

* * @param containers * This object is a list of containers. * @return Returns a reference to this object so that method calls can be chained together. */ Builder containers(Collection containers); /** *

* This object is a list of containers. *

* * @param containers * This object is a list of containers. * @return Returns a reference to this object so that method calls can be chained together. */ Builder containers(TaskContainerProperties... containers); /** *

* This object is a list of containers. *

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

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

* The amount of ephemeral storage to allocate for the task. This parameter is used to expand the total amount * of ephemeral storage available, beyond the default amount, for tasks hosted on Fargate. *

* * @param ephemeralStorage * The amount of ephemeral storage to allocate for the task. This parameter is used to expand the total * amount of ephemeral storage available, beyond the default amount, for tasks hosted on Fargate. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ephemeralStorage(EphemeralStorage ephemeralStorage); /** *

* The amount of ephemeral storage to allocate for the task. This parameter is used to expand the total amount * of ephemeral storage available, beyond the default amount, for tasks hosted on Fargate. *

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

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

* The Amazon Resource Name (ARN) of the execution role that Batch can assume. For jobs that run on Fargate * resources, you must provide an execution role. For more information, see Batch execution IAM * role in the Batch User Guide. *

* * @param executionRoleArn * The Amazon Resource Name (ARN) of the execution role that Batch can assume. For jobs that run on * Fargate resources, you must provide an execution role. For more information, see Batch execution IAM * role in the Batch User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder executionRoleArn(String executionRoleArn); /** *

* The Fargate platform version where the jobs are running. A platform version is specified only for jobs that * are running on Fargate resources. If one isn't specified, the LATEST platform version is used by * default. This uses a recent, approved version of the Fargate platform for compute resources. For more * information, see Fargate platform * versions in the Amazon Elastic Container Service Developer Guide. *

* * @param platformVersion * The Fargate platform version where the jobs are running. A platform version is specified only for jobs * that are running on Fargate resources. If one isn't specified, the LATEST platform * version is used by default. This uses a recent, approved version of the Fargate platform for compute * resources. For more information, see Fargate * platform versions in the Amazon Elastic Container Service Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder platformVersion(String platformVersion); /** *

* The IPC resource namespace to use for the containers in the task. The valid values are host, * task, or none. *

*

* If host is specified, all containers within the tasks that specified the host IPC * mode on the same container instance share the same IPC resources with the host Amazon EC2 instance. *

*

* If task is specified, all containers within the specified task share the same IPC * resources. *

*

* If none is specified, the IPC resources within the containers of a task are private, and are not * shared with other containers in a task or on the container instance. *

*

* If no value is specified, then the IPC resource namespace sharing depends on the Docker daemon setting on the * container instance. For more information, see IPC settings in the Docker run * reference. *

* * @param ipcMode * The IPC resource namespace to use for the containers in the task. The valid values are * host, task, or none.

*

* If host is specified, all containers within the tasks that specified the * host IPC mode on the same container instance share the same IPC resources with the host * Amazon EC2 instance. *

*

* If task is specified, all containers within the specified task share the * same IPC resources. *

*

* If none is specified, the IPC resources within the containers of a task are private, and * are not shared with other containers in a task or on the container instance. *

*

* If no value is specified, then the IPC resource namespace sharing depends on the Docker daemon setting * on the container instance. For more information, see IPC settings in the Docker * run reference. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ipcMode(String ipcMode); /** *

* The Amazon Resource Name (ARN) that's associated with the Amazon ECS task. *

* *

* This is object is comparable to ContainerProperties:jobRoleArn. *

*
* * @param taskRoleArn * The Amazon Resource Name (ARN) that's associated with the Amazon ECS task.

*

* This is object is comparable to ContainerProperties:jobRoleArn. *

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

* The process namespace to use for the containers in the task. The valid values are host or * task. For example, monitoring sidecars might need pidMode to access information * about other containers running in the same task. *

*

* If host is specified, all containers within the tasks that specified the host PID * mode on the same container instance share the process namespace with the host Amazon EC2 instance. *

*

* If task is specified, all containers within the specified task share the same process namespace. *

*

* If no value is specified, the default is a private namespace for each container. For more information, see PID settings in the Docker run * reference. *

* * @param pidMode * The process namespace to use for the containers in the task. The valid values are host or * task. For example, monitoring sidecars might need pidMode to access * information about other containers running in the same task.

*

* If host is specified, all containers within the tasks that specified the * host PID mode on the same container instance share the process namespace with the host * Amazon EC2 instance. *

*

* If task is specified, all containers within the specified task share the same process * namespace. *

*

* If no value is specified, the default is a private namespace for each container. For more information, * see PID settings in the * Docker run reference. * @return Returns a reference to this object so that method calls can be chained together. */ Builder pidMode(String pidMode); /** *

* The network configuration for jobs that are running on Fargate resources. Jobs that are running on Amazon EC2 * resources must not specify this parameter. *

* * @param networkConfiguration * The network configuration for jobs that are running on Fargate resources. Jobs that are running on * Amazon EC2 resources must not specify this parameter. * @return Returns a reference to this object so that method calls can be chained together. */ Builder networkConfiguration(NetworkConfiguration networkConfiguration); /** *

* The network configuration for jobs that are running on Fargate resources. Jobs that are running on Amazon EC2 * resources must not specify this parameter. *

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

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

* An object that represents the compute environment architecture for Batch jobs on Fargate. *

* * @param runtimePlatform * An object that represents the compute environment architecture for Batch jobs on Fargate. * @return Returns a reference to this object so that method calls can be chained together. */ Builder runtimePlatform(RuntimePlatform runtimePlatform); /** *

* An object that represents the compute environment architecture for Batch jobs on Fargate. *

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

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

* A list of volumes that are associated with the job. *

* * @param volumes * A list of volumes that are associated with the job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumes(Collection volumes); /** *

* A list of volumes that are associated with the job. *

* * @param volumes * A list of volumes that are associated with the job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumes(Volume... volumes); /** *

* A list of volumes that are associated with the job. *

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

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.batch.model.Volume.Builder#build()} is called immediately and its * result is passed to {@link #volumes(List)}. * * @param volumes * a consumer that will call methods on * {@link software.amazon.awssdk.services.batch.model.Volume.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #volumes(java.util.Collection) */ Builder volumes(Consumer... volumes); } static final class BuilderImpl implements Builder { private List containers = DefaultSdkAutoConstructList.getInstance(); private EphemeralStorage ephemeralStorage; private String executionRoleArn; private String platformVersion; private String ipcMode; private String taskRoleArn; private String pidMode; private NetworkConfiguration networkConfiguration; private RuntimePlatform runtimePlatform; private List volumes = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(EcsTaskProperties model) { containers(model.containers); ephemeralStorage(model.ephemeralStorage); executionRoleArn(model.executionRoleArn); platformVersion(model.platformVersion); ipcMode(model.ipcMode); taskRoleArn(model.taskRoleArn); pidMode(model.pidMode); networkConfiguration(model.networkConfiguration); runtimePlatform(model.runtimePlatform); volumes(model.volumes); } public final List getContainers() { List result = ListTaskContainerPropertiesCopier.copyToBuilder(this.containers); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setContainers(Collection containers) { this.containers = ListTaskContainerPropertiesCopier.copyFromBuilder(containers); } @Override public final Builder containers(Collection containers) { this.containers = ListTaskContainerPropertiesCopier.copy(containers); return this; } @Override @SafeVarargs public final Builder containers(TaskContainerProperties... containers) { containers(Arrays.asList(containers)); return this; } @Override @SafeVarargs public final Builder containers(Consumer... containers) { containers(Stream.of(containers).map(c -> TaskContainerProperties.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final EphemeralStorage.Builder getEphemeralStorage() { return ephemeralStorage != null ? ephemeralStorage.toBuilder() : null; } public final void setEphemeralStorage(EphemeralStorage.BuilderImpl ephemeralStorage) { this.ephemeralStorage = ephemeralStorage != null ? ephemeralStorage.build() : null; } @Override public final Builder ephemeralStorage(EphemeralStorage ephemeralStorage) { this.ephemeralStorage = ephemeralStorage; return this; } public final String getExecutionRoleArn() { return executionRoleArn; } public final void setExecutionRoleArn(String executionRoleArn) { this.executionRoleArn = executionRoleArn; } @Override public final Builder executionRoleArn(String executionRoleArn) { this.executionRoleArn = executionRoleArn; return this; } public final String getPlatformVersion() { return platformVersion; } public final void setPlatformVersion(String platformVersion) { this.platformVersion = platformVersion; } @Override public final Builder platformVersion(String platformVersion) { this.platformVersion = platformVersion; return this; } public final String getIpcMode() { return ipcMode; } public final void setIpcMode(String ipcMode) { this.ipcMode = ipcMode; } @Override public final Builder ipcMode(String ipcMode) { this.ipcMode = ipcMode; return this; } public final String getTaskRoleArn() { return taskRoleArn; } public final void setTaskRoleArn(String taskRoleArn) { this.taskRoleArn = taskRoleArn; } @Override public final Builder taskRoleArn(String taskRoleArn) { this.taskRoleArn = taskRoleArn; return this; } public final String getPidMode() { return pidMode; } public final void setPidMode(String pidMode) { this.pidMode = pidMode; } @Override public final Builder pidMode(String pidMode) { this.pidMode = pidMode; return this; } public final NetworkConfiguration.Builder getNetworkConfiguration() { return networkConfiguration != null ? networkConfiguration.toBuilder() : null; } public final void setNetworkConfiguration(NetworkConfiguration.BuilderImpl networkConfiguration) { this.networkConfiguration = networkConfiguration != null ? networkConfiguration.build() : null; } @Override public final Builder networkConfiguration(NetworkConfiguration networkConfiguration) { this.networkConfiguration = networkConfiguration; return this; } public final RuntimePlatform.Builder getRuntimePlatform() { return runtimePlatform != null ? runtimePlatform.toBuilder() : null; } public final void setRuntimePlatform(RuntimePlatform.BuilderImpl runtimePlatform) { this.runtimePlatform = runtimePlatform != null ? runtimePlatform.build() : null; } @Override public final Builder runtimePlatform(RuntimePlatform runtimePlatform) { this.runtimePlatform = runtimePlatform; return this; } public final List getVolumes() { List result = VolumesCopier.copyToBuilder(this.volumes); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setVolumes(Collection volumes) { this.volumes = VolumesCopier.copyFromBuilder(volumes); } @Override public final Builder volumes(Collection volumes) { this.volumes = VolumesCopier.copy(volumes); return this; } @Override @SafeVarargs public final Builder volumes(Volume... volumes) { volumes(Arrays.asList(volumes)); return this; } @Override @SafeVarargs public final Builder volumes(Consumer... volumes) { volumes(Stream.of(volumes).map(c -> Volume.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } @Override public EcsTaskProperties build() { return new EcsTaskProperties(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy