Merge pull request #1158 from jclouds/vcloud-redundant-metadata

removed redundant metadata clients from vcloud-director
This commit is contained in:
Adrian Cole 2013-01-08 22:02:49 -08:00
commit 145c2a750c
72 changed files with 688 additions and 1560 deletions

View File

@ -18,7 +18,18 @@
*/ */
package org.jclouds.vcloud.director.v1_5.admin; package org.jclouds.vcloud.director.v1_5.admin;
import java.net.URI;
import org.jclouds.rest.annotations.Delegate; 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.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.Group;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.User;
import org.jclouds.vcloud.director.v1_5.domain.network.Network;
import org.jclouds.vcloud.director.v1_5.domain.org.AdminOrg;
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogApi; import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkApi; import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgApi; import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgApi;
@ -26,7 +37,9 @@ import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcApi; import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcApi;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupApi; import org.jclouds.vcloud.director.v1_5.features.admin.GroupApi;
import org.jclouds.vcloud.director.v1_5.features.admin.UserApi; import org.jclouds.vcloud.director.v1_5.features.admin.UserApi;
import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi; import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
/** /**
* Provides synchronous access to VCloudDirector Admin. * Provides synchronous access to VCloudDirector Admin.
@ -81,4 +94,15 @@ public interface VCloudDirectorAdminApi extends VCloudDirectorApi {
@Override @Override
@Delegate @Delegate
AdminNetworkApi getNetworkApi(); AdminNetworkApi getNetworkApi();
/**
* @return synchronous access to {@link Metadata} features
*/
@Override
@Delegate
MetadataApi getMetadataApi(@EndpointParam(parser = URNToAdminHref.class) String urn);
@Override
@Delegate
MetadataApi getMetadataApi(@EndpointParam URI href);
} }

View File

@ -18,8 +18,19 @@
*/ */
package org.jclouds.vcloud.director.v1_5.admin; package org.jclouds.vcloud.director.v1_5.admin;
import java.net.URI;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.AdminVdc;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.Group;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.User;
import org.jclouds.vcloud.director.v1_5.domain.network.Network;
import org.jclouds.vcloud.director.v1_5.domain.org.AdminOrg;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncApi; import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncApi; import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncApi; import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncApi;
@ -28,6 +39,7 @@ import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupAsyncApi; import org.jclouds.vcloud.director.v1_5.features.admin.GroupAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.UserAsyncApi; import org.jclouds.vcloud.director.v1_5.features.admin.UserAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi; import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
/** /**
@ -85,4 +97,15 @@ public interface VCloudDirectorAdminAsyncApi extends VCloudDirectorAsyncApi {
@Override @Override
@Delegate @Delegate
AdminNetworkAsyncApi getNetworkApi(); AdminNetworkAsyncApi getNetworkApi();
/**
* @return asynchronous access to {@link Metadata} features
*/
@Override
@Delegate
MetadataAsyncApi getMetadataApi(@EndpointParam(parser = URNToAdminHref.class) String urn);
@Override
@Delegate
MetadataAsyncApi getMetadataApi(@EndpointParam URI href);
} }

View File

@ -113,8 +113,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
public static final Map<Class<?>, Class<?>> USER_DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>>builder() public static final Map<Class<?>, Class<?>> USER_DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>>builder()
.put(CatalogApi.class, CatalogAsyncApi.class) .put(CatalogApi.class, CatalogAsyncApi.class)
.put(MediaApi.class, MediaAsyncApi.class) .put(MediaApi.class, MediaAsyncApi.class)
.put(MetadataApi.Readable.class, MetadataAsyncApi.Readable.class) .put(MetadataApi.class, MetadataAsyncApi.class)
.put(MetadataApi.Writeable.class, MetadataAsyncApi.Writeable.class)
.put(NetworkApi.class, NetworkAsyncApi.class) .put(NetworkApi.class, NetworkAsyncApi.class)
.put(OrgApi.class, OrgAsyncApi.class) .put(OrgApi.class, OrgAsyncApi.class)
.put(QueryApi.class, QueryAsyncApi.class) .put(QueryApi.class, QueryAsyncApi.class)

View File

@ -19,12 +19,9 @@
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI; import java.net.URI;
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.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem; import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
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. * Provides synchronous access to {@link Catalog} objects.
@ -111,23 +108,4 @@ public interface CatalogApi {
void removeItem(String catalogItemUrn); void removeItem(String catalogItemUrn);
void removeItem(URI catalogItemHref); void removeItem(URI catalogItemHref);
/**
* @return synchronous access to {@link Metadata.Readable} features
*/
@Delegate
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(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
@Delegate
MetadataApi.Writeable getItemMetadataApi(@EndpointParam URI catalogItemHref);
} }

View File

@ -30,7 +30,6 @@ import javax.ws.rs.Produces;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
@ -40,8 +39,7 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Catalog; 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.CatalogItem;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.CatalogItemURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import org.jclouds.vcloud.director.v1_5.functions.href.CatalogURNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +57,7 @@ public interface CatalogAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Catalog> get(@EndpointParam(parser = CatalogURNToHref.class) String catalogUrn); ListenableFuture<? extends Catalog> get(@EndpointParam(parser = URNToHref.class) String catalogUrn);
/** /**
* @see CatalogApi#addItem(String, CatalogItem) * @see CatalogApi#addItem(String, CatalogItem)
@ -69,7 +67,7 @@ public interface CatalogAsyncApi {
@Consumes(VCloudDirectorMediaType.CATALOG_ITEM) @Consumes(VCloudDirectorMediaType.CATALOG_ITEM)
@Produces(VCloudDirectorMediaType.CATALOG_ITEM) @Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<CatalogItem> addItem(@EndpointParam(parser = CatalogURNToHref.class) String catalogUrn, ListenableFuture<CatalogItem> addItem(@EndpointParam(parser = URNToHref.class) String catalogUrn,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem); @BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/** /**
@ -79,7 +77,7 @@ public interface CatalogAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<CatalogItem> getItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn); ListenableFuture<CatalogItem> getItem(@EndpointParam(parser = URNToHref.class) String catalogItemUrn);
/** /**
* @see CatalogApi#editItem(String, CatalogItem) * @see CatalogApi#editItem(String, CatalogItem)
@ -88,7 +86,7 @@ public interface CatalogAsyncApi {
@Consumes(VCloudDirectorMediaType.CATALOG_ITEM) @Consumes(VCloudDirectorMediaType.CATALOG_ITEM)
@Produces(VCloudDirectorMediaType.CATALOG_ITEM) @Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<CatalogItem> editItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn, ListenableFuture<CatalogItem> editItem(@EndpointParam(parser = URNToHref.class) String catalogItemUrn,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem); @BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/** /**
@ -97,7 +95,7 @@ public interface CatalogAsyncApi {
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> removeItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn); ListenableFuture<Void> removeItem(@EndpointParam(parser = URNToHref.class) String catalogItemUrn);
/** /**
* @see CatalogApi#get(URI) * @see CatalogApi#get(URI)
@ -145,23 +143,4 @@ public interface CatalogAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> removeItem(@EndpointParam URI catalogItemHref); ListenableFuture<Void> removeItem(@EndpointParam URI catalogItemHref);
/**
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = CatalogURNToHref.class) String catalogUrn);
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI catalogItemHref);
/**
* @see CatalogApi#getItemMetadataApi
*/
@Delegate
MetadataAsyncApi.Writeable getItemMetadataApi(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
@Delegate
MetadataAsyncApi.Writeable getItemMetadataApi(@EndpointParam URI catalogItemHref);
} }

View File

@ -19,13 +19,11 @@
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI; import java.net.URI;
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.Media;
import org.jclouds.vcloud.director.v1_5.domain.Owner; 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.Task;
import org.jclouds.vcloud.director.v1_5.domain.params.CloneMediaParams; 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}. * Provides synchronous access to {@link Media}.
@ -88,14 +86,4 @@ public interface MediaApi {
Owner getOwner(String mediaUrn); Owner getOwner(String mediaUrn);
Owner getOwner(URI mediaHref); Owner getOwner(URI mediaHref);
/**
* @return synchronous access to {@link Metadata.Writeable} features
*/
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn);
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam URI mediaHref);
} }

View File

@ -30,7 +30,6 @@ import javax.ws.rs.Produces;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
@ -38,12 +37,11 @@ import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload; import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; 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.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.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Task; 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.domain.params.CloneMediaParams;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.MediaURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +59,7 @@ public interface MediaAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Media> get(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn); ListenableFuture<Media> get(@EndpointParam(parser = URNToHref.class) String mediaUrn);
/** /**
* @see MediaApi#add(URI, Media) * @see MediaApi#add(URI, Media)
@ -80,7 +78,7 @@ public interface MediaAsyncApi {
@Consumes(VCloudDirectorMediaType.MEDIA) @Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.CLONE_MEDIA_PARAMS) @Produces(VCloudDirectorMediaType.CLONE_MEDIA_PARAMS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Media> clone(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn, ListenableFuture<Media> clone(@EndpointParam(parser = URNToHref.class) String mediaUrn,
@BinderParam(BindToXMLPayload.class) CloneMediaParams params); @BinderParam(BindToXMLPayload.class) CloneMediaParams params);
/** /**
@ -90,7 +88,7 @@ public interface MediaAsyncApi {
@Consumes(VCloudDirectorMediaType.TASK) @Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.MEDIA) @Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> edit(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn, ListenableFuture<Task> edit(@EndpointParam(parser = URNToHref.class) String mediaUrn,
@BinderParam(BindToXMLPayload.class) Media media); @BinderParam(BindToXMLPayload.class) Media media);
/** /**
@ -99,7 +97,7 @@ public interface MediaAsyncApi {
@DELETE @DELETE
@Consumes(VCloudDirectorMediaType.TASK) @Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> remove(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn); ListenableFuture<Task> remove(@EndpointParam(parser = URNToHref.class) String mediaUrn);
/** /**
* @see MediaApi#getOwner(String) * @see MediaApi#getOwner(String)
@ -109,7 +107,7 @@ public interface MediaAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn); ListenableFuture<Owner> getOwner(@EndpointParam(parser = URNToHref.class) String mediaUrn);
/** /**
* @see MediaApi#get(URI) * @see MediaApi#get(URI)
@ -157,13 +155,4 @@ public interface MediaAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam URI mediaHref); ListenableFuture<Owner> getOwner(@EndpointParam URI mediaHref);
/**
* @return asynchronous access to {@link Metadata.Writeable} features
*/
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn);
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI mediaHref);
} }

View File

@ -29,8 +29,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
* @author danikov, Adrian Cole * @author danikov, Adrian Cole
*/ */
public interface MetadataApi { public interface MetadataApi {
public static interface Readable extends MetadataApi {
/** /**
* Retrieves an list of metadata * Retrieves an list of metadata
* *
@ -44,37 +42,30 @@ public interface MetadataApi {
* @return the metadata value, or null if not found * @return the metadata value, or null if not found
*/ */
String get(String key); String get(String key);
}
public static interface Writeable extends Readable {
/** /**
* Merges the metadata for a media with the information provided. * Merges the metadata for a media with the information provided.
* *
* @return a task. This operation is asynchronous and the user should * @return a task. This operation is asynchronous and the user should monitor the returned task status in order to
* monitor the returned task status in order to check when it is * check when it is completed.
* completed.
*/ */
Task putAll(Map<String, String> metadata); Task putAll(Map<String, String> metadata);
/** /**
* Sets the metadata for the particular key for the media to the value * Sets the metadata for the particular key for the media to the value provided. Note: this will replace any existing
* provided. Note: this will replace any existing metadata information * metadata information
* *
* @return a task. This operation is asynchronous and the user should * @return a task. This operation is asynchronous and the user should monitor the returned task status in order to
* monitor the returned task status in order to check when it is * check when it is completed.
* completed.
*/ */
Task put(String key, String value); Task put(String key, String value);
/** /**
* Deletes a metadata entry. * Deletes a metadata entry.
* *
* @return a task. This operation is asynchronous and the user should * @return a task. This operation is asynchronous and the user should monitor the returned task status in order to
* monitor the returned task status in order to check when it is * check when it is completed.
* completed.
*/ */
Task remove(String key); Task remove(String key);
} }
}

View File

@ -49,10 +49,8 @@ import com.google.common.util.concurrent.ListenableFuture;
* @see MetadataApi * @see MetadataApi
* @author Adrian Cole, danikov * @author Adrian Cole, danikov
*/ */
public interface MetadataAsyncApi {
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
public static interface Readable extends MetadataAsyncApi { public interface MetadataAsyncApi {
/** /**
* @see MetadataApi.Readable#get() * @see MetadataApi.Readable#get()
@ -74,11 +72,6 @@ public interface MetadataAsyncApi {
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<String> get(@PathParam("key") String key); ListenableFuture<String> get(@PathParam("key") String key);
}
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
public static interface Writeable extends Readable {
/** /**
* @see MetadataApi.Writable#putAll * @see MetadataApi.Writable#putAll
*/ */
@ -90,7 +83,7 @@ public interface MetadataAsyncApi {
ListenableFuture<Task> putAll(@BinderParam(BindMapAsMetadata.class) Map<String, String> metadata); ListenableFuture<Task> putAll(@BinderParam(BindMapAsMetadata.class) Map<String, String> metadata);
/** /**
* @see MetadataApi.Writeable#put * @see MetadataApi#put
*/ */
@PUT @PUT
@Path("/metadata/{key}") @Path("/metadata/{key}")
@ -110,4 +103,3 @@ public interface MetadataAsyncApi {
ListenableFuture<Task> remove(@PathParam("key") String key); ListenableFuture<Task> remove(@PathParam("key") String key);
} }
}

View File

@ -19,10 +19,8 @@
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI; import java.net.URI;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.vcloud.director.v1_5.domain.network.Network; 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}. * Provides synchronous access to {@link Network}.
@ -40,13 +38,4 @@ public interface NetworkApi {
Network get(String networkUrn); Network get(String networkUrn);
Network get(URI networkHref); Network get(URI networkHref);
/**
* @return synchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataApi.Readable getMetadataApi(@EndpointParam(parser = NetworkURNToHref.class) String networkUrn);
@Delegate
MetadataApi.Readable getMetadataApi(@EndpointParam URI networkHref);
} }

View File

@ -24,14 +24,13 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.network.Network; import org.jclouds.vcloud.director.v1_5.domain.network.Network;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.NetworkURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -49,7 +48,7 @@ public interface NetworkAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Network> get(@EndpointParam(parser = NetworkURNToHref.class) String networkUrn); ListenableFuture<? extends Network> get(@EndpointParam(parser = URNToHref.class) String networkUrn);
/** /**
* @see NetworkApi#get(URI) * @see NetworkApi#get(URI)
@ -59,14 +58,4 @@ public interface NetworkAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Network> get(@EndpointParam URI networkHref); ListenableFuture<? extends Network> get(@EndpointParam URI networkHref);
/**
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = NetworkURNToHref.class) String networkUrn);
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI networkHref);
} }

View File

@ -19,11 +19,9 @@
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI; import java.net.URI;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.vcloud.director.v1_5.domain.org.Org; 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.domain.org.OrgList;
import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToHref;
/** /**
* Provides synchronous access to {@link Org}. * Provides synchronous access to {@link Org}.
@ -56,14 +54,4 @@ public interface OrgApi {
Org get(String orgUrn); Org get(String orgUrn);
Org get(URI orgHref); Org get(URI orgHref);
/**
* @return synchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataApi.Readable getMetadataApi(@EndpointParam(parser = OrgURNToHref.class) String orgUrn);
@Delegate
MetadataApi.Readable getMetadataApi(@EndpointParam URI orgHref);
} }

View File

@ -25,7 +25,6 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
@ -33,7 +32,7 @@ import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.org.Org; 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.domain.org.OrgList;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -60,7 +59,7 @@ public interface OrgAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Org> get(@EndpointParam(parser = OrgURNToHref.class) String orgUrn); ListenableFuture<? extends Org> get(@EndpointParam(parser = URNToHref.class) String orgUrn);
/** /**
* @see OrgApi#get(URI) * @see OrgApi#get(URI)
@ -70,14 +69,4 @@ public interface OrgAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Org> get(@EndpointParam URI orgHref); ListenableFuture<? extends Org> get(@EndpointParam URI orgHref);
/**
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = OrgURNToHref.class) String orgUrn);
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI orgHref);
} }

View File

@ -33,7 +33,7 @@ import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.TasksList; import org.jclouds.vcloud.director.v1_5.domain.TasksList;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.TaskURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -60,7 +60,7 @@ public interface TaskAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Task> get(@EndpointParam(parser = TaskURNToHref.class) String taskUrn); ListenableFuture<Task> get(@EndpointParam(parser = URNToHref.class) String taskUrn);
/** /**
* @see TaskApi#get(URI) * @see TaskApi#get(URI)
@ -78,7 +78,7 @@ public interface TaskAsyncApi {
@Path("/action/cancel") @Path("/action/cancel")
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> cancel(@EndpointParam(parser = TaskURNToHref.class) String taskUrn); ListenableFuture<Void> cancel(@EndpointParam(parser = URNToHref.class) String taskUrn);
/** /**
* @see TaskApi#cancel(URI) * @see TaskApi#cancel(URI)

View File

@ -19,10 +19,9 @@
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI; import java.net.URI;
import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.StartupSection; 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.Owner; 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.ProductSectionList;
import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.Task;
@ -33,7 +32,6 @@ 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.params.UndeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection; 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.NetworkConfigSection;
import org.jclouds.vcloud.director.v1_5.functions.href.VAppURNToHref;
/** /**
* Provides synchronous access to {@link VApp} objects. * Provides synchronous access to {@link VApp} objects.
@ -488,14 +486,4 @@ public interface VAppApi {
Task editStartupSection(String vAppUrn, StartupSection section); Task editStartupSection(String vAppUrn, StartupSection section);
Task editStartupSection(URI vAppHref, StartupSection section); Task editStartupSection(URI vAppHref, StartupSection section);
/**
* Synchronous access to {@link VApp} {@link Metadata} features.
*/
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam URI vAppHref);
} }

