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

software.amazon.awssdk.services.cloudformation.model.StackInstance 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 2014-2019 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.Collection;
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 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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* An AWS CloudFormation stack, in a specific account and region, that's part of a stack set operation. A stack instance * is a reference to an attempted or actual stack in a given account within a given region. A stack instance can exist * without a stack—for example, if the stack couldn't be created for some reason. A stack instance is associated with * only one stack set. Each stack instance contains the ID of its associated stack set, as well as the ID of the actual * stack and the stack status. *

*/ @Generated("software.amazon.awssdk:codegen") public final class StackInstance implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField STACK_SET_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StackInstance::stackSetId)).setter(setter(Builder::stackSetId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StackSetId").build()).build(); private static final SdkField REGION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StackInstance::region)).setter(setter(Builder::region)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Region").build()).build(); private static final SdkField ACCOUNT_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StackInstance::account)).setter(setter(Builder::account)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Account").build()).build(); private static final SdkField STACK_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StackInstance::stackId)).setter(setter(Builder::stackId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StackId").build()).build(); private static final SdkField> PARAMETER_OVERRIDES_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(StackInstance::parameterOverrides)) .setter(setter(Builder::parameterOverrides)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParameterOverrides").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Parameter::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StackInstance::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) .getter(getter(StackInstance::statusReason)).setter(setter(Builder::statusReason)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusReason").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STACK_SET_ID_FIELD, REGION_FIELD, ACCOUNT_FIELD, STACK_ID_FIELD, PARAMETER_OVERRIDES_FIELD, STATUS_FIELD, STATUS_REASON_FIELD)); private static final long serialVersionUID = 1L; private final String stackSetId; private final String region; private final String account; private final String stackId; private final List parameterOverrides; private final String status; private final String statusReason; private StackInstance(BuilderImpl builder) { this.stackSetId = builder.stackSetId; this.region = builder.region; this.account = builder.account; this.stackId = builder.stackId; this.parameterOverrides = builder.parameterOverrides; this.status = builder.status; this.statusReason = builder.statusReason; } /** *

* The name or unique ID of the stack set that the stack instance is associated with. *

* * @return The name or unique ID of the stack set that the stack instance is associated with. */ public String stackSetId() { return stackSetId; } /** *

* The name of the AWS region that the stack instance is associated with. *

* * @return The name of the AWS region that the stack instance is associated with. */ public String region() { return region; } /** *

* The name of the AWS account that the stack instance is associated with. *

* * @return The name of the AWS account that the stack instance is associated with. */ public String account() { return account; } /** *

* The ID of the stack instance. *

* * @return The ID of the stack instance. */ public String stackId() { return stackId; } /** *

* A list of parameters from the stack set template whose values have been overridden in this stack instance. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return A list of parameters from the stack set template whose values have been overridden in this stack * instance. */ public List parameterOverrides() { return parameterOverrides; } /** *

* The status of the stack instance, in terms of its synchronization with its associated stack set. *

*
    *
  • *

    * INOPERABLE: A DeleteStackInstances operation has failed and left the stack in an * unstable state. Stacks in this state are excluded from further UpdateStackSet operations. You might * need to perform a DeleteStackInstances operation, with RetainStacks set to * true, to delete the stack instance, and then delete the stack manually. *

    *
  • *
  • *

    * OUTDATED: The stack isn't currently up to date with the stack set because: *

    *
      *
    • *

      * The associated stack failed during a CreateStackSet or UpdateStackSet operation. *

      *
    • *
    • *

      * The stack was part of a CreateStackSet or UpdateStackSet operation that failed or was * stopped before the stack was created or updated. *

      *
    • *
    *
  • *
  • *

    * CURRENT: The stack is currently up to date with the stack set. *

    *
  • *
*

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

* * @return The status of the stack instance, in terms of its synchronization with its associated stack set.

*
    *
  • *

    * INOPERABLE: A DeleteStackInstances operation has failed and left the stack in * an unstable state. Stacks in this state are excluded from further UpdateStackSet operations. * You might need to perform a DeleteStackInstances operation, with RetainStacks * set to true, to delete the stack instance, and then delete the stack manually. *

    *
  • *
  • *

    * OUTDATED: The stack isn't currently up to date with the stack set because: *

    *
      *
    • *

      * The associated stack failed during a CreateStackSet or UpdateStackSet * operation. *

      *
    • *
    • *

      * The stack was part of a CreateStackSet or UpdateStackSet operation that failed * or was stopped before the stack was created or updated. *

      *
    • *
    *
  • *
  • *

    * CURRENT: The stack is currently up to date with the stack set. *

    *
  • * @see StackInstanceStatus */ public StackInstanceStatus status() { return StackInstanceStatus.fromValue(status); } /** *

    * The status of the stack instance, in terms of its synchronization with its associated stack set. *

    *
      *
    • *

      * INOPERABLE: A DeleteStackInstances operation has failed and left the stack in an * unstable state. Stacks in this state are excluded from further UpdateStackSet operations. You might * need to perform a DeleteStackInstances operation, with RetainStacks set to * true, to delete the stack instance, and then delete the stack manually. *

      *
    • *
    • *

      * OUTDATED: The stack isn't currently up to date with the stack set because: *

      *
        *
      • *

        * The associated stack failed during a CreateStackSet or UpdateStackSet operation. *

        *
      • *
      • *

        * The stack was part of a CreateStackSet or UpdateStackSet operation that failed or was * stopped before the stack was created or updated. *

        *
      • *
      *
    • *
    • *

      * CURRENT: The stack is currently up to date with the stack set. *

      *
    • *
    *

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

    * * @return The status of the stack instance, in terms of its synchronization with its associated stack set.

    *
      *
    • *

      * INOPERABLE: A DeleteStackInstances operation has failed and left the stack in * an unstable state. Stacks in this state are excluded from further UpdateStackSet operations. * You might need to perform a DeleteStackInstances operation, with RetainStacks * set to true, to delete the stack instance, and then delete the stack manually. *

      *
    • *
    • *

      * OUTDATED: The stack isn't currently up to date with the stack set because: *

      *
        *
      • *

        * The associated stack failed during a CreateStackSet or UpdateStackSet * operation. *

        *
      • *
      • *

        * The stack was part of a CreateStackSet or UpdateStackSet operation that failed * or was stopped before the stack was created or updated. *

        *
      • *
      *
    • *
    • *

      * CURRENT: The stack is currently up to date with the stack set. *

      *
    • * @see StackInstanceStatus */ public String statusAsString() { return status; } /** *

      * The explanation for the specific status code that is assigned to this stack instance. *

      * * @return The explanation for the specific status code that is assigned to this stack instance. */ public String statusReason() { return statusReason; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(stackSetId()); hashCode = 31 * hashCode + Objects.hashCode(region()); hashCode = 31 * hashCode + Objects.hashCode(account()); hashCode = 31 * hashCode + Objects.hashCode(stackId()); hashCode = 31 * hashCode + Objects.hashCode(parameterOverrides()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(statusReason()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof StackInstance)) { return false; } StackInstance other = (StackInstance) obj; return Objects.equals(stackSetId(), other.stackSetId()) && Objects.equals(region(), other.region()) && Objects.equals(account(), other.account()) && Objects.equals(stackId(), other.stackId()) && Objects.equals(parameterOverrides(), other.parameterOverrides()) && Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(statusReason(), other.statusReason()); } /** * 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 String toString() { return ToString.builder("StackInstance").add("StackSetId", stackSetId()).add("Region", region()) .add("Account", account()).add("StackId", stackId()).add("ParameterOverrides", parameterOverrides()) .add("Status", statusAsString()).add("StatusReason", statusReason()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "StackSetId": return Optional.ofNullable(clazz.cast(stackSetId())); case "Region": return Optional.ofNullable(clazz.cast(region())); case "Account": return Optional.ofNullable(clazz.cast(account())); case "StackId": return Optional.ofNullable(clazz.cast(stackId())); case "ParameterOverrides": return Optional.ofNullable(clazz.cast(parameterOverrides())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "StatusReason": return Optional.ofNullable(clazz.cast(statusReason())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StackInstance) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The name or unique ID of the stack set that the stack instance is associated with. *

      * * @param stackSetId * The name or unique ID of the stack set that the stack instance is associated with. * @return Returns a reference to this object so that method calls can be chained together. */ Builder stackSetId(String stackSetId); /** *

      * The name of the AWS region that the stack instance is associated with. *

      * * @param region * The name of the AWS region that the stack instance is associated with. * @return Returns a reference to this object so that method calls can be chained together. */ Builder region(String region); /** *

      * The name of the AWS account that the stack instance is associated with. *

      * * @param account * The name of the AWS account that the stack instance is associated with. * @return Returns a reference to this object so that method calls can be chained together. */ Builder account(String account); /** *

      * The ID of the stack instance. *

      * * @param stackId * The ID of the stack instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder stackId(String stackId); /** *

      * A list of parameters from the stack set template whose values have been overridden in this stack instance. *

      * * @param parameterOverrides * A list of parameters from the stack set template whose values have been overridden in this stack * instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder parameterOverrides(Collection parameterOverrides); /** *

      * A list of parameters from the stack set template whose values have been overridden in this stack instance. *

      * * @param parameterOverrides * A list of parameters from the stack set template whose values have been overridden in this stack * instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder parameterOverrides(Parameter... parameterOverrides); /** *

      * A list of parameters from the stack set template whose values have been overridden in this stack instance. *

      * This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to * create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its * result is passed to {@link #parameterOverrides(List)}. * * @param parameterOverrides * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #parameterOverrides(List) */ Builder parameterOverrides(Consumer... parameterOverrides); /** *

      * The status of the stack instance, in terms of its synchronization with its associated stack set. *

      *
        *
      • *

        * INOPERABLE: A DeleteStackInstances operation has failed and left the stack in an * unstable state. Stacks in this state are excluded from further UpdateStackSet operations. You * might need to perform a DeleteStackInstances operation, with RetainStacks set to * true, to delete the stack instance, and then delete the stack manually. *

        *
      • *
      • *

        * OUTDATED: The stack isn't currently up to date with the stack set because: *

        *
          *
        • *

          * The associated stack failed during a CreateStackSet or UpdateStackSet operation. *

          *
        • *
        • *

          * The stack was part of a CreateStackSet or UpdateStackSet operation that failed or * was stopped before the stack was created or updated. *

          *
        • *
        *
      • *
      • *

        * CURRENT: The stack is currently up to date with the stack set. *

        *
      • *
      * * @param status * The status of the stack instance, in terms of its synchronization with its associated stack set.

      *
        *
      • *

        * INOPERABLE: A DeleteStackInstances operation has failed and left the stack * in an unstable state. Stacks in this state are excluded from further UpdateStackSet * operations. You might need to perform a DeleteStackInstances operation, with * RetainStacks set to true, to delete the stack instance, and then delete the * stack manually. *

        *
      • *
      • *

        * OUTDATED: The stack isn't currently up to date with the stack set because: *

        *
          *
        • *

          * The associated stack failed during a CreateStackSet or UpdateStackSet * operation. *

          *
        • *
        • *

          * The stack was part of a CreateStackSet or UpdateStackSet operation that * failed or was stopped before the stack was created or updated. *

          *
        • *
        *
      • *
      • *

        * CURRENT: The stack is currently up to date with the stack set. *

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

        * The status of the stack instance, in terms of its synchronization with its associated stack set. *

        *
          *
        • *

          * INOPERABLE: A DeleteStackInstances operation has failed and left the stack in an * unstable state. Stacks in this state are excluded from further UpdateStackSet operations. You * might need to perform a DeleteStackInstances operation, with RetainStacks set to * true, to delete the stack instance, and then delete the stack manually. *

          *
        • *
        • *

          * OUTDATED: The stack isn't currently up to date with the stack set because: *

          *
            *
          • *

            * The associated stack failed during a CreateStackSet or UpdateStackSet operation. *

            *
          • *
          • *

            * The stack was part of a CreateStackSet or UpdateStackSet operation that failed or * was stopped before the stack was created or updated. *

            *
          • *
          *
        • *
        • *

          * CURRENT: The stack is currently up to date with the stack set. *

          *
        • *
        * * @param status * The status of the stack instance, in terms of its synchronization with its associated stack set.

        *
          *
        • *

          * INOPERABLE: A DeleteStackInstances operation has failed and left the stack * in an unstable state. Stacks in this state are excluded from further UpdateStackSet * operations. You might need to perform a DeleteStackInstances operation, with * RetainStacks set to true, to delete the stack instance, and then delete the * stack manually. *

          *
        • *
        • *

          * OUTDATED: The stack isn't currently up to date with the stack set because: *

          *
            *
          • *

            * The associated stack failed during a CreateStackSet or UpdateStackSet * operation. *

            *
          • *
          • *

            * The stack was part of a CreateStackSet or UpdateStackSet operation that * failed or was stopped before the stack was created or updated. *

            *
          • *
          *
        • *
        • *

          * CURRENT: The stack is currently up to date with the stack set. *

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

          * The explanation for the specific status code that is assigned to this stack instance. *

          * * @param statusReason * The explanation for the specific status code that is assigned to this stack instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder statusReason(String statusReason); } static final class BuilderImpl implements Builder { private String stackSetId; private String region; private String account; private String stackId; private List parameterOverrides = DefaultSdkAutoConstructList.getInstance(); private String status; private String statusReason; private BuilderImpl() { } private BuilderImpl(StackInstance model) { stackSetId(model.stackSetId); region(model.region); account(model.account); stackId(model.stackId); parameterOverrides(model.parameterOverrides); status(model.status); statusReason(model.statusReason); } public final String getStackSetId() { return stackSetId; } @Override public final Builder stackSetId(String stackSetId) { this.stackSetId = stackSetId; return this; } public final void setStackSetId(String stackSetId) { this.stackSetId = stackSetId; } public final String getRegion() { return region; } @Override public final Builder region(String region) { this.region = region; return this; } public final void setRegion(String region) { this.region = region; } public final String getAccount() { return account; } @Override public final Builder account(String account) { this.account = account; return this; } public final void setAccount(String account) { this.account = account; } public final String getStackId() { return stackId; } @Override public final Builder stackId(String stackId) { this.stackId = stackId; return this; } public final void setStackId(String stackId) { this.stackId = stackId; } public final Collection getParameterOverrides() { return parameterOverrides != null ? parameterOverrides.stream().map(Parameter::toBuilder) .collect(Collectors.toList()) : null; } @Override public final Builder parameterOverrides(Collection parameterOverrides) { this.parameterOverrides = ParametersCopier.copy(parameterOverrides); return this; } @Override @SafeVarargs public final Builder parameterOverrides(Parameter... parameterOverrides) { parameterOverrides(Arrays.asList(parameterOverrides)); return this; } @Override @SafeVarargs public final Builder parameterOverrides(Consumer... parameterOverrides) { parameterOverrides(Stream.of(parameterOverrides).map(c -> Parameter.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setParameterOverrides(Collection parameterOverrides) { this.parameterOverrides = ParametersCopier.copyFromBuilder(parameterOverrides); } public final String getStatusAsString() { return status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(StackInstanceStatus status) { this.status(status == null ? null : status.toString()); return this; } public final void setStatus(String status) { this.status = status; } public final String getStatusReason() { return statusReason; } @Override public final Builder statusReason(String statusReason) { this.statusReason = statusReason; return this; } public final void setStatusReason(String statusReason) { this.statusReason = statusReason; } @Override public StackInstance build() { return new StackInstance(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy