use of com.google.api.services.compute.model.DiskAggregatedList in project google-cloud-java by GoogleCloudPlatform.
the class HttpComputeRpc method listDisks.
@Override
public Tuple<String, Iterable<Disk>> listDisks(Map<Option, ?> options) {
try {
DiskAggregatedList aggregatedList = compute.disks().aggregatedList(this.options.getProjectId()).setFilter(Option.FILTER.getString(options)).setMaxResults(Option.MAX_RESULTS.getLong(options)).setPageToken(Option.PAGE_TOKEN.getString(options)).execute();
ImmutableList.Builder<Disk> builder = ImmutableList.builder();
Map<String, DisksScopedList> scopedList = aggregatedList.getItems();
if (scopedList != null) {
for (DisksScopedList disksScopedList : scopedList.values()) {
if (disksScopedList.getDisks() != null) {
builder.addAll(disksScopedList.getDisks());
}
}
}
return Tuple.<String, Iterable<Disk>>of(aggregatedList.getNextPageToken(), builder.build());
} catch (IOException ex) {
throw translate(ex);
}
}
Aggregations