List of usage examples for com.amazonaws.services.cloudformation.model DescribeStacksRequest withStackName
public DescribeStacksRequest withStackName(String stackName)
The name or the unique stack ID that is associated with the stack, which are not always interchangeable:
Running stacks: You can specify either the stack's name or its unique stack ID.
From source file:com.tvarit.plugin.RolesFinder.java
License:Open Source License
public RolesFinder(String projectName, AmazonCloudFormationClient amazonCloudFormationClient) { final DescribeStacksRequest describeStacksRequest = new DescribeStacksRequest(); describeStacksRequest.withStackName(projectName + "-infra"); describeStacksResult = amazonCloudFormationClient.describeStacks(describeStacksRequest); }
From source file:io.konig.maven.CreateCloudFormationStackAction.java
License:Apache License
private List<Output> getOutputForRequest(String stackName, AmazonCloudFormation client) throws InterruptedException, StackCreationException { int tried = 0; String maxTime = System.getProperty("stackMaxTime"); while (tried < (maxTime == null ? 1800 : Integer.parseInt(maxTime))) { DescribeStacksRequest describeStacksRequest = new DescribeStacksRequest(); describeStacksRequest.withStackName(stackName); Stack resultStack = client.describeStacks(describeStacksRequest).getStacks().get(0); StackStatus stackStatus = StackStatus.valueOf(resultStack.getStackStatus()); if (("CREATE_COMPLETE").equals(stackStatus.toString())) { return resultStack.getOutputs(); } else if (stackStatus.toString().endsWith("IN_PROGRESS")) { Thread.sleep(10000);/*from w w w. j a v a 2 s .co m*/ } else { DescribeStackEventsRequest describeStackEventsRequest = new DescribeStackEventsRequest(); describeStackEventsRequest.withStackName(stackName); List<StackEvent> stackEvents = client.describeStackEvents(describeStackEventsRequest) .getStackEvents(); List<StackEvent> errorEvents = new ArrayList<StackEvent>(); for (StackEvent stackEvent : stackEvents) { if (stackEvent.getResourceStatus().equals("CREATE_FAILED")) { errorEvents.add(stackEvent); } } throw new StackCreationException(errorEvents.toString()); } tried++; } throw new RuntimeException("stack creation/deletion timed out"); }