Search in sources :

Example 1 with InstanceList

use of com.google.api.services.compute.model.InstanceList in project google-cloud-java by GoogleCloudPlatform.

the class HttpComputeRpc method listInstances.

@Override
public Tuple<String, Iterable<Instance>> listInstances(String zone, Map<Option, ?> options) {
    try {
        InstanceList instanceList = compute.instances().list(this.options.getProjectId(), zone).setFilter(Option.FILTER.getString(options)).setMaxResults(Option.MAX_RESULTS.getLong(options)).setPageToken(Option.PAGE_TOKEN.getString(options)).setFields(Option.FIELDS.getString(options)).execute();
        Iterable<Instance> instances = instanceList.getItems();
        return Tuple.of(instanceList.getNextPageToken(), instances);
    } catch (IOException ex) {
        throw translate(ex);
    }
}
Also used : Instance(com.google.api.services.compute.model.Instance) IOException(java.io.IOException) InstanceList(com.google.api.services.compute.model.InstanceList)

Aggregations

Instance (com.google.api.services.compute.model.Instance)1 InstanceList (com.google.api.services.compute.model.InstanceList)1 IOException (java.io.IOException)1