mirror of https://github.com/apache/jclouds.git
Issue 830: refactored MediaClient to not require href arg; refactored VmApi, VAppApi, VAppTemplateApi to use urn
This commit is contained in:
parent
cd0aa72ae1
commit
169006b3ed
|
@ -43,6 +43,7 @@
|
|||
<!-- URN format: ex. urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4 -->
|
||||
<test.vcloud-director.catalog-id></test.vcloud-director.catalog-id>
|
||||
<test.vcloud-director.media-id></test.vcloud-director.media-id>
|
||||
<!-- URN format: ex. urn:vcloud:vapptemplate:7212e451-76e1-4631-b2de-ba1dfd8080e4 -->
|
||||
<test.vcloud-director.vapptemplate-id></test.vcloud-director.vapptemplate-id>
|
||||
<!-- URN format: ex. urn:vcloud:network:7212e451-76e1-4631-b2de-ba1dfd8080e4 -->
|
||||
<test.vcloud-director.network-id></test.vcloud-director.network-id>
|
||||
|
|
|
@ -23,9 +23,12 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.CatalogItemURNToHref;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.CatalogURNToHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link Catalog} objects.
|
||||
|
@ -118,12 +121,18 @@ public interface CatalogApi {
|
|||
* @return synchronous access to {@link Metadata.Readable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataApi.Readable getMetadataApi();
|
||||
MetadataApi.Readable getMetadataApi(@EndpointParam(parser = CatalogURNToHref.class) String catalogUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataApi.Readable getMetadataApi(@EndpointParam URI catalogItemHref);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Metadata.Writeable} features for CatalogItems
|
||||
*/
|
||||
@Delegate
|
||||
MetadataApi.Writeable getItemMetadataApi();
|
||||
MetadataApi.Writeable getItemMetadataApi(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataApi.Writeable getItemMetadataApi(@EndpointParam URI catalogItemHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -151,11 +151,18 @@ public interface CatalogAsyncApi {
|
|||
* @return asynchronous access to {@link Metadata.Readable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncApi.Readable getMetadataApi();
|
||||
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = CatalogURNToHref.class) String catalogUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI catalogItemHref);
|
||||
|
||||
/**
|
||||
* @see CatalogApi#getItemMetadataApi
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getItemMetadataApi();
|
||||
MetadataAsyncApi.Writeable getItemMetadataApi(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getItemMetadataApi(@EndpointParam URI catalogItemHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,10 +23,13 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
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.Owner;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.CloneMediaParams;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.MediaURNToHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link Media}.
|
||||
|
@ -84,6 +87,9 @@ public interface MediaApi {
|
|||
* @return synchronous access to {@link Metadata.Writeable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi();
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam URI mediaUri);
|
||||
|
||||
}
|
||||
|
|
|
@ -38,10 +38,12 @@ import org.jclouds.rest.binders.BindToXMLPayload;
|
|||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
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.Owner;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.CloneMediaParams;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.MediaURNToHref;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -114,5 +116,8 @@ public interface MediaAsyncApi {
|
|||
* @return asynchronous access to {@link Metadata.Writeable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi();
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI uri);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
|
@ -41,14 +40,14 @@ public interface MetadataApi {
|
|||
*
|
||||
* @return a list of metadata
|
||||
*/
|
||||
Metadata get(URI uri);
|
||||
Metadata get();
|
||||
|
||||
/**
|
||||
* Retrieves a metadata value
|
||||
*
|
||||
* @return the metadata value, or null if not found
|
||||
*/
|
||||
MetadataValue getValue(URI uri, String key);
|
||||
MetadataValue getValue(String key);
|
||||
}
|
||||
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
|
@ -60,7 +59,7 @@ public interface MetadataApi {
|
|||
* @return a task. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
*/
|
||||
Task merge(URI uri, Metadata metadata);
|
||||
Task merge(Metadata metadata);
|
||||
|
||||
/**
|
||||
* Sets the metadata for the particular key for the media to the value provided. Note: this
|
||||
|
@ -69,7 +68,7 @@ public interface MetadataApi {
|
|||
* @return a task. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
*/
|
||||
Task putEntry(URI uri, String key, MetadataValue metadataValue);
|
||||
Task putEntry(String key, MetadataValue metadataValue);
|
||||
|
||||
/**
|
||||
* Deletes a metadata entry.
|
||||
|
@ -77,7 +76,7 @@ public interface MetadataApi {
|
|||
* @return a task. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
*/
|
||||
Task removeEntry(URI uri, String key);
|
||||
Task removeEntry(String key);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ 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.RequestFilters;
|
||||
|
@ -38,6 +37,7 @@ import org.jclouds.rest.binders.BindToXMLPayload;
|
|||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
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.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
|
@ -48,7 +48,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
* @see MetadataApi
|
||||
* @author danikov
|
||||
*/
|
||||
//TODO: take out the endpoint params and supply them in the Delegate calls.
|
||||
// TODO: take out the endpoint params and supply them in the Delegate calls.
|
||||
public interface MetadataAsyncApi {
|
||||
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
|
@ -62,17 +62,17 @@ public interface MetadataAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Metadata> get(@EndpointParam URI metaDataUri);
|
||||
ListenableFuture<Metadata> get();
|
||||
|
||||
/**
|
||||
* @see MetadataApi.Readable#getValue(URI, String)
|
||||
* @see MetadataApi.Readable#getValue(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/metadata/{key}")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<MetadataValue> getValue(@EndpointParam URI metaDataUri, @PathParam("key") String key);
|
||||
ListenableFuture<MetadataValue> getValue(@PathParam("key") String key);
|
||||
|
||||
}
|
||||
|
||||
|
@ -80,18 +80,17 @@ public interface MetadataAsyncApi {
|
|||
public static interface Writeable extends Readable {
|
||||
|
||||
/**
|
||||
* @see MetadataApi.Writable#merge(URI, Metadata))
|
||||
* @see MetadataApi.Writable#merge(Metadata)
|
||||
*/
|
||||
@POST
|
||||
@Path("/metadata")
|
||||
@Consumes(VCloudDirectorMediaType.TASK)
|
||||
@Produces(VCloudDirectorMediaType.METADATA)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> merge(@EndpointParam URI metaDataUri,
|
||||
@BinderParam(BindToXMLPayload.class) Metadata metadata);
|
||||
ListenableFuture<Task> merge(@BinderParam(BindToXMLPayload.class) Metadata metadata);
|
||||
|
||||
/**
|
||||
* @see MetadataApi.Writeable#putEntry(URI, String, MetadataEntry))
|
||||
* @see MetadataApi.Writeable#putEntry(String, MetadataEntry)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/metadata/{key}")
|
||||
|
@ -99,17 +98,17 @@ public interface MetadataAsyncApi {
|
|||
@Produces(VCloudDirectorMediaType.METADATA_VALUE)
|
||||
@JAXBResponseParser
|
||||
// TODO: this is rediculous. get rid of the MetadataValue type, as it is only a string!
|
||||
ListenableFuture<Task> putEntry(@EndpointParam URI metaDataUri, @PathParam("key") String key,
|
||||
ListenableFuture<Task> putEntry(@PathParam("key") String key,
|
||||
@BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
|
||||
|
||||
/**
|
||||
* @see MetadataApi.Writable#removeEntry(URI, String))
|
||||
* @see MetadataApi.Writable#removeEntry(String)
|
||||
*/
|
||||
@DELETE
|
||||
@Path("/metadata/{key}")
|
||||
@Consumes(VCloudDirectorMediaType.TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> removeEntry(@EndpointParam URI metaDataUri, @PathParam("key") String key);
|
||||
ListenableFuture<Task> removeEntry(@PathParam("key") String key);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.network.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.NetworkURNToHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link Network}.
|
||||
|
@ -48,5 +50,8 @@ public interface NetworkApi {
|
|||
* @return synchronous access to {@link Metadata.Readable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataApi.Readable getMetadataApi();
|
||||
MetadataApi.Readable getMetadataApi(@EndpointParam(parser = NetworkURNToHref.class) String networkUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataApi.Readable getMetadataApi(@EndpointParam URI networkHref);
|
||||
}
|
||||
|
|
|
@ -65,6 +65,9 @@ public interface NetworkAsyncApi {
|
|||
* @return asynchronous access to {@link Metadata.Readable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncApi.Readable getMetadataApi();
|
||||
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = NetworkURNToHref.class) String networkUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI networkHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,9 +23,11 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.org.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link Org}.
|
||||
|
@ -64,5 +66,9 @@ public interface OrgApi {
|
|||
* @return synchronous access to {@link Metadata.Readable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataApi.Readable getMetadataApi();
|
||||
MetadataApi.Readable getMetadataApi(@EndpointParam(parser = OrgURNToHref.class) String orgUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataApi.Readable getMetadataApi(@EndpointParam URI orgHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -76,5 +76,9 @@ public interface OrgAsyncApi {
|
|||
* @return asynchronous access to {@link Metadata.Readable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncApi.Readable getMetadataApi();
|
||||
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = OrgURNToHref.class) String orgUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI orgHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ 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.rest.annotations.EndpointParam;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
|
||||
|
@ -36,11 +37,12 @@ import org.jclouds.vcloud.director.v1_5.domain.params.RecomposeVAppParams;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
|
||||
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.functions.href.VAppURNToHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link VApp} objects.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
* @author grkvlt@apache.org, Adrian Cole
|
||||
* @see VAppAsyncApi
|
||||
* @version 1.5
|
||||
*/
|
||||
|
@ -52,33 +54,38 @@ public interface VAppApi {
|
|||
*
|
||||
* 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 addd 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
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION
|
||||
* FAILED_CREATION(-1)} - Transient entity state, e.g., model object is addd 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>
|
||||
|
@ -87,7 +94,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
VApp getVApp(URI vAppURI);
|
||||
VApp get(String vAppUrn);
|
||||
|
||||
VApp get(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Modifies the name/description of a {@link VApp}.
|
||||
|
@ -98,7 +107,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editVApp(URI vAppURI, VApp vApp);
|
||||
Task edit(String vAppUrn, VApp vApp);
|
||||
|
||||
Task edit(URI vAppHref, VApp vApp);
|
||||
|
||||
/**
|
||||
* Deletes a {@link VApp}.
|
||||
|
@ -109,7 +120,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task removeVApp(URI vAppURI);
|
||||
Task remove(String vAppUrn);
|
||||
|
||||
Task remove(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Modifies the control access of a {@link VApp}.
|
||||
|
@ -120,16 +133,17 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
ControlAccessParams editControlAccess(URI vAppURI, ControlAccessParams params);
|
||||
ControlAccessParams editControlAccess(String vAppUrn, ControlAccessParams params);
|
||||
|
||||
ControlAccessParams editControlAccess(URI vAppHref, ControlAccessParams params);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* virtual machines it contains. As of version 1.5 the operation supports force
|
||||
* customization passed with {@link DeployVAppParamsType#setForceCustomization(Boolean)}
|
||||
* parameter.
|
||||
* 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
|
||||
|
@ -137,13 +151,15 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task deploy(URI vAppURI, DeployVAppParams params);
|
||||
Task deploy(String vAppUrn, DeployVAppParams params);
|
||||
|
||||
Task deploy(URI vAppHref, DeployVAppParams params);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Discarding suspended state of a vApp automatically discarded suspended states of all of the
|
||||
* virtual machines it contains.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/action/discardSuspendedState
|
||||
|
@ -151,15 +167,16 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task discardSuspendedState(URI vAppURI);
|
||||
Task discardSuspendedState(String vAppUrn);
|
||||
|
||||
Task discardSuspendedState(URI vAppHref);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* user-initiated tasks running when the vApp enters maintenance mode will
|
||||
* continue.
|
||||
* 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
|
||||
|
@ -167,7 +184,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
void enterMaintenanceMode(URI vAppURI);
|
||||
void enterMaintenanceMode(String vAppUrn);
|
||||
|
||||
void enterMaintenanceMode(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Take the {@link VApp} out of maintenance mode.
|
||||
|
@ -178,17 +197,20 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
void exitMaintenanceMode(URI vAppURI);
|
||||
void exitMaintenanceMode(String vAppUrn);
|
||||
|
||||
void exitMaintenanceMode(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Recompose a {@link VApp} by removing its own VMs and/or adding new ones from other
|
||||
* vApps or vApp templates.
|
||||
* 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
|
||||
* VMs is the same as described in compose vApp operation
|
||||
* {@link VdcApi#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.
|
||||
* 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 VdcApi#composeVApp(String, 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
|
||||
|
@ -196,14 +218,16 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
Task recompose(URI vAppURI, RecomposeVAppParams params);
|
||||
Task recompose(String vAppUrn, RecomposeVAppParams params);
|
||||
|
||||
Task recompose(URI vAppHref, RecomposeVAppParams params);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* undeploys all of the virtual machines it contains.
|
||||
* 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
|
||||
|
@ -211,13 +235,15 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task undeploy(URI vAppURI, UndeployVAppParams params);
|
||||
Task undeploy(String vAppUrn, UndeployVAppParams params);
|
||||
|
||||
Task undeploy(URI vAppHref, UndeployVAppParams params);
|
||||
|
||||
/**
|
||||
* Retrieves the control access information for a {@link VApp}.
|
||||
*
|
||||
* The vApp could be shared to everyone or could be shared to specific user,
|
||||
* by editing the control access values.
|
||||
* The vApp could be shared to everyone or could be shared to specific user, by editing the
|
||||
* control access values.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/controlAccess
|
||||
|
@ -225,13 +251,16 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
//TODO: revise
|
||||
ControlAccessParams getControlAccess(URI vAppURI);
|
||||
// TODO: revise
|
||||
ControlAccessParams getAccessControl(String vAppUrn);
|
||||
|
||||
ControlAccessParams getAccessControl(URI vAppHref);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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
|
||||
|
@ -239,13 +268,15 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task powerOff(URI vAppURI);
|
||||
Task powerOff(String vAppUrn);
|
||||
|
||||
Task powerOff(URI vAppHref);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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
|
||||
|
@ -253,7 +284,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task powerOn(URI vAppURI);
|
||||
Task powerOn(String vAppUrn);
|
||||
|
||||
Task powerOn(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Reboots a {@link VApp}.
|
||||
|
@ -266,13 +299,15 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task reboot(URI vAppURI);
|
||||
Task reboot(String vAppUrn);
|
||||
|
||||
Task reboot(URI vAppHref);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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
|
||||
|
@ -280,13 +315,15 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task reset(URI vAppURI);
|
||||
Task reset(String vAppUrn);
|
||||
|
||||
Task reset(URI vAppHref);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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
|
||||
|
@ -294,13 +331,15 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task shutdown(URI vAppURI);
|
||||
Task shutdown(String vAppUrn);
|
||||
|
||||
Task shutdown(URI vAppHref);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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
|
||||
|
@ -308,7 +347,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task suspend(URI vAppURI);
|
||||
Task suspend(String vAppUrn);
|
||||
|
||||
Task suspend(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Retrieves the lease settings section of a {@link VApp}.
|
||||
|
@ -319,7 +360,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
LeaseSettingsSection getLeaseSettingsSection(URI vAppURI);
|
||||
LeaseSettingsSection getLeaseSettingsSection(String vAppUrn);
|
||||
|
||||
LeaseSettingsSection getLeaseSettingsSection(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Modifies the lease settings section of a {@link VApp}.
|
||||
|
@ -330,7 +373,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section);
|
||||
Task editLeaseSettingsSection(String vAppUrn, LeaseSettingsSection section);
|
||||
|
||||
Task editLeaseSettingsSection(URI vAppHref, LeaseSettingsSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the network config section of a {@link VApp}.
|
||||
|
@ -341,7 +386,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
NetworkConfigSection getNetworkConfigSection(URI vAppURI);
|
||||
NetworkConfigSection getNetworkConfigSection(String vAppUrn);
|
||||
|
||||
NetworkConfigSection getNetworkConfigSection(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Modifies the network config section of a {@link VApp}.
|
||||
|
@ -352,7 +399,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editNetworkConfigSection(URI vAppURI, NetworkConfigSection section);
|
||||
Task editNetworkConfigSection(String vAppUrn, NetworkConfigSection section);
|
||||
|
||||
Task editNetworkConfigSection(URI vAppHref, NetworkConfigSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the network section of a {@link VApp}.
|
||||
|
@ -363,7 +412,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
NetworkSection getNetworkSection(URI vAppURI);
|
||||
NetworkSection getNetworkSection(String vAppUrn);
|
||||
|
||||
NetworkSection getNetworkSection(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Retrieves the owner of a {@link VApp}.
|
||||
|
@ -374,7 +425,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Owner getOwner(URI vAppURI);
|
||||
Owner getOwner(String vAppUrn);
|
||||
|
||||
Owner getOwner(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Changes {@link VApp} owner.
|
||||
|
@ -385,7 +438,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
void editOwner(URI vAppURI, Owner owner);
|
||||
void editOwner(String vAppUrn, Owner owner);
|
||||
|
||||
void editOwner(URI vAppHref, Owner owner);
|
||||
|
||||
/**
|
||||
* Retrieves {@link VApp} product sections.
|
||||
|
@ -396,7 +451,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
ProductSectionList getProductSections(URI vAppURI);
|
||||
ProductSectionList getProductSections(String vAppUrn);
|
||||
|
||||
ProductSectionList getProductSections(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Modifies the product section information of a {@link VApp}.
|
||||
|
@ -407,7 +464,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task editProductSections(URI vAppURI, ProductSectionList sectionList);
|
||||
Task editProductSections(String vAppUrn, ProductSectionList sectionList);
|
||||
|
||||
Task editProductSections(URI vAppHref, ProductSectionList sectionList);
|
||||
|
||||
/**
|
||||
* Retrieves the startup section of a {@link VApp}.
|
||||
|
@ -418,7 +477,9 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
StartupSection getStartupSection(URI vAppURI);
|
||||
StartupSection getStartupSection(String vAppUrn);
|
||||
|
||||
StartupSection getStartupSection(URI vAppHref);
|
||||
|
||||
/**
|
||||
* Modifies the startup section of a {@link VApp}.
|
||||
|
@ -429,11 +490,17 @@ public interface VAppApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editStartupSection(URI vAppURI, StartupSection section);
|
||||
Task editStartupSection(String vAppUrn, StartupSection section);
|
||||
|
||||
Task editStartupSection(URI vAppHref, StartupSection section);
|
||||
|
||||
/**
|
||||
* Synchronous access to {@link VApp} {@link Metadata} features.
|
||||
*/
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi();
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam URI vAppHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ import org.jclouds.rest.annotations.JAXBResponseParser;
|
|||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.binders.BindToXMLPayload;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
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.Task;
|
||||
|
@ -61,6 +62,7 @@ import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
|
|||
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.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.VAppURNToHref;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -72,31 +74,309 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
public interface VAppAsyncApi {
|
||||
|
||||
/**
|
||||
* @see VAppApi#getVApp(URI)
|
||||
* @see VAppApi#get(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPP)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<VApp> getVApp(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<VApp> get(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editVApp(URI, VApp)
|
||||
* @see VAppApi#edit(String, VApp)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(VAPP)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVApp(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) VApp vApp);
|
||||
ListenableFuture<Task> edit(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
|
||||
@BinderParam(BindToXMLPayload.class) VApp vApp);
|
||||
|
||||
/**
|
||||
* @see VAppApi#removeVApp(URI)
|
||||
* @see VAppApi#remove(String)
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> removeVApp(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> remove(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editControlAccess(String, ControlAccessParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/controlAccess")
|
||||
@Produces(CONTROL_ACCESS)
|
||||
@Consumes(CONTROL_ACCESS)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<ControlAccessParams> editControlAccess(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
|
||||
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
|
||||
|
||||
/**
|
||||
* @see VAppApi#deploy(String, DeployVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/deploy")
|
||||
@Produces(DEPLOY_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> deploy(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
|
||||
@BinderParam(BindToXMLPayload.class) DeployVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VAppApi#discardSuspendedState(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/discardSuspendedState")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> discardSuspendedState(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#enterMaintenanceMode(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/enterMaintenanceMode")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> enterMaintenanceMode(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#exitMaintenanceMode(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/exitMaintenanceMode")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> exitMaintenanceMode(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#recompose(String, RecomposeVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/recomposeVApp")
|
||||
@Produces(RECOMPOSE_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> recompose(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
|
||||
@BinderParam(BindToXMLPayload.class) RecomposeVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VAppApi#undeploy(String, UndeployVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/undeploy")
|
||||
@Produces(UNDEPLOY_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> undeploy(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
|
||||
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getAccessControl(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/controlAccess")
|
||||
@Consumes(CONTROL_ACCESS)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#powerOff(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/powerOff")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> powerOff(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#powerOn(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/powerOn")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> powerOn(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#reboot(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/powerOff")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> reboot(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#reset(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/reset")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> reset(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#shutdown(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/shutdown")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> shutdown(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#suspend(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/suspend")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> suspend(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getLeaseSettingsSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/leaseSettingsSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(
|
||||
@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editLeaseSettingsSection(String, LeaseSettingsSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/leaseSettingsSection")
|
||||
@Produces(LEASE_SETTINGS_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
|
||||
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getNetworkConfigSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/networkConfigSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(
|
||||
@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editNetworkConfigSection(String, NetworkConfigSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/networkConfigSection")
|
||||
@Produces(NETWORK_CONFIG_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editNetworkConfigSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getNetworkSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/networkSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getOwner(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/owner")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Owner> getOwner(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editOwner(String, Owner)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/owner")
|
||||
@Produces(OWNER)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> editOwner(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
|
||||
@BinderParam(BindToXMLPayload.class) Owner owner);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getProductSections(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/productSections")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editProductSections(String, ProductSectionList)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/productSections")
|
||||
@Produces(PRODUCT_SECTION_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editProductSections(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getStartupSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/startupSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<StartupSection> getStartupSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editStartupSection(String, StartupSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/startupSection")
|
||||
@Produces(STARTUP_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editStartupSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
|
||||
@BinderParam(BindToXMLPayload.class) StartupSection section);
|
||||
|
||||
/**
|
||||
* @see VAppApi#get(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPP)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<VApp> get(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#edit(URI, VApp)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(VAPP)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> edit(@EndpointParam URI vAppHref, @BinderParam(BindToXMLPayload.class) VApp vApp);
|
||||
|
||||
/**
|
||||
* @see VAppApi#remove(URI)
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> remove(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editControlAccess(URI, ControlAccessParams)
|
||||
|
@ -106,8 +386,8 @@ public interface VAppAsyncApi {
|
|||
@Produces(CONTROL_ACCESS)
|
||||
@Consumes(CONTROL_ACCESS)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<ControlAccessParams> editControlAccess(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
|
||||
ListenableFuture<ControlAccessParams> editControlAccess(@EndpointParam URI vAppHref,
|
||||
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
|
||||
|
||||
/**
|
||||
* @see VAppApi#deploy(URI, DeployVAppParams)
|
||||
|
@ -117,8 +397,8 @@ public interface VAppAsyncApi {
|
|||
@Produces(DEPLOY_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> deploy(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) DeployVAppParams params);
|
||||
ListenableFuture<Task> deploy(@EndpointParam URI vAppHref,
|
||||
@BinderParam(BindToXMLPayload.class) DeployVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VAppApi#discardSuspendedState(URI)
|
||||
|
@ -127,7 +407,7 @@ public interface VAppAsyncApi {
|
|||
@Path("/action/discardSuspendedState")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#enterMaintenanceMode(URI)
|
||||
|
@ -136,7 +416,7 @@ public interface VAppAsyncApi {
|
|||
@Path("/action/enterMaintenanceMode")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> enterMaintenanceMode(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Void> enterMaintenanceMode(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#exitMaintenanceMode(URI)
|
||||
|
@ -145,7 +425,7 @@ public interface VAppAsyncApi {
|
|||
@Path("/action/exitMaintenanceMode")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> exitMaintenanceMode(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Void> exitMaintenanceMode(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#recompose(URI, RecomposeVAppParams)
|
||||
|
@ -155,8 +435,8 @@ public interface VAppAsyncApi {
|
|||
@Produces(RECOMPOSE_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> recompose(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) RecomposeVAppParams params);
|
||||
ListenableFuture<Task> recompose(@EndpointParam URI vAppHref,
|
||||
@BinderParam(BindToXMLPayload.class) RecomposeVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VAppApi#undeploy(URI, UndeployVAppParams)
|
||||
|
@ -166,18 +446,18 @@ public interface VAppAsyncApi {
|
|||
@Produces(UNDEPLOY_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> undeploy(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
|
||||
ListenableFuture<Task> undeploy(@EndpointParam URI vAppHref,
|
||||
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getControlAccess(URI)
|
||||
* @see VAppApi#getAccessControl(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/controlAccess")
|
||||
@Consumes(CONTROL_ACCESS)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ControlAccessParams> getControlAccess(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#powerOff(URI)
|
||||
|
@ -186,7 +466,7 @@ public interface VAppAsyncApi {
|
|||
@Path("/power/action/powerOff")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> powerOff(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> powerOff(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#powerOn(URI)
|
||||
|
@ -195,7 +475,7 @@ public interface VAppAsyncApi {
|
|||
@Path("/power/action/powerOn")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> powerOn(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> powerOn(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#reboot(URI)
|
||||
|
@ -204,7 +484,7 @@ public interface VAppAsyncApi {
|
|||
@Path("/power/action/powerOff")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> reboot(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> reboot(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#reset(URI)
|
||||
|
@ -213,7 +493,7 @@ public interface VAppAsyncApi {
|
|||
@Path("/power/action/reset")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> reset(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> reset(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#shutdown(URI)
|
||||
|
@ -222,7 +502,7 @@ public interface VAppAsyncApi {
|
|||
@Path("/power/action/shutdown")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> shutdown(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> shutdown(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#suspend(URI)
|
||||
|
@ -231,7 +511,7 @@ public interface VAppAsyncApi {
|
|||
@Path("/power/action/suspend")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> suspend(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> suspend(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getLeaseSettingsSection(URI)
|
||||
|
@ -241,7 +521,7 @@ public interface VAppAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editLeaseSettingsSection(URI, LeaseSettingsSection)
|
||||
|
@ -251,8 +531,8 @@ public interface VAppAsyncApi {
|
|||
@Produces(LEASE_SETTINGS_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
|
||||
ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam URI vAppHref,
|
||||
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getNetworkConfigSection(URI)
|
||||
|
@ -262,7 +542,7 @@ public interface VAppAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editNetworkConfigSection(URI, NetworkConfigSection)
|
||||
|
@ -272,8 +552,8 @@ public interface VAppAsyncApi {
|
|||
@Produces(NETWORK_CONFIG_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editNetworkConfigSection(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
|
||||
ListenableFuture<Task> editNetworkConfigSection(@EndpointParam URI vAppHref,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getNetworkSection(URI)
|
||||
|
@ -283,7 +563,7 @@ public interface VAppAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getOwner(URI)
|
||||
|
@ -293,7 +573,7 @@ public interface VAppAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Owner> getOwner(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Owner> getOwner(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editOwner(URI, Owner)
|
||||
|
@ -303,8 +583,7 @@ public interface VAppAsyncApi {
|
|||
@Produces(OWNER)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> editOwner(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) Owner owner);
|
||||
ListenableFuture<Void> editOwner(@EndpointParam URI vAppHref, @BinderParam(BindToXMLPayload.class) Owner owner);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getProductSections(URI)
|
||||
|
@ -314,7 +593,7 @@ public interface VAppAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editProductSections(URI, ProductSectionList)
|
||||
|
@ -324,9 +603,8 @@ public interface VAppAsyncApi {
|
|||
@Produces(PRODUCT_SECTION_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editProductSections(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
|
||||
|
||||
ListenableFuture<Task> editProductSections(@EndpointParam URI vAppHref,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
|
||||
|
||||
/**
|
||||
* @see VAppApi#getStartupSection(URI)
|
||||
|
@ -336,7 +614,7 @@ public interface VAppAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<StartupSection> getStartupSection(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<StartupSection> getStartupSection(@EndpointParam URI vAppHref);
|
||||
|
||||
/**
|
||||
* @see VAppApi#editStartupSection(URI, StartupSection)
|
||||
|
@ -346,12 +624,16 @@ public interface VAppAsyncApi {
|
|||
@Produces(STARTUP_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editStartupSection(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) StartupSection section);
|
||||
ListenableFuture<Task> editStartupSection(@EndpointParam URI vAppHref,
|
||||
@BinderParam(BindToXMLPayload.class) StartupSection section);
|
||||
|
||||
/**
|
||||
* Asynchronous access to {@link VApp} {@link Metadata} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi();
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI vAppHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -24,24 +24,24 @@ import java.util.concurrent.TimeUnit;
|
|||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.dmtf.ovf.NetworkSection;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
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.References;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.dmtf.Envelope;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.CustomizationSection;
|
||||
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.functions.href.VAppTemplateURNToHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link VAppTemplate} objects.
|
||||
*
|
||||
* @author Adam Lowe
|
||||
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncApi
|
||||
* @author Adam Lowe, Adrian Cole
|
||||
* @see VAppTemplateAsyncApi
|
||||
*/
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface VAppTemplateApi {
|
||||
|
@ -51,29 +51,36 @@ public interface VAppTemplateApi {
|
|||
*
|
||||
* The vApp could be in one of these statues:
|
||||
* <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 addd 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 addd.
|
||||
* <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#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#POWERED_OFF POWERED_OFF(8)} -
|
||||
* All VMs of the vApp template are powered off.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#MIXED MIXED(10)} -
|
||||
* vApp template status is set to {@code MIXED} when the VMs in the vApp are in different power states.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION
|
||||
* FAILED_CREATION(-1)} - Transient entity state, e.g., model object is addd 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 addd.
|
||||
* <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#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#POWERED_OFF
|
||||
* POWERED_OFF(8)} - All VMs of the vApp template are powered off.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#MIXED MIXED(10)}
|
||||
* - vApp template status is set to {@code MIXED} when the VMs in the vApp are in different power
|
||||
* states.
|
||||
* </ul>
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the requested template
|
||||
*/
|
||||
VAppTemplate getVAppTemplate(URI templateUri);
|
||||
VAppTemplate get(String templateUrn);
|
||||
|
||||
VAppTemplate get(URI templateHref);
|
||||
|
||||
/**
|
||||
* Modifies only the name/description of a vApp template.
|
||||
|
@ -82,12 +89,16 @@ public interface VAppTemplateApi {
|
|||
* PUT /vAppTemplate/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param template the template containing the new name and/or description
|
||||
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @param template
|
||||
* the template containing the new name and/or description
|
||||
* @return the task performing the action. This operation is asynchronous and the user should
|
||||
* monitor the returned task status in order to check when it is completed.
|
||||
*/
|
||||
Task editVAppTemplate(URI templateUri, VAppTemplate template);
|
||||
Task edit(String templateUrn, VAppTemplate template);
|
||||
|
||||
Task edit(URI templateHref, VAppTemplate template);
|
||||
|
||||
/**
|
||||
* Deletes a vApp template.
|
||||
|
@ -96,24 +107,14 @@ public interface VAppTemplateApi {
|
|||
* DELETE /vAppTemplate/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the task performing the action. This operation is asynchronous and the user should
|
||||
* monitor the returned task status in order to check when it is completed.
|
||||
*/
|
||||
Task removeVappTemplate(URI templateUri);
|
||||
Task remove(String templateUrn);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
*
|
||||
* <pre>
|
||||
* POST /vAppTemplate/{id}/action/consolidate
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
*/
|
||||
Task consolidateVm(URI templateUri);
|
||||
Task remove(URI templateHref);
|
||||
|
||||
/**
|
||||
* Disables the download link to the ovf of a vApp template.
|
||||
|
@ -122,9 +123,12 @@ public interface VAppTemplateApi {
|
|||
* POST /vAppTemplate/{id}/action/disableDownload
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
*/
|
||||
void disableDownload(URI templateUri);
|
||||
void disableDownload(String templateUrn);
|
||||
|
||||
void disableDownload(URI templateHref);
|
||||
|
||||
/**
|
||||
* Enables downloading of the ovf of a vApp template.
|
||||
|
@ -133,25 +137,14 @@ public interface VAppTemplateApi {
|
|||
* POST /vAppTemplate/{id}/action/enableDownload
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the task performing the action. This operation is asynchronous and the user should
|
||||
* monitor the returned task status in order to check when it is completed.
|
||||
*/
|
||||
Task enableDownload(URI templateUri);
|
||||
Task enableDownload(String templateUrn);
|
||||
|
||||
/**
|
||||
* Relocates a virtual machine in a vApp template to a different datastore.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vAppTemplate/{id}/action/relocate
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param params contains the reference to the new datastore
|
||||
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
*/
|
||||
Task relocateVm(URI templateUri, RelocateParams params);
|
||||
Task enableDownload(URI templateHref);
|
||||
|
||||
/**
|
||||
* Retrieves the customization section of a vApp template.
|
||||
|
@ -160,36 +153,13 @@ public interface VAppTemplateApi {
|
|||
* GET /vAppTemplate/{id}/customizationSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the customization section
|
||||
*/
|
||||
CustomizationSection getCustomizationSection(URI templateUri);
|
||||
CustomizationSection getCustomizationSection(String templateUrn);
|
||||
|
||||
/**
|
||||
* Retrieves the Guest Customization Section of a VM
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/guestCustomizationSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the guest customization section
|
||||
*/
|
||||
GuestCustomizationSection getGuestCustomizationSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Modifies the guest customization options of a VM.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vAppTemplate/{id}/guestCustomizationSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param section the new configuration to apply
|
||||
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
*/
|
||||
Task editGuestCustomizationSection(URI templateUri, GuestCustomizationSection section);
|
||||
CustomizationSection getCustomizationSection(URI templateHref);
|
||||
|
||||
/**
|
||||
* Retrieves the lease settings section of a vApp or vApp template
|
||||
|
@ -198,10 +168,13 @@ public interface VAppTemplateApi {
|
|||
* GET /vAppTemplate/{id}/leaseSettingsSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the lease settings
|
||||
*/
|
||||
LeaseSettingsSection getLeaseSettingsSection(URI templateUri);
|
||||
LeaseSettingsSection getLeaseSettingsSection(String templateUrn);
|
||||
|
||||
LeaseSettingsSection getLeaseSettingsSection(URI templateHref);
|
||||
|
||||
/**
|
||||
* Modifies the lease settings section of a vApp or vApp template.
|
||||
|
@ -210,12 +183,16 @@ public interface VAppTemplateApi {
|
|||
* PUT /vAppTemplate/{id}/leaseSettingsSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param section the new configuration to apply
|
||||
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @param section
|
||||
* the new configuration to apply
|
||||
* @return the task performing the action. This operation is asynchronous and the user should
|
||||
* monitor the returned task status in order to check when it is completed.
|
||||
*/
|
||||
Task editLeaseSettingsSection(URI templateUri, LeaseSettingsSection section);
|
||||
Task editLeaseSettingsSection(String templateUrn, LeaseSettingsSection section);
|
||||
|
||||
Task editLeaseSettingsSection(URI templateHref, LeaseSettingsSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the network config section of a vApp or vApp template.
|
||||
|
@ -224,22 +201,13 @@ public interface VAppTemplateApi {
|
|||
* GET /vAppTemplate/{id}/networkConfigSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the network config section requested
|
||||
*/
|
||||
NetworkConfigSection getNetworkConfigSection(URI templateUri);
|
||||
NetworkConfigSection getNetworkConfigSection(String templateUrn);
|
||||
|
||||
/**
|
||||
* Retrieves the network connection section of a VM
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/networkConnectionSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the network connection section requested
|
||||
*/
|
||||
NetworkConnectionSection getNetworkConnectionSection(URI templateUri);
|
||||
NetworkConfigSection getNetworkConfigSection(URI templateHref);
|
||||
|
||||
/**
|
||||
* Retrieves the network section of a vApp or vApp template.
|
||||
|
@ -248,26 +216,32 @@ public interface VAppTemplateApi {
|
|||
* GET /vAppTemplate/{id}/networkSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the network section requested
|
||||
*/
|
||||
NetworkSection getNetworkSection(URI templateUri);
|
||||
NetworkSection getNetworkSection(String templateUrn);
|
||||
|
||||
NetworkSection getNetworkSection(URI templateHref);
|
||||
|
||||
/**
|
||||
* Retrieves an OVF descriptor of a vApp template.
|
||||
*
|
||||
* This OVF represents the vApp template as it is, with all vCloud specific information (like mac address, parent
|
||||
* networks, etc). The OVF which could be downloaded by enabling for download will not contain this information.
|
||||
* There are no specific states bound to this entity.
|
||||
* This OVF represents the vApp template as it is, with all vCloud specific information (like mac
|
||||
* address, parent networks, etc). The OVF which could be downloaded by enabling for download
|
||||
* will not contain this information. There are no specific states bound to this entity.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/ovf
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the ovf envelope
|
||||
*/
|
||||
Envelope getOvf(URI templateUri);
|
||||
Envelope getOvf(String templateUrn);
|
||||
|
||||
Envelope getOvf(URI templateHref);
|
||||
|
||||
/**
|
||||
* Retrieves vApp template owner.
|
||||
|
@ -276,10 +250,13 @@ public interface VAppTemplateApi {
|
|||
* GET /vAppTemplate/{id}/owner
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the owner of the vApp template
|
||||
*/
|
||||
Owner getOwner(URI templateUri);
|
||||
Owner getOwner(String templateUrn);
|
||||
|
||||
Owner getOwner(URI templateHref);
|
||||
|
||||
/**
|
||||
* Retrieves VAppTemplate/VM product sections
|
||||
|
@ -288,10 +265,13 @@ public interface VAppTemplateApi {
|
|||
* GET /vAppTemplate/{id}/productSections
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the product sections
|
||||
*/
|
||||
ProductSectionList getProductSections(URI templateUri);
|
||||
ProductSectionList getProductSections(String templateUrn);
|
||||
|
||||
ProductSectionList getProductSections(URI templateHref);
|
||||
|
||||
/**
|
||||
* Modifies the product sections of a vApp or vApp template.
|
||||
|
@ -300,25 +280,35 @@ public interface VAppTemplateApi {
|
|||
* PUT /vAppTemplate/{id}/productSections
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return the task performing the action. This operation is asynchronous and the user should
|
||||
* monitor the returned task status in order to check when it is completed.
|
||||
*/
|
||||
Task editProductSections(URI templateUri, ProductSectionList sections);
|
||||
Task editProductSections(String templateUrn, ProductSectionList sections);
|
||||
|
||||
Task editProductSections(URI templateHref, ProductSectionList sections);
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/shadowVms
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param templateUrn
|
||||
* the String of the template
|
||||
* @return shadowVM references
|
||||
*/
|
||||
References getShadowVms(URI templateUri);
|
||||
References getShadowVms(String templateUrn);
|
||||
|
||||
References getShadowVms(URI templateHref);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Metadata} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi();
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam URI templateHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,14 +19,11 @@
|
|||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CUSTOMIZATION_SECTION;
|
||||
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.NETWORK_CONFIG_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_SECTION;
|
||||
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.RELOCATE_TEMPLATE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP_TEMPLATE;
|
||||
|
||||
|
@ -49,65 +46,206 @@ import org.jclouds.rest.annotations.JAXBResponseParser;
|
|||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.binders.BindToXMLPayload;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
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.References;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.dmtf.Envelope;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.CustomizationSection;
|
||||
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.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.VAppTemplateURNToHref;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* @author Adam Lowe
|
||||
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateApi
|
||||
* @author Adam Lowe, Adrian Cole
|
||||
* @see VAppTemplateApi
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface VAppTemplateAsyncApi {
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getVAppTemplate(URI)
|
||||
* @see VAppTemplateApi#get(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPP_TEMPLATE)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<VAppTemplate> getVAppTemplate(@EndpointParam URI reference);
|
||||
|
||||
ListenableFuture<VAppTemplate> get(@EndpointParam String reference);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#editVAppTemplate(URI, VAppTemplate)
|
||||
* @see VAppTemplateApi#edit(String, VAppTemplate)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(VAPP_TEMPLATE)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVAppTemplate(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) VAppTemplate template);
|
||||
ListenableFuture<Task> edit(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn,
|
||||
@BinderParam(BindToXMLPayload.class) VAppTemplate template);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#removeVappTemplate(URI)
|
||||
* @see VAppTemplateApi#remove(String)
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> removeVappTemplate(@EndpointParam URI templateUri);
|
||||
ListenableFuture<Task> remove(@EndpointParam String templateUri);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#consolidateVm(URI)
|
||||
* @see VAppTemplateApi#disableDownload(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/disableDownload")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> disableDownload(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#enableDownload(String)
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK)
|
||||
@Path("/action/consolidate")
|
||||
@Path("/action/enableDownload")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> consolidateVm(@EndpointParam URI templateURI);
|
||||
ListenableFuture<Task> enableDownload(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getCustomizationSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(CUSTOMIZATION_SECTION)
|
||||
@Path("/customizationSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<CustomizationSection> getCustomizationSection(
|
||||
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getLeaseSettingsSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(LEASE_SETTINGS_SECTION)
|
||||
@Path("/leaseSettingsSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(
|
||||
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#editLeaseSettingsSection(String, LeaseSettingsSection)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(LEASE_SETTINGS_SECTION)
|
||||
@Consumes(TASK)
|
||||
@Path("/leaseSettingsSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editLeaseSettingsSection(
|
||||
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn,
|
||||
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getNetworkConfigSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_CONFIG_SECTION)
|
||||
@Path("/networkConfigSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(
|
||||
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getNetworkSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_SECTION)
|
||||
@Path("/networkSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkSection> getNetworkSection(
|
||||
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getOvf(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@Path("/ovf")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Envelope> getOvf(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getOwnerOfVAppTemplate(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(OWNER)
|
||||
@Path("/owner")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Owner> getOwner(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getProductSectionsForVAppTemplate(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(PRODUCT_SECTION_LIST)
|
||||
@Path("/productSections")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ProductSectionList> getProductSections(
|
||||
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#editProductSections(String, ProductSectionList)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(PRODUCT_SECTION_LIST)
|
||||
@Consumes(TASK)
|
||||
@Path("/productSections")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editProductSections(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sections);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getShadowVms(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@Path("/shadowVms")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<References> getShadowVms(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#get(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPP_TEMPLATE)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<VAppTemplate> get(@EndpointParam URI reference);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#edit(URI, VAppTemplate)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(VAPP_TEMPLATE)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> edit(@EndpointParam URI templateHref,
|
||||
@BinderParam(BindToXMLPayload.class) VAppTemplate template);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#remove(URI)
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> remove(@EndpointParam URI templateUri);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#disableDownload(URI)
|
||||
|
@ -115,27 +253,16 @@ public interface VAppTemplateAsyncApi {
|
|||
@POST
|
||||
@Path("/action/disableDownload")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> disableDownload(@EndpointParam URI templateURI);
|
||||
ListenableFuture<Void> disableDownload(@EndpointParam URI templateHref);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#enableDownloadVappTemplate(URI)
|
||||
* @see VAppTemplateApi#enableDownload(URI)
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK)
|
||||
@Path("/action/enableDownload")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> enableDownload(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#relocateVm(URI, RelocateParams)
|
||||
*/
|
||||
@POST
|
||||
@Produces(RELOCATE_TEMPLATE)
|
||||
@Consumes(TASK)
|
||||
@Path("/action/relocate")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> relocateVm(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) RelocateParams params);
|
||||
ListenableFuture<Task> enableDownload(@EndpointParam URI templateHref);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getCustomizationSection(URI)
|
||||
|
@ -145,28 +272,7 @@ public interface VAppTemplateAsyncApi {
|
|||
@Path("/customizationSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<CustomizationSection> getCustomizationSection(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getGuestCustomizationSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(GUEST_CUSTOMIZATION_SECTION)
|
||||
@Path("/guestCustomizationSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#editGuestCustomizationSection(URI, org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(GUEST_CUSTOMIZATION_SECTION)
|
||||
@Consumes(TASK)
|
||||
@Path("/guestCustomizationSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editGuestCustomizationSection(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
|
||||
ListenableFuture<CustomizationSection> getCustomizationSection(@EndpointParam URI templateHref);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getLeaseSettingsSection(URI)
|
||||
|
@ -176,7 +282,7 @@ public interface VAppTemplateAsyncApi {
|
|||
@Path("/leaseSettingsSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI templateURI);
|
||||
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI templateHref);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#editLeaseSettingsSection(URI, LeaseSettingsSection)
|
||||
|
@ -186,18 +292,8 @@ public interface VAppTemplateAsyncApi {
|
|||
@Consumes(TASK)
|
||||
@Path("/leaseSettingsSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getNetworkConnectionSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_CONNECTION_SECTION)
|
||||
@Path("/networkConnectionSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI templateURI);
|
||||
ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam URI templateHref,
|
||||
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getNetworkConfigSection(URI)
|
||||
|
@ -207,17 +303,7 @@ public interface VAppTemplateAsyncApi {
|
|||
@Path("/networkConfigSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getNetworkConnectionSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_CONNECTION_SECTION)
|
||||
@Path("/networkConnectionSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkConnectionSection> getVAppTemplateNetworkConnectionSection(@EndpointParam URI templateURI);
|
||||
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI templateHref);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getNetworkSection(URI)
|
||||
|
@ -227,7 +313,7 @@ public interface VAppTemplateAsyncApi {
|
|||
@Path("/networkSection")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI templateURI);
|
||||
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI templateHref);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getOvf(URI)
|
||||
|
@ -237,7 +323,7 @@ public interface VAppTemplateAsyncApi {
|
|||
@Path("/ovf")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Envelope> getOvf(@EndpointParam URI templateURI);
|
||||
ListenableFuture<Envelope> getOvf(@EndpointParam URI templateHref);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getOwnerOfVAppTemplate(URI)
|
||||
|
@ -247,7 +333,7 @@ public interface VAppTemplateAsyncApi {
|
|||
@Path("/owner")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Owner> getOwner(@EndpointParam URI templateURI);
|
||||
ListenableFuture<Owner> getOwner(@EndpointParam URI templateHref);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getProductSectionsForVAppTemplate(URI)
|
||||
|
@ -257,7 +343,7 @@ public interface VAppTemplateAsyncApi {
|
|||
@Path("/productSections")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI templateURI);
|
||||
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI templateHref);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#editProductSections(URI, ProductSectionList)
|
||||
|
@ -267,8 +353,8 @@ public interface VAppTemplateAsyncApi {
|
|||
@Consumes(TASK)
|
||||
@Path("/productSections")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editProductSections(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sections);
|
||||
ListenableFuture<Task> editProductSections(@EndpointParam URI templateHref,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sections);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateApi#getShadowVms(URI)
|
||||
|
@ -278,11 +364,15 @@ public interface VAppTemplateAsyncApi {
|
|||
@Path("/shadowVms")
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<References> getShadowVms(@EndpointParam URI templateURI);
|
||||
ListenableFuture<References> getShadowVms(@EndpointParam URI templateHref);
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Metadata} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi();
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI templateHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
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.VApp;
|
||||
|
@ -35,6 +36,7 @@ import org.jclouds.vcloud.director.v1_5.domain.params.CloneVAppTemplateParams;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.params.ComposeVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.InstantiateVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.UploadVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.VdcURNToHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to a vDC.
|
||||
|
@ -196,5 +198,9 @@ public interface VdcApi {
|
|||
* @return synchronous access to {@link Metadata.Readable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataApi.Readable getMetadataApi();
|
||||
MetadataApi.Readable getMetadataApi(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataApi.Readable getMetadataApi(@EndpointParam URI vdcHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -258,6 +258,9 @@ public interface VdcAsyncApi {
|
|||
* @return asynchronous access to {@link Metadata.Readable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncApi.Readable getMetadataApi();
|
||||
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI vdcHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
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;
|
||||
|
@ -41,11 +43,12 @@ 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.functions.href.VmURNToHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link Vm} objects.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
* @author grkvlt@apache.org, Adrian Cole
|
||||
* @see VmAsyncApi
|
||||
* @version 1.5
|
||||
*/
|
||||
|
@ -56,25 +59,31 @@ public interface VmApi {
|
|||
* Retrieves a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#getVApp(URI)
|
||||
* @see VAppApi#get(String)
|
||||
*/
|
||||
Vm get(URI vmURI);
|
||||
Vm get(String vmUrn);
|
||||
|
||||
Vm get(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the name/description of a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#editVApp(URI, VApp)
|
||||
* @see VAppApi#edit(String, VApp)
|
||||
*/
|
||||
Task edit(URI vmURI, Vm vm);
|
||||
Task edit(String vmUrn, Vm vm);
|
||||
|
||||
Task edit(URI vmHref, Vm vm);
|
||||
|
||||
/**
|
||||
* Deletes a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#removeVApp(URI)
|
||||
* @see VAppApi#remove(String)
|
||||
*/
|
||||
Task remove(URI vmURI);
|
||||
Task remove(String vmUrn);
|
||||
|
||||
Task remove(URI vmHref);
|
||||
|
||||
/**
|
||||
* Consolidates a {@link Vm}.
|
||||
|
@ -85,23 +94,29 @@ public interface VmApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task consolidate(URI vmURI);
|
||||
Task consolidate(String vmUrn);
|
||||
|
||||
Task consolidate(URI vmHref);
|
||||
|
||||
/**
|
||||
* Deploys a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#deploy(URI, DeployVAppParams)
|
||||
* @see VAppApi#deploy(String, DeployVAppParams)
|
||||
*/
|
||||
Task deploy(URI vmURI, DeployVAppParams params);
|
||||
Task deploy(String vmUrn, DeployVAppParams params);
|
||||
|
||||
Task deploy(URI vmHref, DeployVAppParams params);
|
||||
|
||||
/**
|
||||
* Discard suspended state of a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#discardSuspendedState(URI)
|
||||
* @see VAppApi#discardSuspendedState(String)
|
||||
*/
|
||||
Task discardSuspendedState(URI vmURI);
|
||||
Task discardSuspendedState(String vmUrn);
|
||||
|
||||
Task discardSuspendedState(URI vmHref);
|
||||
|
||||
/**
|
||||
* Installs VMware tools to the virtual machine.
|
||||
|
@ -114,7 +129,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task installVMwareTools(URI vmURI);
|
||||
Task installVMwareTools(String vmUrn);
|
||||
|
||||
Task installVMwareTools(URI vmHref);
|
||||
|
||||
/**
|
||||
* Relocates a {@link Vm}.
|
||||
|
@ -125,19 +142,23 @@ public interface VmApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task relocate(URI vmURI, RelocateParams params);
|
||||
Task relocate(String vmUrn, RelocateParams params);
|
||||
|
||||
Task relocate(URI vmHref, RelocateParams params);
|
||||
|
||||
/**
|
||||
* Undeploy a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#undeploy(URI, UndeployVAppParams)
|
||||
* @see VAppApi#undeploy(String, UndeployVAppParams)
|
||||
*/
|
||||
Task undeploy(URI vmURI, UndeployVAppParams params);
|
||||
Task undeploy(String vmUrn, UndeployVAppParams params);
|
||||
|
||||
Task undeploy(URI vmHref, UndeployVAppParams params);
|
||||
|
||||
/**
|
||||
* Upgrade virtual hardware version of a VM to the highest supported virtual
|
||||
* hardware version of provider vDC where the VM locates.
|
||||
* 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
|
||||
|
@ -145,55 +166,69 @@ public interface VmApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task upgradeHardwareVersion(URI vmURI);
|
||||
Task upgradeHardwareVersion(String vmUrn);
|
||||
|
||||
Task upgradeHardwareVersion(URI vmHref);
|
||||
|
||||
/**
|
||||
* Powers off a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#powerOff(URI)
|
||||
* @see VAppApi#powerOff(String)
|
||||
*/
|
||||
Task powerOff(URI vmURI);
|
||||
Task powerOff(String vmUrn);
|
||||
|
||||
Task powerOff(URI vmHref);
|
||||
|
||||
/**
|
||||
* Powers on a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#powerOn(URI)
|
||||
* @see VAppApi#powerOn(String)
|
||||
*/
|
||||
Task powerOn(URI vmURI);
|
||||
Task powerOn(String vmUrn);
|
||||
|
||||
Task powerOn(URI vmHref);
|
||||
|
||||
/**
|
||||
* Reboots a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#reboot(URI)
|
||||
* @see VAppApi#reboot(String)
|
||||
*/
|
||||
Task reboot(URI vmURI);
|
||||
Task reboot(String vmUrn);
|
||||
|
||||
Task reboot(URI vmHref);
|
||||
|
||||
/**
|
||||
* Resets a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#reset(URI)
|
||||
* @see VAppApi#reset(String)
|
||||
*/
|
||||
Task reset(URI vmURI);
|
||||
Task reset(String vmUrn);
|
||||
|
||||
Task reset(URI vmHref);
|
||||
|
||||
/**
|
||||
* Shuts down a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#shutdown(URI)
|
||||
* @see VAppApi#shutdown(String)
|
||||
*/
|
||||
Task shutdown(URI vmURI);
|
||||
Task shutdown(String vmUrn);
|
||||
|
||||
Task shutdown(URI vmHref);
|
||||
|
||||
/**
|
||||
* Suspends a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppApi#suspend(URI)
|
||||
* @see VAppApi#suspend(String)
|
||||
*/
|
||||
Task suspend(URI vmURI);
|
||||
Task suspend(String vmUrn);
|
||||
|
||||
Task suspend(URI vmHref);
|
||||
|
||||
/**
|
||||
* Retrieves the guest customization section of a {@link Vm}.
|
||||
|
@ -203,9 +238,10 @@ public interface VmApi {
|
|||
* </pre>
|
||||
*
|
||||
* @since 1.0
|
||||
* @see VAppApi#
|
||||
*/
|
||||
GuestCustomizationSection getGuestCustomizationSection(URI vmURI);
|
||||
GuestCustomizationSection getGuestCustomizationSection(String vmUrn);
|
||||
|
||||
GuestCustomizationSection getGuestCustomizationSection(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the guest customization section of a {@link Vm}.
|
||||
|
@ -216,7 +252,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
Task editGuestCustomizationSection(URI vmURI, GuestCustomizationSection section);
|
||||
Task editGuestCustomizationSection(String vmUrn, GuestCustomizationSection section);
|
||||
|
||||
Task editGuestCustomizationSection(URI vmHref, GuestCustomizationSection section);
|
||||
|
||||
/**
|
||||
* Ejects media from a {@link Vm}.
|
||||
|
@ -227,7 +265,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task ejectMedia(URI vmURI, MediaInsertOrEjectParams mediaParams);
|
||||
Task ejectMedia(String vmUrn, MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
Task ejectMedia(URI vmHref, MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
/**
|
||||
* Insert media into a {@link Vm}.
|
||||
|
@ -238,7 +278,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task insertMedia(URI vmURI, MediaInsertOrEjectParams mediaParams);
|
||||
Task insertMedia(String vmUrn, MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
Task insertMedia(URI vmHref, MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
/**
|
||||
* Retrieves the network connection section of a {@link Vm}.
|
||||
|
@ -249,7 +291,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
NetworkConnectionSection getNetworkConnectionSection(URI vmURI);
|
||||
NetworkConnectionSection getNetworkConnectionSection(String vmUrn);
|
||||
|
||||
NetworkConnectionSection getNetworkConnectionSection(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the network connection section of a {@link Vm}.
|
||||
|
@ -260,7 +304,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editNetworkConnectionSection(URI vmURI, NetworkConnectionSection section);
|
||||
Task editNetworkConnectionSection(String vmUrn, NetworkConnectionSection section);
|
||||
|
||||
Task editNetworkConnectionSection(URI vmHref, NetworkConnectionSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the operating system section of a {@link Vm}.
|
||||
|
@ -271,7 +317,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
OperatingSystemSection getOperatingSystemSection(URI vmURI);
|
||||
OperatingSystemSection getOperatingSystemSection(String vmUrn);
|
||||
|
||||
OperatingSystemSection getOperatingSystemSection(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the operating system section of a {@link Vm}.
|
||||
|
@ -282,29 +330,36 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editOperatingSystemSection(URI vmURI, OperatingSystemSection section);
|
||||
Task editOperatingSystemSection(String vmUrn, OperatingSystemSection section);
|
||||
|
||||
Task editOperatingSystemSection(URI vmHref, OperatingSystemSection section);
|
||||
|
||||
/**
|
||||
* Retrieves {@link Vm} product sections.
|
||||
*
|
||||
* @since 1.5
|
||||
* @see VAppApi#getProductSections(URI)
|
||||
* @see VAppApi#getProductSections(String)
|
||||
*/
|
||||
ProductSectionList getProductSections(URI vmURI);
|
||||
ProductSectionList getProductSections(String vmUrn);
|
||||
|
||||
ProductSectionList getProductSections(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the product section information of a {@link Vm}.
|
||||
*
|
||||
* @since 1.5
|
||||
* @see VAppApi#editProductSections(URI, ProductSectionList)
|
||||
* @see VAppApi#editProductSections(String, ProductSectionList)
|
||||
*/
|
||||
Task editProductSections(URI vmURI, ProductSectionList sectionList);
|
||||
Task editProductSections(String vmUrn, ProductSectionList sectionList);
|
||||
|
||||
Task editProductSections(URI vmHref, ProductSectionList sectionList);
|
||||
|
||||
/**
|
||||
* Retrieves a pending question for a {@link 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.
|
||||
* The user should answer to the question by operation
|
||||
* {@link #answerQuestion(String, VmQuestionAnswer)}. Usually questions will be asked when the VM
|
||||
* is powering on.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/question
|
||||
|
@ -312,12 +367,15 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
VmPendingQuestion getPendingQuestion(URI vmURI);
|
||||
VmPendingQuestion getPendingQuestion(String vmUrn);
|
||||
|
||||
VmPendingQuestion getPendingQuestion(URI vmHref);
|
||||
|
||||
/**
|
||||
* Answer a pending question on a {@link Vm}.
|
||||
*
|
||||
* The answer IDs of choice and question should match the ones returned from operation {@link #getPendingQuestion(URI)}.
|
||||
* The answer IDs of choice and question should match the ones returned from operation
|
||||
* {@link #getPendingQuestion(String)}.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/question/action/answer
|
||||
|
@ -325,7 +383,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
void answerQuestion(URI vmURI, VmQuestionAnswer answer);
|
||||
void answerQuestion(String vmUrn, VmQuestionAnswer answer);
|
||||
|
||||
void answerQuestion(URI vmHref, VmQuestionAnswer answer);
|
||||
|
||||
/**
|
||||
* Retrieves the runtime info section of a {@link Vm}.
|
||||
|
@ -336,7 +396,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
RuntimeInfoSection getRuntimeInfoSection(URI vmURI);
|
||||
RuntimeInfoSection getRuntimeInfoSection(String vmUrn);
|
||||
|
||||
RuntimeInfoSection getRuntimeInfoSection(URI vmHref);
|
||||
|
||||
/**
|
||||
* Retrieves the thumbnail of the screen of a {@link Vm}.
|
||||
|
@ -349,15 +411,19 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
byte[] getScreenImage(URI vmURI);
|
||||
byte[] getScreenImage(String vmUrn);
|
||||
|
||||
byte[] getScreenImage(URI vmHref);
|
||||
|
||||
/**
|
||||
* Retrieve a screen ticket for remote console connection to a {@link 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.
|
||||
* 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
|
||||
|
@ -365,7 +431,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
ScreenTicket getScreenTicket(URI vmURI);
|
||||
ScreenTicket getScreenTicket(String vmUrn);
|
||||
|
||||
ScreenTicket getScreenTicket(URI vmHref);
|
||||
|
||||
/**
|
||||
* Retrieves the virtual hardware section of a {@link Vm}.
|
||||
|
@ -376,7 +444,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
VirtualHardwareSection getVirtualHardwareSection(URI vmURI);
|
||||
VirtualHardwareSection getVirtualHardwareSection(String vmUrn);
|
||||
|
||||
VirtualHardwareSection getVirtualHardwareSection(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the virtual hardware section of a {@link Vm}.
|
||||
|
@ -387,7 +457,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editVirtualHardwareSection(URI vmURI, VirtualHardwareSection section);
|
||||
Task editVirtualHardwareSection(String vmUrn, VirtualHardwareSection section);
|
||||
|
||||
Task editVirtualHardwareSection(URI vmHref, VirtualHardwareSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the CPU properties in virtual hardware section of a {@link Vm}.
|
||||
|
@ -398,7 +470,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
RasdItem getVirtualHardwareSectionCpu(URI vmURI);
|
||||
RasdItem getVirtualHardwareSectionCpu(String vmUrn);
|
||||
|
||||
RasdItem getVirtualHardwareSectionCpu(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the CPU properties in virtual hardware section of a {@link Vm}.
|
||||
|
@ -409,7 +483,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editVirtualHardwareSectionCpu(URI vmURI, RasdItem rasd);
|
||||
Task editVirtualHardwareSectionCpu(String vmUrn, RasdItem rasd);
|
||||
|
||||
Task editVirtualHardwareSectionCpu(URI vmHref, RasdItem rasd);
|
||||
|
||||
/**
|
||||
* Retrieves a list of items for disks from virtual hardware section of a {@link Vm}.
|
||||
|
@ -420,7 +496,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
RasdItemsList getVirtualHardwareSectionDisks(URI vmURI);
|
||||
RasdItemsList getVirtualHardwareSectionDisks(String vmUrn);
|
||||
|
||||
RasdItemsList getVirtualHardwareSectionDisks(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the disks list in virtual hardware section of a {@link Vm}.
|
||||
|
@ -431,7 +509,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editVirtualHardwareSectionDisks(URI vmURI, RasdItemsList rasdItemsList);
|
||||
Task editVirtualHardwareSectionDisks(String vmUrn, RasdItemsList rasdItemsList);
|
||||
|
||||
Task editVirtualHardwareSectionDisks(URI vmHref, RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* Retrieves the list of items that represents the floppies and CD/DVD drives in a {@link Vm}.
|
||||
|
@ -442,10 +522,13 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
RasdItemsList getVirtualHardwareSectionMedia(URI vmURI);
|
||||
RasdItemsList getVirtualHardwareSectionMedia(String vmUrn);
|
||||
|
||||
RasdItemsList getVirtualHardwareSectionMedia(URI vmHref);
|
||||
|
||||
/**
|
||||
* Retrieves the item that contains memory information from virtual hardware section of a {@link Vm}.
|
||||
* Retrieves the item that contains memory information from virtual hardware section of a
|
||||
* {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/virtualHardwareSection/memory
|
||||
|
@ -453,7 +536,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
RasdItem getVirtualHardwareSectionMemory(URI vmURI);
|
||||
RasdItem getVirtualHardwareSectionMemory(String vmUrn);
|
||||
|
||||
RasdItem getVirtualHardwareSectionMemory(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the memory properties in virtual hardware section of a {@link Vm}.
|
||||
|
@ -464,7 +549,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editVirtualHardwareSectionMemory(URI vmURI, RasdItem rasd);
|
||||
Task editVirtualHardwareSectionMemory(String vmUrn, RasdItem rasd);
|
||||
|
||||
Task editVirtualHardwareSectionMemory(URI vmHref, RasdItem rasd);
|
||||
|
||||
/**
|
||||
* Retrieves a list of items for network cards from virtual hardware section of a {@link Vm}.
|
||||
|
@ -475,7 +562,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
RasdItemsList getVirtualHardwareSectionNetworkCards(URI vmURI);
|
||||
RasdItemsList getVirtualHardwareSectionNetworkCards(String vmUrn);
|
||||
|
||||
RasdItemsList getVirtualHardwareSectionNetworkCards(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the network cards list in virtual hardware section of a {@link Vm}.
|
||||
|
@ -486,7 +575,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task editVirtualHardwareSectionNetworkCards(URI vmURI, RasdItemsList rasdItemsList);
|
||||
Task editVirtualHardwareSectionNetworkCards(String vmUrn, RasdItemsList rasdItemsList);
|
||||
|
||||
Task editVirtualHardwareSectionNetworkCards(URI vmHref, RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* Retrieves a list of items for serial ports from virtual hardware section of a {@link Vm}.
|
||||
|
@ -497,7 +588,9 @@ public interface VmApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
RasdItemsList getVirtualHardwareSectionSerialPorts(URI vmURI);
|
||||
RasdItemsList getVirtualHardwareSectionSerialPorts(String vmUrn);
|
||||
|
||||
RasdItemsList getVirtualHardwareSectionSerialPorts(URI vmHref);
|
||||
|
||||
/**
|
||||
* Modifies the serial ports list in virtual hardware section of a {@link Vm}.
|
||||
|
@ -508,11 +601,17 @@ public interface VmApi {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task editVirtualHardwareSectionSerialPorts(URI vmURI, RasdItemsList rasdItemsList);
|
||||
Task editVirtualHardwareSectionSerialPorts(String vmUrn, RasdItemsList rasdItemsList);
|
||||
|
||||
Task editVirtualHardwareSectionSerialPorts(URI vmHref, RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* Synchronous access to {@link Vm} {@link Metadata} features.
|
||||
*/
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi();
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam URI vmHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import javax.ws.rs.PUT;
|
|||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.dmtf.cim.ResourceAllocationSettingData;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
|
@ -53,6 +54,7 @@ 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.Metadata;
|
||||
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;
|
||||
|
@ -72,16 +74,470 @@ 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.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ReturnPayloadBytes;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.VmURNToHref;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* @author grkvlt@apache.org
|
||||
* @author grkvlt@apache.org, Adrian Cole
|
||||
* @see VmApi
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface VmAsyncApi {
|
||||
|
||||
/**
|
||||
* @see VmApi#get(String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VM)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Vm> get(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#edit(String, Vm)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(VM)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> edit(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) Vm vApp);
|
||||
|
||||
/**
|
||||
* @see VmApi#remove(String)
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> remove(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#consolidate(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/consolidate")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> consolidate(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#deploy(String, DeployVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/deploy")
|
||||
@Produces(DEPLOY_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> deploy(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) DeployVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VmApi#discardSuspendedState(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/discardSuspendedState")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> discardSuspendedState(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#installVMwareTools(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/installVMwareTools")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> installVMwareTools(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#relocate(String, RelocateParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/relocate")
|
||||
@Produces(RELOCATE_VM_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> relocate(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) RelocateParams params);
|
||||
|
||||
/**
|
||||
* @see VmApi#undeploy(String, UndeployVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/undeploy")
|
||||
@Produces(UNDEPLOY_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> undeploy(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VmApi#upgradeHardwareVersion(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/upgradeHardwareVersion")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#powerOff(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/powerOff")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> powerOff(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#powerOn(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/powerOn")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> powerOn(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#reboot(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/powerOff")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> reboot(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#reset(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/reset")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> reset(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#shutdown(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/shutdown")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> shutdown(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#suspend(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/suspend")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> suspend(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#getGuestCustomizationSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/guestCustomizationSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(
|
||||
@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#editGuestCustomizationSection(String, GuestCustomizationSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/guestCustomizationSection")
|
||||
@Produces(GUEST_CUSTOMIZATION_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editGuestCustomizationSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
|
||||
|
||||
/**
|
||||
* @see VmApi#ejectMedia(String, MediaInsertOrEjectParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/media/action/ejectMedia")
|
||||
@Produces(MEDIA_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> ejectMedia(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
/**
|
||||
* @see VmApi#insertMedia(String, MediaInsertOrEjectParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/media/action/insertMedia")
|
||||
@Produces(MEDIA_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> insertMedia(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
/**
|
||||
* @see VmApi#getNetworkConnectionSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/networkConnectionSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(
|
||||
@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#editNetworkConnectionSection(String, NetworkConnectionSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/networkConnectionSection")
|
||||
@Produces(NETWORK_CONNECTION_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editNetworkConnectionSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
|
||||
|
||||
/**
|
||||
* @see VmApi#getOperatingSystemSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/operatingSystemSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(
|
||||
@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#editOperatingSystemSection(String, OperatingSystemSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/operatingSystemSection")
|
||||
@Produces(OPERATING_SYSTEM_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editOperatingSystemSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
|
||||
|
||||
/**
|
||||
* @see VmApi#getProductSections(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/productSections")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#editProductSections(String, ProductSectionList)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/productSections")
|
||||
@Produces(PRODUCT_SECTION_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editProductSections(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
|
||||
|
||||
/**
|
||||
* @see VmApi#getPendingQuestion(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/question")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#answerQuestion(String, VmQuestionAnswer)
|
||||
*/
|
||||
@POST
|
||||
@Path("/question/action/answer")
|
||||
@Produces(VM_PENDING_ANSWER)
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> answerQuestion(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer);
|
||||
|
||||
/**
|
||||
* @see VmApi#getRuntimeInfoSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/runtimeInfoSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#getScreenImage(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/screen")
|
||||
@Consumes(ANY_IMAGE)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
@ResponseParser(ReturnPayloadBytes.class)
|
||||
ListenableFuture<byte[]> getScreenImage(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#getScreenTicket(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/screen/action/acquireTicket")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSection(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(
|
||||
@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSection(String, VirtualHardwareSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection")
|
||||
@Produces(VIRTUAL_HARDWARE_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionCpu(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/cpu")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSectionCpu(String, ResourceAllocationSettingData)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection/cpu")
|
||||
@Produces(OVF_RASD_ITEM)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSectionCpu(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionDisks(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/disks")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(
|
||||
@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSectionDisks(String, RasdItemsList)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection/disks")
|
||||
@Produces(OVF_RASD_ITEMS_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSectionDisks(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionMedia(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/media")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia(
|
||||
@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionMemory(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/memory")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSectionMemory(String, ResourceAllocationSettingData)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection/memory")
|
||||
@Produces(OVF_RASD_ITEM)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSectionMemory(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionNetworkCards(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/networkCards")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(
|
||||
@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSectionNetworkCards(String, RasdItemsList)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection/networkCards")
|
||||
@Produces(OVF_RASD_ITEMS_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSectionNetworkCards(
|
||||
@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionSerialPorts(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/serialPorts")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(
|
||||
@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSectionSerialPorts(String, RasdItemsList)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection/serialPorts")
|
||||
@Produces(OVF_RASD_ITEMS_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSectionSerialPorts(
|
||||
@EndpointParam(parser = VmURNToHref.class) String vmUrn,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* @see VmApi#get(URI)
|
||||
*/
|
||||
|
@ -89,7 +545,7 @@ public interface VmAsyncApi {
|
|||
@Consumes(VM)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Vm> getVm(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Vm> get(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#edit(URI, Vm)
|
||||
|
@ -98,8 +554,7 @@ public interface VmAsyncApi {
|
|||
@Produces(VM)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVm(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) Vm vApp);
|
||||
ListenableFuture<Task> edit(@EndpointParam URI vmHref, @BinderParam(BindToXMLPayload.class) Vm vApp);
|
||||
|
||||
/**
|
||||
* @see VmApi#remove(URI)
|
||||
|
@ -107,7 +562,7 @@ public interface VmAsyncApi {
|
|||
@DELETE
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> removeVm(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> remove(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#consolidate(URI)
|
||||
|
@ -116,7 +571,7 @@ public interface VmAsyncApi {
|
|||
@Path("/action/consolidate")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> consolidateVm(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> consolidate(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#deploy(URI, DeployVAppParams)
|
||||
|
@ -126,8 +581,7 @@ public interface VmAsyncApi {
|
|||
@Produces(DEPLOY_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> deploy(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) DeployVAppParams params);
|
||||
ListenableFuture<Task> deploy(@EndpointParam URI vmHref, @BinderParam(BindToXMLPayload.class) DeployVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VmApi#discardSuspendedState(URI)
|
||||
|
@ -136,7 +590,7 @@ public interface VmAsyncApi {
|
|||
@Path("/action/discardSuspendedState")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#installVMwareTools(URI)
|
||||
|
@ -145,7 +599,7 @@ public interface VmAsyncApi {
|
|||
@Path("/action/installVMwareTools")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> installVMwareTools(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> installVMwareTools(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#relocate(URI, RelocateParams)
|
||||
|
@ -155,8 +609,7 @@ public interface VmAsyncApi {
|
|||
@Produces(RELOCATE_VM_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> relocateVm(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) RelocateParams params);
|
||||
ListenableFuture<Task> relocate(@EndpointParam URI vmHref, @BinderParam(BindToXMLPayload.class) RelocateParams params);
|
||||
|
||||
/**
|
||||
* @see VmApi#undeploy(URI, UndeployVAppParams)
|
||||
|
@ -166,8 +619,8 @@ public interface VmAsyncApi {
|
|||
@Produces(UNDEPLOY_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> undeploy(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
|
||||
ListenableFuture<Task> undeploy(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VmApi#upgradeHardwareVersion(URI)
|
||||
|
@ -176,7 +629,7 @@ public interface VmAsyncApi {
|
|||
@Path("/action/upgradeHardwareVersion")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#powerOff(URI)
|
||||
|
@ -185,7 +638,7 @@ public interface VmAsyncApi {
|
|||
@Path("/power/action/powerOff")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> powerOff(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> powerOff(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#powerOn(URI)
|
||||
|
@ -194,7 +647,7 @@ public interface VmAsyncApi {
|
|||
@Path("/power/action/powerOn")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> powerOn(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> powerOn(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#reboot(URI)
|
||||
|
@ -203,7 +656,7 @@ public interface VmAsyncApi {
|
|||
@Path("/power/action/powerOff")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> reboot(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> reboot(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#reset(URI)
|
||||
|
@ -212,7 +665,7 @@ public interface VmAsyncApi {
|
|||
@Path("/power/action/reset")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> reset(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> reset(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#shutdown(URI)
|
||||
|
@ -221,7 +674,7 @@ public interface VmAsyncApi {
|
|||
@Path("/power/action/shutdown")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> shutdown(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> shutdown(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#suspend(URI)
|
||||
|
@ -230,7 +683,7 @@ public interface VmAsyncApi {
|
|||
@Path("/power/action/suspend")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> suspend(@EndpointParam URI vmURI);
|
||||
ListenableFuture<Task> suspend(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#getGuestCustomizationSection(URI)
|
||||
|
@ -240,7 +693,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmURI);
|
||||
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#editGuestCustomizationSection(URI, GuestCustomizationSection)
|
||||
|
@ -250,8 +703,8 @@ public interface VmAsyncApi {
|
|||
@Produces(GUEST_CUSTOMIZATION_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editGuestCustomizationSection(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
|
||||
ListenableFuture<Task> editGuestCustomizationSection(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
|
||||
|
||||
/**
|
||||
* @see VmApi#ejectMedia(URI, MediaInsertOrEjectParams)
|
||||
|
@ -261,8 +714,8 @@ public interface VmAsyncApi {
|
|||
@Produces(MEDIA_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> ejectMedia(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
||||
ListenableFuture<Task> ejectMedia(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
/**
|
||||
* @see VmApi#insertMedia(URI, MediaInsertOrEjectParams)
|
||||
|
@ -272,8 +725,8 @@ public interface VmAsyncApi {
|
|||
@Produces(MEDIA_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> insertMedia(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
||||
ListenableFuture<Task> insertMedia(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
/**
|
||||
* @see VmApi#getNetworkConnectionSection(URI)
|
||||
|
@ -283,7 +736,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmURI);
|
||||
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#editNetworkConnectionSection(URI, NetworkConnectionSection)
|
||||
|
@ -293,8 +746,8 @@ public interface VmAsyncApi {
|
|||
@Produces(NETWORK_CONNECTION_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editNetworkConnectionSection(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
|
||||
ListenableFuture<Task> editNetworkConnectionSection(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
|
||||
|
||||
/**
|
||||
* @see VmApi#getOperatingSystemSection(URI)
|
||||
|
@ -304,7 +757,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmURI);
|
||||
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#editOperatingSystemSection(URI, OperatingSystemSection)
|
||||
|
@ -314,8 +767,8 @@ public interface VmAsyncApi {
|
|||
@Produces(OPERATING_SYSTEM_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editOperatingSystemSection(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
|
||||
ListenableFuture<Task> editOperatingSystemSection(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
|
||||
|
||||
/**
|
||||
* @see VmApi#getProductSections(URI)
|
||||
|
@ -325,7 +778,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vmURI);
|
||||
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#editProductSections(URI, ProductSectionList)
|
||||
|
@ -335,8 +788,8 @@ public interface VmAsyncApi {
|
|||
@Produces(PRODUCT_SECTION_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editProductSections(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
|
||||
ListenableFuture<Task> editProductSections(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
|
||||
|
||||
/**
|
||||
* @see VmApi#getPendingQuestion(URI)
|
||||
|
@ -346,7 +799,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam URI vmURI);
|
||||
ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#answerQuestion(URI, VmQuestionAnswer)
|
||||
|
@ -356,8 +809,8 @@ public interface VmAsyncApi {
|
|||
@Produces(VM_PENDING_ANSWER)
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> answerQuestion(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer);
|
||||
ListenableFuture<Void> answerQuestion(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer);
|
||||
|
||||
/**
|
||||
* @see VmApi#getRuntimeInfoSection(URI)
|
||||
|
@ -367,7 +820,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam URI vmURI);
|
||||
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#getScreenImage(URI)
|
||||
|
@ -377,7 +830,7 @@ public interface VmAsyncApi {
|
|||
@Consumes(ANY_IMAGE)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
@ResponseParser(ReturnPayloadBytes.class)
|
||||
ListenableFuture<byte[]> getScreenImage(@EndpointParam URI vmURI);
|
||||
ListenableFuture<byte[]> getScreenImage(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#getScreenTicket(URI)
|
||||
|
@ -387,7 +840,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam URI vmURI);
|
||||
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSection(URI)
|
||||
|
@ -397,7 +850,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmURI);
|
||||
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSection(URI, VirtualHardwareSection)
|
||||
|
@ -407,8 +860,8 @@ public interface VmAsyncApi {
|
|||
@Produces(VIRTUAL_HARDWARE_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSection(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
|
||||
ListenableFuture<Task> editVirtualHardwareSection(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionCpu(URI)
|
||||
|
@ -418,7 +871,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam URI vmURI);
|
||||
ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData)
|
||||
|
@ -428,8 +881,8 @@ public interface VmAsyncApi {
|
|||
@Produces(OVF_RASD_ITEM)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSectionCpu(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
|
||||
ListenableFuture<Task> editVirtualHardwareSectionCpu(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionDisks(URI)
|
||||
|
@ -439,7 +892,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(@EndpointParam URI vmURI);
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSectionDisks(URI, RasdItemsList)
|
||||
|
@ -449,8 +902,8 @@ public interface VmAsyncApi {
|
|||
@Produces(OVF_RASD_ITEMS_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSectionDisks(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
ListenableFuture<Task> editVirtualHardwareSectionDisks(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionMedia(URI)
|
||||
|
@ -460,7 +913,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia(@EndpointParam URI vmURI);
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionMemory(URI)
|
||||
|
@ -470,7 +923,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam URI vmURI);
|
||||
ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData)
|
||||
|
@ -480,8 +933,8 @@ public interface VmAsyncApi {
|
|||
@Produces(OVF_RASD_ITEM)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSectionMemory(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
|
||||
ListenableFuture<Task> editVirtualHardwareSectionMemory(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionNetworkCards(URI)
|
||||
|
@ -491,7 +944,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI);
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSectionNetworkCards(URI, RasdItemsList)
|
||||
|
@ -501,8 +954,8 @@ public interface VmAsyncApi {
|
|||
@Produces(OVF_RASD_ITEMS_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
ListenableFuture<Task> editVirtualHardwareSectionNetworkCards(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* @see VmApi#getVirtualHardwareSectionSerialPorts(URI)
|
||||
|
@ -512,7 +965,7 @@ public interface VmAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI);
|
||||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmHref);
|
||||
|
||||
/**
|
||||
* @see VmApi#editVirtualHardwareSectionSerialPorts(URI, RasdItemsList)
|
||||
|
@ -522,12 +975,16 @@ public interface VmAsyncApi {
|
|||
@Produces(OVF_RASD_ITEMS_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
ListenableFuture<Task> editVirtualHardwareSectionSerialPorts(@EndpointParam URI vmHref,
|
||||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* Asynchronous access to {@Vm} {@link Metadata} features.
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi();
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI vmHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||
|
@ -30,6 +31,7 @@ import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams;
|
||||
import org.jclouds.vcloud.director.v1_5.features.CatalogApi;
|
||||
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.CatalogURNToAdminHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link AdminCatalog} objects.
|
||||
|
@ -166,5 +168,10 @@ public interface AdminCatalogApi extends CatalogApi {
|
|||
*/
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi();
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn);
|
||||
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam URI catalogAdminHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -248,6 +248,10 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
|
|||
*/
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi();
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn);
|
||||
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI catalogAdminHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,11 +23,13 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.network.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
|
||||
import org.jclouds.vcloud.director.v1_5.features.NetworkApi;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.NetworkURNToAdminHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to admin {@link Network} objects.
|
||||
|
@ -97,6 +99,10 @@ public interface AdminNetworkApi extends NetworkApi {
|
|||
*/
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi();
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn);
|
||||
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam URI networkAdminHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -116,5 +116,10 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi {
|
|||
*/
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi();
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn);
|
||||
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI networkAdminHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.org.AdminOrg;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.org.OrgEmailSettings;
|
||||
|
@ -34,6 +35,7 @@ import org.jclouds.vcloud.director.v1_5.domain.org.OrgSettings;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.org.OrgVAppTemplateLeaseSettings;
|
||||
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgApi;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToAdminHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link Org} objects.
|
||||
|
@ -274,6 +276,10 @@ public interface AdminOrgApi extends OrgApi {
|
|||
*/
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi();
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
|
||||
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam URI orgAdminHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -363,5 +363,10 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
|
|||
*/
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi();
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
|
||||
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI adminOrgHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,11 +23,13 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AdminVdc;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
|
||||
import org.jclouds.vcloud.director.v1_5.features.MetadataApi.Writeable;
|
||||
import org.jclouds.vcloud.director.v1_5.features.VdcApi;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.href.VdcURNToAdminHref;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link AdminVdc}.
|
||||
|
@ -51,7 +53,7 @@ public interface AdminVdcApi extends VdcApi {
|
|||
AdminVdc get(String vdcUrn);
|
||||
|
||||
@Override
|
||||
AdminVdc get(URI vdcHref);
|
||||
AdminVdc get(URI vdcAdminHref);
|
||||
|
||||
/**
|
||||
* Modifies a Virtual Data Center. Virtual Data Center could be enabled or disabled.
|
||||
|
@ -60,7 +62,7 @@ public interface AdminVdcApi extends VdcApi {
|
|||
*/
|
||||
Task edit(String vdcUrn, AdminVdc vdc);
|
||||
|
||||
Task edit(URI vdcHref, AdminVdc vdc);
|
||||
Task edit(URI vdcAdminHref, AdminVdc vdc);
|
||||
|
||||
/**
|
||||
* Deletes a Virtual Data Center. The Virtual Data Center should be disabled when remove is issued.
|
||||
|
@ -69,7 +71,7 @@ public interface AdminVdcApi extends VdcApi {
|
|||
// TODO Saw what exception, instead of 400
|
||||
Task remove(String vdcUrn);
|
||||
|
||||
Task remove(URI vdcHref);
|
||||
Task remove(URI vdcAdminHref);
|
||||
|
||||
/**
|
||||
* Enables a Virtual Data Center. This operation enables disabled Virtual Data Center.
|
||||
|
@ -77,7 +79,7 @@ public interface AdminVdcApi extends VdcApi {
|
|||
*/
|
||||
void enable(String vdcUrn);
|
||||
|
||||
void enable(URI vdcHref);
|
||||
void enable(URI vdcAdminHref);
|
||||
|
||||
/**
|
||||
* Disables a Virtual Data Center. If the Virtual Data Center is disabled this operation does not
|
||||
|
@ -85,11 +87,15 @@ public interface AdminVdcApi extends VdcApi {
|
|||
*/
|
||||
void disable(String vdcUrn);
|
||||
|
||||
void disable(URI vdcHref);
|
||||
void disable(URI vdcAdminHref);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Writeable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi();
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
|
||||
|
||||
@Delegate
|
||||
MetadataApi.Writeable getMetadataApi(@EndpointParam URI vdcAdminHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<AdminVdc> get(@EndpointParam URI vdcHref);
|
||||
ListenableFuture<AdminVdc> get(@EndpointParam URI vdcAdminHref);
|
||||
|
||||
/**
|
||||
* @see AdminVdcApi#edit(URI, AdminVdc)
|
||||
|
@ -113,7 +113,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
|
|||
@Consumes
|
||||
@Produces(VCloudDirectorMediaType.ADMIN_VDC)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> edit(@EndpointParam URI vdcHref, AdminVdc vdc);
|
||||
ListenableFuture<Task> edit(@EndpointParam URI vdcAdminHref, AdminVdc vdc);
|
||||
|
||||
/**
|
||||
* @see AdminVdcApi#remove(URI)
|
||||
|
@ -121,7 +121,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
|
|||
@DELETE
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> remove(@EndpointParam URI vdcHref);
|
||||
ListenableFuture<Task> remove(@EndpointParam URI vdcAdminHref);
|
||||
|
||||
/**
|
||||
* @see AdminVdcApi#enable(URI)
|
||||
|
@ -130,7 +130,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
|
|||
@Consumes
|
||||
@Path("/action/enable")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> enable(@EndpointParam URI vdcHref);
|
||||
ListenableFuture<Void> enable(@EndpointParam URI vdcAdminHref);
|
||||
|
||||
/**
|
||||
* @see AdminVdcApi#disable(URI)
|
||||
|
@ -139,12 +139,17 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
|
|||
@Consumes
|
||||
@Path("/action/disable")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> disable(@EndpointParam URI vdcHref);
|
||||
ListenableFuture<Void> disable(@EndpointParam URI vdcAdminHref);
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Writeable} features
|
||||
*/
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi();
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
|
||||
|
||||
@Override
|
||||
@Delegate
|
||||
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI vdcAdminHref);
|
||||
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class VAppTemplatesForCatalogItems implements Function<Iterable<CatalogIt
|
|||
@Override
|
||||
public Future<? extends VAppTemplate> apply(CatalogItem from) {
|
||||
return new ExceptionParsingListenableFuture<VAppTemplate>(Futures.makeListenable(VCloudDirectorAsyncApi.class
|
||||
.cast(aapi).getVAppTemplateApi().getVAppTemplate(from.getEntity().getHref()), executor),
|
||||
.cast(aapi).getVAppTemplateApi().get(from.getEntity().getHref()), executor),
|
||||
returnNullOnAuthorizationException);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.functions.href;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Entity;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
|
||||
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
||||
@Singleton
|
||||
public class MediaURNToHref extends URNToHref {
|
||||
|
||||
@Inject
|
||||
public MediaURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
|
||||
super(resolveEntityCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String type() {
|
||||
return VCloudDirectorMediaType.MEDIA;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.functions.href;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Entity;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
|
||||
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
||||
@Singleton
|
||||
public class VAppTemplateURNToHref extends URNToHref {
|
||||
|
||||
@Inject
|
||||
public VAppTemplateURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
|
||||
super(resolveEntityCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String type() {
|
||||
return VCloudDirectorMediaType.VAPP_TEMPLATE;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.functions.href;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Entity;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
|
||||
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
||||
@Singleton
|
||||
public class VAppURNToHref extends URNToHref {
|
||||
|
||||
@Inject
|
||||
public VAppURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
|
||||
super(resolveEntityCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String type() {
|
||||
return VCloudDirectorMediaType.VAPP;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.functions.href;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Entity;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
|
||||
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
||||
@Singleton
|
||||
public class VmURNToHref extends URNToHref {
|
||||
|
||||
@Inject
|
||||
public VmURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
|
||||
super(resolveEntityCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String type() {
|
||||
return VCloudDirectorMediaType.VM;
|
||||
}
|
||||
|
||||
}
|
|
@ -107,8 +107,8 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
protected Vm vm;
|
||||
protected VApp vApp;
|
||||
protected VAppTemplate vAppTemplate;
|
||||
protected URI vmURI;
|
||||
protected URI vAppURI;
|
||||
protected String vmUrn;
|
||||
protected String vAppUrn;
|
||||
|
||||
/**
|
||||
* Retrieves the required apis from the REST API context
|
||||
|
@ -137,35 +137,35 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
vdc = lazyGetVdc();
|
||||
|
||||
// Get the configured VAppTemplate for the tests
|
||||
vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
|
||||
vAppTemplate = vAppTemplateApi.get(vAppTemplateUrn);
|
||||
assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE));
|
||||
|
||||
// Instantiate a new VApp
|
||||
VApp vAppInstantiated = instantiateVApp();
|
||||
assertNotNull(vAppInstantiated, String.format(ENTITY_NON_NULL, VAPP));
|
||||
vAppURI = vAppInstantiated.getHref();
|
||||
vAppUrn = vAppInstantiated.getId();
|
||||
|
||||
// Wait for the task to complete
|
||||
Task instantiateTask = Iterables.getOnlyElement(vAppInstantiated.getTasks());
|
||||
assertTrue(retryTaskSuccessLong.apply(instantiateTask), String.format(TASK_COMPLETE_TIMELY, "instantiateTask"));
|
||||
|
||||
// Get the instantiated VApp
|
||||
vApp = vAppApi.getVApp(vAppURI);
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Get the Vm
|
||||
List<Vm> vms = vApp.getChildren().getVms();
|
||||
vm = Iterables.getOnlyElement(vms);
|
||||
vmURI = vm.getHref();
|
||||
vmUrn = vm.getId();
|
||||
assertFalse(vms.isEmpty(), "The VApp must have a Vm");
|
||||
}
|
||||
|
||||
protected void getGuestCustomizationSection(final Function<URI, GuestCustomizationSection> getGuestCustomizationSection) {
|
||||
protected void getGuestCustomizationSection(final Function<String, GuestCustomizationSection> getGuestCustomizationSection) {
|
||||
// Get URI for child VM
|
||||
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||
String vmUrn = Iterables.getOnlyElement(vApp.getChildren().getVms()).getId();
|
||||
|
||||
// The method under test
|
||||
try {
|
||||
GuestCustomizationSection section = getGuestCustomizationSection.apply(vmURI);
|
||||
GuestCustomizationSection section = getGuestCustomizationSection.apply(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkGuestCustomizationSection(section);
|
||||
|
@ -174,13 +174,13 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
}
|
||||
}
|
||||
|
||||
protected void getNetworkConnectionSection(final Function<URI, NetworkConnectionSection> getNetworkConnectionSection) {
|
||||
protected void getNetworkConnectionSection(final Function<String, NetworkConnectionSection> getNetworkConnectionSection) {
|
||||
// Get URI for child VM
|
||||
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||
String vmUrn = Iterables.getOnlyElement(vApp.getChildren().getVms()).getId();
|
||||
|
||||
// The method under test
|
||||
try {
|
||||
NetworkConnectionSection section = getNetworkConnectionSection.apply(vmURI);
|
||||
NetworkConnectionSection section = getNetworkConnectionSection.apply(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkNetworkConnectionSection(section);
|
||||
|
@ -200,7 +200,7 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
// If we found any references, remove the VApp they point to
|
||||
if (!Iterables.isEmpty(vApps)) {
|
||||
for (Reference ref : vApps) {
|
||||
cleanUpVApp(ref.getHref()); // NOTE may fail, but should continue deleting
|
||||
cleanUpVApp(context.getApi().getVAppApi().get(ref.getHref())); // NOTE may fail, but should continue deleting
|
||||
}
|
||||
} else {
|
||||
logger.warn("No VApps in list found in Vdc %s (%s)", vdc.getName(), Iterables.toString(vAppNames));
|
||||
|
@ -248,14 +248,14 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
/**
|
||||
* Power on a {@link VApp}.
|
||||
*/
|
||||
protected VApp powerOnVApp(final URI testVAppURI) {
|
||||
VApp test = vAppApi.getVApp(testVAppURI);
|
||||
protected VApp powerOnVApp(String vAppUrn) {
|
||||
VApp test = vAppApi.get(vAppUrn);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.POWERED_ON) {
|
||||
Task powerOn = vAppApi.powerOn(vm.getHref());
|
||||
Task powerOn = vAppApi.powerOn(vAppUrn);
|
||||
assertTaskSucceedsLong(powerOn);
|
||||
}
|
||||
test = vAppApi.getVApp(testVAppURI);
|
||||
test = vAppApi.get(vAppUrn);
|
||||
assertStatus(VAPP, test, Status.POWERED_ON);
|
||||
return test;
|
||||
}
|
||||
|
@ -263,14 +263,14 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
/**
|
||||
* Power on a {@link Vm}.
|
||||
*/
|
||||
protected Vm powerOnVm(final URI testVmURI) {
|
||||
Vm test = vmApi.get(testVmURI);
|
||||
protected Vm powerOnVm(String vmUrn) {
|
||||
Vm test = vmApi.get(vmUrn);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.POWERED_ON) {
|
||||
Task powerOn = vmApi.powerOn(vm.getHref());
|
||||
Task powerOn = vmApi.powerOn(vmUrn);
|
||||
assertTaskSucceedsLong(powerOn);
|
||||
}
|
||||
test = vmApi.get(testVmURI);
|
||||
test = vmApi.get(vmUrn);
|
||||
assertStatus(VM, test, Status.POWERED_ON);
|
||||
return test;
|
||||
}
|
||||
|
@ -278,14 +278,14 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
/**
|
||||
* Power off a {@link VApp}.
|
||||
*/
|
||||
protected VApp powerOffVApp(final URI testVAppURI) {
|
||||
VApp test = vAppApi.getVApp(testVAppURI);
|
||||
protected VApp powerOffVApp(String vAppUrn) {
|
||||
VApp test = vAppApi.get(vAppUrn);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.POWERED_OFF) {
|
||||
Task powerOff = vAppApi.powerOff(vm.getHref());
|
||||
Task powerOff = vAppApi.powerOff(vAppUrn);
|
||||
assertTaskSucceedsLong(powerOff);
|
||||
}
|
||||
test = vAppApi.getVApp(testVAppURI);
|
||||
test = vAppApi.get(vAppUrn);
|
||||
assertStatus(VAPP, test, Status.POWERED_OFF);
|
||||
return test;
|
||||
}
|
||||
|
@ -293,15 +293,15 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
/**
|
||||
* Power off a {@link Vm}.
|
||||
*/
|
||||
protected Vm powerOffVm(final URI testVmURI) {
|
||||
Vm test = vmApi.get(testVmURI);
|
||||
protected Vm powerOffVm(String vmUrn) {
|
||||
Vm test = vmApi.get(vmUrn);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.POWERED_OFF || test.isDeployed()) {
|
||||
UndeployVAppParams undeployParams = UndeployVAppParams.builder().build();
|
||||
Task shutdownVapp = vAppApi.undeploy(test.getHref(), undeployParams);
|
||||
Task shutdownVapp = vAppApi.undeploy(vmUrn, undeployParams);
|
||||
assertTaskSucceedsLong(shutdownVapp);
|
||||
}
|
||||
test = vmApi.get(testVmURI);
|
||||
test = vmApi.get(vmUrn);
|
||||
assertStatus(VM, test, Status.POWERED_OFF);
|
||||
return test;
|
||||
}
|
||||
|
@ -309,14 +309,14 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
/**
|
||||
* Suspend a {@link VApp}.
|
||||
*/
|
||||
protected VApp suspendVApp(final URI testVAppURI) {
|
||||
VApp test = vAppApi.getVApp(testVAppURI);
|
||||
protected VApp suspendVApp(String vAppUrn) {
|
||||
VApp test = vAppApi.get(vAppUrn);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.SUSPENDED) {
|
||||
Task suspend = vAppApi.suspend(vm.getHref());
|
||||
Task suspend = vAppApi.suspend(vAppUrn);
|
||||
assertTaskSucceedsLong(suspend);
|
||||
}
|
||||
test = vAppApi.getVApp(testVAppURI);
|
||||
test = vAppApi.get(vAppUrn);
|
||||
assertStatus(VAPP, test, Status.SUSPENDED);
|
||||
return test;
|
||||
}
|
||||
|
@ -324,14 +324,14 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
/**
|
||||
* Suspend a {@link Vm}.
|
||||
*/
|
||||
protected Vm suspendVm(final URI testVmURI) {
|
||||
Vm test = vmApi.get(testVmURI);
|
||||
protected Vm suspendVm(String vmUrn) {
|
||||
Vm test = vmApi.get(vmUrn);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.SUSPENDED) {
|
||||
Task suspend = vmApi.suspend(vm.getHref());
|
||||
Task suspend = vmApi.suspend(vmUrn);
|
||||
assertTaskSucceedsLong(suspend);
|
||||
}
|
||||
test = vmApi.get(testVmURI);
|
||||
test = vmApi.get(vmUrn);
|
||||
assertStatus(VM, test, Status.SUSPENDED);
|
||||
return test;
|
||||
}
|
||||
|
@ -339,16 +339,16 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
/**
|
||||
* Check the {@link VApp}s current status.
|
||||
*/
|
||||
protected void assertVAppStatus(final URI testVAppURI, final Status status) {
|
||||
VApp testVApp = vAppApi.getVApp(testVAppURI);
|
||||
protected void assertVAppStatus(final String vAppUrn, final Status status) {
|
||||
VApp testVApp = vAppApi.get(vAppUrn);
|
||||
assertStatus(VAPP, testVApp, status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the {@link Vm}s current status.
|
||||
*/
|
||||
protected void assertVmStatus(final URI testVmURI, final Status status) {
|
||||
Vm testVm = vmApi.get(testVmURI);
|
||||
protected void assertVmStatus(String vmUrn, final Status status) {
|
||||
Vm testVm = vmApi.get(vmUrn);
|
||||
assertStatus(VM, testVm, status);
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
}
|
||||
|
||||
protected VAppNetworkConfiguration getVAppNetworkConfig(VApp vApp) {
|
||||
Set<VAppNetworkConfiguration> vAppNetworkConfigs = vAppApi.getNetworkConfigSection(vApp.getHref()).getNetworkConfigs();
|
||||
Set<VAppNetworkConfiguration> vAppNetworkConfigs = vAppApi.getNetworkConfigSection(vApp.getId()).getNetworkConfigs();
|
||||
return Iterables.tryFind(vAppNetworkConfigs, Predicates.notNull()).orNull();
|
||||
}
|
||||
|
||||
|
@ -389,11 +389,11 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
|
|||
}
|
||||
|
||||
protected Set<NetworkConnection> listNetworkConnections(Vm vm) {
|
||||
return vmApi.getNetworkConnectionSection(vm.getHref()).getNetworkConnections();
|
||||
return vmApi.getNetworkConnectionSection(vm.getId()).getNetworkConnections();
|
||||
}
|
||||
|
||||
protected Set<VAppNetworkConfiguration> listVappNetworkConfigurations(VApp vApp) {
|
||||
Set<VAppNetworkConfiguration> vAppNetworkConfigs = vAppApi.getNetworkConfigSection(vApp.getHref()).getNetworkConfigs();
|
||||
Set<VAppNetworkConfiguration> vAppNetworkConfigs = vAppApi.getNetworkConfigSection(vApp.getId()).getNetworkConfigs();
|
||||
return vAppNetworkConfigs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
|
|||
@Test
|
||||
public void testGetCatalogMetadataHref() {
|
||||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse);
|
||||
assertEquals(api.getCatalogApi().getMetadataApi().get(catalogHref), metadata());
|
||||
assertEquals(api.getCatalogApi().getMetadataApi(catalogHref).get(), metadata());
|
||||
}
|
||||
|
||||
static Metadata metadata() {
|
||||
|
@ -182,7 +182,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
|
|||
@Test
|
||||
public void testGetCatalogMetadataEntryHref() {
|
||||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadataValue, getMetadataValueResponse);
|
||||
assertEquals(api.getCatalogApi().getMetadataApi().getValue(catalogHref, "KEY"), metadataValue());
|
||||
assertEquals(api.getCatalogApi().getMetadataApi(catalogHref).getValue("KEY"), metadataValue());
|
||||
}
|
||||
|
||||
static String item = "a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df";
|
||||
|
@ -308,7 +308,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
|
|||
@Test
|
||||
public void testGetCatalogItemMetadataHref() {
|
||||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getItemMetadata, getItemMetadataResponse);
|
||||
assertEquals(api.getCatalogApi().getMetadataApi().get(itemHref), expected);
|
||||
assertEquals(api.getCatalogApi().getMetadataApi(itemHref).get(), expected);
|
||||
}
|
||||
|
||||
HttpRequest mergeItemMetadata = HttpRequest.builder()
|
||||
|
@ -330,7 +330,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
|
|||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, mergeItemMetadata, mergeItemMetadataResponse);
|
||||
// TODO: horrendous way of representing Map<String,String>
|
||||
Metadata metadata = Metadata.builder().entry(MetadataEntry.builder().entry("KEY", "VALUE").build()).build();
|
||||
assertEquals(api.getCatalogApi().getItemMetadataApi().merge(itemHref, metadata), mergeMetadataTask());
|
||||
assertEquals(api.getCatalogApi().getItemMetadataApi(itemHref).merge(metadata), mergeMetadataTask());
|
||||
}
|
||||
|
||||
HttpRequest getItemMetadataValue = HttpRequest.builder()
|
||||
|
@ -348,7 +348,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
|
|||
@Test
|
||||
public void testGetCatalogItemMetadataEntryHref() {
|
||||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getItemMetadataValue, getItemMetadataValueResponse);
|
||||
assertEquals(api.getCatalogApi().getMetadataApi().getValue(itemHref, "KEY"), itemMetadataValue());
|
||||
assertEquals(api.getCatalogApi().getMetadataApi(itemHref).getValue("KEY"), itemMetadataValue());
|
||||
}
|
||||
|
||||
HttpRequest putItemMetadata = HttpRequest.builder()
|
||||
|
@ -368,7 +368,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
|
|||
@Test
|
||||
public void testSetCatalogItemMetadataEntryHref() {
|
||||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, putItemMetadata, putItemMetadataResponse);
|
||||
assertEquals(api.getCatalogApi().getItemMetadataApi().putEntry(itemHref, "KEY", MetadataValue.builder().value("KITTENS").build()), setMetadataValueTask());
|
||||
assertEquals(api.getCatalogApi().getItemMetadataApi(itemHref).putEntry("KEY", MetadataValue.builder().value("KITTENS").build()), setMetadataValueTask());
|
||||
}
|
||||
|
||||
HttpRequest removeItemMetadataEntry = HttpRequest.builder()
|
||||
|
@ -386,7 +386,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
|
|||
@Test
|
||||
public void testRemoveCatalogItemMetadataEntryHref() {
|
||||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, removeItemMetadataEntry, removeItemMetadataEntryResponse);
|
||||
assertEquals(api.getCatalogApi().getItemMetadataApi().removeEntry(itemHref, "KEY"), removeEntryTask());
|
||||
assertEquals(api.getCatalogApi().getItemMetadataApi(itemHref).removeEntry("KEY"), removeEntryTask());
|
||||
}
|
||||
|
||||
public static final Catalog catalog() {
|
||||
|
|
|
@ -96,7 +96,7 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
Metadata newMetadata = Metadata.builder().entry(MetadataEntry.builder().entry("KEY", "MARMALADE").build())
|
||||
.build();
|
||||
|
||||
Task mergeCatalogMetadata = adminCatalogApi.getMetadataApi().merge(adminCatalog.getHref(), newMetadata);
|
||||
Task mergeCatalogMetadata = adminCatalogApi.getMetadataApi(adminCatalog.getId()).merge(newMetadata);
|
||||
checkTask(mergeCatalogMetadata);
|
||||
assertTrue(retryTaskSuccess.apply(mergeCatalogMetadata),
|
||||
String.format(TASK_COMPLETE_TIMELY, "setupRequiredApis"));
|
||||
|
@ -184,13 +184,13 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
@Test(description = "GET /catalog/{id}/metadata")
|
||||
public void testGetCatalogMetadata() {
|
||||
Metadata catalogMetadata = catalogApi.getMetadataApi().get(lazyGetCatalog().getHref());
|
||||
Metadata catalogMetadata = catalogApi.getMetadataApi(catalogUrn).get();
|
||||
checkMetadata(catalogMetadata);
|
||||
}
|
||||
|
||||
@Test(description = "GET /catalog/{id}/metadata/{key}")
|
||||
public void testGetCatalogMetadataValue() {
|
||||
Metadata catalogMetadata = catalogApi.getMetadataApi().get(lazyGetCatalog().getHref());
|
||||
Metadata catalogMetadata = catalogApi.getMetadataApi(catalogUrn).get();
|
||||
MetadataEntry existingMetadataEntry = Iterables.find(catalogMetadata.getMetadataEntries(),
|
||||
new Predicate<MetadataEntry>() {
|
||||
@Override
|
||||
|
@ -198,7 +198,8 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
return input.getKey().equals("KEY");
|
||||
}
|
||||
});
|
||||
MetadataValue metadataValue = catalogApi.getMetadataApi().getValue(existingMetadataEntry.getHref(), "KEY");
|
||||
MetadataValue metadataValue = catalogApi.getMetadataApi(catalogApi.get(existingMetadataEntry.getHref()).getId())
|
||||
.getValue("KEY");
|
||||
assertEquals(metadataValue.getValue(), existingMetadataEntry.getValue(), String.format(CORRECT_VALUE_OBJECT_FMT,
|
||||
"Value", "MetadataValue", existingMetadataEntry.getValue(), metadataValue.getValue()));
|
||||
checkMetadataValue(metadataValue);
|
||||
|
@ -206,7 +207,7 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
@Test(description = "GET /catalogItem/{id}/metadata", dependsOnMethods = "testAddCatalogItem")
|
||||
public void testGetCatalogItemMetadata() {
|
||||
Metadata catalogItemMetadata = catalogApi.getItemMetadataApi().get(catalogItem.getHref());
|
||||
Metadata catalogItemMetadata = catalogApi.getItemMetadataApi(catalogItem.getId()).get();
|
||||
checkMetadata(catalogItemMetadata);
|
||||
}
|
||||
|
||||
|
@ -215,23 +216,23 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
Metadata newMetadata = Metadata.builder().entry(MetadataEntry.builder().entry("KEY", "MARMALADE").build())
|
||||
.entry(MetadataEntry.builder().entry("VEGIMITE", "VALUE").build()).build();
|
||||
|
||||
Metadata before = catalogApi.getItemMetadataApi().get(catalogItem.getHref());
|
||||
Metadata before = catalogApi.getItemMetadataApi(catalogItem.getId()).get();
|
||||
|
||||
Task mergeCatalogItemMetadata = catalogApi.getItemMetadataApi().merge(catalogItem.getHref(), newMetadata);
|
||||
Task mergeCatalogItemMetadata = catalogApi.getItemMetadataApi(catalogItem.getId()).merge(newMetadata);
|
||||
checkTask(mergeCatalogItemMetadata);
|
||||
assertTrue(retryTaskSuccess.apply(mergeCatalogItemMetadata),
|
||||
String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata"));
|
||||
Metadata mergedCatalogItemMetadata = catalogApi.getItemMetadataApi().get(catalogItem.getHref());
|
||||
Metadata mergedCatalogItemMetadata = catalogApi.getItemMetadataApi(catalogItem.getId()).get();
|
||||
|
||||
assertTrue(mergedCatalogItemMetadata.getMetadataEntries().size() > before.getMetadataEntries().size(),
|
||||
"Should have added at least one other MetadataEntry to the CatalogItem");
|
||||
|
||||
MetadataValue keyMetadataValue = catalogApi.getItemMetadataApi().getValue(catalogItem.getHref(), "KEY");
|
||||
MetadataValue keyMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).getValue("KEY");
|
||||
assertEquals(keyMetadataValue.getValue(), "MARMALADE",
|
||||
"The Value of the MetadataValue for KEY should have changed");
|
||||
checkMetadataValue(keyMetadataValue);
|
||||
|
||||
MetadataValue newKeyMetadataValue = catalogApi.getItemMetadataApi().getValue(catalogItem.getHref(), "VEGIMITE");
|
||||
MetadataValue newKeyMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).getValue("VEGIMITE");
|
||||
|
||||
assertEquals(newKeyMetadataValue.getValue(), "VALUE",
|
||||
"The Value of the MetadataValue for NEW_KEY should have been set");
|
||||
|
@ -240,7 +241,7 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
@Test(description = "GET /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testSetCatalogItemMetadataValue")
|
||||
public void testGetCatalogItemMetadataValue() {
|
||||
MetadataValue metadataValue = catalogApi.getItemMetadataApi().getValue(catalogItem.getHref(), "KEY");
|
||||
MetadataValue metadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).getValue("KEY");
|
||||
checkMetadataValue(metadataValue);
|
||||
}
|
||||
|
||||
|
@ -248,26 +249,25 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
public void testSetCatalogItemMetadataValue() {
|
||||
MetadataValue newMetadataValue = MetadataValue.builder().value("NEW").build();
|
||||
|
||||
Task setCatalogItemMetadataValue = catalogApi.getItemMetadataApi().putEntry(catalogItem.getHref(), "KEY",
|
||||
Task setCatalogItemMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).putEntry("KEY",
|
||||
newMetadataValue);
|
||||
checkTask(setCatalogItemMetadataValue);
|
||||
assertTrue(retryTaskSuccess.apply(setCatalogItemMetadataValue),
|
||||
String.format(TASK_COMPLETE_TIMELY, "setCatalogItemMetadataValue"));
|
||||
|
||||
MetadataValue editedMetadataValue = catalogApi.getItemMetadataApi().getValue(catalogItem.getHref(), "KEY");
|
||||
assertEquals(editedMetadataValue.getValue(), newMetadataValue.getValue(), String.format(
|
||||
CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", newMetadataValue.getValue(),
|
||||
editedMetadataValue.getValue()));
|
||||
MetadataValue editedMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).getValue("KEY");
|
||||
assertEquals(editedMetadataValue.getValue(), newMetadataValue.getValue(), String.format(CORRECT_VALUE_OBJECT_FMT,
|
||||
"Value", "MetadataValue", newMetadataValue.getValue(), editedMetadataValue.getValue()));
|
||||
checkMetadataValue(editedMetadataValue);
|
||||
}
|
||||
|
||||
@Test(description = "DELETE /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testGetCatalogItemMetadataValue")
|
||||
public void testRemoveCatalogItemMetadataValue() {
|
||||
Task removeCatalogItemMetadataValue = catalogApi.getItemMetadataApi().removeEntry(catalogItem.getHref(), "KEY");
|
||||
Task removeCatalogItemMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).removeEntry("KEY");
|
||||
checkTask(removeCatalogItemMetadataValue);
|
||||
assertTrue(retryTaskSuccess.apply(removeCatalogItemMetadataValue),
|
||||
String.format(TASK_COMPLETE_TIMELY, "removeCatalogItemMetadataValue"));
|
||||
MetadataValue removed = catalogApi.getMetadataApi().getValue(catalogItem.getHref(), "KEY");
|
||||
MetadataValue removed = catalogApi.getItemMetadataApi(catalogItem.getId()).getValue("KEY");
|
||||
assertNull(removed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
|
||||
Metadata expected = metadata();
|
||||
|
||||
assertEquals(api.getMediaApi().getMetadataApi().get(mediaUri), expected);
|
||||
assertEquals(api.getMediaApi().getMetadataApi(mediaUri).get(), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -259,7 +259,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
Metadata inputMetadata = metadata();
|
||||
Task expectedTask = mergeMetadataTask();
|
||||
|
||||
assertEquals(api.getMediaApi().getMetadataApi().merge(mediaUri, inputMetadata), expectedTask);
|
||||
assertEquals(api.getMediaApi().getMetadataApi(mediaUri).merge(inputMetadata), expectedTask);
|
||||
}
|
||||
|
||||
public void testGetMetadataValue() {
|
||||
|
@ -277,7 +277,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
MetadataValue expected = metadataValue();
|
||||
|
||||
|
||||
assertEquals(api.getMediaApi().getMetadataApi().getValue(mediaUri, "key"), expected);
|
||||
assertEquals(api.getMediaApi().getMetadataApi(mediaUri).getValue("key"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -298,7 +298,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
|
||||
Task expectedTask = setMetadataEntryTask();
|
||||
|
||||
assertEquals(api.getMediaApi().getMetadataApi().putEntry(mediaUri, "key", inputMetadataValue), expectedTask);
|
||||
assertEquals(api.getMediaApi().getMetadataApi(mediaUri).putEntry("key", inputMetadataValue), expectedTask);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -316,7 +316,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
|
||||
Task expectedTask = removeEntryTask();
|
||||
|
||||
assertEquals(api.getMediaApi().getMetadataApi().removeEntry(mediaUri, "key"), expectedTask);
|
||||
assertEquals(api.getMediaApi().getMetadataApi(mediaUri).removeEntry("key"), expectedTask);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -109,16 +109,16 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
protected void tidyUp() {
|
||||
if (media != null) {
|
||||
try {
|
||||
Task remove = mediaApi.removeMedia(media.getHref());
|
||||
taskDoneEventually(remove);
|
||||
Task remove = mediaApi.removeMedia(media.getHref());
|
||||
taskDoneEventually(remove);
|
||||
} catch (Exception e) {
|
||||
logger.warn(e, "Error when deleting media '%s': %s", media.getName());
|
||||
}
|
||||
}
|
||||
if (oldMedia != null) {
|
||||
try {
|
||||
Task remove = mediaApi.removeMedia(oldMedia.getHref());
|
||||
taskDoneEventually(remove);
|
||||
Task remove = mediaApi.removeMedia(oldMedia.getHref());
|
||||
taskDoneEventually(remove);
|
||||
} catch (Exception e) {
|
||||
logger.warn(e, "Error when deleting media '%s': %s", oldMedia.getName());
|
||||
}
|
||||
|
@ -133,30 +133,31 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
// TODO: generate an iso
|
||||
byte[] iso = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
|
||||
Media sourceMedia = Media.builder()
|
||||
.type(VCloudDirectorMediaType.MEDIA)
|
||||
.name("Test media "+random.nextInt())
|
||||
.size(iso.length)
|
||||
.imageType(Media.ImageType.ISO)
|
||||
.description("Test media generated by testAddMedia()")
|
||||
.build();
|
||||
Media sourceMedia = Media.builder().type(VCloudDirectorMediaType.MEDIA).name("Test media " + random.nextInt())
|
||||
.size(iso.length).imageType(Media.ImageType.ISO).description("Test media generated by testAddMedia()")
|
||||
.build();
|
||||
media = mediaApi.addMedia(addMedia.getHref(), sourceMedia);
|
||||
|
||||
Checks.checkMediaFor(MEDIA, media);
|
||||
|
||||
assertNotNull(media.getFiles(), String.format(OBJ_FIELD_REQ, MEDIA, "files"));
|
||||
assertTrue(media.getFiles().size() == 1, String.format(OBJ_FIELD_LIST_SIZE_EQ, MEDIA, "files", 1, media.getFiles().size()));
|
||||
assertTrue(media.getFiles().size() == 1,
|
||||
String.format(OBJ_FIELD_LIST_SIZE_EQ, MEDIA, "files", 1, media.getFiles().size()));
|
||||
File uploadFile = getFirst(media.getFiles(), null);
|
||||
assertNotNull(uploadFile, String.format(OBJ_FIELD_REQ, MEDIA, "files.first"));
|
||||
assertEquals(uploadFile.getSize(), Long.valueOf(iso.length));
|
||||
assertEquals(uploadFile.getSize().longValue(), sourceMedia.getSize(),
|
||||
String.format(OBJ_FIELD_EQ, MEDIA, "uploadFile.size()", sourceMedia.getSize(), uploadFile.getSize()));
|
||||
String.format(OBJ_FIELD_EQ, MEDIA, "uploadFile.size()", sourceMedia.getSize(), uploadFile.getSize()));
|
||||
|
||||
Set<Link> links = uploadFile.getLinks();
|
||||
assertNotNull(links, String.format(OBJ_FIELD_REQ, MEDIA, "uploadFile.links"));
|
||||
assertTrue(links.size() >= 1, String.format(OBJ_FIELD_LIST_SIZE_GE, MEDIA, "uploadfile.links", 1, links.size()));
|
||||
assertTrue(Iterables.all(links, Predicates.or(LinkPredicates.relEquals(Link.Rel.UPLOAD_DEFAULT), LinkPredicates.relEquals(Link.Rel.UPLOAD_ALTERNATE))),
|
||||
String.format(OBJ_FIELD_REQ, MEDIA, "uploadFile.links.first"));
|
||||
assertTrue(
|
||||
Iterables.all(
|
||||
links,
|
||||
Predicates.or(LinkPredicates.relEquals(Link.Rel.UPLOAD_DEFAULT),
|
||||
LinkPredicates.relEquals(Link.Rel.UPLOAD_ALTERNATE))),
|
||||
String.format(OBJ_FIELD_REQ, MEDIA, "uploadFile.links.first"));
|
||||
|
||||
Link uploadLink = Iterables.find(links, LinkPredicates.relEquals(Link.Rel.UPLOAD_DEFAULT));
|
||||
context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
|
||||
|
@ -186,12 +187,10 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
@Test(description = "GET /media/{id}/owner", dependsOnMethods = { "testGetMedia" })
|
||||
public void testGetMediaOwner() {
|
||||
Owner directOwner = mediaApi.getOwner(media.getHref());
|
||||
assertEquals(owner.toBuilder()
|
||||
.user(owner.getUser())
|
||||
.build(),
|
||||
directOwner.toBuilder().links(Collections.<Link>emptySet()).build(),
|
||||
String.format(GETTER_RETURNS_SAME_OBJ,
|
||||
"getOwner()", "owner", "media.getOwner()", owner.toString(), directOwner.toString()));
|
||||
assertEquals(owner.toBuilder().user(owner.getUser()).build(),
|
||||
directOwner.toBuilder().links(Collections.<Link> emptySet()).build(), String.format(
|
||||
GETTER_RETURNS_SAME_OBJ, "getOwner()", "owner", "media.getOwner()", owner.toString(),
|
||||
directOwner.toString()));
|
||||
|
||||
// parent type
|
||||
Checks.checkResourceType(directOwner);
|
||||
|
@ -204,11 +203,10 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
@Test(description = "POST /vdc/{id}/action/cloneMedia", dependsOnMethods = { "testGetMediaOwner" })
|
||||
public void testCloneMedia() {
|
||||
oldMedia = media;
|
||||
media = vdcApi.cloneMedia(vdcUrn, CloneMediaParams.builder()
|
||||
.source(Reference.builder().fromEntity(media).build())
|
||||
.name("copied "+media.getName())
|
||||
.description("copied by testCloneMedia()")
|
||||
.build());
|
||||
media = vdcApi.cloneMedia(
|
||||
vdcUrn,
|
||||
CloneMediaParams.builder().source(Reference.builder().fromEntity(media).build())
|
||||
.name("copied " + media.getName()).description("copied by testCloneMedia()").build());
|
||||
|
||||
Checks.checkMediaFor(VDC, media);
|
||||
|
||||
|
@ -222,17 +220,14 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
}
|
||||
|
||||
Checks.checkMediaFor(MEDIA, media);
|
||||
assertTrue(media.clone(oldMedia), String.format(OBJ_FIELD_CLONE, MEDIA, "copied media",
|
||||
media.toString(), oldMedia.toString()));
|
||||
assertTrue(media.clone(oldMedia),
|
||||
String.format(OBJ_FIELD_CLONE, MEDIA, "copied media", media.toString(), oldMedia.toString()));
|
||||
|
||||
mediaApi.getMetadataApi().putEntry(media.getHref(), "key", MetadataValue.builder().value("value").build());
|
||||
mediaApi.getMetadataApi(media.getId()).putEntry("key", MetadataValue.builder().value("value").build());
|
||||
|
||||
media = vdcApi.cloneMedia(vdcUrn, CloneMediaParams.builder()
|
||||
.source(Reference.builder().fromEntity(media).build())
|
||||
.name("moved test media")
|
||||
.description("moved by testCloneMedia()")
|
||||
.isSourceDelete(true)
|
||||
.build());
|
||||
media = vdcApi
|
||||
.cloneMedia(vdcUrn, CloneMediaParams.builder().source(Reference.builder().fromEntity(media).build())
|
||||
.name("moved test media").description("moved by testCloneMedia()").isSourceDelete(true).build());
|
||||
|
||||
Checks.checkMediaFor(VDC, media);
|
||||
|
||||
|
@ -246,16 +241,16 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
}
|
||||
|
||||
Checks.checkMediaFor(MEDIA, media);
|
||||
assertTrue(media.clone(oldMedia), String.format(OBJ_FIELD_CLONE, MEDIA, "moved media",
|
||||
media.toString(), oldMedia.toString()));
|
||||
assertTrue(media.clone(oldMedia),
|
||||
String.format(OBJ_FIELD_CLONE, MEDIA, "moved media", media.toString(), oldMedia.toString()));
|
||||
}
|
||||
|
||||
@Test(description = "PUT /media/{id}", dependsOnMethods = { "testCloneMedia" })
|
||||
public void testSetMedia() {
|
||||
String oldName = media.getName();
|
||||
String newName = "new "+oldName;
|
||||
String newName = "new " + oldName;
|
||||
String oldDescription = media.getDescription();
|
||||
String newDescription = "new "+oldDescription;
|
||||
String newDescription = "new " + oldDescription;
|
||||
media = media.toBuilder().name(newName).description(newDescription).build();
|
||||
|
||||
Task editMedia = mediaApi.editMedia(media.getHref(), media);
|
||||
|
@ -265,9 +260,9 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
assertTrue(equal(media.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, MEDIA, "name"));
|
||||
assertTrue(equal(media.getDescription(), newDescription),
|
||||
String.format(OBJ_FIELD_UPDATABLE, MEDIA, "description"));
|
||||
String.format(OBJ_FIELD_UPDATABLE, MEDIA, "description"));
|
||||
|
||||
//TODO negative tests?
|
||||
// TODO negative tests?
|
||||
|
||||
Checks.checkMediaFor(MEDIA, media);
|
||||
|
||||
|
@ -281,10 +276,9 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
@Test(description = "GET /media/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" })
|
||||
public void testGetMetadata() {
|
||||
metadata = mediaApi.getMetadataApi().get(media.getHref());
|
||||
metadata = mediaApi.getMetadataApi(media.getId()).get();
|
||||
// required for testing
|
||||
assertFalse(isEmpty(metadata.getMetadataEntries()),
|
||||
String.format(OBJ_FIELD_REQ_LIVE, MEDIA, "metadata.entries"));
|
||||
assertFalse(isEmpty(metadata.getMetadataEntries()), String.format(OBJ_FIELD_REQ_LIVE, MEDIA, "metadata.entries"));
|
||||
|
||||
Checks.checkMetadataFor(MEDIA, metadata);
|
||||
}
|
||||
|
@ -293,14 +287,12 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
public void testMergeMetadata() {
|
||||
// test new
|
||||
Set<MetadataEntry> inputEntries = ImmutableSet.of(MetadataEntry.builder().entry("testKey", "testValue").build());
|
||||
Metadata inputMetadata = Metadata.builder()
|
||||
.entries(inputEntries)
|
||||
.build();
|
||||
Metadata inputMetadata = Metadata.builder().entries(inputEntries).build();
|
||||
|
||||
Task mergeMetadata = mediaApi.getMetadataApi().merge(media.getHref(), inputMetadata);
|
||||
Task mergeMetadata = mediaApi.getMetadataApi(media.getId()).merge(inputMetadata);
|
||||
Checks.checkTask(mergeMetadata);
|
||||
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(new)"));
|
||||
metadata = mediaApi.getMetadataApi().get(media.getHref());
|
||||
metadata = mediaApi.getMetadataApi(media.getId()).get();
|
||||
Checks.checkMetadataFor(MEDIA, metadata);
|
||||
checkMetadataContainsEntries(metadata, inputEntries);
|
||||
|
||||
|
@ -309,14 +301,12 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
// test edit
|
||||
inputEntries = ImmutableSet.of(MetadataEntry.builder().entry("testKey", "new testValue").build());
|
||||
inputMetadata = Metadata.builder()
|
||||
.entries(inputEntries)
|
||||
.build();
|
||||
inputMetadata = Metadata.builder().entries(inputEntries).build();
|
||||
|
||||
mergeMetadata = mediaApi.getMetadataApi().merge(media.getHref(), inputMetadata);
|
||||
mergeMetadata = mediaApi.getMetadataApi(media.getId()).merge(inputMetadata);
|
||||
Checks.checkTask(mergeMetadata);
|
||||
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(edit)"));
|
||||
metadata = mediaApi.getMetadataApi().get(media.getHref());
|
||||
metadata = mediaApi.getMetadataApi(media.getId()).get();
|
||||
Checks.checkMetadataFor(MEDIA, metadata);
|
||||
checkMetadataContainsEntries(metadata, inputEntries);
|
||||
|
||||
|
@ -329,21 +319,21 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
boolean found = false;
|
||||
for (MetadataEntry entry : metadata.getMetadataEntries()) {
|
||||
if (equal(inputEntry.getKey(), entry.getKey())) {
|
||||
found = true; break;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
String.format(OBJ_FIELD_CONTAINS, MEDIA, "metadata",
|
||||
Iterables.toString(metadata.getMetadataEntries()),
|
||||
Iterables.toString(entries));
|
||||
String.format(OBJ_FIELD_CONTAINS, MEDIA, "metadata", Iterables.toString(metadata.getMetadataEntries()),
|
||||
Iterables.toString(entries));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test(description = "GET /media/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
|
||||
public void testGetMetadataValue() {
|
||||
metadataValue = mediaApi.getMetadataApi().getValue(media.getHref(), "key");
|
||||
metadataValue = mediaApi.getMetadataApi(media.getId()).getValue("key");
|
||||
Checks.checkMetadataValueFor(MEDIA, metadataValue);
|
||||
}
|
||||
|
||||
|
@ -352,39 +342,37 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
metadataEntryValue = "value";
|
||||
MetadataValue newValue = MetadataValue.builder().value(metadataEntryValue).build();
|
||||
|
||||
Task setMetadataEntry = mediaApi.getMetadataApi().putEntry(media.getHref(), "key", newValue);
|
||||
Task setMetadataEntry = mediaApi.getMetadataApi(media.getId()).putEntry("key", newValue);
|
||||
Checks.checkTask(setMetadataEntry);
|
||||
assertTrue(retryTaskSuccess.apply(setMetadataEntry),
|
||||
String.format(TASK_COMPLETE_TIMELY, "setMetadataEntry"));
|
||||
metadataValue = mediaApi.getMetadataApi().getValue(media.getHref(), "key");
|
||||
assertTrue(retryTaskSuccess.apply(setMetadataEntry), String.format(TASK_COMPLETE_TIMELY, "setMetadataEntry"));
|
||||
metadataValue = mediaApi.getMetadataApi(media.getId()).getValue("key");
|
||||
Checks.checkMetadataValueFor(MEDIA, metadataValue);
|
||||
}
|
||||
|
||||
@Test(description = "DELETE /media/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata", "testGetMetadataValue" } )
|
||||
@Test(description = "DELETE /media/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata",
|
||||
"testGetMetadataValue" })
|
||||
public void testRemoveMetadata() {
|
||||
Task removeEntry = mediaApi.getMetadataApi().removeEntry(media.getHref(), "testKey");
|
||||
Task removeEntry = mediaApi.getMetadataApi(media.getId()).removeEntry("testKey");
|
||||
Checks.checkTask(removeEntry);
|
||||
assertTrue(retryTaskSuccess.apply(removeEntry),
|
||||
String.format(TASK_COMPLETE_TIMELY, "removeEntry"));
|
||||
assertTrue(retryTaskSuccess.apply(removeEntry), String.format(TASK_COMPLETE_TIMELY, "removeEntry"));
|
||||
|
||||
metadataValue = mediaApi.getMetadataApi().getValue(media.getHref(), "testKey");
|
||||
assertNull(metadataValue, String.format(OBJ_FIELD_ATTRB_DEL, MEDIA,
|
||||
"Metadata", metadataValue != null ? metadataValue.toString() : "",
|
||||
"MetadataEntry", metadataValue != null ? metadataValue.toString() : ""));
|
||||
metadataValue = mediaApi.getMetadataApi(media.getId()).getValue("testKey");
|
||||
assertNull(metadataValue, String.format(OBJ_FIELD_ATTRB_DEL, MEDIA, "Metadata",
|
||||
metadataValue != null ? metadataValue.toString() : "", "MetadataEntry",
|
||||
metadataValue != null ? metadataValue.toString() : ""));
|
||||
|
||||
metadataValue = mediaApi.getMetadataApi().getValue(media.getHref(), "key");
|
||||
metadataValue = mediaApi.getMetadataApi(media.getId()).getValue("key");
|
||||
Checks.checkMetadataValueFor(MEDIA, metadataValue);
|
||||
|
||||
media = mediaApi.getMedia(media.getHref());
|
||||
Checks.checkMediaFor(MEDIA, media);
|
||||
}
|
||||
|
||||
@Test(description = "DELETE /media/{id}", dependsOnMethods = { "testRemoveMetadata" } )
|
||||
@Test(description = "DELETE /media/{id}", dependsOnMethods = { "testRemoveMetadata" })
|
||||
public void testRemoveMedia() {
|
||||
Task removeMedia = mediaApi.removeMedia(media.getHref());
|
||||
Checks.checkTask(removeMedia);
|
||||
assertTrue(retryTaskSuccess.apply(removeMedia),
|
||||
String.format(TASK_COMPLETE_TIMELY, "removeMedia"));
|
||||
assertTrue(retryTaskSuccess.apply(removeMedia), String.format(TASK_COMPLETE_TIMELY, "removeMedia"));
|
||||
|
||||
media = mediaApi.getMedia(media.getHref());
|
||||
assertNull(media, String.format(OBJ_DEL, MEDIA, media != null ? media.toString() : ""));
|
||||
|
|
|
@ -181,7 +181,7 @@ public class NetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
@Test
|
||||
public void testGetNetworkMetadataHref() {
|
||||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse);
|
||||
assertEquals(api.getNetworkApi().getMetadataApi().get(networkHref), metadata());
|
||||
assertEquals(api.getNetworkApi().getMetadataApi(networkHref).get(), metadata());
|
||||
}
|
||||
|
||||
static Metadata metadata() {
|
||||
|
@ -216,7 +216,7 @@ public class NetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
@Test
|
||||
public void testGetNetworkMetadataEntryHref() {
|
||||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadataValue, getMetadataValueResponse);
|
||||
assertEquals(api.getNetworkApi().getMetadataApi().getValue(networkHref, "KEY"), metadataValue());
|
||||
assertEquals(api.getNetworkApi().getMetadataApi(networkHref).getValue("KEY"), metadataValue());
|
||||
}
|
||||
|
||||
private MetadataValue metadataValue() {
|
||||
|
|
|
@ -22,8 +22,8 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.O
|
|||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.URN_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REQUIRED_VALUE_OBJECT_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.URN_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkResourceType;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
|
@ -60,21 +60,19 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
protected NetworkApi networkApi;
|
||||
|
||||
private boolean metadataSet = false;
|
||||
private Network network;
|
||||
|
||||
@Override
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void setupRequiredApis() {
|
||||
networkApi = context.getApi().getNetworkApi();
|
||||
network = lazyGetNetwork();
|
||||
}
|
||||
|
||||
@AfterClass(alwaysRun = true)
|
||||
public void cleanUp() {
|
||||
if (metadataSet) {
|
||||
try {
|
||||
Task remove = adminContext.getApi().getNetworkApi().getMetadataApi().removeEntry(network.getHref(), "key");
|
||||
taskDoneEventually(remove);
|
||||
Task remove = adminContext.getApi().getNetworkApi().getMetadataApi(networkUrn).removeEntry("key");
|
||||
taskDoneEventually(remove);
|
||||
} catch (Exception e) {
|
||||
logger.warn(e, "Error when deleting metadata");
|
||||
}
|
||||
|
@ -87,8 +85,8 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
assertNotNull(networkUrn, String.format(URN_REQ_LIVE, NETWORK));
|
||||
|
||||
Network abstractNetwork = networkApi.get(networkUrn);
|
||||
assertTrue(abstractNetwork instanceof OrgNetwork, String.format(REQUIRED_VALUE_OBJECT_FMT,
|
||||
".class", NETWORK, abstractNetwork.getClass(),"OrgNetwork"));
|
||||
assertTrue(abstractNetwork instanceof OrgNetwork,
|
||||
String.format(REQUIRED_VALUE_OBJECT_FMT, ".class", NETWORK, abstractNetwork.getClass(), "OrgNetwork"));
|
||||
OrgNetwork network = Network.toSubType(abstractNetwork);
|
||||
assertNotNull(network, String.format(OBJ_REQ_LIVE, NETWORK));
|
||||
assertTrue(!network.getDescription().equals("DO NOT USE"), "Network isn't to be used for testing");
|
||||
|
@ -97,8 +95,8 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
}
|
||||
|
||||
private void setupMetadata() {
|
||||
adminContext.getApi().getNetworkApi().getMetadataApi().putEntry(network.getHref(),
|
||||
"key", MetadataValue.builder().value("value").build());
|
||||
adminContext.getApi().getNetworkApi().getMetadataApi(networkUrn)
|
||||
.putEntry("key", MetadataValue.builder().value("value").build());
|
||||
metadataSet = true;
|
||||
}
|
||||
|
||||
|
@ -108,10 +106,10 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
setupMetadata();
|
||||
}
|
||||
|
||||
Metadata metadata = networkApi.getMetadataApi().get(network.getHref());
|
||||
Metadata metadata = networkApi.getMetadataApi(networkUrn).get();
|
||||
// required for testing
|
||||
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
|
||||
String.format(OBJ_FIELD_REQ_LIVE, NETWORK, "metadata.entries"));
|
||||
String.format(OBJ_FIELD_REQ_LIVE, NETWORK, "metadata.entries"));
|
||||
|
||||
// parent type
|
||||
checkResourceType(metadata);
|
||||
|
@ -119,9 +117,9 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
for (MetadataEntry entry : metadata.getMetadataEntries()) {
|
||||
// required elements and attributes
|
||||
assertNotNull(entry.getKey(),
|
||||
String.format(OBJ_FIELD_ATTRB_REQ, networkApi, "MetadataEntry", entry.getKey(), "key"));
|
||||
String.format(OBJ_FIELD_ATTRB_REQ, networkApi, "MetadataEntry", entry.getKey(), "key"));
|
||||
assertNotNull(entry.getValue(),
|
||||
String.format(OBJ_FIELD_ATTRB_REQ, networkApi, "MetadataEntry", entry.getValue(), "value"));
|
||||
String.format(OBJ_FIELD_ATTRB_REQ, networkApi, "MetadataEntry", entry.getValue(), "value"));
|
||||
|
||||
// parent type
|
||||
checkResourceType(entry);
|
||||
|
@ -130,7 +128,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
@Test(description = "GET /network/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
|
||||
public void testGetMetadataValue() {
|
||||
MetadataValue metadataValue = networkApi.getMetadataApi().getValue(network.getHref(), "key");
|
||||
MetadataValue metadataValue = networkApi.getMetadataApi(networkUrn).getValue("key");
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(metadataValue);
|
||||
|
@ -138,9 +136,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
// Check required elements and attributes
|
||||
String value = metadataValue.getValue();
|
||||
assertNotNull(value,
|
||||
String.format(OBJ_FIELD_ATTRB_REQ, NETWORK, "MetadataEntry",
|
||||
metadataValue.toString(), "value"));
|
||||
assertEquals(value, "value",
|
||||
String.format(OBJ_FIELD_EQ, NETWORK, "metadataEntry.value", "value", value));
|
||||
String.format(OBJ_FIELD_ATTRB_REQ, NETWORK, "MetadataEntry", metadataValue.toString(), "value"));
|
||||
assertEquals(value, "value", String.format(OBJ_FIELD_EQ, NETWORK, "metadataEntry.value", "value", value));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ public class OrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
@Test
|
||||
public void testGetOrgMetadataHref() {
|
||||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse);
|
||||
assertEquals(api.getOrgApi().getMetadataApi().get(orgHref), metadata());
|
||||
assertEquals(api.getOrgApi().getMetadataApi(orgHref).get(), metadata());
|
||||
}
|
||||
|
||||
static Metadata metadata() {
|
||||
|
@ -179,7 +179,7 @@ public class OrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
@Test
|
||||
public void testGetOrgMetadataEntryHref() {
|
||||
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadataValue, getMetadataValueResponse);
|
||||
assertEquals(api.getOrgApi().getMetadataApi().getValue(orgHref, "KEY"), metadataValue());
|
||||
assertEquals(api.getOrgApi().getMetadataApi(orgHref).getValue("KEY"), metadataValue());
|
||||
}
|
||||
|
||||
public static Org org() {
|
||||
|
|
|
@ -29,15 +29,12 @@ import static org.testng.Assert.assertEquals;
|
|||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
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.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.org.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
|
||||
import org.testng.annotations.AfterClass;
|
||||
|
@ -70,7 +67,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
public void cleanUp() throws Exception {
|
||||
if (adminMembersSet) {
|
||||
try {
|
||||
Task remove = adminContext.getApi().getOrgApi().getMetadataApi().removeEntry(toAdminUri(orgURI), "KEY");
|
||||
Task remove = adminContext.getApi().getOrgApi().getMetadataApi(orgUrn).removeEntry("KEY");
|
||||
taskDoneEventually(remove);
|
||||
} catch (Exception e) {
|
||||
logger.warn(e, "Error when deleting metadata entry");
|
||||
|
@ -88,8 +85,6 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
*/
|
||||
|
||||
private OrgList orgList;
|
||||
private URI orgURI;
|
||||
private Org org;
|
||||
private boolean adminMembersSet = false; // track if test entities have been addd
|
||||
|
||||
@Test(description = "GET /org")
|
||||
|
@ -114,12 +109,10 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
Reference orgRef = Iterables.getFirst(orgList, null);
|
||||
assertNotNull(orgRef);
|
||||
|
||||
orgURI = orgRef.getHref();
|
||||
|
||||
// Call the method being tested
|
||||
org = orgApi.get(orgURI);
|
||||
org = orgApi.get(orgUrn);
|
||||
|
||||
assertEquals(orgApi.get(org.getId()), org);
|
||||
assertEquals(orgApi.get(orgUrn), org);
|
||||
|
||||
checkOrg(org);
|
||||
|
||||
|
@ -133,12 +126,12 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
* the need for configuration
|
||||
*/
|
||||
private void setupAdminMembers() {
|
||||
adminContext.getApi().getOrgApi().getMetadataApi()
|
||||
.putEntry(toAdminUri(orgURI), "KEY", MetadataValue.builder().value("VALUE").build());
|
||||
adminContext.getApi().getOrgApi().getMetadataApi(orgUrn)
|
||||
.putEntry("KEY", MetadataValue.builder().value("VALUE").build());
|
||||
|
||||
AdminCatalog newCatalog = AdminCatalog.builder().name("Test Catalog " + getTestDateTimeStamp())
|
||||
.description("created by testOrg()").build();
|
||||
newCatalog = adminContext.getApi().getCatalogApi().addCatalogToOrg(newCatalog, org.getId());
|
||||
newCatalog = adminContext.getApi().getCatalogApi().addCatalogToOrg(newCatalog, orgUrn);
|
||||
|
||||
catalogUrn = newCatalog.getId();
|
||||
|
||||
|
@ -149,7 +142,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
public void testGetOrgMetadata() {
|
||||
|
||||
// Call the method being tested
|
||||
Metadata metadata = orgApi.getMetadataApi().get(orgURI);
|
||||
Metadata metadata = orgApi.getMetadataApi(orgUrn).get();
|
||||
|
||||
// NOTE The environment MUST have at one metadata entry for the first organisation configured
|
||||
|
||||
|
@ -163,7 +156,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
@Test(description = "GET /org/{id}/metadata/{key}", dependsOnMethods = { "testGetOrgMetadata" })
|
||||
public void testGetOrgMetadataValue() {
|
||||
// Call the method being tested
|
||||
MetadataValue value = orgApi.getMetadataApi().getValue(orgURI, "KEY");
|
||||
MetadataValue value = orgApi.getMetadataApi(orgUrn).getValue("KEY");
|
||||
|
||||
// NOTE The environment MUST have configured the metadata entry as '{ key="KEY", value="VALUE"
|
||||
// )'
|
||||
|
|
|
@ -52,10 +52,10 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests live behavior of {@link QueryApi}.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
* Tests live behavior of {@link QueryApi}.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "QueryApiLiveTest")
|
||||
public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
||||
|
||||
|
@ -64,44 +64,48 @@ public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
*/
|
||||
|
||||
private QueryApi queryApi;
|
||||
private VAppTemplateApi vAppTemplateApi;
|
||||
private VAppApi vAppApi;
|
||||
|
||||
private VApp vApp;
|
||||
|
||||
@AfterClass(alwaysRun = true)
|
||||
public void cleanUp() throws Exception {
|
||||
if (vApp != null) cleanUpVApp(vApp);
|
||||
if (vApp != null)
|
||||
cleanUpVApp(vApp);
|
||||
}
|
||||
|
||||
@Override
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void setupRequiredApis() {
|
||||
queryApi = context.getApi().getQueryApi();
|
||||
vAppTemplateApi = context.getApi().getVAppTemplateApi();
|
||||
vAppApi = context.getApi().getVAppApi();
|
||||
}
|
||||
|
||||
@Test(description = "GET /query")
|
||||
public void testQuery() {
|
||||
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
|
||||
QueryResultRecords queryResult = queryApi.query("vAppTemplate", String.format("name==%s", vAppTemplate.getName()));
|
||||
VAppTemplate vAppTemplate = lazyGetVAppTemplate();
|
||||
QueryResultRecords queryResult = queryApi
|
||||
.query("vAppTemplate", String.format("name==%s", vAppTemplate.getName()));
|
||||
Set<URI> hrefs = toHrefs(queryResult);
|
||||
|
||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null), QueryResultVAppTemplateRecord.class);
|
||||
assertTrue(hrefs.contains(vAppTemplateURI), "VAppTemplates query result should include vAppTemplate "+vAppTemplateURI+"; but only has "+hrefs);
|
||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null),
|
||||
QueryResultVAppTemplateRecord.class);
|
||||
assertTrue(hrefs.contains(vAppTemplate.getHref()), "VAppTemplates query result should include vAppTemplate "
|
||||
+ vAppTemplate.getHref() + "; but only has " + hrefs);
|
||||
}
|
||||
|
||||
@Test(description = "GET /catalogs/query")
|
||||
public void testQueryAllCatalogs() {
|
||||
QueryResultRecords catalogRecords = queryApi.catalogsQueryAll();
|
||||
assertFalse(catalogRecords.getRecords().isEmpty(), String.format(NOT_EMPTY_OBJECT_FMT, "CatalogRecord", "QueryResultRecords"));
|
||||
assertFalse(catalogRecords.getRecords().isEmpty(),
|
||||
String.format(NOT_EMPTY_OBJECT_FMT, "CatalogRecord", "QueryResultRecords"));
|
||||
}
|
||||
|
||||
@Test(description = "GET /catalogs/query?format=references", dependsOnMethods = { "testQueryAllCatalogs" })
|
||||
public void testQueryAllCatalogReferences() {
|
||||
CatalogReferences catalogReferences = queryApi.catalogReferencesQueryAll();
|
||||
assertFalse(catalogReferences.getReferences().isEmpty(), String.format(NOT_EMPTY_OBJECT_FMT, "CatalogReference", "CatalogReferences"));
|
||||
assertFalse(catalogReferences.getReferences().isEmpty(),
|
||||
String.format(NOT_EMPTY_OBJECT_FMT, "CatalogReference", "CatalogReferences"));
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplates/query")
|
||||
|
@ -109,18 +113,22 @@ public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
QueryResultRecords queryResult = queryApi.vAppTemplatesQueryAll();
|
||||
Set<URI> hrefs = toHrefs(queryResult);
|
||||
|
||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null), QueryResultVAppTemplateRecord.class);
|
||||
assertTrue(hrefs.contains(vAppTemplateURI), "VAppTemplates query result should include vAppTemplate "+vAppTemplateURI+"; but only has "+hrefs);
|
||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null),
|
||||
QueryResultVAppTemplateRecord.class);
|
||||
assertTrue(hrefs.contains(lazyGetVAppTemplate().getHref()), "VAppTemplates query result should include vAppTemplate "
|
||||
+ lazyGetVAppTemplate().getHref() + "; but only has " + hrefs);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplates/query?filter")
|
||||
public void testQueryVAppTemplatesWithFilter() {
|
||||
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
|
||||
VAppTemplate vAppTemplate = lazyGetVAppTemplate();
|
||||
QueryResultRecords queryResult = queryApi.vAppTemplatesQuery(String.format("name==%s", vAppTemplate.getName()));
|
||||
Set<URI> hrefs = toHrefs(queryResult);
|
||||
|
||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null), QueryResultVAppTemplateRecord.class);
|
||||
assertTrue(hrefs.contains(vAppTemplateURI), "VAppTemplates query result should have found vAppTemplate "+vAppTemplateURI);
|
||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null),
|
||||
QueryResultVAppTemplateRecord.class);
|
||||
assertTrue(hrefs.contains(vAppTemplate.getHref()), "VAppTemplates query result should have found vAppTemplate "
|
||||
+ vAppTemplate.getHref());
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApps/query")
|
||||
|
@ -131,19 +139,21 @@ public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
Set<URI> hrefs = toHrefs(queryResult);
|
||||
|
||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP, null), QueryResultVAppRecord.class);
|
||||
assertTrue(hrefs.contains(vApp.getHref()), "VApp query result should include vapp "+vApp.getHref()+"; but only has "+hrefs);
|
||||
assertTrue(hrefs.contains(vApp.getHref()), "VApp query result should include vapp " + vApp.getHref()
|
||||
+ "; but only has " + hrefs);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApps/query?filter", dependsOnMethods = { "testQueryAllVApps" } )
|
||||
@Test(description = "GET /vApps/query?filter", dependsOnMethods = { "testQueryAllVApps" })
|
||||
public void testQueryVAppsWithFilter() {
|
||||
QueryResultRecords queryResult = queryApi.vAppsQuery(String.format("name==%s", vApp.getName()));
|
||||
Set<URI> hrefs = toHrefs(queryResult);
|
||||
|
||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP, null), QueryResultVAppRecord.class);
|
||||
assertEquals(hrefs, Collections.singleton(vApp.getHref()), "VApps query result should have found vApp "+vApp.getHref());
|
||||
assertEquals(hrefs, Collections.singleton(vApp.getHref()),
|
||||
"VApps query result should have found vApp " + vApp.getHref());
|
||||
}
|
||||
|
||||
@Test(description = "GET /vms/query", dependsOnMethods = { "testQueryAllVApps" } )
|
||||
@Test(description = "GET /vms/query", dependsOnMethods = { "testQueryAllVApps" })
|
||||
public void testQueryAllVms() {
|
||||
// Wait for vApp to have been entirely instantiated
|
||||
Task instantiateTask = Iterables.getFirst(vApp.getTasks(), null);
|
||||
|
@ -152,10 +162,10 @@ public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
}
|
||||
|
||||
// Start the vApp so that it has VMs
|
||||
Task task = vAppApi.powerOn(vApp.getHref());
|
||||
Task task = vAppApi.powerOn(vApp.getId());
|
||||
assertTaskSucceedsLong(task);
|
||||
|
||||
vApp = vAppApi.getVApp(vApp.getHref()); // reload, so it has the VMs
|
||||
vApp = vAppApi.get(vApp.getId()); // reload, so it has the VMs
|
||||
List<Vm> vms = vApp.getChildren().getVms();
|
||||
Set<URI> vmHrefs = toHrefs(vms);
|
||||
|
||||
|
@ -164,10 +174,11 @@ public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
Set<URI> hrefs = toHrefs(queryResult);
|
||||
|
||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VM, null), QueryResultVMRecord.class);
|
||||
assertTrue(hrefs.containsAll(vmHrefs), "VMs query result should include vms "+vmHrefs+"; but only has "+hrefs);
|
||||
assertTrue(hrefs.containsAll(vmHrefs), "VMs query result should include vms " + vmHrefs + "; but only has "
|
||||
+ hrefs);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vms/query?filter", dependsOnMethods = { "testQueryAllVms" } )
|
||||
@Test(description = "GET /vms/query?filter", dependsOnMethods = { "testQueryAllVms" })
|
||||
public void testQueryAllVmsWithFilter() {
|
||||
List<Vm> vms = vApp.getChildren().getVms();
|
||||
Set<URI> vmHrefs = toHrefs(vms);
|
||||
|
@ -176,7 +187,8 @@ public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
Set<URI> hrefs = toHrefs(queryResult);
|
||||
|
||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VM, null), QueryResultVMRecord.class);
|
||||
assertEquals(hrefs, vmHrefs, "VMs query result should equal vms of vApp "+vApp.getName()+" ("+vmHrefs+"); but only has "+hrefs);
|
||||
assertEquals(hrefs, vmHrefs, "VMs query result should equal vms of vApp " + vApp.getName() + " (" + vmHrefs
|
||||
+ "); but only has " + hrefs);
|
||||
}
|
||||
|
||||
@Test(description = "GET /mediaList/query")
|
||||
|
@ -194,10 +206,13 @@ public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP, null), QueryResultMediaRecord.class);
|
||||
}
|
||||
|
||||
private static void assertRecordTypes(QueryResultRecords queryResult, Collection<String> validTypes, Class<?> validClazz) {
|
||||
private static void assertRecordTypes(QueryResultRecords queryResult, Collection<String> validTypes,
|
||||
Class<?> validClazz) {
|
||||
for (QueryResultRecordType record : queryResult.getRecords()) {
|
||||
assertTrue(validTypes.contains(record.getType()), "invalid type for query result record, "+record.getType()+"; valid types are "+validTypes);
|
||||
assertEquals(record.getClass(), validClazz, "invalid type for query result record, "+record.getClass()+"; expected "+validClazz);
|
||||
assertTrue(validTypes.contains(record.getType()), "invalid type for query result record, " + record.getType()
|
||||
+ "; valid types are " + validTypes);
|
||||
assertEquals(record.getClass(), validClazz, "invalid type for query result record, " + record.getClass()
|
||||
+ "; expected " + validClazz);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
|
||||
VApp expected = getVApp();
|
||||
|
||||
assertEquals(api.getVAppApi().getVApp(vAppURI), expected);
|
||||
assertEquals(api.getVAppApi().get(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -103,7 +103,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
|
||||
Task expected = editVAppTask();
|
||||
|
||||
assertEquals(api.getVAppApi().editVApp(vAppURI, modified), expected);
|
||||
assertEquals(api.getVAppApi().edit(vAppURI, modified), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -119,7 +119,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
|
||||
Task expected = removeVAppTask();
|
||||
|
||||
assertEquals(api.getVAppApi().removeVApp(vAppURI), expected);
|
||||
assertEquals(api.getVAppApi().remove(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -349,12 +349,12 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getControlAccess.xml", VCloudDirectorMediaType.VAPP)
|
||||
.xmlFilePayload("/vApp/getAccessControl.xml", VCloudDirectorMediaType.VAPP)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
ControlAccessParams expected = getControlAccessParams();
|
||||
ControlAccessParams expected = getAccessControlParams();
|
||||
|
||||
assertEquals(api.getVAppApi().getControlAccess(vAppURI), expected);
|
||||
assertEquals(api.getVAppApi().getAccessControl(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -690,7 +690,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
return task;
|
||||
}
|
||||
|
||||
public static ControlAccessParams getControlAccessParams() {
|
||||
public static ControlAccessParams getAccessControlParams() {
|
||||
ControlAccessParams params = ControlAccessParams.builder()
|
||||
.build();
|
||||
|
||||
|
|
|
@ -183,12 +183,12 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see VAppApi#getVApp(URI)
|
||||
* @see VAppApi#get(URI)
|
||||
*/
|
||||
@Test(description = "GET /vApp/{id}")
|
||||
public void testGetVApp() {
|
||||
// The method under test
|
||||
vApp = vAppApi.getVApp(vAppURI);
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkVApp(vApp);
|
||||
|
@ -205,7 +205,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
// TODO source.href vAppTemplateURI
|
||||
|
||||
// Check status
|
||||
assertVAppStatus(vAppURI, Status.POWERED_OFF);
|
||||
assertVAppStatus(vAppUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/recomposeVApp")
|
||||
|
@ -220,22 +220,22 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
RecomposeVAppParams params = addRecomposeParams(composedVApp, toAddVm);
|
||||
|
||||
// The method under test
|
||||
Task recomposeVApp = vAppApi.recompose(composedVApp.getHref(), params);
|
||||
Task recomposeVApp = vAppApi.recompose(composedVApp.getId(), params);
|
||||
assertTaskSucceedsLong(recomposeVApp);
|
||||
|
||||
// add another vm instance to vApp
|
||||
params = addRecomposeParams(composedVApp, toAddVm);
|
||||
recomposeVApp = vAppApi.recompose(composedVApp.getHref(), params);
|
||||
recomposeVApp = vAppApi.recompose(composedVApp.getId(), params);
|
||||
assertTaskSucceedsLong(recomposeVApp);
|
||||
|
||||
// remove a vm
|
||||
VApp configured = vAppApi.getVApp(composedVApp.getHref());
|
||||
VApp configured = vAppApi.get(composedVApp.getId());
|
||||
List<Vm> vmsToBeDeleted = configured.getChildren().getVms();
|
||||
Vm toBeDeleted = Iterables.get(vmsToBeDeleted, 0);
|
||||
Task removeVm = vmApi.remove(toBeDeleted.getHref());
|
||||
Task removeVm = vmApi.remove(toBeDeleted.getId());
|
||||
assertTaskSucceedsLong(removeVm);
|
||||
|
||||
Task removeVApp = vAppApi.removeVApp(composedVApp.getHref());
|
||||
Task removeVApp = vAppApi.remove(composedVApp.getId());
|
||||
assertTaskSucceedsLong(removeVApp);
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
Set<Vm> vms = Sets.newLinkedHashSet();
|
||||
QueryResultRecords templatesRecords = queryApi.vAppTemplatesQueryAll();
|
||||
for (QueryResultRecordType templateRecord : templatesRecords.getRecords()) {
|
||||
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(templateRecord.getHref());
|
||||
VAppTemplate vAppTemplate = vAppTemplateApi.get(templateRecord.getId());
|
||||
vms.addAll(vAppTemplate.getChildren());
|
||||
}
|
||||
return ImmutableSet.copyOf(Iterables.filter(vms, new Predicate<Vm>() {
|
||||
|
@ -251,7 +251,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
// or both.
|
||||
@Override
|
||||
public boolean apply(Vm input) {
|
||||
GuestCustomizationSection guestCustomizationSection = vmApi.getGuestCustomizationSection(input.getHref());
|
||||
GuestCustomizationSection guestCustomizationSection = vmApi.getGuestCustomizationSection(input.getId());
|
||||
String computerName = guestCustomizationSection.getComputerName();
|
||||
String retainComputerName = CharMatcher.inRange('0', '9').or(CharMatcher.inRange('a', 'z'))
|
||||
.or(CharMatcher.inRange('A', 'Z')).or(CharMatcher.is('-')).retainFrom(computerName);
|
||||
|
@ -261,7 +261,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see VAppApi#editVApp(URI, VApp)
|
||||
* @see VAppApi#edit(URI, VApp)
|
||||
*/
|
||||
@Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVApp" })
|
||||
public void testEditVApp() {
|
||||
|
@ -269,11 +269,11 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
vAppNames.add(newVApp.getName());
|
||||
|
||||
// The method under test
|
||||
Task editVApp = vAppApi.editVApp(vApp.getHref(), newVApp);
|
||||
Task editVApp = vAppApi.edit(vAppUrn, newVApp);
|
||||
assertTrue(retryTaskSuccess.apply(editVApp), String.format(TASK_COMPLETE_TIMELY, "editVApp"));
|
||||
|
||||
// Get the edited VApp
|
||||
vApp = vAppApi.getVApp(vApp.getHref());
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Check the required fields are set
|
||||
assertEquals(vApp.getName(), newVApp.getName(),
|
||||
|
@ -289,139 +289,139 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.notPowerOn().build();
|
||||
|
||||
// The method under test
|
||||
Task deployVApp = vAppApi.deploy(vApp.getHref(), params);
|
||||
Task deployVApp = vAppApi.deploy(vAppUrn, params);
|
||||
assertTrue(retryTaskSuccessLong.apply(deployVApp), String.format(TASK_COMPLETE_TIMELY, "deployVApp"));
|
||||
|
||||
// Get the edited VApp
|
||||
vApp = vAppApi.getVApp(vApp.getHref());
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Check the required fields are set
|
||||
assertTrue(vApp.isDeployed(), String.format(OBJ_FIELD_EQ, VAPP, "deployed", "TRUE", vApp.isDeployed().toString()));
|
||||
|
||||
// Check status
|
||||
assertVAppStatus(vAppURI, Status.POWERED_OFF);
|
||||
assertVAppStatus(vAppUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/powerOn", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testPowerOnVApp() {
|
||||
// Power off VApp
|
||||
vApp = powerOffVApp(vApp.getHref());
|
||||
vApp = powerOffVApp(vAppUrn);
|
||||
|
||||
// The method under test
|
||||
Task powerOnVApp = vAppApi.powerOn(vApp.getHref());
|
||||
Task powerOnVApp = vAppApi.powerOn(vAppUrn);
|
||||
assertTaskSucceedsLong(powerOnVApp);
|
||||
|
||||
// Get the edited VApp
|
||||
vApp = vAppApi.getVApp(vApp.getHref());
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Check status
|
||||
assertVAppStatus(vAppURI, Status.POWERED_ON);
|
||||
assertVAppStatus(vAppUrn, Status.POWERED_ON);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/reboot", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testReboot() {
|
||||
// Power on VApp
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
vApp = powerOnVApp(vAppUrn);
|
||||
|
||||
// The method under test
|
||||
Task reboot = vAppApi.reboot(vApp.getHref());
|
||||
Task reboot = vAppApi.reboot(vAppUrn);
|
||||
assertTaskSucceedsLong(reboot);
|
||||
|
||||
// Get the edited VApp
|
||||
vApp = vAppApi.getVApp(vApp.getHref());
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Check status
|
||||
assertVAppStatus(vAppURI, Status.POWERED_OFF);
|
||||
assertVAppStatus(vAppUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/shutdown", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testShutdown() {
|
||||
// Power on VApp
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
vApp = powerOnVApp(vAppUrn);
|
||||
|
||||
// The method under test
|
||||
Task shutdown = vAppApi.shutdown(vApp.getHref());
|
||||
Task shutdown = vAppApi.shutdown(vAppUrn);
|
||||
assertTaskSucceedsLong(shutdown);
|
||||
|
||||
// Get the edited VApp
|
||||
vApp = vAppApi.getVApp(vApp.getHref());
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Check status
|
||||
assertVAppStatus(vApp.getHref(), Status.POWERED_OFF);
|
||||
assertVAppStatus(vAppUrn, Status.POWERED_OFF);
|
||||
|
||||
// Power on the VApp again
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
vApp = powerOnVApp(vAppUrn);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/suspend", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testSuspend() {
|
||||
// Power on VApp
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
vApp = powerOnVApp(vAppUrn);
|
||||
|
||||
// The method under test
|
||||
Task suspend = vAppApi.suspend(vAppURI);
|
||||
Task suspend = vAppApi.suspend(vAppUrn);
|
||||
assertTaskSucceedsLong(suspend);
|
||||
|
||||
// Get the edited VApp
|
||||
vApp = vAppApi.getVApp(vApp.getHref());
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Check status
|
||||
assertVAppStatus(vAppURI, Status.SUSPENDED);
|
||||
assertVAppStatus(vAppUrn, Status.SUSPENDED);
|
||||
|
||||
// Power on the VApp again
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
vApp = powerOnVApp(vAppUrn);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/reset", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testReset() {
|
||||
// Power on VApp
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
vApp = powerOnVApp(vAppUrn);
|
||||
|
||||
// The method under test
|
||||
Task reset = vAppApi.reset(vAppURI);
|
||||
Task reset = vAppApi.reset(vAppUrn);
|
||||
assertTaskSucceedsLong(reset);
|
||||
|
||||
// Get the edited VApp
|
||||
vApp = vAppApi.getVApp(vAppURI);
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Check status
|
||||
assertVAppStatus(vAppURI, Status.POWERED_ON);
|
||||
assertVAppStatus(vAppUrn, Status.POWERED_ON);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/undeploy", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testUndeployVApp() {
|
||||
// Power on VApp
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
vApp = powerOnVApp(vAppUrn);
|
||||
|
||||
UndeployVAppParams params = UndeployVAppParams.builder().build();
|
||||
|
||||
// The method under test
|
||||
Task undeploy = vAppApi.undeploy(vApp.getHref(), params);
|
||||
Task undeploy = vAppApi.undeploy(vAppUrn, params);
|
||||
assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
|
||||
|
||||
// Get the edited VApp
|
||||
vApp = vAppApi.getVApp(vAppURI);
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Check status
|
||||
assertFalse(vApp.isDeployed(),
|
||||
String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString()));
|
||||
assertVAppStatus(vAppURI, Status.POWERED_OFF);
|
||||
assertVAppStatus(vAppUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/powerOff", dependsOnMethods = { "testUndeployVApp" })
|
||||
public void testPowerOffVApp() {
|
||||
// Power on VApp
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
vApp = powerOnVApp(vAppUrn);
|
||||
|
||||
// The method under test
|
||||
Task powerOffVApp = vAppApi.powerOff(vApp.getHref());
|
||||
Task powerOffVApp = vAppApi.powerOff(vAppUrn);
|
||||
assertTrue(retryTaskSuccess.apply(powerOffVApp), String.format(TASK_COMPLETE_TIMELY, "powerOffVApp"));
|
||||
|
||||
// Get the edited VApp
|
||||
vApp = vAppApi.getVApp(vAppURI);
|
||||
vApp = vAppApi.get(vAppUrn);
|
||||
|
||||
// Check status
|
||||
assertVAppStatus(vAppURI, Status.POWERED_OFF);
|
||||
assertVAppStatus(vAppUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/controlAccess", dependsOnMethods = { "testGetVApp" })
|
||||
|
@ -435,7 +435,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.accessLevel("ReadOnly").build()).build();
|
||||
|
||||
// The method under test
|
||||
ControlAccessParams modified = vAppApi.editControlAccess(vApp.getHref(), params);
|
||||
ControlAccessParams modified = vAppApi.editControlAccess(vAppUrn, params);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkControlAccessParams(modified);
|
||||
|
@ -450,7 +450,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.build();
|
||||
|
||||
// The method under test
|
||||
ControlAccessParams modified = vAppApi.editControlAccess(vApp.getHref(), params);
|
||||
ControlAccessParams modified = vAppApi.editControlAccess(vAppUrn, params);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkControlAccessParams(modified);
|
||||
|
@ -462,11 +462,11 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "POST /vApp/{id}/action/discardSuspendedState", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testDiscardSuspendedState() {
|
||||
// Power on, then suspend the VApp
|
||||
vApp = powerOnVApp(vAppURI);
|
||||
vApp = suspendVApp(vAppURI);
|
||||
vApp = powerOnVApp(vAppUrn);
|
||||
vApp = suspendVApp(vAppUrn);
|
||||
|
||||
// The method under test
|
||||
Task discardSuspendedState = vAppApi.discardSuspendedState(vApp.getHref());
|
||||
Task discardSuspendedState = vAppApi.discardSuspendedState(vAppUrn);
|
||||
assertTrue(retryTaskSuccess.apply(discardSuspendedState),
|
||||
String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
|
||||
}
|
||||
|
@ -479,19 +479,19 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
DeployVAppParams params = DeployVAppParams.builder()
|
||||
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
|
||||
.notPowerOn().build();
|
||||
Task deployVApp = vAppApi.deploy(temp.getHref(), params);
|
||||
Task deployVApp = vAppApi.deploy(temp.getId(), params);
|
||||
assertTaskSucceedsLong(deployVApp);
|
||||
|
||||
try {
|
||||
// Method under test
|
||||
vAppApi.enterMaintenanceMode(temp.getHref());
|
||||
vAppApi.enterMaintenanceMode(temp.getId());
|
||||
|
||||
temp = vAppApi.getVApp(temp.getHref());
|
||||
temp = vAppApi.get(temp.getId());
|
||||
assertTrue(temp.isInMaintenanceMode(),
|
||||
String.format(CONDITION_FMT, "InMaintenanceMode", "TRUE", temp.isInMaintenanceMode()));
|
||||
|
||||
// Exit maintenance mode
|
||||
vAppApi.exitMaintenanceMode(temp.getHref());
|
||||
vAppApi.exitMaintenanceMode(temp.getId());
|
||||
} finally {
|
||||
cleanUpVApp(temp);
|
||||
}
|
||||
|
@ -504,17 +504,17 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
DeployVAppParams params = DeployVAppParams.builder()
|
||||
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
|
||||
.notPowerOn().build();
|
||||
Task deployVApp = vAppApi.deploy(temp.getHref(), params);
|
||||
Task deployVApp = vAppApi.deploy(temp.getId(), params);
|
||||
assertTaskSucceedsLong(deployVApp);
|
||||
|
||||
try {
|
||||
// Enter maintenance mode
|
||||
vAppApi.enterMaintenanceMode(temp.getHref());
|
||||
vAppApi.enterMaintenanceMode(temp.getId());
|
||||
|
||||
// Method under test
|
||||
vAppApi.exitMaintenanceMode(temp.getHref());
|
||||
vAppApi.exitMaintenanceMode(temp.getId());
|
||||
|
||||
temp = vAppApi.getVApp(temp.getHref());
|
||||
temp = vAppApi.get(temp.getId());
|
||||
assertFalse(temp.isInMaintenanceMode(),
|
||||
String.format(CONDITION_FMT, "InMaintenanceMode", "FALSE", temp.isInMaintenanceMode()));
|
||||
} finally {
|
||||
|
@ -525,7 +525,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/controlAccess", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetControlAccess() {
|
||||
// The method under test
|
||||
ControlAccessParams controlAccess = vAppApi.getControlAccess(vApp.getHref());
|
||||
ControlAccessParams controlAccess = vAppApi.getAccessControl(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkControlAccessParams(controlAccess);
|
||||
|
@ -534,7 +534,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetLeaseSettingsSection() {
|
||||
// The method under test
|
||||
LeaseSettingsSection section = vAppApi.getLeaseSettingsSection(vApp.getHref());
|
||||
LeaseSettingsSection section = vAppApi.getLeaseSettingsSection(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkLeaseSettingsSection(section);
|
||||
|
@ -543,17 +543,17 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "PUT /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetLeaseSettingsSection" })
|
||||
public void testEditLeaseSettingsSection() {
|
||||
// Copy existing section
|
||||
LeaseSettingsSection oldSection = vAppApi.getLeaseSettingsSection(vApp.getHref());
|
||||
LeaseSettingsSection oldSection = vAppApi.getLeaseSettingsSection(vAppUrn);
|
||||
Integer twoHours = (int) TimeUnit.SECONDS.convert(2L, TimeUnit.HOURS);
|
||||
LeaseSettingsSection newSection = oldSection.toBuilder().deploymentLeaseInSeconds(twoHours).build();
|
||||
|
||||
// The method under test
|
||||
Task editLeaseSettingsSection = vAppApi.editLeaseSettingsSection(vApp.getHref(), newSection);
|
||||
Task editLeaseSettingsSection = vAppApi.editLeaseSettingsSection(vAppUrn, newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editLeaseSettingsSection),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editLeaseSettingsSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
LeaseSettingsSection modified = vAppApi.getLeaseSettingsSection(vApp.getHref());
|
||||
LeaseSettingsSection modified = vAppApi.getLeaseSettingsSection(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkLeaseSettingsSection(modified);
|
||||
|
@ -588,7 +588,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/networkConfigSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetNetworkConfigSection() {
|
||||
// The method under test
|
||||
NetworkConfigSection section = vAppApi.getNetworkConfigSection(vApp.getHref());
|
||||
NetworkConfigSection section = vAppApi.getNetworkConfigSection(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkNetworkConfigSection(section);
|
||||
|
@ -597,17 +597,17 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "PUT /vApp/{id}/networkConfigSection", dependsOnMethods = { "testGetNetworkConfigSection" })
|
||||
public void testEditNetworkConfigSection() {
|
||||
// Copy existing section and edit fields
|
||||
NetworkConfigSection oldSection = vAppApi.getNetworkConfigSection(vApp.getHref());
|
||||
NetworkConfigSection oldSection = vAppApi.getNetworkConfigSection(vAppUrn);
|
||||
VAppNetworkConfiguration networkConfig = VAppNetworkConfiguration.builder().build();
|
||||
NetworkConfigSection newSection = oldSection.toBuilder().networkConfigs(ImmutableSet.of(networkConfig)).build();
|
||||
|
||||
// The method under test
|
||||
Task editNetworkConfigSection = vAppApi.editNetworkConfigSection(vApp.getHref(), newSection);
|
||||
Task editNetworkConfigSection = vAppApi.editNetworkConfigSection(vAppUrn, newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editNetworkConfigSection),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editNetworkConfigSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vApp.getHref());
|
||||
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkNetworkConfigSection(modified);
|
||||
|
@ -622,7 +622,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/networkSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetNetworkSection() {
|
||||
// The method under test
|
||||
NetworkSection section = vAppApi.getNetworkSection(vApp.getHref());
|
||||
NetworkSection section = vAppApi.getNetworkSection(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkNetworkSection(section);
|
||||
|
@ -631,7 +631,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/owner", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetOwner() {
|
||||
// The method under test
|
||||
Owner owner = vAppApi.getOwner(vApp.getHref());
|
||||
Owner owner = vAppApi.getOwner(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkOwner(owner);
|
||||
|
@ -642,10 +642,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
Owner newOwner = Owner.builder().user(Reference.builder().href(user.getHref()).type(ADMIN_USER).build()).build();
|
||||
|
||||
// The method under test
|
||||
vAppApi.editOwner(vApp.getHref(), newOwner);
|
||||
vAppApi.editOwner(vAppUrn, newOwner);
|
||||
|
||||
// Get the new VApp owner
|
||||
Owner modified = vAppApi.getOwner(vApp.getHref());
|
||||
Owner modified = vAppApi.getOwner(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkOwner(modified);
|
||||
|
@ -657,7 +657,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/productSections", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetProductSections() {
|
||||
// The method under test
|
||||
ProductSectionList sectionList = vAppApi.getProductSections(vApp.getHref());
|
||||
ProductSectionList sectionList = vAppApi.getProductSections(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkProductSectionList(sectionList);
|
||||
|
@ -666,7 +666,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
|
||||
public void testEditProductSections() {
|
||||
// Copy existing section and edit fields
|
||||
ProductSectionList oldSections = vAppApi.getProductSections(vApp.getHref());
|
||||
ProductSectionList oldSections = vAppApi.getProductSections(vAppUrn);
|
||||
ProductSectionList newSections = oldSections
|
||||
.toBuilder()
|
||||
.productSection(
|
||||
|
@ -678,12 +678,12 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.build()).build();
|
||||
|
||||
// The method under test
|
||||
Task editProductSections = vAppApi.editProductSections(vApp.getHref(), newSections);
|
||||
Task editProductSections = vAppApi.editProductSections(vAppUrn, newSections);
|
||||
assertTrue(retryTaskSuccess.apply(editProductSections),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editProductSections"));
|
||||
|
||||
// Retrieve the modified section
|
||||
ProductSectionList modified = vAppApi.getProductSections(vApp.getHref());
|
||||
ProductSectionList modified = vAppApi.getProductSections(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkProductSectionList(modified);
|
||||
|
@ -698,7 +698,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/startupSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetStartupSection() {
|
||||
// The method under test
|
||||
StartupSection section = vAppApi.getStartupSection(vApp.getHref());
|
||||
StartupSection section = vAppApi.getStartupSection(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkStartupSection(section);
|
||||
|
@ -707,15 +707,15 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "PUT /vApp/{id}/startupSection", dependsOnMethods = { "testGetStartupSection" })
|
||||
public void testEditStartupSection() {
|
||||
// Copy existing section and edit fields
|
||||
StartupSection oldSection = vAppApi.getStartupSection(vApp.getHref());
|
||||
StartupSection oldSection = vAppApi.getStartupSection(vAppUrn);
|
||||
StartupSection newSection = oldSection.toBuilder().build();
|
||||
|
||||
// The method under test
|
||||
Task editStartupSection = vAppApi.editStartupSection(vApp.getHref(), newSection);
|
||||
Task editStartupSection = vAppApi.editStartupSection(vAppUrn, newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editStartupSection), String.format(TASK_COMPLETE_TIMELY, "editStartupSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
StartupSection modified = vAppApi.getStartupSection(vApp.getHref());
|
||||
StartupSection modified = vAppApi.getStartupSection(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkStartupSection(modified);
|
||||
|
@ -730,10 +730,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
key = name("key-");
|
||||
String value = name("value-");
|
||||
metadataValue = MetadataValue.builder().value(value).build();
|
||||
vAppApi.getMetadataApi().putEntry(vApp.getHref(), key, metadataValue);
|
||||
vAppApi.getMetadataApi(vAppUrn).putEntry(key, metadataValue);
|
||||
|
||||
// Retrieve the value, and assert it was set correctly
|
||||
MetadataValue newMetadataValue = vAppApi.getMetadataApi().getValue(vApp.getHref(), key);
|
||||
MetadataValue newMetadataValue = vAppApi.getMetadataApi(vAppUrn).getValue(key);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkMetadataValueFor(VAPP, newMetadataValue, value);
|
||||
|
@ -744,10 +744,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
key = name("key-");
|
||||
String value = name("value-");
|
||||
metadataValue = MetadataValue.builder().value(value).build();
|
||||
vAppApi.getMetadataApi().putEntry(vApp.getHref(), key, metadataValue);
|
||||
vAppApi.getMetadataApi(vAppUrn).putEntry(key, metadataValue);
|
||||
|
||||
// Call the method being tested
|
||||
Metadata metadata = vAppApi.getMetadataApi().get(vApp.getHref());
|
||||
Metadata metadata = vAppApi.getMetadataApi(vAppUrn).get();
|
||||
|
||||
checkMetadata(metadata);
|
||||
|
||||
|
@ -759,7 +759,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
|
||||
public void testGetOrgMetadataValue() {
|
||||
// Call the method being tested
|
||||
MetadataValue value = vAppApi.getMetadataApi().getValue(vApp.getHref(), key);
|
||||
MetadataValue value = vAppApi.getMetadataApi(vAppUrn).getValue(key);
|
||||
|
||||
String expected = metadataValue.getValue();
|
||||
|
||||
|
@ -771,11 +771,11 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
|
||||
public void testRemoveMetadataEntry() {
|
||||
// Delete the entry
|
||||
Task task = vAppApi.getMetadataApi().removeEntry(vApp.getHref(), key);
|
||||
Task task = vAppApi.getMetadataApi(vAppUrn).removeEntry(key);
|
||||
retryTaskSuccess.apply(task);
|
||||
|
||||
// Confirm the entry has been removed
|
||||
Metadata newMetadata = vAppApi.getMetadataApi().get(vApp.getHref());
|
||||
Metadata newMetadata = vAppApi.getMetadataApi(vAppUrn).get();
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkMetadataKeyAbsentFor(VAPP, newMetadata, key);
|
||||
|
@ -783,18 +783,18 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
@Test(description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
|
||||
public void testMergeMetadata() {
|
||||
Metadata oldMetadata = vAppApi.getMetadataApi().get(vApp.getHref());
|
||||
Metadata oldMetadata = vAppApi.getMetadataApi(vAppUrn).get();
|
||||
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
|
||||
|
||||
// Store a value, to be removed
|
||||
String key = name("key-");
|
||||
String value = name("value-");
|
||||
Metadata addedMetadata = Metadata.builder().entry(MetadataEntry.builder().key(key).value(value).build()).build();
|
||||
Task task = vAppApi.getMetadataApi().merge(vApp.getHref(), addedMetadata);
|
||||
Task task = vAppApi.getMetadataApi(vAppUrn).merge(addedMetadata);
|
||||
retryTaskSuccess.apply(task);
|
||||
|
||||
// Confirm the entry contains everything that was there, and everything that was being added
|
||||
Metadata newMetadata = vAppApi.getMetadataApi().get(vApp.getHref());
|
||||
Metadata newMetadata = vAppApi.getMetadataApi(vAppUrn).get();
|
||||
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
|
||||
.put(key, value).build();
|
||||
|
||||
|
@ -803,7 +803,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see VAppApi#removeVApp(URI)
|
||||
* @see VAppApi#remove(URI)
|
||||
*/
|
||||
@Test(description = "DELETE /vApp/{id}")
|
||||
public void testRemoveVApp() {
|
||||
|
@ -811,10 +811,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
VApp temp = instantiateVApp();
|
||||
|
||||
// The method under test
|
||||
Task removeVApp = vAppApi.removeVApp(temp.getHref());
|
||||
Task removeVApp = vAppApi.remove(temp.getId());
|
||||
assertTrue(retryTaskSuccess.apply(removeVApp), String.format(TASK_COMPLETE_TIMELY, "removeVApp"));
|
||||
|
||||
VApp removed = vAppApi.getVApp(temp.getHref());
|
||||
VApp removed = vAppApi.get(temp.getId());
|
||||
assertNull(removed, "The VApp " + temp.getName() + " should have been removed");
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.T
|
|||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkConfigSection;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -79,7 +78,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
|
|||
protected void tidyUp() {
|
||||
if (key != null) {
|
||||
try {
|
||||
Task remove = vAppTemplateApi.getMetadataApi().removeEntry(vAppTemplateURI, key);
|
||||
Task remove = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).removeEntry(key);
|
||||
taskDoneEventually(remove);
|
||||
} catch (Exception e) {
|
||||
logger.warn(e, "Error when deleting metadata entry '%s'", key);
|
||||
|
@ -101,10 +100,10 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "Create a vApp Network based on an org network with `default` firewall rules applied")
|
||||
public void testAddVAppNetworkWithDefaultSecurityGroup() {
|
||||
ImmutableList<String> securityGroups = ImmutableList.of(DEFAULT_SECURITY_GROUP);
|
||||
addVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppURI);
|
||||
addVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppUrn);
|
||||
|
||||
// Retrieve the modified section
|
||||
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppURI);
|
||||
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkNetworkConfigSection(modified);
|
||||
|
@ -120,10 +119,10 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "Create a vApp Network based on an org network with `http` firewall rules applied")
|
||||
public void testAddVAppNetworkWithHttpSecurityGroup() {
|
||||
ImmutableList<String> securityGroups = ImmutableList.of(HTTP_SECURITY_GROUP);
|
||||
addVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppURI);
|
||||
addVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppUrn);
|
||||
|
||||
// Retrieve the modified section
|
||||
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppURI);
|
||||
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkNetworkConfigSection(modified);
|
||||
|
@ -139,10 +138,10 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "Create a vApp Network based on an org network with both `defautl` and `http` firewall rules applied")
|
||||
public void testAddVAppNetworkWithDefaultAndHttpSecurityGroup() {
|
||||
ImmutableList<String> securityGroups = ImmutableList.of(DEFAULT_SECURITY_GROUP, HTTP_SECURITY_GROUP);
|
||||
addVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppURI);
|
||||
addVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppUrn);
|
||||
|
||||
// Retrieve the modified section
|
||||
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppURI);
|
||||
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkNetworkConfigSection(modified);
|
||||
|
@ -155,11 +154,11 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
|
|||
*/
|
||||
}
|
||||
|
||||
private void addVAppNetworkWithSecurityGroupOnVApp(ImmutableList<String> securityGroups, URI vAppURI) {
|
||||
private void addVAppNetworkWithSecurityGroupOnVApp(ImmutableList<String> securityGroups, String vAppUrn) {
|
||||
String newVAppNetworkName = generateVAppNetworkName(network.getName(), securityGroups);
|
||||
// Create a vAppNetwork with firewall rules
|
||||
NetworkConfigSection newSection = generateNetworkConfigSection(securityGroups, newVAppNetworkName);
|
||||
Task editNetworkConfigSection = vAppApi.editNetworkConfigSection(vAppURI, newSection);
|
||||
Task editNetworkConfigSection = vAppApi.editNetworkConfigSection(vAppUrn, newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editNetworkConfigSection), String.format(TASK_COMPLETE_TIMELY, "editNetworkConfigSection"));
|
||||
attachVmToVAppNetwork(vm, newVAppNetworkName);
|
||||
}
|
||||
|
@ -191,7 +190,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
|
|||
}
|
||||
|
||||
private void attachVmToVAppNetwork(Vm vm, String vAppNetworkName) {
|
||||
Set<NetworkConnection> networkConnections = vmApi.getNetworkConnectionSection(vm.getHref())
|
||||
Set<NetworkConnection> networkConnections = vmApi.getNetworkConnectionSection(vm.getId())
|
||||
.getNetworkConnections();
|
||||
|
||||
NetworkConnectionSection section = NetworkConnectionSection.builder()
|
||||
|
@ -209,7 +208,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
section = section.toBuilder().networkConnection(newNetworkConnection).build();
|
||||
}
|
||||
Task configureNetwork = vmApi.editNetworkConnectionSection(vm.getHref(), section);
|
||||
Task configureNetwork = vmApi.editNetworkConnectionSection(vm.getId(), section);
|
||||
assertTaskSucceedsLong(configureNetwork);
|
||||
}
|
||||
|
||||
|
@ -333,7 +332,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
private void disconnectVmFromVAppNetwork(Vm vm) {
|
||||
|
||||
Set<NetworkConnection> networkConnections = vmApi.getNetworkConnectionSection(vm.getHref())
|
||||
Set<NetworkConnection> networkConnections = vmApi.getNetworkConnectionSection(vm.getId())
|
||||
.getNetworkConnections();
|
||||
|
||||
NetworkConnectionSection section = NetworkConnectionSection.builder()
|
||||
|
@ -350,7 +349,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
|
|||
.build())
|
||||
.build();
|
||||
}
|
||||
Task cleanUpNetworks = vmApi.editNetworkConnectionSection(vm.getHref(), section);
|
||||
Task cleanUpNetworks = vmApi.editNetworkConnectionSection(vm.getId(), section);
|
||||
assertTaskSucceedsLong(cleanUpNetworks);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,10 @@ package org.jclouds.vcloud.director.v1_5.features;
|
|||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ANY;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CUSTOMIZATION_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ERROR;
|
||||
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.METADATA;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.METADATA_ENTRY;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONFIG_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.RELOCATE_TEMPLATE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP_TEMPLATE;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
@ -50,7 +48,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vm;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.CustomizationSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection;
|
||||
|
@ -86,14 +83,14 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
).getVAppTemplateApi();
|
||||
|
||||
assertNotNull(api);
|
||||
VAppTemplate template = api.getVAppTemplate(uri);
|
||||
VAppTemplate template = api.get(uri);
|
||||
|
||||
assertEquals(template, exampleTemplate());
|
||||
|
||||
Task task = api.editVAppTemplate(uri, exampleTemplate());
|
||||
Task task = api.edit(uri, exampleTemplate());
|
||||
assertNotNull(task);
|
||||
|
||||
task = api.removeVappTemplate(uri);
|
||||
task = api.remove(uri);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
|
@ -106,7 +103,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId).acceptMedia(VAPP_TEMPLATE).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
|
||||
|
||||
api.getVAppTemplate(uri);
|
||||
api.get(uri);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||
|
@ -118,7 +115,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId).xmlFilePayload("/vapptemplate/vAppTemplate.xml", VAPP_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
|
||||
|
||||
api.editVAppTemplate(uri, exampleTemplate());
|
||||
api.edit(uri, exampleTemplate());
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = VCloudDirectorException.class)
|
||||
|
@ -130,33 +127,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId).acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
|
||||
|
||||
api.removeVappTemplate(uri);
|
||||
}
|
||||
|
||||
public void testConsolidateVAppTemplate() {
|
||||
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateApi api = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/consolidate").acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
|
||||
).getVAppTemplateApi();
|
||||
|
||||
assertNotNull(api);
|
||||
Task task = api.consolidateVm(uri);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||
public void testConsolidateMissingVAppTemplate() {
|
||||
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/consolidate").acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
|
||||
|
||||
api.consolidateVm(uri);
|
||||
api.remove(uri);
|
||||
}
|
||||
|
||||
public void testDisableDownloadVAppTemplate() {
|
||||
|
@ -210,39 +181,6 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
api.enableDownload(uri);
|
||||
}
|
||||
|
||||
public void testRelocateVAppTemplate() {
|
||||
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateApi api = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/relocate").xmlFilePayload("/vapptemplate/relocateParams.xml", RELOCATE_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
|
||||
).getVAppTemplateApi();
|
||||
|
||||
assertNotNull(api);
|
||||
|
||||
Reference datastore = Reference.builder().href(URI.create("https://vcloud.example.com/api/admin/extension/datastore/607")).build();
|
||||
RelocateParams params = RelocateParams.builder().datastore(datastore).build();
|
||||
|
||||
Task task = api.relocateVm(uri, params);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = VCloudDirectorException.class)
|
||||
public void testRelocateMissingVAppTemplate() {
|
||||
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/relocate").xmlFilePayload("/vapptemplate/relocateParams.xml", RELOCATE_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
|
||||
|
||||
Reference datastore = Reference.builder().href(URI.create("https://vcloud.example.com/api/admin/extension/datastore/607")).build();
|
||||
RelocateParams params = RelocateParams.builder().datastore(datastore).build();
|
||||
|
||||
api.relocateVm(uri, params);
|
||||
}
|
||||
|
||||
public void testErrorGetCustomizationSection() {
|
||||
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
@ -254,50 +192,6 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
assertNull(api.getCustomizationSection(uri));
|
||||
}
|
||||
|
||||
public void testGuestCustomizationSection() {
|
||||
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/guestCustomizationSection").acceptMedia(GUEST_CUSTOMIZATION_SECTION).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/guestCustomizationSection.xml", GUEST_CUSTOMIZATION_SECTION).httpResponseBuilder().build(),
|
||||
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/guestCustomizationSection").xmlFilePayload("/vapptemplate/guestCustomizationSection.xml", GUEST_CUSTOMIZATION_SECTION).acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
|
||||
).getVAppTemplateApi();
|
||||
|
||||
assertNotNull(api);
|
||||
GuestCustomizationSection section = api.getGuestCustomizationSection(uri);
|
||||
|
||||
assertEquals(section, exampleGuestCustomizationSection());
|
||||
|
||||
Task task = api.editGuestCustomizationSection(uri, exampleGuestCustomizationSection());
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = VCloudDirectorException.class)
|
||||
public void testErrorGetGuestCustomizationSection() {
|
||||
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/guestCustomizationSection").acceptMedia(GUEST_CUSTOMIZATION_SECTION).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
|
||||
|
||||
api.getGuestCustomizationSection(uri);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = VCloudDirectorException.class)
|
||||
public void testErrorEditGuestCustomizationSection() {
|
||||
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/guestCustomizationSection").xmlFilePayload("/vapptemplate/guestCustomizationSection.xml", GUEST_CUSTOMIZATION_SECTION).acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
|
||||
|
||||
api.editGuestCustomizationSection(uri, exampleGuestCustomizationSection());
|
||||
}
|
||||
|
||||
public void testLeaseSettingsSection() throws ParseException {
|
||||
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
@ -353,11 +247,11 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
).getVAppTemplateApi();
|
||||
|
||||
assertNotNull(api);
|
||||
Metadata metadata = api.getMetadataApi().get(uri);
|
||||
Metadata metadata = api.getMetadataApi(uri).get();
|
||||
|
||||
assertEquals(metadata, exampleMetadata());
|
||||
|
||||
Task task = api.getMetadataApi().merge(uri, exampleMetadata());
|
||||
Task task = api.getMetadataApi(uri).merge(exampleMetadata());
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
|
@ -370,7 +264,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(ANY).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
|
||||
|
||||
api.getMetadataApi().get(uri);
|
||||
api.getMetadataApi(uri).get();
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = VCloudDirectorException.class)
|
||||
|
@ -382,7 +276,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/metadata").xmlFilePayload("/vapptemplate/metadata.xml", METADATA).acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
|
||||
|
||||
api.getMetadataApi().merge(uri, exampleMetadata());
|
||||
api.getMetadataApi(uri).merge(exampleMetadata());
|
||||
}
|
||||
|
||||
public void testVappTemplateMetadataValue() {
|
||||
|
@ -399,14 +293,14 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
).getVAppTemplateApi();
|
||||
|
||||
assertNotNull(api);
|
||||
MetadataValue metadata = api.getMetadataApi().getValue(uri, "12345");
|
||||
MetadataValue metadata = api.getMetadataApi(uri).getValue("12345");
|
||||
|
||||
assertEquals(metadata, exampleMetadataValue());
|
||||
|
||||
Task task = api.getMetadataApi().putEntry(uri, "12345", exampleMetadataValue());
|
||||
Task task = api.getMetadataApi(uri).putEntry("12345", exampleMetadataValue());
|
||||
assertNotNull(task);
|
||||
|
||||
task = api.getMetadataApi().removeEntry(uri, "12345");
|
||||
task = api.getMetadataApi(uri).removeEntry("12345");
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
|
@ -418,7 +312,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata/12345").acceptMedia(METADATA_ENTRY).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
|
||||
|
||||
assertNull(api.getMetadataApi().getValue(uri, "12345"));
|
||||
assertNull(api.getMetadataApi(uri).getValue("12345"));
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = VCloudDirectorException.class)
|
||||
|
@ -430,7 +324,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/metadata/12345").xmlFilePayload("/vapptemplate/metadataValue.xml", METADATA_ENTRY).acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
|
||||
|
||||
api.getMetadataApi().putEntry(uri, "12345", exampleMetadataValue());
|
||||
api.getMetadataApi(uri).putEntry("12345", exampleMetadataValue());
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||
|
@ -442,7 +336,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
|
|||
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId + "/metadata/12345").acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
|
||||
|
||||
api.getMetadataApi().removeEntry(uri, "12345");
|
||||
api.getMetadataApi(uri).removeEntry("12345");
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = VCloudDirectorException.class)
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkCustomizationSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkGuestCustomizationSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkLeaseSettingsSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadata;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataFor;
|
||||
|
@ -38,7 +37,6 @@ import static org.testng.Assert.assertNull;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -46,7 +44,6 @@ import java.util.Set;
|
|||
|
||||
import org.jclouds.dmtf.ovf.NetworkSection;
|
||||
import org.jclouds.vcloud.director.v1_5.AbstractVAppApiLiveTest;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link.Rel;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
|
@ -55,17 +52,13 @@ import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
|||
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.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.References;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.dmtf.Envelope;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.CloneVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.CustomizationSection;
|
||||
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.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -91,8 +84,8 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
protected void tidyUp() {
|
||||
if (key != null) {
|
||||
try {
|
||||
Task remove = vAppTemplateApi.getMetadataApi().removeEntry(vAppTemplateURI, key);
|
||||
taskDoneEventually(remove);
|
||||
Task remove = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).removeEntry(key);
|
||||
taskDoneEventually(remove);
|
||||
} catch (Exception e) {
|
||||
logger.warn(e, "Error when deleting metadata entry '%s'", key);
|
||||
}
|
||||
|
@ -101,10 +94,8 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
private VAppTemplate cloneVAppTemplate(boolean waitForTask) throws Exception {
|
||||
CloneVAppTemplateParams cloneVAppTemplateParams = CloneVAppTemplateParams.builder()
|
||||
.source(Reference.builder().href(vAppTemplateURI).build())
|
||||
.isSourceDelete(false)
|
||||
.name("clone")
|
||||
.build();
|
||||
.source(Reference.builder().href(lazyGetVAppTemplate().getHref()).build()).isSourceDelete(false)
|
||||
.name("clone").build();
|
||||
VAppTemplate clonedVappTemplate = vdcApi.cloneVAppTemplate(vdcUrn, cloneVAppTemplateParams);
|
||||
|
||||
if (waitForTask) {
|
||||
|
@ -117,30 +108,30 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
@Test(description = "GET /vAppTemplate/{id}")
|
||||
public void testGetVAppTemplate() {
|
||||
vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
|
||||
vAppTemplate = vAppTemplateApi.get(vAppTemplateUrn);
|
||||
|
||||
checkVAppTemplate(vAppTemplate);
|
||||
assertEquals(vAppTemplate.getHref(), vAppTemplateURI);
|
||||
assertEquals(vAppTemplate.getId(), vAppTemplateUrn);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplate/{id}/owner")
|
||||
public void testGetVAppTemplateOwner() {
|
||||
Owner owner = vAppTemplateApi.getOwner(vAppTemplateURI);
|
||||
Owner owner = vAppTemplateApi.getOwner(vAppTemplateUrn);
|
||||
|
||||
checkOwner(owner);
|
||||
assertEquals(owner.getUser(), vAppTemplateApi.getVAppTemplate(vAppTemplateURI).getOwner().getUser());
|
||||
assertEquals(owner.getUser(), vAppTemplateApi.get(vAppTemplateUrn).getOwner().getUser());
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplate/{id}/customizationSection")
|
||||
public void testGetCustomizationSection() {
|
||||
CustomizationSection customizationSection = vAppTemplateApi.getCustomizationSection(vAppTemplateURI);
|
||||
CustomizationSection customizationSection = vAppTemplateApi.getCustomizationSection(vAppTemplateUrn);
|
||||
|
||||
checkCustomizationSection(customizationSection);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplate/{id}/productSections")
|
||||
public void testGetProductSections() {
|
||||
ProductSectionList productSectionList = vAppTemplateApi.getProductSections(vAppTemplateURI);
|
||||
ProductSectionList productSectionList = vAppTemplateApi.getProductSections(vAppTemplateUrn);
|
||||
|
||||
checkProductSectionList(productSectionList);
|
||||
}
|
||||
|
@ -149,47 +140,38 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
public void testEditProductSections() {
|
||||
// TODO make a real modification
|
||||
|
||||
ProductSectionList origSections = vAppTemplateApi.getProductSections(vApp.getHref());
|
||||
ProductSectionList origSections = vAppTemplateApi.getProductSections(vApp.getId());
|
||||
ProductSectionList newSections = origSections.toBuilder().build();
|
||||
|
||||
Task task = vAppTemplateApi.editProductSections(vApp.getHref(), newSections);
|
||||
Task task = vAppTemplateApi.editProductSections(vApp.getId(), newSections);
|
||||
assertTaskSucceeds(task);
|
||||
|
||||
ProductSectionList modified = vAppTemplateApi.getProductSections(vApp.getHref());
|
||||
ProductSectionList modified = vAppTemplateApi.getProductSections(vApp.getId());
|
||||
checkProductSectionList(modified);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplate/{id}/guestCustomizationSection")
|
||||
public void testGetGuestCustomizationSection() {
|
||||
getGuestCustomizationSection(new Function<URI, GuestCustomizationSection>() {
|
||||
@Override
|
||||
public GuestCustomizationSection apply(URI uri) {
|
||||
return vAppTemplateApi.getGuestCustomizationSection(uri);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplate/{id}/leaseSettingsSection")
|
||||
public void testGetLeaseSettingsSection() {
|
||||
LeaseSettingsSection leaseSettingsSection = vAppTemplateApi.getLeaseSettingsSection(vAppTemplateURI);
|
||||
LeaseSettingsSection leaseSettingsSection = vAppTemplateApi.getLeaseSettingsSection(vAppTemplateUrn);
|
||||
|
||||
checkLeaseSettingsSection(leaseSettingsSection);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplate/{id}/metadata", dependsOnMethods = { "testEditMetadataValue" })
|
||||
public void testGetVAppTemplateMetadata() {
|
||||
Metadata metadata = vAppTemplateApi.getMetadataApi().get(vAppTemplateURI);
|
||||
Metadata metadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get();
|
||||
|
||||
checkMetadata(metadata);
|
||||
}
|
||||
|
||||
// implicitly tested by testEditVAppTemplateMetadataValue, which first adds the metadata entry; otherwise no entry may exist
|
||||
// implicitly tested by testEditVAppTemplateMetadataValue, which first adds the metadata entry;
|
||||
// otherwise no entry may exist
|
||||
@Test(description = "GET /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetVAppTemplateMetadata" })
|
||||
public void testGetMetadataValue() {
|
||||
Metadata metadata = vAppTemplateApi.getMetadataApi().get(vAppTemplateURI);
|
||||
Metadata metadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get();
|
||||
MetadataEntry entry = Iterables.get(metadata.getMetadataEntries(), 0);
|
||||
|
||||
MetadataValue val = vAppTemplateApi.getMetadataApi().getValue(vAppTemplateURI, entry.getKey());
|
||||
MetadataValue val = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).getValue(entry.getKey());
|
||||
|
||||
checkMetadataValue(val);
|
||||
assertEquals(val.getValue(), entry.getValue());
|
||||
|
@ -197,31 +179,21 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
@Test(description = "GET /vAppTemplate/{id}/networkConfigSection")
|
||||
public void testGetVAppTemplateNetworkConfigSection() {
|
||||
NetworkConfigSection networkConfigSection = vAppTemplateApi.getNetworkConfigSection(vAppTemplateURI);
|
||||
NetworkConfigSection networkConfigSection = vAppTemplateApi.getNetworkConfigSection(vAppTemplateUrn);
|
||||
|
||||
checkNetworkConfigSection(networkConfigSection);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplate/{id}/networkConnectionSection")
|
||||
public void testGetNetworkConnectionSection() {
|
||||
getNetworkConnectionSection(new Function<URI, NetworkConnectionSection>() {
|
||||
@Override
|
||||
public NetworkConnectionSection apply(URI uri) {
|
||||
return vAppTemplateApi.getNetworkConnectionSection(uri);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplate/{id}/networkSection")
|
||||
public void testGetVAppTemplateNetworkSection() {
|
||||
NetworkSection networkSection = vAppTemplateApi.getNetworkSection(vAppTemplateURI);
|
||||
NetworkSection networkSection = vAppTemplateApi.getNetworkSection(vAppTemplateUrn);
|
||||
|
||||
checkOvfNetworkSection(networkSection);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vAppTemplate/{id}/ovf")
|
||||
public void testGetVAppTemplateOvf() {
|
||||
Envelope envelope = vAppTemplateApi.getOvf(vAppTemplateURI);
|
||||
Envelope envelope = vAppTemplateApi.getOvf(vAppTemplateUrn);
|
||||
|
||||
checkOvfEnvelope(envelope);
|
||||
}
|
||||
|
@ -230,94 +202,70 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
public void testEditVAppTemplate() {
|
||||
String name = name("myname-");
|
||||
String description = name("Description ");
|
||||
VAppTemplate template = VAppTemplate.builder()
|
||||
.name(name)
|
||||
.description(description)
|
||||
.build();
|
||||
VAppTemplate template = VAppTemplate.builder().name(name).description(description).build();
|
||||
|
||||
final Task task = vAppTemplateApi.editVAppTemplate(vAppTemplateURI, template);
|
||||
final Task task = vAppTemplateApi.edit(vAppTemplateUrn, template);
|
||||
assertTaskSucceeds(task);
|
||||
|
||||
VAppTemplate newTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
|
||||
VAppTemplate newTemplate = vAppTemplateApi.get(vAppTemplateUrn);
|
||||
assertEquals(newTemplate.getName(), name);
|
||||
assertEquals(newTemplate.getDescription(), description);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vAppTemplate/{id}/metadata", dependsOnMethods = { "testGetVAppTemplate" })
|
||||
public void testEditMetadata() {
|
||||
Metadata oldMetadata = vAppTemplateApi.getMetadataApi().get(vAppTemplateURI);
|
||||
Map<String,String> oldMetadataMap = metadataToMap(oldMetadata);
|
||||
Metadata oldMetadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get();
|
||||
Map<String, String> oldMetadataMap = metadataToMap(oldMetadata);
|
||||
|
||||
key = name("key-");
|
||||
val = name("value-");
|
||||
MetadataEntry metadataEntry = MetadataEntry.builder().entry(key, val).build();
|
||||
Metadata metadata = Metadata.builder().fromMetadata(oldMetadata).entry(metadataEntry).build();
|
||||
|
||||
final Task task = vAppTemplateApi.getMetadataApi().merge(vAppTemplateURI, metadata);
|
||||
final Task task = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).merge(metadata);
|
||||
assertTaskSucceeds(task);
|
||||
|
||||
Metadata newMetadata = vAppTemplateApi.getMetadataApi().get(vAppTemplateURI);
|
||||
Map<String,String> expectedMetadataMap = ImmutableMap.<String,String>builder()
|
||||
.putAll(oldMetadataMap)
|
||||
.put(key, val)
|
||||
.build();
|
||||
Metadata newMetadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get();
|
||||
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
|
||||
.put(key, val).build();
|
||||
checkMetadataFor("vAppTemplate", newMetadata, expectedMetadataMap);
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testEditMetadata" })
|
||||
public void testEditMetadataValue() {
|
||||
val = "new"+val;
|
||||
val = "new" + val;
|
||||
MetadataValue metadataValue = MetadataValue.builder().value(val).build();
|
||||
|
||||
final Task task = vAppTemplateApi.getMetadataApi().putEntry(vAppTemplateURI, key, metadataValue);
|
||||
final Task task = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).putEntry(key, metadataValue);
|
||||
retryTaskSuccess.apply(task);
|
||||
|
||||
MetadataValue newMetadataValue = vAppTemplateApi.getMetadataApi().getValue(vAppTemplateURI, key);
|
||||
MetadataValue newMetadataValue = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).getValue(key);
|
||||
assertEquals(newMetadataValue.getValue(), metadataValue.getValue());
|
||||
}
|
||||
|
||||
@Test(description = "DELETE /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadataValue" })
|
||||
public void testRemoveVAppTemplateMetadataValue() {
|
||||
final Task deletionTask = vAppTemplateApi.getMetadataApi().removeEntry(vAppTemplateURI, key);
|
||||
final Task deletionTask = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).removeEntry(key);
|
||||
assertTaskSucceeds(deletionTask);
|
||||
|
||||
Metadata newMetadata = vAppTemplateApi.getMetadataApi().get(vAppTemplateURI);
|
||||
Metadata newMetadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get();
|
||||
checkMetadataKeyAbsentFor("vAppTemplate", newMetadata, key);
|
||||
key = null;
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vAppTemplate/{id}/guestCustomizationSection")
|
||||
public void testEditGuestCustomizationSection() {
|
||||
String computerName = name("n");
|
||||
GuestCustomizationSection newSection = GuestCustomizationSection.builder()
|
||||
.info("")
|
||||
.computerName(computerName)
|
||||
.build();
|
||||
|
||||
final Task task = vAppTemplateApi.editGuestCustomizationSection(vm.getHref(), newSection);
|
||||
assertTaskSucceeds(task);
|
||||
|
||||
GuestCustomizationSection modified = vAppTemplateApi.getGuestCustomizationSection(vm.getHref());
|
||||
|
||||
checkGuestCustomizationSection(modified);
|
||||
assertEquals(modified.getComputerName(), computerName);
|
||||
}
|
||||
|
||||
// NOTE vAppTemplate supports only storageLease (deployment lease applies to vApp too)
|
||||
@Test(description = "PUT /vAppTemplate/{id}/leaseSettingsSection")
|
||||
public void testEditLeaseSettingsSection() throws Exception {
|
||||
// NOTE use smallish number for storageLeaseInSeconds; it seems to be capped at 5184000?
|
||||
int storageLeaseInSeconds = random.nextInt(10000)+1;
|
||||
int storageLeaseInSeconds = random.nextInt(10000) + 1;
|
||||
|
||||
LeaseSettingsSection leaseSettingSection = LeaseSettingsSection.builder()
|
||||
.info("my info")
|
||||
.storageLeaseInSeconds(storageLeaseInSeconds)
|
||||
.build();
|
||||
LeaseSettingsSection leaseSettingSection = LeaseSettingsSection.builder().info("my info")
|
||||
.storageLeaseInSeconds(storageLeaseInSeconds).build();
|
||||
|
||||
final Task task = vAppTemplateApi.editLeaseSettingsSection(vAppTemplateURI, leaseSettingSection);
|
||||
final Task task = vAppTemplateApi.editLeaseSettingsSection(vAppTemplateUrn, leaseSettingSection);
|
||||
assertTaskSucceeds(task);
|
||||
|
||||
LeaseSettingsSection newLeaseSettingsSection = vAppTemplateApi.getLeaseSettingsSection(vAppTemplateURI);
|
||||
LeaseSettingsSection newLeaseSettingsSection = vAppTemplateApi.getLeaseSettingsSection(vAppTemplateUrn);
|
||||
assertEquals(newLeaseSettingsSection.getStorageLeaseInSeconds(), (Integer) storageLeaseInSeconds);
|
||||
}
|
||||
|
||||
|
@ -326,45 +274,48 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
VAppTemplate clonedVappTemplate = cloneVAppTemplate(true);
|
||||
|
||||
// Confirm that "get" works pre-remove
|
||||
VAppTemplate vAppTemplatePreDelete = vAppTemplateApi.getVAppTemplate(clonedVappTemplate.getHref());
|
||||
VAppTemplate vAppTemplatePreDelete = vAppTemplateApi.get(clonedVappTemplate.getId());
|
||||
checkVAppTemplate(vAppTemplatePreDelete);
|
||||
|
||||
// Delete the template
|
||||
final Task task = vAppTemplateApi.removeVappTemplate(clonedVappTemplate.getHref());
|
||||
final Task task = vAppTemplateApi.remove(clonedVappTemplate.getId());
|
||||
assertTaskSucceeds(task);
|
||||
|
||||
// Confirm that can't access post-remove, i.e. template has been removed
|
||||
VAppTemplate removed = vAppTemplateApi.getVAppTemplate(clonedVappTemplate.getHref());
|
||||
VAppTemplate removed = vAppTemplateApi.get(clonedVappTemplate.getId());
|
||||
assertNull(removed);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vAppTemplate/{id}/action/disableDownload")
|
||||
public void testDisableVAppTemplateDownload() throws Exception {
|
||||
vAppTemplateApi.disableDownload(vAppTemplateURI);
|
||||
vAppTemplateApi.disableDownload(vAppTemplateUrn);
|
||||
|
||||
// TODO Check that it really is disabled. The only thing I can see for determining this
|
||||
// is the undocumented "download" link in the VAppTemplate. But that is brittle and we
|
||||
// don't know what timing guarantees there are for adding/removing the link.
|
||||
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
|
||||
VAppTemplate vAppTemplate = vAppTemplateApi.get(vAppTemplateUrn);
|
||||
Set<Link> links = vAppTemplate.getLinks();
|
||||
assertTrue(Iterables.all(Iterables.transform(links, rel), Predicates.not(Predicates.in(EnumSet.of(Link.Rel.DOWNLOAD_DEFAULT, Link.Rel.DOWNLOAD_ALTERNATE)))),
|
||||
"Should not offer download link after disabling download: "+vAppTemplate);
|
||||
assertTrue(Iterables.all(Iterables.transform(links, rel),
|
||||
Predicates.not(Predicates.in(EnumSet.of(Link.Rel.DOWNLOAD_DEFAULT, Link.Rel.DOWNLOAD_ALTERNATE)))),
|
||||
"Should not offer download link after disabling download: " + vAppTemplate);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vAppTemplate/{id}/action/enableDownload")
|
||||
public void testEnableVAppTemplateDownload() throws Exception {
|
||||
// First disable so that enable really has some work to do...
|
||||
vAppTemplateApi.disableDownload(vAppTemplateURI);
|
||||
final Task task = vAppTemplateApi.enableDownload(vAppTemplateURI);
|
||||
vAppTemplateApi.disableDownload(vAppTemplateUrn);
|
||||
final Task task = vAppTemplateApi.enableDownload(vAppTemplateUrn);
|
||||
assertTaskSucceeds(task);
|
||||
|
||||
// TODO Check that it really is enabled. The only thing I can see for determining this
|
||||
// is the undocumented "download" link in the VAppTemplate. But that is brittle and we
|
||||
// don't know what timing guarantees there are for adding/removing the link.
|
||||
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
|
||||
VAppTemplate vAppTemplate = vAppTemplateApi.get(vAppTemplateUrn);
|
||||
Set<Link> links = vAppTemplate.getLinks();
|
||||
assertTrue(Iterables.any(Iterables.transform(links, rel), Predicates.in(EnumSet.of(Link.Rel.DOWNLOAD_DEFAULT, Link.Rel.DOWNLOAD_ALTERNATE))),
|
||||
"Should offer download link after enabling download: "+vAppTemplate);
|
||||
assertTrue(
|
||||
Iterables.any(Iterables.transform(links, rel),
|
||||
Predicates.in(EnumSet.of(Link.Rel.DOWNLOAD_DEFAULT, Link.Rel.DOWNLOAD_ALTERNATE))),
|
||||
"Should offer download link after enabling download: " + vAppTemplate);
|
||||
}
|
||||
|
||||
private Function<Link, Link.Rel> rel = new Function<Link, Link.Rel>() {
|
||||
|
@ -374,53 +325,23 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
}
|
||||
};
|
||||
|
||||
@Test(description = "POST /vAppTemplate/{id}/action/consolidate")
|
||||
public void testConsolidateVAppTemplate() throws Exception {
|
||||
final Task task = vAppTemplateApi.consolidateVm(vm.getHref());
|
||||
assertTaskSucceedsLong(task);
|
||||
|
||||
// TODO Need assertion that command had effect
|
||||
}
|
||||
|
||||
// TODO How to obtain a datastore reference?
|
||||
@Test(description = "POST /vAppTemplate/{id}/action/relocate")
|
||||
public void testRelocateVAppTemplate() throws Exception {
|
||||
Reference dataStore = null; // FIXME
|
||||
RelocateParams relocateParams = RelocateParams.builder()
|
||||
.datastore(dataStore)
|
||||
.build();
|
||||
|
||||
final Task task = vAppTemplateApi.relocateVm(vAppTemplateURI, relocateParams);
|
||||
assertTaskSucceedsLong(task);
|
||||
|
||||
// TODO Need assertion that command had effect
|
||||
}
|
||||
|
||||
// NOTE This will fail unless we can relocate a template to another datastore
|
||||
@Test(description = "GET /vAppTemplate/{id}/shadowVms", dependsOnMethods = { "testRelocateVAppTemplate" })
|
||||
public void testGetShadowVms() {
|
||||
References references = vAppTemplateApi.getShadowVms(vAppTemplateURI);
|
||||
|
||||
Checks.checkReferences(references);
|
||||
}
|
||||
|
||||
// This failed previously, but is passing now.
|
||||
// However, it's not part of the official API so not necessary to assert it.
|
||||
@Test(description = "test completed task not included in vAppTemplate")
|
||||
public void testCompletedTaskNotIncludedInVAppTemplate() throws Exception {
|
||||
// Kick off a task, and wait for it to complete
|
||||
vAppTemplateApi.disableDownload(vAppTemplateURI);
|
||||
final Task task = vAppTemplateApi.enableDownload(vAppTemplateURI);
|
||||
vAppTemplateApi.disableDownload(vAppTemplateUrn);
|
||||
final Task task = vAppTemplateApi.enableDownload(vAppTemplateUrn);
|
||||
assertTaskDoneEventually(task);
|
||||
|
||||
// Ask the VAppTemplate for its tasks, and the status of the matching task if it exists
|
||||
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
|
||||
VAppTemplate vAppTemplate = vAppTemplateApi.get(vAppTemplateUrn);
|
||||
List<Task> tasks = vAppTemplate.getTasks();
|
||||
for (Task contender : tasks) {
|
||||
if (task.getId().equals(contender.getId())) {
|
||||
Task.Status status = contender.getStatus();
|
||||
if (EnumSet.of(Task.Status.QUEUED, Task.Status.PRE_RUNNING, Task.Status.RUNNING).contains(status)) {
|
||||
fail("Task "+contender+" reported complete, but is included in VAppTemplate in status "+status);
|
||||
fail("Task " + contender + " reported complete, but is included in VAppTemplate in status " + status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -355,7 +355,7 @@ public class VdcApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
|
||||
Metadata expected = metadata();
|
||||
|
||||
assertEquals(api.getVdcApi().getMetadataApi().get(vdcUri), expected);
|
||||
assertEquals(api.getVdcApi().getMetadataApi(vdcUri).get(), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -373,7 +373,7 @@ public class VdcApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
|
||||
MetadataValue expected = metadataValue();
|
||||
|
||||
assertEquals(api.getVdcApi().getMetadataApi().getValue(vdcUri, "key"), expected);
|
||||
assertEquals(api.getVdcApi().getMetadataApi(vdcUri).getValue("key"), expected);
|
||||
}
|
||||
|
||||
public static Vdc getVdc() {
|
||||
|
|
|
@ -64,7 +64,7 @@ import com.google.common.collect.Iterables;
|
|||
/**
|
||||
* Tests behavior of {@link VdcApi}
|
||||
*
|
||||
* @author danikov
|
||||
* @author danikov, Adrian Cole
|
||||
*/
|
||||
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VdcApiLiveTest")
|
||||
public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
||||
|
@ -121,7 +121,7 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
if (metadataSet) {
|
||||
try {
|
||||
Task remove = adminContext.getApi().getVdcApi().getMetadataApi().removeEntry(lazyGetVdc().getHref(), "key");
|
||||
Task remove = adminContext.getApi().getVdcApi().getMetadataApi(vdcUrn).removeEntry("key");
|
||||
taskDoneEventually(remove);
|
||||
} catch (Exception e) {
|
||||
logger.warn(e, "Error deleting metadata entry");
|
||||
|
@ -187,8 +187,8 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
@Test(description = "POST /vdc/{id}/action/cloneVAppTemplate")
|
||||
public void testCloneVAppTemplate() {
|
||||
clonedVAppTemplate = vdcApi.cloneVAppTemplate(vdcUrn, CloneVAppTemplateParams.builder().source(vAppTemplateURI)
|
||||
.build());
|
||||
clonedVAppTemplate = vdcApi.cloneVAppTemplate(vdcUrn,
|
||||
CloneVAppTemplateParams.builder().source(lazyGetVAppTemplate().getHref()).build());
|
||||
|
||||
Task task = Iterables.getFirst(clonedVAppTemplate.getTasks(), null);
|
||||
assertNotNull(task, "vdcApi.cloneVAppTemplate returned VAppTemplate that did not contain any tasks");
|
||||
|
@ -259,7 +259,7 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
InstantiateVAppTemplateParams instantiate = InstantiateVAppTemplateParams.builder().name(name("test-vapp-"))
|
||||
.notDeploy().notPowerOn().description("Test VApp").instantiationParams(instantiationParams)
|
||||
.source(vAppTemplateURI).build();
|
||||
.source(lazyGetVAppTemplate().getHref()).build();
|
||||
|
||||
instantiatedVApp = vdcApi.instantiateVApp(vdcUrn, instantiate);
|
||||
Task instantiationTask = Iterables.getFirst(instantiatedVApp.getTasks(), null);
|
||||
|
@ -300,8 +300,8 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
}
|
||||
|
||||
private void setupMetadata() {
|
||||
adminContext.getApi().getVdcApi().getMetadataApi()
|
||||
.putEntry(lazyGetVdc().getHref(), "key", MetadataValue.builder().value("value").build());
|
||||
adminContext.getApi().getVdcApi().getMetadataApi(vdcUrn)
|
||||
.putEntry("key", MetadataValue.builder().value("value").build());
|
||||
metadataSet = true;
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
setupMetadata();
|
||||
}
|
||||
|
||||
Metadata metadata = vdcApi.getMetadataApi().get(lazyGetVdc().getHref());
|
||||
Metadata metadata = vdcApi.getMetadataApi(vdcUrn).get();
|
||||
|
||||
// required for testing
|
||||
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
|
||||
|
@ -323,12 +323,12 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
@Test(description = "GET /vdc/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
|
||||
public void testGetMetadataValue() {
|
||||
// First find a key
|
||||
Metadata metadata = vdcApi.getMetadataApi().get(lazyGetVdc().getHref());
|
||||
Metadata metadata = vdcApi.getMetadataApi(vdcUrn).get();
|
||||
Map<String, String> metadataMap = Checks.metadataToMap(metadata);
|
||||
String key = Iterables.getFirst(metadataMap.keySet(), "MadeUpKey!");
|
||||
String value = metadataMap.get(key);
|
||||
|
||||
MetadataValue metadataValue = vdcApi.getMetadataApi().getValue(lazyGetVdc().getHref(), key);
|
||||
MetadataValue metadataValue = vdcApi.getMetadataApi(vdcUrn).getValue(key);
|
||||
|
||||
Checks.checkMetadataValueFor(VDC, metadataValue, value);
|
||||
}
|
||||
|
|
|
@ -985,7 +985,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
|
|||
return task;
|
||||
}
|
||||
|
||||
public static ControlAccessParams getControlAccessParams() {
|
||||
public static ControlAccessParams getAccessControlParams() {
|
||||
ControlAccessParams params = ControlAccessParams.builder()
|
||||
.build();
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ import static org.testng.Assert.assertNull;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -180,12 +179,12 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see VmApi#get(URI)
|
||||
* @see VmApi#get(String)
|
||||
*/
|
||||
@Test(description = "GET /vApp/{id}")
|
||||
public void testGetVm() {
|
||||
// The method under test
|
||||
vm = vmApi.get(vmURI);
|
||||
vm = vmApi.get(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkVm(vm);
|
||||
|
@ -195,22 +194,22 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
String.format(OBJ_FIELD_EQ, VM, "deployed", "FALSE", vm.isDeployed().toString()));
|
||||
|
||||
// Check status
|
||||
assertVmStatus(vm.getHref(), Status.POWERED_OFF);
|
||||
assertVmStatus(vmUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see VmApi#edit(URI, Vm)
|
||||
* @see VmApi#edit(String, Vm)
|
||||
*/
|
||||
@Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVm" })
|
||||
public void testEditVm() {
|
||||
Vm newVm = Vm.builder().name(name("new-name-")).description("New Description").build();
|
||||
|
||||
// The method under test
|
||||
Task editVm = vmApi.edit(vm.getHref(), newVm);
|
||||
Task editVm = vmApi.edit(vmUrn, newVm);
|
||||
assertTrue(retryTaskSuccess.apply(editVm), String.format(TASK_COMPLETE_TIMELY, "editVm"));
|
||||
|
||||
// Get the edited Vm
|
||||
vm = vmApi.get(vm.getHref());
|
||||
vm = vmApi.get(vmUrn);
|
||||
|
||||
// Check the required fields are set
|
||||
assertEquals(vm.getName(), newVm.getName(),
|
||||
|
@ -226,155 +225,155 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.notPowerOn().build();
|
||||
|
||||
// The method under test
|
||||
Task deployVm = vmApi.deploy(vm.getHref(), params);
|
||||
Task deployVm = vmApi.deploy(vmUrn, params);
|
||||
assertTrue(retryTaskSuccessLong.apply(deployVm), String.format(TASK_COMPLETE_TIMELY, "deployVm"));
|
||||
|
||||
// Get the edited Vm
|
||||
vm = vmApi.get(vm.getHref());
|
||||
vm = vmApi.get(vmUrn);
|
||||
|
||||
// Check the required fields are set
|
||||
assertTrue(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VM, "deployed", "TRUE", vm.isDeployed().toString()));
|
||||
|
||||
// Check status
|
||||
assertVmStatus(vmURI, Status.POWERED_OFF);
|
||||
assertVmStatus(vmUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/powerOn", dependsOnMethods = { "testDeployVm" })
|
||||
public void testPowerOnVm() {
|
||||
// Power off Vm
|
||||
vm = powerOffVm(vm.getHref());
|
||||
vm = powerOffVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
Task powerOnVm = vmApi.powerOn(vm.getHref());
|
||||
Task powerOnVm = vmApi.powerOn(vmUrn);
|
||||
assertTaskSucceedsLong(powerOnVm);
|
||||
|
||||
// Get the edited Vm
|
||||
vm = vmApi.get(vm.getHref());
|
||||
vm = vmApi.get(vmUrn);
|
||||
|
||||
// Check status
|
||||
assertVmStatus(vm.getHref(), Status.POWERED_ON);
|
||||
assertVmStatus(vmUrn, Status.POWERED_ON);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/reboot", dependsOnMethods = { "testDeployVm" })
|
||||
public void testReboot() {
|
||||
// Power on Vm
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
Task reboot = vmApi.reboot(vm.getHref());
|
||||
Task reboot = vmApi.reboot(vmUrn);
|
||||
assertTaskSucceedsLong(reboot);
|
||||
|
||||
// Get the edited Vm
|
||||
vm = vmApi.get(vm.getHref());
|
||||
vm = vmApi.get(vmUrn);
|
||||
|
||||
// Check status
|
||||
assertVmStatus(vmURI, Status.POWERED_OFF);
|
||||
assertVmStatus(vmUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/shutdown", dependsOnMethods = { "testInstallVMwareTools" })
|
||||
public void testShutdown() {
|
||||
// Power on Vm
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
Task shutdown = vmApi.shutdown(vm.getHref());
|
||||
Task shutdown = vmApi.shutdown(vmUrn);
|
||||
assertTaskSucceedsLong(shutdown);
|
||||
|
||||
// Get the edited Vm
|
||||
vm = vmApi.get(vm.getHref());
|
||||
vm = vmApi.get(vmUrn);
|
||||
|
||||
// Check status
|
||||
assertVmStatus(vm.getHref(), Status.POWERED_OFF);
|
||||
assertVmStatus(vmUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/suspend", dependsOnMethods = { "testDeployVm" })
|
||||
public void testSuspend() {
|
||||
// Power on Vm
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
Task suspend = vmApi.suspend(vmURI);
|
||||
Task suspend = vmApi.suspend(vmUrn);
|
||||
assertTaskSucceedsLong(suspend);
|
||||
|
||||
// Get the edited Vm
|
||||
vm = vmApi.get(vm.getHref());
|
||||
vm = vmApi.get(vmUrn);
|
||||
|
||||
// Check status
|
||||
assertVmStatus(vmURI, Status.SUSPENDED);
|
||||
assertVmStatus(vmUrn, Status.SUSPENDED);
|
||||
|
||||
// Power on the Vm again
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/reset", dependsOnMethods = { "testDeployVm" })
|
||||
public void testReset() {
|
||||
// Power on Vm
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
Task reset = vmApi.reset(vmURI);
|
||||
Task reset = vmApi.reset(vmUrn);
|
||||
assertTaskSucceedsLong(reset);
|
||||
|
||||
// Get the edited Vm
|
||||
vm = vmApi.get(vm.getHref());
|
||||
vm = vmApi.get(vmUrn);
|
||||
|
||||
// Check status
|
||||
assertVmStatus(vmURI, Status.POWERED_ON);
|
||||
assertVmStatus(vmUrn, Status.POWERED_ON);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/undeploy", dependsOnMethods = { "testDeployVm" })
|
||||
public void testUndeployVm() {
|
||||
// Power on Vm
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
UndeployVAppParams params = UndeployVAppParams.builder().build();
|
||||
|
||||
// The method under test
|
||||
Task undeploy = vmApi.undeploy(vm.getHref(), params);
|
||||
Task undeploy = vmApi.undeploy(vmUrn, params);
|
||||
assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
|
||||
|
||||
// Get the edited Vm
|
||||
vm = vmApi.get(vm.getHref());
|
||||
vm = vmApi.get(vmUrn);
|
||||
|
||||
// Check status
|
||||
assertFalse(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VM, "deployed", "FALSE", vm.isDeployed().toString()));
|
||||
assertVmStatus(vmURI, Status.POWERED_OFF);
|
||||
assertVmStatus(vmUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/powerOff", dependsOnMethods = { "testUndeployVm" })
|
||||
public void testPowerOffVm() {
|
||||
// Power on Vm
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
// NB this will put the vm in partially powered off state
|
||||
Task powerOffVm = vmApi.powerOff(vm.getHref());
|
||||
Task powerOffVm = vmApi.powerOff(vmUrn);
|
||||
assertTrue(retryTaskSuccess.apply(powerOffVm), String.format(TASK_COMPLETE_TIMELY, "powerOffVm"));
|
||||
|
||||
// Get the edited Vm
|
||||
vm = vmApi.get(vmURI);
|
||||
vm = vmApi.get(vmUrn);
|
||||
|
||||
// Check status
|
||||
assertVmStatus(vmURI, Status.POWERED_OFF);
|
||||
assertVmStatus(vmUrn, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/consolidate", dependsOnMethods = { "testDeployVm" })
|
||||
public void testConsolidateVm() {
|
||||
// Power on Vm
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
Task consolidateVm = vmApi.consolidate(vm.getHref());
|
||||
Task consolidateVm = vmApi.consolidate(vmUrn);
|
||||
assertTrue(retryTaskSuccess.apply(consolidateVm), String.format(TASK_COMPLETE_TIMELY, "consolidateVm"));
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/discardSuspendedState", dependsOnMethods = { "testDeployVm" })
|
||||
public void testDiscardSuspendedState() {
|
||||
// Suspend the Vm
|
||||
vm = suspendVm(vm.getHref());
|
||||
vm = suspendVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
Task discardSuspendedState = vmApi.discardSuspendedState(vm.getHref());
|
||||
Task discardSuspendedState = vmApi.discardSuspendedState(vmUrn);
|
||||
assertTrue(retryTaskSuccess.apply(discardSuspendedState),
|
||||
String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
|
||||
}
|
||||
|
@ -382,10 +381,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "POST /vApp/{id}/action/installVMwareTools", dependsOnMethods = { "testDeployVm" })
|
||||
public void testInstallVMwareTools() {
|
||||
// First ensure the vApp is powered on
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
Task installVMwareTools = vmApi.installVMwareTools(vm.getHref());
|
||||
Task installVMwareTools = vmApi.installVMwareTools(vmUrn);
|
||||
assertTrue(retryTaskSuccess.apply(installVMwareTools), String.format(TASK_COMPLETE_TIMELY, "installVMwareTools"));
|
||||
}
|
||||
|
||||
|
@ -399,29 +398,29 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.build();
|
||||
|
||||
// The method under test
|
||||
Task relocate = vmApi.relocate(vm.getHref(), params);
|
||||
Task relocate = vmApi.relocate(vmUrn, params);
|
||||
assertTrue(retryTaskSuccess.apply(relocate), String.format(TASK_COMPLETE_TIMELY, "relocate"));
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/upgradeHardwareVersion", dependsOnMethods = { "testGetVm" })
|
||||
public void testUpgradeHardwareVersion() {
|
||||
// Power off Vm
|
||||
vm = powerOffVm(vm.getHref());
|
||||
vm = powerOffVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
Task upgradeHardwareVersion = vmApi.upgradeHardwareVersion(vm.getHref());
|
||||
Task upgradeHardwareVersion = vmApi.upgradeHardwareVersion(vmUrn);
|
||||
assertTrue(retryTaskSuccess.apply(upgradeHardwareVersion),
|
||||
String.format(TASK_COMPLETE_TIMELY, "upgradeHardwareVersion"));
|
||||
|
||||
// Power on the Vm again
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetVm" })
|
||||
public void testGetGuestCustomizationSection() {
|
||||
getGuestCustomizationSection(new Function<URI, GuestCustomizationSection>() {
|
||||
getGuestCustomizationSection(new Function<String, GuestCustomizationSection>() {
|
||||
@Override
|
||||
public GuestCustomizationSection apply(URI uri) {
|
||||
public GuestCustomizationSection apply(String uri) {
|
||||
return vmApi.getGuestCustomizationSection(uri);
|
||||
}
|
||||
});
|
||||
|
@ -430,18 +429,18 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" })
|
||||
public void testEditGuestCustomizationSection() {
|
||||
// Copy existing section and edit fields
|
||||
GuestCustomizationSection oldSection = vmApi.getGuestCustomizationSection(vm.getHref());
|
||||
GuestCustomizationSection oldSection = vmApi.getGuestCustomizationSection(vmUrn);
|
||||
GuestCustomizationSection newSection = oldSection.toBuilder().computerName(name("n")).enabled(Boolean.TRUE)
|
||||
.adminPassword(null) // Not allowed
|
||||
.build();
|
||||
|
||||
// The method under test
|
||||
Task editGuestCustomizationSection = vmApi.editGuestCustomizationSection(vm.getHref(), newSection);
|
||||
Task editGuestCustomizationSection = vmApi.editGuestCustomizationSection(vmUrn, newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editGuestCustomizationSection),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editGuestCustomizationSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
GuestCustomizationSection modified = vmApi.getGuestCustomizationSection(vm.getHref());
|
||||
GuestCustomizationSection modified = vmApi.getGuestCustomizationSection(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkGuestCustomizationSection(modified);
|
||||
|
@ -466,7 +465,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.media(Reference.builder().href(mediaURI).type(MEDIA).build()).build();
|
||||
|
||||
// The method under test
|
||||
Task insertMedia = vmApi.insertMedia(vm.getHref(), params);
|
||||
Task insertMedia = vmApi.insertMedia(vmUrn, params);
|
||||
assertTrue(retryTaskSuccess.apply(insertMedia), String.format(TASK_COMPLETE_TIMELY, "insertMedia"));
|
||||
}
|
||||
|
||||
|
@ -477,15 +476,15 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.media(Reference.builder().href(mediaURI).type(MEDIA).build()).build();
|
||||
|
||||
// The method under test
|
||||
Task ejectMedia = vmApi.ejectMedia(vm.getHref(), params);
|
||||
Task ejectMedia = vmApi.ejectMedia(vmUrn, params);
|
||||
assertTrue(retryTaskSuccess.apply(ejectMedia), String.format(TASK_COMPLETE_TIMELY, "ejectMedia"));
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetVm" })
|
||||
public void testGetNetworkConnectionSection() {
|
||||
getNetworkConnectionSection(new Function<URI, NetworkConnectionSection>() {
|
||||
getNetworkConnectionSection(new Function<String, NetworkConnectionSection>() {
|
||||
@Override
|
||||
public NetworkConnectionSection apply(URI uri) {
|
||||
public NetworkConnectionSection apply(String uri) {
|
||||
return vmApi.getNetworkConnectionSection(uri);
|
||||
}
|
||||
});
|
||||
|
@ -494,13 +493,13 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
// FIXME "Task error: Unable to perform this action. Contact your cloud administrator."
|
||||
@Test(description = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testEditGuestCustomizationSection" })
|
||||
public void testEditNetworkConnectionSection() {
|
||||
powerOffVm(vm.getHref());
|
||||
powerOffVm(vmUrn);
|
||||
// Look up a network in the Vdc
|
||||
Set<Reference> networks = vdc.getAvailableNetworks();
|
||||
Reference network = Iterables.getLast(networks);
|
||||
|
||||
// Copy existing section and edit fields
|
||||
NetworkConnectionSection oldSection = vmApi.getNetworkConnectionSection(vm.getHref());
|
||||
NetworkConnectionSection oldSection = vmApi.getNetworkConnectionSection(vmUrn);
|
||||
NetworkConnectionSection newSection = oldSection
|
||||
.toBuilder()
|
||||
.networkConnection(
|
||||
|
@ -508,12 +507,12 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.network(network.getName()).build()).build();
|
||||
|
||||
// The method under test
|
||||
Task editNetworkConnectionSection = vmApi.editNetworkConnectionSection(vm.getHref(), newSection);
|
||||
Task editNetworkConnectionSection = vmApi.editNetworkConnectionSection(vmUrn, newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editNetworkConnectionSection),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editNetworkConnectionSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
NetworkConnectionSection modified = vmApi.getNetworkConnectionSection(vm.getHref());
|
||||
NetworkConnectionSection modified = vmApi.getNetworkConnectionSection(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkNetworkConnectionSection(modified);
|
||||
|
@ -528,7 +527,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetVm" })
|
||||
public void testGetOperatingSystemSection() {
|
||||
// The method under test
|
||||
OperatingSystemSection section = vmApi.getOperatingSystemSection(vm.getHref());
|
||||
OperatingSystemSection section = vmApi.getOperatingSystemSection(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkOperatingSystemSection(section);
|
||||
|
@ -544,12 +543,12 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.id(OSType.RHEL_64.getCode()).osType("rhel5_64Guest").build();
|
||||
|
||||
// The method under test
|
||||
Task editOperatingSystemSection = vmApi.editOperatingSystemSection(vm.getHref(), newSection);
|
||||
Task editOperatingSystemSection = vmApi.editOperatingSystemSection(vmUrn, newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editOperatingSystemSection),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editOperatingSystemSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
OperatingSystemSection modified = vmApi.getOperatingSystemSection(vm.getHref());
|
||||
OperatingSystemSection modified = vmApi.getOperatingSystemSection(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkOperatingSystemSection(modified);
|
||||
|
@ -561,7 +560,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/productSections", dependsOnMethods = { "testGetVm" })
|
||||
public void testGetProductSections() {
|
||||
// The method under test
|
||||
ProductSectionList sectionList = vmApi.getProductSections(vm.getHref());
|
||||
ProductSectionList sectionList = vmApi.getProductSections(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkProductSectionList(sectionList);
|
||||
|
@ -569,9 +568,9 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
@Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
|
||||
public void testEditProductSections() {
|
||||
powerOffVm(vm.getHref());
|
||||
powerOffVm(vmUrn);
|
||||
// Copy existing section and edit fields
|
||||
ProductSectionList oldSections = vmApi.getProductSections(vm.getHref());
|
||||
ProductSectionList oldSections = vmApi.getProductSections(vmUrn);
|
||||
ProductSectionList newSections = oldSections
|
||||
.toBuilder()
|
||||
.productSection(
|
||||
|
@ -583,12 +582,12 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
.build()).build();
|
||||
|
||||
// The method under test
|
||||
Task editProductSections = vmApi.editProductSections(vm.getHref(), newSections);
|
||||
Task editProductSections = vmApi.editProductSections(vmUrn, newSections);
|
||||
assertTrue(retryTaskSuccess.apply(editProductSections),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editProductSections"));
|
||||
|
||||
// Retrieve the modified section
|
||||
ProductSectionList modified = vmApi.getProductSections(vm.getHref());
|
||||
ProductSectionList modified = vmApi.getProductSections(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkProductSectionList(modified);
|
||||
|
@ -604,12 +603,12 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/question", dependsOnMethods = { "testDeployVm" })
|
||||
public void testGetPendingQuestion() {
|
||||
// Power on Vm
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
// TODO how to test?
|
||||
|
||||
// The method under test
|
||||
VmPendingQuestion question = vmApi.getPendingQuestion(vm.getHref());
|
||||
VmPendingQuestion question = vmApi.getPendingQuestion(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkVmPendingQuestion(question);
|
||||
|
@ -620,7 +619,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
// TODO check that the question has been answered (e.g. asking for getPendingQuestion does not
|
||||
// include our answered question).
|
||||
|
||||
VmPendingQuestion question = vmApi.getPendingQuestion(vm.getHref());
|
||||
VmPendingQuestion question = vmApi.getPendingQuestion(vmUrn);
|
||||
List<VmQuestionAnswerChoice> answerChoices = question.getChoices();
|
||||
VmQuestionAnswerChoice answerChoice = Iterables.getFirst(answerChoices, null);
|
||||
assertNotNull(answerChoice, "Question " + question + " must have at least once answer-choice");
|
||||
|
@ -628,13 +627,13 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
VmQuestionAnswer answer = VmQuestionAnswer.builder().choiceId(answerChoice.getId())
|
||||
.questionId(question.getQuestionId()).build();
|
||||
|
||||
vmApi.answerQuestion(vm.getHref(), answer);
|
||||
vmApi.answerQuestion(vmUrn, answer);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/runtimeInfoSection", dependsOnMethods = { "testGetVm" })
|
||||
public void testGetRuntimeInfoSection() {
|
||||
// The method under test
|
||||
RuntimeInfoSection section = vmApi.getRuntimeInfoSection(vm.getHref());
|
||||
RuntimeInfoSection section = vmApi.getRuntimeInfoSection(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRuntimeInfoSection(section);
|
||||
|
@ -644,10 +643,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/screen", dependsOnMethods = { "testInstallVMwareTools" })
|
||||
public void testGetScreenImage() {
|
||||
// Power on Vm
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
byte[] image = vmApi.getScreenImage(vm.getHref());
|
||||
byte[] image = vmApi.getScreenImage(vmUrn);
|
||||
|
||||
// Check returned bytes against PNG header magic number
|
||||
byte[] pngHeaderBytes = new byte[] { (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
|
||||
|
@ -662,10 +661,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "POST /vApp/{id}/screen/action/acquireTicket", dependsOnMethods = { "testDeployVm" })
|
||||
public void testGetScreenTicket() {
|
||||
// Power on Vm
|
||||
vm = powerOnVm(vm.getHref());
|
||||
vm = powerOnVm(vmUrn);
|
||||
|
||||
// The method under test
|
||||
ScreenTicket ticket = vmApi.getScreenTicket(vm.getHref());
|
||||
ScreenTicket ticket = vmApi.getScreenTicket(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkScreenTicket(ticket);
|
||||
|
@ -674,7 +673,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVm" })
|
||||
public void testGetVirtualHardwareSection() {
|
||||
// Method under test
|
||||
VirtualHardwareSection hardware = vmApi.getVirtualHardwareSection(vm.getHref());
|
||||
VirtualHardwareSection hardware = vmApi.getVirtualHardwareSection(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkVirtualHardwareSection(hardware);
|
||||
|
@ -683,10 +682,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testEditVirtualHardwareSection() {
|
||||
// Power off Vm
|
||||
vm = powerOffVm(vm.getHref());
|
||||
vm = powerOffVm(vmUrn);
|
||||
|
||||
// Copy existing section and edit fields
|
||||
VirtualHardwareSection oldSection = vmApi.getVirtualHardwareSection(vm.getHref());
|
||||
VirtualHardwareSection oldSection = vmApi.getVirtualHardwareSection(vmUrn);
|
||||
Set<? extends ResourceAllocationSettingData> oldItems = oldSection.getItems();
|
||||
Set<ResourceAllocationSettingData> newItems = Sets.newLinkedHashSet(oldItems);
|
||||
ResourceAllocationSettingData oldMemory = Iterables.find(oldItems,
|
||||
|
@ -703,12 +702,12 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
VirtualHardwareSection newSection = oldSection.toBuilder().items(newItems).build();
|
||||
|
||||
// The method under test
|
||||
Task editVirtualHardwareSection = vmApi.editVirtualHardwareSection(vm.getHref(), newSection);
|
||||
Task editVirtualHardwareSection = vmApi.editVirtualHardwareSection(vmUrn, newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSection),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
VirtualHardwareSection modifiedSection = vmApi.getVirtualHardwareSection(vm.getHref());
|
||||
VirtualHardwareSection modifiedSection = vmApi.getVirtualHardwareSection(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkVirtualHardwareSection(modifiedSection);
|
||||
|
@ -729,7 +728,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionCpu() {
|
||||
// Method under test
|
||||
RasdItem rasd = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
|
||||
RasdItem rasd = vmApi.getVirtualHardwareSectionCpu(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkResourceAllocationSettingData(rasd);
|
||||
|
@ -738,17 +737,17 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" })
|
||||
public void testEditVirtualHardwareSectionCpu() {
|
||||
// Copy existing section and edit fields
|
||||
RasdItem oldItem = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
|
||||
RasdItem oldItem = vmApi.getVirtualHardwareSectionCpu(vmUrn);
|
||||
RasdItem newItem = oldItem.toBuilder().elementName("2 virtual CPU(s)").virtualQuantity(new BigInteger("2"))
|
||||
.build();
|
||||
|
||||
// Method under test
|
||||
Task editVirtualHardwareSectionCpu = vmApi.editVirtualHardwareSectionCpu(vm.getHref(), newItem);
|
||||
Task editVirtualHardwareSectionCpu = vmApi.editVirtualHardwareSectionCpu(vmUrn, newItem);
|
||||
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionCpu),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionCpu"));
|
||||
|
||||
// Retrieve the modified section
|
||||
RasdItem modified = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
|
||||
RasdItem modified = vmApi.getVirtualHardwareSectionCpu(vmUrn);
|
||||
|
||||
// Check the retrieved object
|
||||
checkResourceAllocationSettingData(modified);
|
||||
|
@ -762,7 +761,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionDisks() {
|
||||
// Method under test
|
||||
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
|
||||
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionDisks(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(rasdItems);
|
||||
|
@ -771,16 +770,16 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSectionDisks" })
|
||||
public void testEditVirtualHardwareSectionDisks() {
|
||||
// Copy the existing items list and edit the name of an item
|
||||
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
|
||||
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionDisks(vmUrn);
|
||||
RasdItemsList newSection = oldSection.toBuilder().build();
|
||||
|
||||
// Method under test
|
||||
Task editVirtualHardwareSectionDisks = vmApi.editVirtualHardwareSectionDisks(vm.getHref(), newSection);
|
||||
Task editVirtualHardwareSectionDisks = vmApi.editVirtualHardwareSectionDisks(vmUrn, newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionDisks),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionDisks"));
|
||||
|
||||
// Retrieve the modified section
|
||||
RasdItemsList modified = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
|
||||
RasdItemsList modified = vmApi.getVirtualHardwareSectionDisks(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(modified);
|
||||
|
@ -812,7 +811,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/media", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionMedia() {
|
||||
// Method under test
|
||||
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionMedia(vm.getHref());
|
||||
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionMedia(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(rasdItems);
|
||||
|
@ -821,7 +820,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionMemory() {
|
||||
// Method under test
|
||||
RasdItem rasd = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
|
||||
RasdItem rasd = vmApi.getVirtualHardwareSectionCpu(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkResourceAllocationSettingData(rasd);
|
||||
|
@ -829,17 +828,17 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" })
|
||||
public void testEditVirtualHardwareSectionMemory() {
|
||||
RasdItem origItem = vmApi.getVirtualHardwareSectionMemory(vm.getHref());
|
||||
RasdItem origItem = vmApi.getVirtualHardwareSectionMemory(vmUrn);
|
||||
RasdItem newItem = origItem.toBuilder().elementName("1024 MB of memory").virtualQuantity(new BigInteger("1024"))
|
||||
.build();
|
||||
|
||||
// Method under test
|
||||
Task editVirtualHardwareSectionMemory = vmApi.editVirtualHardwareSectionMemory(vm.getHref(), newItem);
|
||||
Task editVirtualHardwareSectionMemory = vmApi.editVirtualHardwareSectionMemory(vmUrn, newItem);
|
||||
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionMemory),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionMemory"));
|
||||
|
||||
// Retrieve the modified section
|
||||
RasdItem modified = vmApi.getVirtualHardwareSectionMemory(vm.getHref());
|
||||
RasdItem modified = vmApi.getVirtualHardwareSectionMemory(vmUrn);
|
||||
|
||||
// Check the retrieved object
|
||||
checkResourceAllocationSettingData(modified);
|
||||
|
@ -853,7 +852,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionNetworkCards() {
|
||||
// Method under test
|
||||
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
|
||||
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionNetworkCards(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(rasdItems);
|
||||
|
@ -861,17 +860,17 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSectionNetworkCards" })
|
||||
public void testEditVirtualHardwareSectionNetworkCards() {
|
||||
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
|
||||
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionNetworkCards(vmUrn);
|
||||
RasdItemsList newSection = oldSection.toBuilder().build();
|
||||
|
||||
// Method under test
|
||||
Task editVirtualHardwareSectionNetworkCards = vmApi.editVirtualHardwareSectionNetworkCards(vm.getHref(),
|
||||
Task editVirtualHardwareSectionNetworkCards = vmApi.editVirtualHardwareSectionNetworkCards(vmUrn,
|
||||
newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionNetworkCards),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionNetworkCards"));
|
||||
|
||||
// Retrieve the modified section
|
||||
RasdItemsList modified = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
|
||||
RasdItemsList modified = vmApi.getVirtualHardwareSectionNetworkCards(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(modified);
|
||||
|
@ -885,7 +884,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionSerialPorts() {
|
||||
// Method under test
|
||||
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
|
||||
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionSerialPorts(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(rasdItems);
|
||||
|
@ -893,17 +892,17 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSectionSerialPorts" })
|
||||
public void testEditVirtualHardwareSectionSerialPorts() {
|
||||
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
|
||||
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionSerialPorts(vmUrn);
|
||||
RasdItemsList newSection = oldSection.toBuilder().build();
|
||||
|
||||
// Method under test
|
||||
Task editVirtualHardwareSectionSerialPorts = vmApi
|
||||
.editVirtualHardwareSectionSerialPorts(vm.getHref(), newSection);
|
||||
.editVirtualHardwareSectionSerialPorts(vmUrn, newSection);
|
||||
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionSerialPorts),
|
||||
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionSerialPorts"));
|
||||
|
||||
// Retrieve the modified section
|
||||
RasdItemsList modified = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
|
||||
RasdItemsList modified = vmApi.getVirtualHardwareSectionSerialPorts(vmUrn);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(modified);
|
||||
|
@ -919,10 +918,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
key = name("key-");
|
||||
String value = name("value-");
|
||||
metadataValue = MetadataValue.builder().value(value).build();
|
||||
vmApi.getMetadataApi().putEntry(vm.getHref(), key, metadataValue);
|
||||
vmApi.getMetadataApi(vmUrn).putEntry(key, metadataValue);
|
||||
|
||||
// Retrieve the value, and assert it was set correctly
|
||||
MetadataValue newMetadataValue = vmApi.getMetadataApi().getValue(vm.getHref(), key);
|
||||
MetadataValue newMetadataValue = vmApi.getMetadataApi(vmUrn).getValue(key);
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkMetadataValueFor(VM, newMetadataValue, value);
|
||||
|
@ -931,7 +930,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "GET /vApp/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" })
|
||||
public void testGetMetadata() {
|
||||
// Call the method being tested
|
||||
Metadata metadata = vmApi.getMetadataApi().get(vm.getHref());
|
||||
Metadata metadata = vmApi.getMetadataApi(vmUrn).get();
|
||||
|
||||
checkMetadata(metadata);
|
||||
|
||||
|
@ -945,10 +944,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
key = name("key-");
|
||||
String value = name("value-");
|
||||
metadataValue = MetadataValue.builder().value(value).build();
|
||||
vmApi.getMetadataApi().putEntry(vm.getHref(), key, metadataValue);
|
||||
vmApi.getMetadataApi(vmUrn).putEntry(key, metadataValue);
|
||||
|
||||
// Call the method being tested
|
||||
MetadataValue metadataValue = vmApi.getMetadataApi().getValue(vm.getHref(), key);
|
||||
MetadataValue metadataValue = vmApi.getMetadataApi(vmUrn).getValue(key);
|
||||
|
||||
String expected = metadataValue.getValue();
|
||||
|
||||
|
@ -960,11 +959,11 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
@Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
|
||||
public void testRemoveMetadataEntry() {
|
||||
// Delete the entry
|
||||
Task task = vmApi.getMetadataApi().removeEntry(vm.getHref(), key);
|
||||
Task task = vmApi.getMetadataApi(vmUrn).removeEntry(key);
|
||||
retryTaskSuccess.apply(task);
|
||||
|
||||
// Confirm the entry has been removed
|
||||
Metadata newMetadata = vmApi.getMetadataApi().get(vm.getHref());
|
||||
Metadata newMetadata = vmApi.getMetadataApi(vmUrn).get();
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkMetadataKeyAbsentFor(VM, newMetadata, key);
|
||||
|
@ -972,18 +971,18 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
|
||||
@Test(description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
|
||||
public void testMergeMetadata() {
|
||||
Metadata oldMetadata = vmApi.getMetadataApi().get(vm.getHref());
|
||||
Metadata oldMetadata = vmApi.getMetadataApi(vmUrn).get();
|
||||
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
|
||||
|
||||
// Store a value, to be removed
|
||||
String key = name("key-");
|
||||
String value = name("value-");
|
||||
Metadata addedMetadata = Metadata.builder().entry(MetadataEntry.builder().key(key).value(value).build()).build();
|
||||
Task task = vmApi.getMetadataApi().merge(vm.getHref(), addedMetadata);
|
||||
Task task = vmApi.getMetadataApi(vmUrn).merge(addedMetadata);
|
||||
retryTaskSuccess.apply(task);
|
||||
|
||||
// Confirm the entry contains everything that was there, and everything that was being added
|
||||
Metadata newMetadata = vmApi.getMetadataApi().get(vm.getHref());
|
||||
Metadata newMetadata = vmApi.getMetadataApi(vmUrn).get();
|
||||
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
|
||||
.put(key, value).build();
|
||||
|
||||
|
@ -992,7 +991,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see VmApi#remove(URI)
|
||||
* @see VmApi#remove(String)
|
||||
*/
|
||||
@Test(description = "DELETE /vApp/{id}")
|
||||
public void testRemoveVm() {
|
||||
|
@ -1001,27 +1000,27 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
DeployVAppParams params = DeployVAppParams.builder()
|
||||
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
|
||||
.powerOn().build();
|
||||
Task deployVApp = vAppApi.deploy(remove.getHref(), params);
|
||||
Task deployVApp = vAppApi.deploy(remove.getId(), params);
|
||||
assertTaskSucceedsLong(deployVApp);
|
||||
|
||||
// Get the edited VApp and the Vm
|
||||
remove = vAppApi.getVApp(remove.getHref());
|
||||
remove = vAppApi.get(remove.getId());
|
||||
List<Vm> vms = remove.getChildren().getVms();
|
||||
Vm temp = Iterables.get(vms, 0);
|
||||
|
||||
// otherwise it's impossible to stop a running vApp with no vms
|
||||
if (vms.size() == 1) {
|
||||
UndeployVAppParams undeployParams = UndeployVAppParams.builder().build();
|
||||
Task shutdownVapp = vAppApi.undeploy(remove.getHref(), undeployParams);
|
||||
Task shutdownVapp = vAppApi.undeploy(remove.getId(), undeployParams);
|
||||
assertTaskSucceedsLong(shutdownVapp);
|
||||
} else {
|
||||
powerOffVm(temp.getHref());
|
||||
powerOffVm(temp.getId());
|
||||
}
|
||||
// The method under test
|
||||
Task removeVm = vmApi.remove(temp.getHref());
|
||||
Task removeVm = vmApi.remove(temp.getId());
|
||||
assertTrue(retryTaskSuccess.apply(removeVm), String.format(TASK_COMPLETE_TIMELY, "removeVm"));
|
||||
|
||||
Vm removed = vmApi.get(temp.getHref());
|
||||
Vm removed = vmApi.get(temp.getId());
|
||||
assertNull(removed, "The Vm " + temp.getName() + " should have been removed");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,14 +60,14 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
@BeforeClass(alwaysRun = true)
|
||||
public void setupRequiredApis() {
|
||||
vdcApi = adminContext.getApi().getVdcApi();
|
||||
metadataApi = vdcApi.getMetadataApi();
|
||||
metadataApi = vdcApi.getMetadataApi(vdcUrn);
|
||||
}
|
||||
|
||||
@AfterClass(alwaysRun = true)
|
||||
public void cleanUp() throws Exception {
|
||||
if (metadataKey != null) {
|
||||
try {
|
||||
Task task = metadataApi.removeEntry(lazyGetVdc().getHref(), metadataKey);
|
||||
Task task = metadataApi.removeEntry(metadataKey);
|
||||
taskDoneEventually(task);
|
||||
} catch (VCloudDirectorException e) {
|
||||
logger.warn(e, "Error deleting metadata-value (perhaps it doesn't exist?); continuing...");
|
||||
|
@ -161,7 +161,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
|
||||
@Test(description = "GET /admin/vdc/{id}/metadata")
|
||||
public void testGetMetadata() throws Exception {
|
||||
Metadata metadata = metadataApi.get(lazyGetVdc().getHref());
|
||||
Metadata metadata = metadataApi.get();
|
||||
|
||||
Checks.checkMetadata(metadata);
|
||||
}
|
||||
|
@ -174,10 +174,10 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
Metadata metadata = Metadata.builder().entry(MetadataEntry.builder().entry(metadataKey, metadataValue).build())
|
||||
.build();
|
||||
|
||||
Task task = metadataApi.merge(lazyGetVdc().getHref(), metadata);
|
||||
Task task = metadataApi.merge(metadata);
|
||||
assertTaskSucceeds(task);
|
||||
|
||||
MetadataValue modified = metadataApi.getValue(lazyGetVdc().getHref(), metadataKey);
|
||||
MetadataValue modified = metadataApi.getValue(metadataKey);
|
||||
Checks.checkMetadataValueFor("AdminVdc", modified, metadataValue);
|
||||
Checks.checkMetadata(metadata);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
// TODO insufficient permissions to test
|
||||
@Test(description = "GET /admin/vdc/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadata" }, enabled = false)
|
||||
public void testGetMetadataValue() throws Exception {
|
||||
MetadataValue retrievedMetadataValue = metadataApi.getValue(lazyGetVdc().getHref(), metadataKey);
|
||||
MetadataValue retrievedMetadataValue = metadataApi.getValue(metadataKey);
|
||||
|
||||
Checks.checkMetadataValueFor("AdminVdc", retrievedMetadataValue, metadataValue);
|
||||
}
|
||||
|
@ -196,10 +196,10 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
metadataValue = name("value-");
|
||||
MetadataValue newV = MetadataValue.builder().value(metadataValue).build();
|
||||
|
||||
Task task = metadataApi.putEntry(lazyGetVdc().getHref(), metadataKey, newV);
|
||||
Task task = metadataApi.putEntry(metadataKey, newV);
|
||||
assertTaskSucceeds(task);
|
||||
|
||||
MetadataValue retrievedMetadataValue = metadataApi.getValue(lazyGetVdc().getHref(), metadataKey);
|
||||
MetadataValue retrievedMetadataValue = metadataApi.getValue(metadataKey);
|
||||
Checks.checkMetadataValueFor("AdminVdc", retrievedMetadataValue, metadataValue);
|
||||
}
|
||||
|
||||
|
@ -208,11 +208,11 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
public void testRemoveMetadataValue() throws Exception {
|
||||
// TODO Remove dependency on other tests; make cleanUp remove a list of metadata entries?
|
||||
|
||||
Task task = metadataApi.removeEntry(lazyGetVdc().getHref(), metadataKey);
|
||||
Task task = metadataApi.removeEntry(metadataKey);
|
||||
assertTaskSucceeds(task);
|
||||
|
||||
try {
|
||||
metadataApi.getValue(lazyGetVdc().getHref(), metadataKey);
|
||||
metadataApi.getValue(metadataKey);
|
||||
fail("Retrieval of metadata value " + metadataKey + " should have fail after deletion");
|
||||
} catch (VCloudDirectorException e) {
|
||||
// success; should not be accessible
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.vcloud.director.v1_5.internal;
|
||||
|
||||
import static com.google.common.base.Strings.emptyToNull;
|
||||
import static com.google.common.collect.FluentIterable.from;
|
||||
import static com.google.common.collect.Iterables.any;
|
||||
import static com.google.common.collect.Iterables.find;
|
||||
import static com.google.common.collect.Iterables.getFirst;
|
||||
|
@ -33,6 +32,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK;
|
|||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ORG_NETWORK;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.USER;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP_TEMPLATE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VDC;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
@ -61,6 +61,7 @@ import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
|
|||
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncApi;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link.Rel;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ResourceEntity.Status;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Role.DefaultRoles;
|
||||
|
@ -83,7 +84,6 @@ import org.jclouds.vcloud.director.v1_5.features.TaskApi;
|
|||
import org.jclouds.vcloud.director.v1_5.features.VAppApi;
|
||||
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateApi;
|
||||
import org.jclouds.vcloud.director.v1_5.features.VdcApi;
|
||||
import org.jclouds.vcloud.director.v1_5.predicates.EntityPredicates;
|
||||
import org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates;
|
||||
import org.jclouds.vcloud.director.v1_5.predicates.ReferencePredicates;
|
||||
import org.jclouds.vcloud.director.v1_5.predicates.TaskStatusEquals;
|
||||
|
@ -96,10 +96,13 @@ import org.testng.annotations.Listeners;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
@ -128,13 +131,17 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
public Predicate<Task> retryTaskSuccessLong;
|
||||
|
||||
protected RestContext<VCloudDirectorAdminApi, VCloudDirectorAdminAsyncApi> adminContext;
|
||||
protected RestContext<VCloudDirectorApi, VCloudDirectorAsyncApi> context; // FIXME: rename to userContext?
|
||||
protected RestContext<VCloudDirectorApi, VCloudDirectorAsyncApi> context; // FIXME: rename to
|
||||
// userContext?
|
||||
protected Session adminSession;
|
||||
protected Session session;
|
||||
|
||||
protected String orgUrn;
|
||||
protected Org org;
|
||||
protected String catalogUrn;
|
||||
private Catalog catalog;
|
||||
protected URI vAppTemplateURI;
|
||||
protected String vAppTemplateUrn;
|
||||
private VAppTemplate vAppTemplate;
|
||||
protected URI mediaURI;
|
||||
protected String networkUrn;
|
||||
private Network network;
|
||||
|
@ -154,8 +161,6 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
|
||||
protected VCloudDirectorTestSession testSession;
|
||||
|
||||
protected Org org;
|
||||
|
||||
protected static String testStamp;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
|
@ -185,13 +190,8 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
@Override
|
||||
protected void initializeContext() {
|
||||
Properties overrides = setupProperties();
|
||||
testSession = VCloudDirectorTestSession.builder()
|
||||
.provider(provider)
|
||||
.identity(identity)
|
||||
.credential(credential)
|
||||
.endpoint(endpoint)
|
||||
.overrides(overrides)
|
||||
.build();
|
||||
testSession = VCloudDirectorTestSession.builder().provider(provider).identity(identity).credential(credential)
|
||||
.endpoint(endpoint).overrides(overrides).build();
|
||||
|
||||
context = testSession.getUserContext();
|
||||
adminContext = testSession.getAdminContext();
|
||||
|
@ -220,10 +220,12 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
return getRoleReferenceFor(name, adminContext);
|
||||
}
|
||||
|
||||
public static Reference getRoleReferenceFor(String name, RestContext<VCloudDirectorAdminApi, VCloudDirectorAdminAsyncApi> adminContext) {
|
||||
public static Reference getRoleReferenceFor(String name,
|
||||
RestContext<VCloudDirectorAdminApi, VCloudDirectorAdminAsyncApi> adminContext) {
|
||||
RoleReferences roles = adminContext.getApi().getQueryApi().roleReferencesQueryAll();
|
||||
// backend in a builder to strip out unwanted xml cruft that the api chokes on
|
||||
return Reference.builder().fromReference(find(roles.getReferences(), ReferencePredicates.nameEquals(name))).build();
|
||||
return Reference.builder().fromReference(find(roles.getReferences(), ReferencePredicates.nameEquals(name)))
|
||||
.build();
|
||||
}
|
||||
|
||||
public User randomTestUser(String prefix) {
|
||||
|
@ -231,29 +233,16 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
}
|
||||
|
||||
public User randomTestUser(String prefix, Reference role) {
|
||||
return User.builder()
|
||||
.name(name(prefix)+getTestDateTimeStamp())
|
||||
.fullName("testFullName")
|
||||
.emailAddress("test@test.com")
|
||||
.telephone("555-1234")
|
||||
.isEnabled(false)
|
||||
.im("testIM")
|
||||
.isAlertEnabled(false)
|
||||
.alertEmailPrefix("testPrefix")
|
||||
.alertEmail("testAlert@test.com")
|
||||
.isExternal(false)
|
||||
.isGroupRole(false)
|
||||
.role(role)
|
||||
.password("password")
|
||||
.build();
|
||||
return User.builder().name(name(prefix) + getTestDateTimeStamp()).fullName("testFullName")
|
||||
.emailAddress("test@test.com").telephone("555-1234").isEnabled(false).im("testIM").isAlertEnabled(false)
|
||||
.alertEmailPrefix("testPrefix").alertEmail("testAlert@test.com").isExternal(false).isGroupRole(false)
|
||||
.role(role).password("password").build();
|
||||
}
|
||||
|
||||
protected void initTestParametersFromPropertiesOrLazyDiscover() {
|
||||
catalogUrn = emptyToNull(System.getProperty("test." + provider + ".catalog-id"));
|
||||
|
||||
String vAppTemplateId = emptyToNull(System.getProperty("test." + provider + ".vapptemplate-id"));
|
||||
if (vAppTemplateId != null)
|
||||
vAppTemplateURI = URI.create(endpoint + "/vAppTemplate/" + vAppTemplateId);
|
||||
vAppTemplateUrn = emptyToNull(System.getProperty("test." + provider + ".vapptemplate-id"));
|
||||
|
||||
vdcUrn = emptyToNull(System.getProperty("test." + provider + ".vdc-id"));
|
||||
|
||||
|
@ -265,43 +254,132 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
|
||||
userUrn = emptyToNull(System.getProperty("test." + provider + ".user-id"));
|
||||
|
||||
org = context.getApi().getOrgApi().get(
|
||||
find(context.getApi().getOrgApi().list(),
|
||||
ReferencePredicates.<Reference> nameEquals(session.get())).getHref());
|
||||
org = context
|
||||
.getApi()
|
||||
.getOrgApi()
|
||||
.get(find(context.getApi().getOrgApi().list(), ReferencePredicates.<Reference> nameEquals(session.get()))
|
||||
.getHref());
|
||||
orgUrn = org.getId();
|
||||
|
||||
if (any(Lists.newArrayList(vAppTemplateURI, networkUrn, vdcUrn), Predicates.isNull())) {
|
||||
if (any(Lists.newArrayList(vAppTemplateUrn, networkUrn, vdcUrn), Predicates.isNull())) {
|
||||
|
||||
if (vdcUrn == null) {
|
||||
vdc = context.getApi().getVdcApi().get(find(org.getLinks(),
|
||||
ReferencePredicates.<Link> typeEquals(VDC)).getHref());
|
||||
vdc = context.getApi().getVdcApi()
|
||||
.get(find(org.getLinks(), ReferencePredicates.<Link> typeEquals(VDC)).getHref());
|
||||
vdcUrn = vdc.getId();
|
||||
|
||||
if (vAppTemplateUrn == null) {
|
||||
Reference vAppTemplateRef = Iterables.find(vdc.getResourceEntities(),
|
||||
ReferencePredicates.<Reference> typeEquals(VAPP_TEMPLATE));
|
||||
vAppTemplate = context.getApi().getVAppTemplateApi().get(vAppTemplateRef.getHref());
|
||||
vAppTemplateUrn = vAppTemplate.getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (networkUrn == null) {
|
||||
network = context.getApi().getNetworkApi().get(find(org.getLinks(),
|
||||
ReferencePredicates.<Link> typeEquals(ORG_NETWORK)).getHref());
|
||||
networkUrn = network.getId();
|
||||
Optional<Network> optionalNetwork = tryFindBridgedNetworkInOrg();
|
||||
if (optionalNetwork.isPresent()) {
|
||||
network = optionalNetwork.get();
|
||||
networkUrn = network.getId();
|
||||
}
|
||||
}
|
||||
|
||||
if (catalogUrn == null) {
|
||||
catalog = context.getApi().getCatalogApi().get(find(org.getLinks(),
|
||||
ReferencePredicates.<Link> typeEquals(CATALOG)).getHref());
|
||||
catalogUrn = catalog.getId();
|
||||
Optional<Catalog> optionalCatalog = tryFindWritableCatalogInOrg();
|
||||
if (optionalCatalog.isPresent()) {
|
||||
catalog = optionalCatalog.get();
|
||||
catalogUrn = catalog.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Function<Catalog, String> prettyCatalog = new Function<Catalog, String>() {
|
||||
|
||||
@Override
|
||||
public String apply(Catalog input) {
|
||||
return Objects.toStringHelper("").omitNullValues().add("name", input.getName()).add("id", input.getId())
|
||||
.add("owner", input.getOwner()).add("isPublished", input.isPublished()).toString();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* If I can add to a catalog, I can write to it
|
||||
*/
|
||||
public Optional<Catalog> tryFindWritableCatalogInOrg() {
|
||||
FluentIterable<Catalog> catalogs = FluentIterable.from(org.getLinks())
|
||||
.filter(ReferencePredicates.<Link> typeEquals(CATALOG)).transform(new Function<Link, Catalog>() {
|
||||
@Override
|
||||
public Catalog apply(Link in) {
|
||||
return context.getApi().getCatalogApi().get(in.getHref());
|
||||
}
|
||||
});
|
||||
|
||||
Optional<Catalog> optionalCatalog = tryFind(catalogs, new Predicate<Catalog>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(Catalog input) {
|
||||
return Iterables.any(input.getLinks(), LinkPredicates.relEquals(Rel.ADD));
|
||||
}
|
||||
|
||||
});
|
||||
if (optionalCatalog.isPresent()) {
|
||||
Logger.CONSOLE.info("found catalog: %s", prettyCatalog.apply(optionalCatalog.get()));
|
||||
} else {
|
||||
Logger.CONSOLE.warn("%s doesn't own any catalogs in org %s; catalogs: %s", context.getApi()
|
||||
.getCurrentSession().getUser(), org.getName(), Iterables.transform(catalogs, prettyCatalog));
|
||||
}
|
||||
return optionalCatalog;
|
||||
}
|
||||
|
||||
Function<Network, String> prettyNetwork = new Function<Network, String>() {
|
||||
|
||||
@Override
|
||||
public String apply(Network input) {
|
||||
return Objects.toStringHelper("").omitNullValues().add("name", input.getName()).add("id", input.getId())
|
||||
.add("fenceMode", input.getConfiguration().getFenceMode())
|
||||
.add("taskCount", input.getTasks().size() > 0 ? input.getTasks().size() : null).toString();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public Optional<Network> tryFindBridgedNetworkInOrg() {
|
||||
FluentIterable<Network> networks = FluentIterable.from(org.getLinks())
|
||||
.filter(ReferencePredicates.<Link> typeEquals(ORG_NETWORK)).transform(new Function<Link, Network>() {
|
||||
@Override
|
||||
public Network apply(Link in) {
|
||||
return context.getApi().getNetworkApi().get(in.getHref());
|
||||
}
|
||||
});
|
||||
|
||||
Optional<Network> optionalNetwork = tryFind(networks, new Predicate<Network>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(Network input) {
|
||||
if (input.getConfiguration().getFenceMode().equals(Network.FenceMode.BRIDGED)) {
|
||||
if (input.getTasks().size() == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
if (optionalNetwork.isPresent()) {
|
||||
Logger.CONSOLE.info("found network: %s", prettyNetwork.apply(optionalNetwork.get()));
|
||||
} else {
|
||||
Logger.CONSOLE.warn("no ready bridged networks present in org %s; networks: %s", org.getName(),
|
||||
Iterables.transform(networks, prettyNetwork));
|
||||
}
|
||||
return optionalNetwork;
|
||||
}
|
||||
|
||||
protected Vdc lazyGetVdc() {
|
||||
if (vdc == null) {
|
||||
assertNotNull(vdcUrn, String.format(URN_REQ_LIVE, VDC));
|
||||
vdc = from(org.getLinks()).filter(LinkPredicates.typeEquals(VDC))
|
||||
.transform(new Function<Link, Vdc>() {
|
||||
|
||||
@Override
|
||||
public Vdc apply(Link in) {
|
||||
return context.getApi().getVdcApi().get(in.getHref());
|
||||
}
|
||||
}).firstMatch(EntityPredicates.idEquals(vdcUrn)).get();
|
||||
vdc = context.getApi().getVdcApi().get(vdcUrn);
|
||||
assertNotNull(vdc, String.format(ENTITY_NON_NULL, VDC));
|
||||
}
|
||||
return vdc;
|
||||
|
@ -310,14 +388,7 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
protected Network lazyGetNetwork() {
|
||||
if (network == null) {
|
||||
assertNotNull(networkUrn, String.format(URN_REQ_LIVE, NETWORK));
|
||||
network = from(org.getLinks()).filter(LinkPredicates.typeEquals(ORG_NETWORK))
|
||||
.transform(new Function<Link, Network>() {
|
||||
|
||||
@Override
|
||||
public Network apply(Link in) {
|
||||
return context.getApi().getNetworkApi().get(in.getHref());
|
||||
}
|
||||
}).firstMatch(EntityPredicates.idEquals(networkUrn)).get();
|
||||
network = context.getApi().getNetworkApi().get(networkUrn);
|
||||
assertNotNull(network, String.format(ENTITY_NON_NULL, NETWORK));
|
||||
}
|
||||
return network;
|
||||
|
@ -326,14 +397,7 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
protected Catalog lazyGetCatalog() {
|
||||
if (catalog == null) {
|
||||
assertNotNull(catalogUrn, String.format(URN_REQ_LIVE, CATALOG));
|
||||
catalog = from(org.getLinks()).filter(LinkPredicates.typeEquals(CATALOG))
|
||||
.transform(new Function<Link, Catalog>() {
|
||||
|
||||
@Override
|
||||
public Catalog apply(Link in) {
|
||||
return context.getApi().getCatalogApi().get(in.getHref());
|
||||
}
|
||||
}).firstMatch(EntityPredicates.idEquals(catalogUrn)).get();
|
||||
catalog = context.getApi().getCatalogApi().get(catalogUrn);
|
||||
assertNotNull(catalog, String.format(ENTITY_NON_NULL, CATALOG));
|
||||
}
|
||||
return catalog;
|
||||
|
@ -348,6 +412,15 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
return user;
|
||||
}
|
||||
|
||||
protected VAppTemplate lazyGetVAppTemplate() {
|
||||
if (vAppTemplate == null) {
|
||||
assertNotNull(vAppTemplateUrn, String.format(URN_REQ_LIVE, VAPP_TEMPLATE));
|
||||
vAppTemplate = adminContext.getApi().getVAppTemplateApi().get(vAppTemplateUrn);
|
||||
assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE));
|
||||
}
|
||||
return vAppTemplate;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public URI toAdminUri(Reference ref) {
|
||||
return toAdminUri(ref.getHref());
|
||||
|
@ -369,32 +442,32 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
protected boolean taskStatusEventually(Task task, Task.Status running, ImmutableSet<Task.Status> immutableSet) {
|
||||
TaskApi taskApi = context.getApi().getTaskApi();
|
||||
TaskStatusEquals predicate = new TaskStatusEquals(taskApi, running, immutableSet);
|
||||
RetryablePredicate<Task> retryablePredicate = new RetryablePredicate<Task>(predicate, TASK_TIMEOUT_SECONDS * 1000L);
|
||||
RetryablePredicate<Task> retryablePredicate = new RetryablePredicate<Task>(predicate,
|
||||
TASK_TIMEOUT_SECONDS * 1000L);
|
||||
return retryablePredicate.apply(task);
|
||||
}
|
||||
|
||||
protected void assertTaskStatusEventually(Task task, Task.Status running, ImmutableSet<Task.Status> immutableSet) {
|
||||
assertTrue(taskStatusEventually(task, running, immutableSet),
|
||||
String.format("Task '%s' must reach status %s", task.getOperationName(), running));
|
||||
String.format("Task '%s' must reach status %s", task.getOperationName(), running));
|
||||
}
|
||||
|
||||
protected boolean taskDoneEventually(Task task) {
|
||||
TaskApi taskApi = context.getApi().getTaskApi();
|
||||
TaskStatusEquals predicate = new TaskStatusEquals(
|
||||
taskApi,
|
||||
ImmutableSet.of(Task.Status.ABORTED, Task.Status.CANCELED, Task.Status.ERROR, Task.Status.SUCCESS),
|
||||
Collections.<Task.Status>emptySet());
|
||||
RetryablePredicate<Task> retryablePredicate = new RetryablePredicate<Task>(predicate, LONG_TASK_TIMEOUT_SECONDS * 1000L);
|
||||
TaskStatusEquals predicate = new TaskStatusEquals(taskApi, ImmutableSet.of(Task.Status.ABORTED,
|
||||
Task.Status.CANCELED, Task.Status.ERROR, Task.Status.SUCCESS), Collections.<Task.Status> emptySet());
|
||||
RetryablePredicate<Task> retryablePredicate = new RetryablePredicate<Task>(predicate,
|
||||
LONG_TASK_TIMEOUT_SECONDS * 1000L);
|
||||
return retryablePredicate.apply(task);
|
||||
}
|
||||
|
||||
protected void assertTaskDoneEventually(Task task) {
|
||||
assertTrue(taskDoneEventually(task),
|
||||
String.format("Task '%s' must complete", task.getOperationName()));
|
||||
assertTrue(taskDoneEventually(task), String.format("Task '%s' must complete", task.getOperationName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate a {@link VApp} in a {@link Vdc} using the {@link VAppTemplate} we have configured for the tests.
|
||||
* Instantiate a {@link VApp} in a {@link Vdc} using the {@link VAppTemplate} we have configured
|
||||
* for the tests.
|
||||
*
|
||||
* @return the VApp that is being instantiated
|
||||
*/
|
||||
|
@ -403,21 +476,17 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
}
|
||||
|
||||
protected VApp instantiateVApp(String name) {
|
||||
InstantiateVAppTemplateParams instantiate = InstantiateVAppTemplateParams.builder()
|
||||
.name(name)
|
||||
.notDeploy()
|
||||
.notPowerOn()
|
||||
.description("Test VApp")
|
||||
.instantiationParams(instantiationParams())
|
||||
.source(Reference.builder().href(vAppTemplateURI).build())
|
||||
.build();
|
||||
InstantiateVAppTemplateParams instantiate = InstantiateVAppTemplateParams.builder().name(name).notDeploy()
|
||||
.notPowerOn().description("Test VApp").instantiationParams(instantiationParams())
|
||||
.source(Reference.builder().href(lazyGetVAppTemplate().getHref()).build()).build();
|
||||
|
||||
VdcApi vdcApi = context.getApi().getVdcApi();
|
||||
VApp vAppInstantiated = vdcApi.instantiateVApp(vdcUrn, instantiate);
|
||||
assertNotNull(vAppInstantiated, String.format(ENTITY_NON_NULL, VAPP));
|
||||
|
||||
Task instantiationTask = getFirst(vAppInstantiated.getTasks(), null);
|
||||
if (instantiationTask != null) assertTaskSucceedsLong(instantiationTask);
|
||||
if (instantiationTask != null)
|
||||
assertTaskSucceedsLong(instantiationTask);
|
||||
|
||||
// Save VApp name for cleanUp
|
||||
vAppNames.add(name);
|
||||
|
@ -428,23 +497,19 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
/** Build an {@link InstantiationParams} object. */
|
||||
protected InstantiationParams instantiationParams() {
|
||||
InstantiationParams instantiationParams = InstantiationParams.builder()
|
||||
.sections(ImmutableSet.of(networkConfigSection()))
|
||||
.build();
|
||||
.sections(ImmutableSet.of(networkConfigSection())).build();
|
||||
|
||||
return instantiationParams;
|
||||
}
|
||||
|
||||
/** Build a {@link NetworkConfigSection} object. */
|
||||
private NetworkConfigSection networkConfigSection() {
|
||||
NetworkConfigSection networkConfigSection = NetworkConfigSection.builder()
|
||||
.info("Configuration parameters for logical networks")
|
||||
.networkConfigs(
|
||||
ImmutableSet.of(
|
||||
VAppNetworkConfiguration.builder()
|
||||
.networkName("vAppNetwork")
|
||||
.configuration(networkConfiguration())
|
||||
.build()))
|
||||
.build();
|
||||
NetworkConfigSection networkConfigSection = NetworkConfigSection
|
||||
.builder()
|
||||
.info("Configuration parameters for logical networks")
|
||||
.networkConfigs(
|
||||
ImmutableSet.of(VAppNetworkConfiguration.builder().networkName("vAppNetwork")
|
||||
.configuration(networkConfiguration()).build())).build();
|
||||
|
||||
return networkConfigSection;
|
||||
}
|
||||
|
@ -470,10 +535,8 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
}
|
||||
|
||||
// Build the configuration object
|
||||
NetworkConfiguration networkConfiguration = NetworkConfiguration.builder()
|
||||
.parentNetwork(parentNetwork.get())
|
||||
.fenceMode(Network.FenceMode.BRIDGED)
|
||||
.build();
|
||||
NetworkConfiguration networkConfiguration = NetworkConfiguration.builder().parentNetwork(parentNetwork.get())
|
||||
.fenceMode(Network.FenceMode.BRIDGED).build();
|
||||
|
||||
return networkConfiguration;
|
||||
}
|
||||
|
@ -481,27 +544,23 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
protected void cleanUpVAppTemplate(VAppTemplate vAppTemplate) {
|
||||
VAppTemplateApi vappTemplateApi = context.getApi().getVAppTemplateApi();
|
||||
try {
|
||||
Task task = vappTemplateApi.removeVappTemplate(vAppTemplate.getHref());
|
||||
taskDoneEventually(task);
|
||||
Task task = vappTemplateApi.remove(vAppTemplate.getId());
|
||||
taskDoneEventually(task);
|
||||
} catch (Exception e) {
|
||||
logger.warn(e, "Error deleting template '%s'", vAppTemplate.getName());
|
||||
}
|
||||
}
|
||||
|
||||
protected void cleanUpVApp(VApp vApp) {
|
||||
cleanUpVApp(vApp.getHref());
|
||||
}
|
||||
|
||||
// TODO code tidy for cleanUpVApp? Seems extremely verbose!
|
||||
protected void cleanUpVApp(URI vAppURI) {
|
||||
protected void cleanUpVApp(VApp vApp) {
|
||||
VAppApi vAppApi = context.getApi().getVAppApi();
|
||||
|
||||
VApp vApp = vAppApi.getVApp(vAppURI); // Refresh
|
||||
String vAppUrn = vApp.getId();
|
||||
vApp = vAppApi.get(vAppUrn); // Refresh
|
||||
if (vApp == null) {
|
||||
logger.info("Cannot find VApp at %s", vAppURI.getPath());
|
||||
logger.info("Cannot find VApp at %s", vAppUrn);
|
||||
return; // Presumably vApp has already been removed. Ignore.
|
||||
}
|
||||
logger.debug("Deleting VApp %s (%s)", vApp.getName(), vAppURI.getPath());
|
||||
logger.debug("Deleting VApp %s (%s)", vApp.getName(), vAppUrn);
|
||||
|
||||
// Wait for busy tasks to complete (don't care if it's failed or successful)
|
||||
// Otherwise, get error on remove "entity is busy completing an operation.
|
||||
|
@ -516,7 +575,7 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
// Shutdown and power off the VApp if necessary
|
||||
if (vApp.getStatus() == Status.POWERED_ON) {
|
||||
try {
|
||||
Task shutdownTask = vAppApi.shutdown(vAppURI);
|
||||
Task shutdownTask = vAppApi.shutdown(vAppUrn);
|
||||
taskDoneEventually(shutdownTask);
|
||||
} catch (Exception e) {
|
||||
// keep going; cleanup as much as possible
|
||||
|
@ -528,9 +587,8 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
if (vApp.isDeployed()) {
|
||||
try {
|
||||
UndeployVAppParams params = UndeployVAppParams.builder()
|
||||
.undeployPowerAction(UndeployVAppParams.PowerAction.SHUTDOWN)
|
||||
.build();
|
||||
Task undeployTask = vAppApi.undeploy(vAppURI, params);
|
||||
.undeployPowerAction(UndeployVAppParams.PowerAction.SHUTDOWN).build();
|
||||
Task undeployTask = vAppApi.undeploy(vAppUrn, params);
|
||||
taskDoneEventually(undeployTask);
|
||||
} catch (Exception e) {
|
||||
// keep going; cleanup as much as possible
|
||||
|
@ -539,13 +597,13 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
|
|||
}
|
||||
|
||||
try {
|
||||
Task task = vAppApi.removeVApp(vAppURI);
|
||||
Task task = vAppApi.remove(vAppUrn);
|
||||
taskDoneEventually(task);
|
||||
vAppNames.remove(vApp.getName());
|
||||
logger.info("Deleted VApp %s", vApp.getName());
|
||||
} catch (Exception e) {
|
||||
vApp = vAppApi.getVApp(vAppURI); // Refresh
|
||||
logger.warn(e, "Deleting VApp %s failed (%s)", vApp.getName(), vAppURI.getPath());
|
||||
vApp = vAppApi.get(vApp.getId()); // Refresh
|
||||
logger.warn(e, "Deleting VApp %s failed (%s)", vApp.getName(), vAppUrn);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue