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