Example usage for com.amazonaws.services.opsworks.model DescribeInstancesResult getInstances

List of usage examples for com.amazonaws.services.opsworks.model DescribeInstancesResult getInstances

Introduction

In this page you can find the example usage for com.amazonaws.services.opsworks.model DescribeInstancesResult getInstances.

Prototype


public java.util.List<Instance> getInstances() 

Source Link

Document

An array of Instance objects that describe the instances.

Usage

From source file:com.tispr.aws.OpsWorksClient.java

License:Apache License

protected List<String> getInstancesIds(String layerId) {
    List<String> instanceIds = new ArrayList<String>();

    if (layerId == null || layerId.isEmpty()) {
        return instanceIds;
    }//from  w  ww. ja  v a 2  s.c o m

    DescribeInstancesRequest req = new DescribeInstancesRequest().withLayerId(layerId);
    DescribeInstancesResult res = opsWorksClient.describeInstances(req);

    for (Instance i : res.getInstances()) {
        instanceIds.add(i.getInstanceId());
    }

    return instanceIds;
}