View File

@ -44,7 +44,6 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.StartupSection; import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
@ -61,7 +60,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.LeaseSettingsSection;
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection; 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.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.VAppURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -79,7 +78,7 @@ public interface VAppAsyncApi {
@Consumes(VAPP) @Consumes(VAPP)
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VApp> get(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<VApp> get(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#edit(String, VApp) * @see VAppApi#edit(String, VApp)
@ -88,7 +87,7 @@ public interface VAppAsyncApi {
@Produces(VAPP) @Produces(VAPP)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> edit(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, ListenableFuture<Task> edit(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) VApp vApp); @BinderParam(BindToXMLPayload.class) VApp vApp);
/** /**
@ -97,7 +96,7 @@ public interface VAppAsyncApi {
@DELETE @DELETE
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> remove(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Task> remove(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#editControlAccess(String, ControlAccessParams) * @see VAppApi#editControlAccess(String, ControlAccessParams)
@ -107,7 +106,7 @@ public interface VAppAsyncApi {
@Produces(CONTROL_ACCESS) @Produces(CONTROL_ACCESS)
@Consumes(CONTROL_ACCESS) @Consumes(CONTROL_ACCESS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<ControlAccessParams> editControlAccess(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, ListenableFuture<ControlAccessParams> editControlAccess(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) ControlAccessParams params); @BinderParam(BindToXMLPayload.class) ControlAccessParams params);
/** /**
@ -118,7 +117,7 @@ public interface VAppAsyncApi {
@Produces(DEPLOY_VAPP_PARAMS) @Produces(DEPLOY_VAPP_PARAMS)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> deploy(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, ListenableFuture<Task> deploy(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) DeployVAppParams params); @BinderParam(BindToXMLPayload.class) DeployVAppParams params);
/** /**
@ -128,7 +127,7 @@ public interface VAppAsyncApi {
@Path("/action/discardSuspendedState") @Path("/action/discardSuspendedState")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> discardSuspendedState(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Task> discardSuspendedState(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#enterMaintenanceMode(String) * @see VAppApi#enterMaintenanceMode(String)
@ -137,7 +136,7 @@ public interface VAppAsyncApi {
@Path("/action/enterMaintenanceMode") @Path("/action/enterMaintenanceMode")
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> enterMaintenanceMode(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Void> enterMaintenanceMode(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#exitMaintenanceMode(String) * @see VAppApi#exitMaintenanceMode(String)
@ -146,7 +145,7 @@ public interface VAppAsyncApi {
@Path("/action/exitMaintenanceMode") @Path("/action/exitMaintenanceMode")
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> exitMaintenanceMode(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Void> exitMaintenanceMode(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#recompose(String, RecomposeVAppParams) * @see VAppApi#recompose(String, RecomposeVAppParams)
@ -156,7 +155,7 @@ public interface VAppAsyncApi {
@Produces(RECOMPOSE_VAPP_PARAMS) @Produces(RECOMPOSE_VAPP_PARAMS)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> recompose(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, ListenableFuture<Task> recompose(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) RecomposeVAppParams params); @BinderParam(BindToXMLPayload.class) RecomposeVAppParams params);
/** /**
@ -167,7 +166,7 @@ public interface VAppAsyncApi {
@Produces(UNDEPLOY_VAPP_PARAMS) @Produces(UNDEPLOY_VAPP_PARAMS)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> undeploy(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, ListenableFuture<Task> undeploy(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params); @BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
/** /**
@ -178,7 +177,7 @@ public interface VAppAsyncApi {
@Consumes(CONTROL_ACCESS) @Consumes(CONTROL_ACCESS)
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#powerOff(String) * @see VAppApi#powerOff(String)
@ -187,7 +186,7 @@ public interface VAppAsyncApi {
@Path("/power/action/powerOff") @Path("/power/action/powerOff")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> powerOff(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Task> powerOff(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#powerOn(String) * @see VAppApi#powerOn(String)
@ -196,7 +195,7 @@ public interface VAppAsyncApi {
@Path("/power/action/powerOn") @Path("/power/action/powerOn")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> powerOn(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Task> powerOn(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#reboot(String) * @see VAppApi#reboot(String)
@ -205,7 +204,7 @@ public interface VAppAsyncApi {
@Path("/power/action/reboot") @Path("/power/action/reboot")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> reboot(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Task> reboot(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#reset(String) * @see VAppApi#reset(String)
@ -214,7 +213,7 @@ public interface VAppAsyncApi {
@Path("/power/action/reset") @Path("/power/action/reset")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> reset(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Task> reset(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#shutdown(String) * @see VAppApi#shutdown(String)
@ -223,7 +222,7 @@ public interface VAppAsyncApi {
@Path("/power/action/shutdown") @Path("/power/action/shutdown")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> shutdown(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Task> shutdown(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#suspend(String) * @see VAppApi#suspend(String)
@ -232,7 +231,7 @@ public interface VAppAsyncApi {
@Path("/power/action/suspend") @Path("/power/action/suspend")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> suspend(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Task> suspend(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#getLeaseSettingsSection(String) * @see VAppApi#getLeaseSettingsSection(String)
@ -243,7 +242,7 @@ public interface VAppAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection( ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(
@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); @EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#editLeaseSettingsSection(String, LeaseSettingsSection) * @see VAppApi#editLeaseSettingsSection(String, LeaseSettingsSection)
@ -253,7 +252,7 @@ public interface VAppAsyncApi {
@Produces(LEASE_SETTINGS_SECTION) @Produces(LEASE_SETTINGS_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section); @BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
/** /**
@ -265,7 +264,7 @@ public interface VAppAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkConfigSection> getNetworkConfigSection( ListenableFuture<NetworkConfigSection> getNetworkConfigSection(
@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); @EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#editNetworkConfigSection(String, NetworkConfigSection) * @see VAppApi#editNetworkConfigSection(String, NetworkConfigSection)
@ -275,7 +274,7 @@ public interface VAppAsyncApi {
@Produces(NETWORK_CONFIG_SECTION) @Produces(NETWORK_CONFIG_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editNetworkConfigSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, ListenableFuture<Task> editNetworkConfigSection(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section); @BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
/** /**
@ -286,7 +285,7 @@ public interface VAppAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#getOwner(String) * @see VAppApi#getOwner(String)
@ -296,7 +295,7 @@ public interface VAppAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<Owner> getOwner(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#editOwner(String, Owner) * @see VAppApi#editOwner(String, Owner)
@ -306,7 +305,7 @@ public interface VAppAsyncApi {
@Produces(OWNER) @Produces(OWNER)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> editOwner(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, ListenableFuture<Void> editOwner(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) Owner owner); @BinderParam(BindToXMLPayload.class) Owner owner);
/** /**
@ -317,7 +316,7 @@ public interface VAppAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<ProductSectionList> getProductSections(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#editProductSections(String, ProductSectionList) * @see VAppApi#editProductSections(String, ProductSectionList)
@ -327,7 +326,7 @@ public interface VAppAsyncApi {
@Produces(PRODUCT_SECTION_LIST) @Produces(PRODUCT_SECTION_LIST)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editProductSections(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, ListenableFuture<Task> editProductSections(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
/** /**
@ -338,7 +337,7 @@ public interface VAppAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<StartupSection> getStartupSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); ListenableFuture<StartupSection> getStartupSection(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/** /**
* @see VAppApi#editStartupSection(String, StartupSection) * @see VAppApi#editStartupSection(String, StartupSection)
@ -348,7 +347,7 @@ public interface VAppAsyncApi {
@Produces(STARTUP_SECTION) @Produces(STARTUP_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editStartupSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, ListenableFuture<Task> editStartupSection(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) StartupSection section); @BinderParam(BindToXMLPayload.class) StartupSection section);
/** /**
@ -625,14 +624,4 @@ public interface VAppAsyncApi {
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editStartupSection(@EndpointParam URI vAppHref, ListenableFuture<Task> editStartupSection(@EndpointParam URI vAppHref,
@BinderParam(BindToXMLPayload.class) StartupSection section); @BinderParam(BindToXMLPayload.class) StartupSection section);
/**
* Asynchronous access to {@link VApp} {@link Metadata} features
*/
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI vAppHref);
} }

View File

@ -19,9 +19,8 @@
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI; import java.net.URI;
import org.jclouds.dmtf.ovf.NetworkSection; 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.Owner; 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.ProductSectionList;
import org.jclouds.vcloud.director.v1_5.domain.References; import org.jclouds.vcloud.director.v1_5.domain.References;
@ -31,7 +30,6 @@ import org.jclouds.vcloud.director.v1_5.domain.dmtf.Envelope;
import org.jclouds.vcloud.director.v1_5.domain.section.CustomizationSection; import org.jclouds.vcloud.director.v1_5.domain.section.CustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection; 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.NetworkConfigSection;
import org.jclouds.vcloud.director.v1_5.functions.href.VAppTemplateURNToHref;
/** /**
* Provides synchronous access to {@link VAppTemplate} objects. * Provides synchronous access to {@link VAppTemplate} objects.
@ -296,14 +294,4 @@ public interface VAppTemplateApi {
References getShadowVms(String templateUrn); References getShadowVms(String templateUrn);
References getShadowVms(URI templateHref); References getShadowVms(URI templateHref);
/**
* @return synchronous access to {@link Metadata} features
*/
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam URI templateHref);
} }

View File

@ -40,13 +40,11 @@ import javax.ws.rs.Produces;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload; import org.jclouds.rest.binders.BindToXMLPayload;
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.Owner;
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; 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.References;
@ -57,7 +55,7 @@ import org.jclouds.vcloud.director.v1_5.domain.section.CustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection; 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.NetworkConfigSection;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.VAppTemplateURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -75,7 +73,7 @@ public interface VAppTemplateAsyncApi {
@Consumes(VAPP_TEMPLATE) @Consumes(VAPP_TEMPLATE)
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VAppTemplate> get(@EndpointParam(parser = VAppTemplateURNToHref.class) String reference); ListenableFuture<VAppTemplate> get(@EndpointParam(parser = URNToHref.class) String reference);
/** /**
* @see VAppTemplateApi#edit(String, VAppTemplate) * @see VAppTemplateApi#edit(String, VAppTemplate)
@ -84,7 +82,7 @@ public interface VAppTemplateAsyncApi {
@Produces(VAPP_TEMPLATE) @Produces(VAPP_TEMPLATE)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> edit(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn, ListenableFuture<Task> edit(@EndpointParam(parser = URNToHref.class) String templateUrn,
@BinderParam(BindToXMLPayload.class) VAppTemplate template); @BinderParam(BindToXMLPayload.class) VAppTemplate template);
/** /**
@ -101,7 +99,7 @@ public interface VAppTemplateAsyncApi {
@POST @POST
@Path("/action/disableDownload") @Path("/action/disableDownload")
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> disableDownload(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); ListenableFuture<Void> disableDownload(@EndpointParam(parser = URNToHref.class) String templateUrn);
/** /**
* @see VAppTemplateApi#enableDownload(String) * @see VAppTemplateApi#enableDownload(String)
@ -110,7 +108,7 @@ public interface VAppTemplateAsyncApi {
@Consumes(TASK) @Consumes(TASK)
@Path("/action/enableDownload") @Path("/action/enableDownload")
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> enableDownload(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); ListenableFuture<Task> enableDownload(@EndpointParam(parser = URNToHref.class) String templateUrn);
/** /**
* @see VAppTemplateApi#getCustomizationSection(String) * @see VAppTemplateApi#getCustomizationSection(String)
@ -121,7 +119,7 @@ public interface VAppTemplateAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<CustomizationSection> getCustomizationSection( ListenableFuture<CustomizationSection> getCustomizationSection(
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); @EndpointParam(parser = URNToHref.class) String templateUrn);
/** /**
* @see VAppTemplateApi#getLeaseSettingsSection(String) * @see VAppTemplateApi#getLeaseSettingsSection(String)
@ -132,7 +130,7 @@ public interface VAppTemplateAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection( ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); @EndpointParam(parser = URNToHref.class) String templateUrn);
/** /**
* @see VAppTemplateApi#editLeaseSettingsSection(String, LeaseSettingsSection) * @see VAppTemplateApi#editLeaseSettingsSection(String, LeaseSettingsSection)
@ -143,7 +141,7 @@ public interface VAppTemplateAsyncApi {
@Path("/leaseSettingsSection") @Path("/leaseSettingsSection")
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editLeaseSettingsSection( ListenableFuture<Task> editLeaseSettingsSection(
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn, @EndpointParam(parser = URNToHref.class) String templateUrn,
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection); @BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection);
/** /**
@ -155,7 +153,7 @@ public interface VAppTemplateAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkConfigSection> getNetworkConfigSection( ListenableFuture<NetworkConfigSection> getNetworkConfigSection(
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); @EndpointParam(parser = URNToHref.class) String templateUrn);
/** /**
* @see VAppTemplateApi#getNetworkSection(String) * @see VAppTemplateApi#getNetworkSection(String)
@ -166,7 +164,7 @@ public interface VAppTemplateAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkSection> getNetworkSection( ListenableFuture<NetworkSection> getNetworkSection(
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); @EndpointParam(parser = URNToHref.class) String templateUrn);
/** /**
* @see VAppTemplateApi#getOvf(String) * @see VAppTemplateApi#getOvf(String)
@ -176,7 +174,7 @@ public interface VAppTemplateAsyncApi {
@Path("/ovf") @Path("/ovf")
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Envelope> getOvf(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); ListenableFuture<Envelope> getOvf(@EndpointParam(parser = URNToHref.class) String templateUrn);
/** /**
* @see VAppTemplateApi#getOwnerOfVAppTemplate(String) * @see VAppTemplateApi#getOwnerOfVAppTemplate(String)
@ -186,7 +184,7 @@ public interface VAppTemplateAsyncApi {
@Path("/owner") @Path("/owner")
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); ListenableFuture<Owner> getOwner(@EndpointParam(parser = URNToHref.class) String templateUrn);
/** /**
* @see VAppTemplateApi#getProductSectionsForVAppTemplate(String) * @see VAppTemplateApi#getProductSectionsForVAppTemplate(String)
@ -197,7 +195,7 @@ public interface VAppTemplateAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ProductSectionList> getProductSections( ListenableFuture<ProductSectionList> getProductSections(
@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); @EndpointParam(parser = URNToHref.class) String templateUrn);
/** /**
* @see VAppTemplateApi#editProductSections(String, ProductSectionList) * @see VAppTemplateApi#editProductSections(String, ProductSectionList)
@ -207,7 +205,7 @@ public interface VAppTemplateAsyncApi {
@Consumes(TASK) @Consumes(TASK)
@Path("/productSections") @Path("/productSections")
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editProductSections(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn, ListenableFuture<Task> editProductSections(@EndpointParam(parser = URNToHref.class) String templateUrn,
@BinderParam(BindToXMLPayload.class) ProductSectionList sections); @BinderParam(BindToXMLPayload.class) ProductSectionList sections);
/** /**
@ -218,7 +216,7 @@ public interface VAppTemplateAsyncApi {
@Path("/shadowVms") @Path("/shadowVms")
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<References> getShadowVms(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); ListenableFuture<References> getShadowVms(@EndpointParam(parser = URNToHref.class) String templateUrn);
/** /**
* @see VAppTemplateApi#get(URI) * @see VAppTemplateApi#get(URI)
@ -365,14 +363,4 @@ public interface VAppTemplateAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<References> getShadowVms(@EndpointParam URI templateHref); ListenableFuture<References> getShadowVms(@EndpointParam URI templateHref);
/**
* @return asynchronous access to {@link Metadata} features
*/
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI templateHref);
} }

