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

software.amazon.awssdk.services.cloudformation.model.StackResource 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.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;

/**
 * 

* The StackResource data type. *

*/ @Generated("software.amazon.awssdk:codegen") public final class StackResource implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField STACK_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StackResource::stackName)).setter(setter(Builder::stackName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StackName").build()).build(); private static final SdkField STACK_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StackResource::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) .getter(getter(StackResource::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) .getter(getter(StackResource::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) .getter(getter(StackResource::resourceType)).setter(setter(Builder::resourceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType").build()).build(); private static final SdkField TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .getter(getter(StackResource::timestamp)).setter(setter(Builder::timestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Timestamp").build()).build(); private static final SdkField RESOURCE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StackResource::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) .getter(getter(StackResource::resourceStatusReason)).setter(setter(Builder::resourceStatusReason)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceStatusReason").build()) .build(); private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StackResource::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build(); private static final SdkField DRIFT_INFORMATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).getter(getter(StackResource::driftInformation)) .setter(setter(Builder::driftInformation)).constructor(StackResourceDriftInformation::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DriftInformation").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STACK_NAME_FIELD, STACK_ID_FIELD, LOGICAL_RESOURCE_ID_FIELD, PHYSICAL_RESOURCE_ID_FIELD, RESOURCE_TYPE_FIELD, TIMESTAMP_FIELD, RESOURCE_STATUS_FIELD, RESOURCE_STATUS_REASON_FIELD, DESCRIPTION_FIELD, DRIFT_INFORMATION_FIELD)); private static final long serialVersionUID = 1L; private final String stackName; private final String stackId; private final String logicalResourceId; private final String physicalResourceId; private final String resourceType; private final Instant timestamp; private final String resourceStatus; private final String resourceStatusReason; private final String description; private final StackResourceDriftInformation driftInformation; private StackResource(BuilderImpl builder) { this.stackName = builder.stackName; this.stackId = builder.stackId; this.logicalResourceId = builder.logicalResourceId; this.physicalResourceId = builder.physicalResourceId; this.resourceType = builder.resourceType; this.timestamp = builder.timestamp; this.resourceStatus = builder.resourceStatus; this.resourceStatusReason = builder.resourceStatusReason; this.description = builder.description; this.driftInformation = builder.driftInformation; } /** *

* The name associated with the stack. *

* * @return The name associated with the stack. */ public String stackName() { return stackName; } /** *

* Unique identifier of the stack. *

* * @return Unique identifier of the stack. */ public 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 String logicalResourceId() { return logicalResourceId; } /** *

* The name or unique identifier that corresponds to a physical instance ID of a resource supported by AWS * CloudFormation. *

* * @return The name or unique identifier that corresponds to a physical instance ID of a resource supported by AWS * CloudFormation. */ public String physicalResourceId() { return physicalResourceId; } /** *

* Type of resource. (For more information, go to AWS * Resource Types Reference in the AWS CloudFormation User Guide.) *

* * @return Type of resource. (For more information, go to AWS Resource Types Reference in the AWS CloudFormation User Guide.) */ public String resourceType() { return resourceType; } /** *

* Time the status was updated. *

* * @return Time the status was updated. */ public Instant timestamp() { return timestamp; } /** *

* 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 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 String resourceStatusAsString() { return resourceStatus; } /** *

* Success/failure message associated with the resource. *

* * @return Success/failure message associated with the resource. */ public String resourceStatusReason() { return resourceStatusReason; } /** *

* User defined description associated with the resource. *

* * @return User defined description associated with the resource. */ public String description() { return description; } /** *

* 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 StackResourceDriftInformation driftInformation() { return driftInformation; } @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(stackName()); hashCode = 31 * hashCode + Objects.hashCode(stackId()); hashCode = 31 * hashCode + Objects.hashCode(logicalResourceId()); hashCode = 31 * hashCode + Objects.hashCode(physicalResourceId()); hashCode = 31 * hashCode + Objects.hashCode(resourceType()); hashCode = 31 * hashCode + Objects.hashCode(timestamp()); hashCode = 31 * hashCode + Objects.hashCode(resourceStatusAsString()); hashCode = 31 * hashCode + Objects.hashCode(resourceStatusReason()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(driftInformation()); 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 StackResource)) { return false; } StackResource other = (StackResource) obj; return Objects.equals(stackName(), other.stackName()) && Objects.equals(stackId(), other.stackId()) && Objects.equals(logicalResourceId(), other.logicalResourceId()) && Objects.equals(physicalResourceId(), other.physicalResourceId()) && Objects.equals(resourceType(), other.resourceType()) && Objects.equals(timestamp(), other.timestamp()) && Objects.equals(resourceStatusAsString(), other.resourceStatusAsString()) && Objects.equals(resourceStatusReason(), other.resourceStatusReason()) && Objects.equals(description(), other.description()) && Objects.equals(driftInformation(), other.driftInformation()); } /** * 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("StackResource").add("StackName", stackName()).add("StackId", stackId()) .add("LogicalResourceId", logicalResourceId()).add("PhysicalResourceId", physicalResourceId()) .add("ResourceType", resourceType()).add("Timestamp", timestamp()) .add("ResourceStatus", resourceStatusAsString()).add("ResourceStatusReason", resourceStatusReason()) .add("Description", description()).add("DriftInformation", driftInformation()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "StackName": return Optional.ofNullable(clazz.cast(stackName())); 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 "ResourceType": return Optional.ofNullable(clazz.cast(resourceType())); case "Timestamp": return Optional.ofNullable(clazz.cast(timestamp())); case "ResourceStatus": return Optional.ofNullable(clazz.cast(resourceStatusAsString())); case "ResourceStatusReason": return Optional.ofNullable(clazz.cast(resourceStatusReason())); case "Description": return Optional.ofNullable(clazz.cast(description())); case "DriftInformation": return Optional.ofNullable(clazz.cast(driftInformation())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StackResource) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name associated with the stack. *

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

* Unique identifier of the stack. *

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

* The logical name of the resource specified in the template. *

* * @param logicalResourceId * The logical name of the resource specified in the template. * @return Returns a reference to this object so that method calls can be chained together. */ Builder logicalResourceId(String logicalResourceId); /** *

* The name or unique identifier that corresponds to a physical instance ID of a resource supported by AWS * CloudFormation. *

* * @param physicalResourceId * The name or unique identifier that corresponds to a physical instance ID of a resource supported by * AWS CloudFormation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder physicalResourceId(String physicalResourceId); /** *

* Type of resource. (For more information, go to * AWS Resource Types Reference in the AWS CloudFormation User Guide.) *

* * @param resourceType * Type of resource. (For more information, go to * AWS Resource Types Reference in the AWS CloudFormation User Guide.) * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceType(String resourceType); /** *

* Time the status was updated. *

* * @param timestamp * Time the status was updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder timestamp(Instant timestamp); /** *

* Current status of the resource. *

* * @param resourceStatus * Current status of the resource. * @see ResourceStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceStatus */ Builder resourceStatus(String resourceStatus); /** *

* Current status of the resource. *

* * @param resourceStatus * Current status of the resource. * @see ResourceStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceStatus */ Builder resourceStatus(ResourceStatus resourceStatus); /** *

* Success/failure message associated with the resource. *

* * @param resourceStatusReason * Success/failure message associated with the resource. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceStatusReason(String resourceStatusReason); /** *

* User defined description associated with the resource. *

* * @param description * User defined description associated with the resource. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* 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. *

* * @param driftInformation * 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 Returns a reference to this object so that method calls can be chained together. */ Builder driftInformation(StackResourceDriftInformation driftInformation); /** *

* 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. *

* This is a convenience that creates an instance of the {@link StackResourceDriftInformation.Builder} avoiding * the need to create one manually via {@link StackResourceDriftInformation#builder()}. * * When the {@link Consumer} completes, {@link StackResourceDriftInformation.Builder#build()} is called * immediately and its result is passed to {@link #driftInformation(StackResourceDriftInformation)}. * * @param driftInformation * a consumer that will call methods on {@link StackResourceDriftInformation.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #driftInformation(StackResourceDriftInformation) */ default Builder driftInformation(Consumer driftInformation) { return driftInformation(StackResourceDriftInformation.builder().applyMutation(driftInformation).build()); } } static final class BuilderImpl implements Builder { private String stackName; private String stackId; private String logicalResourceId; private String physicalResourceId; private String resourceType; private Instant timestamp; private String resourceStatus; private String resourceStatusReason; private String description; private StackResourceDriftInformation driftInformation; private BuilderImpl() { } private BuilderImpl(StackResource model) { stackName(model.stackName); stackId(model.stackId); logicalResourceId(model.logicalResourceId); physicalResourceId(model.physicalResourceId); resourceType(model.resourceType); timestamp(model.timestamp); resourceStatus(model.resourceStatus); resourceStatusReason(model.resourceStatusReason); description(model.description); driftInformation(model.driftInformation); } public final String getStackName() { return stackName; } @Override public final Builder stackName(String stackName) { this.stackName = stackName; return this; } public final void setStackName(String stackName) { this.stackName = stackName; } 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 String getLogicalResourceId() { return logicalResourceId; } @Override public final Builder logicalResourceId(String logicalResourceId) { this.logicalResourceId = logicalResourceId; return this; } public final void setLogicalResourceId(String logicalResourceId) { this.logicalResourceId = logicalResourceId; } public final String getPhysicalResourceId() { return physicalResourceId; } @Override public final Builder physicalResourceId(String physicalResourceId) { this.physicalResourceId = physicalResourceId; return this; } public final void setPhysicalResourceId(String physicalResourceId) { this.physicalResourceId = physicalResourceId; } public final String getResourceType() { return resourceType; } @Override public final Builder resourceType(String resourceType) { this.resourceType = resourceType; return this; } public final void setResourceType(String resourceType) { this.resourceType = resourceType; } public final Instant getTimestamp() { return timestamp; } @Override public final Builder timestamp(Instant timestamp) { this.timestamp = timestamp; return this; } public final void setTimestamp(Instant timestamp) { this.timestamp = timestamp; } public final String getResourceStatus() { return resourceStatus; } @Override public final Builder resourceStatus(String resourceStatus) { this.resourceStatus = resourceStatus; return this; } @Override public final Builder resourceStatus(ResourceStatus resourceStatus) { this.resourceStatus(resourceStatus == null ? null : resourceStatus.toString()); return this; } public final void setResourceStatus(String resourceStatus) { this.resourceStatus = resourceStatus; } public final String getResourceStatusReason() { return resourceStatusReason; } @Override public final Builder resourceStatusReason(String resourceStatusReason) { this.resourceStatusReason = resourceStatusReason; return this; } public final void setResourceStatusReason(String resourceStatusReason) { this.resourceStatusReason = resourceStatusReason; } public final String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } public final StackResourceDriftInformation.Builder getDriftInformation() { return driftInformation != null ? driftInformation.toBuilder() : null; } @Override public final Builder driftInformation(StackResourceDriftInformation driftInformation) { this.driftInformation = driftInformation; return this; } public final void setDriftInformation(StackResourceDriftInformation.BuilderImpl driftInformation) { this.driftInformation = driftInformation != null ? driftInformation.build() : null; } @Override public StackResource build() { return new StackResource(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy