com.amazonaws.services.servicecatalog.model.ResourceChange Maven / Gradle / Ivy
/*
* Copyright 2019-2024 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 com.amazonaws.services.servicecatalog.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Information about a resource change that will occur when a plan is executed.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ResourceChange implements Serializable, Cloneable, StructuredPojo {
/**
*
* The change action.
*
*/
private String action;
/**
*
* The ID of the resource, as defined in the CloudFormation template.
*
*/
private String logicalResourceId;
/**
*
* The ID of the resource, if it was already created.
*
*/
private String physicalResourceId;
/**
*
* The type of resource.
*
*/
private String resourceType;
/**
*
* If the change type is Modify
, indicates whether the existing resource is deleted and replaced with a
* new one.
*
*/
private String replacement;
/**
*
* The change scope.
*
*/
private java.util.List scope;
/**
*
* Information about the resource changes.
*
*/
private java.util.List details;
/**
*
* The change action.
*
*
* @param action
* The change action.
* @see ChangeAction
*/
public void setAction(String action) {
this.action = action;
}
/**
*
* The change action.
*
*
* @return The change action.
* @see ChangeAction
*/
public String getAction() {
return this.action;
}
/**
*
* The change action.
*
*
* @param action
* The change action.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ChangeAction
*/
public ResourceChange withAction(String action) {
setAction(action);
return this;
}
/**
*
* The change action.
*
*
* @param action
* The change action.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ChangeAction
*/
public ResourceChange withAction(ChangeAction action) {
this.action = action.toString();
return this;
}
/**
*
* The ID of the resource, as defined in the CloudFormation template.
*
*
* @param logicalResourceId
* The ID of the resource, as defined in the CloudFormation template.
*/
public void setLogicalResourceId(String logicalResourceId) {
this.logicalResourceId = logicalResourceId;
}
/**
*
* The ID of the resource, as defined in the CloudFormation template.
*
*
* @return The ID of the resource, as defined in the CloudFormation template.
*/
public String getLogicalResourceId() {
return this.logicalResourceId;
}
/**
*
* The ID of the resource, as defined in the CloudFormation template.
*
*
* @param logicalResourceId
* The ID of the resource, as defined in the CloudFormation template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResourceChange withLogicalResourceId(String logicalResourceId) {
setLogicalResourceId(logicalResourceId);
return this;
}
/**
*
* The ID of the resource, if it was already created.
*
*
* @param physicalResourceId
* The ID of the resource, if it was already created.
*/
public void setPhysicalResourceId(String physicalResourceId) {
this.physicalResourceId = physicalResourceId;
}
/**
*
* The ID of the resource, if it was already created.
*
*
* @return The ID of the resource, if it was already created.
*/
public String getPhysicalResourceId() {
return this.physicalResourceId;
}
/**
*
* The ID of the resource, if it was already created.
*
*
* @param physicalResourceId
* The ID of the resource, if it was already created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResourceChange withPhysicalResourceId(String physicalResourceId) {
setPhysicalResourceId(physicalResourceId);
return this;
}
/**
*
* The type of resource.
*
*
* @param resourceType
* The type of resource.
*/
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
/**
*
* The type of resource.
*
*
* @return The type of resource.
*/
public String getResourceType() {
return this.resourceType;
}
/**
*
* The type of resource.
*
*
* @param resourceType
* The type of resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResourceChange withResourceType(String resourceType) {
setResourceType(resourceType);
return this;
}
/**
*
* If the change type is Modify
, indicates whether the existing resource is deleted and replaced with a
* new one.
*
*
* @param replacement
* If the change type is Modify
, indicates whether the existing resource is deleted and replaced
* with a new one.
* @see Replacement
*/
public void setReplacement(String replacement) {
this.replacement = replacement;
}
/**
*
* If the change type is Modify
, indicates whether the existing resource is deleted and replaced with a
* new one.
*
*
* @return If the change type is Modify
, indicates whether the existing resource is deleted and
* replaced with a new one.
* @see Replacement
*/
public String getReplacement() {
return this.replacement;
}
/**
*
* If the change type is Modify
, indicates whether the existing resource is deleted and replaced with a
* new one.
*
*
* @param replacement
* If the change type is Modify
, indicates whether the existing resource is deleted and replaced
* with a new one.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Replacement
*/
public ResourceChange withReplacement(String replacement) {
setReplacement(replacement);
return this;
}
/**
*
* If the change type is Modify
, indicates whether the existing resource is deleted and replaced with a
* new one.
*
*
* @param replacement
* If the change type is Modify
, indicates whether the existing resource is deleted and replaced
* with a new one.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Replacement
*/
public ResourceChange withReplacement(Replacement replacement) {
this.replacement = replacement.toString();
return this;
}
/**
*
* The change scope.
*
*
* @return The change scope.
* @see ResourceAttribute
*/
public java.util.List getScope() {
return scope;
}
/**
*
* The change scope.
*
*
* @param scope
* The change scope.
* @see ResourceAttribute
*/
public void setScope(java.util.Collection scope) {
if (scope == null) {
this.scope = null;
return;
}
this.scope = new java.util.ArrayList(scope);
}
/**
*
* The change scope.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setScope(java.util.Collection)} or {@link #withScope(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param scope
* The change scope.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceAttribute
*/
public ResourceChange withScope(String... scope) {
if (this.scope == null) {
setScope(new java.util.ArrayList(scope.length));
}
for (String ele : scope) {
this.scope.add(ele);
}
return this;
}
/**
*
* The change scope.
*
*
* @param scope
* The change scope.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceAttribute
*/
public ResourceChange withScope(java.util.Collection scope) {
setScope(scope);
return this;
}
/**
*
* The change scope.
*
*
* @param scope
* The change scope.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceAttribute
*/
public ResourceChange withScope(ResourceAttribute... scope) {
java.util.ArrayList scopeCopy = new java.util.ArrayList(scope.length);
for (ResourceAttribute value : scope) {
scopeCopy.add(value.toString());
}
if (getScope() == null) {
setScope(scopeCopy);
} else {
getScope().addAll(scopeCopy);
}
return this;
}
/**
*
* Information about the resource changes.
*
*
* @return Information about the resource changes.
*/
public java.util.List getDetails() {
return details;
}
/**
*
* Information about the resource changes.
*
*
* @param details
* Information about the resource changes.
*/
public void setDetails(java.util.Collection details) {
if (details == null) {
this.details = null;
return;
}
this.details = new java.util.ArrayList(details);
}
/**
*
* Information about the resource changes.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setDetails(java.util.Collection)} or {@link #withDetails(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param details
* Information about the resource changes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResourceChange withDetails(ResourceChangeDetail... details) {
if (this.details == null) {
setDetails(new java.util.ArrayList(details.length));
}
for (ResourceChangeDetail ele : details) {
this.details.add(ele);
}
return this;
}
/**
*
* Information about the resource changes.
*
*
* @param details
* Information about the resource changes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResourceChange withDetails(java.util.Collection details) {
setDetails(details);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getAction() != null)
sb.append("Action: ").append(getAction()).append(",");
if (getLogicalResourceId() != null)
sb.append("LogicalResourceId: ").append(getLogicalResourceId()).append(",");
if (getPhysicalResourceId() != null)
sb.append("PhysicalResourceId: ").append(getPhysicalResourceId()).append(",");
if (getResourceType() != null)
sb.append("ResourceType: ").append(getResourceType()).append(",");
if (getReplacement() != null)
sb.append("Replacement: ").append(getReplacement()).append(",");
if (getScope() != null)
sb.append("Scope: ").append(getScope()).append(",");
if (getDetails() != null)
sb.append("Details: ").append(getDetails());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ResourceChange == false)
return false;
ResourceChange other = (ResourceChange) obj;
if (other.getAction() == null ^ this.getAction() == null)
return false;
if (other.getAction() != null && other.getAction().equals(this.getAction()) == false)
return false;
if (other.getLogicalResourceId() == null ^ this.getLogicalResourceId() == null)
return false;
if (other.getLogicalResourceId() != null && other.getLogicalResourceId().equals(this.getLogicalResourceId()) == false)
return false;
if (other.getPhysicalResourceId() == null ^ this.getPhysicalResourceId() == null)
return false;
if (other.getPhysicalResourceId() != null && other.getPhysicalResourceId().equals(this.getPhysicalResourceId()) == false)
return false;
if (other.getResourceType() == null ^ this.getResourceType() == null)
return false;
if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == false)
return false;
if (other.getReplacement() == null ^ this.getReplacement() == null)
return false;
if (other.getReplacement() != null && other.getReplacement().equals(this.getReplacement()) == false)
return false;
if (other.getScope() == null ^ this.getScope() == null)
return false;
if (other.getScope() != null && other.getScope().equals(this.getScope()) == false)
return false;
if (other.getDetails() == null ^ this.getDetails() == null)
return false;
if (other.getDetails() != null && other.getDetails().equals(this.getDetails()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAction() == null) ? 0 : getAction().hashCode());
hashCode = prime * hashCode + ((getLogicalResourceId() == null) ? 0 : getLogicalResourceId().hashCode());
hashCode = prime * hashCode + ((getPhysicalResourceId() == null) ? 0 : getPhysicalResourceId().hashCode());
hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode());
hashCode = prime * hashCode + ((getReplacement() == null) ? 0 : getReplacement().hashCode());
hashCode = prime * hashCode + ((getScope() == null) ? 0 : getScope().hashCode());
hashCode = prime * hashCode + ((getDetails() == null) ? 0 : getDetails().hashCode());
return hashCode;
}
@Override
public ResourceChange clone() {
try {
return (ResourceChange) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.servicecatalog.model.transform.ResourceChangeMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}