All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.cloudformation.model.PropertyDifference Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS CloudFormation module holds the client classes that are used for communicating with AWS CloudFormation Service

There is a newer version: 2.29.39
Show newest version
/*
 * 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.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;

/**
 * 

* Information about a resource property whose actual value differs from its expected value, as defined in the stack * template and any values specified as template parameters. These will be present only for resources whose * StackResourceDriftStatus is MODIFIED. For more information, see Detecting * Unregulated Configuration Changes to Stacks and Resources. *

*/ @Generated("software.amazon.awssdk:codegen") public final class PropertyDifference implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField PROPERTY_PATH_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("PropertyPath").getter(getter(PropertyDifference::propertyPath)).setter(setter(Builder::propertyPath)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PropertyPath").build()).build(); private static final SdkField EXPECTED_VALUE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ExpectedValue").getter(getter(PropertyDifference::expectedValue)).setter(setter(Builder::expectedValue)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpectedValue").build()).build(); private static final SdkField ACTUAL_VALUE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ActualValue").getter(getter(PropertyDifference::actualValue)).setter(setter(Builder::actualValue)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActualValue").build()).build(); private static final SdkField DIFFERENCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DifferenceType").getter(getter(PropertyDifference::differenceTypeAsString)) .setter(setter(Builder::differenceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DifferenceType").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PROPERTY_PATH_FIELD, EXPECTED_VALUE_FIELD, ACTUAL_VALUE_FIELD, DIFFERENCE_TYPE_FIELD)); private static final long serialVersionUID = 1L; private final String propertyPath; private final String expectedValue; private final String actualValue; private final String differenceType; private PropertyDifference(BuilderImpl builder) { this.propertyPath = builder.propertyPath; this.expectedValue = builder.expectedValue; this.actualValue = builder.actualValue; this.differenceType = builder.differenceType; } /** *

* The fully-qualified path to the resource property. *

* * @return The fully-qualified path to the resource property. */ public final String propertyPath() { return propertyPath; } /** *

* The expected property value of the resource property, as defined in the stack template and any values specified * as template parameters. *

* * @return The expected property value of the resource property, as defined in the stack template and any values * specified as template parameters. */ public final String expectedValue() { return expectedValue; } /** *

* The actual property value of the resource property. *

* * @return The actual property value of the resource property. */ public final String actualValue() { return actualValue; } /** *

* The type of property difference. *

*
    *
  • *

    * ADD: A value has been added to a resource property that's an array or list data type. *

    *
  • *
  • *

    * REMOVE: The property has been removed from the current resource configuration. *

    *
  • *
  • *

    * NOT_EQUAL: The current property value differs from its expected value (as defined in the stack * template and any values specified as template parameters). *

    *
  • *
*

* If the service returns an enum value that is not available in the current SDK version, {@link #differenceType} * will return {@link DifferenceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #differenceTypeAsString}. *

* * @return The type of property difference.

*
    *
  • *

    * ADD: A value has been added to a resource property that's an array or list data type. *

    *
  • *
  • *

    * REMOVE: The property has been removed from the current resource configuration. *

    *
  • *
  • *

    * NOT_EQUAL: The current property value differs from its expected value (as defined in the * stack template and any values specified as template parameters). *

    *
  • * @see DifferenceType */ public final DifferenceType differenceType() { return DifferenceType.fromValue(differenceType); } /** *

    * The type of property difference. *

    *
      *
    • *

      * ADD: A value has been added to a resource property that's an array or list data type. *

      *
    • *
    • *

      * REMOVE: The property has been removed from the current resource configuration. *

      *
    • *
    • *

      * NOT_EQUAL: The current property value differs from its expected value (as defined in the stack * template and any values specified as template parameters). *

      *
    • *
    *

    * If the service returns an enum value that is not available in the current SDK version, {@link #differenceType} * will return {@link DifferenceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #differenceTypeAsString}. *

    * * @return The type of property difference.

    *
      *
    • *

      * ADD: A value has been added to a resource property that's an array or list data type. *

      *
    • *
    • *

      * REMOVE: The property has been removed from the current resource configuration. *

      *
    • *
    • *

      * NOT_EQUAL: The current property value differs from its expected value (as defined in the * stack template and any values specified as template parameters). *

      *
    • * @see DifferenceType */ public final String differenceTypeAsString() { return differenceType; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(propertyPath()); hashCode = 31 * hashCode + Objects.hashCode(expectedValue()); hashCode = 31 * hashCode + Objects.hashCode(actualValue()); hashCode = 31 * hashCode + Objects.hashCode(differenceTypeAsString()); 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 PropertyDifference)) { return false; } PropertyDifference other = (PropertyDifference) obj; return Objects.equals(propertyPath(), other.propertyPath()) && Objects.equals(expectedValue(), other.expectedValue()) && Objects.equals(actualValue(), other.actualValue()) && Objects.equals(differenceTypeAsString(), other.differenceTypeAsString()); } /** * 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("PropertyDifference").add("PropertyPath", propertyPath()).add("ExpectedValue", expectedValue()) .add("ActualValue", actualValue()).add("DifferenceType", differenceTypeAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "PropertyPath": return Optional.ofNullable(clazz.cast(propertyPath())); case "ExpectedValue": return Optional.ofNullable(clazz.cast(expectedValue())); case "ActualValue": return Optional.ofNullable(clazz.cast(actualValue())); case "DifferenceType": return Optional.ofNullable(clazz.cast(differenceTypeAsString())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((PropertyDifference) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The fully-qualified path to the resource property. *

      * * @param propertyPath * The fully-qualified path to the resource property. * @return Returns a reference to this object so that method calls can be chained together. */ Builder propertyPath(String propertyPath); /** *

      * The expected property value of the resource property, as defined in the stack template and any values * specified as template parameters. *

      * * @param expectedValue * The expected property value of the resource property, as defined in the stack template and any values * specified as template parameters. * @return Returns a reference to this object so that method calls can be chained together. */ Builder expectedValue(String expectedValue); /** *

      * The actual property value of the resource property. *

      * * @param actualValue * The actual property value of the resource property. * @return Returns a reference to this object so that method calls can be chained together. */ Builder actualValue(String actualValue); /** *

      * The type of property difference. *

      *
        *
      • *

        * ADD: A value has been added to a resource property that's an array or list data type. *

        *
      • *
      • *

        * REMOVE: The property has been removed from the current resource configuration. *

        *
      • *
      • *

        * NOT_EQUAL: The current property value differs from its expected value (as defined in the stack * template and any values specified as template parameters). *

        *
      • *
      * * @param differenceType * The type of property difference.

      *
        *
      • *

        * ADD: A value has been added to a resource property that's an array or list data type. *

        *
      • *
      • *

        * REMOVE: The property has been removed from the current resource configuration. *

        *
      • *
      • *

        * NOT_EQUAL: The current property value differs from its expected value (as defined in the * stack template and any values specified as template parameters). *

        *
      • * @see DifferenceType * @return Returns a reference to this object so that method calls can be chained together. * @see DifferenceType */ Builder differenceType(String differenceType); /** *

        * The type of property difference. *

        *
          *
        • *

          * ADD: A value has been added to a resource property that's an array or list data type. *

          *
        • *
        • *

          * REMOVE: The property has been removed from the current resource configuration. *

          *
        • *
        • *

          * NOT_EQUAL: The current property value differs from its expected value (as defined in the stack * template and any values specified as template parameters). *

          *
        • *
        * * @param differenceType * The type of property difference.

        *
          *
        • *

          * ADD: A value has been added to a resource property that's an array or list data type. *

          *
        • *
        • *

          * REMOVE: The property has been removed from the current resource configuration. *

          *
        • *
        • *

          * NOT_EQUAL: The current property value differs from its expected value (as defined in the * stack template and any values specified as template parameters). *

          *
        • * @see DifferenceType * @return Returns a reference to this object so that method calls can be chained together. * @see DifferenceType */ Builder differenceType(DifferenceType differenceType); } static final class BuilderImpl implements Builder { private String propertyPath; private String expectedValue; private String actualValue; private String differenceType; private BuilderImpl() { } private BuilderImpl(PropertyDifference model) { propertyPath(model.propertyPath); expectedValue(model.expectedValue); actualValue(model.actualValue); differenceType(model.differenceType); } public final String getPropertyPath() { return propertyPath; } public final void setPropertyPath(String propertyPath) { this.propertyPath = propertyPath; } @Override public final Builder propertyPath(String propertyPath) { this.propertyPath = propertyPath; return this; } public final String getExpectedValue() { return expectedValue; } public final void setExpectedValue(String expectedValue) { this.expectedValue = expectedValue; } @Override public final Builder expectedValue(String expectedValue) { this.expectedValue = expectedValue; return this; } public final String getActualValue() { return actualValue; } public final void setActualValue(String actualValue) { this.actualValue = actualValue; } @Override public final Builder actualValue(String actualValue) { this.actualValue = actualValue; return this; } public final String getDifferenceType() { return differenceType; } public final void setDifferenceType(String differenceType) { this.differenceType = differenceType; } @Override public final Builder differenceType(String differenceType) { this.differenceType = differenceType; return this; } @Override public final Builder differenceType(DifferenceType differenceType) { this.differenceType(differenceType == null ? null : differenceType.toString()); return this; } @Override public PropertyDifference build() { return new PropertyDifference(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy