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

software.amazon.awssdk.services.cloudformation.model.ResourceChange 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.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.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The ResourceChange structure describes the resource and the action that AWS CloudFormation will perform * on it if you execute this change set. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ResourceChange implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ACTION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Action") .getter(getter(ResourceChange::actionAsString)).setter(setter(Builder::action)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Action").build()).build(); private static final SdkField LOGICAL_RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LogicalResourceId").getter(getter(ResourceChange::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(ResourceChange::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(ResourceChange::resourceType)).setter(setter(Builder::resourceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType").build()).build(); private static final SdkField REPLACEMENT_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Replacement").getter(getter(ResourceChange::replacementAsString)).setter(setter(Builder::replacement)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Replacement").build()).build(); private static final SdkField> SCOPE_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Scope") .getter(getter(ResourceChange::scopeAsStrings)) .setter(setter(Builder::scopeWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Scope").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> DETAILS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Details") .getter(getter(ResourceChange::details)) .setter(setter(Builder::details)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Details").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ResourceChangeDetail::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField CHANGE_SET_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ChangeSetId").getter(getter(ResourceChange::changeSetId)).setter(setter(Builder::changeSetId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChangeSetId").build()).build(); private static final SdkField MODULE_INFO_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("ModuleInfo").getter(getter(ResourceChange::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(ACTION_FIELD, LOGICAL_RESOURCE_ID_FIELD, PHYSICAL_RESOURCE_ID_FIELD, RESOURCE_TYPE_FIELD, REPLACEMENT_FIELD, SCOPE_FIELD, DETAILS_FIELD, CHANGE_SET_ID_FIELD, MODULE_INFO_FIELD)); private static final long serialVersionUID = 1L; private final String action; private final String logicalResourceId; private final String physicalResourceId; private final String resourceType; private final String replacement; private final List scope; private final List details; private final String changeSetId; private final ModuleInfo moduleInfo; private ResourceChange(BuilderImpl builder) { this.action = builder.action; this.logicalResourceId = builder.logicalResourceId; this.physicalResourceId = builder.physicalResourceId; this.resourceType = builder.resourceType; this.replacement = builder.replacement; this.scope = builder.scope; this.details = builder.details; this.changeSetId = builder.changeSetId; this.moduleInfo = builder.moduleInfo; } /** *

* The action that AWS CloudFormation takes on the resource, such as Add (adds a new resource), * Modify (changes a resource), Remove (deletes a resource), Import (imports * a resource), or Dynamic (exact action for the resource cannot be determined). *

*

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

* * @return The action that AWS CloudFormation takes on the resource, such as Add (adds a new resource), * Modify (changes a resource), Remove (deletes a resource), Import * (imports a resource), or Dynamic (exact action for the resource cannot be determined). * @see ChangeAction */ public final ChangeAction action() { return ChangeAction.fromValue(action); } /** *

* The action that AWS CloudFormation takes on the resource, such as Add (adds a new resource), * Modify (changes a resource), Remove (deletes a resource), Import (imports * a resource), or Dynamic (exact action for the resource cannot be determined). *

*

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

* * @return The action that AWS CloudFormation takes on the resource, such as Add (adds a new resource), * Modify (changes a resource), Remove (deletes a resource), Import * (imports a resource), or Dynamic (exact action for the resource cannot be determined). * @see ChangeAction */ public final String actionAsString() { return action; } /** *

* The resource's logical ID, which is defined in the stack's template. *

* * @return The resource's logical ID, which is defined in the stack's template. */ public final String logicalResourceId() { return logicalResourceId; } /** *

* The resource's physical ID (resource name). Resources that you are adding don't have physical IDs because they * haven't been created. *

* * @return The resource's physical ID (resource name). Resources that you are adding don't have physical IDs because * they haven't been created. */ public final String physicalResourceId() { return physicalResourceId; } /** *

* The type of AWS CloudFormation resource, such as AWS::S3::Bucket. *

* * @return The type of AWS CloudFormation resource, such as AWS::S3::Bucket. */ public final String resourceType() { return resourceType; } /** *

* For the Modify action, indicates whether AWS CloudFormation will replace the resource by creating a * new one and deleting the old one. This value depends on the value of the RequiresRecreation property * in the ResourceTargetDefinition structure. For example, if the RequiresRecreation field * is Always and the Evaluation field is Static, Replacement is * True. If the RequiresRecreation field is Always and the * Evaluation field is Dynamic, Replacement is Conditionally. *

*

* If you have multiple changes with different RequiresRecreation values, the Replacement * value depends on the change with the most impact. A RequiresRecreation value of Always * has the most impact, followed by Conditionally, and then Never. *

*

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

* * @return For the Modify action, indicates whether AWS CloudFormation will replace the resource by * creating a new one and deleting the old one. This value depends on the value of the * RequiresRecreation property in the ResourceTargetDefinition structure. For * example, if the RequiresRecreation field is Always and the * Evaluation field is Static, Replacement is True. If * the RequiresRecreation field is Always and the Evaluation field is * Dynamic, Replacement is Conditionally.

*

* If you have multiple changes with different RequiresRecreation values, the * Replacement value depends on the change with the most impact. A * RequiresRecreation value of Always has the most impact, followed by * Conditionally, and then Never. * @see Replacement */ public final Replacement replacement() { return Replacement.fromValue(replacement); } /** *

* For the Modify action, indicates whether AWS CloudFormation will replace the resource by creating a * new one and deleting the old one. This value depends on the value of the RequiresRecreation property * in the ResourceTargetDefinition structure. For example, if the RequiresRecreation field * is Always and the Evaluation field is Static, Replacement is * True. If the RequiresRecreation field is Always and the * Evaluation field is Dynamic, Replacement is Conditionally. *

*

* If you have multiple changes with different RequiresRecreation values, the Replacement * value depends on the change with the most impact. A RequiresRecreation value of Always * has the most impact, followed by Conditionally, and then Never. *

*

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

* * @return For the Modify action, indicates whether AWS CloudFormation will replace the resource by * creating a new one and deleting the old one. This value depends on the value of the * RequiresRecreation property in the ResourceTargetDefinition structure. For * example, if the RequiresRecreation field is Always and the * Evaluation field is Static, Replacement is True. If * the RequiresRecreation field is Always and the Evaluation field is * Dynamic, Replacement is Conditionally.

*

* If you have multiple changes with different RequiresRecreation values, the * Replacement value depends on the change with the most impact. A * RequiresRecreation value of Always has the most impact, followed by * Conditionally, and then Never. * @see Replacement */ public final String replacementAsString() { return replacement; } /** *

* For the Modify action, indicates which resource attribute is triggering this update, such as a * change in the resource attribute's Metadata, Properties, or Tags. *

*

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

*

* You can use {@link #hasScope()} to see if a value was sent in this field. *

* * @return For the Modify action, indicates which resource attribute is triggering this update, such as * a change in the resource attribute's Metadata, Properties, or Tags * . */ public final List scope() { return ScopeCopier.copyStringToEnum(scope); } /** * Returns true if the Scope property was specified by the sender (it may be empty), or false if the sender did not * specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasScope() { return scope != null && !(scope instanceof SdkAutoConstructList); } /** *

* For the Modify action, indicates which resource attribute is triggering this update, such as a * change in the resource attribute's Metadata, Properties, or Tags. *

*

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

*

* You can use {@link #hasScope()} to see if a value was sent in this field. *

* * @return For the Modify action, indicates which resource attribute is triggering this update, such as * a change in the resource attribute's Metadata, Properties, or Tags * . */ public final List scopeAsStrings() { return scope; } /** * Returns true if the Details property was specified by the sender (it may be empty), or false if the sender did * not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasDetails() { return details != null && !(details instanceof SdkAutoConstructList); } /** *

* For the Modify action, a list of ResourceChangeDetail structures that describes the * changes that AWS CloudFormation will make to the resource. *

*

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

*

* You can use {@link #hasDetails()} to see if a value was sent in this field. *

* * @return For the Modify action, a list of ResourceChangeDetail structures that describes * the changes that AWS CloudFormation will make to the resource. */ public final List details() { return details; } /** *

* The change set ID of the nested change set. *

* * @return The change set ID of the nested change set. */ public final String changeSetId() { return changeSetId; } /** *

* 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(actionAsString()); hashCode = 31 * hashCode + Objects.hashCode(logicalResourceId()); hashCode = 31 * hashCode + Objects.hashCode(physicalResourceId()); hashCode = 31 * hashCode + Objects.hashCode(resourceType()); hashCode = 31 * hashCode + Objects.hashCode(replacementAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasScope() ? scopeAsStrings() : null); hashCode = 31 * hashCode + Objects.hashCode(hasDetails() ? details() : null); hashCode = 31 * hashCode + Objects.hashCode(changeSetId()); 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 ResourceChange)) { return false; } ResourceChange other = (ResourceChange) obj; return Objects.equals(actionAsString(), other.actionAsString()) && Objects.equals(logicalResourceId(), other.logicalResourceId()) && Objects.equals(physicalResourceId(), other.physicalResourceId()) && Objects.equals(resourceType(), other.resourceType()) && Objects.equals(replacementAsString(), other.replacementAsString()) && hasScope() == other.hasScope() && Objects.equals(scopeAsStrings(), other.scopeAsStrings()) && hasDetails() == other.hasDetails() && Objects.equals(details(), other.details()) && Objects.equals(changeSetId(), other.changeSetId()) && 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("ResourceChange").add("Action", actionAsString()).add("LogicalResourceId", logicalResourceId()) .add("PhysicalResourceId", physicalResourceId()).add("ResourceType", resourceType()) .add("Replacement", replacementAsString()).add("Scope", hasScope() ? scopeAsStrings() : null) .add("Details", hasDetails() ? details() : null).add("ChangeSetId", changeSetId()) .add("ModuleInfo", moduleInfo()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Action": return Optional.ofNullable(clazz.cast(actionAsString())); 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 "Replacement": return Optional.ofNullable(clazz.cast(replacementAsString())); case "Scope": return Optional.ofNullable(clazz.cast(scopeAsStrings())); case "Details": return Optional.ofNullable(clazz.cast(details())); case "ChangeSetId": return Optional.ofNullable(clazz.cast(changeSetId())); 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((ResourceChange) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The action that AWS CloudFormation takes on the resource, such as Add (adds a new resource), * Modify (changes a resource), Remove (deletes a resource), Import * (imports a resource), or Dynamic (exact action for the resource cannot be determined). *

* * @param action * The action that AWS CloudFormation takes on the resource, such as Add (adds a new * resource), Modify (changes a resource), Remove (deletes a resource), * Import (imports a resource), or Dynamic (exact action for the resource * cannot be determined). * @see ChangeAction * @return Returns a reference to this object so that method calls can be chained together. * @see ChangeAction */ Builder action(String action); /** *

* The action that AWS CloudFormation takes on the resource, such as Add (adds a new resource), * Modify (changes a resource), Remove (deletes a resource), Import * (imports a resource), or Dynamic (exact action for the resource cannot be determined). *

* * @param action * The action that AWS CloudFormation takes on the resource, such as Add (adds a new * resource), Modify (changes a resource), Remove (deletes a resource), * Import (imports a resource), or Dynamic (exact action for the resource * cannot be determined). * @see ChangeAction * @return Returns a reference to this object so that method calls can be chained together. * @see ChangeAction */ Builder action(ChangeAction action); /** *

* The resource's logical ID, which is defined in the stack's template. *

* * @param logicalResourceId * The resource's logical ID, which is defined in the stack's template. * @return Returns a reference to this object so that method calls can be chained together. */ Builder logicalResourceId(String logicalResourceId); /** *

* The resource's physical ID (resource name). Resources that you are adding don't have physical IDs because * they haven't been created. *

* * @param physicalResourceId * The resource's physical ID (resource name). Resources that you are adding don't have physical IDs * because they haven't been created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder physicalResourceId(String physicalResourceId); /** *

* The type of AWS CloudFormation resource, such as AWS::S3::Bucket. *

* * @param resourceType * The type of AWS CloudFormation resource, such as AWS::S3::Bucket. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceType(String resourceType); /** *

* For the Modify action, indicates whether AWS CloudFormation will replace the resource by * creating a new one and deleting the old one. This value depends on the value of the * RequiresRecreation property in the ResourceTargetDefinition structure. For example, * if the RequiresRecreation field is Always and the Evaluation field is * Static, Replacement is True. If the RequiresRecreation * field is Always and the Evaluation field is Dynamic, * Replacement is Conditionally. *

*

* If you have multiple changes with different RequiresRecreation values, the * Replacement value depends on the change with the most impact. A RequiresRecreation * value of Always has the most impact, followed by Conditionally, and then * Never. *

* * @param replacement * For the Modify action, indicates whether AWS CloudFormation will replace the resource by * creating a new one and deleting the old one. This value depends on the value of the * RequiresRecreation property in the ResourceTargetDefinition structure. For * example, if the RequiresRecreation field is Always and the * Evaluation field is Static, Replacement is True. * If the RequiresRecreation field is Always and the Evaluation * field is Dynamic, Replacement is Conditionally.

*

* If you have multiple changes with different RequiresRecreation values, the * Replacement value depends on the change with the most impact. A * RequiresRecreation value of Always has the most impact, followed by * Conditionally, and then Never. * @see Replacement * @return Returns a reference to this object so that method calls can be chained together. * @see Replacement */ Builder replacement(String replacement); /** *

* For the Modify action, indicates whether AWS CloudFormation will replace the resource by * creating a new one and deleting the old one. This value depends on the value of the * RequiresRecreation property in the ResourceTargetDefinition structure. For example, * if the RequiresRecreation field is Always and the Evaluation field is * Static, Replacement is True. If the RequiresRecreation * field is Always and the Evaluation field is Dynamic, * Replacement is Conditionally. *

*

* If you have multiple changes with different RequiresRecreation values, the * Replacement value depends on the change with the most impact. A RequiresRecreation * value of Always has the most impact, followed by Conditionally, and then * Never. *

* * @param replacement * For the Modify action, indicates whether AWS CloudFormation will replace the resource by * creating a new one and deleting the old one. This value depends on the value of the * RequiresRecreation property in the ResourceTargetDefinition structure. For * example, if the RequiresRecreation field is Always and the * Evaluation field is Static, Replacement is True. * If the RequiresRecreation field is Always and the Evaluation * field is Dynamic, Replacement is Conditionally.

*

* If you have multiple changes with different RequiresRecreation values, the * Replacement value depends on the change with the most impact. A * RequiresRecreation value of Always has the most impact, followed by * Conditionally, and then Never. * @see Replacement * @return Returns a reference to this object so that method calls can be chained together. * @see Replacement */ Builder replacement(Replacement replacement); /** *

* For the Modify action, indicates which resource attribute is triggering this update, such as a * change in the resource attribute's Metadata, Properties, or Tags. *

* * @param scope * For the Modify action, indicates which resource attribute is triggering this update, such * as a change in the resource attribute's Metadata, Properties, or * Tags. * @return Returns a reference to this object so that method calls can be chained together. */ Builder scopeWithStrings(Collection scope); /** *

* For the Modify action, indicates which resource attribute is triggering this update, such as a * change in the resource attribute's Metadata, Properties, or Tags. *

* * @param scope * For the Modify action, indicates which resource attribute is triggering this update, such * as a change in the resource attribute's Metadata, Properties, or * Tags. * @return Returns a reference to this object so that method calls can be chained together. */ Builder scopeWithStrings(String... scope); /** *

* For the Modify action, indicates which resource attribute is triggering this update, such as a * change in the resource attribute's Metadata, Properties, or Tags. *

* * @param scope * For the Modify action, indicates which resource attribute is triggering this update, such * as a change in the resource attribute's Metadata, Properties, or * Tags. * @return Returns a reference to this object so that method calls can be chained together. */ Builder scope(Collection scope); /** *

* For the Modify action, indicates which resource attribute is triggering this update, such as a * change in the resource attribute's Metadata, Properties, or Tags. *

* * @param scope * For the Modify action, indicates which resource attribute is triggering this update, such * as a change in the resource attribute's Metadata, Properties, or * Tags. * @return Returns a reference to this object so that method calls can be chained together. */ Builder scope(ResourceAttribute... scope); /** *

* For the Modify action, a list of ResourceChangeDetail structures that describes the * changes that AWS CloudFormation will make to the resource. *

* * @param details * For the Modify action, a list of ResourceChangeDetail structures that * describes the changes that AWS CloudFormation will make to the resource. * @return Returns a reference to this object so that method calls can be chained together. */ Builder details(Collection details); /** *

* For the Modify action, a list of ResourceChangeDetail structures that describes the * changes that AWS CloudFormation will make to the resource. *

* * @param details * For the Modify action, a list of ResourceChangeDetail structures that * describes the changes that AWS CloudFormation will make to the resource. * @return Returns a reference to this object so that method calls can be chained together. */ Builder details(ResourceChangeDetail... details); /** *

* For the Modify action, a list of ResourceChangeDetail structures that describes the * changes that AWS CloudFormation will make to the resource. *

* 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 #details(List)}. * * @param details * 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 #details(List) */ Builder details(Consumer... details); /** *

* The change set ID of the nested change set. *

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

* 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 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 action; private String logicalResourceId; private String physicalResourceId; private String resourceType; private String replacement; private List scope = DefaultSdkAutoConstructList.getInstance(); private List details = DefaultSdkAutoConstructList.getInstance(); private String changeSetId; private ModuleInfo moduleInfo; private BuilderImpl() { } private BuilderImpl(ResourceChange model) { action(model.action); logicalResourceId(model.logicalResourceId); physicalResourceId(model.physicalResourceId); resourceType(model.resourceType); replacement(model.replacement); scopeWithStrings(model.scope); details(model.details); changeSetId(model.changeSetId); moduleInfo(model.moduleInfo); } public final String getAction() { return action; } @Override public final Builder action(String action) { this.action = action; return this; } @Override public final Builder action(ChangeAction action) { this.action(action == null ? null : action.toString()); return this; } public final void setAction(String action) { this.action = action; } 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 String getReplacement() { return replacement; } @Override public final Builder replacement(String replacement) { this.replacement = replacement; return this; } @Override public final Builder replacement(Replacement replacement) { this.replacement(replacement == null ? null : replacement.toString()); return this; } public final void setReplacement(String replacement) { this.replacement = replacement; } public final Collection getScope() { if (scope instanceof SdkAutoConstructList) { return null; } return scope; } @Override public final Builder scopeWithStrings(Collection scope) { this.scope = ScopeCopier.copy(scope); return this; } @Override @SafeVarargs public final Builder scopeWithStrings(String... scope) { scopeWithStrings(Arrays.asList(scope)); return this; } @Override public final Builder scope(Collection scope) { this.scope = ScopeCopier.copyEnumToString(scope); return this; } @Override @SafeVarargs public final Builder scope(ResourceAttribute... scope) { scope(Arrays.asList(scope)); return this; } public final void setScope(Collection scope) { this.scope = ScopeCopier.copy(scope); } public final Collection getDetails() { if (details instanceof SdkAutoConstructList) { return null; } return details != null ? details.stream().map(ResourceChangeDetail::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder details(Collection details) { this.details = ResourceChangeDetailsCopier.copy(details); return this; } @Override @SafeVarargs public final Builder details(ResourceChangeDetail... details) { details(Arrays.asList(details)); return this; } @Override @SafeVarargs public final Builder details(Consumer... details) { details(Stream.of(details).map(c -> ResourceChangeDetail.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setDetails(Collection details) { this.details = ResourceChangeDetailsCopier.copyFromBuilder(details); } public final String getChangeSetId() { return changeSetId; } @Override public final Builder changeSetId(String changeSetId) { this.changeSetId = changeSetId; return this; } public final void setChangeSetId(String changeSetId) { this.changeSetId = changeSetId; } public final ModuleInfo.Builder getModuleInfo() { return moduleInfo != null ? moduleInfo.toBuilder() : null; } @Override public final Builder moduleInfo(ModuleInfo moduleInfo) { this.moduleInfo = moduleInfo; return this; } public final void setModuleInfo(ModuleInfo.BuilderImpl moduleInfo) { this.moduleInfo = moduleInfo != null ? moduleInfo.build() : null; } @Override public ResourceChange build() { return new ResourceChange(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy