
com.amazonaws.services.cloudformation.model.DeleteStackRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-cloudformation Show documentation
/*
* Copyright 2010-2016 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.cloudformation.model;
import java.io.Serializable;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* The input for DeleteStack action.
*
*/
public class DeleteStackRequest extends AmazonWebServiceRequest implements
Serializable, Cloneable {
/**
*
* The name or the unique stack ID that is associated with the stack.
*
*/
private String stackName;
/**
*
* For stacks in the DELETE_FAILED
state, a list of resource
* logical IDs that are associated with the resources you want to retain.
* During deletion, AWS CloudFormation deletes the stack but does not delete
* the retained resources.
*
*
* Retaining resources is useful when you cannot delete a resource, such as
* a non-empty S3 bucket, but you want to delete the stack.
*
*/
private com.amazonaws.internal.SdkInternalList retainResources;
/**
*
* The name or the unique stack ID that is associated with the stack.
*
*
* @param stackName
* The name or the unique stack ID that is associated with the stack.
*/
public void setStackName(String stackName) {
this.stackName = stackName;
}
/**
*
* The name or the unique stack ID that is associated with the stack.
*
*
* @return The name or the unique stack ID that is associated with the
* stack.
*/
public String getStackName() {
return this.stackName;
}
/**
*
* The name or the unique stack ID that is associated with the stack.
*
*
* @param stackName
* The name or the unique stack ID that is associated with the stack.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public DeleteStackRequest withStackName(String stackName) {
setStackName(stackName);
return this;
}
/**
*
* For stacks in the DELETE_FAILED
state, a list of resource
* logical IDs that are associated with the resources you want to retain.
* During deletion, AWS CloudFormation deletes the stack but does not delete
* the retained resources.
*
*
* Retaining resources is useful when you cannot delete a resource, such as
* a non-empty S3 bucket, but you want to delete the stack.
*
*
* @return For stacks in the DELETE_FAILED
state, a list of
* resource logical IDs that are associated with the resources you
* want to retain. During deletion, AWS CloudFormation deletes the
* stack but does not delete the retained resources.
*
* Retaining resources is useful when you cannot delete a resource,
* such as a non-empty S3 bucket, but you want to delete the stack.
*/
public java.util.List getRetainResources() {
if (retainResources == null) {
retainResources = new com.amazonaws.internal.SdkInternalList();
}
return retainResources;
}
/**
*
* For stacks in the DELETE_FAILED
state, a list of resource
* logical IDs that are associated with the resources you want to retain.
* During deletion, AWS CloudFormation deletes the stack but does not delete
* the retained resources.
*
*
* Retaining resources is useful when you cannot delete a resource, such as
* a non-empty S3 bucket, but you want to delete the stack.
*
*
* @param retainResources
* For stacks in the DELETE_FAILED
state, a list of
* resource logical IDs that are associated with the resources you
* want to retain. During deletion, AWS CloudFormation deletes the
* stack but does not delete the retained resources.
*
* Retaining resources is useful when you cannot delete a resource,
* such as a non-empty S3 bucket, but you want to delete the stack.
*/
public void setRetainResources(java.util.Collection retainResources) {
if (retainResources == null) {
this.retainResources = null;
return;
}
this.retainResources = new com.amazonaws.internal.SdkInternalList(
retainResources);
}
/**
*
* For stacks in the DELETE_FAILED
state, a list of resource
* logical IDs that are associated with the resources you want to retain.
* During deletion, AWS CloudFormation deletes the stack but does not delete
* the retained resources.
*
*
* Retaining resources is useful when you cannot delete a resource, such as
* a non-empty S3 bucket, but you want to delete the stack.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setRetainResources(java.util.Collection)} or
* {@link #withRetainResources(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param retainResources
* For stacks in the DELETE_FAILED
state, a list of
* resource logical IDs that are associated with the resources you
* want to retain. During deletion, AWS CloudFormation deletes the
* stack but does not delete the retained resources.
*
* Retaining resources is useful when you cannot delete a resource,
* such as a non-empty S3 bucket, but you want to delete the stack.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public DeleteStackRequest withRetainResources(String... retainResources) {
if (this.retainResources == null) {
setRetainResources(new com.amazonaws.internal.SdkInternalList(
retainResources.length));
}
for (String ele : retainResources) {
this.retainResources.add(ele);
}
return this;
}
/**
*
* For stacks in the DELETE_FAILED
state, a list of resource
* logical IDs that are associated with the resources you want to retain.
* During deletion, AWS CloudFormation deletes the stack but does not delete
* the retained resources.
*
*
* Retaining resources is useful when you cannot delete a resource, such as
* a non-empty S3 bucket, but you want to delete the stack.
*
*
* @param retainResources
* For stacks in the DELETE_FAILED
state, a list of
* resource logical IDs that are associated with the resources you
* want to retain. During deletion, AWS CloudFormation deletes the
* stack but does not delete the retained resources.
*
* Retaining resources is useful when you cannot delete a resource,
* such as a non-empty S3 bucket, but you want to delete the stack.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public DeleteStackRequest withRetainResources(
java.util.Collection retainResources) {
setRetainResources(retainResources);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getStackName() != null)
sb.append("StackName: " + getStackName() + ",");
if (getRetainResources() != null)
sb.append("RetainResources: " + getRetainResources());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DeleteStackRequest == false)
return false;
DeleteStackRequest other = (DeleteStackRequest) obj;
if (other.getStackName() == null ^ this.getStackName() == null)
return false;
if (other.getStackName() != null
&& other.getStackName().equals(this.getStackName()) == false)
return false;
if (other.getRetainResources() == null
^ this.getRetainResources() == null)
return false;
if (other.getRetainResources() != null
&& other.getRetainResources().equals(this.getRetainResources()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getStackName() == null) ? 0 : getStackName().hashCode());
hashCode = prime
* hashCode
+ ((getRetainResources() == null) ? 0 : getRetainResources()
.hashCode());
return hashCode;
}
@Override
public DeleteStackRequest clone() {
return (DeleteStackRequest) super.clone();
}
}