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

software.amazon.awssdk.services.codedeploy.model.ECSTarget Maven / Gradle / Ivy

/*
 * 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.codedeploy.model;

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

/**
 * 

* Information about the target of an Amazon ECS deployment. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ECSTarget implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DEPLOYMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("deploymentId").getter(getter(ECSTarget::deploymentId)).setter(setter(Builder::deploymentId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentId").build()).build(); private static final SdkField TARGET_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("targetId").getter(getter(ECSTarget::targetId)).setter(setter(Builder::targetId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetId").build()).build(); private static final SdkField TARGET_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("targetArn").getter(getter(ECSTarget::targetArn)).setter(setter(Builder::targetArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetArn").build()).build(); private static final SdkField LAST_UPDATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("lastUpdatedAt").getter(getter(ECSTarget::lastUpdatedAt)).setter(setter(Builder::lastUpdatedAt)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdatedAt").build()).build(); private static final SdkField> LIFECYCLE_EVENTS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("lifecycleEvents") .getter(getter(ECSTarget::lifecycleEvents)) .setter(setter(Builder::lifecycleEvents)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lifecycleEvents").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(LifecycleEvent::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status") .getter(getter(ECSTarget::statusAsString)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build(); private static final SdkField> TASK_SETS_INFO_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("taskSetsInfo") .getter(getter(ECSTarget::taskSetsInfo)) .setter(setter(Builder::taskSetsInfo)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskSetsInfo").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ECSTaskSet::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections .unmodifiableList(Arrays.asList(DEPLOYMENT_ID_FIELD, TARGET_ID_FIELD, TARGET_ARN_FIELD, LAST_UPDATED_AT_FIELD, LIFECYCLE_EVENTS_FIELD, STATUS_FIELD, TASK_SETS_INFO_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("deploymentId", DEPLOYMENT_ID_FIELD); put("targetId", TARGET_ID_FIELD); put("targetArn", TARGET_ARN_FIELD); put("lastUpdatedAt", LAST_UPDATED_AT_FIELD); put("lifecycleEvents", LIFECYCLE_EVENTS_FIELD); put("status", STATUS_FIELD); put("taskSetsInfo", TASK_SETS_INFO_FIELD); } }); private static final long serialVersionUID = 1L; private final String deploymentId; private final String targetId; private final String targetArn; private final Instant lastUpdatedAt; private final List lifecycleEvents; private final String status; private final List taskSetsInfo; private ECSTarget(BuilderImpl builder) { this.deploymentId = builder.deploymentId; this.targetId = builder.targetId; this.targetArn = builder.targetArn; this.lastUpdatedAt = builder.lastUpdatedAt; this.lifecycleEvents = builder.lifecycleEvents; this.status = builder.status; this.taskSetsInfo = builder.taskSetsInfo; } /** *

* The unique ID of a deployment. *

* * @return The unique ID of a deployment. */ public final String deploymentId() { return deploymentId; } /** *

* The unique ID of a deployment target that has a type of ecsTarget. *

* * @return The unique ID of a deployment target that has a type of ecsTarget. */ public final String targetId() { return targetId; } /** *

* The Amazon Resource Name (ARN) of the target. *

* * @return The Amazon Resource Name (ARN) of the target. */ public final String targetArn() { return targetArn; } /** *

* The date and time when the target Amazon ECS application was updated by a deployment. *

* * @return The date and time when the target Amazon ECS application was updated by a deployment. */ public final Instant lastUpdatedAt() { return lastUpdatedAt; } /** * For responses, this returns true if the service returned a value for the LifecycleEvents 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 hasLifecycleEvents() { return lifecycleEvents != null && !(lifecycleEvents instanceof SdkAutoConstructList); } /** *

* The lifecycle events of the deployment to this target Amazon ECS application. *

*

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

* * @return The lifecycle events of the deployment to this target Amazon ECS application. */ public final List lifecycleEvents() { return lifecycleEvents; } /** *

* The status an Amazon ECS deployment's target ECS application. *

*

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

* * @return The status an Amazon ECS deployment's target ECS application. * @see TargetStatus */ public final TargetStatus status() { return TargetStatus.fromValue(status); } /** *

* The status an Amazon ECS deployment's target ECS application. *

*

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

* * @return The status an Amazon ECS deployment's target ECS application. * @see TargetStatus */ public final String statusAsString() { return status; } /** * For responses, this returns true if the service returned a value for the TaskSetsInfo 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 hasTaskSetsInfo() { return taskSetsInfo != null && !(taskSetsInfo instanceof SdkAutoConstructList); } /** *

* The ECSTaskSet objects associated with the ECS target. *

*

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

* * @return The ECSTaskSet objects associated with the ECS target. */ public final List taskSetsInfo() { return taskSetsInfo; } @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(deploymentId()); hashCode = 31 * hashCode + Objects.hashCode(targetId()); hashCode = 31 * hashCode + Objects.hashCode(targetArn()); hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedAt()); hashCode = 31 * hashCode + Objects.hashCode(hasLifecycleEvents() ? lifecycleEvents() : null); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasTaskSetsInfo() ? taskSetsInfo() : 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 ECSTarget)) { return false; } ECSTarget other = (ECSTarget) obj; return Objects.equals(deploymentId(), other.deploymentId()) && Objects.equals(targetId(), other.targetId()) && Objects.equals(targetArn(), other.targetArn()) && Objects.equals(lastUpdatedAt(), other.lastUpdatedAt()) && hasLifecycleEvents() == other.hasLifecycleEvents() && Objects.equals(lifecycleEvents(), other.lifecycleEvents()) && Objects.equals(statusAsString(), other.statusAsString()) && hasTaskSetsInfo() == other.hasTaskSetsInfo() && Objects.equals(taskSetsInfo(), other.taskSetsInfo()); } /** * 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("ECSTarget").add("DeploymentId", deploymentId()).add("TargetId", targetId()) .add("TargetArn", targetArn()).add("LastUpdatedAt", lastUpdatedAt()) .add("LifecycleEvents", hasLifecycleEvents() ? lifecycleEvents() : null).add("Status", statusAsString()) .add("TaskSetsInfo", hasTaskSetsInfo() ? taskSetsInfo() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "deploymentId": return Optional.ofNullable(clazz.cast(deploymentId())); case "targetId": return Optional.ofNullable(clazz.cast(targetId())); case "targetArn": return Optional.ofNullable(clazz.cast(targetArn())); case "lastUpdatedAt": return Optional.ofNullable(clazz.cast(lastUpdatedAt())); case "lifecycleEvents": return Optional.ofNullable(clazz.cast(lifecycleEvents())); case "status": return Optional.ofNullable(clazz.cast(statusAsString())); case "taskSetsInfo": return Optional.ofNullable(clazz.cast(taskSetsInfo())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((ECSTarget) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The unique ID of a deployment. *

* * @param deploymentId * The unique ID of a deployment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deploymentId(String deploymentId); /** *

* The unique ID of a deployment target that has a type of ecsTarget. *

* * @param targetId * The unique ID of a deployment target that has a type of ecsTarget. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetId(String targetId); /** *

* The Amazon Resource Name (ARN) of the target. *

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

* The date and time when the target Amazon ECS application was updated by a deployment. *

* * @param lastUpdatedAt * The date and time when the target Amazon ECS application was updated by a deployment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdatedAt(Instant lastUpdatedAt); /** *

* The lifecycle events of the deployment to this target Amazon ECS application. *

* * @param lifecycleEvents * The lifecycle events of the deployment to this target Amazon ECS application. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lifecycleEvents(Collection lifecycleEvents); /** *

* The lifecycle events of the deployment to this target Amazon ECS application. *

* * @param lifecycleEvents * The lifecycle events of the deployment to this target Amazon ECS application. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lifecycleEvents(LifecycleEvent... lifecycleEvents); /** *

* The lifecycle events of the deployment to this target Amazon ECS application. *

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

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

* The status an Amazon ECS deployment's target ECS application. *

* * @param status * The status an Amazon ECS deployment's target ECS application. * @see TargetStatus * @return Returns a reference to this object so that method calls can be chained together. * @see TargetStatus */ Builder status(String status); /** *

* The status an Amazon ECS deployment's target ECS application. *

* * @param status * The status an Amazon ECS deployment's target ECS application. * @see TargetStatus * @return Returns a reference to this object so that method calls can be chained together. * @see TargetStatus */ Builder status(TargetStatus status); /** *

* The ECSTaskSet objects associated with the ECS target. *

* * @param taskSetsInfo * The ECSTaskSet objects associated with the ECS target. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskSetsInfo(Collection taskSetsInfo); /** *

* The ECSTaskSet objects associated with the ECS target. *

* * @param taskSetsInfo * The ECSTaskSet objects associated with the ECS target. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskSetsInfo(ECSTaskSet... taskSetsInfo); /** *

* The ECSTaskSet objects associated with the ECS target. *

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

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.codedeploy.model.ECSTaskSet.Builder#build()} is called immediately and * its result is passed to {@link #taskSetsInfo(List)}. * * @param taskSetsInfo * a consumer that will call methods on * {@link software.amazon.awssdk.services.codedeploy.model.ECSTaskSet.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #taskSetsInfo(java.util.Collection) */ Builder taskSetsInfo(Consumer... taskSetsInfo); } static final class BuilderImpl implements Builder { private String deploymentId; private String targetId; private String targetArn; private Instant lastUpdatedAt; private List lifecycleEvents = DefaultSdkAutoConstructList.getInstance(); private String status; private List taskSetsInfo = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ECSTarget model) { deploymentId(model.deploymentId); targetId(model.targetId); targetArn(model.targetArn); lastUpdatedAt(model.lastUpdatedAt); lifecycleEvents(model.lifecycleEvents); status(model.status); taskSetsInfo(model.taskSetsInfo); } public final String getDeploymentId() { return deploymentId; } public final void setDeploymentId(String deploymentId) { this.deploymentId = deploymentId; } @Override public final Builder deploymentId(String deploymentId) { this.deploymentId = deploymentId; return this; } public final String getTargetId() { return targetId; } public final void setTargetId(String targetId) { this.targetId = targetId; } @Override public final Builder targetId(String targetId) { this.targetId = targetId; return this; } public final String getTargetArn() { return targetArn; } public final void setTargetArn(String targetArn) { this.targetArn = targetArn; } @Override public final Builder targetArn(String targetArn) { this.targetArn = targetArn; return this; } public final Instant getLastUpdatedAt() { return lastUpdatedAt; } public final void setLastUpdatedAt(Instant lastUpdatedAt) { this.lastUpdatedAt = lastUpdatedAt; } @Override public final Builder lastUpdatedAt(Instant lastUpdatedAt) { this.lastUpdatedAt = lastUpdatedAt; return this; } public final List getLifecycleEvents() { List result = LifecycleEventListCopier.copyToBuilder(this.lifecycleEvents); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setLifecycleEvents(Collection lifecycleEvents) { this.lifecycleEvents = LifecycleEventListCopier.copyFromBuilder(lifecycleEvents); } @Override public final Builder lifecycleEvents(Collection lifecycleEvents) { this.lifecycleEvents = LifecycleEventListCopier.copy(lifecycleEvents); return this; } @Override @SafeVarargs public final Builder lifecycleEvents(LifecycleEvent... lifecycleEvents) { lifecycleEvents(Arrays.asList(lifecycleEvents)); return this; } @Override @SafeVarargs public final Builder lifecycleEvents(Consumer... lifecycleEvents) { lifecycleEvents(Stream.of(lifecycleEvents).map(c -> LifecycleEvent.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(TargetStatus status) { this.status(status == null ? null : status.toString()); return this; } public final List getTaskSetsInfo() { List result = ECSTaskSetListCopier.copyToBuilder(this.taskSetsInfo); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTaskSetsInfo(Collection taskSetsInfo) { this.taskSetsInfo = ECSTaskSetListCopier.copyFromBuilder(taskSetsInfo); } @Override public final Builder taskSetsInfo(Collection taskSetsInfo) { this.taskSetsInfo = ECSTaskSetListCopier.copy(taskSetsInfo); return this; } @Override @SafeVarargs public final Builder taskSetsInfo(ECSTaskSet... taskSetsInfo) { taskSetsInfo(Arrays.asList(taskSetsInfo)); return this; } @Override @SafeVarargs public final Builder taskSetsInfo(Consumer... taskSetsInfo) { taskSetsInfo(Stream.of(taskSetsInfo).map(c -> ECSTaskSet.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public ECSTarget build() { return new ECSTarget(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy