software.amazon.awssdk.services.datazone.model.Deployment Maven / Gradle / Ivy
Show all versions of datazone Show documentation
/*
* 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.datazone.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 software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The details of the last deployment of the environment.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Deployment implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField DEPLOYMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("deploymentId").getter(getter(Deployment::deploymentId)).setter(setter(Builder::deploymentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentId").build()).build();
private static final SdkField DEPLOYMENT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("deploymentStatus").getter(getter(Deployment::deploymentStatusAsString))
.setter(setter(Builder::deploymentStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentStatus").build()).build();
private static final SdkField DEPLOYMENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("deploymentType").getter(getter(Deployment::deploymentTypeAsString))
.setter(setter(Builder::deploymentType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentType").build()).build();
private static final SdkField FAILURE_REASON_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("failureReason")
.getter(getter(Deployment::failureReason)).setter(setter(Builder::failureReason))
.constructor(EnvironmentError::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("failureReason").build()).build();
private static final SdkField IS_DEPLOYMENT_COMPLETE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("isDeploymentComplete").getter(getter(Deployment::isDeploymentComplete))
.setter(setter(Builder::isDeploymentComplete))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isDeploymentComplete").build())
.build();
private static final SdkField> MESSAGES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("messages")
.getter(getter(Deployment::messages))
.setter(setter(Builder::messages))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("messages").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.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,
DEPLOYMENT_STATUS_FIELD, DEPLOYMENT_TYPE_FIELD, FAILURE_REASON_FIELD, IS_DEPLOYMENT_COMPLETE_FIELD, MESSAGES_FIELD));
private static final long serialVersionUID = 1L;
private final String deploymentId;
private final String deploymentStatus;
private final String deploymentType;
private final EnvironmentError failureReason;
private final Boolean isDeploymentComplete;
private final List messages;
private Deployment(BuilderImpl builder) {
this.deploymentId = builder.deploymentId;
this.deploymentStatus = builder.deploymentStatus;
this.deploymentType = builder.deploymentType;
this.failureReason = builder.failureReason;
this.isDeploymentComplete = builder.isDeploymentComplete;
this.messages = builder.messages;
}
/**
*
* The identifier of the last deployment of the environment.
*
*
* @return The identifier of the last deployment of the environment.
*/
public final String deploymentId() {
return deploymentId;
}
/**
*
* The status of the last deployment of the environment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #deploymentStatus}
* will return {@link DeploymentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #deploymentStatusAsString}.
*
*
* @return The status of the last deployment of the environment.
* @see DeploymentStatus
*/
public final DeploymentStatus deploymentStatus() {
return DeploymentStatus.fromValue(deploymentStatus);
}
/**
*
* The status of the last deployment of the environment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #deploymentStatus}
* will return {@link DeploymentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #deploymentStatusAsString}.
*
*
* @return The status of the last deployment of the environment.
* @see DeploymentStatus
*/
public final String deploymentStatusAsString() {
return deploymentStatus;
}
/**
*
* The type of the last deployment of the environment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #deploymentType}
* will return {@link DeploymentType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #deploymentTypeAsString}.
*
*
* @return The type of the last deployment of the environment.
* @see DeploymentType
*/
public final DeploymentType deploymentType() {
return DeploymentType.fromValue(deploymentType);
}
/**
*
* The type of the last deployment of the environment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #deploymentType}
* will return {@link DeploymentType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #deploymentTypeAsString}.
*
*
* @return The type of the last deployment of the environment.
* @see DeploymentType
*/
public final String deploymentTypeAsString() {
return deploymentType;
}
/**
*
* The failure reason of the last deployment of the environment.
*
*
* @return The failure reason of the last deployment of the environment.
*/
public final EnvironmentError failureReason() {
return failureReason;
}
/**
*
* Specifies whether the last deployment of the environment is complete.
*
*
* @return Specifies whether the last deployment of the environment is complete.
*/
public final Boolean isDeploymentComplete() {
return isDeploymentComplete;
}
/**
* For responses, this returns true if the service returned a value for the Messages 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 hasMessages() {
return messages != null && !(messages instanceof SdkAutoConstructList);
}
/**
*
* The messages of the last deployment of the environment.
*
*
* 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 #hasMessages} method.
*
*
* @return The messages of the last deployment of the environment.
*/
public final List messages() {
return messages;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(deploymentId());
hashCode = 31 * hashCode + Objects.hashCode(deploymentStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(deploymentTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(failureReason());
hashCode = 31 * hashCode + Objects.hashCode(isDeploymentComplete());
hashCode = 31 * hashCode + Objects.hashCode(hasMessages() ? messages() : 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 Deployment)) {
return false;
}
Deployment other = (Deployment) obj;
return Objects.equals(deploymentId(), other.deploymentId())
&& Objects.equals(deploymentStatusAsString(), other.deploymentStatusAsString())
&& Objects.equals(deploymentTypeAsString(), other.deploymentTypeAsString())
&& Objects.equals(failureReason(), other.failureReason())
&& Objects.equals(isDeploymentComplete(), other.isDeploymentComplete()) && hasMessages() == other.hasMessages()
&& Objects.equals(messages(), other.messages());
}
/**
* 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("Deployment").add("DeploymentId", deploymentId())
.add("DeploymentStatus", deploymentStatusAsString()).add("DeploymentType", deploymentTypeAsString())
.add("FailureReason", failureReason()).add("IsDeploymentComplete", isDeploymentComplete())
.add("Messages", hasMessages() ? messages() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "deploymentId":
return Optional.ofNullable(clazz.cast(deploymentId()));
case "deploymentStatus":
return Optional.ofNullable(clazz.cast(deploymentStatusAsString()));
case "deploymentType":
return Optional.ofNullable(clazz.cast(deploymentTypeAsString()));
case "failureReason":
return Optional.ofNullable(clazz.cast(failureReason()));
case "isDeploymentComplete":
return Optional.ofNullable(clazz.cast(isDeploymentComplete()));
case "messages":
return Optional.ofNullable(clazz.cast(messages()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function