Example usage for com.amazonaws.services.cloudformation AmazonCloudFormationAsyncClient describeStackEventsAsync

List of usage examples for com.amazonaws.services.cloudformation AmazonCloudFormationAsyncClient describeStackEventsAsync

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudformation AmazonCloudFormationAsyncClient describeStackEventsAsync.

Prototype

@Override
    public java.util.concurrent.Future<DescribeStackEventsResult> describeStackEventsAsync(
            DescribeStackEventsRequest request) 

Source Link

Usage

From source file:com.mweagle.tereus.aws.CloudFormation.java

License:Open Source License

protected List<StackEvent> getStackEvents(final AmazonCloudFormationAsyncClient awsClient,
        final String stackName, Logger logger) throws Exception {
    List<StackEvent> events = new ArrayList<StackEvent>();
    Optional<String> token = Optional.empty();

    final DescribeStackEventsRequest describeRequest = new DescribeStackEventsRequest();
    describeRequest.setStackName(stackName);
    do {/*from www  .j  a va2 s .co  m*/
        if (token.isPresent()) {
            describeRequest.setNextToken(token.get());
        }
        final Future<DescribeStackEventsResult> stackEvents = awsClient
                .describeStackEventsAsync(describeRequest);
        DescribeStackEventsResult eventResult = stackEvents.get();
        events.addAll(eventResult.getStackEvents());
        token = Optional.ofNullable(eventResult.getNextToken());
    } while (token.isPresent());
    return events;
}