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

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

The 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.HashMap;
import java.util.List;
import java.util.Map;
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 details of a task definition that describes the container and volume definitions of an Amazon ECS task. *

*/ @Generated("software.amazon.awssdk:codegen") public final class EcsTaskDetails implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField> CONTAINERS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("containers") .getter(getter(EcsTaskDetails::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(TaskContainerDetails::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField CONTAINER_INSTANCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("containerInstanceArn").getter(getter(EcsTaskDetails::containerInstanceArn)) .setter(setter(Builder::containerInstanceArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("containerInstanceArn").build()) .build(); private static final SdkField TASK_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("taskArn").getter(getter(EcsTaskDetails::taskArn)).setter(setter(Builder::taskArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskArn").build()).build(); private static final SdkField EPHEMERAL_STORAGE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ephemeralStorage") .getter(getter(EcsTaskDetails::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(EcsTaskDetails::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(EcsTaskDetails::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(EcsTaskDetails::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(EcsTaskDetails::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(EcsTaskDetails::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(EcsTaskDetails::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(EcsTaskDetails::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(EcsTaskDetails::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, CONTAINER_INSTANCE_ARN_FIELD, TASK_ARN_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 Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("containers", CONTAINERS_FIELD); put("containerInstanceArn", CONTAINER_INSTANCE_ARN_FIELD); put("taskArn", TASK_ARN_FIELD); put("ephemeralStorage", EPHEMERAL_STORAGE_FIELD); put("executionRoleArn", EXECUTION_ROLE_ARN_FIELD); put("platformVersion", PLATFORM_VERSION_FIELD); put("ipcMode", IPC_MODE_FIELD); put("taskRoleArn", TASK_ROLE_ARN_FIELD); put("pidMode", PID_MODE_FIELD); put("networkConfiguration", NETWORK_CONFIGURATION_FIELD); put("runtimePlatform", RUNTIME_PLATFORM_FIELD); put("volumes", VOLUMES_FIELD); } }); private static final long serialVersionUID = 1L; private final List containers; private final String containerInstanceArn; private final String taskArn; 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 EcsTaskDetails(BuilderImpl builder) { this.containers = builder.containers; this.containerInstanceArn = builder.containerInstanceArn; this.taskArn = builder.taskArn; 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); } /** *

* A list of containers that are included in the taskProperties list. *

*

* 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 A list of containers that are included in the taskProperties list. */ public final List containers() { return containers; } /** *

* The Amazon Resource Name (ARN) of the container instance that hosts the task. *

* * @return The Amazon Resource Name (ARN) of the container instance that hosts the task. */ public final String containerInstanceArn() { return containerInstanceArn; } /** *

* The ARN of the Amazon ECS task. *

* * @return The ARN of the Amazon ECS task. */ public final String taskArn() { return taskArn; } /** *

* The amount of ephemeral storage allocated for the task. *

* * @return The amount of ephemeral storage allocated for the task. */ public final EphemeralStorage ephemeralStorage() { return ephemeralStorage; } /** *

* The Amazon Resource Name (ARN) of the execution role that Batch can assume. 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 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. *

* * @return The Fargate platform version where the jobs are running. */ public final String platformVersion() { return platformVersion; } /** *

* The IPC resource namespace to use for the containers in the task. *

* * @return The IPC resource namespace to use for the containers in the task. */ public final String ipcMode() { return ipcMode; } /** *

* The Amazon Resource Name (ARN) of the IAM role that the container can assume for Amazon Web Services permissions. * For more information, see IAM roles for tasks in * the Amazon Elastic Container Service Developer Guide. *

* *

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

*
* * @return The Amazon Resource Name (ARN) of the IAM role that the container can assume for Amazon Web Services * permissions. For more information, see IAM roles for * tasks in the Amazon Elastic Container Service Developer Guide.

*

* 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. *

* * @return The process namespace to use for the containers in the task. */ 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 data volumes used in a 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 data volumes used in a 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(containerInstanceArn()); hashCode = 31 * hashCode + Objects.hashCode(taskArn()); 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 EcsTaskDetails)) { return false; } EcsTaskDetails other = (EcsTaskDetails) obj; return hasContainers() == other.hasContainers() && Objects.equals(containers(), other.containers()) && Objects.equals(containerInstanceArn(), other.containerInstanceArn()) && Objects.equals(taskArn(), other.taskArn()) && 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("EcsTaskDetails").add("Containers", hasContainers() ? containers() : null) .add("ContainerInstanceArn", containerInstanceArn()).add("TaskArn", taskArn()) .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 "containerInstanceArn": return Optional.ofNullable(clazz.cast(containerInstanceArn())); case "taskArn": return Optional.ofNullable(clazz.cast(taskArn())); 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; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((EcsTaskDetails) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* A list of containers that are included in the taskProperties list. *

* * @param containers * A list of containers that are included in the taskProperties list. * @return Returns a reference to this object so that method calls can be chained together. */ Builder containers(Collection containers); /** *

* A list of containers that are included in the taskProperties list. *

* * @param containers * A list of containers that are included in the taskProperties list. * @return Returns a reference to this object so that method calls can be chained together. */ Builder containers(TaskContainerDetails... containers); /** *

* A list of containers that are included in the taskProperties list. *

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

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.batch.model.TaskContainerDetails.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.TaskContainerDetails.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 Amazon Resource Name (ARN) of the container instance that hosts the task. *

* * @param containerInstanceArn * The Amazon Resource Name (ARN) of the container instance that hosts the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder containerInstanceArn(String containerInstanceArn); /** *

* The ARN of the Amazon ECS task. *

* * @param taskArn * The ARN of the Amazon ECS task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskArn(String taskArn); /** *

* The amount of ephemeral storage allocated for the task. *

* * @param ephemeralStorage * The amount of ephemeral storage allocated for the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ephemeralStorage(EphemeralStorage ephemeralStorage); /** *

* The amount of ephemeral storage allocated for the task. *

* 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 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 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. *

* * @param platformVersion * The Fargate platform version where the jobs are running. * @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. *

* * @param ipcMode * The IPC resource namespace to use for the containers in the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ipcMode(String ipcMode); /** *

* The Amazon Resource Name (ARN) of the IAM role that the container can assume for Amazon Web Services * permissions. For more information, see IAM roles for * tasks in the Amazon Elastic Container Service Developer Guide. *

* *

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

*
* * @param taskRoleArn * The Amazon Resource Name (ARN) of the IAM role that the container can assume for Amazon Web Services * permissions. For more information, see IAM roles for * tasks in the Amazon Elastic Container Service Developer Guide.

*

* 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. *

* * @param pidMode * The process namespace to use for the containers in the task. * @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 data volumes used in a job. *

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

* A list of data volumes used in a job. *

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

* A list of data volumes used in a 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 String containerInstanceArn; private String taskArn; 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(EcsTaskDetails model) { containers(model.containers); containerInstanceArn(model.containerInstanceArn); taskArn(model.taskArn); 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 = ListTaskContainerDetailsCopier.copyToBuilder(this.containers); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setContainers(Collection containers) { this.containers = ListTaskContainerDetailsCopier.copyFromBuilder(containers); } @Override public final Builder containers(Collection containers) { this.containers = ListTaskContainerDetailsCopier.copy(containers); return this; } @Override @SafeVarargs public final Builder containers(TaskContainerDetails... containers) { containers(Arrays.asList(containers)); return this; } @Override @SafeVarargs public final Builder containers(Consumer... containers) { containers(Stream.of(containers).map(c -> TaskContainerDetails.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final String getContainerInstanceArn() { return containerInstanceArn; } public final void setContainerInstanceArn(String containerInstanceArn) { this.containerInstanceArn = containerInstanceArn; } @Override public final Builder containerInstanceArn(String containerInstanceArn) { this.containerInstanceArn = containerInstanceArn; return this; } public final String getTaskArn() { return taskArn; } public final void setTaskArn(String taskArn) { this.taskArn = taskArn; } @Override public final Builder taskArn(String taskArn) { this.taskArn = taskArn; 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 EcsTaskDetails build() { return new EcsTaskDetails(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy