mirror of https://github.com/apache/jclouds.git
openstack-glance extensibility
This commit is contained in:
parent
9acfa880d4
commit
b3121b7889
|
@ -44,12 +44,12 @@ public interface ImageApi {
|
|||
/**
|
||||
* Returns a set of brief metadata about images
|
||||
*/
|
||||
Set<Image> list(ListImageOptions... options);
|
||||
Set<? extends Image> list(ListImageOptions... options);
|
||||
|
||||
/**
|
||||
* Returns a set of detailed metadata about images
|
||||
*/
|
||||
Set<ImageDetails> listInDetail(ListImageOptions... options);
|
||||
Set<? extends ImageDetails> listInDetail(ListImageOptions... options);
|
||||
|
||||
/**
|
||||
* Return metadata about an image with id
|
||||
|
|
|
@ -73,7 +73,7 @@ public interface ImageAsyncApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/images")
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<Image>> list(ListImageOptions... options);
|
||||
ListenableFuture<? extends Set<? extends Image>> list(ListImageOptions... options);
|
||||
|
||||
/**
|
||||
* @see ImageApi#listInDetail
|
||||
|
@ -83,7 +83,7 @@ public interface ImageAsyncApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/images/detail")
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<ImageDetails>> listInDetail(ListImageOptions... options);
|
||||
ListenableFuture<? extends Set<? extends ImageDetails>> 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<ImageDetails> create(@HeaderParam("x-image-meta-name") String name, Payload payload, CreateImageOptions... options);
|
||||
ListenableFuture<? extends ImageDetails> 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<ImageDetails> reserve(@HeaderParam("x-image-meta-name") String name, CreateImageOptions... options);
|
||||
ListenableFuture<? extends ImageDetails> 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<ImageDetails> upload(@PathParam("id") String id, Payload imageData, UpdateImageOptions... options);
|
||||
ListenableFuture<? extends ImageDetails> 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<ImageDetails> update(@PathParam("id") String id, UpdateImageOptions... options);
|
||||
ListenableFuture<? extends ImageDetails> update(@PathParam("id") String id, UpdateImageOptions... options);
|
||||
|
||||
/**
|
||||
* @see ImageApi#delete
|
||||
|
|
|
@ -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<HttpResponse, Imag
|
|||
this.dateService = dateService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImageDetails apply(HttpResponse from) {
|
||||
ImageDetails.Builder<?> builder = ImageDetails.builder()
|
||||
.id(from.getFirstHeaderOrNull(ID.asHeader()))
|
||||
|
|
|
@ -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<Image> response = api.list(ListImageOptions.Builder.limit(100));
|
||||
Set<? extends Image> 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<ImageDetails> response = api.listInDetail();
|
||||
Set<? extends ImageDetails> response = api.listInDetail();
|
||||
assert null != response;
|
||||
for (ImageDetails image : response) {
|
||||
checkImage(image);
|
||||
|
|
Loading…
Reference in New Issue