added deleteVAppTemplateVAppOrMediaImage to vcloud

This commit is contained in:
Adrian Cole 2011-05-25 17:07:23 -06:00
parent bd69558081
commit 92c5234761
3 changed files with 50 additions and 2 deletions

View File

@ -363,11 +363,20 @@ public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
ListenableFuture<? extends Task> suspendVAppOrVm(@EndpointParam URI vAppOrVmId); ListenableFuture<? extends Task> suspendVAppOrVm(@EndpointParam URI vAppOrVmId);
/** /**
* @see CommonVCloudClient#deleteVApp * @see CommonVCloudClient#deleteVAppTemplateVAppOrMediaImage
*/ */
@DELETE @DELETE
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@XMLResponseParser(TaskHandler.class) @XMLResponseParser(TaskHandler.class)
ListenableFuture<? extends Task> deleteVApp(@EndpointParam URI vAppId); ListenableFuture<? extends Task> deleteVAppTemplateVAppOrMediaImage(@EndpointParam URI id);
/**
* @see CommonVCloudClient#deleteVApp
*/
@Deprecated
@DELETE
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@XMLResponseParser(TaskHandler.class)
ListenableFuture<? extends Task> deleteVApp(@EndpointParam URI id);
} }

View File

@ -261,6 +261,29 @@ public interface VCloudClient extends CommonVCloudClient {
*/ */
Task suspendVAppOrVm(URI vAppOrVmId); Task suspendVAppOrVm(URI vAppOrVmId);
/**
* delete a vAppTemplate, vApp, or media image. You cannot delete an object
* if it is in use. Any object that is being copied or moved is in use. Other
* criteria that determine whether an object is in use depend on the object
* type.
* <ul>
* <li>A vApptemplate is in use if it is being instantiated. After
* instantiation is complete, the template is no longer in use.</li>
* <li>A vApp is in use if it is deployed.</li>
* <li>A media image is in use if it is inserted in a Vm.</li>
* </ul>
*
* @param id
* href of the vAppTemplate, vApp, or media image
* @return task of the operation in progress
*/
Task deleteVAppTemplateVAppOrMediaImage(URI id);
/**
*
* @see deleteVAppTemplateVAppOrMediaImage
*/
@Deprecated
Task deleteVApp(URI vAppId); Task deleteVApp(URI vAppId);
} }

View File

@ -729,6 +729,22 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
checkFilters(request); checkFilters(request);
} }
public void testDeleteVAppTemplateVAppOrMediaImage() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudAsyncClient.class.getMethod("deleteVAppTemplateVAppOrMediaImage", URI.class);
HttpRequest request = processor.createRequest(method,
URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
assertRequestLineEquals(request, "DELETE https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "");
assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, TaskHandler.class);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
checkFilters(request);
}
public void testPowerOnVAppOrVm() throws SecurityException, NoSuchMethodException, IOException { public void testPowerOnVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudAsyncClient.class.getMethod("powerOnVAppOrVm", URI.class); Method method = VCloudAsyncClient.class.getMethod("powerOnVAppOrVm", URI.class);
HttpRequest request = processor.createRequest(method, HttpRequest request = processor.createRequest(method,