software.amazon.awssdk.services.proton.model.DeploymentSummary Maven / Gradle / Ivy
Show all versions of proton 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.proton.model;
import java.io.Serializable;
import java.time.Instant;
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.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;
/**
*
* Summary data of the deployment.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DeploymentSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(DeploymentSummary::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField COMPLETED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("completedAt").getter(getter(DeploymentSummary::completedAt)).setter(setter(Builder::completedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("completedAt").build()).build();
private static final SdkField COMPONENT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("componentName").getter(getter(DeploymentSummary::componentName)).setter(setter(Builder::componentName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("componentName").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createdAt").getter(getter(DeploymentSummary::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();
private static final SdkField DEPLOYMENT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("deploymentStatus").getter(getter(DeploymentSummary::deploymentStatusAsString))
.setter(setter(Builder::deploymentStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentStatus").build()).build();
private static final SdkField ENVIRONMENT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("environmentName").getter(getter(DeploymentSummary::environmentName))
.setter(setter(Builder::environmentName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("environmentName").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("id")
.getter(getter(DeploymentSummary::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build();
private static final SdkField LAST_ATTEMPTED_DEPLOYMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("lastAttemptedDeploymentId").getter(getter(DeploymentSummary::lastAttemptedDeploymentId))
.setter(setter(Builder::lastAttemptedDeploymentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastAttemptedDeploymentId").build())
.build();
private static final SdkField LAST_MODIFIED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastModifiedAt").getter(getter(DeploymentSummary::lastModifiedAt))
.setter(setter(Builder::lastModifiedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedAt").build()).build();
private static final SdkField LAST_SUCCEEDED_DEPLOYMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("lastSucceededDeploymentId").getter(getter(DeploymentSummary::lastSucceededDeploymentId))
.setter(setter(Builder::lastSucceededDeploymentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastSucceededDeploymentId").build())
.build();
private static final SdkField SERVICE_INSTANCE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceInstanceName").getter(getter(DeploymentSummary::serviceInstanceName))
.setter(setter(Builder::serviceInstanceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceInstanceName").build())
.build();
private static final SdkField SERVICE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceName").getter(getter(DeploymentSummary::serviceName)).setter(setter(Builder::serviceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceName").build()).build();
private static final SdkField TARGET_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("targetArn").getter(getter(DeploymentSummary::targetArn)).setter(setter(Builder::targetArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetArn").build()).build();
private static final SdkField TARGET_RESOURCE_CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("targetResourceCreatedAt").getter(getter(DeploymentSummary::targetResourceCreatedAt))
.setter(setter(Builder::targetResourceCreatedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetResourceCreatedAt").build())
.build();
private static final SdkField TARGET_RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("targetResourceType").getter(getter(DeploymentSummary::targetResourceTypeAsString))
.setter(setter(Builder::targetResourceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetResourceType").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, COMPLETED_AT_FIELD,
COMPONENT_NAME_FIELD, CREATED_AT_FIELD, DEPLOYMENT_STATUS_FIELD, ENVIRONMENT_NAME_FIELD, ID_FIELD,
LAST_ATTEMPTED_DEPLOYMENT_ID_FIELD, LAST_MODIFIED_AT_FIELD, LAST_SUCCEEDED_DEPLOYMENT_ID_FIELD,
SERVICE_INSTANCE_NAME_FIELD, SERVICE_NAME_FIELD, TARGET_ARN_FIELD, TARGET_RESOURCE_CREATED_AT_FIELD,
TARGET_RESOURCE_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final Instant completedAt;
private final String componentName;
private final Instant createdAt;
private final String deploymentStatus;
private final String environmentName;
private final String id;
private final String lastAttemptedDeploymentId;
private final Instant lastModifiedAt;
private final String lastSucceededDeploymentId;
private final String serviceInstanceName;
private final String serviceName;
private final String targetArn;
private final Instant targetResourceCreatedAt;
private final String targetResourceType;
private DeploymentSummary(BuilderImpl builder) {
this.arn = builder.arn;
this.completedAt = builder.completedAt;
this.componentName = builder.componentName;
this.createdAt = builder.createdAt;
this.deploymentStatus = builder.deploymentStatus;
this.environmentName = builder.environmentName;
this.id = builder.id;
this.lastAttemptedDeploymentId = builder.lastAttemptedDeploymentId;
this.lastModifiedAt = builder.lastModifiedAt;
this.lastSucceededDeploymentId = builder.lastSucceededDeploymentId;
this.serviceInstanceName = builder.serviceInstanceName;
this.serviceName = builder.serviceName;
this.targetArn = builder.targetArn;
this.targetResourceCreatedAt = builder.targetResourceCreatedAt;
this.targetResourceType = builder.targetResourceType;
}
/**
*
* The Amazon Resource Name (ARN) of the deployment.
*
*
* @return The Amazon Resource Name (ARN) of the deployment.
*/
public final String arn() {
return arn;
}
/**
*
* The date and time the deployment was completed.
*
*
* @return The date and time the deployment was completed.
*/
public final Instant completedAt() {
return completedAt;
}
/**
*
* The name of the component associated with the deployment.
*
*
* @return The name of the component associated with the deployment.
*/
public final String componentName() {
return componentName;
}
/**
*
* The date and time the deployment was created.
*
*
* @return The date and time the deployment was created.
*/
public final Instant createdAt() {
return createdAt;
}
/**
*
* The current status of the deployment.
*
*
* 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 current status of the deployment.
* @see DeploymentStatus
*/
public final DeploymentStatus deploymentStatus() {
return DeploymentStatus.fromValue(deploymentStatus);
}
/**
*
* The current status of the deployment.
*
*
* 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 current status of the deployment.
* @see DeploymentStatus
*/
public final String deploymentStatusAsString() {
return deploymentStatus;
}
/**
*
* The name of the environment associated with the deployment.
*
*
* @return The name of the environment associated with the deployment.
*/
public final String environmentName() {
return environmentName;
}
/**
*
* The ID of the deployment.
*
*
* @return The ID of the deployment.
*/
public final String id() {
return id;
}
/**
*
* The ID of the last attempted deployment.
*
*
* @return The ID of the last attempted deployment.
*/
public final String lastAttemptedDeploymentId() {
return lastAttemptedDeploymentId;
}
/**
*
* The date and time the deployment was last modified.
*
*
* @return The date and time the deployment was last modified.
*/
public final Instant lastModifiedAt() {
return lastModifiedAt;
}
/**
*
* The ID of the last successful deployment.
*
*
* @return The ID of the last successful deployment.
*/
public final String lastSucceededDeploymentId() {
return lastSucceededDeploymentId;
}
/**
*
* The name of the service instance associated with the deployment.
*
*
* @return The name of the service instance associated with the deployment.
*/
public final String serviceInstanceName() {
return serviceInstanceName;
}
/**
*
* The name of the service associated with the deployment.
*
*
* @return The name of the service associated with the deployment.
*/
public final String serviceName() {
return serviceName;
}
/**
*
* The Amazon Resource Name (ARN) of the target of the deployment.
*
*
* @return The Amazon Resource Name (ARN) of the target of the deployment.
*/
public final String targetArn() {
return targetArn;
}
/**
*
* The date and time the target resource was created.
*
*
* @return The date and time the target resource was created.
*/
public final Instant targetResourceCreatedAt() {
return targetResourceCreatedAt;
}
/**
*
* The resource type of the deployment target. It can be an environment, service, service instance, or component.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #targetResourceType} will return {@link DeploymentTargetResourceType#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #targetResourceTypeAsString}.
*
*
* @return The resource type of the deployment target. It can be an environment, service, service instance, or
* component.
* @see DeploymentTargetResourceType
*/
public final DeploymentTargetResourceType targetResourceType() {
return DeploymentTargetResourceType.fromValue(targetResourceType);
}
/**
*
* The resource type of the deployment target. It can be an environment, service, service instance, or component.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #targetResourceType} will return {@link DeploymentTargetResourceType#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #targetResourceTypeAsString}.
*
*
* @return The resource type of the deployment target. It can be an environment, service, service instance, or
* component.
* @see DeploymentTargetResourceType
*/
public final String targetResourceTypeAsString() {
return targetResourceType;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(completedAt());
hashCode = 31 * hashCode + Objects.hashCode(componentName());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(deploymentStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(environmentName());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(lastAttemptedDeploymentId());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedAt());
hashCode = 31 * hashCode + Objects.hashCode(lastSucceededDeploymentId());
hashCode = 31 * hashCode + Objects.hashCode(serviceInstanceName());
hashCode = 31 * hashCode + Objects.hashCode(serviceName());
hashCode = 31 * hashCode + Objects.hashCode(targetArn());
hashCode = 31 * hashCode + Objects.hashCode(targetResourceCreatedAt());
hashCode = 31 * hashCode + Objects.hashCode(targetResourceTypeAsString());
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 DeploymentSummary)) {
return false;
}
DeploymentSummary other = (DeploymentSummary) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(completedAt(), other.completedAt())
&& Objects.equals(componentName(), other.componentName()) && Objects.equals(createdAt(), other.createdAt())
&& Objects.equals(deploymentStatusAsString(), other.deploymentStatusAsString())
&& Objects.equals(environmentName(), other.environmentName()) && Objects.equals(id(), other.id())
&& Objects.equals(lastAttemptedDeploymentId(), other.lastAttemptedDeploymentId())
&& Objects.equals(lastModifiedAt(), other.lastModifiedAt())
&& Objects.equals(lastSucceededDeploymentId(), other.lastSucceededDeploymentId())
&& Objects.equals(serviceInstanceName(), other.serviceInstanceName())
&& Objects.equals(serviceName(), other.serviceName()) && Objects.equals(targetArn(), other.targetArn())
&& Objects.equals(targetResourceCreatedAt(), other.targetResourceCreatedAt())
&& Objects.equals(targetResourceTypeAsString(), other.targetResourceTypeAsString());
}
/**
* 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("DeploymentSummary").add("Arn", arn()).add("CompletedAt", completedAt())
.add("ComponentName", componentName()).add("CreatedAt", createdAt())
.add("DeploymentStatus", deploymentStatusAsString()).add("EnvironmentName", environmentName()).add("Id", id())
.add("LastAttemptedDeploymentId", lastAttemptedDeploymentId()).add("LastModifiedAt", lastModifiedAt())
.add("LastSucceededDeploymentId", lastSucceededDeploymentId()).add("ServiceInstanceName", serviceInstanceName())
.add("ServiceName", serviceName()).add("TargetArn", targetArn())
.add("TargetResourceCreatedAt", targetResourceCreatedAt())
.add("TargetResourceType", targetResourceTypeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "completedAt":
return Optional.ofNullable(clazz.cast(completedAt()));
case "componentName":
return Optional.ofNullable(clazz.cast(componentName()));
case "createdAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "deploymentStatus":
return Optional.ofNullable(clazz.cast(deploymentStatusAsString()));
case "environmentName":
return Optional.ofNullable(clazz.cast(environmentName()));
case "id":
return Optional.ofNullable(clazz.cast(id()));
case "lastAttemptedDeploymentId":
return Optional.ofNullable(clazz.cast(lastAttemptedDeploymentId()));
case "lastModifiedAt":
return Optional.ofNullable(clazz.cast(lastModifiedAt()));
case "lastSucceededDeploymentId":
return Optional.ofNullable(clazz.cast(lastSucceededDeploymentId()));
case "serviceInstanceName":
return Optional.ofNullable(clazz.cast(serviceInstanceName()));
case "serviceName":
return Optional.ofNullable(clazz.cast(serviceName()));
case "targetArn":
return Optional.ofNullable(clazz.cast(targetArn()));
case "targetResourceCreatedAt":
return Optional.ofNullable(clazz.cast(targetResourceCreatedAt()));
case "targetResourceType":
return Optional.ofNullable(clazz.cast(targetResourceTypeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function