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

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

/**
 * 

* Contains high-level information about the specified stack resource. *

*/ @Generated("software.amazon.awssdk:codegen") public final class StackResourceSummary implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField LOGICAL_RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LogicalResourceId").getter(getter(StackResourceSummary::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(StackResourceSummary::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) .memberName("ResourceType").getter(getter(StackResourceSummary::resourceType)).setter(setter(Builder::resourceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType").build()).build(); private static final SdkField LAST_UPDATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("LastUpdatedTimestamp").getter(getter(StackResourceSummary::lastUpdatedTimestamp)) .setter(setter(Builder::lastUpdatedTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTimestamp").build()) .build(); private static final SdkField RESOURCE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ResourceStatus").getter(getter(StackResourceSummary::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) .memberName("ResourceStatusReason").getter(getter(StackResourceSummary::resourceStatusReason)) .setter(setter(Builder::resourceStatusReason)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceStatusReason").build()) .build(); private static final SdkField DRIFT_INFORMATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("DriftInformation") .getter(getter(StackResourceSummary::driftInformation)).setter(setter(Builder::driftInformation)) .constructor(StackResourceDriftInformationSummary::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DriftInformation").build()).build(); private static final SdkField MODULE_INFO_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("ModuleInfo").getter(getter(StackResourceSummary::moduleInfo)).setter(setter(Builder::moduleInfo)) .constructor(ModuleInfo::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModuleInfo").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOGICAL_RESOURCE_ID_FIELD, PHYSICAL_RESOURCE_ID_FIELD, RESOURCE_TYPE_FIELD, LAST_UPDATED_TIMESTAMP_FIELD, RESOURCE_STATUS_FIELD, RESOURCE_STATUS_REASON_FIELD, DRIFT_INFORMATION_FIELD, MODULE_INFO_FIELD)); private static final long serialVersionUID = 1L; private final String logicalResourceId; private final String physicalResourceId; private final String resourceType; private final Instant lastUpdatedTimestamp; private final String resourceStatus; private final String resourceStatusReason; private final StackResourceDriftInformationSummary driftInformation; private final ModuleInfo moduleInfo; private StackResourceSummary(BuilderImpl builder) { this.logicalResourceId = builder.logicalResourceId; this.physicalResourceId = builder.physicalResourceId; this.resourceType = builder.resourceType; this.lastUpdatedTimestamp = builder.lastUpdatedTimestamp; this.resourceStatus = builder.resourceStatus; this.resourceStatusReason = builder.resourceStatusReason; this.driftInformation = builder.driftInformation; this.moduleInfo = builder.moduleInfo; } /** *

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

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

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

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

* Time the status was updated. *

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

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

* Success/failure message associated with the resource. *

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

* 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 final StackResourceDriftInformationSummary driftInformation() { return driftInformation; } /** *

* Contains information about the module from which the resource was created, if the resource was created from a * module included in the stack template. *

* * @return Contains information about the module from which the resource was created, if the resource was created * from a module included in the stack template. */ public final ModuleInfo moduleInfo() { return moduleInfo; } @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(logicalResourceId()); hashCode = 31 * hashCode + Objects.hashCode(physicalResourceId()); hashCode = 31 * hashCode + Objects.hashCode(resourceType()); hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(resourceStatusAsString()); hashCode = 31 * hashCode + Objects.hashCode(resourceStatusReason()); hashCode = 31 * hashCode + Objects.hashCode(driftInformation()); hashCode = 31 * hashCode + Objects.hashCode(moduleInfo()); 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 StackResourceSummary)) { return false; } StackResourceSummary other = (StackResourceSummary) obj; return Objects.equals(logicalResourceId(), other.logicalResourceId()) && Objects.equals(physicalResourceId(), other.physicalResourceId()) && Objects.equals(resourceType(), other.resourceType()) && Objects.equals(lastUpdatedTimestamp(), other.lastUpdatedTimestamp()) && Objects.equals(resourceStatusAsString(), other.resourceStatusAsString()) && Objects.equals(resourceStatusReason(), other.resourceStatusReason()) && Objects.equals(driftInformation(), other.driftInformation()) && Objects.equals(moduleInfo(), other.moduleInfo()); } /** * 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("StackResourceSummary").add("LogicalResourceId", logicalResourceId()) .add("PhysicalResourceId", physicalResourceId()).add("ResourceType", resourceType()) .add("LastUpdatedTimestamp", lastUpdatedTimestamp()).add("ResourceStatus", resourceStatusAsString()) .add("ResourceStatusReason", resourceStatusReason()).add("DriftInformation", driftInformation()) .add("ModuleInfo", moduleInfo()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { 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 "LastUpdatedTimestamp": return Optional.ofNullable(clazz.cast(lastUpdatedTimestamp())); case "ResourceStatus": return Optional.ofNullable(clazz.cast(resourceStatusAsString())); case "ResourceStatusReason": return Optional.ofNullable(clazz.cast(resourceStatusReason())); case "DriftInformation": return Optional.ofNullable(clazz.cast(driftInformation())); case "ModuleInfo": return Optional.ofNullable(clazz.cast(moduleInfo())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StackResourceSummary) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

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

* * @param physicalResourceId * The name or unique identifier that corresponds to a physical instance ID of the resource. * @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 Amazon Web Services Resource Types Reference in the CloudFormation User Guide.) *

* * @param resourceType * Type of resource. (For more information, go to Amazon Web Services Resource Types Reference in the 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 lastUpdatedTimestamp * Time the status was updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdatedTimestamp(Instant lastUpdatedTimestamp); /** *

* 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); /** *

* 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(StackResourceDriftInformationSummary 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 method that creates an instance of the * {@link StackResourceDriftInformationSummary.Builder} avoiding the need to create one manually via * {@link StackResourceDriftInformationSummary#builder()}. * *

* When the {@link Consumer} completes, {@link StackResourceDriftInformationSummary.Builder#build()} is called * immediately and its result is passed to {@link #driftInformation(StackResourceDriftInformationSummary)}. * * @param driftInformation * a consumer that will call methods on {@link StackResourceDriftInformationSummary.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #driftInformation(StackResourceDriftInformationSummary) */ default Builder driftInformation(Consumer driftInformation) { return driftInformation(StackResourceDriftInformationSummary.builder().applyMutation(driftInformation).build()); } /** *

* Contains information about the module from which the resource was created, if the resource was created from a * module included in the stack template. *

* * @param moduleInfo * Contains information about the module from which the resource was created, if the resource was created * from a module included in the stack template. * @return Returns a reference to this object so that method calls can be chained together. */ Builder moduleInfo(ModuleInfo moduleInfo); /** *

* Contains information about the module from which the resource was created, if the resource was created from a * module included in the stack template. *

* This is a convenience method that creates an instance of the {@link ModuleInfo.Builder} avoiding the need to * create one manually via {@link ModuleInfo#builder()}. * *

* When the {@link Consumer} completes, {@link ModuleInfo.Builder#build()} is called immediately and its result * is passed to {@link #moduleInfo(ModuleInfo)}. * * @param moduleInfo * a consumer that will call methods on {@link ModuleInfo.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #moduleInfo(ModuleInfo) */ default Builder moduleInfo(Consumer moduleInfo) { return moduleInfo(ModuleInfo.builder().applyMutation(moduleInfo).build()); } } static final class BuilderImpl implements Builder { private String logicalResourceId; private String physicalResourceId; private String resourceType; private Instant lastUpdatedTimestamp; private String resourceStatus; private String resourceStatusReason; private StackResourceDriftInformationSummary driftInformation; private ModuleInfo moduleInfo; private BuilderImpl() { } private BuilderImpl(StackResourceSummary model) { logicalResourceId(model.logicalResourceId); physicalResourceId(model.physicalResourceId); resourceType(model.resourceType); lastUpdatedTimestamp(model.lastUpdatedTimestamp); resourceStatus(model.resourceStatus); resourceStatusReason(model.resourceStatusReason); driftInformation(model.driftInformation); moduleInfo(model.moduleInfo); } public final String getLogicalResourceId() { return logicalResourceId; } public final void setLogicalResourceId(String logicalResourceId) { this.logicalResourceId = logicalResourceId; } @Override public final Builder logicalResourceId(String logicalResourceId) { this.logicalResourceId = logicalResourceId; return this; } public final String getPhysicalResourceId() { return physicalResourceId; } public final void setPhysicalResourceId(String physicalResourceId) { this.physicalResourceId = physicalResourceId; } @Override public final Builder physicalResourceId(String physicalResourceId) { this.physicalResourceId = physicalResourceId; return this; } public final String getResourceType() { return resourceType; } public final void setResourceType(String resourceType) { this.resourceType = resourceType; } @Override public final Builder resourceType(String resourceType) { this.resourceType = resourceType; return this; } public final Instant getLastUpdatedTimestamp() { return lastUpdatedTimestamp; } public final void setLastUpdatedTimestamp(Instant lastUpdatedTimestamp) { this.lastUpdatedTimestamp = lastUpdatedTimestamp; } @Override public final Builder lastUpdatedTimestamp(Instant lastUpdatedTimestamp) { this.lastUpdatedTimestamp = lastUpdatedTimestamp; return this; } public final String getResourceStatus() { return resourceStatus; } public final void setResourceStatus(String resourceStatus) { this.resourceStatus = 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 String getResourceStatusReason() { return resourceStatusReason; } public final void setResourceStatusReason(String resourceStatusReason) { this.resourceStatusReason = resourceStatusReason; } @Override public final Builder resourceStatusReason(String resourceStatusReason) { this.resourceStatusReason = resourceStatusReason; return this; } public final StackResourceDriftInformationSummary.Builder getDriftInformation() { return driftInformation != null ? driftInformation.toBuilder() : null; } public final void setDriftInformation(StackResourceDriftInformationSummary.BuilderImpl driftInformation) { this.driftInformation = driftInformation != null ? driftInformation.build() : null; } @Override public final Builder driftInformation(StackResourceDriftInformationSummary driftInformation) { this.driftInformation = driftInformation; return this; } public final ModuleInfo.Builder getModuleInfo() { return moduleInfo != null ? moduleInfo.toBuilder() : null; } public final void setModuleInfo(ModuleInfo.BuilderImpl moduleInfo) { this.moduleInfo = moduleInfo != null ? moduleInfo.build() : null; } @Override public final Builder moduleInfo(ModuleInfo moduleInfo) { this.moduleInfo = moduleInfo; return this; } @Override public StackResourceSummary build() { return new StackResourceSummary(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy