software.amazon.awssdk.services.cloudformation.model.StackSetDriftDetectionDetails 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;
/**
*
* Detailed information about the drift status of the stack set.
*
*
* For stack sets, contains information about the last completed drift operation performed on the stack set.
* Information about drift operations in-progress isn't included.
*
*
* For stack set operations, includes information about drift operations currently being performed on the stack set.
*
*
* For more information, see Detecting unmanaged
* changes in stack sets in the CloudFormation User Guide.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class StackSetDriftDetectionDetails implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DRIFT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DriftStatus").getter(getter(StackSetDriftDetectionDetails::driftStatusAsString))
.setter(setter(Builder::driftStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DriftStatus").build()).build();
private static final SdkField DRIFT_DETECTION_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DriftDetectionStatus").getter(getter(StackSetDriftDetectionDetails::driftDetectionStatusAsString))
.setter(setter(Builder::driftDetectionStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DriftDetectionStatus").build())
.build();
private static final SdkField LAST_DRIFT_CHECK_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastDriftCheckTimestamp").getter(getter(StackSetDriftDetectionDetails::lastDriftCheckTimestamp))
.setter(setter(Builder::lastDriftCheckTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastDriftCheckTimestamp").build())
.build();
private static final SdkField TOTAL_STACK_INSTANCES_COUNT_FIELD = SdkField
. builder(MarshallingType.INTEGER).memberName("TotalStackInstancesCount")
.getter(getter(StackSetDriftDetectionDetails::totalStackInstancesCount))
.setter(setter(Builder::totalStackInstancesCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalStackInstancesCount").build())
.build();
private static final SdkField DRIFTED_STACK_INSTANCES_COUNT_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("DriftedStackInstancesCount")
.getter(getter(StackSetDriftDetectionDetails::driftedStackInstancesCount))
.setter(setter(Builder::driftedStackInstancesCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DriftedStackInstancesCount").build())
.build();
private static final SdkField IN_SYNC_STACK_INSTANCES_COUNT_FIELD = SdkField
. builder(MarshallingType.INTEGER).memberName("InSyncStackInstancesCount")
.getter(getter(StackSetDriftDetectionDetails::inSyncStackInstancesCount))
.setter(setter(Builder::inSyncStackInstancesCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InSyncStackInstancesCount").build())
.build();
private static final SdkField IN_PROGRESS_STACK_INSTANCES_COUNT_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("InProgressStackInstancesCount")
.getter(getter(StackSetDriftDetectionDetails::inProgressStackInstancesCount))
.setter(setter(Builder::inProgressStackInstancesCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InProgressStackInstancesCount")
.build()).build();
private static final SdkField FAILED_STACK_INSTANCES_COUNT_FIELD = SdkField
. builder(MarshallingType.INTEGER).memberName("FailedStackInstancesCount")
.getter(getter(StackSetDriftDetectionDetails::failedStackInstancesCount))
.setter(setter(Builder::failedStackInstancesCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailedStackInstancesCount").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DRIFT_STATUS_FIELD,
DRIFT_DETECTION_STATUS_FIELD, LAST_DRIFT_CHECK_TIMESTAMP_FIELD, TOTAL_STACK_INSTANCES_COUNT_FIELD,
DRIFTED_STACK_INSTANCES_COUNT_FIELD, IN_SYNC_STACK_INSTANCES_COUNT_FIELD, IN_PROGRESS_STACK_INSTANCES_COUNT_FIELD,
FAILED_STACK_INSTANCES_COUNT_FIELD));
private static final long serialVersionUID = 1L;
private final String driftStatus;
private final String driftDetectionStatus;
private final Instant lastDriftCheckTimestamp;
private final Integer totalStackInstancesCount;
private final Integer driftedStackInstancesCount;
private final Integer inSyncStackInstancesCount;
private final Integer inProgressStackInstancesCount;
private final Integer failedStackInstancesCount;
private StackSetDriftDetectionDetails(BuilderImpl builder) {
this.driftStatus = builder.driftStatus;
this.driftDetectionStatus = builder.driftDetectionStatus;
this.lastDriftCheckTimestamp = builder.lastDriftCheckTimestamp;
this.totalStackInstancesCount = builder.totalStackInstancesCount;
this.driftedStackInstancesCount = builder.driftedStackInstancesCount;
this.inSyncStackInstancesCount = builder.inSyncStackInstancesCount;
this.inProgressStackInstancesCount = builder.inProgressStackInstancesCount;
this.failedStackInstancesCount = builder.failedStackInstancesCount;
}
/**
*
* Status of the stack set's actual configuration compared to its expected template and parameter configuration. A
* stack set is considered to have drifted if one or more of its stack instances have drifted from their expected
* template and parameter configuration.
*
*
* -
*
* DRIFTED
: One or more of the stack instances belonging to the stack set stack differs from the
* expected template and parameter configuration. A stack instance is considered to have drifted if one or more of
* the resources in the associated stack have drifted.
*
*
* -
*
* NOT_CHECKED
: CloudFormation hasn't checked the stack set for drift.
*
*
* -
*
* IN_SYNC
: All of the stack instances belonging to the stack set stack match from the expected
* template and parameter configuration.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #driftStatus} will
* return {@link StackSetDriftStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #driftStatusAsString}.
*
*
* @return Status of the stack set's actual configuration compared to its expected template and parameter
* configuration. A stack set is considered to have drifted if one or more of its stack instances have
* drifted from their expected template and parameter configuration.
*
* -
*
* DRIFTED
: One or more of the stack instances belonging to the stack set stack differs from
* the expected template and parameter configuration. A stack instance is considered to have drifted if one
* or more of the resources in the associated stack have drifted.
*
*
* -
*
* NOT_CHECKED
: CloudFormation hasn't checked the stack set for drift.
*
*
* -
*
* IN_SYNC
: All of the stack instances belonging to the stack set stack match from the expected
* template and parameter configuration.
*
*
* @see StackSetDriftStatus
*/
public final StackSetDriftStatus driftStatus() {
return StackSetDriftStatus.fromValue(driftStatus);
}
/**
*
* Status of the stack set's actual configuration compared to its expected template and parameter configuration. A
* stack set is considered to have drifted if one or more of its stack instances have drifted from their expected
* template and parameter configuration.
*
*
* -
*
* DRIFTED
: One or more of the stack instances belonging to the stack set stack differs from the
* expected template and parameter configuration. A stack instance is considered to have drifted if one or more of
* the resources in the associated stack have drifted.
*
*
* -
*
* NOT_CHECKED
: CloudFormation hasn't checked the stack set for drift.
*
*
* -
*
* IN_SYNC
: All of the stack instances belonging to the stack set stack match from the expected
* template and parameter configuration.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #driftStatus} will
* return {@link StackSetDriftStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #driftStatusAsString}.
*
*
* @return Status of the stack set's actual configuration compared to its expected template and parameter
* configuration. A stack set is considered to have drifted if one or more of its stack instances have
* drifted from their expected template and parameter configuration.
*
* -
*
* DRIFTED
: One or more of the stack instances belonging to the stack set stack differs from
* the expected template and parameter configuration. A stack instance is considered to have drifted if one
* or more of the resources in the associated stack have drifted.
*
*
* -
*
* NOT_CHECKED
: CloudFormation hasn't checked the stack set for drift.
*
*
* -
*
* IN_SYNC
: All of the stack instances belonging to the stack set stack match from the expected
* template and parameter configuration.
*
*
* @see StackSetDriftStatus
*/
public final String driftStatusAsString() {
return driftStatus;
}
/**
*
* The status of the stack set drift detection operation.
*
*
* -
*
* COMPLETED
: The drift detection operation completed without failing on any stack instances.
*
*
* -
*
* FAILED
: The drift detection operation exceeded the specified failure tolerance.
*
*
* -
*
* PARTIAL_SUCCESS
: The drift detection operation completed without exceeding the failure tolerance for
* the operation.
*
*
* -
*
* IN_PROGRESS
: The drift detection operation is currently being performed.
*
*
* -
*
* STOPPED
: The user has canceled the drift detection operation.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #driftDetectionStatus} will return {@link StackSetDriftDetectionStatus#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #driftDetectionStatusAsString}.
*
*
* @return The status of the stack set drift detection operation.
*
* -
*
* COMPLETED
: The drift detection operation completed without failing on any stack instances.
*
*
* -
*
* FAILED
: The drift detection operation exceeded the specified failure tolerance.
*
*
* -
*
* PARTIAL_SUCCESS
: The drift detection operation completed without exceeding the failure
* tolerance for the operation.
*
*
* -
*
* IN_PROGRESS
: The drift detection operation is currently being performed.
*
*
* -
*
* STOPPED
: The user has canceled the drift detection operation.
*
*
* @see StackSetDriftDetectionStatus
*/
public final StackSetDriftDetectionStatus driftDetectionStatus() {
return StackSetDriftDetectionStatus.fromValue(driftDetectionStatus);
}
/**
*
* The status of the stack set drift detection operation.
*
*
* -
*
* COMPLETED
: The drift detection operation completed without failing on any stack instances.
*
*
* -
*
* FAILED
: The drift detection operation exceeded the specified failure tolerance.
*
*
* -
*
* PARTIAL_SUCCESS
: The drift detection operation completed without exceeding the failure tolerance for
* the operation.
*
*
* -
*
* IN_PROGRESS
: The drift detection operation is currently being performed.
*
*
* -
*
* STOPPED
: The user has canceled the drift detection operation.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #driftDetectionStatus} will return {@link StackSetDriftDetectionStatus#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #driftDetectionStatusAsString}.
*
*
* @return The status of the stack set drift detection operation.
*
* -
*
* COMPLETED
: The drift detection operation completed without failing on any stack instances.
*
*
* -
*
* FAILED
: The drift detection operation exceeded the specified failure tolerance.
*
*
* -
*
* PARTIAL_SUCCESS
: The drift detection operation completed without exceeding the failure
* tolerance for the operation.
*
*
* -
*
* IN_PROGRESS
: The drift detection operation is currently being performed.
*
*
* -
*
* STOPPED
: The user has canceled the drift detection operation.
*
*
* @see StackSetDriftDetectionStatus
*/
public final String driftDetectionStatusAsString() {
return driftDetectionStatus;
}
/**
*
* Most recent time when CloudFormation performed a drift detection operation on the stack set. This value will be
* NULL
for any stack set on which drift detection hasn't yet been performed.
*
*
* @return Most recent time when CloudFormation performed a drift detection operation on the stack set. This value
* will be NULL
for any stack set on which drift detection hasn't yet been performed.
*/
public final Instant lastDriftCheckTimestamp() {
return lastDriftCheckTimestamp;
}
/**
*
* The total number of stack instances belonging to this stack set.
*
*
* The total number of stack instances is equal to the total of:
*
*
* -
*
* Stack instances that match the stack set configuration.
*
*
* -
*
* Stack instances that have drifted from the stack set configuration.
*
*
* -
*
* Stack instances where the drift detection operation has failed.
*
*
* -
*
* Stack instances currently being checked for drift.
*
*
*
*
* @return The total number of stack instances belonging to this stack set.
*
* The total number of stack instances is equal to the total of:
*
*
* -
*
* Stack instances that match the stack set configuration.
*
*
* -
*
* Stack instances that have drifted from the stack set configuration.
*
*
* -
*
* Stack instances where the drift detection operation has failed.
*
*
* -
*
* Stack instances currently being checked for drift.
*
*
*/
public final Integer totalStackInstancesCount() {
return totalStackInstancesCount;
}
/**
*
* The number of stack instances that have drifted from the expected template and parameter configuration of the
* stack set. A stack instance is considered to have drifted if one or more of the resources in the associated stack
* don't match their expected configuration.
*
*
* @return The number of stack instances that have drifted from the expected template and parameter configuration of
* the stack set. A stack instance is considered to have drifted if one or more of the resources in the
* associated stack don't match their expected configuration.
*/
public final Integer driftedStackInstancesCount() {
return driftedStackInstancesCount;
}
/**
*
* The number of stack instances which match the expected template and parameter configuration of the stack set.
*
*
* @return The number of stack instances which match the expected template and parameter configuration of the stack
* set.
*/
public final Integer inSyncStackInstancesCount() {
return inSyncStackInstancesCount;
}
/**
*
* The number of stack instances that are currently being checked for drift.
*
*
* @return The number of stack instances that are currently being checked for drift.
*/
public final Integer inProgressStackInstancesCount() {
return inProgressStackInstancesCount;
}
/**
*
* The number of stack instances for which the drift detection operation failed.
*
*
* @return The number of stack instances for which the drift detection operation failed.
*/
public final Integer failedStackInstancesCount() {
return failedStackInstancesCount;
}
@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(driftStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(driftDetectionStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(lastDriftCheckTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(totalStackInstancesCount());
hashCode = 31 * hashCode + Objects.hashCode(driftedStackInstancesCount());
hashCode = 31 * hashCode + Objects.hashCode(inSyncStackInstancesCount());
hashCode = 31 * hashCode + Objects.hashCode(inProgressStackInstancesCount());
hashCode = 31 * hashCode + Objects.hashCode(failedStackInstancesCount());
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 StackSetDriftDetectionDetails)) {
return false;
}
StackSetDriftDetectionDetails other = (StackSetDriftDetectionDetails) obj;
return Objects.equals(driftStatusAsString(), other.driftStatusAsString())
&& Objects.equals(driftDetectionStatusAsString(), other.driftDetectionStatusAsString())
&& Objects.equals(lastDriftCheckTimestamp(), other.lastDriftCheckTimestamp())
&& Objects.equals(totalStackInstancesCount(), other.totalStackInstancesCount())
&& Objects.equals(driftedStackInstancesCount(), other.driftedStackInstancesCount())
&& Objects.equals(inSyncStackInstancesCount(), other.inSyncStackInstancesCount())
&& Objects.equals(inProgressStackInstancesCount(), other.inProgressStackInstancesCount())
&& Objects.equals(failedStackInstancesCount(), other.failedStackInstancesCount());
}
/**
* 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("StackSetDriftDetectionDetails").add("DriftStatus", driftStatusAsString())
.add("DriftDetectionStatus", driftDetectionStatusAsString())
.add("LastDriftCheckTimestamp", lastDriftCheckTimestamp())
.add("TotalStackInstancesCount", totalStackInstancesCount())
.add("DriftedStackInstancesCount", driftedStackInstancesCount())
.add("InSyncStackInstancesCount", inSyncStackInstancesCount())
.add("InProgressStackInstancesCount", inProgressStackInstancesCount())
.add("FailedStackInstancesCount", failedStackInstancesCount()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DriftStatus":
return Optional.ofNullable(clazz.cast(driftStatusAsString()));
case "DriftDetectionStatus":
return Optional.ofNullable(clazz.cast(driftDetectionStatusAsString()));
case "LastDriftCheckTimestamp":
return Optional.ofNullable(clazz.cast(lastDriftCheckTimestamp()));
case "TotalStackInstancesCount":
return Optional.ofNullable(clazz.cast(totalStackInstancesCount()));
case "DriftedStackInstancesCount":
return Optional.ofNullable(clazz.cast(driftedStackInstancesCount()));
case "InSyncStackInstancesCount":
return Optional.ofNullable(clazz.cast(inSyncStackInstancesCount()));
case "InProgressStackInstancesCount":
return Optional.ofNullable(clazz.cast(inProgressStackInstancesCount()));
case "FailedStackInstancesCount":
return Optional.ofNullable(clazz.cast(failedStackInstancesCount()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function