View File

@ -19,8 +19,7 @@
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI; import java.net.URI;
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.Media;
import org.jclouds.vcloud.director.v1_5.domain.VApp; import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
@ -32,7 +31,6 @@ 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.ComposeVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.params.InstantiateVAppParams; 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.domain.params.UploadVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.functions.href.VdcURNToHref;
/** /**
* Provides synchronous access to a vDC. * Provides synchronous access to a vDC.
@ -188,14 +186,4 @@ public interface VdcApi {
Media addMedia(String vdcUrn, Media media); Media addMedia(String vdcUrn, Media media);
Media addMedia(URI vdcHref, Media media); Media addMedia(URI vdcHref, Media media);
/**
* @return synchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataApi.Readable getMetadataApi(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn);
@Delegate
MetadataApi.Readable getMetadataApi(@EndpointParam URI vdcHref);
} }

View File

@ -28,7 +28,6 @@ import javax.ws.rs.Produces;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
@ -47,7 +46,7 @@ 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.InstantiateVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.params.UploadVAppTemplateParams; import org.jclouds.vcloud.director.v1_5.domain.params.UploadVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.VdcURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -65,7 +64,7 @@ public interface VdcAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Vdc> get(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn); ListenableFuture<? extends Vdc> get(@EndpointParam(parser = URNToHref.class) String vdcUrn);
/** /**
* @see VdcApi#captureVApp(String, CaptureVAppParams) * @see VdcApi#captureVApp(String, CaptureVAppParams)
@ -75,7 +74,7 @@ public interface VdcAsyncApi {
@Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE) @Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE)
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) @Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<VAppTemplate> captureVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, ListenableFuture<VAppTemplate> captureVApp(@EndpointParam(parser = URNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) CaptureVAppParams params); @BinderParam(BindToXMLPayload.class) CaptureVAppParams params);
/** /**
@ -86,7 +85,7 @@ public interface VdcAsyncApi {
@Consumes(VCloudDirectorMediaType.MEDIA) @Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.CLONE_MEDIA_PARAMS) @Produces(VCloudDirectorMediaType.CLONE_MEDIA_PARAMS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Media> cloneMedia(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, ListenableFuture<Media> cloneMedia(@EndpointParam(parser = URNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) CloneMediaParams params); @BinderParam(BindToXMLPayload.class) CloneMediaParams params);
/** /**
@ -98,7 +97,7 @@ public interface VdcAsyncApi {
@Produces(VCloudDirectorMediaType.CLONE_VAPP_PARAMS) @Produces(VCloudDirectorMediaType.CLONE_VAPP_PARAMS)
// TODO fix these etc. // TODO fix these etc.
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<VApp> cloneVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, ListenableFuture<VApp> cloneVApp(@EndpointParam(parser = URNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) CloneVAppParams params); @BinderParam(BindToXMLPayload.class) CloneVAppParams params);
/** /**
@ -109,7 +108,7 @@ public interface VdcAsyncApi {
@Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE) @Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE)
@Produces(VCloudDirectorMediaType.CLONE_VAPP_TEMPLATE_PARAMS) @Produces(VCloudDirectorMediaType.CLONE_VAPP_TEMPLATE_PARAMS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<VAppTemplate> cloneVAppTemplate(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, ListenableFuture<VAppTemplate> cloneVAppTemplate(@EndpointParam(parser = URNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) CloneVAppTemplateParams params); @BinderParam(BindToXMLPayload.class) CloneVAppTemplateParams params);
/** /**
@ -120,7 +119,7 @@ public interface VdcAsyncApi {
@Consumes(VCloudDirectorMediaType.VAPP) @Consumes(VCloudDirectorMediaType.VAPP)
@Produces(VCloudDirectorMediaType.COMPOSE_VAPP_PARAMS) @Produces(VCloudDirectorMediaType.COMPOSE_VAPP_PARAMS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<VApp> composeVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, ListenableFuture<VApp> composeVApp(@EndpointParam(parser = URNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) ComposeVAppParams params); @BinderParam(BindToXMLPayload.class) ComposeVAppParams params);
/** /**
@ -131,7 +130,7 @@ public interface VdcAsyncApi {
@Consumes(VCloudDirectorMediaType.VAPP) @Consumes(VCloudDirectorMediaType.VAPP)
@Produces(VCloudDirectorMediaType.INSTANTIATE_VAPP_TEMPLATE_PARAMS) @Produces(VCloudDirectorMediaType.INSTANTIATE_VAPP_TEMPLATE_PARAMS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<VApp> instantiateVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, ListenableFuture<VApp> instantiateVApp(@EndpointParam(parser = URNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) InstantiateVAppParams params); @BinderParam(BindToXMLPayload.class) InstantiateVAppParams params);
/** /**
@ -142,7 +141,7 @@ public interface VdcAsyncApi {
@Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE) @Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE)
@Produces(VCloudDirectorMediaType.UPLOAD_VAPP_TEMPLATE_PARAMS) @Produces(VCloudDirectorMediaType.UPLOAD_VAPP_TEMPLATE_PARAMS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<VAppTemplate> uploadVAppTemplate(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, ListenableFuture<VAppTemplate> uploadVAppTemplate(@EndpointParam(parser = URNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params); @BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params);
/** /**
@ -153,7 +152,7 @@ public interface VdcAsyncApi {
@Consumes(VCloudDirectorMediaType.MEDIA) @Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.MEDIA) @Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Media> addMedia(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, ListenableFuture<Media> addMedia(@EndpointParam(parser = URNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) Media media); @BinderParam(BindToXMLPayload.class) Media media);
/** /**
@ -253,13 +252,4 @@ public interface VdcAsyncApi {
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Media> addMedia(@EndpointParam URI vdcHref, @BinderParam(BindToXMLPayload.class) Media media); ListenableFuture<Media> addMedia(@EndpointParam URI vdcHref, @BinderParam(BindToXMLPayload.class) Media media);
/**
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn);
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI vdcHref);
} }

View File

@ -19,12 +19,12 @@
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI; import java.net.URI;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; 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.RasdItemsList;
import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket; import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket;
import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.Vm; import org.jclouds.vcloud.director.v1_5.domain.Vm;
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion; import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer; import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
@ -38,7 +38,6 @@ 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.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection; 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.domain.section.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.functions.href.VmURNToHref;
/** /**
* Provides synchronous access to {@link Vm} objects. * Provides synchronous access to {@link Vm} objects.
@ -598,14 +597,4 @@ public interface VmApi {
Task editVirtualHardwareSectionSerialPorts(String vmUrn, RasdItemsList rasdItemsList); Task editVirtualHardwareSectionSerialPorts(String vmUrn, RasdItemsList rasdItemsList);
Task editVirtualHardwareSectionSerialPorts(URI vmHref, RasdItemsList rasdItemsList); Task editVirtualHardwareSectionSerialPorts(URI vmHref, RasdItemsList rasdItemsList);
/**
* Synchronous access to {@link Vm} {@link Metadata} features.
*/
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam URI vmHref);
} }

View File

@ -45,8 +45,8 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.dmtf.cim.ResourceAllocationSettingData;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
@ -72,7 +72,7 @@ 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.domain.section.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; 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.ReturnPayloadBytes;
import org.jclouds.vcloud.director.v1_5.functions.href.VmURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -90,7 +90,7 @@ public interface VmAsyncApi {
@Consumes(VM) @Consumes(VM)
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Vm> get(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Vm> get(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#edit(String, Vm) * @see VmApi#edit(String, Vm)
@ -99,7 +99,7 @@ public interface VmAsyncApi {
@Produces(VM) @Produces(VM)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> edit(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> edit(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) Vm vApp); @BinderParam(BindToXMLPayload.class) Vm vApp);
/** /**
@ -108,7 +108,7 @@ public interface VmAsyncApi {
@DELETE @DELETE
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> remove(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> remove(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#consolidate(String) * @see VmApi#consolidate(String)
@ -117,7 +117,7 @@ public interface VmAsyncApi {
@Path("/action/consolidate") @Path("/action/consolidate")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> consolidate(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> consolidate(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#deploy(String, DeployVAppParams) * @see VmApi#deploy(String, DeployVAppParams)
@ -127,7 +127,7 @@ public interface VmAsyncApi {
@Produces(DEPLOY_VAPP_PARAMS) @Produces(DEPLOY_VAPP_PARAMS)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> deploy(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> deploy(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) DeployVAppParams params); @BinderParam(BindToXMLPayload.class) DeployVAppParams params);
/** /**
@ -137,7 +137,7 @@ public interface VmAsyncApi {
@Path("/action/discardSuspendedState") @Path("/action/discardSuspendedState")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> discardSuspendedState(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> discardSuspendedState(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#installVMwareTools(String) * @see VmApi#installVMwareTools(String)
@ -146,7 +146,7 @@ public interface VmAsyncApi {
@Path("/action/installVMwareTools") @Path("/action/installVMwareTools")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> installVMwareTools(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> installVMwareTools(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#relocate(String, RelocateParams) * @see VmApi#relocate(String, RelocateParams)
@ -156,7 +156,7 @@ public interface VmAsyncApi {
@Produces(RELOCATE_VM_PARAMS) @Produces(RELOCATE_VM_PARAMS)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> relocate(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> relocate(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) RelocateParams params); @BinderParam(BindToXMLPayload.class) RelocateParams params);
/** /**
@ -167,7 +167,7 @@ public interface VmAsyncApi {
@Produces(UNDEPLOY_VAPP_PARAMS) @Produces(UNDEPLOY_VAPP_PARAMS)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> undeploy(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> undeploy(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params); @BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
/** /**
@ -177,7 +177,7 @@ public interface VmAsyncApi {
@Path("/action/upgradeHardwareVersion") @Path("/action/upgradeHardwareVersion")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#powerOff(String) * @see VmApi#powerOff(String)
@ -186,7 +186,7 @@ public interface VmAsyncApi {
@Path("/power/action/powerOff") @Path("/power/action/powerOff")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> powerOff(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> powerOff(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#powerOn(String) * @see VmApi#powerOn(String)
@ -195,7 +195,7 @@ public interface VmAsyncApi {
@Path("/power/action/powerOn") @Path("/power/action/powerOn")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> powerOn(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> powerOn(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#reboot(String) * @see VmApi#reboot(String)
@ -204,7 +204,7 @@ public interface VmAsyncApi {
@Path("/power/action/reboot") @Path("/power/action/reboot")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> reboot(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> reboot(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#reset(String) * @see VmApi#reset(String)
@ -213,7 +213,7 @@ public interface VmAsyncApi {
@Path("/power/action/reset") @Path("/power/action/reset")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> reset(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> reset(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#shutdown(String) * @see VmApi#shutdown(String)
@ -222,7 +222,7 @@ public interface VmAsyncApi {
@Path("/power/action/shutdown") @Path("/power/action/shutdown")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> shutdown(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> shutdown(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#suspend(String) * @see VmApi#suspend(String)
@ -231,7 +231,7 @@ public interface VmAsyncApi {
@Path("/power/action/suspend") @Path("/power/action/suspend")
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> suspend(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<Task> suspend(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#getGuestCustomizationSection(String) * @see VmApi#getGuestCustomizationSection(String)
@ -242,7 +242,7 @@ public interface VmAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection( ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(
@EndpointParam(parser = VmURNToHref.class) String vmUrn); @EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#editGuestCustomizationSection(String, GuestCustomizationSection) * @see VmApi#editGuestCustomizationSection(String, GuestCustomizationSection)
@ -252,7 +252,7 @@ public interface VmAsyncApi {
@Produces(GUEST_CUSTOMIZATION_SECTION) @Produces(GUEST_CUSTOMIZATION_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editGuestCustomizationSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> editGuestCustomizationSection(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section); @BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
/** /**
@ -263,7 +263,7 @@ public interface VmAsyncApi {
@Produces(MEDIA_PARAMS) @Produces(MEDIA_PARAMS)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> ejectMedia(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> ejectMedia(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
/** /**
@ -274,7 +274,7 @@ public interface VmAsyncApi {
@Produces(MEDIA_PARAMS) @Produces(MEDIA_PARAMS)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> insertMedia(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> insertMedia(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
/** /**
@ -286,7 +286,7 @@ public interface VmAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection( ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(
@EndpointParam(parser = VmURNToHref.class) String vmUrn); @EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#editNetworkConnectionSection(String, NetworkConnectionSection) * @see VmApi#editNetworkConnectionSection(String, NetworkConnectionSection)
@ -296,7 +296,7 @@ public interface VmAsyncApi {
@Produces(NETWORK_CONNECTION_SECTION) @Produces(NETWORK_CONNECTION_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editNetworkConnectionSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> editNetworkConnectionSection(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section); @BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
/** /**
@ -308,7 +308,7 @@ public interface VmAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OperatingSystemSection> getOperatingSystemSection( ListenableFuture<OperatingSystemSection> getOperatingSystemSection(
@EndpointParam(parser = VmURNToHref.class) String vmUrn); @EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#editOperatingSystemSection(String, OperatingSystemSection) * @see VmApi#editOperatingSystemSection(String, OperatingSystemSection)
@ -318,7 +318,7 @@ public interface VmAsyncApi {
@Produces(OPERATING_SYSTEM_SECTION) @Produces(OPERATING_SYSTEM_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editOperatingSystemSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> editOperatingSystemSection(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section); @BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
/** /**
@ -329,7 +329,7 @@ public interface VmAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<ProductSectionList> getProductSections(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#editProductSections(String, ProductSectionList) * @see VmApi#editProductSections(String, ProductSectionList)
@ -339,7 +339,7 @@ public interface VmAsyncApi {
@Produces(PRODUCT_SECTION_LIST) @Produces(PRODUCT_SECTION_LIST)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editProductSections(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> editProductSections(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
/** /**
@ -350,7 +350,7 @@ public interface VmAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#answerQuestion(String, VmQuestionAnswer) * @see VmApi#answerQuestion(String, VmQuestionAnswer)
@ -360,7 +360,7 @@ public interface VmAsyncApi {
@Produces(VM_PENDING_ANSWER) @Produces(VM_PENDING_ANSWER)
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> answerQuestion(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Void> answerQuestion(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer); @BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer);
/** /**
@ -371,7 +371,7 @@ public interface VmAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#getScreenImage(String) * @see VmApi#getScreenImage(String)
@ -381,7 +381,7 @@ public interface VmAsyncApi {
@Consumes(ANY_IMAGE) @Consumes(ANY_IMAGE)
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(ReturnPayloadBytes.class) @ResponseParser(ReturnPayloadBytes.class)
ListenableFuture<byte[]> getScreenImage(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<byte[]> getScreenImage(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#getScreenTicket(String) * @see VmApi#getScreenTicket(String)
@ -391,7 +391,7 @@ public interface VmAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#getVirtualHardwareSection(String) * @see VmApi#getVirtualHardwareSection(String)
@ -402,7 +402,7 @@ public interface VmAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection( ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(
@EndpointParam(parser = VmURNToHref.class) String vmUrn); @EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#editVirtualHardwareSection(String, VirtualHardwareSection) * @see VmApi#editVirtualHardwareSection(String, VirtualHardwareSection)
@ -412,7 +412,7 @@ public interface VmAsyncApi {
@Produces(VIRTUAL_HARDWARE_SECTION) @Produces(VIRTUAL_HARDWARE_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editVirtualHardwareSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> editVirtualHardwareSection(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section); @BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
/** /**
@ -423,7 +423,7 @@ public interface VmAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#editVirtualHardwareSectionCpu(String, ResourceAllocationSettingData) * @see VmApi#editVirtualHardwareSectionCpu(String, ResourceAllocationSettingData)
@ -433,7 +433,7 @@ public interface VmAsyncApi {
@Produces(OVF_RASD_ITEM) @Produces(OVF_RASD_ITEM)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editVirtualHardwareSectionCpu(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> editVirtualHardwareSectionCpu(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) RasdItem rasd); @BinderParam(BindToXMLPayload.class) RasdItem rasd);
/** /**
@ -445,7 +445,7 @@ public interface VmAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks( ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(
@EndpointParam(parser = VmURNToHref.class) String vmUrn); @EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#editVirtualHardwareSectionDisks(String, RasdItemsList) * @see VmApi#editVirtualHardwareSectionDisks(String, RasdItemsList)
@ -455,7 +455,7 @@ public interface VmAsyncApi {
@Produces(OVF_RASD_ITEMS_LIST) @Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editVirtualHardwareSectionDisks(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> editVirtualHardwareSectionDisks(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/** /**
@ -467,7 +467,7 @@ public interface VmAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia( ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia(
@EndpointParam(parser = VmURNToHref.class) String vmUrn); @EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#getVirtualHardwareSectionMemory(String) * @see VmApi#getVirtualHardwareSectionMemory(String)
@ -477,7 +477,7 @@ public interface VmAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam(parser = VmURNToHref.class) String vmUrn); ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#editVirtualHardwareSectionMemory(String, ResourceAllocationSettingData) * @see VmApi#editVirtualHardwareSectionMemory(String, ResourceAllocationSettingData)
@ -487,7 +487,7 @@ public interface VmAsyncApi {
@Produces(OVF_RASD_ITEM) @Produces(OVF_RASD_ITEM)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editVirtualHardwareSectionMemory(@EndpointParam(parser = VmURNToHref.class) String vmUrn, ListenableFuture<Task> editVirtualHardwareSectionMemory(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) RasdItem rasd); @BinderParam(BindToXMLPayload.class) RasdItem rasd);
/** /**
@ -499,7 +499,7 @@ public interface VmAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards( ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(
@EndpointParam(parser = VmURNToHref.class) String vmUrn); @EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#editVirtualHardwareSectionNetworkCards(String, RasdItemsList) * @see VmApi#editVirtualHardwareSectionNetworkCards(String, RasdItemsList)
@ -510,7 +510,7 @@ public interface VmAsyncApi {
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editVirtualHardwareSectionNetworkCards( ListenableFuture<Task> editVirtualHardwareSectionNetworkCards(
@EndpointParam(parser = VmURNToHref.class) String vmUrn, @EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/** /**
@ -522,7 +522,7 @@ public interface VmAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts( ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(
@EndpointParam(parser = VmURNToHref.class) String vmUrn); @EndpointParam(parser = URNToHref.class) String vmUrn);
/** /**
* @see VmApi#editVirtualHardwareSectionSerialPorts(String, RasdItemsList) * @see VmApi#editVirtualHardwareSectionSerialPorts(String, RasdItemsList)
@ -533,7 +533,7 @@ public interface VmAsyncApi {
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editVirtualHardwareSectionSerialPorts( ListenableFuture<Task> editVirtualHardwareSectionSerialPorts(
@EndpointParam(parser = VmURNToHref.class) String vmUrn, @EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/** /**
@ -975,14 +975,4 @@ public interface VmAsyncApi {
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> editVirtualHardwareSectionSerialPorts(@EndpointParam URI vmHref, ListenableFuture<Task> editVirtualHardwareSectionSerialPorts(@EndpointParam URI vmHref,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/**
* Asynchronous access to {@Vm} {@link Metadata} features.
*/
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI vmHref);
} }

