use of com.google.api.services.compute.model.ImageList in project platformlayer by platformlayer.
the class GoogleComputeClient method listImages.
private Iterable<Image> listImages(String projectId) throws OpsException {
List<Image> ret = Lists.newArrayList();
ImageList imageList;
try {
log.debug("Listing images in project " + projectId);
imageList = compute.images().list(projectId).execute();
} catch (IOException e) {
throw new OpsException("Error listing images", e);
}
if (imageList.getItems() != null) {
ret.addAll(imageList.getItems());
}
return ret;
}
use of com.google.api.services.compute.model.ImageList in project google-cloud-java by GoogleCloudPlatform.
the class HttpComputeRpc method listImages.
@Override
public Tuple<String, Iterable<Image>> listImages(String project, Map<Option, ?> options) {
try {
ImageList imageList = compute.images().list(project).setFilter(Option.FILTER.getString(options)).setMaxResults(Option.MAX_RESULTS.getLong(options)).setPageToken(Option.PAGE_TOKEN.getString(options)).setFields(Option.FIELDS.getString(options)).execute();
Iterable<Image> images = imageList.getItems();
return Tuple.of(imageList.getNextPageToken(), images);
} catch (IOException ex) {
throw translate(ex);
}
}
Aggregations