List of usage examples for com.amazonaws.services.cloudformation.model StackStatus DELETE_COMPLETE
StackStatus DELETE_COMPLETE
To view the source code for com.amazonaws.services.cloudformation.model StackStatus DELETE_COMPLETE.
Click Source Link
From source file:br.com.ingenieux.mojo.cloudformation.DeleteStackMojo.java
License:Apache License
@Override protected Object executeInternal() throws Exception { shouldFailIfMissingStack(failIfMissing); getService().deleteStack(/*from w ww.j a v a 2 s. c o m*/ 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; }
From source file:com.carrotgarden.maven.aws.cfn.CarrotCloudForm.java
License:BSD License
private Stack waitForStackDelete() throws Exception { final long timeStart = System.currentTimeMillis(); while (true) { if (isTimeoutPending(timeStart)) { return newStackWithStatus(StackStatus.DELETE_FAILED, "stack delete timeout"); }//from w w w . j av a2 s .c o m Stack stack = null; try { stack = findStack(); } catch (final Exception e) { return newStackWithStatus(StackStatus.DELETE_FAILED, e.toString()); } if (!isStackValid(stack)) { return newStackWithStatus(StackStatus.DELETE_COMPLETE, "stack delete invalid/missing"); } final StackStatus status = StackStatus.fromValue(stack.getStackStatus()); switch (status) { case DELETE_IN_PROGRESS: final long timeCurrent = System.currentTimeMillis(); final long timeDiff = timeCurrent - timeStart; logger.info("stack delete in progress; time=" + timeDiff / 1000); sleep(); continue; case DELETE_COMPLETE: logger.info("stack delete complete"); printStackEvents(); return stack; default: logger.error("stack delete failed"); return stack; } } }
From source file:jetbrains.buildServer.runner.cloudformation.AWSClient.java
License:Apache License
@NotNull private String getHumanReadableStatus(@NotNull String status) { if (StackStatus.CREATE_IN_PROGRESS.toString().equals(status)) return "launching"; if (StackStatus.UPDATE_IN_PROGRESS.toString().equals(status)) return "updating"; if (StackStatus.CREATE_COMPLETE.toString().equals(status)) return "ready"; if (StackStatus.DELETE_COMPLETE.toString().equals(status)) return "terminated"; if (StackStatus.DELETE_IN_PROGRESS.toString().equals(status)) return "terminating"; return CloudFormationConstants.STATUS_IS_UNKNOWN; }
From source file:org.springframework.cloud.stream.app.aws.AwsIntegrationTestStackRule.java
License:Apache License
private void waitForCompletion() throws InterruptedException { DescribeStacksRequest wait = new DescribeStacksRequest(); wait.setStackName(this.stackName); Boolean completed = false;/*from ww w .j av a2 s .co m*/ String stackStatus = "Unknown"; String stackReason = ""; while (!completed) { List<Stack> stacks = null; try { stacks = this.cloudFormation.describeStacks(wait).getStacks(); } catch (Exception e) { logger.error("cloudFormation.describeStacks() exception", e); } if (CollectionUtils.isEmpty(stacks)) { completed = true; stackStatus = StackStatus.DELETE_COMPLETE.toString(); stackReason = "Stack has been deleted"; } else { for (Stack stack : stacks) { if (stack.getStackStatus().equals(StackStatus.CREATE_COMPLETE.toString()) || stack.getStackStatus().equals(StackStatus.CREATE_FAILED.toString()) || stack.getStackStatus().equals(StackStatus.ROLLBACK_FAILED.toString()) || stack.getStackStatus().equals(StackStatus.DELETE_FAILED.toString())) { completed = true; stackStatus = stack.getStackStatus(); stackReason = stack.getStackStatusReason(); } } } // Not done yet so sleep for 2 seconds. if (!completed) { Thread.sleep(2000); } else { if (stackStatus.equals(StackStatus.CREATE_FAILED.toString())) { Assume.assumeTrue( "The test AWS stack [" + this.stackName + "] cannot be created. Reason: " + stackReason, true); } } } }