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