From b3121b7889ac6bd28fa40c0bfad473000ae3fe43 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Sun, 12 Aug 2012 12:42:22 +0100 Subject: [PATCH] openstack-glance extensibility --- .../glance/v1_0/features/ImageApi.java | 4 ++-- .../glance/v1_0/features/ImageAsyncApi.java | 12 ++++++------ .../functions/ParseImageDetailsFromHeaders.java | 17 ++++++++++++++++- .../glance/v1_0/features/ImageApiLiveTest.java | 4 ++-- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java index c86757a51d..b24e368359 100644 --- a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java +++ b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java @@ -44,12 +44,12 @@ public interface ImageApi { /** * Returns a set of brief metadata about images */ - Set list(ListImageOptions... options); + Set list(ListImageOptions... options); /** * Returns a set of detailed metadata about images */ - Set listInDetail(ListImageOptions... options); + Set listInDetail(ListImageOptions... options); /** * Return metadata about an image with id diff --git a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageAsyncApi.java b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageAsyncApi.java index b7c467aa0a..c4b41caf2c 100644 --- a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageAsyncApi.java +++ b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageAsyncApi.java @@ -73,7 +73,7 @@ public interface ImageAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/images") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> list(ListImageOptions... options); + ListenableFuture> list(ListImageOptions... options); /** * @see ImageApi#listInDetail @@ -83,7 +83,7 @@ public interface ImageAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/images/detail") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listInDetail(ListImageOptions... options); + ListenableFuture> listInDetail(ListImageOptions... options); /** * @see ImageApi#show @@ -110,7 +110,7 @@ public interface ImageAsyncApi { @Produces(MediaType.APPLICATION_OCTET_STREAM) @SelectJson("image") @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture create(@HeaderParam("x-image-meta-name") String name, Payload payload, CreateImageOptions... options); + ListenableFuture create(@HeaderParam("x-image-meta-name") String name, Payload payload, CreateImageOptions... options); /** * @see ImageApi#reserve @@ -119,7 +119,7 @@ public interface ImageAsyncApi { @Path("/images") @SelectJson("image") @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture reserve(@HeaderParam("x-image-meta-name") String name, CreateImageOptions... options); + ListenableFuture reserve(@HeaderParam("x-image-meta-name") String name, CreateImageOptions... options); /** * @see ImageApi#upload @@ -129,7 +129,7 @@ public interface ImageAsyncApi { @Produces(MediaType.APPLICATION_OCTET_STREAM) @SelectJson("image") @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture upload(@PathParam("id") String id, Payload imageData, UpdateImageOptions... options); + ListenableFuture upload(@PathParam("id") String id, Payload imageData, UpdateImageOptions... options); /** * @see ImageApi#update @@ -138,7 +138,7 @@ public interface ImageAsyncApi { @Path("/images/{id}") @SelectJson("image") @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture update(@PathParam("id") String id, UpdateImageOptions... options); + ListenableFuture update(@PathParam("id") String id, UpdateImageOptions... options); /** * @see ImageApi#delete diff --git a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/ParseImageDetailsFromHeaders.java b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/ParseImageDetailsFromHeaders.java index 44ecc33d51..9bcb4e4deb 100644 --- a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/ParseImageDetailsFromHeaders.java +++ b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/ParseImageDetailsFromHeaders.java @@ -18,7 +18,21 @@ */ package org.jclouds.openstack.glance.v1_0.functions; -import static org.jclouds.openstack.glance.v1_0.options.ImageField.*; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.CHECKSUM; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.CONTAINER_FORMAT; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.CREATED_AT; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.DELETED_AT; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.DISK_FORMAT; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.ID; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.IS_PUBLIC; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.LOCATION; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.MIN_DISK; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.MIN_RAM; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.NAME; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.OWNER; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.SIZE; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.STATUS; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.UPDATED_AT; import javax.inject.Inject; @@ -44,6 +58,7 @@ public class ParseImageDetailsFromHeaders implements Function builder = ImageDetails.builder() .id(from.getFirstHeaderOrNull(ID.asHeader())) diff --git a/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/features/ImageApiLiveTest.java b/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/features/ImageApiLiveTest.java index 6be9b4a1a0..ef457545fb 100644 --- a/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/features/ImageApiLiveTest.java +++ b/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/features/ImageApiLiveTest.java @@ -49,7 +49,7 @@ public class ImageApiLiveTest extends BaseGlanceApiLiveTest { public void testList() throws Exception { for (String zoneId : glanceContext.getApi().getConfiguredRegions()) { ImageApi api = glanceContext.getApi().getImageApiForRegion(zoneId); - Set response = api.list(ListImageOptions.Builder.limit(100)); + Set response = api.list(ListImageOptions.Builder.limit(100)); assert null != response; for (Image image : response) { checkImage(image); @@ -67,7 +67,7 @@ public class ImageApiLiveTest extends BaseGlanceApiLiveTest { public void testListInDetail() throws Exception { for (String zoneId : glanceContext.getApi().getConfiguredRegions()) { ImageApi api = glanceContext.getApi().getImageApiForRegion(zoneId); - Set response = api.listInDetail(); + Set response = api.listInDetail(); assert null != response; for (ImageDetails image : response) { checkImage(image);