Example usage for com.amazonaws.services.cloudformation.model AmazonCloudFormationException getErrorMessage

List of usage examples for com.amazonaws.services.cloudformation.model AmazonCloudFormationException getErrorMessage

Introduction

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

Prototype

public String getErrorMessage() 

Source Link

Usage

From source file:de.taimos.pipeline.aws.cloudformation.CloudFormationStack.java

License:Apache License

public boolean exists() {
    try {/* ww w.j  a v  a 2  s.c o  m*/
        DescribeStacksResult result = this.client
                .describeStacks(new DescribeStacksRequest().withStackName(this.stack));
        return !result.getStacks().isEmpty();
    } catch (AmazonCloudFormationException e) {
        if ("AccessDenied".equals(e.getErrorCode())) {
            this.listener.getLogger().format("Got error from describeStacks: %s %n", e.getErrorMessage());
            throw e;
        } else if ("ValidationError".equals(e.getErrorCode())
                && e.getErrorMessage().contains("does not exist")) {
            return false;
        } else {
            throw e;
        }
    }
}

From source file:de.taimos.pipeline.aws.cloudformation.CloudFormationStack.java

License:Apache License

public boolean changeSetExists(String changeSetName) {
    try {//from w ww. j  a v  a  2  s  .  c  o  m
        this.client.describeChangeSet(
                new DescribeChangeSetRequest().withStackName(this.stack).withChangeSetName(changeSetName));
        return true;
    } catch (AmazonCloudFormationException e) {
        if ("AccessDenied".equals(e.getErrorCode())) {
            this.listener.getLogger().format("Got error from describeStacks: %s %n", e.getErrorMessage());
            throw e;
        }
        return false;
    }
}

From source file:de.taimos.pipeline.aws.cloudformation.stacksets.CloudFormationStackSet.java

License:Apache License

public boolean exists() {
    try {//from  ww  w . j  a v  a2 s.co m
        this.client.describeStackSet(new DescribeStackSetRequest().withStackSetName(this.stackSet));
        return true;
    } catch (AmazonCloudFormationException e) {
        if ("StackSetNotFoundException".equals(e.getErrorCode())) {
            return false;
        } else {
            this.listener.getLogger().format("Got error from describeStacks: %s %n", e.getErrorMessage());
            throw e;
        }
    }
}