View File

@ -19,15 +19,12 @@
package org.jclouds.vcloud.director.v1_5.features.admin; package org.jclouds.vcloud.director.v1_5.features.admin;
import java.net.URI; import java.net.URI;
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.AdminCatalog;
import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams; 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.domain.params.PublishCatalogParams;
import org.jclouds.vcloud.director.v1_5.features.CatalogApi; 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. * Provides synchronous access to {@link AdminCatalog} objects.
@ -157,16 +154,4 @@ public interface AdminCatalogApi extends CatalogApi {
ControlAccessParams getAccessControl(String catalogUrn); ControlAccessParams getAccessControl(String catalogUrn);
ControlAccessParams getAccessControl(URI catalogAdminHref); ControlAccessParams getAccessControl(URI catalogAdminHref);
/**
* @return synchronous access to {@link Metadata.Writeable} features
*/
@Override
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn);
@Override
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam URI catalogAdminHref);
} }

View File

@ -32,7 +32,6 @@ import javax.ws.rs.Produces;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
@ -40,15 +39,12 @@ import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload; import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; 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.AdminCatalog;
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.Owner;
import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams; 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.domain.params.PublishCatalogParams;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncApi; import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.CatalogURNToAdminHref; import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref;
import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToAdminHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -68,7 +64,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@Produces(VCloudDirectorMediaType.ADMIN_CATALOG) @Produces(VCloudDirectorMediaType.ADMIN_CATALOG)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<AdminCatalog> addCatalogToOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog, ListenableFuture<AdminCatalog> addCatalogToOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog,
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); @EndpointParam(parser = URNToAdminHref.class) String orgUrn);
/** /**
* @see AdminCatalogApi#addCatalogToOrg(AdminCatalog, URI) * @see AdminCatalogApi#addCatalogToOrg(AdminCatalog, URI)
@ -89,7 +85,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<AdminCatalog> get(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn); ListenableFuture<AdminCatalog> get(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn);
/** /**
* @see AdminCatalogApi#get(URI) * @see AdminCatalogApi#get(URI)
@ -108,7 +104,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@Consumes(VCloudDirectorMediaType.ADMIN_CATALOG) @Consumes(VCloudDirectorMediaType.ADMIN_CATALOG)
@Produces(VCloudDirectorMediaType.ADMIN_CATALOG) @Produces(VCloudDirectorMediaType.ADMIN_CATALOG)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<AdminCatalog> edit(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn, ListenableFuture<AdminCatalog> edit(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn,
@BinderParam(BindToXMLPayload.class) AdminCatalog catalog); @BinderParam(BindToXMLPayload.class) AdminCatalog catalog);
/** /**
@ -127,7 +123,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> remove(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn); ListenableFuture<Void> remove(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn);
/** /**
* @see AdminCatalogApi#remove(URI) * @see AdminCatalogApi#remove(URI)
@ -145,7 +141,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn); ListenableFuture<Owner> getOwner(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn);
/** /**
* @see AdminCatalogApi#getOwner(URI) * @see AdminCatalogApi#getOwner(URI)
@ -165,7 +161,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.OWNER) @Produces(VCloudDirectorMediaType.OWNER)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> setOwner(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn, ListenableFuture<Void> setOwner(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn,
@BinderParam(BindToXMLPayload.class) Owner newOwner); @BinderParam(BindToXMLPayload.class) Owner newOwner);
/** /**
@ -187,7 +183,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS) @Produces(VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> publish(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn, ListenableFuture<Void> publish(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn,
@BinderParam(BindToXMLPayload.class) PublishCatalogParams params); @BinderParam(BindToXMLPayload.class) PublishCatalogParams params);
/** /**
@ -209,7 +205,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@Produces(CONTROL_ACCESS) @Produces(CONTROL_ACCESS)
@Consumes(CONTROL_ACCESS) @Consumes(CONTROL_ACCESS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<ControlAccessParams> editAccessControl(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn, ListenableFuture<ControlAccessParams> editAccessControl(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn,
@BinderParam(BindToXMLPayload.class) ControlAccessParams params); @BinderParam(BindToXMLPayload.class) ControlAccessParams params);
/** /**
@ -231,7 +227,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn); ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn);
/** /**
* @see AdminCatalogApi#getAccessControl(URI) * @see AdminCatalogApi#getAccessControl(URI)
@ -242,16 +238,4 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam URI catalogAdminHref); ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam URI catalogAdminHref);
/**
* @return synchronous access to {@link Metadata.Writeable} features
*/
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn);
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI catalogAdminHref);
} }

View File

@ -19,14 +19,11 @@
package org.jclouds.vcloud.director.v1_5.features.admin; package org.jclouds.vcloud.director.v1_5.features.admin;
import java.net.URI; import java.net.URI;
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.Task;
import org.jclouds.vcloud.director.v1_5.domain.network.Network; 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.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.features.NetworkApi;
import org.jclouds.vcloud.director.v1_5.functions.href.NetworkURNToAdminHref;
/** /**
* Provides synchronous access to admin {@link Network} objects. * Provides synchronous access to admin {@link Network} objects.
@ -89,16 +86,4 @@ public interface AdminNetworkApi extends NetworkApi {
Task reset(String networkUrn); Task reset(String networkUrn);
Task reset(URI networkAdminHref); Task reset(URI networkAdminHref);
/**
* @return synchronous access to admin {@link MetadataApi.Writeable} features
*/
@Override
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn);
@Override
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam URI networkAdminHref);
} }

View File

@ -29,7 +29,6 @@ import javax.ws.rs.Produces;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
@ -39,10 +38,9 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Task; 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.network.Network;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork; import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncApi; import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.NetworkURNToAdminHref; import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +59,7 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Network> get(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn); ListenableFuture<? extends Network> get(@EndpointParam(parser = URNToAdminHref.class) String networkUrn);
/** /**
* @see AdminNetworkApi#get(URI) * @see AdminNetworkApi#get(URI)
@ -80,7 +78,7 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi {
@Consumes(VCloudDirectorMediaType.TASK) @Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK) @Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> edit(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn, ListenableFuture<Task> edit(@EndpointParam(parser = URNToAdminHref.class) String networkUrn,
@BinderParam(BindToXMLPayload.class) OrgNetwork network); @BinderParam(BindToXMLPayload.class) OrgNetwork network);
/** /**
@ -100,7 +98,7 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi {
@Path("/action/reset") @Path("/action/reset")
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> reset(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn); ListenableFuture<Task> reset(@EndpointParam(parser = URNToAdminHref.class) String networkUrn);
/** /**
* @see AdminNetworkApi#reset(URI) * @see AdminNetworkApi#reset(URI)
@ -110,16 +108,4 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> reset(@EndpointParam URI networkAdminHref); ListenableFuture<Task> reset(@EndpointParam URI networkAdminHref);
/**
* @return asynchronous access to admin {@link MetadataAsyncApi.Writeable} features
*/
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn);
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI networkAdminHref);
} }

View File

@ -19,9 +19,9 @@
package org.jclouds.vcloud.director.v1_5.features.admin; package org.jclouds.vcloud.director.v1_5.features.admin;
import java.net.URI; import java.net.URI;
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.AdminOrg;
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgEmailSettings; import org.jclouds.vcloud.director.v1_5.domain.org.OrgEmailSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgGeneralSettings; import org.jclouds.vcloud.director.v1_5.domain.org.OrgGeneralSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgLdapSettings; import org.jclouds.vcloud.director.v1_5.domain.org.OrgLdapSettings;
@ -29,9 +29,7 @@ import org.jclouds.vcloud.director.v1_5.domain.org.OrgLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgPasswordPolicySettings; import org.jclouds.vcloud.director.v1_5.domain.org.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgSettings; 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.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.features.OrgApi;
import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToAdminHref;
/** /**
* Provides synchronous access to {@link Org} objects. * Provides synchronous access to {@link Org} objects.
@ -265,16 +263,4 @@ public interface AdminOrgApi extends OrgApi {
OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(String orgUrn, OrgVAppTemplateLeaseSettings newSettings); OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(String orgUrn, OrgVAppTemplateLeaseSettings newSettings);
OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(URI orgAdminHref, OrgVAppTemplateLeaseSettings newSettings); OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(URI orgAdminHref, OrgVAppTemplateLeaseSettings newSettings);
/**
* @return synchronous access to admin {@link MetadataApi.Writeable} features
*/
@Override
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
@Override
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam URI orgAdminHref);
} }

View File

@ -28,7 +28,6 @@ import javax.ws.rs.Produces;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
@ -43,10 +42,9 @@ import org.jclouds.vcloud.director.v1_5.domain.org.OrgLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgPasswordPolicySettings; import org.jclouds.vcloud.director.v1_5.domain.org.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgSettings; 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.domain.org.OrgVAppTemplateLeaseSettings;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncApi; import org.jclouds.vcloud.director.v1_5.features.OrgAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToAdminHref; import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -65,7 +63,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<AdminOrg> get(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); ListenableFuture<AdminOrg> get(@EndpointParam(parser = URNToAdminHref.class) String orgUrn);
/** /**
* @see AdminOrgApi#get(URI) * @see AdminOrgApi#get(URI)
@ -85,7 +83,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OrgSettings> getSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); ListenableFuture<OrgSettings> getSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn);
/** /**
* @see AdminOrgApi#getSettings(URI) * @see AdminOrgApi#getSettings(URI)
@ -105,7 +103,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@Consumes(VCloudDirectorMediaType.ORG_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgSettings> editSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, ListenableFuture<OrgSettings> editSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgSettings settings); @BinderParam(BindToXMLPayload.class) OrgSettings settings);
/** /**
@ -127,7 +125,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OrgEmailSettings> getEmailSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); ListenableFuture<OrgEmailSettings> getEmailSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn);
/** /**
* @see AdminOrgApi#getEmailSettings(URI) * @see AdminOrgApi#getEmailSettings(URI)
@ -148,7 +146,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgEmailSettings> editEmailSettings( ListenableFuture<OrgEmailSettings> editEmailSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, @EndpointParam(parser = URNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgEmailSettings settings); @BinderParam(BindToXMLPayload.class) OrgEmailSettings settings);
/** /**
@ -171,7 +169,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OrgGeneralSettings> getGeneralSettings( ListenableFuture<OrgGeneralSettings> getGeneralSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); @EndpointParam(parser = URNToAdminHref.class) String orgUrn);
/** /**
* @see AdminOrgApi#getGeneralSettings(URI) * @see AdminOrgApi#getGeneralSettings(URI)
@ -192,7 +190,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgGeneralSettings> editGeneralSettings( ListenableFuture<OrgGeneralSettings> editGeneralSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, @EndpointParam(parser = URNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings); @BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings);
/** /**
@ -214,7 +212,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OrgLdapSettings> getLdapSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); ListenableFuture<OrgLdapSettings> getLdapSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn);
/** /**
* @see AdminOrgApi#getPasswordPolicy(URI) * @see AdminOrgApi#getPasswordPolicy(URI)
@ -235,7 +233,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy( ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); @EndpointParam(parser = URNToAdminHref.class) String orgUrn);
/** /**
* @see AdminOrgApi#getPasswordPolicy(URI) * @see AdminOrgApi#getPasswordPolicy(URI)
@ -256,7 +254,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgPasswordPolicySettings> editPasswordPolicy( ListenableFuture<OrgPasswordPolicySettings> editPasswordPolicy(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, @EndpointParam(parser = URNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings); @BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings);
/** /**
@ -279,7 +277,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings( ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); @EndpointParam(parser = URNToAdminHref.class) String orgUrn);
/** /**
* @see AdminOrgApi#getVAppLeaseSettings(URI) * @see AdminOrgApi#getVAppLeaseSettings(URI)
@ -300,7 +298,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgLeaseSettings> editVAppLeaseSettings( ListenableFuture<OrgLeaseSettings> editVAppLeaseSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, @EndpointParam(parser = URNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings); @BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings);
/** /**
@ -323,7 +321,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings( ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); @EndpointParam(parser = URNToAdminHref.class) String orgUrn);
/** /**
* @see AdminOrgApi#getVAppTemplateLeaseSettings(URI) * @see AdminOrgApi#getVAppTemplateLeaseSettings(URI)
@ -344,7 +342,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgVAppTemplateLeaseSettings> editVAppTemplateLeaseSettings( ListenableFuture<OrgVAppTemplateLeaseSettings> editVAppTemplateLeaseSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, @EndpointParam(parser = URNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings); @BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings);
/** /**
@ -357,16 +355,4 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgVAppTemplateLeaseSettings> editVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref, ListenableFuture<OrgVAppTemplateLeaseSettings> editVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings); @BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings);
/**
* @return asynchronous access to admin {@link MetadataAsyncApi.Writeable} features
*/
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI adminOrgHref);
} }

