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

* 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 AWS Fargate with Amazon ECS is supported. For more information, see AWS 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 AWS Fargate with Amazon ECS is supported. For more information, see AWS 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 AWS Fargate with Amazon ECS is supported. For more information, see AWS 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 AWS Fargate with Amazon ECS is supported. For more information, see AWS 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 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 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 AWS 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 AWS 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; } @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()); 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()); } /** * 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()).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())); 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 AWS Fargate with Amazon ECS is supported. For more information, see AWS 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 AWS Fargate with Amazon ECS is supported. For more information, * see AWS 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 AWS Fargate with Amazon ECS is supported. For more information, see AWS 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 AWS Fargate with Amazon ECS is supported. For more information, * see AWS 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 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 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 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 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 AWS 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 AWS 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); } 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 BuilderImpl() { } private BuilderImpl(EcsParameters model) { taskDefinitionArn(model.taskDefinitionArn); taskCount(model.taskCount); launchType(model.launchType); networkConfiguration(model.networkConfiguration); platformVersion(model.platformVersion); group(model.group); } public final String getTaskDefinitionArn() { return taskDefinitionArn; } @Override public final Builder taskDefinitionArn(String taskDefinitionArn) { this.taskDefinitionArn = taskDefinitionArn; return this; } public final void setTaskDefinitionArn(String taskDefinitionArn) { this.taskDefinitionArn = taskDefinitionArn; } public final Integer getTaskCount() { return taskCount; } @Override public final Builder taskCount(Integer taskCount) { this.taskCount = taskCount; return this; } public final void setTaskCount(Integer taskCount) { this.taskCount = taskCount; } public final String getLaunchType() { return 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 void setLaunchType(String launchType) { this.launchType = launchType; } public final NetworkConfiguration.Builder getNetworkConfiguration() { return networkConfiguration != null ? networkConfiguration.toBuilder() : null; } @Override public final Builder networkConfiguration(NetworkConfiguration networkConfiguration) { this.networkConfiguration = networkConfiguration; return this; } public final void setNetworkConfiguration(NetworkConfiguration.BuilderImpl networkConfiguration) { this.networkConfiguration = networkConfiguration != null ? networkConfiguration.build() : null; } public final String getPlatformVersion() { return platformVersion; } @Override public final Builder platformVersion(String platformVersion) { this.platformVersion = platformVersion; return this; } public final void setPlatformVersion(String platformVersion) { this.platformVersion = platformVersion; } public final String getGroup() { return group; } @Override public final Builder group(String group) { this.group = group; return this; } public final void setGroup(String group) { this.group = group; } @Override public EcsParameters build() { return new EcsParameters(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy