@Override public Boolean call() { LOGGER.info("Checking status of Gcp image '{}' copy", name); try { Compute.Images.Get getImages = compute.images().get(projectId, name); String status = getImages.execute().getStatus(); LOGGER.info("Status of image {} copy: {}", name, status); return READY.equals(status); } catch (IOException e) { LOGGER.warn("Failed to retrieve image copy status", e); return false; } }
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; }