software.amazon.awssdk.services.cloudformation.model.StackInstanceResourceDriftsSummary 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.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;
/**
*
* The structure containing summary information about resource drifts for a stack instance.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class StackInstanceResourceDriftsSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField STACK_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StackId").getter(getter(StackInstanceResourceDriftsSummary::stackId)).setter(setter(Builder::stackId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StackId").build()).build();
private static final SdkField LOGICAL_RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LogicalResourceId").getter(getter(StackInstanceResourceDriftsSummary::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(StackInstanceResourceDriftsSummary::physicalResourceId))
.setter(setter(Builder::physicalResourceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PhysicalResourceId").build())
.build();
private static final SdkField> PHYSICAL_RESOURCE_ID_CONTEXT_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("PhysicalResourceIdContext")
.getter(getter(StackInstanceResourceDriftsSummary::physicalResourceIdContext))
.setter(setter(Builder::physicalResourceIdContext))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PhysicalResourceIdContext").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(PhysicalResourceIdContextKeyValuePair::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceType").getter(getter(StackInstanceResourceDriftsSummary::resourceType))
.setter(setter(Builder::resourceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType").build()).build();
private static final SdkField> PROPERTY_DIFFERENCES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("PropertyDifferences")
.getter(getter(StackInstanceResourceDriftsSummary::propertyDifferences))
.setter(setter(Builder::propertyDifferences))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PropertyDifferences").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(PropertyDifference::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField STACK_RESOURCE_DRIFT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StackResourceDriftStatus")
.getter(getter(StackInstanceResourceDriftsSummary::stackResourceDriftStatusAsString))
.setter(setter(Builder::stackResourceDriftStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StackResourceDriftStatus").build())
.build();
private static final SdkField TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("Timestamp").getter(getter(StackInstanceResourceDriftsSummary::timestamp))
.setter(setter(Builder::timestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Timestamp").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STACK_ID_FIELD,
LOGICAL_RESOURCE_ID_FIELD, PHYSICAL_RESOURCE_ID_FIELD, PHYSICAL_RESOURCE_ID_CONTEXT_FIELD, RESOURCE_TYPE_FIELD,
PROPERTY_DIFFERENCES_FIELD, STACK_RESOURCE_DRIFT_STATUS_FIELD, TIMESTAMP_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("StackId", STACK_ID_FIELD);
put("LogicalResourceId", LOGICAL_RESOURCE_ID_FIELD);
put("PhysicalResourceId", PHYSICAL_RESOURCE_ID_FIELD);
put("PhysicalResourceIdContext", PHYSICAL_RESOURCE_ID_CONTEXT_FIELD);
put("ResourceType", RESOURCE_TYPE_FIELD);
put("PropertyDifferences", PROPERTY_DIFFERENCES_FIELD);
put("StackResourceDriftStatus", STACK_RESOURCE_DRIFT_STATUS_FIELD);
put("Timestamp", TIMESTAMP_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String stackId;
private final String logicalResourceId;
private final String physicalResourceId;
private final List physicalResourceIdContext;
private final String resourceType;
private final List propertyDifferences;
private final String stackResourceDriftStatus;
private final Instant timestamp;
private StackInstanceResourceDriftsSummary(BuilderImpl builder) {
this.stackId = builder.stackId;
this.logicalResourceId = builder.logicalResourceId;
this.physicalResourceId = builder.physicalResourceId;
this.physicalResourceIdContext = builder.physicalResourceIdContext;
this.resourceType = builder.resourceType;
this.propertyDifferences = builder.propertyDifferences;
this.stackResourceDriftStatus = builder.stackResourceDriftStatus;
this.timestamp = builder.timestamp;
}
/**
*
* The ID of the stack instance.
*
*
* @return The ID of the stack instance.
*/
public final String stackId() {
return stackId;
}
/**
*
* 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 a resource supported by
* CloudFormation.
*
*
* @return The name or unique identifier that corresponds to a physical instance ID of a resource supported by
* CloudFormation.
*/
public final String physicalResourceId() {
return physicalResourceId;
}
/**
* For responses, this returns true if the service returned a value for the PhysicalResourceIdContext 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 hasPhysicalResourceIdContext() {
return physicalResourceIdContext != null && !(physicalResourceIdContext instanceof SdkAutoConstructList);
}
/**
*
* Context information that enables CloudFormation to uniquely identify a resource. CloudFormation uses context
* key-value pairs in cases where a resource's logical and physical IDs aren't enough to uniquely identify that
* resource. Each context key-value pair specifies a unique resource that contains the targeted resource.
*
*
* 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 #hasPhysicalResourceIdContext} method.
*
*
* @return Context information that enables CloudFormation to uniquely identify a resource. CloudFormation uses
* context key-value pairs in cases where a resource's logical and physical IDs aren't enough to uniquely
* identify that resource. Each context key-value pair specifies a unique resource that contains the
* targeted resource.
*/
public final List physicalResourceIdContext() {
return physicalResourceIdContext;
}
/**
*
* Type of resource. For more information, see Amazon
* Web Services resource and property types reference in the CloudFormation User Guide.
*
*
* @return Type of resource. For more information, see Amazon Web Services resource and property types reference in the CloudFormation User Guide.
*/
public final String resourceType() {
return resourceType;
}
/**
* For responses, this returns true if the service returned a value for the PropertyDifferences 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 hasPropertyDifferences() {
return propertyDifferences != null && !(propertyDifferences instanceof SdkAutoConstructList);
}
/**
*
* Status of the actual configuration of the resource compared to its expected configuration. These will be present
* only for resources whose StackInstanceResourceDriftStatus
is MODIFIED
.
*
*
* 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 #hasPropertyDifferences} method.
*
*
* @return Status of the actual configuration of the resource compared to its expected configuration. These will be
* present only for resources whose StackInstanceResourceDriftStatus
is MODIFIED
.
*/
public final List propertyDifferences() {
return propertyDifferences;
}
/**
*
* The drift status of the resource in a stack instance.
*
*
* -
*
* DELETED
: The resource differs from its expected template configuration in that the resource has been
* deleted.
*
*
* -
*
* MODIFIED
: One or more resource properties differ from their expected template values.
*
*
* -
*
* IN_SYNC
: The resource's actual configuration matches its expected template configuration.
*
*
* -
*
* NOT_CHECKED
: CloudFormation doesn't currently return this value.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #stackResourceDriftStatus} will return {@link StackResourceDriftStatus#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #stackResourceDriftStatusAsString}.
*
*
* @return The drift status of the resource in a stack instance.
*
* -
*
* DELETED
: The resource differs from its expected template configuration in that the resource
* has been deleted.
*
*
* -
*
* MODIFIED
: One or more resource properties differ from their expected template values.
*
*
* -
*
* IN_SYNC
: The resource's actual configuration matches its expected template configuration.
*
*
* -
*
* NOT_CHECKED
: CloudFormation doesn't currently return this value.
*
*
* @see StackResourceDriftStatus
*/
public final StackResourceDriftStatus stackResourceDriftStatus() {
return StackResourceDriftStatus.fromValue(stackResourceDriftStatus);
}
/**
*
* The drift status of the resource in a stack instance.
*
*
* -
*
* DELETED
: The resource differs from its expected template configuration in that the resource has been
* deleted.
*
*
* -
*
* MODIFIED
: One or more resource properties differ from their expected template values.
*
*
* -
*
* IN_SYNC
: The resource's actual configuration matches its expected template configuration.
*
*
* -
*
* NOT_CHECKED
: CloudFormation doesn't currently return this value.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #stackResourceDriftStatus} will return {@link StackResourceDriftStatus#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #stackResourceDriftStatusAsString}.
*
*
* @return The drift status of the resource in a stack instance.
*
* -
*
* DELETED
: The resource differs from its expected template configuration in that the resource
* has been deleted.
*
*
* -
*
* MODIFIED
: One or more resource properties differ from their expected template values.
*
*
* -
*
* IN_SYNC
: The resource's actual configuration matches its expected template configuration.
*
*
* -
*
* NOT_CHECKED
: CloudFormation doesn't currently return this value.
*
*
* @see StackResourceDriftStatus
*/
public final String stackResourceDriftStatusAsString() {
return stackResourceDriftStatus;
}
/**
*
* Time at which the stack instance drift detection operation was initiated.
*
*
* @return Time at which the stack instance drift detection operation was initiated.
*/
public final Instant timestamp() {
return timestamp;
}
@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(stackId());
hashCode = 31 * hashCode + Objects.hashCode(logicalResourceId());
hashCode = 31 * hashCode + Objects.hashCode(physicalResourceId());
hashCode = 31 * hashCode + Objects.hashCode(hasPhysicalResourceIdContext() ? physicalResourceIdContext() : null);
hashCode = 31 * hashCode + Objects.hashCode(resourceType());
hashCode = 31 * hashCode + Objects.hashCode(hasPropertyDifferences() ? propertyDifferences() : null);
hashCode = 31 * hashCode + Objects.hashCode(stackResourceDriftStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(timestamp());
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 StackInstanceResourceDriftsSummary)) {
return false;
}
StackInstanceResourceDriftsSummary other = (StackInstanceResourceDriftsSummary) obj;
return Objects.equals(stackId(), other.stackId()) && Objects.equals(logicalResourceId(), other.logicalResourceId())
&& Objects.equals(physicalResourceId(), other.physicalResourceId())
&& hasPhysicalResourceIdContext() == other.hasPhysicalResourceIdContext()
&& Objects.equals(physicalResourceIdContext(), other.physicalResourceIdContext())
&& Objects.equals(resourceType(), other.resourceType())
&& hasPropertyDifferences() == other.hasPropertyDifferences()
&& Objects.equals(propertyDifferences(), other.propertyDifferences())
&& Objects.equals(stackResourceDriftStatusAsString(), other.stackResourceDriftStatusAsString())
&& Objects.equals(timestamp(), other.timestamp());
}
/**
* 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("StackInstanceResourceDriftsSummary").add("StackId", stackId())
.add("LogicalResourceId", logicalResourceId()).add("PhysicalResourceId", physicalResourceId())
.add("PhysicalResourceIdContext", hasPhysicalResourceIdContext() ? physicalResourceIdContext() : null)
.add("ResourceType", resourceType())
.add("PropertyDifferences", hasPropertyDifferences() ? propertyDifferences() : null)
.add("StackResourceDriftStatus", stackResourceDriftStatusAsString()).add("Timestamp", timestamp()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StackId":
return Optional.ofNullable(clazz.cast(stackId()));
case "LogicalResourceId":
return Optional.ofNullable(clazz.cast(logicalResourceId()));
case "PhysicalResourceId":
return Optional.ofNullable(clazz.cast(physicalResourceId()));
case "PhysicalResourceIdContext":
return Optional.ofNullable(clazz.cast(physicalResourceIdContext()));
case "ResourceType":
return Optional.ofNullable(clazz.cast(resourceType()));
case "PropertyDifferences":
return Optional.ofNullable(clazz.cast(propertyDifferences()));
case "StackResourceDriftStatus":
return Optional.ofNullable(clazz.cast(stackResourceDriftStatusAsString()));
case "Timestamp":
return Optional.ofNullable(clazz.cast(timestamp()));
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