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

software.amazon.awssdk.services.ecs.model.RunTaskRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for the Amazon EC2 Container Service holds the client classes that are used for communicating with the Amazon EC2 Container Service

There is a newer version: 2.30.1
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.ecs.model;

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.awscore.AwsRequestOverrideConfiguration;
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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class RunTaskRequest extends EcsRequest implements ToCopyableBuilder {
    private static final SdkField> CAPACITY_PROVIDER_STRATEGY_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("capacityProviderStrategy")
            .getter(getter(RunTaskRequest::capacityProviderStrategy))
            .setter(setter(Builder::capacityProviderStrategy))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("capacityProviderStrategy").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(CapacityProviderStrategyItem::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField CLUSTER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("cluster")
            .getter(getter(RunTaskRequest::cluster)).setter(setter(Builder::cluster))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("cluster").build()).build();

    private static final SdkField COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("count")
            .getter(getter(RunTaskRequest::count)).setter(setter(Builder::count))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("count").build()).build();

    private static final SdkField ENABLE_ECS_MANAGED_TAGS_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
            .memberName("enableECSManagedTags").getter(getter(RunTaskRequest::enableECSManagedTags))
            .setter(setter(Builder::enableECSManagedTags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("enableECSManagedTags").build())
            .build();

    private static final SdkField ENABLE_EXECUTE_COMMAND_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
            .memberName("enableExecuteCommand").getter(getter(RunTaskRequest::enableExecuteCommand))
            .setter(setter(Builder::enableExecuteCommand))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("enableExecuteCommand").build())
            .build();

    private static final SdkField GROUP_FIELD = SdkField. builder(MarshallingType.STRING).memberName("group")
            .getter(getter(RunTaskRequest::group)).setter(setter(Builder::group))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("group").build()).build();

    private static final SdkField LAUNCH_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("launchType").getter(getter(RunTaskRequest::launchTypeAsString)).setter(setter(Builder::launchType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("launchType").build()).build();

    private static final SdkField NETWORK_CONFIGURATION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("networkConfiguration")
            .getter(getter(RunTaskRequest::networkConfiguration)).setter(setter(Builder::networkConfiguration))
            .constructor(NetworkConfiguration::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("networkConfiguration").build())
            .build();

    private static final SdkField OVERRIDES_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("overrides").getter(getter(RunTaskRequest::overrides)).setter(setter(Builder::overrides))
            .constructor(TaskOverride::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("overrides").build()).build();

    private static final SdkField> PLACEMENT_CONSTRAINTS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("placementConstraints")
            .getter(getter(RunTaskRequest::placementConstraints))
            .setter(setter(Builder::placementConstraints))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("placementConstraints").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(PlacementConstraint::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField> PLACEMENT_STRATEGY_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("placementStrategy")
            .getter(getter(RunTaskRequest::placementStrategy))
            .setter(setter(Builder::placementStrategy))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("placementStrategy").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(PlacementStrategy::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField PLATFORM_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("platformVersion").getter(getter(RunTaskRequest::platformVersion))
            .setter(setter(Builder::platformVersion))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("platformVersion").build()).build();

    private static final SdkField PROPAGATE_TAGS_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("propagateTags").getter(getter(RunTaskRequest::propagateTagsAsString))
            .setter(setter(Builder::propagateTags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("propagateTags").build()).build();

    private static final SdkField REFERENCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("referenceId").getter(getter(RunTaskRequest::referenceId)).setter(setter(Builder::referenceId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("referenceId").build()).build();

    private static final SdkField STARTED_BY_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("startedBy").getter(getter(RunTaskRequest::startedBy)).setter(setter(Builder::startedBy))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startedBy").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("tags")
            .getter(getter(RunTaskRequest::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(Tag::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField TASK_DEFINITION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("taskDefinition").getter(getter(RunTaskRequest::taskDefinition)).setter(setter(Builder::taskDefinition))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskDefinition").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
            CAPACITY_PROVIDER_STRATEGY_FIELD, CLUSTER_FIELD, COUNT_FIELD, ENABLE_ECS_MANAGED_TAGS_FIELD,
            ENABLE_EXECUTE_COMMAND_FIELD, GROUP_FIELD, LAUNCH_TYPE_FIELD, NETWORK_CONFIGURATION_FIELD, OVERRIDES_FIELD,
            PLACEMENT_CONSTRAINTS_FIELD, PLACEMENT_STRATEGY_FIELD, PLATFORM_VERSION_FIELD, PROPAGATE_TAGS_FIELD,
            REFERENCE_ID_FIELD, STARTED_BY_FIELD, TAGS_FIELD, TASK_DEFINITION_FIELD));

    private final List capacityProviderStrategy;

    private final String cluster;

    private final Integer count;

    private final Boolean enableECSManagedTags;

    private final Boolean enableExecuteCommand;

    private final String group;

    private final String launchType;

    private final NetworkConfiguration networkConfiguration;

    private final TaskOverride overrides;

    private final List placementConstraints;

    private final List placementStrategy;

    private final String platformVersion;

    private final String propagateTags;

    private final String referenceId;

    private final String startedBy;

    private final List tags;

    private final String taskDefinition;

    private RunTaskRequest(BuilderImpl builder) {
        super(builder);
        this.capacityProviderStrategy = builder.capacityProviderStrategy;
        this.cluster = builder.cluster;
        this.count = builder.count;
        this.enableECSManagedTags = builder.enableECSManagedTags;
        this.enableExecuteCommand = builder.enableExecuteCommand;
        this.group = builder.group;
        this.launchType = builder.launchType;
        this.networkConfiguration = builder.networkConfiguration;
        this.overrides = builder.overrides;
        this.placementConstraints = builder.placementConstraints;
        this.placementStrategy = builder.placementStrategy;
        this.platformVersion = builder.platformVersion;
        this.propagateTags = builder.propagateTags;
        this.referenceId = builder.referenceId;
        this.startedBy = builder.startedBy;
        this.tags = builder.tags;
        this.taskDefinition = builder.taskDefinition;
    }

    /**
     * For responses, this returns true if the service returned a value for the CapacityProviderStrategy 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 hasCapacityProviderStrategy() {
        return capacityProviderStrategy != null && !(capacityProviderStrategy instanceof SdkAutoConstructList);
    }

    /**
     * 

* The capacity provider strategy to use for the task. *

*

* If a capacityProviderStrategy is specified, the launchType parameter must be omitted. * If no capacityProviderStrategy or launchType is specified, the * defaultCapacityProviderStrategy for the cluster is used. *

*

* When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

*

* A capacity provider strategy may contain a maximum of 6 capacity providers. *

*

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

* * @return The capacity provider strategy to use for the task.

*

* If a capacityProviderStrategy is specified, the launchType parameter must be * omitted. If no capacityProviderStrategy or launchType is specified, the * defaultCapacityProviderStrategy for the cluster is used. *

*

* When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

*

* A capacity provider strategy may contain a maximum of 6 capacity providers. */ public final List capacityProviderStrategy() { return capacityProviderStrategy; } /** *

* The short name or full Amazon Resource Name (ARN) of the cluster to run your task on. If you do not specify a * cluster, the default cluster is assumed. *

* * @return The short name or full Amazon Resource Name (ARN) of the cluster to run your task on. If you do not * specify a cluster, the default cluster is assumed. */ public final String cluster() { return cluster; } /** *

* The number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks for * each call. *

* * @return The number of instantiations of the specified task to place on your cluster. You can specify up to 10 * tasks for each call. */ public final Integer count() { return count; } /** *

* Specifies whether to use Amazon ECS managed tags for the task. For more information, see Tagging Your Amazon ECS * Resources in the Amazon Elastic Container Service Developer Guide. *

* * @return Specifies whether to use Amazon ECS managed tags for the task. For more information, see Tagging Your * Amazon ECS Resources in the Amazon Elastic Container Service Developer Guide. */ public final Boolean enableECSManagedTags() { return enableECSManagedTags; } /** *

* Determines whether to use the execute command functionality for the containers in this task. If true * , this enables execute command functionality on all containers in the task. *

*

* If true, then the task definition must have a task role, or you must provide one as an override. *

* * @return Determines whether to use the execute command functionality for the containers in this task. If * true, this enables execute command functionality on all containers in the task.

*

* If true, then the task definition must have a task role, or you must provide one as an * override. */ public final Boolean enableExecuteCommand() { return enableExecuteCommand; } /** *

* The name of the task group to associate with the task. The default value is the family name of the task * definition (for example, family:my-family-name). *

* * @return The name of the task group to associate with the task. The default value is the family name of the task * definition (for example, family:my-family-name). */ public final String group() { return group; } /** *

* The infrastructure to run your standalone task on. For more information, see Amazon ECS launch types * in the Amazon Elastic Container Service Developer Guide. *

*

* The FARGATE launch type runs your tasks on Fargate On-Demand infrastructure. *

* *

* Fargate Spot infrastructure is available for use but a capacity provider strategy must be used. For more * information, see Fargate capacity * providers in the Amazon ECS User Guide for Fargate. *

*
*

* The EC2 launch type runs your tasks on Amazon EC2 instances registered to your cluster. *

*

* The EXTERNAL launch type runs your tasks on your on-premises server or virtual machine (VM) capacity * registered to your cluster. *

*

* A task can use either a launch type or a capacity provider strategy. If a launchType is specified, * the capacityProviderStrategy parameter must be omitted. *

*

* When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #launchType} will * return {@link LaunchType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #launchTypeAsString}. *

* * @return The infrastructure to run your standalone task on. For more information, see Amazon ECS launch * types in the Amazon Elastic Container Service Developer Guide.

*

* The FARGATE launch type runs your tasks on Fargate On-Demand infrastructure. *

* *

* Fargate Spot infrastructure is available for use but a capacity provider strategy must be used. For more * information, see Fargate * capacity providers in the Amazon ECS User Guide for Fargate. *

*
*

* The EC2 launch type runs your tasks on Amazon EC2 instances registered to your cluster. *

*

* The EXTERNAL launch type runs your tasks on your on-premises server or virtual machine (VM) * capacity registered to your cluster. *

*

* A task can use either a launch type or a capacity provider strategy. If a launchType is * specified, the capacityProviderStrategy parameter must be omitted. *

*

* When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. * @see LaunchType */ public final LaunchType launchType() { return LaunchType.fromValue(launchType); } /** *

* The infrastructure to run your standalone task on. For more information, see Amazon ECS launch types * in the Amazon Elastic Container Service Developer Guide. *

*

* The FARGATE launch type runs your tasks on Fargate On-Demand infrastructure. *

* *

* Fargate Spot infrastructure is available for use but a capacity provider strategy must be used. For more * information, see Fargate capacity * providers in the Amazon ECS User Guide for Fargate. *

*
*

* The EC2 launch type runs your tasks on Amazon EC2 instances registered to your cluster. *

*

* The EXTERNAL launch type runs your tasks on your on-premises server or virtual machine (VM) capacity * registered to your cluster. *

*

* A task can use either a launch type or a capacity provider strategy. If a launchType is specified, * the capacityProviderStrategy parameter must be omitted. *

*

* When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #launchType} will * return {@link LaunchType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #launchTypeAsString}. *

* * @return The infrastructure to run your standalone task on. For more information, see Amazon ECS launch * types in the Amazon Elastic Container Service Developer Guide.

*

* The FARGATE launch type runs your tasks on Fargate On-Demand infrastructure. *

* *

* Fargate Spot infrastructure is available for use but a capacity provider strategy must be used. For more * information, see Fargate * capacity providers in the Amazon ECS User Guide for Fargate. *

*
*

* The EC2 launch type runs your tasks on Amazon EC2 instances registered to your cluster. *

*

* The EXTERNAL launch type runs your tasks on your on-premises server or virtual machine (VM) * capacity registered to your cluster. *

*

* A task can use either a launch type or a capacity provider strategy. If a launchType is * specified, the capacityProviderStrategy parameter must be omitted. *

*

* When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. * @see LaunchType */ public final String launchTypeAsString() { return launchType; } /** *

* The network configuration for the task. This parameter is required for task definitions that use the * awsvpc network mode to receive their own elastic network interface, and it isn't supported for other * network modes. For more information, see Task networking in * the Amazon Elastic Container Service Developer Guide. *

* * @return The network configuration for the task. This parameter is required for task definitions that use the * awsvpc network mode to receive their own elastic network interface, and it isn't supported * for other network modes. For more information, see Task * networking in the Amazon Elastic Container Service Developer Guide. */ public final NetworkConfiguration networkConfiguration() { return networkConfiguration; } /** *

* A list of container overrides in JSON format that specify the name of a container in the specified task * definition and the overrides it should receive. You can override the default command for a container (that's * specified in the task definition or Docker image) with a command override. You can also override * existing environment variables (that are specified in the task definition or Docker image) on a container or add * new environment variables to it with an environment override. *

*

* A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the * override structure. *

* * @return A list of container overrides in JSON format that specify the name of a container in the specified task * definition and the overrides it should receive. You can override the default command for a container * (that's specified in the task definition or Docker image) with a command override. You can * also override existing environment variables (that are specified in the task definition or Docker image) * on a container or add new environment variables to it with an environment override.

*

* A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters * of the override structure. */ public final TaskOverride overrides() { return overrides; } /** * For responses, this returns true if the service returned a value for the PlacementConstraints 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 hasPlacementConstraints() { return placementConstraints != null && !(placementConstraints instanceof SdkAutoConstructList); } /** *

* An array of placement constraint objects to use for the task. You can specify up to 10 constraints for each task * (including constraints in the task definition and those specified at runtime). *

*

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

* * @return An array of placement constraint objects to use for the task. You can specify up to 10 constraints for * each task (including constraints in the task definition and those specified at runtime). */ public final List placementConstraints() { return placementConstraints; } /** * For responses, this returns true if the service returned a value for the PlacementStrategy 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 hasPlacementStrategy() { return placementStrategy != null && !(placementStrategy instanceof SdkAutoConstructList); } /** *

* The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules for each task. *

*

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

* * @return The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules for * each task. */ public final List placementStrategy() { return placementStrategy; } /** *

* The platform version the task uses. A platform version is only specified for tasks hosted on Fargate. If one * isn't specified, the LATEST platform version is used. For more information, see Fargate platform * versions in the Amazon Elastic Container Service Developer Guide. *

* * @return The platform version the task uses. A platform version is only specified for tasks hosted on Fargate. If * one isn't specified, the LATEST platform version is used. For more information, see Fargate * platform versions in the Amazon Elastic Container Service Developer Guide. */ public final String platformVersion() { return platformVersion; } /** *

* Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags * aren't propagated. Tags can only be propagated to the task during task creation. To add tags to a task after task * creation, use the TagResource API action. *

* *

* An error will be received if you specify the SERVICE option when running a task. *

*
*

* If the service returns an enum value that is not available in the current SDK version, {@link #propagateTags} * will return {@link PropagateTags#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #propagateTagsAsString}. *

* * @return Specifies whether to propagate the tags from the task definition to the task. If no value is specified, * the tags aren't propagated. Tags can only be propagated to the task during task creation. To add tags to * a task after task creation, use the TagResource API action.

*

* An error will be received if you specify the SERVICE option when running a task. *

* @see PropagateTags */ public final PropagateTags propagateTags() { return PropagateTags.fromValue(propagateTags); } /** *

* Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags * aren't propagated. Tags can only be propagated to the task during task creation. To add tags to a task after task * creation, use the TagResource API action. *

* *

* An error will be received if you specify the SERVICE option when running a task. *

*
*

* If the service returns an enum value that is not available in the current SDK version, {@link #propagateTags} * will return {@link PropagateTags#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #propagateTagsAsString}. *

* * @return Specifies whether to propagate the tags from the task definition to the task. If no value is specified, * the tags aren't propagated. Tags can only be propagated to the task during task creation. To add tags to * a task after task creation, use the TagResource API action.

*

* An error will be received if you specify the SERVICE option when running a task. *

* @see PropagateTags */ public final String propagateTagsAsString() { return propagateTags; } /** *

* The reference ID to use for the task. The reference ID can have a maximum length of 1024 characters. *

* * @return The reference ID to use for the task. The reference ID can have a maximum length of 1024 characters. */ public final String referenceId() { return referenceId; } /** *

* An optional tag specified when a task is started. For example, if you automatically trigger a task to run a batch * process job, you could apply a unique identifier for that job to your task with the startedBy * parameter. You can then identify which tasks belong to that job by filtering the results of a ListTasks * call with the startedBy value. Up to 36 letters (uppercase and lowercase), numbers, hyphens (-), and * underscores (_) are allowed. *

*

* If a task is started by an Amazon ECS service, then the startedBy parameter contains the deployment * ID of the service that starts it. *

* * @return An optional tag specified when a task is started. For example, if you automatically trigger a task to run * a batch process job, you could apply a unique identifier for that job to your task with the * startedBy parameter. You can then identify which tasks belong to that job by filtering the * results of a ListTasks call with the startedBy value. Up to 36 letters (uppercase and * lowercase), numbers, hyphens (-), and underscores (_) are allowed.

*

* If a task is started by an Amazon ECS service, then the startedBy parameter contains the * deployment ID of the service that starts it. */ public final String startedBy() { return startedBy; } /** * For responses, this returns true if the service returned a value for the Tags 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 hasTags() { return tags != null && !(tags instanceof SdkAutoConstructList); } /** *

* The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and * an optional value, both of which you define. *

*

* The following basic restrictions apply to tags: *

*
    *
  • *

    * Maximum number of tags per resource - 50 *

    *
  • *
  • *

    * For each resource, each tag key must be unique, and each tag key can have only one value. *

    *
  • *
  • *

    * Maximum key length - 128 Unicode characters in UTF-8 *

    *
  • *
  • *

    * Maximum value length - 256 Unicode characters in UTF-8 *

    *
  • *
  • *

    * If your tagging schema is used across multiple services and resources, remember that other services may have * restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable * in UTF-8, and the following characters: + - = . _ : / @. *

    *
  • *
  • *

    * Tag keys and values are case-sensitive. *

    *
  • *
  • *

    * Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for * either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values * with this prefix. Tags with this prefix do not count against your tags per resource limit. *

    *
  • *
*

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

* * @return The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a * key and an optional value, both of which you define.

*

* The following basic restrictions apply to tags: *

*
    *
  • *

    * Maximum number of tags per resource - 50 *

    *
  • *
  • *

    * For each resource, each tag key must be unique, and each tag key can have only one value. *

    *
  • *
  • *

    * Maximum key length - 128 Unicode characters in UTF-8 *

    *
  • *
  • *

    * Maximum value length - 256 Unicode characters in UTF-8 *

    *
  • *
  • *

    * If your tagging schema is used across multiple services and resources, remember that other services may * have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces * representable in UTF-8, and the following characters: + - = . _ : / @. *

    *
  • *
  • *

    * Tag keys and values are case-sensitive. *

    *
  • *
  • *

    * Do not use aws:, AWS:, or any upper or lowercase combination of such as a * prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete * tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource * limit. *

    *
  • */ public final List tags() { return tags; } /** *

    * The family and revision (family:revision) or full ARN of the task * definition to run. If a revision isn't specified, the latest ACTIVE revision is used. *

    *

    * When you create an IAM policy for run-task, you can set the resource to be the latest task definition revision, * or a specific revision. *

    *

    * The full ARN value must match the value that you specified as the Resource of the IAM principal's * permissions policy. *

    *

    * When you specify the policy resource as the latest task definition version (by setting the Resource * in the policy to arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName), then set this * value to arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName. *

    *

    * When you specify the policy resource as a specific task definition version (by setting the Resource * in the policy to arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:1 or * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:*), then set this value to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:1. *

    *

    * For more information, see Policy Resources for Amazon ECS in the Amazon Elastic Container Service developer Guide. *

    * * @return The family and revision (family:revision) or full ARN of the task * definition to run. If a revision isn't specified, the latest ACTIVE revision is * used.

    *

    * When you create an IAM policy for run-task, you can set the resource to be the latest task definition * revision, or a specific revision. *

    *

    * The full ARN value must match the value that you specified as the Resource of the IAM * principal's permissions policy. *

    *

    * When you specify the policy resource as the latest task definition version (by setting the * Resource in the policy to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName), then set this value to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName. *

    *

    * When you specify the policy resource as a specific task definition version (by setting the * Resource in the policy to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:1 or * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:*), then set this value to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:1. *

    *

    * For more information, see Policy Resources for Amazon ECS in the Amazon Elastic Container Service developer Guide. */ public final String taskDefinition() { return taskDefinition; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(hasCapacityProviderStrategy() ? capacityProviderStrategy() : null); hashCode = 31 * hashCode + Objects.hashCode(cluster()); hashCode = 31 * hashCode + Objects.hashCode(count()); hashCode = 31 * hashCode + Objects.hashCode(enableECSManagedTags()); hashCode = 31 * hashCode + Objects.hashCode(enableExecuteCommand()); hashCode = 31 * hashCode + Objects.hashCode(group()); hashCode = 31 * hashCode + Objects.hashCode(launchTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(networkConfiguration()); hashCode = 31 * hashCode + Objects.hashCode(overrides()); hashCode = 31 * hashCode + Objects.hashCode(hasPlacementConstraints() ? placementConstraints() : null); hashCode = 31 * hashCode + Objects.hashCode(hasPlacementStrategy() ? placementStrategy() : null); hashCode = 31 * hashCode + Objects.hashCode(platformVersion()); hashCode = 31 * hashCode + Objects.hashCode(propagateTagsAsString()); hashCode = 31 * hashCode + Objects.hashCode(referenceId()); hashCode = 31 * hashCode + Objects.hashCode(startedBy()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(taskDefinition()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof RunTaskRequest)) { return false; } RunTaskRequest other = (RunTaskRequest) obj; return hasCapacityProviderStrategy() == other.hasCapacityProviderStrategy() && Objects.equals(capacityProviderStrategy(), other.capacityProviderStrategy()) && Objects.equals(cluster(), other.cluster()) && Objects.equals(count(), other.count()) && Objects.equals(enableECSManagedTags(), other.enableECSManagedTags()) && Objects.equals(enableExecuteCommand(), other.enableExecuteCommand()) && Objects.equals(group(), other.group()) && Objects.equals(launchTypeAsString(), other.launchTypeAsString()) && Objects.equals(networkConfiguration(), other.networkConfiguration()) && Objects.equals(overrides(), other.overrides()) && hasPlacementConstraints() == other.hasPlacementConstraints() && Objects.equals(placementConstraints(), other.placementConstraints()) && hasPlacementStrategy() == other.hasPlacementStrategy() && Objects.equals(placementStrategy(), other.placementStrategy()) && Objects.equals(platformVersion(), other.platformVersion()) && Objects.equals(propagateTagsAsString(), other.propagateTagsAsString()) && Objects.equals(referenceId(), other.referenceId()) && Objects.equals(startedBy(), other.startedBy()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && Objects.equals(taskDefinition(), other.taskDefinition()); } /** * 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("RunTaskRequest") .add("CapacityProviderStrategy", hasCapacityProviderStrategy() ? capacityProviderStrategy() : null) .add("Cluster", cluster()).add("Count", count()).add("EnableECSManagedTags", enableECSManagedTags()) .add("EnableExecuteCommand", enableExecuteCommand()).add("Group", group()) .add("LaunchType", launchTypeAsString()).add("NetworkConfiguration", networkConfiguration()) .add("Overrides", overrides()) .add("PlacementConstraints", hasPlacementConstraints() ? placementConstraints() : null) .add("PlacementStrategy", hasPlacementStrategy() ? placementStrategy() : null) .add("PlatformVersion", platformVersion()).add("PropagateTags", propagateTagsAsString()) .add("ReferenceId", referenceId()).add("StartedBy", startedBy()).add("Tags", hasTags() ? tags() : null) .add("TaskDefinition", taskDefinition()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "capacityProviderStrategy": return Optional.ofNullable(clazz.cast(capacityProviderStrategy())); case "cluster": return Optional.ofNullable(clazz.cast(cluster())); case "count": return Optional.ofNullable(clazz.cast(count())); case "enableECSManagedTags": return Optional.ofNullable(clazz.cast(enableECSManagedTags())); case "enableExecuteCommand": return Optional.ofNullable(clazz.cast(enableExecuteCommand())); case "group": return Optional.ofNullable(clazz.cast(group())); case "launchType": return Optional.ofNullable(clazz.cast(launchTypeAsString())); case "networkConfiguration": return Optional.ofNullable(clazz.cast(networkConfiguration())); case "overrides": return Optional.ofNullable(clazz.cast(overrides())); case "placementConstraints": return Optional.ofNullable(clazz.cast(placementConstraints())); case "placementStrategy": return Optional.ofNullable(clazz.cast(placementStrategy())); case "platformVersion": return Optional.ofNullable(clazz.cast(platformVersion())); case "propagateTags": return Optional.ofNullable(clazz.cast(propagateTagsAsString())); case "referenceId": return Optional.ofNullable(clazz.cast(referenceId())); case "startedBy": return Optional.ofNullable(clazz.cast(startedBy())); case "tags": return Optional.ofNullable(clazz.cast(tags())); case "taskDefinition": return Optional.ofNullable(clazz.cast(taskDefinition())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((RunTaskRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends EcsRequest.Builder, SdkPojo, CopyableBuilder { /** *

    * The capacity provider strategy to use for the task. *

    *

    * If a capacityProviderStrategy is specified, the launchType parameter must be * omitted. If no capacityProviderStrategy or launchType is specified, the * defaultCapacityProviderStrategy for the cluster is used. *

    *

    * When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

    *

    * A capacity provider strategy may contain a maximum of 6 capacity providers. *

    * * @param capacityProviderStrategy * The capacity provider strategy to use for the task.

    *

    * If a capacityProviderStrategy is specified, the launchType parameter must be * omitted. If no capacityProviderStrategy or launchType is specified, the * defaultCapacityProviderStrategy for the cluster is used. *

    *

    * When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

    *

    * A capacity provider strategy may contain a maximum of 6 capacity providers. * @return Returns a reference to this object so that method calls can be chained together. */ Builder capacityProviderStrategy(Collection capacityProviderStrategy); /** *

    * The capacity provider strategy to use for the task. *

    *

    * If a capacityProviderStrategy is specified, the launchType parameter must be * omitted. If no capacityProviderStrategy or launchType is specified, the * defaultCapacityProviderStrategy for the cluster is used. *

    *

    * When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

    *

    * A capacity provider strategy may contain a maximum of 6 capacity providers. *

    * * @param capacityProviderStrategy * The capacity provider strategy to use for the task.

    *

    * If a capacityProviderStrategy is specified, the launchType parameter must be * omitted. If no capacityProviderStrategy or launchType is specified, the * defaultCapacityProviderStrategy for the cluster is used. *

    *

    * When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

    *

    * A capacity provider strategy may contain a maximum of 6 capacity providers. * @return Returns a reference to this object so that method calls can be chained together. */ Builder capacityProviderStrategy(CapacityProviderStrategyItem... capacityProviderStrategy); /** *

    * The capacity provider strategy to use for the task. *

    *

    * If a capacityProviderStrategy is specified, the launchType parameter must be * omitted. If no capacityProviderStrategy or launchType is specified, the * defaultCapacityProviderStrategy for the cluster is used. *

    *

    * When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

    *

    * A capacity provider strategy may contain a maximum of 6 capacity providers. *

    * This is a convenience method that creates an instance of the {@link List * .Builder} avoiding the need to create one manually via {@link List * #builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called * immediately and its result is passed to {@link #capacityProviderStrategy(List)} * . * * @param capacityProviderStrategy * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #capacityProviderStrategy(List) */ Builder capacityProviderStrategy(Consumer... capacityProviderStrategy); /** *

    * The short name or full Amazon Resource Name (ARN) of the cluster to run your task on. If you do not specify a * cluster, the default cluster is assumed. *

    * * @param cluster * The short name or full Amazon Resource Name (ARN) of the cluster to run your task on. If you do not * specify a cluster, the default cluster is assumed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cluster(String cluster); /** *

    * The number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks * for each call. *

    * * @param count * The number of instantiations of the specified task to place on your cluster. You can specify up to 10 * tasks for each call. * @return Returns a reference to this object so that method calls can be chained together. */ Builder count(Integer count); /** *

    * Specifies whether to use Amazon ECS managed tags for the task. For more information, see Tagging Your Amazon * ECS Resources in the Amazon Elastic Container Service Developer Guide. *

    * * @param enableECSManagedTags * Specifies whether to use Amazon ECS managed tags for the task. For more information, see Tagging Your * Amazon ECS Resources in the Amazon Elastic Container Service Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder enableECSManagedTags(Boolean enableECSManagedTags); /** *

    * Determines whether to use the execute command functionality for the containers in this task. If * true, this enables execute command functionality on all containers in the task. *

    *

    * If true, then the task definition must have a task role, or you must provide one as an override. *

    * * @param enableExecuteCommand * Determines whether to use the execute command functionality for the containers in this task. If * true, this enables execute command functionality on all containers in the task.

    *

    * If true, then the task definition must have a task role, or you must provide one as an * override. * @return Returns a reference to this object so that method calls can be chained together. */ Builder enableExecuteCommand(Boolean enableExecuteCommand); /** *

    * The name of the task group to associate with the task. The default value is the family name of the task * definition (for example, family:my-family-name). *

    * * @param group * The name of the task group to associate with the task. The default value is the family name of the * task definition (for example, family:my-family-name). * @return Returns a reference to this object so that method calls can be chained together. */ Builder group(String group); /** *

    * The infrastructure to run your standalone task on. For more information, see Amazon ECS launch * types in the Amazon Elastic Container Service Developer Guide. *

    *

    * The FARGATE launch type runs your tasks on Fargate On-Demand infrastructure. *

    * *

    * Fargate Spot infrastructure is available for use but a capacity provider strategy must be used. For more * information, see Fargate * capacity providers in the Amazon ECS User Guide for Fargate. *

    *
    *

    * The EC2 launch type runs your tasks on Amazon EC2 instances registered to your cluster. *

    *

    * The EXTERNAL launch type runs your tasks on your on-premises server or virtual machine (VM) * capacity registered to your cluster. *

    *

    * A task can use either a launch type or a capacity provider strategy. If a launchType is * specified, the capacityProviderStrategy parameter must be omitted. *

    *

    * When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

    * * @param launchType * The infrastructure to run your standalone task on. For more information, see Amazon ECS launch * types in the Amazon Elastic Container Service Developer Guide.

    *

    * The FARGATE launch type runs your tasks on Fargate On-Demand infrastructure. *

    * *

    * Fargate Spot infrastructure is available for use but a capacity provider strategy must be used. For * more information, see Fargate * capacity providers in the Amazon ECS User Guide for Fargate. *

    *
    *

    * The EC2 launch type runs your tasks on Amazon EC2 instances registered to your cluster. *

    *

    * The EXTERNAL launch type runs your tasks on your on-premises server or virtual machine * (VM) capacity registered to your cluster. *

    *

    * A task can use either a launch type or a capacity provider strategy. If a launchType is * specified, the capacityProviderStrategy parameter must be omitted. *

    *

    * When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. * @see LaunchType * @return Returns a reference to this object so that method calls can be chained together. * @see LaunchType */ Builder launchType(String launchType); /** *

    * The infrastructure to run your standalone task on. For more information, see Amazon ECS launch * types in the Amazon Elastic Container Service Developer Guide. *

    *

    * The FARGATE launch type runs your tasks on Fargate On-Demand infrastructure. *

    * *

    * Fargate Spot infrastructure is available for use but a capacity provider strategy must be used. For more * information, see Fargate * capacity providers in the Amazon ECS User Guide for Fargate. *

    *
    *

    * The EC2 launch type runs your tasks on Amazon EC2 instances registered to your cluster. *

    *

    * The EXTERNAL launch type runs your tasks on your on-premises server or virtual machine (VM) * capacity registered to your cluster. *

    *

    * A task can use either a launch type or a capacity provider strategy. If a launchType is * specified, the capacityProviderStrategy parameter must be omitted. *

    *

    * When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. *

    * * @param launchType * The infrastructure to run your standalone task on. For more information, see Amazon ECS launch * types in the Amazon Elastic Container Service Developer Guide.

    *

    * The FARGATE launch type runs your tasks on Fargate On-Demand infrastructure. *

    * *

    * Fargate Spot infrastructure is available for use but a capacity provider strategy must be used. For * more information, see Fargate * capacity providers in the Amazon ECS User Guide for Fargate. *

    *
    *

    * The EC2 launch type runs your tasks on Amazon EC2 instances registered to your cluster. *

    *

    * The EXTERNAL launch type runs your tasks on your on-premises server or virtual machine * (VM) capacity registered to your cluster. *

    *

    * A task can use either a launch type or a capacity provider strategy. If a launchType is * specified, the capacityProviderStrategy parameter must be omitted. *

    *

    * When you use cluster auto scaling, you must specify capacityProviderStrategy and not * launchType. * @see LaunchType * @return Returns a reference to this object so that method calls can be chained together. * @see LaunchType */ Builder launchType(LaunchType launchType); /** *

    * The network configuration for the task. This parameter is required for task definitions that use the * awsvpc network mode to receive their own elastic network interface, and it isn't supported for * other network modes. For more information, see Task networking * in the Amazon Elastic Container Service Developer Guide. *

    * * @param networkConfiguration * The network configuration for the task. This parameter is required for task definitions that use the * awsvpc network mode to receive their own elastic network interface, and it isn't * supported for other network modes. For more information, see Task * networking in the Amazon Elastic Container Service Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder networkConfiguration(NetworkConfiguration networkConfiguration); /** *

    * The network configuration for the task. This parameter is required for task definitions that use the * awsvpc network mode to receive their own elastic network interface, and it isn't supported for * other network modes. For more information, see Task networking * in the Amazon Elastic Container Service Developer Guide. *

    * 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()); } /** *

    * A list of container overrides in JSON format that specify the name of a container in the specified task * definition and the overrides it should receive. You can override the default command for a container (that's * specified in the task definition or Docker image) with a command override. You can also override * existing environment variables (that are specified in the task definition or Docker image) on a container or * add new environment variables to it with an environment override. *

    *

    * A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of * the override structure. *

    * * @param overrides * A list of container overrides in JSON format that specify the name of a container in the specified * task definition and the overrides it should receive. You can override the default command for a * container (that's specified in the task definition or Docker image) with a command * override. You can also override existing environment variables (that are specified in the task * definition or Docker image) on a container or add new environment variables to it with an * environment override.

    *

    * A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting * characters of the override structure. * @return Returns a reference to this object so that method calls can be chained together. */ Builder overrides(TaskOverride overrides); /** *

    * A list of container overrides in JSON format that specify the name of a container in the specified task * definition and the overrides it should receive. You can override the default command for a container (that's * specified in the task definition or Docker image) with a command override. You can also override * existing environment variables (that are specified in the task definition or Docker image) on a container or * add new environment variables to it with an environment override. *

    *

    * A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of * the override structure. *

    * This is a convenience method that creates an instance of the {@link TaskOverride.Builder} avoiding the need * to create one manually via {@link TaskOverride#builder()}. * * When the {@link Consumer} completes, {@link TaskOverride.Builder#build()} is called immediately and its * result is passed to {@link #overrides(TaskOverride)}. * * @param overrides * a consumer that will call methods on {@link TaskOverride.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #overrides(TaskOverride) */ default Builder overrides(Consumer overrides) { return overrides(TaskOverride.builder().applyMutation(overrides).build()); } /** *

    * An array of placement constraint objects to use for the task. You can specify up to 10 constraints for each * task (including constraints in the task definition and those specified at runtime). *

    * * @param placementConstraints * An array of placement constraint objects to use for the task. You can specify up to 10 constraints for * each task (including constraints in the task definition and those specified at runtime). * @return Returns a reference to this object so that method calls can be chained together. */ Builder placementConstraints(Collection placementConstraints); /** *

    * An array of placement constraint objects to use for the task. You can specify up to 10 constraints for each * task (including constraints in the task definition and those specified at runtime). *

    * * @param placementConstraints * An array of placement constraint objects to use for the task. You can specify up to 10 constraints for * each task (including constraints in the task definition and those specified at runtime). * @return Returns a reference to this object so that method calls can be chained together. */ Builder placementConstraints(PlacementConstraint... placementConstraints); /** *

    * An array of placement constraint objects to use for the task. You can specify up to 10 constraints for each * task (including constraints in the task definition and those specified at runtime). *

    * This is a convenience method that creates an instance of the {@link List.Builder} * avoiding the need to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately * and its result is passed to {@link #placementConstraints(List)}. * * @param placementConstraints * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #placementConstraints(List) */ Builder placementConstraints(Consumer... placementConstraints); /** *

    * The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules for each * task. *

    * * @param placementStrategy * The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules for * each task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder placementStrategy(Collection placementStrategy); /** *

    * The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules for each * task. *

    * * @param placementStrategy * The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules for * each task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder placementStrategy(PlacementStrategy... placementStrategy); /** *

    * The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules for each * task. *

    * This is a convenience method that creates an instance of the {@link List.Builder} avoiding * the need to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately * and its result is passed to {@link #placementStrategy(List)}. * * @param placementStrategy * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #placementStrategy(List) */ Builder placementStrategy(Consumer... placementStrategy); /** *

    * The platform version the task uses. A platform version is only specified for tasks hosted on Fargate. If one * isn't specified, the LATEST platform version is used. For more information, see Fargate platform * versions in the Amazon Elastic Container Service Developer Guide. *

    * * @param platformVersion * The platform version the task uses. A platform version is only specified for tasks hosted on Fargate. * If one isn't specified, the LATEST platform version is used. 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); /** *

    * Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the * tags aren't propagated. Tags can only be propagated to the task during task creation. To add tags to a task * after task creation, use the TagResource API action. *

    * *

    * An error will be received if you specify the SERVICE option when running a task. *

    *
    * * @param propagateTags * Specifies whether to propagate the tags from the task definition to the task. If no value is * specified, the tags aren't propagated. Tags can only be propagated to the task during task creation. * To add tags to a task after task creation, use the TagResource API action.

    *

    * An error will be received if you specify the SERVICE option when running a task. *

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

    * Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the * tags aren't propagated. Tags can only be propagated to the task during task creation. To add tags to a task * after task creation, use the TagResource API action. *

    * *

    * An error will be received if you specify the SERVICE option when running a task. *

    *
    * * @param propagateTags * Specifies whether to propagate the tags from the task definition to the task. If no value is * specified, the tags aren't propagated. Tags can only be propagated to the task during task creation. * To add tags to a task after task creation, use the TagResource API action.

    *

    * An error will be received if you specify the SERVICE option when running a task. *

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

    * The reference ID to use for the task. The reference ID can have a maximum length of 1024 characters. *

    * * @param referenceId * The reference ID to use for the task. The reference ID can have a maximum length of 1024 characters. * @return Returns a reference to this object so that method calls can be chained together. */ Builder referenceId(String referenceId); /** *

    * An optional tag specified when a task is started. For example, if you automatically trigger a task to run a * batch process job, you could apply a unique identifier for that job to your task with the * startedBy parameter. You can then identify which tasks belong to that job by filtering the * results of a ListTasks call with the startedBy value. Up to 36 letters (uppercase and * lowercase), numbers, hyphens (-), and underscores (_) are allowed. *

    *

    * If a task is started by an Amazon ECS service, then the startedBy parameter contains the * deployment ID of the service that starts it. *

    * * @param startedBy * An optional tag specified when a task is started. For example, if you automatically trigger a task to * run a batch process job, you could apply a unique identifier for that job to your task with the * startedBy parameter. You can then identify which tasks belong to that job by filtering * the results of a ListTasks call with the startedBy value. Up to 36 letters * (uppercase and lowercase), numbers, hyphens (-), and underscores (_) are allowed.

    *

    * If a task is started by an Amazon ECS service, then the startedBy parameter contains the * deployment ID of the service that starts it. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startedBy(String startedBy); /** *

    * The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key * and an optional value, both of which you define. *

    *

    * The following basic restrictions apply to tags: *

    *
      *
    • *

      * Maximum number of tags per resource - 50 *

      *
    • *
    • *

      * For each resource, each tag key must be unique, and each tag key can have only one value. *

      *
    • *
    • *

      * Maximum key length - 128 Unicode characters in UTF-8 *

      *
    • *
    • *

      * Maximum value length - 256 Unicode characters in UTF-8 *

      *
    • *
    • *

      * If your tagging schema is used across multiple services and resources, remember that other services may have * restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces * representable in UTF-8, and the following characters: + - = . _ : / @. *

      *
    • *
    • *

      * Tag keys and values are case-sensitive. *

      *
    • *
    • *

      * Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix * for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys * or values with this prefix. Tags with this prefix do not count against your tags per resource limit. *

      *
    • *
    * * @param tags * The metadata that you apply to the task to help you categorize and organize them. Each tag consists of * a key and an optional value, both of which you define.

    *

    * The following basic restrictions apply to tags: *

    *
      *
    • *

      * Maximum number of tags per resource - 50 *

      *
    • *
    • *

      * For each resource, each tag key must be unique, and each tag key can have only one value. *

      *
    • *
    • *

      * Maximum key length - 128 Unicode characters in UTF-8 *

      *
    • *
    • *

      * Maximum value length - 256 Unicode characters in UTF-8 *

      *
    • *
    • *

      * If your tagging schema is used across multiple services and resources, remember that other services * may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and * spaces representable in UTF-8, and the following characters: + - = . _ : / @. *

      *
    • *
    • *

      * Tag keys and values are case-sensitive. *

      *
    • *
    • *

      * Do not use aws:, AWS:, or any upper or lowercase combination of such as a * prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or * delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per * resource limit. *

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

      * The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key * and an optional value, both of which you define. *

      *

      * The following basic restrictions apply to tags: *

      *
        *
      • *

        * Maximum number of tags per resource - 50 *

        *
      • *
      • *

        * For each resource, each tag key must be unique, and each tag key can have only one value. *

        *
      • *
      • *

        * Maximum key length - 128 Unicode characters in UTF-8 *

        *
      • *
      • *

        * Maximum value length - 256 Unicode characters in UTF-8 *

        *
      • *
      • *

        * If your tagging schema is used across multiple services and resources, remember that other services may have * restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces * representable in UTF-8, and the following characters: + - = . _ : / @. *

        *
      • *
      • *

        * Tag keys and values are case-sensitive. *

        *
      • *
      • *

        * Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix * for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys * or values with this prefix. Tags with this prefix do not count against your tags per resource limit. *

        *
      • *
      * * @param tags * The metadata that you apply to the task to help you categorize and organize them. Each tag consists of * a key and an optional value, both of which you define.

      *

      * The following basic restrictions apply to tags: *

      *
        *
      • *

        * Maximum number of tags per resource - 50 *

        *
      • *
      • *

        * For each resource, each tag key must be unique, and each tag key can have only one value. *

        *
      • *
      • *

        * Maximum key length - 128 Unicode characters in UTF-8 *

        *
      • *
      • *

        * Maximum value length - 256 Unicode characters in UTF-8 *

        *
      • *
      • *

        * If your tagging schema is used across multiple services and resources, remember that other services * may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and * spaces representable in UTF-8, and the following characters: + - = . _ : / @. *

        *
      • *
      • *

        * Tag keys and values are case-sensitive. *

        *
      • *
      • *

        * Do not use aws:, AWS:, or any upper or lowercase combination of such as a * prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or * delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per * resource limit. *

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

        * The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key * and an optional value, both of which you define. *

        *

        * The following basic restrictions apply to tags: *

        *
          *
        • *

          * Maximum number of tags per resource - 50 *

          *
        • *
        • *

          * For each resource, each tag key must be unique, and each tag key can have only one value. *

          *
        • *
        • *

          * Maximum key length - 128 Unicode characters in UTF-8 *

          *
        • *
        • *

          * Maximum value length - 256 Unicode characters in UTF-8 *

          *
        • *
        • *

          * If your tagging schema is used across multiple services and resources, remember that other services may have * restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces * representable in UTF-8, and the following characters: + - = . _ : / @. *

          *
        • *
        • *

          * Tag keys and values are case-sensitive. *

          *
        • *
        • *

          * Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix * for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys * or values with this prefix. Tags with this prefix do not count against your tags per resource limit. *

          *
        • *
        * This is a convenience method that creates an instance of the {@link List.Builder} avoiding the need to * create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result * is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(List) */ Builder tags(Consumer... tags); /** *

        * The family and revision (family:revision) or full ARN of the task * definition to run. If a revision isn't specified, the latest ACTIVE revision is * used. *

        *

        * When you create an IAM policy for run-task, you can set the resource to be the latest task definition * revision, or a specific revision. *

        *

        * The full ARN value must match the value that you specified as the Resource of the IAM * principal's permissions policy. *

        *

        * When you specify the policy resource as the latest task definition version (by setting the * Resource in the policy to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName), then set this value to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName. *

        *

        * When you specify the policy resource as a specific task definition version (by setting the * Resource in the policy to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:1 or * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:*), then set this value to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:1. *

        *

        * For more information, see Policy Resources for Amazon ECS in the Amazon Elastic Container Service developer Guide. *

        * * @param taskDefinition * The family and revision (family:revision) or full ARN of the * task definition to run. If a revision isn't specified, the latest ACTIVE * revision is used.

        *

        * When you create an IAM policy for run-task, you can set the resource to be the latest task definition * revision, or a specific revision. *

        *

        * The full ARN value must match the value that you specified as the Resource of the IAM * principal's permissions policy. *

        *

        * When you specify the policy resource as the latest task definition version (by setting the * Resource in the policy to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName), then set this value * to arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName. *

        *

        * When you specify the policy resource as a specific task definition version (by setting the * Resource in the policy to * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:1 or * arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:*), then set this value * to arn:aws:ecs:us-east-1:111122223333:task-definition/TaskFamilyName:1. *

        *

        * For more information, see Policy Resources for Amazon ECS in the Amazon Elastic Container Service developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskDefinition(String taskDefinition); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends EcsRequest.BuilderImpl implements Builder { private List capacityProviderStrategy = DefaultSdkAutoConstructList.getInstance(); private String cluster; private Integer count; private Boolean enableECSManagedTags; private Boolean enableExecuteCommand; private String group; private String launchType; private NetworkConfiguration networkConfiguration; private TaskOverride overrides; private List placementConstraints = DefaultSdkAutoConstructList.getInstance(); private List placementStrategy = DefaultSdkAutoConstructList.getInstance(); private String platformVersion; private String propagateTags; private String referenceId; private String startedBy; private List tags = DefaultSdkAutoConstructList.getInstance(); private String taskDefinition; private BuilderImpl() { } private BuilderImpl(RunTaskRequest model) { super(model); capacityProviderStrategy(model.capacityProviderStrategy); cluster(model.cluster); count(model.count); enableECSManagedTags(model.enableECSManagedTags); enableExecuteCommand(model.enableExecuteCommand); group(model.group); launchType(model.launchType); networkConfiguration(model.networkConfiguration); overrides(model.overrides); placementConstraints(model.placementConstraints); placementStrategy(model.placementStrategy); platformVersion(model.platformVersion); propagateTags(model.propagateTags); referenceId(model.referenceId); startedBy(model.startedBy); tags(model.tags); taskDefinition(model.taskDefinition); } public final List getCapacityProviderStrategy() { List result = CapacityProviderStrategyCopier .copyToBuilder(this.capacityProviderStrategy); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setCapacityProviderStrategy( Collection capacityProviderStrategy) { this.capacityProviderStrategy = CapacityProviderStrategyCopier.copyFromBuilder(capacityProviderStrategy); } @Override public final Builder capacityProviderStrategy(Collection capacityProviderStrategy) { this.capacityProviderStrategy = CapacityProviderStrategyCopier.copy(capacityProviderStrategy); return this; } @Override @SafeVarargs public final Builder capacityProviderStrategy(CapacityProviderStrategyItem... capacityProviderStrategy) { capacityProviderStrategy(Arrays.asList(capacityProviderStrategy)); return this; } @Override @SafeVarargs public final Builder capacityProviderStrategy(Consumer... capacityProviderStrategy) { capacityProviderStrategy(Stream.of(capacityProviderStrategy) .map(c -> CapacityProviderStrategyItem.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final String getCluster() { return cluster; } public final void setCluster(String cluster) { this.cluster = cluster; } @Override public final Builder cluster(String cluster) { this.cluster = cluster; return this; } public final Integer getCount() { return count; } public final void setCount(Integer count) { this.count = count; } @Override public final Builder count(Integer count) { this.count = count; return this; } public final Boolean getEnableECSManagedTags() { return enableECSManagedTags; } public final void setEnableECSManagedTags(Boolean enableECSManagedTags) { this.enableECSManagedTags = enableECSManagedTags; } @Override public final Builder enableECSManagedTags(Boolean enableECSManagedTags) { this.enableECSManagedTags = enableECSManagedTags; return this; } public final Boolean getEnableExecuteCommand() { return enableExecuteCommand; } public final void setEnableExecuteCommand(Boolean enableExecuteCommand) { this.enableExecuteCommand = enableExecuteCommand; } @Override public final Builder enableExecuteCommand(Boolean enableExecuteCommand) { this.enableExecuteCommand = enableExecuteCommand; return this; } public final String getGroup() { return group; } public final void setGroup(String group) { this.group = group; } @Override public final Builder group(String group) { this.group = group; return this; } public final String getLaunchType() { return launchType; } public final void setLaunchType(String launchType) { this.launchType = launchType; } @Override public final Builder launchType(String launchType) { this.launchType = launchType; return this; } @Override public final Builder launchType(LaunchType launchType) { this.launchType(launchType == null ? null : launchType.toString()); 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 TaskOverride.Builder getOverrides() { return overrides != null ? overrides.toBuilder() : null; } public final void setOverrides(TaskOverride.BuilderImpl overrides) { this.overrides = overrides != null ? overrides.build() : null; } @Override public final Builder overrides(TaskOverride overrides) { this.overrides = overrides; return this; } public final List getPlacementConstraints() { List result = PlacementConstraintsCopier.copyToBuilder(this.placementConstraints); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setPlacementConstraints(Collection placementConstraints) { this.placementConstraints = PlacementConstraintsCopier.copyFromBuilder(placementConstraints); } @Override public final Builder placementConstraints(Collection placementConstraints) { this.placementConstraints = PlacementConstraintsCopier.copy(placementConstraints); return this; } @Override @SafeVarargs public final Builder placementConstraints(PlacementConstraint... placementConstraints) { placementConstraints(Arrays.asList(placementConstraints)); return this; } @Override @SafeVarargs public final Builder placementConstraints(Consumer... placementConstraints) { placementConstraints(Stream.of(placementConstraints).map(c -> PlacementConstraint.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final List getPlacementStrategy() { List result = PlacementStrategiesCopier.copyToBuilder(this.placementStrategy); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setPlacementStrategy(Collection placementStrategy) { this.placementStrategy = PlacementStrategiesCopier.copyFromBuilder(placementStrategy); } @Override public final Builder placementStrategy(Collection placementStrategy) { this.placementStrategy = PlacementStrategiesCopier.copy(placementStrategy); return this; } @Override @SafeVarargs public final Builder placementStrategy(PlacementStrategy... placementStrategy) { placementStrategy(Arrays.asList(placementStrategy)); return this; } @Override @SafeVarargs public final Builder placementStrategy(Consumer... placementStrategy) { placementStrategy(Stream.of(placementStrategy).map(c -> PlacementStrategy.builder().applyMutation(c).build()) .collect(Collectors.toList())); 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 getPropagateTags() { return propagateTags; } public final void setPropagateTags(String propagateTags) { this.propagateTags = propagateTags; } @Override public final Builder propagateTags(String propagateTags) { this.propagateTags = propagateTags; return this; } @Override public final Builder propagateTags(PropagateTags propagateTags) { this.propagateTags(propagateTags == null ? null : propagateTags.toString()); return this; } public final String getReferenceId() { return referenceId; } public final void setReferenceId(String referenceId) { this.referenceId = referenceId; } @Override public final Builder referenceId(String referenceId) { this.referenceId = referenceId; return this; } public final String getStartedBy() { return startedBy; } public final void setStartedBy(String startedBy) { this.startedBy = startedBy; } @Override public final Builder startedBy(String startedBy) { this.startedBy = startedBy; return this; } public final List getTags() { List result = TagsCopier.copyToBuilder(this.tags); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTags(Collection tags) { this.tags = TagsCopier.copyFromBuilder(tags); } @Override public final Builder tags(Collection tags) { this.tags = TagsCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final String getTaskDefinition() { return taskDefinition; } public final void setTaskDefinition(String taskDefinition) { this.taskDefinition = taskDefinition; } @Override public final Builder taskDefinition(String taskDefinition) { this.taskDefinition = taskDefinition; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public RunTaskRequest build() { return new RunTaskRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy