Create new VmClient and references using existing methods from VAppClient

This commit is contained in:
Andrew Donald Kennedy 2012-04-26 01:34:43 +01:00
parent 19b19d2a5d
commit 8becbd0394
7 changed files with 1536 additions and 700 deletions

View File

@ -67,6 +67,8 @@ import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
import org.jclouds.vcloud.director.v1_5.features.VmAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VmClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncClient;
@ -122,6 +124,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
.put(VAppClient.class, VAppAsyncClient.class)
.put(VAppTemplateClient.class, VAppTemplateAsyncClient.class)
.put(VdcClient.class, VdcAsyncClient.class)
.put(VmClient.class, VmAsyncClient.class)
.build();
public static final Map<Class<?>, Class<?>> ADMIN_DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>>builder()
@ -166,6 +169,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
bindClientAndAsyncClient(binder(), SessionClient.class, SessionAsyncClient.class);
bindClientAndAsyncClient(binder(), TaskClient.class, TaskAsyncClient.class);
bindClientAndAsyncClient(binder(), VAppClient.class, VAppAsyncClient.class);
bindClientAndAsyncClient(binder(), VmClient.class, VmAsyncClient.class);
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class);

View File

@ -122,15 +122,6 @@ public interface VAppAsyncClient {
@JAXBResponseParser
ListenableFuture<Task> deleteVApp(@EndpointParam URI vAppURI);
/**
* @see VAppClient#consolidateVm(URI)
*/
@POST
@Path("/action/consolidate")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> consolidateVm(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyControlAccess(URI, ControlAccessParams)
*/
@ -180,15 +171,6 @@ public interface VAppAsyncClient {
@JAXBResponseParser
ListenableFuture<Void> exitMaintenanceMode(@EndpointParam URI vAppURI);
/**
* @see VAppClient#installVMwareTools(URI)
*/
@POST
@Path("/action/installVMwareTools")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> installVMwareTools(@EndpointParam URI vAppURI);
/**
* @see VAppClient#recompose(URI, RecomposeVAppParams)
*/
@ -200,17 +182,6 @@ public interface VAppAsyncClient {
ListenableFuture<Task> recompose(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RecomposeVAppParams params);
/**
* @see VAppClient#relocateVm(URI, RelocateParams)
*/
@POST
@Path("/action/relocate")
@Produces(RELOCATE_VM_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> relocateVm(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RelocateParams params);
/**
* @see VAppClient#undeploy(URI, UndeployVAppParams)
*/
@ -222,15 +193,6 @@ public interface VAppAsyncClient {
ListenableFuture<Task> undeploy(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
/**
* @see VAppClient#upgradeHardwareVersion(URI)
*/
@POST
@Path("/action/upgradeHardwareVersion")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getControlAccess(URI)
*/
@ -295,27 +257,6 @@ public interface VAppAsyncClient {
@JAXBResponseParser
ListenableFuture<Task> suspend(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getGuestCustomizationSection(URI)
*/
@GET
@Path("/guestCustomizationSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyGuestCustomizationSection(URI, GuestCustomizationSection)
*/
@PUT
@Path("/guestCustomizationSection")
@Produces(GUEST_CUSTOMIZATION_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyGuestCustomizationSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
/**
* @see VAppClient#getLeaseSettingsSection(URI)
*/
@ -337,28 +278,6 @@ public interface VAppAsyncClient {
ListenableFuture<Task> modifyLeaseSettingsSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
/**
* @see VAppClient#ejectMedia(URI, MediaInsertOrEjectParams)
*/
@POST
@Path("/media/action/ejectMedia")
@Produces(MEDIA_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> ejectMedia(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
/**
* @see VAppClient#insertMedia(URI, MediaInsertOrEjectParams)
*/
@POST
@Path("/media/action/insertMedia")
@Produces(MEDIA_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> insertMedia(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
/**
* @see VAppClient#getNetworkConfigSection(URI)
*/
@ -380,27 +299,6 @@ public interface VAppAsyncClient {
ListenableFuture<Task> modifyNetworkConfigSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
/**
* @see VAppClient#getNetworkConnectionSection(URI)
*/
@GET
@Path("/networkConnectionSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection)
*/
@PUT
@Path("/networkConnectionSection")
@Produces(NETWORK_CONNECTION_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyNetworkConnectionSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
/**
* @see VAppClient#getNetworkSection(URI)
*/
@ -411,27 +309,6 @@ public interface VAppAsyncClient {
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getOperatingSystemSection(URI)
*/
@GET
@Path("/operatingSystemSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyOperatingSystemSection(URI, OperatingSystemSection)
*/
@PUT
@Path("/operatingSystemSection")
@Produces(OPERATING_SYSTEM_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyOperatingSystemSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
/**
* @see VAppClient#getOwner(URI)
*/
@ -474,56 +351,6 @@ public interface VAppAsyncClient {
ListenableFuture<Task> modifyProductSections(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
/**
* @see VAppClient#getPendingQuestion(URI)
*/
@GET
@Path("/question")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam URI vAppURI);
/**
* @see VAppClient#answerQuestion(URI, VmQuestionAnswer)
*/
@POST
@Path("/question/action/answer")
@Produces(VM_PENDING_ANSWER)
@Consumes
@JAXBResponseParser
ListenableFuture<Void> answerQuestion(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer);
/**
* @see VAppClient#getRuntimeInfoSection(URI)
*/
@GET
@Path("/runtimeInfoSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam URI vmURI);
/**
* @see VAppClient#getScreenImage(URI)
*/
@GET
@Path("/screen")
@Consumes(ANY_IMAGE)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@ResponseParser(ReturnPayloadBytes.class)
ListenableFuture<byte[]> getScreenImage(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getScreenTicket(URI)
*/
@POST
@Path("/screen/action/acquireTicket")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getStartupSection(URI)
@ -547,145 +374,8 @@ public interface VAppAsyncClient {
@BinderParam(BindToXMLPayload.class) StartupSection section);
/**
* @see VAppClient#getVirtualHardwareSection(URI)
*/
@GET
@Path("/virtualHardwareSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSection(URI, VirtualHardwareSection)
*/
@PUT
@Path("/virtualHardwareSection")
@Produces(VIRTUAL_HARDWARE_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
/**
* @see VAppClient#getVirtualHardwareSectionCpu(URI)
*/
@GET
@Path("/virtualHardwareSection/cpu")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData)
*/
@PUT
@Path("/virtualHardwareSection/cpu")
@Produces(OVF_RASD_ITEM)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionCpu(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
/**
* @see VAppClient#getVirtualHardwareSectionDisks(URI)
*/
@GET
@Path("/virtualHardwareSection/disks")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionDisks(URI, RasdItemsList)
*/
@PUT
@Path("/virtualHardwareSection/disks")
@Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionDisks(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/**
* @see VAppClient#getVirtualHardwareSectionMedia(URI)
*/
@GET
@Path("/virtualHardwareSection/media")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia(@EndpointParam URI vmURI);
/**
* @see VAppClient#getVirtualHardwareSectionMemory(URI)
*/
@GET
@Path("/virtualHardwareSection/memory")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData)
*/
@PUT
@Path("/virtualHardwareSection/memory")
@Produces(OVF_RASD_ITEM)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionMemory(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
/**
* @see VAppClient#getVirtualHardwareSectionNetworkCards(URI)
*/
@GET
@Path("/virtualHardwareSection/networkCards")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionNetworkCards(URI, RasdItemsList)
*/
@PUT
@Path("/virtualHardwareSection/networkCards")
@Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/**
* @see VAppClient#getVirtualHardwareSectionSerialPorts(URI)
*/
@GET
@Path("/virtualHardwareSection/serialPorts")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionSerialPorts(URI, RasdItemsList)
*/
@PUT
@Path("/virtualHardwareSection/serialPorts")
@Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/**
* @return asynchronous access to {@link Metadata} features
* Asynchronous access to {@link VApp} {@link Metadata} features
*/
@Delegate
MetadataAsyncClient.Writeable getMetadataClient();
}

View File

@ -27,26 +27,14 @@ import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList;
import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams;
import org.jclouds.vcloud.director.v1_5.domain.params.RecomposeVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection;
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection;
import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
/**
* Provides synchronous access to {@link VApp} objects.
@ -59,9 +47,9 @@ import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
public interface VAppClient {
/**
* Retrieves a vApp/VM.
* Retrieves a {@link VApp}.
*
* The vApp/VM could be in one of these statuses:
* The {@link VApp} could be in one of these statuses:
* <ul>
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION FAILED_CREATION(-1)} -
* Transient entity state, e.g., model object is created but the corresponding VC backing does not
@ -101,7 +89,7 @@ public interface VAppClient {
VApp getVApp(URI vAppURI);
/**
* Modifies the name/description of a vApp/VM.
* Modifies the name/description of a {@link VApp}.
*
* <pre>
* PUT /vApp/{id}
@ -112,7 +100,7 @@ public interface VAppClient {
Task modifyVApp(URI vAppURI, VApp vApp);
/**
* Deletes a vApp/VM.
* Deletes a {@link VApp}.
*
* <pre>
* DELETE /vApp/{id}
@ -123,18 +111,7 @@ public interface VAppClient {
Task deleteVApp(URI vAppURI);
/**
* Consolidates a vm.
*
* <pre>
* POST /vApp/{id}/action/consolidate
* </pre>
*
* @since 1.5
*/
Task consolidateVm(URI vAppURI);
/**
* Modifies the control access of a vApp.
* Modifies the control access of a {@link VApp}.
*
* <pre>
* POST /vApp/{id}/action/controlAccess
@ -145,7 +122,7 @@ public interface VAppClient {
ControlAccessParams modifyControlAccess(URI vAppURI, ControlAccessParams params);
/**
* Deploys a vApp/VM.
* Deploys a {@link VApp}.
*
* Deployment means allocation of all resource for a vApp/VM like CPU and memory
* from a vDC resource pool. Deploying a vApp automatically deploys all of the
@ -162,7 +139,7 @@ public interface VAppClient {
Task deploy(URI vAppURI, DeployVAppParams params);
/**
* Discard suspended state of a vApp/VM.
* Discard suspended state of a {@link VApp}.
*
* Discarding suspended state of a vApp automatically discarded suspended
* states of all of the virtual machines it contains.
@ -176,7 +153,7 @@ public interface VAppClient {
Task discardSuspendedState(URI vAppURI);
/**
* Place the vApp into maintenance mode.
* Place the {@link VApp} into maintenance mode.
*
* While in maintenance mode, a system admin can operate on the vApp as
* usual, but end users are restricted to read-only operations. Any
@ -192,7 +169,7 @@ public interface VAppClient {
void enterMaintenanceMode(URI vAppURI);
/**
* Take the vApp out of maintenance mode.
* Take the {@link VApp} out of maintenance mode.
*
* <pre>
* POST /vApp/{id}/action/exitMaintenanceMode
@ -203,20 +180,7 @@ public interface VAppClient {
void exitMaintenanceMode(URI vAppURI);
/**
* Installs VMware tools to the virtual machine.
*
* It should be running in order for them to be installed.
*
* <pre>
* POST /vApp/{id}/action/installVMwareTools
* </pre>
*
* @since 1.5
*/
Task installVMwareTools(URI vAppURI);
/**
* Recompose a vApp by removing its own VMs and/or adding new ones from other
* Recompose a {@link VApp} by removing its own VMs and/or adding new ones from other
* vApps or vApp templates.
*
* To remove VMs you should put their references in elements. The way you add
@ -234,18 +198,7 @@ public interface VAppClient {
Task recompose(URI vAppURI, RecomposeVAppParams params);
/**
* Relocates a vm.
*
* <pre>
* POST /vApp/{id}/action/relocate
* </pre>
*
* @since 1.5
*/
Task relocateVm(URI vAppURI, RelocateParams params);
/**
* Undeploy a vApp/VM.
* Undeploy a {@link VApp}.
*
* Undeployment means deallocation of all resources for a vApp/VM like CPU
* and memory from a vDC resource pool. Undeploying a vApp automatically
@ -260,19 +213,7 @@ public interface VAppClient {
Task undeploy(URI vAppURI, UndeployVAppParams params);
/**
* Upgrade virtual hardware version of a VM to the highest supported virtual
* hardware version of provider vDC where the VM locates.
*
* <pre>
* POST /vApp/{id}/action/upgradeHardwareVersion
* </pre>
*
* @since 1.5
*/
Task upgradeHardwareVersion(URI vAppURI);
/**
* Retrieves the control access information for a vApp.
* Retrieves the control access information for a {@link VApp}.
*
* The vApp could be shared to everyone or could be shared to specific user,
* by modifying the control access values.
@ -286,7 +227,7 @@ public interface VAppClient {
ControlAccessParams getControlAccess(URI vAppURI);
/**
* Powers off a vApp/VM.
* Powers off a {@link VApp}.
*
* If the operation is used over a vApp then all VMs are powered off. This operation is allowed only when the vApp/VM is powered on.
*
@ -299,7 +240,7 @@ public interface VAppClient {
Task powerOff(URI vAppURI);
/**
* Powers on a vApp/VM.
* Powers on a {@link VApp}.
*
* If the operation is used over a vApp then all VMs are powered on. This
* operation is allowed only when the vApp/VM is powered off.
@ -313,7 +254,7 @@ public interface VAppClient {
Task powerOn(URI vAppURI);
/**
* Reboots a vApp/VM.
* Reboots a {@link VApp}.
*
* The vApp/VM should be started in order to reboot it.
*
@ -326,7 +267,7 @@ public interface VAppClient {
Task reboot(URI vAppURI);
/**
* Resets a vApp/VM.
* Resets a {@link VApp}.
*
* If the operation is used over a vApp then all VMs are reset. This
* operation is allowed only when the vApp/VM is powered on.
@ -340,7 +281,7 @@ public interface VAppClient {
Task reset(URI vAppURI);
/**
* Shutdowns a vApp/VM.
* Shuts down a {@link VApp}.
*
* If the operation is used over a vApp then all VMs are shutdown. This
* operation is allowed only when the vApp/VM is powered on.
@ -354,7 +295,7 @@ public interface VAppClient {
Task shutdown(URI vAppURI);
/**
* Suspends a vApp/VM.
* Suspends a {@link VApp}.
*
* If the operation is used over a vApp then all VMs are suspended. This
* operation is allowed only when the vApp/VM is powered on.
@ -368,29 +309,7 @@ public interface VAppClient {
Task suspend(URI vAppURI);
/**
* Retrieves the guest customization section of a VM.
*
* <pre>
* GET /vApp/{id}/guestCustomizationSection
* </pre>
*
* @since 1.0
*/
GuestCustomizationSection getGuestCustomizationSection(URI vmURI);
/**
* Modifies the guest customization section of a VM.
*
* <pre>
* PUT /vApp/{id}/guestCustomizationSection
* </pre>
*
* @since 1.0
*/
Task modifyGuestCustomizationSection(URI vmURI, GuestCustomizationSection section);
/**
* Retrieves the lease settings section of a vApp or vApp template.
* Retrieves the lease settings section of a {@link VApp}.
*
* <pre>
* GET /vApp/{id}/leaseSettingsSection
@ -401,7 +320,7 @@ public interface VAppClient {
LeaseSettingsSection getLeaseSettingsSection(URI vAppURI);
/**
* Modifies the lease settings section of a vApp or vApp template.
* Modifies the lease settings section of a {@link VApp}.
*
* <pre>
* PUT /vApp/{id}/leaseSettingsSection
@ -412,29 +331,7 @@ public interface VAppClient {
Task modifyLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section);
/**
* Ejects a media from a VM.
*
* <pre>
* PUT /vApp/{id}/media/action/ejectMedia
* </pre>
*
* @since 0.9
*/
Task ejectMedia(URI vmURI, MediaInsertOrEjectParams mediaParams);
/**
* Inserts a media into a VM.
*
* <pre>
* PUT /vApp/{id}/media/action/insertMedia
* </pre>
*
* @since 0.9
*/
Task insertMedia(URI vmURI, MediaInsertOrEjectParams mediaParams);
/**
* Retrieves the network config section of a vApp or vApp template.
* Retrieves the network config section of a {@link VApp}.
*
* <pre>
* GET /vApp/{id}/networkConfigSection
@ -442,10 +339,10 @@ public interface VAppClient {
*
* @since 0.9
*/
NetworkConfigSection getNetworkConfigSection(URI vmURI);
NetworkConfigSection getNetworkConfigSection(URI vAppURI);
/**
* Modifies the network config section of a vApp.
* Modifies the network config section of a {@link VApp}.
*
* <pre>
* PUT /vApp/{id}/networkConfigSection
@ -453,32 +350,10 @@ public interface VAppClient {
*
* @since 0.9
*/
Task modifyNetworkConfigSection(URI vmURI, NetworkConfigSection section);
Task modifyNetworkConfigSection(URI vAppURI, NetworkConfigSection section);
/**
* Retrieves the network connection section of a VM.
*
* <pre>
* GET /vApp/{id}/networkConnectionSection
* </pre>
*
* @since 0.9
*/
NetworkConnectionSection getNetworkConnectionSection(URI vmURI);
/**
* Modifies the network connection section of a VM.
*
* <pre>
* PUT /vApp/{id}/networkConnectionSection
* </pre>
*
* @since 0.9
*/
Task modifyNetworkConnectionSection(URI vmURI, NetworkConnectionSection section);
/**
* Retrieves the network section of a vApp or vApp template.
* Retrieves the network section of a {@link VApp}.
*
* <pre>
* GET /vApp/{id}/networkSection
@ -489,29 +364,7 @@ public interface VAppClient {
NetworkSection getNetworkSection(URI vAppURI);
/**
* Retrieves the operating system section of a VM.
*
* <pre>
* GET /vApp/{id}/operatingSystemSection
* </pre>
*
* @since 0.9
*/
OperatingSystemSection getOperatingSystemSection(URI vmURI);
/**
* Modifies the operating system section of a VM.
*
* <pre>
* PUT /vApp/{id}/operatingSystemSection
* </pre>
*
* @since 0.9
*/
Task modifyOperatingSystemSection(URI vmURI, OperatingSystemSection section);
/**
* Retrieves the owner of a vApp.
* Retrieves the owner of a {@link VApp}.
*
* <pre>
* GET /vApp/{id}/owner
@ -522,7 +375,7 @@ public interface VAppClient {
Owner getOwner(URI vAppURI);
/**
* Changes VApp owner.
* Changes {@link VApp} owner.
*
* <pre>
* PUT /vApp/{id}/owner
@ -533,7 +386,7 @@ public interface VAppClient {
void modifyOwner(URI vAppURI, Owner owner);
/**
* Retrieves VAppTemplate/VM product sections.
* Retrieves {@link VApp} product sections.
*
* <pre>
* GET /vApp/{id}/productSections
@ -544,7 +397,7 @@ public interface VAppClient {
ProductSectionList getProductSections(URI vAppURI);
/**
* Modifies the product section information of a vApp/VM.
* Modifies the product section information of a {@link VApp}.
*
* <pre>
* PUT /vApp/{id}/productSections
@ -555,74 +408,7 @@ public interface VAppClient {
Task modifyProductSections(URI vAppURI, ProductSectionList sectionList);
/**
* Retrieves a pending question for a VM.
*
* The user should answer to the question by operation {@link #answerQuestion(URI, VmQuestionAnswer)}.
* Usually questions will be asked when the VM is powering on.
*
* <pre>
* GET /vApp/{id}/question
* </pre>
*
* @since 0.9
*/
VmPendingQuestion getPendingQuestion(URI vAppURI);
/**
* Answer on a pending question.
*
* The answer IDs of choice and question should match the ones returned from operation {@link #getPendingQuestion(URI)}.
*
* <pre>
* POST /vApp/{id}/question/action/answer
* </pre>
*
* @since 0.9
*/
void answerQuestion(URI vAppURI, VmQuestionAnswer answer);
/**
* Retrieves the runtime info section of a VM.
*
* <pre>
* GET /vApp/{id}/runtimeInfoSection
* </pre>
*
* @since 1.5
*/
RuntimeInfoSection getRuntimeInfoSection(URI vmURI);
/**
* Retrieves the thumbnail of the screen of a VM.
*
* The content type of the response may vary (e.g. {@code image/png}, {@code image/gif}).
*
* <pre>
* GET /vApp/{id}/screen
* </pre>
*
* @since 0.9
*/
byte[] getScreenImage(URI vAppURI);
/**
* Retrieve a screen ticket for remote console connection to a VM.
*
* A screen ticket is a string that includes the virtual machine's IP address, its managed object reference, and a string
* that has been encoded as described in RFC 2396. Each VM element in a vApp includes a link where rel="screen:acquireTicket".
* You can use that link to request a screen ticket that you can use with the vmware-vmrc utility to open a VMware Remote
* Console for the virtual machine represented by that VM element. The vApp should be running to get a valid screen ticket.
*
* <pre>
* GET /vApp/{id}/screen/action/acquireTicket
* </pre>
*
* @since 0.9
*/
ScreenTicket getScreenTicket(URI vAppURI);
/**
* Retrieves the startup section of a VApp.
* Retrieves the startup section of a {@link VApp}.
*
* <pre>
* GET /vApp/{id}/startupSection
@ -633,7 +419,7 @@ public interface VAppClient {
StartupSection getStartupSection(URI vAppURI);
/**
* Modifies the startup section of a VApp.
* Modifies the startup section of a {@link VApp}.
*
* <pre>
* PUT /vApp/{id}/startupSection
@ -644,150 +430,7 @@ public interface VAppClient {
Task modifyStartupSection(URI vAppURI, StartupSection section);
/**
* Retrieves the virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection
* </pre>
*
* @since 0.9
*/
VirtualHardwareSection getVirtualHardwareSection(URI vmURI);
/**
* Modifies the virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection
* </pre>
*
* @since 0.9
*/
Task modifyVirtualHardwareSection(URI vmURI, VirtualHardwareSection section);
/**
* Retrieves the CPU properties in virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/cpu
* </pre>
*
* @since 0.9
*/
RasdItem getVirtualHardwareSectionCpu(URI vmURI);
/**
* Modifies the CPU properties in virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection/cpu
* </pre>
*
* @since 0.9
*/
Task modifyVirtualHardwareSectionCpu(URI vmURI, RasdItem rasd);
/**
* Retrieves a list of ResourceAllocationSettingData items for disks from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/disks
* </pre>
*
* @since 0.9
*/
RasdItemsList getVirtualHardwareSectionDisks(URI vmURI);
/**
* Modifies the disks list in virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection/disks
* </pre>
*
* @since 0.9
*/
Task modifyVirtualHardwareSectionDisks(URI vmURI, RasdItemsList rasdItemsList);
/**
* Retrieves the list of ResourceAllocationSettingData items that represents the floppies and CD/DVD drives in a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/media
* </pre>
*
* @since 0.9
*/
RasdItemsList getVirtualHardwareSectionMedia(URI vmURI);
/**
* Retrieves the ResourceAllocationSettingData item that contains memory information from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/memory
* </pre>
*
* @since 0.9
*/
RasdItem getVirtualHardwareSectionMemory(URI vmURI);
/**
* Modifies the memory properties in virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection/memory
* </pre>
*
* @since 0.9
*/
Task modifyVirtualHardwareSectionMemory(URI vmURI, RasdItem rasd);
/**
* Retrieves a list of ResourceAllocationSettingData items for network cards from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/networkCards
* </pre>
*
* @since 0.9
*/
RasdItemsList getVirtualHardwareSectionNetworkCards(URI vmURI);
/**
* Modifies the network cards list in virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection/networkCards
* </pre>
*
* @since 0.9
*/
Task modifyVirtualHardwareSectionNetworkCards(URI vmURI, RasdItemsList rasdItemsList);
/**
* Retrieves a list of ResourceAllocationSettingData items for serial ports from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/serialPorts
* </pre>
*
* @since 1.5
*/
RasdItemsList getVirtualHardwareSectionSerialPorts(URI vmURI);
/**
* Modifies the serial ports list in virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection/serialPorts
* </pre>
*
* @since 1.5
*/
Task modifyVirtualHardwareSectionSerialPorts(URI vmURI, RasdItemsList rasdItemsList);
/**
* @return synchronous access to {@link Metadata} features
* Synchronous access to {@link VApp} {@link Metadata} features.
*/
@Delegate
MetadataClient.Writeable getMetadataClient();

View File

@ -0,0 +1,691 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.features;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ANY_IMAGE;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CONTROL_ACCESS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.LEASE_SETTINGS_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.MEDIA_PARAMS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONFIG_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OVF_RASD_ITEM;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OWNER;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.PRODUCT_SECTION_LIST;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.RECOMPOSE_VAPP_PARAMS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.RELOCATE_VM_PARAMS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.STARTUP_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.UNDEPLOY_VAPP_PARAMS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VM_PENDING_ANSWER;
import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList;
import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams;
import org.jclouds.vcloud.director.v1_5.domain.params.RecomposeVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection;
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection;
import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ReturnPayloadBytes;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @author grkvlt@apache.org
* @see VAppClient
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface VmAsyncClient {
/**
* @see VAppClient#getVApp(URI)
*/
@GET
@Consumes(VAPP)
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VApp> getVApp(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyVApp(URI, VApp)
*/
@PUT
@Produces(VAPP)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVApp(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) VApp vApp);
/**
* @see VAppClient#deleteVApp(URI)
*/
@DELETE
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> deleteVApp(@EndpointParam URI vAppURI);
/**
* @see VAppClient#consolidateVm(URI)
*/
@POST
@Path("/action/consolidate")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> consolidateVm(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyControlAccess(URI, ControlAccessParams)
*/
@POST
@Path("/action/controlAccess")
@Produces(CONTROL_ACCESS)
@Consumes(CONTROL_ACCESS)
@JAXBResponseParser
ListenableFuture<ControlAccessParams> modifyControlAccess(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
/**
* @see VAppClient#deploy(URI, DeployVAppParams)
*/
@POST
@Path("/action/deploy")
@Produces(DEPLOY_VAPP_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> deploy(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) DeployVAppParams params);
/**
* @see VAppClient#discardSuspendedState(URI)
*/
@POST
@Path("/action/discardSuspendedState")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vAppURI);
/**
* @see VAppClient#enterMaintenanceMode(URI)
*/
@POST
@Path("/action/enterMaintenanceMode")
@Consumes
@JAXBResponseParser
ListenableFuture<Void> enterMaintenanceMode(@EndpointParam URI vAppURI);
/**
* @see VAppClient#exitMaintenanceMode(URI)
*/
@POST
@Path("/action/exitMaintenanceMode")
@Consumes
@JAXBResponseParser
ListenableFuture<Void> exitMaintenanceMode(@EndpointParam URI vAppURI);
/**
* @see VAppClient#installVMwareTools(URI)
*/
@POST
@Path("/action/installVMwareTools")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> installVMwareTools(@EndpointParam URI vAppURI);
/**
* @see VAppClient#recompose(URI, RecomposeVAppParams)
*/
@POST
@Path("/action/recomposeVApp")
@Produces(RECOMPOSE_VAPP_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> recompose(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RecomposeVAppParams params);
/**
* @see VAppClient#relocateVm(URI, RelocateParams)
*/
@POST
@Path("/action/relocate")
@Produces(RELOCATE_VM_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> relocateVm(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RelocateParams params);
/**
* @see VAppClient#undeploy(URI, UndeployVAppParams)
*/
@POST
@Path("/action/undeploy")
@Produces(UNDEPLOY_VAPP_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> undeploy(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
/**
* @see VAppClient#upgradeHardwareVersion(URI)
*/
@POST
@Path("/action/upgradeHardwareVersion")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getControlAccess(URI)
*/
@GET
@Path("/controlAccess")
@Consumes(CONTROL_ACCESS)
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ControlAccessParams> getControlAccess(@EndpointParam URI vAppURI);
/**
* @see VAppClient#powerOff(URI)
*/
@POST
@Path("/power/action/powerOff")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> powerOff(@EndpointParam URI vAppURI);
/**
* @see VAppClient#powerOn(URI)
*/
@POST
@Path("/power/action/powerOn")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> powerOn(@EndpointParam URI vAppURI);
/**
* @see VAppClient#reboot(URI)
*/
@POST
@Path("/power/action/powerOff")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> reboot(@EndpointParam URI vAppURI);
/**
* @see VAppClient#reset(URI)
*/
@POST
@Path("/power/action/reset")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> reset(@EndpointParam URI vAppURI);
/**
* @see VAppClient#shutdown(URI)
*/
@POST
@Path("/power/action/shutdown")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> shutdown(@EndpointParam URI vAppURI);
/**
* @see VAppClient#suspend(URI)
*/
@POST
@Path("/power/action/suspend")
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> suspend(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getGuestCustomizationSection(URI)
*/
@GET
@Path("/guestCustomizationSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyGuestCustomizationSection(URI, GuestCustomizationSection)
*/
@PUT
@Path("/guestCustomizationSection")
@Produces(GUEST_CUSTOMIZATION_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyGuestCustomizationSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
/**
* @see VAppClient#getLeaseSettingsSection(URI)
*/
@GET
@Path("/leaseSettingsSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyLeaseSettingsSection(URI, LeaseSettingsSection)
*/
@PUT
@Path("/leaseSettingsSection")
@Produces(LEASE_SETTINGS_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyLeaseSettingsSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
/**
* @see VAppClient#ejectMedia(URI, MediaInsertOrEjectParams)
*/
@POST
@Path("/media/action/ejectMedia")
@Produces(MEDIA_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> ejectMedia(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
/**
* @see VAppClient#insertMedia(URI, MediaInsertOrEjectParams)
*/
@POST
@Path("/media/action/insertMedia")
@Produces(MEDIA_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> insertMedia(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
/**
* @see VAppClient#getNetworkConfigSection(URI)
*/
@GET
@Path("/networkConfigSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyNetworkConfigSection(URI, NetworkConfigSection)
*/
@PUT
@Path("/networkConfigSection")
@Produces(NETWORK_CONFIG_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyNetworkConfigSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
/**
* @see VAppClient#getNetworkConnectionSection(URI)
*/
@GET
@Path("/networkConnectionSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection)
*/
@PUT
@Path("/networkConnectionSection")
@Produces(NETWORK_CONNECTION_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyNetworkConnectionSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
/**
* @see VAppClient#getNetworkSection(URI)
*/
@GET
@Path("/networkSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getOperatingSystemSection(URI)
*/
@GET
@Path("/operatingSystemSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyOperatingSystemSection(URI, OperatingSystemSection)
*/
@PUT
@Path("/operatingSystemSection")
@Produces(OPERATING_SYSTEM_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyOperatingSystemSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
/**
* @see VAppClient#getOwner(URI)
*/
@GET
@Path("/owner")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyOwner(URI, Owner)
*/
@PUT
@Path("/owner")
@Produces(OWNER)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Void> modifyOwner(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) Owner owner);
/**
* @see VAppClient#getProductSections(URI)
*/
@GET
@Path("/productSections")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyProductSections(URI, ProductSectionList)
*/
@PUT
@Path("/productSections")
@Produces(PRODUCT_SECTION_LIST)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyProductSections(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
/**
* @see VAppClient#getPendingQuestion(URI)
*/
@GET
@Path("/question")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam URI vAppURI);
/**
* @see VAppClient#answerQuestion(URI, VmQuestionAnswer)
*/
@POST
@Path("/question/action/answer")
@Produces(VM_PENDING_ANSWER)
@Consumes
@JAXBResponseParser
ListenableFuture<Void> answerQuestion(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer);
/**
* @see VAppClient#getRuntimeInfoSection(URI)
*/
@GET
@Path("/runtimeInfoSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam URI vmURI);
/**
* @see VAppClient#getScreenImage(URI)
*/
@GET
@Path("/screen")
@Consumes(ANY_IMAGE)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@ResponseParser(ReturnPayloadBytes.class)
ListenableFuture<byte[]> getScreenImage(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getScreenTicket(URI)
*/
@POST
@Path("/screen/action/acquireTicket")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getStartupSection(URI)
*/
@GET
@Path("/startupSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<StartupSection> getStartupSection(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyStartupSection(URI, StartupSection)
*/
@PUT
@Path("/startupSection")
@Produces(STARTUP_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyStartupSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) StartupSection section);
/**
* @see VAppClient#getVirtualHardwareSection(URI)
*/
@GET
@Path("/virtualHardwareSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSection(URI, VirtualHardwareSection)
*/
@PUT
@Path("/virtualHardwareSection")
@Produces(VIRTUAL_HARDWARE_SECTION)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
/**
* @see VAppClient#getVirtualHardwareSectionCpu(URI)
*/
@GET
@Path("/virtualHardwareSection/cpu")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData)
*/
@PUT
@Path("/virtualHardwareSection/cpu")
@Produces(OVF_RASD_ITEM)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionCpu(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
/**
* @see VAppClient#getVirtualHardwareSectionDisks(URI)
*/
@GET
@Path("/virtualHardwareSection/disks")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionDisks(URI, RasdItemsList)
*/
@PUT
@Path("/virtualHardwareSection/disks")
@Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionDisks(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/**
* @see VAppClient#getVirtualHardwareSectionMedia(URI)
*/
@GET
@Path("/virtualHardwareSection/media")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia(@EndpointParam URI vmURI);
/**
* @see VAppClient#getVirtualHardwareSectionMemory(URI)
*/
@GET
@Path("/virtualHardwareSection/memory")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData)
*/
@PUT
@Path("/virtualHardwareSection/memory")
@Produces(OVF_RASD_ITEM)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionMemory(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
/**
* @see VAppClient#getVirtualHardwareSectionNetworkCards(URI)
*/
@GET
@Path("/virtualHardwareSection/networkCards")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionNetworkCards(URI, RasdItemsList)
*/
@PUT
@Path("/virtualHardwareSection/networkCards")
@Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/**
* @see VAppClient#getVirtualHardwareSectionSerialPorts(URI)
*/
@GET
@Path("/virtualHardwareSection/serialPorts")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionSerialPorts(URI, RasdItemsList)
*/
@PUT
@Path("/virtualHardwareSection/serialPorts")
@Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/**
* @return asynchronous access to {@link Metadata} features
*/
@Delegate
MetadataAsyncClient.Writeable getMetadataClient();
}

View File

@ -0,0 +1,794 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList;
import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams;
import org.jclouds.vcloud.director.v1_5.domain.params.RecomposeVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection;
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection;
import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
/**
* Provides synchronous access to {@link VApp} objects.
*
* @author grkvlt@apache.org
* @see VAppAsyncClient
* @version 1.5
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface VmClient {
/**
* Retrieves a vApp/VM.
*
* The vApp/VM could be in one of these statuses:
* <ul>
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION FAILED_CREATION(-1)} -
* Transient entity state, e.g., model object is created but the corresponding VC backing does not
* exist yet. This is further sub-categorized in the respective entities.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED UNRESOLVED(0)} -
* Entity is whole, e.g., VM creation is complete and all the required model objects and VC backings are
* created.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#RESOLVED RESOLVED(1)} -
* Entity is resolved.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#DEPLOYED DEPLOYED(2)} -
* Entity is deployed.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#SUSPENDED SUSPENDED(3)} -
* All VMs of the vApp are suspended.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_ON POWERED_ON(4)} -
* All VMs of the vApp are powered on.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#WAITING_FOR_INPUT WAITING_FOR_INPUT(5)} -
* VM is pending response on a question.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNKNOWN UNKNOWN(6)} -
* Entity state could not be retrieved from the inventory, e.g., VM power state is null.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRECOGNIZED UNRECOGNIZED(7)} -
* Entity state was retrieved from the inventory but could not be mapped to an internal state.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_OFF POWERED_OFF(8)} -
* All VMs of the vApp are powered off.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#INCONSISTENT_STATE INCONSISTENT_STATE(9)} -
* Apply to VM status, if a vm is {@code POWERED_ON}, or {@code WAITING_FOR_INPUT}, but is
* undeployed, it is in an inconsistent state.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#MIXED MIXED(10)} -
* vApp status is set to {@code MIXED} when the VMs in the vApp are in different power states
* </ul>
*
* <pre>
* GET /vApp/{id}
* </pre>
*
* @since 0.9
*/
VApp getVApp(URI vAppURI);
/**
* Modifies the name/description of a vApp/VM.
*
* <pre>
* PUT /vApp/{id}
* </pre>
*
* @since 0.9
*/
Task modifyVApp(URI vAppURI, VApp vApp);
/**
* Deletes a vApp/VM.
*
* <pre>
* DELETE /vApp/{id}
* </pre>
*
* @since 0.9
*/
Task deleteVApp(URI vAppURI);
/**
* Consolidates a vm.
*
* <pre>
* POST /vApp/{id}/action/consolidate
* </pre>
*
* @since 1.5
*/
Task consolidateVm(URI vAppURI);
/**
* Modifies the control access of a vApp.
*
* <pre>
* POST /vApp/{id}/action/controlAccess
* </pre>
*
* @since 0.9
*/
ControlAccessParams modifyControlAccess(URI vAppURI, ControlAccessParams params);
/**
* Deploys a vApp/VM.
*
* Deployment means allocation of all resource for a vApp/VM like CPU and memory
* from a vDC resource pool. Deploying a vApp automatically deploys all of the
* virtual machines it contains. As of version 1.5 the operation supports force
* customization passed with {@link DeployVAppParamsType#setForceCustomization(Boolean)}
* parameter.
*
* <pre>
* POST /vApp/{id}/action/deploy
* </pre>
*
* @since 0.9
*/
Task deploy(URI vAppURI, DeployVAppParams params);
/**
* Discard suspended state of a vApp/VM.
*
* Discarding suspended state of a vApp automatically discarded suspended
* states of all of the virtual machines it contains.
*
* <pre>
* POST /vApp/{id}/action/discardSuspendedState
* </pre>
*
* @since 0.9
*/
Task discardSuspendedState(URI vAppURI);
/**
* Place the vApp into maintenance mode.
*
* While in maintenance mode, a system admin can operate on the vApp as
* usual, but end users are restricted to read-only operations. Any
* user-initiated tasks running when the vApp enters maintenance mode will
* continue.
*
* <pre>
* POST /vApp/{id}/action/enterMaintenanceMode
* </pre>
*
* @since 1.5
*/
void enterMaintenanceMode(URI vAppURI);
/**
* Take the vApp out of maintenance mode.
*
* <pre>
* POST /vApp/{id}/action/exitMaintenanceMode
* </pre>
*
* @since 1.5
*/
void exitMaintenanceMode(URI vAppURI);
/**
* Installs VMware tools to the virtual machine.
*
* It should be running in order for them to be installed.
*
* <pre>
* POST /vApp/{id}/action/installVMwareTools
* </pre>
*
* @since 1.5
*/
Task installVMwareTools(URI vAppURI);
/**
* Recompose a vApp by removing its own VMs and/or adding new ones from other
* vApps or vApp templates.
*
* To remove VMs you should put their references in elements. The way you add
* VMs is the same as described in compose vApp operation
* {@link VdcClient#composeVApp(URI, org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams)}.
* The status of vApp will be in {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED}
* until the recompose task is finished.
*
* <pre>
* POST /vApp/{id}/action/recomposeVApp
* </pre>
*
* @since 1.0
*/
Task recompose(URI vAppURI, RecomposeVAppParams params);
/**
* Relocates a vm.
*
* <pre>
* POST /vApp/{id}/action/relocate
* </pre>
*
* @since 1.5
*/
Task relocateVm(URI vAppURI, RelocateParams params);
/**
* Undeploy a vApp/VM.
*
* Undeployment means deallocation of all resources for a vApp/VM like CPU
* and memory from a vDC resource pool. Undeploying a vApp automatically
* undeploys all of the virtual machines it contains.
*
* <pre>
* POST /vApp/{id}/action/undeploy
* </pre>
*
* @since 0.9
*/
Task undeploy(URI vAppURI, UndeployVAppParams params);
/**
* Upgrade virtual hardware version of a VM to the highest supported virtual
* hardware version of provider vDC where the VM locates.
*
* <pre>
* POST /vApp/{id}/action/upgradeHardwareVersion
* </pre>
*
* @since 1.5
*/
Task upgradeHardwareVersion(URI vAppURI);
/**
* Retrieves the control access information for a vApp.
*
* The vApp could be shared to everyone or could be shared to specific user,
* by modifying the control access values.
*
* <pre>
* GET /vApp/{id}/controlAccess
* </pre>
*
* @since 0.9
*/
ControlAccessParams getControlAccess(URI vAppURI);
/**
* Powers off a vApp/VM.
*
* If the operation is used over a vApp then all VMs are powered off. This operation is allowed only when the vApp/VM is powered on.
*
* <pre>
* POST /vApp/{id}/power/action/powerOff
* </pre>
*
* @since 0.9
*/
Task powerOff(URI vAppURI);
/**
* Powers on a vApp/VM.
*
* If the operation is used over a vApp then all VMs are powered on. This
* operation is allowed only when the vApp/VM is powered off.
*
* <pre>
* POST /vApp/{id}/power/action/powerOn
* </pre>
*
* @since 0.9
*/
Task powerOn(URI vAppURI);
/**
* Reboots a vApp/VM.
*
* The vApp/VM should be started in order to reboot it.
*
* <pre>
* POST /vApp/{id}/power/action/reboot
* </pre>
*
* @since 0.9
*/
Task reboot(URI vAppURI);
/**
* Resets a vApp/VM.
*
* If the operation is used over a vApp then all VMs are reset. This
* operation is allowed only when the vApp/VM is powered on.
*
* <pre>
* POST /vApp/{id}/power/action/reset
* </pre>
*
* @since 0.9
*/
Task reset(URI vAppURI);
/**
* Shutdowns a vApp/VM.
*
* If the operation is used over a vApp then all VMs are shutdown. This
* operation is allowed only when the vApp/VM is powered on.
*
* <pre>
* POST /vApp/{id}/power/action/shutdown
* </pre>
*
* @since 0.9
*/
Task shutdown(URI vAppURI);
/**
* Suspends a vApp/VM.
*
* If the operation is used over a vApp then all VMs are suspended. This
* operation is allowed only when the vApp/VM is powered on.
*
* <pre>
* POST /vApp/{id}/power/action/suspend
* </pre>
*
* @since 0.9
*/
Task suspend(URI vAppURI);
/**
* Retrieves the guest customization section of a VM.
*
* <pre>
* GET /vApp/{id}/guestCustomizationSection
* </pre>
*
* @since 1.0
*/
GuestCustomizationSection getGuestCustomizationSection(URI vmURI);
/**
* Modifies the guest customization section of a VM.
*
* <pre>
* PUT /vApp/{id}/guestCustomizationSection
* </pre>
*
* @since 1.0
*/
Task modifyGuestCustomizationSection(URI vmURI, GuestCustomizationSection section);
/**
* Retrieves the lease settings section of a vApp or vApp template.
*
* <pre>
* GET /vApp/{id}/leaseSettingsSection
* </pre>
*
* @since 0.9
*/
LeaseSettingsSection getLeaseSettingsSection(URI vAppURI);
/**
* Modifies the lease settings section of a vApp or vApp template.
*
* <pre>
* PUT /vApp/{id}/leaseSettingsSection
* </pre>
*
* @since 0.9
*/
Task modifyLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section);
/**
* Ejects a media from a VM.
*
* <pre>
* PUT /vApp/{id}/media/action/ejectMedia
* </pre>
*
* @since 0.9
*/
Task ejectMedia(URI vmURI, MediaInsertOrEjectParams mediaParams);
/**
* Inserts a media into a VM.
*
* <pre>
* PUT /vApp/{id}/media/action/insertMedia
* </pre>
*
* @since 0.9
*/
Task insertMedia(URI vmURI, MediaInsertOrEjectParams mediaParams);
/**
* Retrieves the network config section of a vApp or vApp template.
*
* <pre>
* GET /vApp/{id}/networkConfigSection
* </pre>
*
* @since 0.9
*/
NetworkConfigSection getNetworkConfigSection(URI vmURI);
/**
* Modifies the network config section of a vApp.
*
* <pre>
* PUT /vApp/{id}/networkConfigSection
* </pre>
*
* @since 0.9
*/
Task modifyNetworkConfigSection(URI vmURI, NetworkConfigSection section);
/**
* Retrieves the network connection section of a VM.
*
* <pre>
* GET /vApp/{id}/networkConnectionSection
* </pre>
*
* @since 0.9
*/
NetworkConnectionSection getNetworkConnectionSection(URI vmURI);
/**
* Modifies the network connection section of a VM.
*
* <pre>
* PUT /vApp/{id}/networkConnectionSection
* </pre>
*
* @since 0.9
*/
Task modifyNetworkConnectionSection(URI vmURI, NetworkConnectionSection section);
/**
* Retrieves the network section of a vApp or vApp template.
*
* <pre>
* GET /vApp/{id}/networkSection
* </pre>
*
* @since 0.9
*/
NetworkSection getNetworkSection(URI vAppURI);
/**
* Retrieves the operating system section of a VM.
*
* <pre>
* GET /vApp/{id}/operatingSystemSection
* </pre>
*
* @since 0.9
*/
OperatingSystemSection getOperatingSystemSection(URI vmURI);
/**
* Modifies the operating system section of a VM.
*
* <pre>
* PUT /vApp/{id}/operatingSystemSection
* </pre>
*
* @since 0.9
*/
Task modifyOperatingSystemSection(URI vmURI, OperatingSystemSection section);
/**
* Retrieves the owner of a vApp.
*
* <pre>
* GET /vApp/{id}/owner
* </pre>
*
* @since 1.5
*/
Owner getOwner(URI vAppURI);
/**
* Changes VApp owner.
*
* <pre>
* PUT /vApp/{id}/owner
* </pre>
*
* @since 1.5
*/
void modifyOwner(URI vAppURI, Owner owner);
/**
* Retrieves VAppTemplate/VM product sections.
*
* <pre>
* GET /vApp/{id}/productSections
* </pre>
*
* @since 1.5
*/
ProductSectionList getProductSections(URI vAppURI);
/**
* Modifies the product section information of a vApp/VM.
*
* <pre>
* PUT /vApp/{id}/productSections
* </pre>
*
* @since 1.5
*/
Task modifyProductSections(URI vAppURI, ProductSectionList sectionList);
/**
* Retrieves a pending question for a VM.
*
* The user should answer to the question by operation {@link #answerQuestion(URI, VmQuestionAnswer)}.
* Usually questions will be asked when the VM is powering on.
*
* <pre>
* GET /vApp/{id}/question
* </pre>
*
* @since 0.9
*/
VmPendingQuestion getPendingQuestion(URI vAppURI);
/**
* Answer on a pending question.
*
* The answer IDs of choice and question should match the ones returned from operation {@link #getPendingQuestion(URI)}.
*
* <pre>
* POST /vApp/{id}/question/action/answer
* </pre>
*
* @since 0.9
*/
void answerQuestion(URI vAppURI, VmQuestionAnswer answer);
/**
* Retrieves the runtime info section of a VM.
*
* <pre>
* GET /vApp/{id}/runtimeInfoSection
* </pre>
*
* @since 1.5
*/
RuntimeInfoSection getRuntimeInfoSection(URI vmURI);
/**
* Retrieves the thumbnail of the screen of a VM.
*
* The content type of the response may vary (e.g. {@code image/png}, {@code image/gif}).
*
* <pre>
* GET /vApp/{id}/screen
* </pre>
*
* @since 0.9
*/
byte[] getScreenImage(URI vAppURI);
/**
* Retrieve a screen ticket for remote console connection to a VM.
*
* A screen ticket is a string that includes the virtual machine's IP address, its managed object reference, and a string
* that has been encoded as described in RFC 2396. Each VM element in a vApp includes a link where rel="screen:acquireTicket".
* You can use that link to request a screen ticket that you can use with the vmware-vmrc utility to open a VMware Remote
* Console for the virtual machine represented by that VM element. The vApp should be running to get a valid screen ticket.
*
* <pre>
* GET /vApp/{id}/screen/action/acquireTicket
* </pre>
*
* @since 0.9
*/
ScreenTicket getScreenTicket(URI vAppURI);
/**
* Retrieves the startup section of a VApp.
*
* <pre>
* GET /vApp/{id}/startupSection
* </pre>
*
* @since 0.9
*/
StartupSection getStartupSection(URI vAppURI);
/**
* Modifies the startup section of a VApp.
*
* <pre>
* PUT /vApp/{id}/startupSection
* </pre>
*
* @since 0.9
*/
Task modifyStartupSection(URI vAppURI, StartupSection section);
/**
* Retrieves the virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection
* </pre>
*
* @since 0.9
*/
VirtualHardwareSection getVirtualHardwareSection(URI vmURI);
/**
* Modifies the virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection
* </pre>
*
* @since 0.9
*/
Task modifyVirtualHardwareSection(URI vmURI, VirtualHardwareSection section);
/**
* Retrieves the CPU properties in virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/cpu
* </pre>
*
* @since 0.9
*/
RasdItem getVirtualHardwareSectionCpu(URI vmURI);
/**
* Modifies the CPU properties in virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection/cpu
* </pre>
*
* @since 0.9
*/
Task modifyVirtualHardwareSectionCpu(URI vmURI, RasdItem rasd);
/**
* Retrieves a list of ResourceAllocationSettingData items for disks from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/disks
* </pre>
*
* @since 0.9
*/
RasdItemsList getVirtualHardwareSectionDisks(URI vmURI);
/**
* Modifies the disks list in virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection/disks
* </pre>
*
* @since 0.9
*/
Task modifyVirtualHardwareSectionDisks(URI vmURI, RasdItemsList rasdItemsList);
/**
* Retrieves the list of ResourceAllocationSettingData items that represents the floppies and CD/DVD drives in a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/media
* </pre>
*
* @since 0.9
*/
RasdItemsList getVirtualHardwareSectionMedia(URI vmURI);
/**
* Retrieves the ResourceAllocationSettingData item that contains memory information from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/memory
* </pre>
*
* @since 0.9
*/
RasdItem getVirtualHardwareSectionMemory(URI vmURI);
/**
* Modifies the memory properties in virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection/memory
* </pre>
*
* @since 0.9
*/
Task modifyVirtualHardwareSectionMemory(URI vmURI, RasdItem rasd);
/**
* Retrieves a list of ResourceAllocationSettingData items for network cards from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/networkCards
* </pre>
*
* @since 0.9
*/
RasdItemsList getVirtualHardwareSectionNetworkCards(URI vmURI);
/**
* Modifies the network cards list in virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection/networkCards
* </pre>
*
* @since 0.9
*/
Task modifyVirtualHardwareSectionNetworkCards(URI vmURI, RasdItemsList rasdItemsList);
/**
* Retrieves a list of ResourceAllocationSettingData items for serial ports from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/serialPorts
* </pre>
*
* @since 1.5
*/
RasdItemsList getVirtualHardwareSectionSerialPorts(URI vmURI);
/**
* Modifies the serial ports list in virtual hardware section of a VM.
*
* <pre>
* PUT /vApp/{id}/virtualHardwareSection/serialPorts
* </pre>
*
* @since 1.5
*/
Task modifyVirtualHardwareSectionSerialPorts(URI vmURI, RasdItemsList rasdItemsList);
/**
* @return synchronous access to {@link Metadata} features
*/
@Delegate
MetadataClient.Writeable getMetadataClient();
}

View File

@ -29,6 +29,7 @@ import org.jclouds.vcloud.director.v1_5.features.UploadAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VmAsyncClient;
import com.google.inject.Provides;
@ -105,4 +106,10 @@ public interface VCloudDirectorAsyncClient {
*/
@Delegate
VAppTemplateAsyncClient getVAppTemplateClient();
/**
* @return asynchronous access to {@link Vm} features
*/
@Delegate
VmAsyncClient getVmClient();
}

View File

@ -33,6 +33,7 @@ import org.jclouds.vcloud.director.v1_5.features.UploadClient;
import org.jclouds.vcloud.director.v1_5.features.VAppClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
import org.jclouds.vcloud.director.v1_5.features.VmClient;
import com.google.inject.Provides;
@ -109,4 +110,10 @@ public interface VCloudDirectorClient {
*/
@Delegate
VAppTemplateClient getVAppTemplateClient();
/**
* @return synchronous access to {@link Vm} features
*/
@Delegate
VmClient getVmClient();
}