List of usage examples for com.amazonaws.services.cloudformation.model DescribeStacksResult getNextToken
public String getNextToken()
If the output exceeds 1 MB in size, a string that identifies the next page of stacks.
From source file:br.com.ingenieux.mojo.cloudformation.LoadStackOutputsMojo.java
License:Apache License
private Collection<Output> listOutputs() { if (isEmpty(stackId)) { return Collections.emptyList(); }/*from ww w.j a v a2 s . c o m*/ String nextToken = null; final DescribeStacksRequest request = new DescribeStacksRequest().withStackName(stackId); List<Output> result = new ArrayList<>(); do { request.setNextToken(nextToken); final DescribeStacksResult response = getService().describeStacks(request); result.addAll(response.getStacks().stream().flatMap(stack -> stack.getOutputs().stream()) .collect(Collectors.toList())); nextToken = response.getNextToken(); } while (null != nextToken); return result; }
From source file:com.deploymentio.cfnstacker.CloudFormationClient.java
License:Apache License
/** * Finds the stack with the given name. Will only find stack still * running/*from ww w .java 2 s .c om*/ * * @param name name of the stack * @return the stack object or <code>null</code> if no running stack with * this name was found */ public Stack findStack(String name) { DescribeStacksResult describeStacksResult = null; String nextToken = null; do { describeStacksResult = client.describeStacks(new DescribeStacksRequest().withNextToken(nextToken)); nextToken = describeStacksResult.getNextToken(); for (Stack stack : describeStacksResult.getStacks()) { if (stack.getStackName().equals(name)) { return stack; } } } while (!StringUtils.isEmpty(nextToken)); return null; }
From source file:org.xmlsh.aws.cfnDescribeStacks.java
License:BSD License
private int describe(String name) throws IOException, XMLStreamException, SaxonApiException, CoreException { OutputPort stdout = getStdout();// w w w . j ava2 s . co m mWriter = new SafeXMLStreamWriter(stdout.asXMLStreamWriter(getSerializeOpts())); startDocument(); startElement(getName()); DescribeStacksRequest request = new DescribeStacksRequest(); if (name != null) request.setStackName(name); traceCall("describeStacks"); DescribeStacksResult result = getAWSClient().describeStacks(request); do { for (Stack stack : result.getStacks()) { writeStack(stack); } request.setNextToken(result.getNextToken()); } while (request.getNextToken() != null); endElement(); endDocument(); closeWriter(); stdout.writeSequenceTerminator(getSerializeOpts()); return 0; }