View File

@ -19,13 +19,10 @@
package org.jclouds.vcloud.director.v1_5.features.admin; package org.jclouds.vcloud.director.v1_5.features.admin;
import java.net.URI; import java.net.URI;
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.AdminVdc;
import org.jclouds.vcloud.director.v1_5.domain.Task; 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.VdcApi; 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}. * Provides synchronous access to {@link AdminVdc}.
@ -83,14 +80,4 @@ public interface AdminVdcApi extends VdcApi {
void disable(String vdcUrn); void disable(String vdcUrn);
void disable(URI vdcAdminHref); void disable(URI vdcAdminHref);
/**
* @return synchronous access to {@link Writeable} features
*/
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
@Delegate
MetadataApi.Writeable getMetadataApi(@EndpointParam URI vdcAdminHref);
} }

View File

@ -29,7 +29,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
@ -37,10 +36,9 @@ import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; 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.domain.Task;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncApi; import org.jclouds.vcloud.director.v1_5.features.VdcAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.VdcURNToAdminHref; import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -58,7 +56,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<AdminVdc> get(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn); ListenableFuture<AdminVdc> get(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn);
/** /**
* @see AdminVdcApi#edit(String, AdminVdc) * @see AdminVdcApi#edit(String, AdminVdc)
@ -67,7 +65,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.ADMIN_VDC) @Produces(VCloudDirectorMediaType.ADMIN_VDC)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> edit(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn, AdminVdc vdc); ListenableFuture<Task> edit(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn, AdminVdc vdc);
/** /**
* @see AdminVdcApi#remove(String) * @see AdminVdcApi#remove(String)
@ -75,7 +73,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> remove(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn); ListenableFuture<Task> remove(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn);
/** /**
* @see AdminVdcApi#enable(String) * @see AdminVdcApi#enable(String)
@ -84,7 +82,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
@Consumes @Consumes
@Path("/action/enable") @Path("/action/enable")
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> enable(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn); ListenableFuture<Void> enable(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn);
/** /**
* @see AdminVdcApi#disable(String) * @see AdminVdcApi#disable(String)
@ -93,7 +91,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
@Consumes @Consumes
@Path("/action/disable") @Path("/action/disable")
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> disable(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn); ListenableFuture<Void> disable(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn);
/** /**
* @see AdminVdcApi#get(URI) * @see AdminVdcApi#get(URI)
@ -139,16 +137,4 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
@Path("/action/disable") @Path("/action/disable")
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> disable(@EndpointParam URI vdcAdminHref); ListenableFuture<Void> disable(@EndpointParam URI vdcAdminHref);
/**
* @return asynchronous access to {@link Writeable} features
*/
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI vdcAdminHref);
} }

View File

@ -38,8 +38,8 @@ import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Group; import org.jclouds.vcloud.director.v1_5.domain.Group;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.GroupURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref;
import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToAdminHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +59,7 @@ public interface GroupAsyncApi {
@Produces(VCloudDirectorMediaType.GROUP) @Produces(VCloudDirectorMediaType.GROUP)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Group> addGroupToOrg(@BinderParam(BindToXMLPayload.class) Group group, ListenableFuture<Group> addGroupToOrg(@BinderParam(BindToXMLPayload.class) Group group,
@EndpointParam(parser = OrgURNToAdminHref.class) String adminUrn); @EndpointParam(parser = URNToAdminHref.class) String adminUrn);
/** /**
* @see GroupApi#get(String) * @see GroupApi#get(String)
@ -68,7 +68,7 @@ public interface GroupAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Group> get(@EndpointParam(parser = GroupURNToHref.class) String groupUri); ListenableFuture<Group> get(@EndpointParam(parser = URNToHref.class) String groupUri);
/** /**
* @see GroupApi#edit(String, Group) * @see GroupApi#edit(String, Group)
@ -77,7 +77,7 @@ public interface GroupAsyncApi {
@Consumes(VCloudDirectorMediaType.GROUP) @Consumes(VCloudDirectorMediaType.GROUP)
@Produces(VCloudDirectorMediaType.GROUP) @Produces(VCloudDirectorMediaType.GROUP)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Group> edit(@EndpointParam(parser = GroupURNToHref.class) String groupUrn, ListenableFuture<Group> edit(@EndpointParam(parser = URNToHref.class) String groupUrn,
@BinderParam(BindToXMLPayload.class) Group group); @BinderParam(BindToXMLPayload.class) Group group);
/** /**
@ -86,7 +86,7 @@ public interface GroupAsyncApi {
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> remove(@EndpointParam(parser = GroupURNToHref.class) String groupUrn); ListenableFuture<Void> remove(@EndpointParam(parser = URNToHref.class) String groupUrn);
/** /**
* @see GroupApi#addGroupToOrg(Group, URI) * @see GroupApi#addGroupToOrg(Group, URI)

View File

@ -38,8 +38,8 @@ import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.User; import org.jclouds.vcloud.director.v1_5.domain.User;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToAdminHref; import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref;
import org.jclouds.vcloud.director.v1_5.functions.href.UserURNToHref; import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +59,7 @@ public interface UserAsyncApi {
@Produces(VCloudDirectorMediaType.USER) @Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<User> addUserToOrg(@BinderParam(BindToXMLPayload.class) User user, ListenableFuture<User> addUserToOrg(@BinderParam(BindToXMLPayload.class) User user,
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); @EndpointParam(parser = URNToAdminHref.class) String orgUrn);
/** /**
* @see UserApi#addUserToOrg(User, URI) * @see UserApi#addUserToOrg(User, URI)
@ -79,7 +79,7 @@ public interface UserAsyncApi {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<User> get(@EndpointParam(parser = UserURNToHref.class) String userUrn); ListenableFuture<User> get(@EndpointParam(parser = URNToHref.class) String userUrn);
/** /**
* @see UserApi#get(URI) * @see UserApi#get(URI)
@ -97,7 +97,7 @@ public interface UserAsyncApi {
@Consumes(VCloudDirectorMediaType.USER) @Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER) @Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<User> edit(@EndpointParam(parser = UserURNToHref.class) String userUrn, ListenableFuture<User> edit(@EndpointParam(parser = URNToHref.class) String userUrn,
@BinderParam(BindToXMLPayload.class) User user); @BinderParam(BindToXMLPayload.class) User user);
/** /**
@ -115,7 +115,7 @@ public interface UserAsyncApi {
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> remove(@EndpointParam(parser = UserURNToHref.class) String userUrn); ListenableFuture<Void> remove(@EndpointParam(parser = URNToHref.class) String userUrn);
/** /**
* @see UserApi#remove(URI) * @see UserApi#remove(URI)
@ -132,7 +132,7 @@ public interface UserAsyncApi {
@Path("/action/unlock") @Path("/action/unlock")
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> unlock(@EndpointParam(parser = UserURNToHref.class) String userUrn); ListenableFuture<Void> unlock(@EndpointParam(parser = URNToHref.class) String userUrn);
/** /**
* @see UserApi#unlock(URI) * @see UserApi#unlock(URI)

View File

@ -0,0 +1,68 @@
/*
* 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;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.Iterables;
/**
* Resolves URN to its Admin HREF via the entity Resolver
*
* @author Adrian Cole
*/
@Singleton
public final class URNToAdminHref implements Function<Object, URI> {
private final LoadingCache<String, Entity> resolveEntityCache;
@Inject
public URNToAdminHref(LoadingCache<String, Entity> resolveEntityCache) {
this.resolveEntityCache = checkNotNull(resolveEntityCache, "resolveEntityCache");
}
@Override
public URI apply(@Nullable Object from) {
checkArgument(checkNotNull(from, "urn") instanceof String, "urn is a String argument");
Entity entity = resolveEntityCache.getUnchecked(from.toString());
Optional<Link> link = Iterables.tryFind(entity.getLinks(), typeContainsAdmin);
checkArgument(link.isPresent(), "no admin link found for entity %s", entity);
return link.get().getHref();
}
private static final Predicate<Link> typeContainsAdmin = new Predicate<Link>() {
@Override
public boolean apply(Link in) {
return in.getType().indexOf(".admin.") != -1;
}
};
}

View File

@ -20,6 +20,7 @@ package org.jclouds.vcloud.director.v1_5.functions;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.get;
import java.net.URI; import java.net.URI;
@ -28,13 +29,9 @@ import javax.inject.Singleton;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.Entity; import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
import com.google.common.collect.Iterables;
/** /**
* Resolves URN to its HREF via the entity Resolver * Resolves URN to its HREF via the entity Resolver
@ -42,7 +39,7 @@ import com.google.common.collect.Iterables;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Singleton @Singleton
public abstract class URNToHref implements Function<Object, URI> { public final class URNToHref implements Function<Object, URI> {
private final LoadingCache<String, Entity> resolveEntityCache; private final LoadingCache<String, Entity> resolveEntityCache;
@Inject @Inject
@ -50,19 +47,11 @@ public abstract class URNToHref implements Function<Object, URI> {
this.resolveEntityCache = checkNotNull(resolveEntityCache, "resolveEntityCache"); this.resolveEntityCache = checkNotNull(resolveEntityCache, "resolveEntityCache");
} }
/**
* media type to search for.
*
* @see VCloudDirectorMediaType
*/
protected abstract String type();
@Override @Override
public URI apply(@Nullable Object from) { public URI apply(@Nullable Object from) {
checkArgument(checkNotNull(from, "urn") instanceof String, "urn is a String argument"); checkArgument(checkNotNull(from, "urn") instanceof String, "urn is a String argument");
Entity entity = resolveEntityCache.getUnchecked(from.toString()); Entity entity = resolveEntityCache.getUnchecked(from.toString());
Optional<Link> link = Iterables.tryFind(entity.getLinks(), LinkPredicates.typeEquals(type())); checkArgument(entity.getLinks().size() >0,"no links found for entity %s", entity);
checkArgument(link.isPresent(), "no link for type %s found for entity %s", type(), entity); return get(entity.getLinks(), 0).getHref();
return link.get().getHref();
} }
} }

View File

@ -1,43 +0,0 @@
/*
* 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 CatalogItemURNToHref extends URNToHref {
@Inject
public CatalogItemURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.CATALOG_ITEM;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 CatalogURNToAdminHref extends URNToHref {
@Inject
public CatalogURNToAdminHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.ADMIN_CATALOG;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 CatalogURNToHref extends URNToHref {
@Inject
public CatalogURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.CATALOG;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 GroupURNToHref extends URNToHref {
@Inject
public GroupURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.GROUP;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 NetworkURNToAdminHref extends URNToHref {
@Inject
public NetworkURNToAdminHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.ADMIN_NETWORK;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 NetworkURNToHref extends URNToHref {
@Inject
public NetworkURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.NETWORK;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 OrgURNToAdminHref extends URNToHref {
@Inject
public OrgURNToAdminHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.ADMIN_ORG;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 OrgURNToHref extends URNToHref {
@Inject
public OrgURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.ORG;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 TaskURNToHref extends URNToHref {
@Inject
public TaskURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.TASK;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 TasksListURNToHref extends URNToHref {
@Inject
public TasksListURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.TASKS_LIST;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 UserURNToHref extends URNToHref {
@Inject
public UserURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.USER;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 VdcURNToAdminHref extends URNToHref {
@Inject
public VdcURNToAdminHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.ADMIN_VDC;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 VdcURNToHref extends URNToHref {
@Inject
public VdcURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.VDC;
}
}

View File

@ -1,43 +0,0 @@
/*
* 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;
}
}

View File

@ -18,11 +18,25 @@
*/ */
package org.jclouds.vcloud.director.v1_5.user; package org.jclouds.vcloud.director.v1_5.user;
import java.net.URI;
import org.jclouds.rest.annotations.Delegate; 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.Entity; import org.jclouds.vcloud.director.v1_5.domain.Entity;
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.Session; import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.Vm;
import org.jclouds.vcloud.director.v1_5.domain.network.Network;
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
import org.jclouds.vcloud.director.v1_5.features.CatalogApi; import org.jclouds.vcloud.director.v1_5.features.CatalogApi;
import org.jclouds.vcloud.director.v1_5.features.MediaApi; import org.jclouds.vcloud.director.v1_5.features.MediaApi;
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.features.NetworkApi;
import org.jclouds.vcloud.director.v1_5.features.OrgApi; import org.jclouds.vcloud.director.v1_5.features.OrgApi;
import org.jclouds.vcloud.director.v1_5.features.QueryApi; import org.jclouds.vcloud.director.v1_5.features.QueryApi;
@ -32,6 +46,7 @@ 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.VAppTemplateApi;
import org.jclouds.vcloud.director.v1_5.features.VdcApi; import org.jclouds.vcloud.director.v1_5.features.VdcApi;
import org.jclouds.vcloud.director.v1_5.features.VmApi; import org.jclouds.vcloud.director.v1_5.features.VmApi;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.inject.Provides; import com.google.inject.Provides;
@ -123,4 +138,13 @@ public interface VCloudDirectorApi {
*/ */
@Delegate @Delegate
VmApi getVmApi(); VmApi getVmApi();
/**
* @return synchronous access to {@link Metadata} features
*/
@Delegate
MetadataApi getMetadataApi(@EndpointParam(parser = URNToHref.class) String urn);
@Delegate
MetadataApi getMetadataApi(@EndpointParam URI href);
} }

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.vcloud.director.v1_5.user; package org.jclouds.vcloud.director.v1_5.user;
import java.net.URI;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -25,16 +27,24 @@ import javax.ws.rs.PathParam;
import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.Entity; import org.jclouds.vcloud.director.v1_5.domain.Entity;
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.Session; import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.VApp; import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.Vm; import org.jclouds.vcloud.director.v1_5.domain.Vm;
import org.jclouds.vcloud.director.v1_5.domain.network.Network;
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncApi; import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncApi; import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncApi; import org.jclouds.vcloud.director.v1_5.features.OrgAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncApi; import org.jclouds.vcloud.director.v1_5.features.QueryAsyncApi;
@ -45,6 +55,7 @@ import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncApi; import org.jclouds.vcloud.director.v1_5.features.VdcAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VmAsyncApi; import org.jclouds.vcloud.director.v1_5.features.VmAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.Provides; import com.google.inject.Provides;
@ -140,4 +151,13 @@ public interface VCloudDirectorAsyncApi {
*/ */
@Delegate @Delegate
VmAsyncApi getVmApi(); VmAsyncApi getVmApi();
/**
* @return asynchronous access to {@link Metadata} features
*/
@Delegate
MetadataAsyncApi getMetadataApi(@EndpointParam(parser = URNToHref.class) String urn);
@Delegate
MetadataAsyncApi getMetadataApi(@EndpointParam URI href);
} }

View File

