Example usage for com.amazonaws.services.ecs.model ListContainerInstancesRequest withCluster

List of usage examples for com.amazonaws.services.ecs.model ListContainerInstancesRequest withCluster

Introduction

In this page you can find the example usage for com.amazonaws.services.ecs.model ListContainerInstancesRequest withCluster.

Prototype


public ListContainerInstancesRequest withCluster(String cluster) 

Source Link

Document

The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances to list.

Usage

From source file:com.steelbridgelabs.oss.neo4j.cluster.ecs.AutoscalingGroupMembers.java

License:Apache License

private static List<String> containerInstanceArns(AmazonECS client, String cluster) {
    // create request
    ListContainerInstancesRequest request = new ListContainerInstancesRequest();
    // specify cluster name
    request.withCluster(cluster);
    // next token
    String token = null;/*from   www  .  ja v a 2 s.  c  om*/
    // container instance arns
    List<String> list = new ArrayList<>();
    do {
        // set next token
        request.setNextToken(token);
        // describe instances
        ListContainerInstancesResult result = client.listContainerInstances(request);
        // get container instance arns
        list.addAll(result.getContainerInstanceArns());
        // check we have more data to retrieve
        token = result.getNextToken();
    } while (token != null);
    // return arns
    return list;
}