use of com.amazonaws.services.cloudformation.model.Stack in project pipeline-aws-plugin by jenkinsci.
the class CloudFormationStack method describeOutputs.
public Map<String, String> describeOutputs() {
DescribeStacksResult result = this.client.describeStacks(new DescribeStacksRequest().withStackName(this.stack));
Stack cfnStack = result.getStacks().get(0);
Map<String, String> map = new HashMap<>();
for (Output output : cfnStack.getOutputs()) {
map.put(output.getOutputKey(), output.getOutputValue());
}
return map;
}
use of com.amazonaws.services.cloudformation.model.Stack in project cloudbreak by hortonworks.
the class AwsCreateVpcNetworkTest method getOutputForRequest.
private List<Output> getOutputForRequest(String vpcStackName, AmazonCloudFormation client) {
int tried = 0;
while (tried < MAX_TRY) {
LOGGER.info("checking vpc stack creation result, tried: " + tried + '/' + MAX_TRY);
DescribeStacksRequest describeStacksRequest = new DescribeStacksRequest();
describeStacksRequest.withStackName(vpcStackName);
Stack resultStack = client.describeStacks(describeStacksRequest).getStacks().get(0);
StackStatus stackStatus = StackStatus.valueOf(resultStack.getStackStatus());
if (FAILED_STATUSES.contains(stackStatus)) {
LOGGER.error("stack creation failed: {}", stackStatus);
throw new RuntimeException();
} else if (CREATE_COMPLETE.equals(stackStatus)) {
return resultStack.getOutputs();
}
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
LOGGER.error("thread sleep interrupted", e);
}
tried++;
}
throw new RuntimeException("vpc creation timed out");
}
use of com.amazonaws.services.cloudformation.model.Stack in project cloudbreak by hortonworks.
the class AbstractAwsStackStatusCheckerTask method doCall.
@Override
protected Boolean doCall() {
LOGGER.info("Checking if AWS CloudFormation stack '{}' reached status '{}'", cloudFormationStackName, successStatus);
try {
com.amazonaws.services.cloudformation.model.Stack cfStack = cfClient.describeStacks(describeStacksRequest).getStacks().get(0);
List<StackEvent> stackEvents = cfClient.describeStackEvents(stackEventsRequest).getStackEvents();
return doCheck(cfStack, stackEvents);
} catch (AmazonServiceException e) {
return handleError(e);
}
}
Aggregations