software.amazon.awssdk.services.cloudformation.model.TemplateSummary Maven / Gradle / Ivy
Show all versions of cloudformation 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.cloudformation.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;
/**
*
* The summary of a generated template.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TemplateSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField GENERATED_TEMPLATE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GeneratedTemplateId").getter(getter(TemplateSummary::generatedTemplateId))
.setter(setter(Builder::generatedTemplateId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GeneratedTemplateId").build())
.build();
private static final SdkField GENERATED_TEMPLATE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GeneratedTemplateName").getter(getter(TemplateSummary::generatedTemplateName))
.setter(setter(Builder::generatedTemplateName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GeneratedTemplateName").build())
.build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(TemplateSummary::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField STATUS_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StatusReason").getter(getter(TemplateSummary::statusReason)).setter(setter(Builder::statusReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusReason").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(TemplateSummary::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedTime").getter(getter(TemplateSummary::lastUpdatedTime))
.setter(setter(Builder::lastUpdatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTime").build()).build();
private static final SdkField NUMBER_OF_RESOURCES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("NumberOfResources").getter(getter(TemplateSummary::numberOfResources))
.setter(setter(Builder::numberOfResources))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NumberOfResources").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(GENERATED_TEMPLATE_ID_FIELD,
GENERATED_TEMPLATE_NAME_FIELD, STATUS_FIELD, STATUS_REASON_FIELD, CREATION_TIME_FIELD, LAST_UPDATED_TIME_FIELD,
NUMBER_OF_RESOURCES_FIELD));
private static final long serialVersionUID = 1L;
private final String generatedTemplateId;
private final String generatedTemplateName;
private final String status;
private final String statusReason;
private final Instant creationTime;
private final Instant lastUpdatedTime;
private final Integer numberOfResources;
private TemplateSummary(BuilderImpl builder) {
this.generatedTemplateId = builder.generatedTemplateId;
this.generatedTemplateName = builder.generatedTemplateName;
this.status = builder.status;
this.statusReason = builder.statusReason;
this.creationTime = builder.creationTime;
this.lastUpdatedTime = builder.lastUpdatedTime;
this.numberOfResources = builder.numberOfResources;
}
/**
*
* The Amazon Resource Name (ARN) of the generated template. The format is
* arn:${Partition}:cloudformation:${Region}:${Account}:generatedtemplate/${Id}
. For example,
* arn:aws:cloudformation:us-east-1:123456789012:generatedtemplate/2e8465c1-9a80-43ea-a3a3-4f2d692fe6dc
* .
*
*
* @return The Amazon Resource Name (ARN) of the generated template. The format is
* arn:${Partition}:cloudformation:${Region}:${Account}:generatedtemplate/${Id}
. For example,
* arn:aws:cloudformation:us-east-1:123456789012:generatedtemplate/2e8465c1-9a80-43ea-a3a3-4f2d692fe6dc
* .
*/
public final String generatedTemplateId() {
return generatedTemplateId;
}
/**
*
* The name of the generated template.
*
*
* @return The name of the generated template.
*/
public final String generatedTemplateName() {
return generatedTemplateName;
}
/**
*
* The status of the template generation. Supported values are:
*
*
* -
*
* CreatePending
- the creation of the template is pending.
*
*
* -
*
* CreateInProgress
- the creation of the template is in progress.
*
*
* -
*
* DeletePending
- the deletion of the template is pending.
*
*
* -
*
* DeleteInProgress
- the deletion of the template is in progress.
*
*
* -
*
* UpdatePending
- the update of the template is pending.
*
*
* -
*
* UpdateInProgress
- the update of the template is in progress.
*
*
* -
*
* Failed
- the template operation failed.
*
*
* -
*
* Complete
- the template operation is complete.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link GeneratedTemplateStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the template generation. Supported values are:
*
* -
*
* CreatePending
- the creation of the template is pending.
*
*
* -
*
* CreateInProgress
- the creation of the template is in progress.
*
*
* -
*
* DeletePending
- the deletion of the template is pending.
*
*
* -
*
* DeleteInProgress
- the deletion of the template is in progress.
*
*
* -
*
* UpdatePending
- the update of the template is pending.
*
*
* -
*
* UpdateInProgress
- the update of the template is in progress.
*
*
* -
*
* Failed
- the template operation failed.
*
*
* -
*
* Complete
- the template operation is complete.
*
*
* @see GeneratedTemplateStatus
*/
public final GeneratedTemplateStatus status() {
return GeneratedTemplateStatus.fromValue(status);
}
/**
*
* The status of the template generation. Supported values are:
*
*
* -
*
* CreatePending
- the creation of the template is pending.
*
*
* -
*
* CreateInProgress
- the creation of the template is in progress.
*
*
* -
*
* DeletePending
- the deletion of the template is pending.
*
*
* -
*
* DeleteInProgress
- the deletion of the template is in progress.
*
*
* -
*
* UpdatePending
- the update of the template is pending.
*
*
* -
*
* UpdateInProgress
- the update of the template is in progress.
*
*
* -
*
* Failed
- the template operation failed.
*
*
* -
*
* Complete
- the template operation is complete.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link GeneratedTemplateStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the template generation. Supported values are:
*
* -
*
* CreatePending
- the creation of the template is pending.
*
*
* -
*
* CreateInProgress
- the creation of the template is in progress.
*
*
* -
*
* DeletePending
- the deletion of the template is pending.
*
*
* -
*
* DeleteInProgress
- the deletion of the template is in progress.
*
*
* -
*
* UpdatePending
- the update of the template is pending.
*
*
* -
*
* UpdateInProgress
- the update of the template is in progress.
*
*
* -
*
* Failed
- the template operation failed.
*
*
* -
*
* Complete
- the template operation is complete.
*
*
* @see GeneratedTemplateStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The reason for the current template generation status. This will provide more details if a failure happened.
*
*
* @return The reason for the current template generation status. This will provide more details if a failure
* happened.
*/
public final String statusReason() {
return statusReason;
}
/**
*
* The time the generated template was created.
*
*
* @return The time the generated template was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The time the generated template was last updated.
*
*
* @return The time the generated template was last updated.
*/
public final Instant lastUpdatedTime() {
return lastUpdatedTime;
}
/**
*
* The number of resources in the generated template. This is a total of resources in pending, in-progress,
* completed, and failed states.
*
*
* @return The number of resources in the generated template. This is a total of resources in pending, in-progress,
* completed, and failed states.
*/
public final Integer numberOfResources() {
return numberOfResources;
}
@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(generatedTemplateId());
hashCode = 31 * hashCode + Objects.hashCode(generatedTemplateName());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusReason());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime());
hashCode = 31 * hashCode + Objects.hashCode(numberOfResources());
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 TemplateSummary)) {
return false;
}
TemplateSummary other = (TemplateSummary) obj;
return Objects.equals(generatedTemplateId(), other.generatedTemplateId())
&& Objects.equals(generatedTemplateName(), other.generatedTemplateName())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusReason(), other.statusReason()) && Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(lastUpdatedTime(), other.lastUpdatedTime())
&& Objects.equals(numberOfResources(), other.numberOfResources());
}
/**
* 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("TemplateSummary").add("GeneratedTemplateId", generatedTemplateId())
.add("GeneratedTemplateName", generatedTemplateName()).add("Status", statusAsString())
.add("StatusReason", statusReason()).add("CreationTime", creationTime())
.add("LastUpdatedTime", lastUpdatedTime()).add("NumberOfResources", numberOfResources()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "GeneratedTemplateId":
return Optional.ofNullable(clazz.cast(generatedTemplateId()));
case "GeneratedTemplateName":
return Optional.ofNullable(clazz.cast(generatedTemplateName()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "StatusReason":
return Optional.ofNullable(clazz.cast(statusReason()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "LastUpdatedTime":
return Optional.ofNullable(clazz.cast(lastUpdatedTime()));
case "NumberOfResources":
return Optional.ofNullable(clazz.cast(numberOfResources()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function