update client with the right param types and metadataValue getter

This commit is contained in:
danikov 2012-02-21 16:03:59 +00:00
parent 16309eaef1
commit 257503f4dd
2 changed files with 39 additions and 38 deletions

View File

@ -23,12 +23,15 @@ import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams;
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams;
@ -37,9 +40,10 @@ import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppParamsType;
import org.jclouds.vcloud.director.v1_5.domain.Media;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.UploadVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
@ -70,88 +74,96 @@ public interface VdcAsyncClient {
*/
@POST
@Path("/action/captureVApp")
@Consumes
@Consumes(VCloudDirectorMediaType.V_APP_TEMPLATE)
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Media> captureVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
@PayloadParam(value = "?") CaptureVAppParams params);
ListenableFuture<VAppTemplate> captureVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
@BinderParam(BindToXMLPayload.class) CaptureVAppParams params);
/**
* @see VdcClient#cloneMedia(Reference, CloneMediaParams)
*/
@POST
@Path("/action/cloneMedia")
@Consumes
@Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Media> cloneMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
@PayloadParam(value = "?") CloneMediaParams params);
@BinderParam(BindToXMLPayload.class) CloneMediaParams params);
/**
* @see VdcClient#cloneVApp(Reference, CloneVAppParams)
*/
@POST
@Path("/action/cloneVApp")
@Consumes
@Consumes(VCloudDirectorMediaType.V_APP)
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VApp> cloneVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
@PayloadParam(value = "?") CloneVAppParams params);
@BinderParam(BindToXMLPayload.class) CloneVAppParams params);
/**
* @see VdcClient#cloneVAppTemplate(Reference, CloneVAppTemplateParams)
*/
@POST
@Path("/action/cloneVAppTemplate")
@Consumes
@Consumes(VCloudDirectorMediaType.V_APP_TEMPLATE)
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VAppTemplate> cloneVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
@PayloadParam(value = "?") CloneVAppTemplateParams params);
@BinderParam(BindToXMLPayload.class) CloneVAppTemplateParams params);
/**
* @see VdcClient#composeVApp(Reference, ComposeVAppParams)
*/
@POST
@Path("/action/composeVApp")
@Consumes
@Consumes(VCloudDirectorMediaType.V_APP)
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VApp> composeVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
@PayloadParam(value = "?") ComposeVAppParams params);
@BinderParam(BindToXMLPayload.class) ComposeVAppParams params);
/**
* @see VdcClient#instantiateVApp(Reference, InstantiateVAppParamsType)
*/
@POST
@Path("/action/instantiateVApp")
@Consumes
@Consumes(VCloudDirectorMediaType.V_APP)
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VApp> instantiateVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
@PayloadParam(value = "?") InstantiateVAppParamsType<?> params);
@BinderParam(BindToXMLPayload.class) InstantiateVAppParamsType<?> params);
/**
* @see VdcClient#uploadVAppTemplate(Reference, UploadVAppTemplateParams)
*/
@POST
@Path("/action/uploadVAppTemplate")
@Consumes
@Consumes(VCloudDirectorMediaType.V_APP_TEMPLATE)
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VAppTemplate> uploadVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
@PayloadParam(value = "?") UploadVAppTemplateParams params);
@BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params);
/**
* @see VdcClient#createMedia(Reference, Media)
*/
@POST
@Path("/media")
@Consumes
@Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Media> createMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
@PayloadParam(value = "?") Media media);
@BinderParam(BindToXMLPayload.class) Media media);
/**
* @see VdcClient#getMetadata(Reference)
@ -171,7 +183,7 @@ public interface VdcAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataEntry> getMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef ,
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef ,
@PathParam("key") String key);
}

View File

@ -20,15 +20,8 @@ package org.jclouds.vcloud.director.v1_5.features;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams;
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams;
@ -36,16 +29,12 @@ import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppParamsType;
import org.jclouds.vcloud.director.v1_5.domain.Media;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
import org.jclouds.vcloud.director.v1_5.domain.UploadVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.functions.ReferenceToEndpoint;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides synchronous access to a vDC.
@ -72,7 +61,7 @@ public interface VdcClient {
* @return a VApp resource which will contain a task.
* The user should should wait for this task to finish to be able to use the vApp.
*/
VAppTemplate captureVApp(Reference vdcRef, CloneMediaParams params);
VAppTemplate captureVApp(Reference vdcRef, CaptureVAppParams params);
/**
* Clones a media into new one.
@ -162,10 +151,10 @@ public interface VdcClient {
Metadata getMetadata(Reference vdcRef);
/**
* Retrieves a metadata entry
* Retrieves a metadata value
*
* @return the metadata entry, or null if not found
* @return the metadata value, or null if not found
*/
MetadataEntry getMetadataEntry(Reference vdcRef, String key);
MetadataValue getMetadataValue(Reference vdcRef, String key);
}