diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncClient.java index 4d62bea509..4fe5cda2ae 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncClient.java @@ -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 captureVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef, - @PayloadParam(value = "?") CaptureVAppParams params); + ListenableFuture 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 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 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 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 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 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 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 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 getMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef , + ListenableFuture getMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef , @PathParam("key") String key); } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcClient.java index 27391ce221..0b72a139c4 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcClient.java @@ -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); }