diff --git a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Compute.java b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Compute.java
index b433294ecad8..300d38908a8b 100644
--- a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Compute.java
+++ b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Compute.java
@@ -1832,9 +1832,14 @@ public static ImageListOption fields(ImageField... fields) {
Image get(ImageId imageId, ImageOption... options);
/**
- * Lists images in the provided project that are available to the current user.
+ * Lists images in the provided project that are available to the current user. This method can be
+ * used to list publicly-available images by providing the respective image project. Examples of
+ * image projects are: {@code centos-cloud}, {@code coreos-cloud}, {@code debian-cloud},
+ * {@code opensuse-cloud}, {@code rhel-cloud}, {@code suse-cloud}, {@code ubuntu-os-cloud} and
+ * {@code windows-cloud}. Attempting to delete or deprecate a publicly-available image will fail.
*
* @throws ComputeException upon failure
+ * @see Operating Systems
*/
Page listImages(String project, ImageListOption... options);
@@ -1850,7 +1855,7 @@ public static ImageListOption fields(ImageField... fields) {
*
* @return a global operation if the delete request was issued correctly, {@code null} if the
* image was not found
- * @throws ComputeException upon failure
+ * @throws ComputeException upon failure or if {@code image} is a publicly-available image
*/
Operation delete(ImageId image, OperationOption... options);
@@ -1859,7 +1864,7 @@ public static ImageListOption fields(ImageField... fields) {
*
* @return a global operation if the deprecation request was issued correctly, {@code null} if the
* image was not found
- * @throws ComputeException upon failure
+ * @throws ComputeException upon failure or if {@code image} is a publicly-available image
*/
Operation deprecate(ImageId image, DeprecationStatus deprecationStatus,
OperationOption... options);
diff --git a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/ComputeImpl.java b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/ComputeImpl.java
index dda8dbe69bc4..1f875ad337f1 100644
--- a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/ComputeImpl.java
+++ b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/ComputeImpl.java
@@ -1124,14 +1124,15 @@ public Image apply(com.google.api.services.compute.model.Image image) {
}
@Override
- public Operation delete(final ImageId image, OperationOption... options) {
+ public Operation delete(ImageId image, OperationOption... options) {
+ final ImageId completeId = image.setProjectId(options().projectId());
final Map optionsMap = optionMap(options);
try {
com.google.api.services.compute.model.Operation answer =
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.deleteImage(image.image(), optionsMap);
+ return computeRpc.deleteImage(completeId.project(), completeId.image(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER);
return answer == null ? null : Operation.fromPb(this, answer);
@@ -1141,15 +1142,17 @@ public com.google.api.services.compute.model.Operation call() {
}
@Override
- public Operation deprecate(final ImageId image,
+ public Operation deprecate(ImageId image,
final DeprecationStatus deprecationStatus, OperationOption... options) {
+ final ImageId completeId = image.setProjectId(options().projectId());
final Map optionsMap = optionMap(options);
try {
com.google.api.services.compute.model.Operation answer =
runWithRetries(new Callable() {
@Override
public com.google.api.services.compute.model.Operation call() {
- return computeRpc.deprecateImage(image.image(), deprecationStatus.toPb(), optionsMap);
+ return computeRpc.deprecateImage(completeId.project(), completeId.image(),
+ deprecationStatus.toPb(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER);
return answer == null ? null : Operation.fromPb(this, answer);
diff --git a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Image.java b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Image.java
index e42a292f72ab..7815929f3bf3 100644
--- a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Image.java
+++ b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Image.java
@@ -156,7 +156,7 @@ public Image reload(ImageOption... options) {
*
* @return a global operation if the delete request was successfully sent, {@code null} if the
* image was not found
- * @throws ComputeException upon failure
+ * @throws ComputeException upon failure or if this image is a publicly-available image
*/
public Operation delete(OperationOption... options) {
return compute.delete(imageId(), options);
@@ -167,7 +167,7 @@ public Operation delete(OperationOption... options) {
*
* @return a global operation if the deprecation request was successfully sent, {@code null} if
* the image was not found
- * @throws ComputeException upon failure
+ * @throws ComputeException upon failure or if this image is a publicly-available image
*/
public Operation deprecate(DeprecationStatus deprecationStatus,
OperationOption... options) {
diff --git a/gcloud-java-compute/src/main/java/com/google/gcloud/spi/ComputeRpc.java b/gcloud-java-compute/src/main/java/com/google/gcloud/spi/ComputeRpc.java
index afdf38a27961..523686283db0 100644
--- a/gcloud-java-compute/src/main/java/com/google/gcloud/spi/ComputeRpc.java
+++ b/gcloud-java-compute/src/main/java/com/google/gcloud/spi/ComputeRpc.java
@@ -366,7 +366,7 @@ Operation createSnapshot(String zone, String disk, String snapshot, String descr
* image was not found
* @throws ComputeException upon failure
*/
- Operation deleteImage(String image, Map