@ -98,7 +98,7 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
protected VAppTemplateApi vAppTemplateApi; protected VAppTemplateApi vAppTemplateApi;
protected VdcApi vdcApi; protected VdcApi vdcApi;
protected VmApi vmApi; protected VmApi vmApi;
protected MetadataApi.Writeable metadataApi; protected MetadataApi metadataApi;
/* /*
* Objects shared between tests. * Objects shared between tests.

View File

@ -151,7 +151,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
@Test @Test
public void testGetCatalogMetadataHref() { public void testGetCatalogMetadataHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse);
assertEquals(api.getCatalogApi().getMetadataApi(catalogHref).get(), metadata()); assertEquals(api.getMetadataApi(catalogHref).get(), metadata());
} }
static Metadata metadata() { static Metadata metadata() {
@ -182,7 +182,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
@Test @Test
public void testGetCatalogMetadataEntryHref() { public void testGetCatalogMetadataEntryHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadataValue, getMetadataValueResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadataValue, getMetadataValueResponse);
assertEquals(api.getCatalogApi().getMetadataApi(catalogHref).get("KEY"), "VALUE"); assertEquals(api.getMetadataApi(catalogHref).get("KEY"), "VALUE");
} }
static String item = "a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"; static String item = "a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df";
@ -308,7 +308,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
@Test @Test
public void testGetCatalogItemMetadataHref() { public void testGetCatalogItemMetadataHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getItemMetadata, getItemMetadataResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getItemMetadata, getItemMetadataResponse);
assertEquals(api.getCatalogApi().getMetadataApi(itemHref).get(), expected); assertEquals(api.getMetadataApi(itemHref).get(), expected);
} }
HttpRequest mergeItemMetadata = HttpRequest.builder() HttpRequest mergeItemMetadata = HttpRequest.builder()
@ -328,7 +328,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
@Test @Test
public void testMergeCatalogItemMetadataHref() { public void testMergeCatalogItemMetadataHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, mergeItemMetadata, mergeItemMetadataResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, mergeItemMetadata, mergeItemMetadataResponse);
assertEquals(api.getCatalogApi().getItemMetadataApi(itemHref).putAll(ImmutableMap.of("KEY", "VALUE")), mergeMetadataTask()); assertEquals(api.getMetadataApi(itemHref).putAll(ImmutableMap.of("KEY", "VALUE")), mergeMetadataTask());
} }
HttpRequest getItemMetadataValue = HttpRequest.builder() HttpRequest getItemMetadataValue = HttpRequest.builder()
@ -346,7 +346,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
@Test @Test
public void testGetCatalogItemMetadataEntryHref() { public void testGetCatalogItemMetadataEntryHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getItemMetadataValue, getItemMetadataValueResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getItemMetadataValue, getItemMetadataValueResponse);
assertEquals(api.getCatalogApi().getMetadataApi(itemHref).get("KEY"), "VALUE"); assertEquals(api.getMetadataApi(itemHref).get("KEY"), "VALUE");
} }
HttpRequest putItemMetadata = HttpRequest.builder() HttpRequest putItemMetadata = HttpRequest.builder()
@ -366,7 +366,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
@Test @Test
public void testSetCatalogItemMetadataEntryHref() { public void testSetCatalogItemMetadataEntryHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, putItemMetadata, putItemMetadataResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, putItemMetadata, putItemMetadataResponse);
assertEquals(api.getCatalogApi().getItemMetadataApi(itemHref).put("KEY", "KITTENS"), setMetadataValueTask()); assertEquals(api.getMetadataApi(itemHref).put("KEY", "KITTENS"), setMetadataValueTask());
} }
HttpRequest removeItemMetadataEntry = HttpRequest.builder() HttpRequest removeItemMetadataEntry = HttpRequest.builder()
@ -384,7 +384,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
@Test @Test
public void testRemoveCatalogItemMetadataEntryHref() { public void testRemoveCatalogItemMetadataEntryHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, removeItemMetadataEntry, removeItemMetadataEntryResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, removeItemMetadataEntry, removeItemMetadataEntryResponse);
assertEquals(api.getCatalogApi().getItemMetadataApi(itemHref).remove("KEY"), removeTask()); assertEquals(api.getMetadataApi(itemHref).remove("KEY"), removeTask());
} }
public static final Catalog catalog() { public static final Catalog catalog() {

View File

@ -175,78 +175,78 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@Test(description = "GET /catalog/{id}/metadata") @Test(description = "GET /catalog/{id}/metadata")
public void testGetCatalogMetadata() { public void testGetCatalogMetadata() {
Metadata catalogMetadata = catalogApi.getMetadataApi(catalogUrn).get(); Metadata catalogMetadata = context.getApi().getMetadataApi(catalogUrn).get();
checkMetadata(catalogMetadata); checkMetadata(catalogMetadata);
} }
@Test(description = "GET /catalog/{id}/metadata/{key}") @Test(description = "GET /catalog/{id}/metadata/{key}")
public void testGetCatalogMetadataValue() { public void testGetCatalogMetadataValue() {
Task mergeCatalogMetadata = adminCatalogApi.getMetadataApi(catalogUrn) Task mergeCatalogMetadata = context.getApi().getMetadataApi(catalogUrn)
.putAll(ImmutableMap.of("KEY", "MARMALADE")); .putAll(ImmutableMap.of("KEY", "MARMALADE"));
assertTaskSucceedsLong(mergeCatalogMetadata); assertTaskSucceedsLong(mergeCatalogMetadata);
Metadata catalogMetadata = catalogApi.getMetadataApi(catalogUrn).get(); Metadata catalogMetadata = context.getApi().getMetadataApi(catalogUrn).get();
String metadataValue = catalogApi.getMetadataApi(catalogUrn).get("KEY"); String metadataValue = context.getApi().getMetadataApi(catalogUrn).get("KEY");
assertEquals(metadataValue, catalogMetadata.get("KEY"), String.format(CORRECT_VALUE_OBJECT_FMT, "Value", assertEquals(metadataValue, catalogMetadata.get("KEY"), String.format(CORRECT_VALUE_OBJECT_FMT, "Value",
"MetadataValue", catalogMetadata.get("KEY"), metadataValue)); "MetadataValue", catalogMetadata.get("KEY"), metadataValue));
} }
@Test(description = "GET /catalogItem/{id}/metadata", dependsOnMethods = "testAddCatalogItem") @Test(description = "GET /catalogItem/{id}/metadata", dependsOnMethods = "testAddCatalogItem")
public void testGetCatalogItemMetadata() { public void testGetCatalogItemMetadata() {
Metadata catalogItemMetadata = catalogApi.getItemMetadataApi(catalogItem.getId()).get(); Metadata catalogItemMetadata = context.getApi().getMetadataApi(catalogItem.getId()).get();
checkMetadata(catalogItemMetadata); checkMetadata(catalogItemMetadata);
} }
@Test(description = "POST /catalogItem/{id}/metadata", dependsOnMethods = "testAddCatalogItem") @Test(description = "POST /catalogItem/{id}/metadata", dependsOnMethods = "testAddCatalogItem")
public void testMergeCatalogItemMetadata() { public void testMergeCatalogItemMetadata() {
Metadata before = catalogApi.getItemMetadataApi(catalogItem.getId()).get(); Metadata before = context.getApi().getMetadataApi(catalogItem.getId()).get();
Task mergeCatalogItemMetadata = catalogApi.getItemMetadataApi(catalogItem.getId()).putAll( Task mergeCatalogItemMetadata = context.getApi().getMetadataApi(catalogItem.getId()).putAll(
ImmutableMap.of("KEY", "MARMALADE", "VEGIMITE", "VALUE")); ImmutableMap.of("KEY", "MARMALADE", "VEGIMITE", "VALUE"));
checkTask(mergeCatalogItemMetadata); checkTask(mergeCatalogItemMetadata);
assertTrue(retryTaskSuccess.apply(mergeCatalogItemMetadata), assertTrue(retryTaskSuccess.apply(mergeCatalogItemMetadata),
String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata")); String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata"));
Metadata mergedCatalogItemMetadata = catalogApi.getItemMetadataApi(catalogItem.getId()).get(); Metadata mergedCatalogItemMetadata = context.getApi().getMetadataApi(catalogItem.getId()).get();
assertTrue(mergedCatalogItemMetadata.getMetadataEntries().size() > before.getMetadataEntries().size(), assertTrue(mergedCatalogItemMetadata.getMetadataEntries().size() > before.getMetadataEntries().size(),
"Should have added at least one other MetadataEntry to the CatalogItem"); "Should have added at least one other MetadataEntry to the CatalogItem");
String keyMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).get("KEY"); String keyMetadataValue = context.getApi().getMetadataApi(catalogItem.getId()).get("KEY");
assertEquals(keyMetadataValue, "MARMALADE", "The Value of the MetadataValue for KEY should have changed"); assertEquals(keyMetadataValue, "MARMALADE", "The Value of the MetadataValue for KEY should have changed");
String newKeyMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).get("VEGIMITE"); String newKeyMetadataValue = context.getApi().getMetadataApi(catalogItem.getId()).get("VEGIMITE");
assertEquals(newKeyMetadataValue, "VALUE", "The Value of the MetadataValue for NEW_KEY should have been set"); assertEquals(newKeyMetadataValue, "VALUE", "The Value of the MetadataValue for NEW_KEY should have been set");
} }
@Test(description = "GET /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testSetCatalogItemMetadataValue") @Test(description = "GET /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testSetCatalogItemMetadataValue")
public void testGetCatalogItemMetadataValue() { public void testGetCatalogItemMetadataValue() {
String metadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).get("KEY"); String metadataValue = context.getApi().getMetadataApi(catalogItem.getId()).get("KEY");
assertNotNull(metadataValue); assertNotNull(metadataValue);
} }
@Test(description = "PUT /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testMergeCatalogItemMetadata") @Test(description = "PUT /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testMergeCatalogItemMetadata")
public void testSetCatalogItemMetadataValue() { public void testSetCatalogItemMetadataValue() {
Task setCatalogItemMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).put("KEY", "NEW"); Task setCatalogItemMetadataValue = context.getApi().getMetadataApi(catalogItem.getId()).put("KEY", "NEW");
checkTask(setCatalogItemMetadataValue); checkTask(setCatalogItemMetadataValue);
assertTrue(retryTaskSuccess.apply(setCatalogItemMetadataValue), assertTrue(retryTaskSuccess.apply(setCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "setCatalogItemMetadataValue")); String.format(TASK_COMPLETE_TIMELY, "setCatalogItemMetadataValue"));
String editedMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).get("KEY"); String editedMetadataValue = context.getApi().getMetadataApi(catalogItem.getId()).get("KEY");
assertEquals(editedMetadataValue, "NEW", assertEquals(editedMetadataValue, "NEW",
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", "NEW", editedMetadataValue)); String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", "NEW", editedMetadataValue));
} }
@Test(description = "DELETE /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testGetCatalogItemMetadataValue") @Test(description = "DELETE /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testGetCatalogItemMetadataValue")
public void testRemoveCatalogItemMetadataValue() { public void testRemoveCatalogItemMetadataValue() {
Task removeCatalogItemMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).remove("KEY"); Task removeCatalogItemMetadataValue = context.getApi().getMetadataApi(catalogItem.getId()).remove("KEY");
checkTask(removeCatalogItemMetadataValue); checkTask(removeCatalogItemMetadataValue);
assertTrue(retryTaskSuccess.apply(removeCatalogItemMetadataValue), assertTrue(retryTaskSuccess.apply(removeCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "removeCatalogItemMetadataValue")); String.format(TASK_COMPLETE_TIMELY, "removeCatalogItemMetadataValue"));
String removed = catalogApi.getItemMetadataApi(catalogItem.getId()).get("KEY"); String removed = context.getApi().getMetadataApi(catalogItem.getId()).get("KEY");
assertNull(removed); assertNull(removed);
} }

View File

@ -92,7 +92,7 @@ public class KeyPairsApiLiveTest extends BaseVCloudDirectorApiLiveTest {
Vdc currentVDC = lazyGetVdc(); Vdc currentVDC = lazyGetVdc();
Media keyPairsContainer = findOrCreateKeyPairContainerInVDCNamed(currentVDC, Media keyPairsContainer = findOrCreateKeyPairContainerInVDCNamed(currentVDC,
keyPairContainer, keyPairName); keyPairContainer, keyPairName);
String keypairValue = mediaApi.getMetadataApi( String keypairValue = context.getApi().getMetadataApi(
keyPairsContainer.getId()).get(keyPairName); keyPairsContainer.getId()).get(keyPairName);
assertEquals(keypairValue, generateKeyPair(keyPairName)); assertEquals(keypairValue, generateKeyPair(keyPairName));
} }
@ -122,7 +122,7 @@ public class KeyPairsApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@Override @Override
public boolean apply(Media input) { public boolean apply(Media input) {
return mediaApi.getMetadataApi(input.getId()).get( return context.getApi().getMetadataApi(input.getId()).get(
keyPairName) != null; keyPairName) != null;
} }
}); });
@ -208,7 +208,7 @@ public class KeyPairsApiLiveTest extends BaseVCloudDirectorApiLiveTest {
private void setKeyPairOnkeyPairsContainer(Media media, String keyPairName, private void setKeyPairOnkeyPairsContainer(Media media, String keyPairName,
String keyPair) { String keyPair) {
Task setKeyPair = mediaApi.getMetadataApi(media.getId()).put( Task setKeyPair = context.getApi().getMetadataApi(media.getId()).put(
keyPairName, keyPair); keyPairName, keyPair);
Checks.checkTask(setKeyPair); Checks.checkTask(setKeyPair);
assertTrue(retryTaskSuccess.apply(setKeyPair), assertTrue(retryTaskSuccess.apply(setKeyPair),

View File

@ -238,7 +238,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
Metadata expected = metadata(); Metadata expected = metadata();
assertEquals(api.getMediaApi().getMetadataApi(mediaUri).get(), expected); assertEquals(api.getMetadataApi(mediaUri).get(), expected);
} }
@Test @Test
@ -258,7 +258,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
Metadata inputMetadata = metadata(); Metadata inputMetadata = metadata();
Task expectedTask = mergeMetadataTask(); Task expectedTask = mergeMetadataTask();
assertEquals(api.getMediaApi().getMetadataApi(mediaUri).putAll(inputMetadata), expectedTask); assertEquals(api.getMetadataApi(mediaUri).putAll(inputMetadata), expectedTask);
} }
public void testGetMetadataValue() { public void testGetMetadataValue() {
@ -273,7 +273,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.xmlFilePayload("/media/metadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE) .xmlFilePayload("/media/metadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
assertEquals(api.getMediaApi().getMetadataApi(mediaUri).get("key"), "value"); assertEquals(api.getMetadataApi(mediaUri).get("key"), "value");
} }
@Test @Test
@ -292,7 +292,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
Task expectedTask = setMetadataEntryTask(); Task expectedTask = setMetadataEntryTask();
assertEquals(api.getMediaApi().getMetadataApi(mediaUri).put("key", "value"), expectedTask); assertEquals(api.getMetadataApi(mediaUri).put("key", "value"), expectedTask);
} }
@Test @Test
@ -310,7 +310,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
Task expectedTask = removeTask(); Task expectedTask = removeTask();
assertEquals(api.getMediaApi().getMetadataApi(mediaUri).remove("key"), expectedTask); assertEquals(api.getMetadataApi(mediaUri).remove("key"), expectedTask);
} }
@Test @Test

View File

@ -220,7 +220,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
assertTrue(media.clone(oldMedia), assertTrue(media.clone(oldMedia),
String.format(OBJ_FIELD_CLONE, MEDIA, "copied media", media.toString(), oldMedia.toString())); String.format(OBJ_FIELD_CLONE, MEDIA, "copied media", media.toString(), oldMedia.toString()));
mediaApi.getMetadataApi(media.getId()).put("key", "value"); context.getApi().getMetadataApi(media.getId()).put("key", "value");
media = vdcApi media = vdcApi
.cloneMedia(vdcUrn, CloneMediaParams.builder().source(Reference.builder().fromEntity(media).build()) .cloneMedia(vdcUrn, CloneMediaParams.builder().source(Reference.builder().fromEntity(media).build())
@ -273,7 +273,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@Test(description = "GET /media/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" }) @Test(description = "GET /media/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" })
public void testGetMetadata() { public void testGetMetadata() {
metadata = mediaApi.getMetadataApi(media.getId()).get(); metadata = context.getApi().getMetadataApi(media.getId()).get();
// required for testing // 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"));
@ -283,10 +283,10 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@Test(description = "POST /media/{id}/metadata", dependsOnMethods = { "testGetMedia" }) @Test(description = "POST /media/{id}/metadata", dependsOnMethods = { "testGetMedia" })
public void testMergeMetadata() { public void testMergeMetadata() {
// test new // test new
Task mergeMetadata = mediaApi.getMetadataApi(media.getId()).putAll(ImmutableMap.of("testKey", "testValue")); Task mergeMetadata = context.getApi().getMetadataApi(media.getId()).putAll(ImmutableMap.of("testKey", "testValue"));
Checks.checkTask(mergeMetadata); Checks.checkTask(mergeMetadata);
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(new)")); assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(new)"));
metadata = mediaApi.getMetadataApi(media.getId()).get(); metadata = context.getApi().getMetadataApi(media.getId()).get();
Checks.checkMetadataFor(MEDIA, metadata); Checks.checkMetadataFor(MEDIA, metadata);
assertEquals(metadata.get("testKey"), "testValue"); assertEquals(metadata.get("testKey"), "testValue");
@ -294,10 +294,10 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
Checks.checkMediaFor(MEDIA, media); Checks.checkMediaFor(MEDIA, media);
// test edit // test edit
mergeMetadata = mediaApi.getMetadataApi(media.getId()).put("testKey", "new testValue"); mergeMetadata = context.getApi().getMetadataApi(media.getId()).put("testKey", "new testValue");
Checks.checkTask(mergeMetadata); Checks.checkTask(mergeMetadata);
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(edit)")); assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(edit)"));
metadata = mediaApi.getMetadataApi(media.getId()).get(); metadata = context.getApi().getMetadataApi(media.getId()).get();
Checks.checkMetadataFor(MEDIA, metadata); Checks.checkMetadataFor(MEDIA, metadata);
assertEquals(metadata.get("testKey"), "new testValue"); assertEquals(metadata.get("testKey"), "new testValue");
@ -307,7 +307,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@Test(description = "GET /media/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }) @Test(description = "GET /media/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
public void testGetMetadataValue() { public void testGetMetadataValue() {
metadataValue = mediaApi.getMetadataApi(media.getId()).get("key"); metadataValue = context.getApi().getMetadataApi(media.getId()).get("key");
assertNotNull(metadataValue); assertNotNull(metadataValue);
} }
@ -315,26 +315,26 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void testSetMetadataValue() { public void testSetMetadataValue() {
metadataEntryValue = "value"; metadataEntryValue = "value";
Task setMetadataEntry = mediaApi.getMetadataApi(media.getId()).put("key", metadataEntryValue); Task setMetadataEntry = context.getApi().getMetadataApi(media.getId()).put("key", metadataEntryValue);
Checks.checkTask(setMetadataEntry); Checks.checkTask(setMetadataEntry);
assertTrue(retryTaskSuccess.apply(setMetadataEntry), String.format(TASK_COMPLETE_TIMELY, "setMetadataEntry")); assertTrue(retryTaskSuccess.apply(setMetadataEntry), String.format(TASK_COMPLETE_TIMELY, "setMetadataEntry"));
metadataValue = mediaApi.getMetadataApi(media.getId()).get("key"); metadataValue = context.getApi().getMetadataApi(media.getId()).get("key");
assertNotNull(metadataValue); assertNotNull(metadataValue);
} }
@Test(description = "DELETE /media/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata", @Test(description = "DELETE /media/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata",
"testGetMetadataValue" }) "testGetMetadataValue" })
public void testRemoveMetadata() { public void testRemoveMetadata() {
Task remove = mediaApi.getMetadataApi(media.getId()).remove("testKey"); Task remove = context.getApi().getMetadataApi(media.getId()).remove("testKey");
Checks.checkTask(remove); Checks.checkTask(remove);
assertTrue(retryTaskSuccess.apply(remove), String.format(TASK_COMPLETE_TIMELY, "remove")); assertTrue(retryTaskSuccess.apply(remove), String.format(TASK_COMPLETE_TIMELY, "remove"));
metadataValue = mediaApi.getMetadataApi(media.getId()).get("testKey"); metadataValue = context.getApi().getMetadataApi(media.getId()).get("testKey");
assertNull(metadataValue, String.format(OBJ_FIELD_ATTRB_DEL, MEDIA, "Metadata", assertNull(metadataValue, String.format(OBJ_FIELD_ATTRB_DEL, MEDIA, "Metadata",
metadataValue != null ? metadataValue.toString() : "", "MetadataEntry", metadataValue != null ? metadataValue.toString() : "", "MetadataEntry",
metadataValue != null ? metadataValue.toString() : "")); metadataValue != null ? metadataValue.toString() : ""));
metadataValue = mediaApi.getMetadataApi(media.getId()).get("key"); metadataValue = context.getApi().getMetadataApi(media.getId()).get("key");
assertNotNull(metadataValue); assertNotNull(metadataValue);
media = mediaApi.get(media.getId()); media = mediaApi.get(media.getId());

View File

@ -0,0 +1,166 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.features;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ANY;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ERROR;
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.TASK;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import java.net.URI;
import java.util.TimeZone;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.domain.Link;
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.Task;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.testng.annotations.Test;
/**
* Tests the request/response behavior of {@link org.jclouds.vcloud.director.v1_5.features.MetadataApi}
*
* @author Adam Lowe
*/
@Test(groups = { "unit", "user" }, testName = "MetadataApiExpectTest")
public class MetadataApiExpectTest extends VCloudDirectorAdminApiExpectTest {
public MetadataApiExpectTest() {
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
}
public void testVappTemplateMetadata() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
MetadataApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(ANY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/metadata.xml", METADATA).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/metadata").xmlFilePayload("/vapptemplate/metadata.xml", METADATA).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getMetadataApi(uri);
assertNotNull(api);
Metadata metadata = api.get();
assertEquals(metadata, exampleMetadata());
Task task = api.putAll(exampleMetadata());
assertNotNull(task);
}
@Test(expectedExceptions = VCloudDirectorException.class)
public void testErrorGetMetadata() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
MetadataApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(ANY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getMetadataApi(uri);
api.get();
}
@Test(expectedExceptions = VCloudDirectorException.class)
public void testErrorEditMetadata() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
MetadataApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
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()).getMetadataApi(uri);
api.putAll(exampleMetadata());
}
public void testVappTemplateMetadataValue() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
MetadataApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata/12345").acceptMedia(METADATA_ENTRY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/metadataValue.xml", METADATA_ENTRY).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/metadata/12345").xmlFilePayload("/vapptemplate/metadataValue.xml", METADATA_ENTRY).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId + "/metadata/12345").acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getMetadataApi(uri);
assertNotNull(api);
String metadata = api.get("12345");
assertEquals(metadata, "some value");
Task task = api.put("12345", "some value");
assertNotNull(task);
task = api.remove("12345");
assertNotNull(task);
}
public void testErrorGetMetadataValue() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
MetadataApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata/12345").acceptMedia(METADATA_ENTRY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getMetadataApi(uri);
assertNull(api.get("12345"));
}
@Test(expectedExceptions = VCloudDirectorException.class)
public void testErrorEditMetadataValue() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
MetadataApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
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()).getMetadataApi(uri);
api.put("12345", "some value");
}
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testRemoveMissingMetadataValue() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
MetadataApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId + "/metadata/12345").acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getMetadataApi(uri);
api.remove("12345");
}
private Metadata exampleMetadata() {
return Metadata.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/metadata"))
.type("application/vnd.vmware.vcloud.metadata+xml")
.link(Link.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"))
.type("application/vnd.vmware.vcloud.vAppTemplate+xml").rel("up").build())
.entry(MetadataEntry.builder().key("key").value("value").build()).build();
}
}

