Example usage for com.amazonaws.services.cloudformation.model StackStatus CREATE_IN_PROGRESS

List of usage examples for com.amazonaws.services.cloudformation.model StackStatus CREATE_IN_PROGRESS

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudformation.model StackStatus CREATE_IN_PROGRESS.

Prototype

StackStatus CREATE_IN_PROGRESS

To view the source code for com.amazonaws.services.cloudformation.model StackStatus CREATE_IN_PROGRESS.

Click Source Link

Usage

From source file:com.tvarit.plugin.StackMaker.java

License:Open Source License

public Stack makeStack(CreateStackRequest createStackRequest,
        AmazonCloudFormationClient amazonCloudFormationClient, Log log) throws MojoFailureException {

    CreateStackResult createStackResult = amazonCloudFormationClient.createStack(createStackRequest);
    final String stackName = createStackRequest.getStackName();
    DescribeStacksResult describeStacksResult = amazonCloudFormationClient
            .describeStacks(new DescribeStacksRequest().withStackName(stackName));
    while (describeStacksResult.getStacks().get(0).getStackStatus()
            .equals(StackStatus.CREATE_IN_PROGRESS.toString())) {
        try {//from   w  ww  .jav  a  2 s  .c  o  m
            log.info("Awaiting stack create completion!");
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            log.error(e);
            throw new RuntimeException(e);
        }
        describeStacksResult = amazonCloudFormationClient
                .describeStacks(new DescribeStacksRequest().withStackName(stackName));
    }
    final Stack stack = describeStacksResult.getStacks().get(0);

    final String stackStatus = stack.getStackStatus();
    if (!stackStatus.equals(StackStatus.CREATE_COMPLETE.toString())) {
        throw new MojoFailureException("Could not create infrastructure. Stack Status is: " + stackStatus
                + ". Please review details on the AWS console and open a new github issue on https://github.com/sdole/tvarit-maven/issues/new that is needed.");
    }
    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;
}