software.amazon.awssdk.services.cloudformation.model.StackResourceSummary 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.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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Contains high-level information about the specified stack resource.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class StackResourceSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField LOGICAL_RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LogicalResourceId").getter(getter(StackResourceSummary::logicalResourceId))
.setter(setter(Builder::logicalResourceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogicalResourceId").build()).build();
private static final SdkField PHYSICAL_RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PhysicalResourceId").getter(getter(StackResourceSummary::physicalResourceId))
.setter(setter(Builder::physicalResourceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PhysicalResourceId").build())
.build();
private static final SdkField RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceType").getter(getter(StackResourceSummary::resourceType)).setter(setter(Builder::resourceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType").build()).build();
private static final SdkField LAST_UPDATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedTimestamp").getter(getter(StackResourceSummary::lastUpdatedTimestamp))
.setter(setter(Builder::lastUpdatedTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTimestamp").build())
.build();
private static final SdkField RESOURCE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceStatus").getter(getter(StackResourceSummary::resourceStatusAsString))
.setter(setter(Builder::resourceStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceStatus").build()).build();
private static final SdkField RESOURCE_STATUS_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceStatusReason").getter(getter(StackResourceSummary::resourceStatusReason))
.setter(setter(Builder::resourceStatusReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceStatusReason").build())
.build();
private static final SdkField DRIFT_INFORMATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DriftInformation")
.getter(getter(StackResourceSummary::driftInformation)).setter(setter(Builder::driftInformation))
.constructor(StackResourceDriftInformationSummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DriftInformation").build()).build();
private static final SdkField MODULE_INFO_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("ModuleInfo").getter(getter(StackResourceSummary::moduleInfo)).setter(setter(Builder::moduleInfo))
.constructor(ModuleInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModuleInfo").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOGICAL_RESOURCE_ID_FIELD,
PHYSICAL_RESOURCE_ID_FIELD, RESOURCE_TYPE_FIELD, LAST_UPDATED_TIMESTAMP_FIELD, RESOURCE_STATUS_FIELD,
RESOURCE_STATUS_REASON_FIELD, DRIFT_INFORMATION_FIELD, MODULE_INFO_FIELD));
private static final long serialVersionUID = 1L;
private final String logicalResourceId;
private final String physicalResourceId;
private final String resourceType;
private final Instant lastUpdatedTimestamp;
private final String resourceStatus;
private final String resourceStatusReason;
private final StackResourceDriftInformationSummary driftInformation;
private final ModuleInfo moduleInfo;
private StackResourceSummary(BuilderImpl builder) {
this.logicalResourceId = builder.logicalResourceId;
this.physicalResourceId = builder.physicalResourceId;
this.resourceType = builder.resourceType;
this.lastUpdatedTimestamp = builder.lastUpdatedTimestamp;
this.resourceStatus = builder.resourceStatus;
this.resourceStatusReason = builder.resourceStatusReason;
this.driftInformation = builder.driftInformation;
this.moduleInfo = builder.moduleInfo;
}
/**
*
* The logical name of the resource specified in the template.
*
*
* @return The logical name of the resource specified in the template.
*/
public final String logicalResourceId() {
return logicalResourceId;
}
/**
*
* The name or unique identifier that corresponds to a physical instance ID of the resource.
*
*
* @return The name or unique identifier that corresponds to a physical instance ID of the resource.
*/
public final String physicalResourceId() {
return physicalResourceId;
}
/**
*
* Type of resource. (For more information, go to Amazon
* Web Services Resource Types Reference in the CloudFormation User Guide.)
*
*
* @return Type of resource. (For more information, go to Amazon Web Services Resource Types Reference in the CloudFormation User Guide.)
*/
public final String resourceType() {
return resourceType;
}
/**
*
* Time the status was updated.
*
*
* @return Time the status was updated.
*/
public final Instant lastUpdatedTimestamp() {
return lastUpdatedTimestamp;
}
/**
*
* Current status of the resource.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #resourceStatus}
* will return {@link ResourceStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #resourceStatusAsString}.
*
*
* @return Current status of the resource.
* @see ResourceStatus
*/
public final ResourceStatus resourceStatus() {
return ResourceStatus.fromValue(resourceStatus);
}
/**
*
* Current status of the resource.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #resourceStatus}
* will return {@link ResourceStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #resourceStatusAsString}.
*
*
* @return Current status of the resource.
* @see ResourceStatus
*/
public final String resourceStatusAsString() {
return resourceStatus;
}
/**
*
* Success/failure message associated with the resource.
*
*
* @return Success/failure message associated with the resource.
*/
public final String resourceStatusReason() {
return resourceStatusReason;
}
/**
*
* Information about whether the resource's actual configuration differs, or has drifted, from its expected
* configuration, as defined in the stack template and any values specified as template parameters. For more
* information, see Detecting
* Unregulated Configuration Changes to Stacks and Resources.
*
*
* @return Information about whether the resource's actual configuration differs, or has drifted, from its
* expected configuration, as defined in the stack template and any values specified as template parameters.
* For more information, see Detecting Unregulated Configuration Changes to Stacks and Resources.
*/
public final StackResourceDriftInformationSummary driftInformation() {
return driftInformation;
}
/**
*
* Contains information about the module from which the resource was created, if the resource was created from a
* module included in the stack template.
*
*
* @return Contains information about the module from which the resource was created, if the resource was created
* from a module included in the stack template.
*/
public final ModuleInfo moduleInfo() {
return moduleInfo;
}
@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(logicalResourceId());
hashCode = 31 * hashCode + Objects.hashCode(physicalResourceId());
hashCode = 31 * hashCode + Objects.hashCode(resourceType());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(resourceStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(resourceStatusReason());
hashCode = 31 * hashCode + Objects.hashCode(driftInformation());
hashCode = 31 * hashCode + Objects.hashCode(moduleInfo());
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 StackResourceSummary)) {
return false;
}
StackResourceSummary other = (StackResourceSummary) obj;
return Objects.equals(logicalResourceId(), other.logicalResourceId())
&& Objects.equals(physicalResourceId(), other.physicalResourceId())
&& Objects.equals(resourceType(), other.resourceType())
&& Objects.equals(lastUpdatedTimestamp(), other.lastUpdatedTimestamp())
&& Objects.equals(resourceStatusAsString(), other.resourceStatusAsString())
&& Objects.equals(resourceStatusReason(), other.resourceStatusReason())
&& Objects.equals(driftInformation(), other.driftInformation())
&& Objects.equals(moduleInfo(), other.moduleInfo());
}
/**
* 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("StackResourceSummary").add("LogicalResourceId", logicalResourceId())
.add("PhysicalResourceId", physicalResourceId()).add("ResourceType", resourceType())
.add("LastUpdatedTimestamp", lastUpdatedTimestamp()).add("ResourceStatus", resourceStatusAsString())
.add("ResourceStatusReason", resourceStatusReason()).add("DriftInformation", driftInformation())
.add("ModuleInfo", moduleInfo()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LogicalResourceId":
return Optional.ofNullable(clazz.cast(logicalResourceId()));
case "PhysicalResourceId":
return Optional.ofNullable(clazz.cast(physicalResourceId()));
case "ResourceType":
return Optional.ofNullable(clazz.cast(resourceType()));
case "LastUpdatedTimestamp":
return Optional.ofNullable(clazz.cast(lastUpdatedTimestamp()));
case "ResourceStatus":
return Optional.ofNullable(clazz.cast(resourceStatusAsString()));
case "ResourceStatusReason":
return Optional.ofNullable(clazz.cast(resourceStatusReason()));
case "DriftInformation":
return Optional.ofNullable(clazz.cast(driftInformation()));
case "ModuleInfo":
return Optional.ofNullable(clazz.cast(moduleInfo()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function