View File

@ -180,7 +180,7 @@ public class NetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test @Test
public void testGetNetworkMetadataHref() { public void testGetNetworkMetadataHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse);
assertEquals(api.getNetworkApi().getMetadataApi(networkHref).get(), metadata()); assertEquals(api.getMetadataApi(networkHref).get(), metadata());
} }
static Metadata metadata() { static Metadata metadata() {
@ -215,7 +215,7 @@ public class NetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test @Test
public void testGetNetworkMetadataEntryHref() { public void testGetNetworkMetadataEntryHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadataValue, getMetadataValueResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadataValue, getMetadataValueResponse);
assertEquals(api.getNetworkApi().getMetadataApi(networkHref).get("KEY"), "value"); assertEquals(api.getMetadataApi(networkHref).get("KEY"), "value");
} }
public static OrgNetwork network() { public static OrgNetwork network() {

View File

@ -71,7 +71,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void cleanUp() { public void cleanUp() {
if (metadataSet) { if (metadataSet) {
try { try {
Task remove = adminContext.getApi().getNetworkApi().getMetadataApi(networkUrn).remove("key"); Task remove = adminContext.getApi().getMetadataApi(networkUrn).remove("key");
taskDoneEventually(remove); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting metadata"); logger.warn(e, "Error when deleting metadata");
@ -96,7 +96,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
private void setupMetadata() { private void setupMetadata() {
//TODO: block until complete //TODO: block until complete
adminContext.getApi().getNetworkApi().getMetadataApi(networkUrn).put("key", "value"); adminContext.getApi().getMetadataApi(networkUrn).put("key", "value");
metadataSet = true; metadataSet = true;
} }
@ -106,7 +106,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
setupMetadata(); setupMetadata();
} }
Metadata metadata = networkApi.getMetadataApi(networkUrn).get(); Metadata metadata = context.getApi().getMetadataApi(networkUrn).get();
// required for testing // required for testing
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()), assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
String.format(OBJ_FIELD_REQ_LIVE, NETWORK, "metadata.entries")); String.format(OBJ_FIELD_REQ_LIVE, NETWORK, "metadata.entries"));
@ -128,7 +128,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@Test(description = "GET /network/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" }) @Test(description = "GET /network/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
public void testGetMetadataValue() { public void testGetMetadataValue() {
String metadataValue = networkApi.getMetadataApi(networkUrn).get("key"); String metadataValue = context.getApi().getMetadataApi(networkUrn).get("key");
assertEquals(metadataValue, "value", String.format(OBJ_FIELD_EQ, NETWORK, "metadataEntry.value", "value", metadataValue)); assertEquals(metadataValue, "value", String.format(OBJ_FIELD_EQ, NETWORK, "metadataEntry.value", "value", metadataValue));
} }

View File

@ -147,7 +147,7 @@ public class OrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test @Test
public void testGetOrgMetadataHref() { public void testGetOrgMetadataHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse);
assertEquals(api.getOrgApi().getMetadataApi(orgHref).get(), metadata()); assertEquals(api.getMetadataApi(orgHref).get(), metadata());
} }
static Metadata metadata() { static Metadata metadata() {
@ -178,7 +178,7 @@ public class OrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test @Test
public void testGetOrgMetadataEntryHref() { public void testGetOrgMetadataEntryHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadataValue, getMetadataValueResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadataValue, getMetadataValueResponse);
assertEquals(api.getOrgApi().getMetadataApi(orgHref).get("KEY"), "VALUE"); assertEquals(api.getMetadataApi(orgHref).get("KEY"), "VALUE");
} }
public static Org org() { public static Org org() {

View File

@ -65,7 +65,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void cleanUp() throws Exception { public void cleanUp() throws Exception {
if (adminMembersSet) { if (adminMembersSet) {
try { try {
Task remove = adminContext.getApi().getOrgApi().getMetadataApi(orgUrn).remove("KEY"); Task remove = adminContext.getApi().getMetadataApi(orgUrn).remove("KEY");
taskDoneEventually(remove); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting metadata entry"); logger.warn(e, "Error when deleting metadata entry");
@ -125,7 +125,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
*/ */
private void setupAdminMembers() { private void setupAdminMembers() {
//TODO: block until complete //TODO: block until complete
adminContext.getApi().getOrgApi().getMetadataApi(orgUrn).put("KEY", "VALUE"); adminContext.getApi().getMetadataApi(orgUrn).put("KEY", "VALUE");
AdminCatalog newCatalog = AdminCatalog.builder().name("Test Catalog " + getTestDateTimeStamp()) AdminCatalog newCatalog = AdminCatalog.builder().name("Test Catalog " + getTestDateTimeStamp())
.description("created by testOrg()").build(); .description("created by testOrg()").build();
@ -140,7 +140,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void testGetOrgMetadata() { public void testGetOrgMetadata() {
// Call the method being tested // Call the method being tested
Metadata metadata = orgApi.getMetadataApi(orgUrn).get(); Metadata metadata = context.getApi().getMetadataApi(orgUrn).get();
// NOTE The environment MUST have at one metadata entry for the first organisation configured // NOTE The environment MUST have at one metadata entry for the first organisation configured
@ -154,7 +154,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@Test(description = "GET /org/{id}/metadata/{key}", dependsOnMethods = { "testGetOrgMetadata" }) @Test(description = "GET /org/{id}/metadata/{key}", dependsOnMethods = { "testGetOrgMetadata" })
public void testGetOrgMetadataValue() { public void testGetOrgMetadataValue() {
// Call the method being tested // Call the method being tested
String value = orgApi.getMetadataApi(orgUrn).get("KEY"); String value = context.getApi().getMetadataApi(orgUrn).get("KEY");
// NOTE The environment MUST have configured the metadata entry as '{ key="KEY", value="VALUE" // NOTE The environment MUST have configured the metadata entry as '{ key="KEY", value="VALUE"
// )' // )'

View File

@ -695,10 +695,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
public void testSetMetadataValue() { public void testSetMetadataValue() {
key = name("key-"); key = name("key-");
String value = name("value-"); String value = name("value-");
vAppApi.getMetadataApi(vAppUrn).put(key, value); context.getApi().getMetadataApi(vAppUrn).put(key, value);
// Retrieve the value, and assert it was set correctly // Retrieve the value, and assert it was set correctly
String newMetadataValue = vAppApi.getMetadataApi(vAppUrn).get(key); String newMetadataValue = context.getApi().getMetadataApi(vAppUrn).get(key);
// Check the retrieved object is well formed // Check the retrieved object is well formed
assertEquals(newMetadataValue, value); assertEquals(newMetadataValue, value);
@ -708,10 +708,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
public void testGetMetadata() { public void testGetMetadata() {
key = name("key-"); key = name("key-");
String value = name("value-"); String value = name("value-");
vAppApi.getMetadataApi(vAppUrn).put(key, value); context.getApi().getMetadataApi(vAppUrn).put(key, value);
// Call the method being tested // Call the method being tested
Metadata metadata = vAppApi.getMetadataApi(vAppUrn).get(); Metadata metadata = context.getApi().getMetadataApi(vAppUrn).get();
checkMetadata(metadata); checkMetadata(metadata);
@ -725,10 +725,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
key = name("key-"); key = name("key-");
String value = name("value-"); String value = name("value-");
vAppApi.getMetadataApi(vAppUrn).put(key, value); context.getApi().getMetadataApi(vAppUrn).put(key, value);
// Call the method being tested // Call the method being tested
String newValue = vAppApi.getMetadataApi(vAppUrn).get(key); String newValue = context.getApi().getMetadataApi(vAppUrn).get(key);
assertEquals(newValue, value, String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", value, newValue)); assertEquals(newValue, value, String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", value, newValue));
} }
@ -736,11 +736,11 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
@Test(groups = { "live", "user" }, description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }) @Test(groups = { "live", "user" }, description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
public void testRemoveMetadataEntry() { public void testRemoveMetadataEntry() {
// Delete the entry // Delete the entry
Task task = vAppApi.getMetadataApi(vAppUrn).remove(key); Task task = context.getApi().getMetadataApi(vAppUrn).remove(key);
retryTaskSuccess.apply(task); retryTaskSuccess.apply(task);
// Confirm the entry has been removed // Confirm the entry has been removed
Metadata newMetadata = vAppApi.getMetadataApi(vAppUrn).get(); Metadata newMetadata = context.getApi().getMetadataApi(vAppUrn).get();
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkMetadataKeyAbsentFor(VAPP, newMetadata, key); checkMetadataKeyAbsentFor(VAPP, newMetadata, key);
@ -748,17 +748,17 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
@Test(groups = { "live", "user" }, description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" }) @Test(groups = { "live", "user" }, description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
public void testMergeMetadata() { public void testMergeMetadata() {
Metadata oldMetadata = vAppApi.getMetadataApi(vAppUrn).get(); Metadata oldMetadata = context.getApi().getMetadataApi(vAppUrn).get();
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata); Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
// Store a value, to be removed // Store a value, to be removed
String key = name("key-"); String key = name("key-");
String value = name("value-"); String value = name("value-");
Task task = vAppApi.getMetadataApi(vAppUrn).putAll(ImmutableMap.of(key, value)); Task task = context.getApi().getMetadataApi(vAppUrn).putAll(ImmutableMap.of(key, value));
retryTaskSuccess.apply(task); retryTaskSuccess.apply(task);
// Confirm the entry contains everything that was there, and everything that was being added // Confirm the entry contains everything that was there, and everything that was being added
Metadata newMetadata = vAppApi.getMetadataApi(vAppUrn).get(); Metadata newMetadata = context.getApi().getMetadataApi(vAppUrn).get();
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap) Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
.put(key, value).build(); .put(key, value).build();

View File

@ -78,7 +78,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
protected void tidyUp() { protected void tidyUp() {
if (key != null) { if (key != null) {
try { try {
Task remove = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).remove(key); Task remove = context.getApi().getMetadataApi(vAppTemplateUrn).remove(key);
taskDoneEventually(remove); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting metadata entry '%s'", key); logger.warn(e, "Error when deleting metadata entry '%s'", key);

View File

@ -18,12 +18,9 @@
*/ */
package org.jclouds.vcloud.director.v1_5.features; 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.CUSTOMIZATION_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ERROR; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ERROR;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.LEASE_SETTINGS_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.NETWORK_CONFIG_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP_TEMPLATE; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP_TEMPLATE;
@ -40,8 +37,6 @@ import java.util.TimeZone;
import org.jclouds.rest.ResourceNotFoundException; import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Link;
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.Owner; import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.Task;
@ -234,109 +229,6 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
api.editLeaseSettingsSection(uri, exampleLeaseSettingsSection()); api.editLeaseSettingsSection(uri, exampleLeaseSettingsSection());
} }
public void testVappTemplateMetadata() {
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 + "/metadata").acceptMedia(ANY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/metadata.xml", METADATA).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/metadata").xmlFilePayload("/vapptemplate/metadata.xml", METADATA).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateApi();
assertNotNull(api);
Metadata metadata = api.getMetadataApi(uri).get();
assertEquals(metadata, exampleMetadata());
Task task = api.getMetadataApi(uri).putAll(exampleMetadata());
assertNotNull(task);
}
@Test(expectedExceptions = VCloudDirectorException.class)
public void testErrorGetMetadata() {
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 + "/metadata").acceptMedia(ANY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
api.getMetadataApi(uri).get();
}
@Test(expectedExceptions = VCloudDirectorException.class)
public void testErrorEditMetadata() {
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 + "/metadata").xmlFilePayload("/vapptemplate/metadata.xml", METADATA).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
api.getMetadataApi(uri).putAll(exampleMetadata());
}
public void testVappTemplateMetadataValue() {
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 + "/metadata/12345").acceptMedia(METADATA_ENTRY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/metadataValue.xml", METADATA_ENTRY).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/metadata/12345").xmlFilePayload("/vapptemplate/metadataValue.xml", METADATA_ENTRY).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId + "/metadata/12345").acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateApi();
assertNotNull(api);
String metadata = api.getMetadataApi(uri).get("12345");
assertEquals(metadata, "some value");
Task task = api.getMetadataApi(uri).put("12345", "some value");
assertNotNull(task);
task = api.getMetadataApi(uri).remove("12345");
assertNotNull(task);
}
public void testErrorGetMetadataValue() {
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 + "/metadata/12345").acceptMedia(METADATA_ENTRY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
assertNull(api.getMetadataApi(uri).get("12345"));
}
@Test(expectedExceptions = VCloudDirectorException.class)
public void testErrorEditMetadataValue() {
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 + "/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(uri).put("12345", "some value");
}
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testRemoveMissingMetadataValue() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
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(uri).remove("12345");
}
@Test(expectedExceptions = VCloudDirectorException.class) @Test(expectedExceptions = VCloudDirectorException.class)
public void testErrorGetNetworkConfigSection() { public void testErrorGetNetworkConfigSection() {
@ -427,13 +319,4 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
.build(); .build();
} }
private Metadata exampleMetadata() {
return Metadata.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/metadata"))
.type("application/vnd.vmware.vcloud.metadata+xml")
.link(Link.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"))
.type("application/vnd.vmware.vcloud.vAppTemplate+xml").rel("up").build())
.entry(MetadataEntry.builder().key("key").value("value").build()).build();
}
} }

View File

@ -82,7 +82,7 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
protected void tidyUp() { protected void tidyUp() {
if (key != null) { if (key != null) {
try { try {
Task remove = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).remove(key); Task remove = context.getApi().getMetadataApi(vAppTemplateUrn).remove(key);
taskDoneEventually(remove); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting metadata entry '%s'", key); logger.warn(e, "Error when deleting metadata entry '%s'", key);
@ -143,7 +143,7 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
@Test(description = "GET /vAppTemplate/{id}/metadata", dependsOnMethods = { "testEditMetadataValue" }) @Test(description = "GET /vAppTemplate/{id}/metadata", dependsOnMethods = { "testEditMetadataValue" })
public void testGetVAppTemplateMetadata() { public void testGetVAppTemplateMetadata() {
Metadata metadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(); Metadata metadata = context.getApi().getMetadataApi(vAppTemplateUrn).get();
checkMetadata(metadata); checkMetadata(metadata);
} }
@ -152,10 +152,10 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
// otherwise no entry may exist // otherwise no entry may exist
@Test(description = "GET /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetVAppTemplateMetadata" }) @Test(description = "GET /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetVAppTemplateMetadata" })
public void testGetMetadataValue() { public void testGetMetadataValue() {
Metadata metadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(); Metadata metadata = context.getApi().getMetadataApi(vAppTemplateUrn).get();
MetadataEntry entry = Iterables.get(metadata.getMetadataEntries(), 0); MetadataEntry entry = Iterables.get(metadata.getMetadataEntries(), 0);
String val = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(entry.getKey()); String val = context.getApi().getMetadataApi(vAppTemplateUrn).get(entry.getKey());
assertEquals(val, entry.getValue()); assertEquals(val, entry.getValue());
} }
@ -197,16 +197,16 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
@Test(description = "POST /vAppTemplate/{id}/metadata", dependsOnMethods = { "testGetVAppTemplate" }) @Test(description = "POST /vAppTemplate/{id}/metadata", dependsOnMethods = { "testGetVAppTemplate" })
public void testEditMetadata() { public void testEditMetadata() {
Metadata oldMetadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(); Metadata oldMetadata = context.getApi().getMetadataApi(vAppTemplateUrn).get();
Map<String, String> oldMetadataMap = metadataToMap(oldMetadata); Map<String, String> oldMetadataMap = metadataToMap(oldMetadata);
key = name("key-"); key = name("key-");
val = name("value-"); val = name("value-");
final Task task = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).putAll(ImmutableMap.of(key, val)); final Task task = context.getApi().getMetadataApi(vAppTemplateUrn).putAll(ImmutableMap.of(key, val));
assertTaskSucceeds(task); assertTaskSucceeds(task);
Metadata newMetadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(); Metadata newMetadata = context.getApi().getMetadataApi(vAppTemplateUrn).get();
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap) Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
.put(key, val).build(); .put(key, val).build();
checkMetadataFor("vAppTemplate", newMetadata, expectedMetadataMap); checkMetadataFor("vAppTemplate", newMetadata, expectedMetadataMap);
@ -216,19 +216,19 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
public void testEditMetadataValue() { public void testEditMetadataValue() {
val = "new" + val; val = "new" + val;
final Task task = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).put(key, val); final Task task = context.getApi().getMetadataApi(vAppTemplateUrn).put(key, val);
retryTaskSuccess.apply(task); retryTaskSuccess.apply(task);
String newMetadataValue = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(key); String newMetadataValue = context.getApi().getMetadataApi(vAppTemplateUrn).get(key);
assertEquals(newMetadataValue, val); assertEquals(newMetadataValue, val);
} }
@Test(description = "DELETE /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadataValue" }) @Test(description = "DELETE /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadataValue" })
public void testRemoveVAppTemplateMetadataValue() { public void testRemoveVAppTemplateMetadataValue() {
final Task deletionTask = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).remove(key); final Task deletionTask = context.getApi().getMetadataApi(vAppTemplateUrn).remove(key);
assertTaskSucceeds(deletionTask); assertTaskSucceeds(deletionTask);
Metadata newMetadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(); Metadata newMetadata = context.getApi().getMetadataApi(vAppTemplateUrn).get();
checkMetadataKeyAbsentFor("vAppTemplate", newMetadata, key); checkMetadataKeyAbsentFor("vAppTemplate", newMetadata, key);
key = null; key = null;
} }

View File

@ -354,7 +354,7 @@ public class VdcApiExpectTest extends VCloudDirectorAdminApiExpectTest {
Metadata expected = metadata(); Metadata expected = metadata();
assertEquals(api.getVdcApi().getMetadataApi(vdcUri).get(), expected); assertEquals(api.getMetadataApi(vdcUri).get(), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -370,7 +370,7 @@ public class VdcApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.xmlFilePayload("/vdc/metadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE) .xmlFilePayload("/vdc/metadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
assertEquals(api.getVdcApi().getMetadataApi(vdcUri).get("key"), ""); assertEquals(api.getMetadataApi(vdcUri).get("key"), "");
} }
public static Vdc getVdc() { public static Vdc getVdc() {

View File

@ -123,7 +123,7 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
if (metadataSet) { if (metadataSet) {
try { try {
Task remove = adminContext.getApi().getVdcApi().getMetadataApi(vdcUrn).remove("key"); Task remove = adminContext.getApi().getMetadataApi(vdcUrn).remove("key");
taskDoneEventually(remove); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error deleting metadata entry"); logger.warn(e, "Error deleting metadata entry");
@ -310,7 +310,7 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@Test(description = "GET /vdc/{id}/metadata", dependsOnMethods = { "testGetVdc" }) @Test(description = "GET /vdc/{id}/metadata", dependsOnMethods = { "testGetVdc" })
public void testGetMetadata() { public void testGetMetadata() {
Metadata metadata = vdcApi.getMetadataApi(vdcUrn).get(); Metadata metadata = context.getApi().getMetadataApi(vdcUrn).get();
// required for testing // required for testing
assertTrue(Iterables.isEmpty(metadata.getMetadataEntries()), assertTrue(Iterables.isEmpty(metadata.getMetadataEntries()),
@ -323,12 +323,12 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void testGetMetadataValue() { public void testGetMetadataValue() {
// setupMetadata(); // setupMetadata();
// First find a key // First find a key
Metadata metadata = vdcApi.getMetadataApi(vdcUrn).get(); Metadata metadata = context.getApi().getMetadataApi(vdcUrn).get();
Map<String, String> metadataMap = Checks.metadataToMap(metadata); Map<String, String> metadataMap = Checks.metadataToMap(metadata);
String key = Iterables.getFirst(metadataMap.keySet(), "MadeUpKey!"); String key = Iterables.getFirst(metadataMap.keySet(), "MadeUpKey!");
String value = metadataMap.get(key); String value = metadataMap.get(key);
String metadataValue = vdcApi.getMetadataApi(vdcUrn).get(key); String metadataValue = context.getApi().getMetadataApi(vdcUrn).get(key);
assertEquals(metadataValue, value); assertEquals(metadataValue, value);
} }

View File

@ -69,9 +69,7 @@ import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer; import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswerChoice; import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswerChoice;
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem; import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConfiguration;
import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection; import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection;
import org.jclouds.vcloud.director.v1_5.domain.network.Network.FenceMode;
import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection.IpAddressAllocationMode; import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection.IpAddressAllocationMode;
import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams; import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams; import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams;
@ -87,9 +85,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -851,10 +847,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
key = name("key-"); key = name("key-");
metadataValue = name("value-"); metadataValue = name("value-");
//TODO: block!! //TODO: block!!
vmApi.getMetadataApi(vmUrn).put(key, metadataValue); context.getApi().getMetadataApi(vmUrn).put(key, metadataValue);
// Retrieve the value, and assert it was set correctly // Retrieve the value, and assert it was set correctly
String newMetadataValue = vmApi.getMetadataApi(vmUrn).get(key); String newMetadataValue = context.getApi().getMetadataApi(vmUrn).get(key);
// Check the retrieved object is well formed // Check the retrieved object is well formed
assertEquals(newMetadataValue, metadataValue, assertEquals(newMetadataValue, metadataValue,
@ -867,9 +863,9 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
key = name("key-"); key = name("key-");
metadataValue = name("value-"); metadataValue = name("value-");
vmApi.getMetadataApi(vmUrn).put(key, metadataValue); context.getApi().getMetadataApi(vmUrn).put(key, metadataValue);
// Call the method being tested // Call the method being tested
Metadata metadata = vmApi.getMetadataApi(vmUrn).get(); Metadata metadata = context.getApi().getMetadataApi(vmUrn).get();
checkMetadata(metadata); checkMetadata(metadata);
@ -883,10 +879,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
metadataValue = name("value-"); metadataValue = name("value-");
//TODO: block!! //TODO: block!!
vmApi.getMetadataApi(vmUrn).put(key, metadataValue); context.getApi().getMetadataApi(vmUrn).put(key, metadataValue);
// Call the method being tested // Call the method being tested
String newMetadataValue = vmApi.getMetadataApi(vmUrn).get(key); String newMetadataValue = context.getApi().getMetadataApi(vmUrn).get(key);
assertEquals(newMetadataValue, metadataValue, assertEquals(newMetadataValue, metadataValue,
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", metadataValue, newMetadataValue)); String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", metadataValue, newMetadataValue));
@ -895,11 +891,11 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
@Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }) @Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
public void testRemoveMetadataEntry() { public void testRemoveMetadataEntry() {
// Delete the entry // Delete the entry
Task task = vmApi.getMetadataApi(vmUrn).remove(key); Task task = context.getApi().getMetadataApi(vmUrn).remove(key);
retryTaskSuccess.apply(task); retryTaskSuccess.apply(task);
// Confirm the entry has been removed // Confirm the entry has been removed
Metadata newMetadata = vmApi.getMetadataApi(vmUrn).get(); Metadata newMetadata = context.getApi().getMetadataApi(vmUrn).get();
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkMetadataKeyAbsentFor(VM, newMetadata, key); checkMetadataKeyAbsentFor(VM, newMetadata, key);
@ -907,17 +903,17 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
@Test(description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" }) @Test(description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
public void testMergeMetadata() { public void testMergeMetadata() {
Metadata oldMetadata = vmApi.getMetadataApi(vmUrn).get(); Metadata oldMetadata = context.getApi().getMetadataApi(vmUrn).get();
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata); Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
// Store a value, to be removed // Store a value, to be removed
String key = name("key-"); String key = name("key-");
String value = name("value-"); String value = name("value-");
Task task = vmApi.getMetadataApi(vmUrn).putAll(ImmutableMap.of(key, value)); Task task = context.getApi().getMetadataApi(vmUrn).putAll(ImmutableMap.of(key, value));
retryTaskSuccess.apply(task); retryTaskSuccess.apply(task);
// Confirm the entry contains everything that was there, and everything that was being added // Confirm the entry contains everything that was there, and everything that was being added
Metadata newMetadata = vmApi.getMetadataApi(vmUrn).get(); Metadata newMetadata = context.getApi().getMetadataApi(vmUrn).get();
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap) Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
.put(key, value).build(); .put(key, value).build();

View File

@ -51,7 +51,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
* Convenience reference to API api. * Convenience reference to API api.
*/ */
protected AdminVdcApi vdcApi; protected AdminVdcApi vdcApi;
protected MetadataApi.Writeable metadataApi; protected MetadataApi metadataApi;
private String metadataKey; private String metadataKey;
private String metadataValue; private String metadataValue;
@ -60,7 +60,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
public void setupRequiredApis() { public void setupRequiredApis() {
vdcApi = adminContext.getApi().getVdcApi(); vdcApi = adminContext.getApi().getVdcApi();
metadataApi = vdcApi.getMetadataApi(vdcUrn); metadataApi = context.getApi().getMetadataApi(vdcUrn);
} }
@AfterClass(alwaysRun = true) @AfterClass(alwaysRun = true)