/** * <p> * The name or the unique stack ID that is associated with the stack. * </p> * * @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; }
@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()); hashCode = prime * hashCode + ((getRoleARN() == null) ? 0 : getRoleARN().hashCode()); hashCode = prime * hashCode + ((getClientRequestToken() == null) ? 0 : getClientRequestToken().hashCode()); return hashCode; }
@TaskAction public void deleteStack() { DeleteStackRequest deleteStackRequest = new DeleteStackRequest(); deleteStackRequest.withStackName(stackName); client.deleteStack(deleteStackRequest); } }
@Override protected Object executeInternal() throws Exception { shouldFailIfMissingStack(failIfMissing); getService().deleteStack(new DeleteStackRequest().withStackName(this.stackName).withRetainResources(retainResources)); WaitForStackCommand.WaitForStackContext ctx = new WaitForStackCommand.WaitForStackContext(this.stackName, getService(), this, 30, asList(StackStatus.DELETE_COMPLETE)); new WaitForStackCommand(ctx).execute(); return null; } }
DeleteStackRequest request = new DeleteStackRequest(); request.setStackName(<stack_name_to_be_deleted>); AmazonCloudFormationClient client = new AmazonCloudFormationClient (<credentials>); client.deleteStack(request);
public void deleteStack(String stackName) { logger.info("Delete stack '{}'", stackName); cloudFormation.deleteStack(new DeleteStackRequest().withStackName(stackName)); } }
.withRegion(region) .build(); DeleteStackRequest deleteStackRequest = new DeleteStackRequest(); deleteStackRequest.setStackName(stackName); stackdestroy.deleteStack(deleteStackRequest); logger.info(StringUtil.concatStrings("Stack : ", stackName, " is handed over for deletion!"));
private void deleteStack(AmazonCloudFormation cfn) throws InterruptedException { // to enable conventionMappings feature String stackName = getStackName(); getLogger().info("delete stack: {}", stackName); cfn.deleteStack(new DeleteStackRequest().withStackName(stackName)); getLogger().info("delete requested: {}", stackName); Thread.sleep(3000); }
@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; if (other.getRoleARN() == null ^ this.getRoleARN() == null) return false; if (other.getRoleARN() != null && other.getRoleARN().equals(this.getRoleARN()) == false) return false; if (other.getClientRequestToken() == null ^ this.getClientRequestToken() == null) return false; if (other.getClientRequestToken() != null && other.getClientRequestToken().equals(this.getClientRequestToken()) == false) return false; return true; }
/** * <p> * The name or the unique stack ID that is associated with the stack. * </p> * * @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; }
public void delete(PollConfiguration pollConfiguration) throws ExecutionException { this.client.deleteStack(new DeleteStackRequest().withStackName(this.stack)); new EventPrinter(this.client, this.listener).waitAndPrintStackEvents(this.stack, this.client.waiters().stackDeleteComplete(), pollConfiguration); }
/** * 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 (getStackName() != null) sb.append("StackName: ").append(getStackName()).append(","); if (getRetainResources() != null) sb.append("RetainResources: ").append(getRetainResources()).append(","); if (getRoleARN() != null) sb.append("RoleARN: ").append(getRoleARN()).append(","); if (getClientRequestToken() != null) sb.append("ClientRequestToken: ").append(getClientRequestToken()); sb.append("}"); return sb.toString(); }
@TaskAction public void deleteStack() { // to enable conventionMappings feature String stackName = getStackName(); if (stackName == null) { throw new GradleException("stackName is not specified"); } AmazonCloudFormationPluginExtension ext = getProject().getExtensions().getByType(AmazonCloudFormationPluginExtension.class); AmazonCloudFormation cfn = ext.getClient(); cfn.deleteStack(new DeleteStackRequest().withStackName(stackName)); getLogger().info("delete stack " + stackName + " requested"); } }
request.setHttpMethod(HttpMethodName.POST); if (deleteStackRequest.getStackName() != null) { request.addParameter("StackName", StringUtils.fromString(deleteStackRequest.getStackName())); if (deleteStackRequest.getRetainResources().isEmpty() && !((com.amazonaws.internal.SdkInternalList<String>) deleteStackRequest.getRetainResources()).isAutoConstruct()) { request.addParameter("RetainResources", ""); if (!deleteStackRequest.getRetainResources().isEmpty() || !((com.amazonaws.internal.SdkInternalList<String>) deleteStackRequest.getRetainResources()).isAutoConstruct()) { com.amazonaws.internal.SdkInternalList<String> retainResourcesList = (com.amazonaws.internal.SdkInternalList<String>) deleteStackRequest .getRetainResources(); int retainResourcesListIndex = 1; if (deleteStackRequest.getRoleARN() != null) { request.addParameter("RoleARN", StringUtils.fromString(deleteStackRequest.getRoleARN())); if (deleteStackRequest.getClientRequestToken() != null) { request.addParameter("ClientRequestToken", StringUtils.fromString(deleteStackRequest.getClientRequestToken()));
/** * @return */ public boolean delete() { if (isPrefixSelected) { stackName = getOldestStackNameWithPrefix(); } logger.println("Deleting Cloud Formation stack: " + getExpandedStackName()); DeleteStackRequest deleteStackRequest = new DeleteStackRequest(); deleteStackRequest.withStackName(getExpandedStackName()); amazonClient.deleteStack(deleteStackRequest); boolean result = waitForStackToBeDeleted(); logger.println("Cloud Formation stack: " + getExpandedStackName() + (result ? " deleted successfully" : " failed deleting.")); return result; }
@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()); hashCode = prime * hashCode + ((getRoleARN() == null) ? 0 : getRoleARN().hashCode()); hashCode = prime * hashCode + ((getClientRequestToken() == null) ? 0 : getClientRequestToken().hashCode()); return hashCode; }
public void execute() { checkParams(); AmazonEC2Client ec2Client = getOrCreateClient(AmazonEC2Client.class); ec2Client .deleteKeyPair(new DeleteKeyPairRequest().withKeyName(keyName)); AmazonCloudFormationClient cloudFormationClient = getOrCreateClient(AmazonCloudFormationClient.class); cloudFormationClient.deleteStack(new DeleteStackRequest() .withStackName(stackName)); } }
@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; if (other.getRoleARN() == null ^ this.getRoleARN() == null) return false; if (other.getRoleARN() != null && other.getRoleARN().equals(this.getRoleARN()) == false) return false; if (other.getClientRequestToken() == null ^ this.getClientRequestToken() == null) return false; if (other.getClientRequestToken() != null && other.getClientRequestToken().equals(this.getClientRequestToken()) == false) return false; return true; }
DeleteStackRequest deleteRequest = new DeleteStackRequest() .withStackName(stackName);
/** * 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 (getStackName() != null) sb.append("StackName: ").append(getStackName()).append(","); if (getRetainResources() != null) sb.append("RetainResources: ").append(getRetainResources()).append(","); if (getRoleARN() != null) sb.append("RoleARN: ").append(getRoleARN()).append(","); if (getClientRequestToken() != null) sb.append("ClientRequestToken: ").append(getClientRequestToken()); sb.append("}"); return sb.toString(); }