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

software.amazon.awssdk.services.eventbridge.model.EcsParameters Maven / Gradle / Ivy

Go to download

The AWS Java SDK for EventBridge module holds the client classes that are used for communicating with EventBridge.

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

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The custom parameters to be used when the target is an Amazon ECS task. *

*/ @Generated("software.amazon.awssdk:codegen") public final class EcsParameters implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TASK_DEFINITION_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TaskDefinitionArn").getter(getter(EcsParameters::taskDefinitionArn)) .setter(setter(Builder::taskDefinitionArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TaskDefinitionArn").build()).build(); private static final SdkField TASK_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("TaskCount").getter(getter(EcsParameters::taskCount)).setter(setter(Builder::taskCount)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TaskCount").build()).build(); private static final SdkField LAUNCH_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LaunchType").getter(getter(EcsParameters::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(EcsParameters::networkConfiguration)).setter(setter(Builder::networkConfiguration)) .constructor(NetworkConfiguration::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkConfiguration").build()) .build(); private static final SdkField PLATFORM_VERSION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("PlatformVersion").getter(getter(EcsParameters::platformVersion)) .setter(setter(Builder::platformVersion)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PlatformVersion").build()).build(); private static final SdkField GROUP_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Group") .getter(getter(EcsParameters::group)).setter(setter(Builder::group)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Group").build()).build(); private static final SdkField> CAPACITY_PROVIDER_STRATEGY_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("CapacityProviderStrategy") .getter(getter(EcsParameters::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 ENABLE_ECS_MANAGED_TAGS_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("EnableECSManagedTags").getter(getter(EcsParameters::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(EcsParameters::enableExecuteCommand)) .setter(setter(Builder::enableExecuteCommand)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnableExecuteCommand").build()) .build(); private static final SdkField> PLACEMENT_CONSTRAINTS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("PlacementConstraints") .getter(getter(EcsParameters::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(EcsParameters::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 PROPAGATE_TAGS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("PropagateTags").getter(getter(EcsParameters::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(EcsParameters::referenceId)).setter(setter(Builder::referenceId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReferenceId").build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Tags") .getter(getter(EcsParameters::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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TASK_DEFINITION_ARN_FIELD, TASK_COUNT_FIELD, LAUNCH_TYPE_FIELD, NETWORK_CONFIGURATION_FIELD, PLATFORM_VERSION_FIELD, GROUP_FIELD, CAPACITY_PROVIDER_STRATEGY_FIELD, ENABLE_ECS_MANAGED_TAGS_FIELD, ENABLE_EXECUTE_COMMAND_FIELD, PLACEMENT_CONSTRAINTS_FIELD, PLACEMENT_STRATEGY_FIELD, PROPAGATE_TAGS_FIELD, REFERENCE_ID_FIELD, TAGS_FIELD)); private static final long serialVersionUID = 1L; private final String taskDefinitionArn; private final Integer taskCount; private final String launchType; private final NetworkConfiguration networkConfiguration; private final String platformVersion; private final String group; private final List capacityProviderStrategy; private final Boolean enableECSManagedTags; private final Boolean enableExecuteCommand; private final List placementConstraints; private final List placementStrategy; private final String propagateTags; private final String referenceId; private final List tags; private EcsParameters(BuilderImpl builder) { this.taskDefinitionArn = builder.taskDefinitionArn; this.taskCount = builder.taskCount; this.launchType = builder.launchType; this.networkConfiguration = builder.networkConfiguration; this.platformVersion = builder.platformVersion; this.group = builder.group; this.capacityProviderStrategy = builder.capacityProviderStrategy; this.enableECSManagedTags = builder.enableECSManagedTags; this.enableExecuteCommand = builder.enableExecuteCommand; this.placementConstraints = builder.placementConstraints; this.placementStrategy = builder.placementStrategy; this.propagateTags = builder.propagateTags; this.referenceId = builder.referenceId; this.tags = builder.tags; } /** *

* The ARN of the task definition to use if the event target is an Amazon ECS task. *

* * @return The ARN of the task definition to use if the event target is an Amazon ECS task. */ public final String taskDefinitionArn() { return taskDefinitionArn; } /** *

* The number of tasks to create based on TaskDefinition. The default is 1. *

* * @return The number of tasks to create based on TaskDefinition. The default is 1. */ public final Integer taskCount() { return taskCount; } /** *

* Specifies the launch type on which your task is running. The launch type that you specify here must match one of * the launch type (compatibilities) of the target task. The FARGATE value is supported only in the * Regions where Fargate with Amazon ECS is supported. For more information, see Fargate on Amazon ECS in * the Amazon Elastic Container Service Developer Guide. *

*

* 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 Specifies the launch type on which your task is running. The launch type that you specify here must match * one of the launch type (compatibilities) of the target task. The FARGATE value is supported * only in the Regions where Fargate with Amazon ECS is supported. For more information, see Fargate on Amazon * ECS in the Amazon Elastic Container Service Developer Guide. * @see LaunchType */ public final LaunchType launchType() { return LaunchType.fromValue(launchType); } /** *

* Specifies the launch type on which your task is running. The launch type that you specify here must match one of * the launch type (compatibilities) of the target task. The FARGATE value is supported only in the * Regions where Fargate with Amazon ECS is supported. For more information, see Fargate on Amazon ECS in * the Amazon Elastic Container Service Developer Guide. *

*

* 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 Specifies the launch type on which your task is running. The launch type that you specify here must match * one of the launch type (compatibilities) of the target task. The FARGATE value is supported * only in the Regions where Fargate with Amazon ECS is supported. For more information, see Fargate on Amazon * ECS in the Amazon Elastic Container Service Developer Guide. * @see LaunchType */ public final String launchTypeAsString() { return launchType; } /** *

* Use this structure if the Amazon ECS task uses the awsvpc network mode. This structure specifies the * VPC subnets and security groups associated with the task, and whether a public IP address is to be used. This * structure is required if LaunchType is FARGATE because the awsvpc mode is * required for Fargate tasks. *

*

* If you specify NetworkConfiguration when the target ECS task does not use the awsvpc * network mode, the task fails. *

* * @return Use this structure if the Amazon ECS task uses the awsvpc network mode. This structure * specifies the VPC subnets and security groups associated with the task, and whether a public IP address * is to be used. This structure is required if LaunchType is FARGATE because the * awsvpc mode is required for Fargate tasks.

*

* If you specify NetworkConfiguration when the target ECS task does not use the * awsvpc network mode, the task fails. */ public final NetworkConfiguration networkConfiguration() { return networkConfiguration; } /** *

* Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as * 1.1.0. *

*

* This structure is used only if LaunchType is FARGATE. For more information about valid * platform versions, see Fargate Platform * Versions in the Amazon Elastic Container Service Developer Guide. *

* * @return Specifies the platform version for the task. Specify only the numeric portion of the platform version, * such as 1.1.0.

*

* This structure is used only if LaunchType is FARGATE. For more information * about valid platform versions, see Fargate * Platform Versions in the Amazon Elastic Container Service Developer Guide. */ public final String platformVersion() { return platformVersion; } /** *

* Specifies an ECS task group for the task. The maximum length is 255 characters. *

* * @return Specifies an ECS task group for the task. The maximum length is 255 characters. */ public final String group() { return group; } /** * 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. *

*

* 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. */ public final List capacityProviderStrategy() { return capacityProviderStrategy; } /** *

* Specifies whether to enable 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 enable 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; } /** *

* Whether or not to enable the execute command functionality for the containers in this task. If true, this enables * execute command functionality on all containers in the task. *

* * @return Whether or not to enable the execute command functionality for the containers in this task. If true, this * enables execute command functionality on all containers in the task. */ public final Boolean enableExecuteCommand() { return enableExecuteCommand; } /** * 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 per 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 per * 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 five strategy rules per 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 five strategy rules per * task. */ public final List placementStrategy() { return placementStrategy; } /** *

* Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags * are not 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. *

*

* 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 are not 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. * @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 * are not 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. *

*

* 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 are not 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. * @see PropagateTags */ public final String propagateTagsAsString() { return propagateTags; } /** *

* The reference ID to use for the task. *

* * @return The reference ID to use for the task. */ public final String referenceId() { return referenceId; } /** * 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. To learn more, see RunTask in the Amazon ECS API Reference. *

*

* 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. To learn more, see RunTask in the Amazon ECS API Reference. */ public final List tags() { return tags; } @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(taskDefinitionArn()); hashCode = 31 * hashCode + Objects.hashCode(taskCount()); hashCode = 31 * hashCode + Objects.hashCode(launchTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(networkConfiguration()); hashCode = 31 * hashCode + Objects.hashCode(platformVersion()); hashCode = 31 * hashCode + Objects.hashCode(group()); hashCode = 31 * hashCode + Objects.hashCode(hasCapacityProviderStrategy() ? capacityProviderStrategy() : null); hashCode = 31 * hashCode + Objects.hashCode(enableECSManagedTags()); hashCode = 31 * hashCode + Objects.hashCode(enableExecuteCommand()); hashCode = 31 * hashCode + Objects.hashCode(hasPlacementConstraints() ? placementConstraints() : null); hashCode = 31 * hashCode + Objects.hashCode(hasPlacementStrategy() ? placementStrategy() : null); hashCode = 31 * hashCode + Objects.hashCode(propagateTagsAsString()); hashCode = 31 * hashCode + Objects.hashCode(referenceId()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : 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 EcsParameters)) { return false; } EcsParameters other = (EcsParameters) obj; return Objects.equals(taskDefinitionArn(), other.taskDefinitionArn()) && Objects.equals(taskCount(), other.taskCount()) && Objects.equals(launchTypeAsString(), other.launchTypeAsString()) && Objects.equals(networkConfiguration(), other.networkConfiguration()) && Objects.equals(platformVersion(), other.platformVersion()) && Objects.equals(group(), other.group()) && hasCapacityProviderStrategy() == other.hasCapacityProviderStrategy() && Objects.equals(capacityProviderStrategy(), other.capacityProviderStrategy()) && Objects.equals(enableECSManagedTags(), other.enableECSManagedTags()) && Objects.equals(enableExecuteCommand(), other.enableExecuteCommand()) && hasPlacementConstraints() == other.hasPlacementConstraints() && Objects.equals(placementConstraints(), other.placementConstraints()) && hasPlacementStrategy() == other.hasPlacementStrategy() && Objects.equals(placementStrategy(), other.placementStrategy()) && Objects.equals(propagateTagsAsString(), other.propagateTagsAsString()) && Objects.equals(referenceId(), other.referenceId()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()); } /** * 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("EcsParameters").add("TaskDefinitionArn", taskDefinitionArn()).add("TaskCount", taskCount()) .add("LaunchType", launchTypeAsString()).add("NetworkConfiguration", networkConfiguration()) .add("PlatformVersion", platformVersion()).add("Group", group()) .add("CapacityProviderStrategy", hasCapacityProviderStrategy() ? capacityProviderStrategy() : null) .add("EnableECSManagedTags", enableECSManagedTags()).add("EnableExecuteCommand", enableExecuteCommand()) .add("PlacementConstraints", hasPlacementConstraints() ? placementConstraints() : null) .add("PlacementStrategy", hasPlacementStrategy() ? placementStrategy() : null) .add("PropagateTags", propagateTagsAsString()).add("ReferenceId", referenceId()) .add("Tags", hasTags() ? tags() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "TaskDefinitionArn": return Optional.ofNullable(clazz.cast(taskDefinitionArn())); case "TaskCount": return Optional.ofNullable(clazz.cast(taskCount())); case "LaunchType": return Optional.ofNullable(clazz.cast(launchTypeAsString())); case "NetworkConfiguration": return Optional.ofNullable(clazz.cast(networkConfiguration())); case "PlatformVersion": return Optional.ofNullable(clazz.cast(platformVersion())); case "Group": return Optional.ofNullable(clazz.cast(group())); case "CapacityProviderStrategy": return Optional.ofNullable(clazz.cast(capacityProviderStrategy())); case "EnableECSManagedTags": return Optional.ofNullable(clazz.cast(enableECSManagedTags())); case "EnableExecuteCommand": return Optional.ofNullable(clazz.cast(enableExecuteCommand())); case "PlacementConstraints": return Optional.ofNullable(clazz.cast(placementConstraints())); case "PlacementStrategy": return Optional.ofNullable(clazz.cast(placementStrategy())); case "PropagateTags": return Optional.ofNullable(clazz.cast(propagateTagsAsString())); case "ReferenceId": return Optional.ofNullable(clazz.cast(referenceId())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((EcsParameters) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ARN of the task definition to use if the event target is an Amazon ECS task. *

* * @param taskDefinitionArn * The ARN of the task definition to use if the event target is an Amazon ECS task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskDefinitionArn(String taskDefinitionArn); /** *

* The number of tasks to create based on TaskDefinition. The default is 1. *

* * @param taskCount * The number of tasks to create based on TaskDefinition. The default is 1. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskCount(Integer taskCount); /** *

* Specifies the launch type on which your task is running. The launch type that you specify here must match one * of the launch type (compatibilities) of the target task. The FARGATE value is supported only in * the Regions where Fargate with Amazon ECS is supported. For more information, see Fargate on Amazon ECS * in the Amazon Elastic Container Service Developer Guide. *

* * @param launchType * Specifies the launch type on which your task is running. The launch type that you specify here must * match one of the launch type (compatibilities) of the target task. The FARGATE value is * supported only in the Regions where Fargate with Amazon ECS is supported. For more information, see Fargate on Amazon * ECS in the Amazon Elastic Container Service Developer Guide. * @see LaunchType * @return Returns a reference to this object so that method calls can be chained together. * @see LaunchType */ Builder launchType(String launchType); /** *

* Specifies the launch type on which your task is running. The launch type that you specify here must match one * of the launch type (compatibilities) of the target task. The FARGATE value is supported only in * the Regions where Fargate with Amazon ECS is supported. For more information, see Fargate on Amazon ECS * in the Amazon Elastic Container Service Developer Guide. *

* * @param launchType * Specifies the launch type on which your task is running. The launch type that you specify here must * match one of the launch type (compatibilities) of the target task. The FARGATE value is * supported only in the Regions where Fargate with Amazon ECS is supported. For more information, see Fargate on Amazon * ECS in the Amazon Elastic Container Service Developer Guide. * @see LaunchType * @return Returns a reference to this object so that method calls can be chained together. * @see LaunchType */ Builder launchType(LaunchType launchType); /** *

* Use this structure if the Amazon ECS task uses the awsvpc network mode. This structure specifies * the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. * This structure is required if LaunchType is FARGATE because the awsvpc * mode is required for Fargate tasks. *

*

* If you specify NetworkConfiguration when the target ECS task does not use the * awsvpc network mode, the task fails. *

* * @param networkConfiguration * Use this structure if the Amazon ECS task uses the awsvpc network mode. This structure * specifies the VPC subnets and security groups associated with the task, and whether a public IP * address is to be used. This structure is required if LaunchType is FARGATE * because the awsvpc mode is required for Fargate tasks.

*

* If you specify NetworkConfiguration when the target ECS task does not use the * awsvpc network mode, the task fails. * @return Returns a reference to this object so that method calls can be chained together. */ Builder networkConfiguration(NetworkConfiguration networkConfiguration); /** *

* Use this structure if the Amazon ECS task uses the awsvpc network mode. This structure specifies * the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. * This structure is required if LaunchType is FARGATE because the awsvpc * mode is required for Fargate tasks. *

*

* If you specify NetworkConfiguration when the target ECS task does not use the * awsvpc network mode, the task fails. *

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

* Specifies the platform version for the task. Specify only the numeric portion of the platform version, such * as 1.1.0. *

*

* This structure is used only if LaunchType is FARGATE. For more information about * valid platform versions, see Fargate Platform * Versions in the Amazon Elastic Container Service Developer Guide. *

* * @param platformVersion * Specifies the platform version for the task. Specify only the numeric portion of the platform version, * such as 1.1.0.

*

* This structure is used only if LaunchType is FARGATE. For more information * about valid platform versions, 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 an ECS task group for the task. The maximum length is 255 characters. *

* * @param group * Specifies an ECS task group for the task. The maximum length is 255 characters. * @return Returns a reference to this object so that method calls can be chained together. */ Builder group(String group); /** *

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

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

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

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

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

* Specifies whether to enable 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 enable 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); /** *

* Whether or not to enable the execute command functionality for the containers in this task. If true, this * enables execute command functionality on all containers in the task. *

* * @param enableExecuteCommand * Whether or not to enable the execute command functionality for the containers in this task. If true, * this enables execute command functionality on all containers in the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder enableExecuteCommand(Boolean enableExecuteCommand); /** *

* An array of placement constraint objects to use for the task. You can specify up to 10 constraints per 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 per * 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 per 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 per * 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 per task * (including constraints in the task definition and those specified at runtime). *

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

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

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

* * @param placementStrategy * The placement strategy objects to use for the task. You can specify a maximum of five strategy rules * per 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 five strategy rules per * task. *

* * @param placementStrategy * The placement strategy objects to use for the task. You can specify a maximum of five strategy rules * per 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 five strategy rules per * task. *

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

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

* Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the * tags are not 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. *

* * @param propagateTags * Specifies whether to propagate the tags from the task definition to the task. If no value is * specified, the tags are not 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. * @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 are not 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. *

* * @param propagateTags * Specifies whether to propagate the tags from the task definition to the task. If no value is * specified, the tags are not 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. * @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. *

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

* 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. To learn more, see RunTask in the Amazon ECS API Reference. *

* * @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. To learn more, see RunTask in the Amazon ECS API Reference. * @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. To learn more, see RunTask in the Amazon ECS API Reference. *

* * @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. To learn more, see RunTask in the Amazon ECS API Reference. * @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. To learn more, see RunTask in the Amazon ECS API Reference. *

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

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.eventbridge.model.Tag.Builder#build()} is called immediately and its * result is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on * {@link software.amazon.awssdk.services.eventbridge.model.Tag.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(java.util.Collection) */ Builder tags(Consumer... tags); } static final class BuilderImpl implements Builder { private String taskDefinitionArn; private Integer taskCount; private String launchType; private NetworkConfiguration networkConfiguration; private String platformVersion; private String group; private List capacityProviderStrategy = DefaultSdkAutoConstructList.getInstance(); private Boolean enableECSManagedTags; private Boolean enableExecuteCommand; private List placementConstraints = DefaultSdkAutoConstructList.getInstance(); private List placementStrategy = DefaultSdkAutoConstructList.getInstance(); private String propagateTags; private String referenceId; private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(EcsParameters model) { taskDefinitionArn(model.taskDefinitionArn); taskCount(model.taskCount); launchType(model.launchType); networkConfiguration(model.networkConfiguration); platformVersion(model.platformVersion); group(model.group); capacityProviderStrategy(model.capacityProviderStrategy); enableECSManagedTags(model.enableECSManagedTags); enableExecuteCommand(model.enableExecuteCommand); placementConstraints(model.placementConstraints); placementStrategy(model.placementStrategy); propagateTags(model.propagateTags); referenceId(model.referenceId); tags(model.tags); } public final String getTaskDefinitionArn() { return taskDefinitionArn; } public final void setTaskDefinitionArn(String taskDefinitionArn) { this.taskDefinitionArn = taskDefinitionArn; } @Override public final Builder taskDefinitionArn(String taskDefinitionArn) { this.taskDefinitionArn = taskDefinitionArn; return this; } public final Integer getTaskCount() { return taskCount; } public final void setTaskCount(Integer taskCount) { this.taskCount = taskCount; } @Override public final Builder taskCount(Integer taskCount) { this.taskCount = taskCount; 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 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 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 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 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 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 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 List getTags() { List result = TagListCopier.copyToBuilder(this.tags); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } @Override public final Builder tags(Collection tags) { this.tags = TagListCopier.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; } @Override public EcsParameters build() { return new EcsParameters(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy