software.amazon.awssdk.services.cloudformation.model.DescribeGeneratedTemplateResponse 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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeGeneratedTemplateResponse extends CloudFormationResponse implements
ToCopyableBuilder {
private static final SdkField GENERATED_TEMPLATE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GeneratedTemplateId").getter(getter(DescribeGeneratedTemplateResponse::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(DescribeGeneratedTemplateResponse::generatedTemplateName))
.setter(setter(Builder::generatedTemplateName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GeneratedTemplateName").build())
.build();
private static final SdkField> RESOURCES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Resources")
.getter(getter(DescribeGeneratedTemplateResponse::resources))
.setter(setter(Builder::resources))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Resources").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ResourceDetail::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(DescribeGeneratedTemplateResponse::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(DescribeGeneratedTemplateResponse::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(DescribeGeneratedTemplateResponse::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(DescribeGeneratedTemplateResponse::lastUpdatedTime))
.setter(setter(Builder::lastUpdatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTime").build()).build();
private static final SdkField PROGRESS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Progress")
.getter(getter(DescribeGeneratedTemplateResponse::progress)).setter(setter(Builder::progress))
.constructor(TemplateProgress::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Progress").build()).build();
private static final SdkField STACK_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StackId").getter(getter(DescribeGeneratedTemplateResponse::stackId)).setter(setter(Builder::stackId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StackId").build()).build();
private static final SdkField TEMPLATE_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("TemplateConfiguration")
.getter(getter(DescribeGeneratedTemplateResponse::templateConfiguration))
.setter(setter(Builder::templateConfiguration)).constructor(TemplateConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TemplateConfiguration").build())
.build();
private static final SdkField TOTAL_WARNINGS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TotalWarnings").getter(getter(DescribeGeneratedTemplateResponse::totalWarnings))
.setter(setter(Builder::totalWarnings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalWarnings").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(GENERATED_TEMPLATE_ID_FIELD,
GENERATED_TEMPLATE_NAME_FIELD, RESOURCES_FIELD, STATUS_FIELD, STATUS_REASON_FIELD, CREATION_TIME_FIELD,
LAST_UPDATED_TIME_FIELD, PROGRESS_FIELD, STACK_ID_FIELD, TEMPLATE_CONFIGURATION_FIELD, TOTAL_WARNINGS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("GeneratedTemplateId", GENERATED_TEMPLATE_ID_FIELD);
put("GeneratedTemplateName", GENERATED_TEMPLATE_NAME_FIELD);
put("Resources", RESOURCES_FIELD);
put("Status", STATUS_FIELD);
put("StatusReason", STATUS_REASON_FIELD);
put("CreationTime", CREATION_TIME_FIELD);
put("LastUpdatedTime", LAST_UPDATED_TIME_FIELD);
put("Progress", PROGRESS_FIELD);
put("StackId", STACK_ID_FIELD);
put("TemplateConfiguration", TEMPLATE_CONFIGURATION_FIELD);
put("TotalWarnings", TOTAL_WARNINGS_FIELD);
}
});
private final String generatedTemplateId;
private final String generatedTemplateName;
private final List resources;
private final String status;
private final String statusReason;
private final Instant creationTime;
private final Instant lastUpdatedTime;
private final TemplateProgress progress;
private final String stackId;
private final TemplateConfiguration templateConfiguration;
private final Integer totalWarnings;
private DescribeGeneratedTemplateResponse(BuilderImpl builder) {
super(builder);
this.generatedTemplateId = builder.generatedTemplateId;
this.generatedTemplateName = builder.generatedTemplateName;
this.resources = builder.resources;
this.status = builder.status;
this.statusReason = builder.statusReason;
this.creationTime = builder.creationTime;
this.lastUpdatedTime = builder.lastUpdatedTime;
this.progress = builder.progress;
this.stackId = builder.stackId;
this.templateConfiguration = builder.templateConfiguration;
this.totalWarnings = builder.totalWarnings;
}
/**
*
* 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;
}
/**
* For responses, this returns true if the service returned a value for the Resources 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 hasResources() {
return resources != null && !(resources instanceof SdkAutoConstructList);
}
/**
*
* A list of objects describing the details of the resources in the template generation.
*
*
* 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 #hasResources} method.
*
*
* @return A list of objects describing the details of the resources in the template generation.
*/
public final List resources() {
return resources;
}
/**
*
* 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;
}
/**
*
* An object describing the progress of the template generation.
*
*
* @return An object describing the progress of the template generation.
*/
public final TemplateProgress progress() {
return progress;
}
/**
*
* The stack ARN of the base stack if a base stack was provided when generating the template.
*
*
* @return The stack ARN of the base stack if a base stack was provided when generating the template.
*/
public final String stackId() {
return stackId;
}
/**
*
* The configuration details of the generated template, including the DeletionPolicy
and
* UpdateReplacePolicy
.
*
*
* @return The configuration details of the generated template, including the DeletionPolicy
and
* UpdateReplacePolicy
.
*/
public final TemplateConfiguration templateConfiguration() {
return templateConfiguration;
}
/**
*
* The number of warnings generated for this template. The warnings are found in the details of each of the
* resources in the template.
*
*
* @return The number of warnings generated for this template. The warnings are found in the details of each of the
* resources in the template.
*/
public final Integer totalWarnings() {
return totalWarnings;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(generatedTemplateId());
hashCode = 31 * hashCode + Objects.hashCode(generatedTemplateName());
hashCode = 31 * hashCode + Objects.hashCode(hasResources() ? resources() : null);
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(progress());
hashCode = 31 * hashCode + Objects.hashCode(stackId());
hashCode = 31 * hashCode + Objects.hashCode(templateConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(totalWarnings());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeGeneratedTemplateResponse)) {
return false;
}
DescribeGeneratedTemplateResponse other = (DescribeGeneratedTemplateResponse) obj;
return Objects.equals(generatedTemplateId(), other.generatedTemplateId())
&& Objects.equals(generatedTemplateName(), other.generatedTemplateName())
&& hasResources() == other.hasResources() && Objects.equals(resources(), other.resources())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusReason(), other.statusReason()) && Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(lastUpdatedTime(), other.lastUpdatedTime()) && Objects.equals(progress(), other.progress())
&& Objects.equals(stackId(), other.stackId())
&& Objects.equals(templateConfiguration(), other.templateConfiguration())
&& Objects.equals(totalWarnings(), other.totalWarnings());
}
/**
* 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("DescribeGeneratedTemplateResponse").add("GeneratedTemplateId", generatedTemplateId())
.add("GeneratedTemplateName", generatedTemplateName()).add("Resources", hasResources() ? resources() : null)
.add("Status", statusAsString()).add("StatusReason", statusReason()).add("CreationTime", creationTime())
.add("LastUpdatedTime", lastUpdatedTime()).add("Progress", progress()).add("StackId", stackId())
.add("TemplateConfiguration", templateConfiguration()).add("TotalWarnings", totalWarnings()).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 "Resources":
return Optional.ofNullable(clazz.cast(resources()));
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 "Progress":
return Optional.ofNullable(clazz.cast(progress()));
case "StackId":
return Optional.ofNullable(clazz.cast(stackId()));
case "TemplateConfiguration":
return Optional.ofNullable(clazz.cast(templateConfiguration()));
case "TotalWarnings":
return Optional.ofNullable(clazz.cast(totalWarnings()));
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