mirror of https://github.com/apache/jclouds.git
implement actions
This commit is contained in:
parent
b8c0670cad
commit
b01a888835
|
@ -20,17 +20,26 @@ package org.jclouds.vcloud.director.v1_5.features;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||||
|
import org.jclouds.rest.annotations.PayloadParam;
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
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;
|
||||||
|
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.Metadata;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
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.VAppTemplate;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
||||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||||
import org.jclouds.vcloud.director.v1_5.functions.ReferenceToEndpoint;
|
import org.jclouds.vcloud.director.v1_5.functions.ReferenceToEndpoint;
|
||||||
|
@ -47,16 +56,93 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
public interface VdcAsyncClient {
|
public interface VdcAsyncClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VdcClient#getVdc(ReferenceType)
|
* @see VdcClient#getVdc(Reference)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Consumes
|
@Consumes
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<Vdc> getVdc(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef);
|
ListenableFuture<Vdc> getVdc(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VdcClient#cloneMedia(Reference, CloneMediaParams)
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/action/cloneMedia")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<Media> cloneMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
|
||||||
|
@PayloadParam(value = "?") CloneMediaParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VdcClient#cloneVApp(Reference, CloneVAppParams)
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/action/cloneVApp")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<VApp> cloneVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
|
||||||
|
@PayloadParam(value = "?") CloneVAppParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VdcClient#cloneVAppTemplate(Reference, CloneVAppTemplateParams)
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/action/cloneVAppTemplate")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<VAppTemplate> cloneVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
|
||||||
|
@PayloadParam(value = "?") CloneVAppTemplateParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VdcClient#composeVApp(Reference, ComposeVAppParams)
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/action/composeVApp")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<VApp> composeVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
|
||||||
|
@PayloadParam(value = "?") ComposeVAppParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VdcClient#instantiateVApp(Reference, InstantiateVAppParamsType)
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/action/instantiateVApp")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<VApp> instantiateVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
|
||||||
|
@PayloadParam(value = "?") InstantiateVAppParamsType<?> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VdcClient#uploadVAppTemplate(Reference, UploadVAppTemplateParams)
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/action/uploadVAppTemplate")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<VAppTemplate> uploadVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
|
||||||
|
@PayloadParam(value = "?") UploadVAppTemplateParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VdcClient#createMedia(Reference, Media)
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/media")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<Media> createMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef,
|
||||||
|
@PayloadParam(value = "?") Media media);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VdcClient#getMetadata(ReferenceType)
|
* @see VdcClient#getMetadata(Reference)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/metadata")
|
@Path("/metadata")
|
||||||
|
@ -66,7 +152,7 @@ public interface VdcAsyncClient {
|
||||||
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef);
|
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VdcClient#getMetadataEntry(ReferenceType, String)
|
* @see VdcClient#getMetadataEntry(Reference, String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/metadata/{key}")
|
@Path("/metadata/{key}")
|
||||||
|
|
|
@ -20,11 +20,32 @@ package org.jclouds.vcloud.director.v1_5.features;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
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.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.CloneMediaParams;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams;
|
||||||
|
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.Metadata;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
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.VAppTemplate;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
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.
|
* Provides synchronous access to a vDC.
|
||||||
|
@ -44,6 +65,86 @@ public interface VdcClient {
|
||||||
*/
|
*/
|
||||||
Vdc getVdc(Reference vdcRef);
|
Vdc getVdc(Reference vdcRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clones a media into new one.
|
||||||
|
* The status of the returned media is UNRESOLVED(0) until the task for cloning finish.
|
||||||
|
*
|
||||||
|
* @return a Media resource which will contain a task.
|
||||||
|
* The user should monitor the contained task status in order to check when it is completed.
|
||||||
|
*/
|
||||||
|
Media cloneMedia(Reference vdcRef, CloneMediaParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clones a vApp into new one. The status of vApp will be in UNRESOLVED(0) until the clone task is finished.
|
||||||
|
*
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
VApp cloneVApp(Reference vdcRef, CloneVAppParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clones a vApp template into new one.
|
||||||
|
* The status of vApp template will be in UNRESOLVED(0) until the clone task is finished.
|
||||||
|
*
|
||||||
|
* @return a VAppTemplate resource which will contain a task.
|
||||||
|
* The user should should wait for this task to finish to be able to use the VAppTemplate.
|
||||||
|
*/
|
||||||
|
VAppTemplate cloneVAppTemplate(Reference vdcRef, CloneVAppTemplateParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Composes a new vApp using VMs from other vApps or vApp templates. The vCloud API supports
|
||||||
|
* composing a vApp from any combination of vApp templates, vApps, or virtual machines.
|
||||||
|
* When you compose a vApp, all children of each composition source become peers in the
|
||||||
|
* Children collection of the composed vApp. To compose a vApp, a client makes a compose
|
||||||
|
* vApp request whose body is a ComposeVAppParams element, includes the following information:
|
||||||
|
* - An InstantiationParams element that applies to the composed vApp itself and any vApp
|
||||||
|
* templates referenced in Item elements. - A SourcedItem element for each virtual machine,
|
||||||
|
* vApp, or vAppTemplate to include in the composition. Each SourcedItem can contain the
|
||||||
|
* following elements: - A required Source element whose href attribute value is a reference
|
||||||
|
* to a vApp template, vApp, or VM to include in the composition. If the Source element
|
||||||
|
* references a VM, the Item must also include an InstantiationParams element specific to
|
||||||
|
* that VM. - An optional NetworkAssignment element that specifies how the network connections
|
||||||
|
* of child VM elements are mapped to vApp networks in the parent. - If any of the composition
|
||||||
|
* items is subject to a EULA, the ComposeVAppParams element must include an AllEULAsAccepted
|
||||||
|
* element that has a value of true, indicating that you accept the EULA. Otherwise, composition
|
||||||
|
* fails. The composed vApp must be deployed and powered on before it can be used. The status
|
||||||
|
* of vApp will be UNRESOLVED(0) until the compose task is finished.
|
||||||
|
*
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
VApp composeVApp(Reference vdcRef, ComposeVAppParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate a vApp template into a new vApp.
|
||||||
|
* The status of vApp will be in UNRESOLVED(0) until the instantiate task is finished.
|
||||||
|
*
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
VApp instantiateVApp(Reference vdcRef, InstantiateVAppParamsType<?> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uploading vApp template to a vDC. The operation is separate on several steps:
|
||||||
|
* 1. creating empty vApp template entity
|
||||||
|
* 2. uploading an OVF of vApp template
|
||||||
|
* 3. uploading disks described from the OVF
|
||||||
|
* 4. finishing task for uploading
|
||||||
|
* The status of vApp template will be NOT_READY(0) until the ovf and all disks are uploaded
|
||||||
|
* to the transfer site. After this a task will run on the vApp template uploading.
|
||||||
|
*
|
||||||
|
* @return a VAppTemplate resource which will contain a task.
|
||||||
|
* The user should should wait for this task to finish to be able to use the VAppTemplate.
|
||||||
|
*/
|
||||||
|
VAppTemplate uploadVAppTemplate(Reference vdcRef, UploadVAppTemplateParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a media (and present upload link for the floppy/iso file).
|
||||||
|
*
|
||||||
|
* @return The response will return a link to transfer site to be able to continue with uploading the media.
|
||||||
|
*/
|
||||||
|
Media createMedia(Reference vdcRef, Media media);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves an list of the vdc's metadata
|
* Retrieves an list of the vdc's metadata
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue