From 062354c3059316ad4d268784602119352287d77a Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 8 Jan 2013 21:31:19 -0800 Subject: [PATCH] removed redundant metadata clients from vcloud-director --- .../v1_5/admin/VCloudDirectorAdminApi.java | 24 +++ .../admin/VCloudDirectorAdminAsyncApi.java | 23 +++ .../VCloudDirectorRestClientModule.java | 3 +- .../director/v1_5/features/CatalogApi.java | 24 +-- .../v1_5/features/CatalogAsyncApi.java | 33 +--- .../director/v1_5/features/MediaApi.java | 14 +- .../director/v1_5/features/MediaAsyncApi.java | 23 +-- .../director/v1_5/features/MetadataApi.java | 77 ++++---- .../v1_5/features/MetadataAsyncApi.java | 100 +++++------ .../director/v1_5/features/NetworkApi.java | 13 +- .../v1_5/features/NetworkAsyncApi.java | 15 +- .../vcloud/director/v1_5/features/OrgApi.java | 14 +- .../director/v1_5/features/OrgAsyncApi.java | 15 +- .../director/v1_5/features/TaskAsyncApi.java | 6 +- .../director/v1_5/features/VAppApi.java | 14 +- .../director/v1_5/features/VAppAsyncApi.java | 69 +++----- .../v1_5/features/VAppTemplateApi.java | 14 +- .../v1_5/features/VAppTemplateAsyncApi.java | 42 ++--- .../vcloud/director/v1_5/features/VdcApi.java | 14 +- .../director/v1_5/features/VdcAsyncApi.java | 30 ++-- .../vcloud/director/v1_5/features/VmApi.java | 15 +- .../director/v1_5/features/VmAsyncApi.java | 102 +++++------ .../v1_5/features/admin/AdminCatalogApi.java | 17 +- .../features/admin/AdminCatalogAsyncApi.java | 36 ++-- .../v1_5/features/admin/AdminNetworkApi.java | 17 +- .../features/admin/AdminNetworkAsyncApi.java | 22 +-- .../v1_5/features/admin/AdminOrgApi.java | 18 +- .../v1_5/features/admin/AdminOrgAsyncApi.java | 44 ++--- .../v1_5/features/admin/AdminVdcApi.java | 15 +- .../v1_5/features/admin/AdminVdcAsyncApi.java | 26 +-- .../v1_5/features/admin/GroupAsyncApi.java | 12 +- .../v1_5/features/admin/UserAsyncApi.java | 14 +- .../v1_5/functions/URNToAdminHref.java | 68 +++++++ .../director/v1_5/functions/URNToHref.java | 19 +- .../functions/href/CatalogItemURNToHref.java | 43 ----- .../functions/href/CatalogURNToAdminHref.java | 43 ----- .../v1_5/functions/href/CatalogURNToHref.java | 43 ----- .../v1_5/functions/href/GroupURNToHref.java | 43 ----- .../v1_5/functions/href/MediaURNToHref.java | 43 ----- .../functions/href/NetworkURNToAdminHref.java | 43 ----- .../v1_5/functions/href/NetworkURNToHref.java | 43 ----- .../functions/href/OrgURNToAdminHref.java | 43 ----- .../v1_5/functions/href/OrgURNToHref.java | 43 ----- .../v1_5/functions/href/TaskURNToHref.java | 43 ----- .../functions/href/TasksListURNToHref.java | 43 ----- .../v1_5/functions/href/UserURNToHref.java | 43 ----- .../functions/href/VAppTemplateURNToHref.java | 43 ----- .../v1_5/functions/href/VAppURNToHref.java | 43 ----- .../functions/href/VdcURNToAdminHref.java | 43 ----- .../v1_5/functions/href/VdcURNToHref.java | 43 ----- .../v1_5/functions/href/VmURNToHref.java | 43 ----- .../director/v1_5/user/VCloudDirectorApi.java | 24 +++ .../v1_5/user/VCloudDirectorAsyncApi.java | 20 +++ .../v1_5/AbstractVAppApiLiveTest.java | 2 +- .../v1_5/features/CatalogApiExpectTest.java | 14 +- .../v1_5/features/CatalogApiLiveTest.java | 30 ++-- .../v1_5/features/KeyPairsApiLiveTest.java | 6 +- .../v1_5/features/MediaApiExpectTest.java | 10 +- .../v1_5/features/MediaApiLiveTest.java | 24 +-- .../v1_5/features/MetadataApiExpectTest.java | 166 ++++++++++++++++++ .../v1_5/features/NetworkApiExpectTest.java | 4 +- .../v1_5/features/NetworkApiLiveTest.java | 8 +- .../v1_5/features/OrgApiExpectTest.java | 4 +- .../v1_5/features/OrgApiLiveTest.java | 8 +- .../v1_5/features/VAppApiLiveTest.java | 22 +-- .../v1_5/features/VAppNetworksLiveTest.java | 2 +- .../features/VAppTemplateApiExpectTest.java | 117 ------------ .../features/VAppTemplateApiLiveTest.java | 22 +-- .../v1_5/features/VdcApiExpectTest.java | 4 +- .../v1_5/features/VdcApiLiveTest.java | 8 +- .../director/v1_5/features/VmApiLiveTest.java | 26 ++- .../features/admin/AdminVdcApiLiveTest.java | 4 +- 72 files changed, 688 insertions(+), 1560 deletions(-) create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/URNToAdminHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogItemURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogURNToAdminHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/GroupURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/MediaURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/NetworkURNToAdminHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/NetworkURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/OrgURNToAdminHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/OrgURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/TaskURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/TasksListURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/UserURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VAppTemplateURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VAppURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VdcURNToAdminHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VdcURNToHref.java delete mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VmURNToHref.java create mode 100644 labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MetadataApiExpectTest.java diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminApi.java index 2cdf72e6f9..151ac5e0ba 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminApi.java @@ -18,7 +18,18 @@ */ package org.jclouds.vcloud.director.v1_5.admin; +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.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.AdminNetworkApi; 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.GroupApi; 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.VCloudDirectorAsyncApi; /** * Provides synchronous access to VCloudDirector Admin. @@ -81,4 +94,15 @@ public interface VCloudDirectorAdminApi extends VCloudDirectorApi { @Override @Delegate 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); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncApi.java index af31875951..26353dbf5c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncApi.java @@ -18,8 +18,19 @@ */ package org.jclouds.vcloud.director.v1_5.admin; +import java.net.URI; + import org.jclouds.rest.annotations.Delegate; +import org.jclouds.rest.annotations.EndpointParam; 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.AdminNetworkAsyncApi; 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.UserAsyncApi; 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; /** @@ -85,4 +97,15 @@ public interface VCloudDirectorAdminAsyncApi extends VCloudDirectorAsyncApi { @Override @Delegate 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); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java index 716cf18a29..b68eb1fdd7 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java @@ -113,8 +113,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule, Class> USER_DELEGATE_MAP = ImmutableMap., Class>builder() .put(CatalogApi.class, CatalogAsyncApi.class) .put(MediaApi.class, MediaAsyncApi.class) - .put(MetadataApi.Readable.class, MetadataAsyncApi.Readable.class) - .put(MetadataApi.Writeable.class, MetadataAsyncApi.Writeable.class) + .put(MetadataApi.class, MetadataAsyncApi.class) .put(NetworkApi.class, NetworkAsyncApi.class) .put(OrgApi.class, OrgAsyncApi.class) .put(QueryApi.class, QueryAsyncApi.class) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogApi.java index 1e67214c7b..e6541c1a24 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogApi.java @@ -19,12 +19,9 @@ package org.jclouds.vcloud.director.v1_5.features; 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.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. @@ -111,23 +108,4 @@ public interface CatalogApi { void removeItem(String catalogItemUrn); 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogAsyncApi.java index 337c5eb153..04867392ea 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogAsyncApi.java @@ -30,7 +30,6 @@ import javax.ws.rs.Produces; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; 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.CatalogItem; 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.href.CatalogURNToHref; +import org.jclouds.vcloud.director.v1_5.functions.URNToHref; import com.google.common.util.concurrent.ListenableFuture; @@ -59,7 +57,7 @@ public interface CatalogAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = CatalogURNToHref.class) String catalogUrn); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String catalogUrn); /** * @see CatalogApi#addItem(String, CatalogItem) @@ -69,7 +67,7 @@ public interface CatalogAsyncApi { @Consumes(VCloudDirectorMediaType.CATALOG_ITEM) @Produces(VCloudDirectorMediaType.CATALOG_ITEM) @JAXBResponseParser - ListenableFuture addItem(@EndpointParam(parser = CatalogURNToHref.class) String catalogUrn, + ListenableFuture addItem(@EndpointParam(parser = URNToHref.class) String catalogUrn, @BinderParam(BindToXMLPayload.class) CatalogItem catalogItem); /** @@ -79,7 +77,7 @@ public interface CatalogAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn); + ListenableFuture getItem(@EndpointParam(parser = URNToHref.class) String catalogItemUrn); /** * @see CatalogApi#editItem(String, CatalogItem) @@ -88,7 +86,7 @@ public interface CatalogAsyncApi { @Consumes(VCloudDirectorMediaType.CATALOG_ITEM) @Produces(VCloudDirectorMediaType.CATALOG_ITEM) @JAXBResponseParser - ListenableFuture editItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn, + ListenableFuture editItem(@EndpointParam(parser = URNToHref.class) String catalogItemUrn, @BinderParam(BindToXMLPayload.class) CatalogItem catalogItem); /** @@ -97,7 +95,7 @@ public interface CatalogAsyncApi { @DELETE @Consumes @JAXBResponseParser - ListenableFuture removeItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn); + ListenableFuture removeItem(@EndpointParam(parser = URNToHref.class) String catalogItemUrn); /** * @see CatalogApi#get(URI) @@ -145,23 +143,4 @@ public interface CatalogAsyncApi { @Consumes @JAXBResponseParser ListenableFuture 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaApi.java index 72b0aa7bb5..9ee1adbda7 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaApi.java @@ -19,13 +19,11 @@ package org.jclouds.vcloud.director.v1_5.features; 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.Owner; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.params.CloneMediaParams; -import org.jclouds.vcloud.director.v1_5.functions.href.MediaURNToHref; /** * Provides synchronous access to {@link Media}. @@ -88,14 +86,4 @@ public interface MediaApi { Owner getOwner(String mediaUrn); 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaAsyncApi.java index 043ab2ac19..7dd5237b44 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaAsyncApi.java @@ -30,7 +30,6 @@ import javax.ws.rs.Produces; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; 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.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.Media; -import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.params.CloneMediaParams; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; -import org.jclouds.vcloud.director.v1_5.functions.href.MediaURNToHref; +import org.jclouds.vcloud.director.v1_5.functions.URNToHref; import com.google.common.util.concurrent.ListenableFuture; @@ -61,7 +59,7 @@ public interface MediaAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String mediaUrn); /** * @see MediaApi#add(URI, Media) @@ -80,7 +78,7 @@ public interface MediaAsyncApi { @Consumes(VCloudDirectorMediaType.MEDIA) @Produces(VCloudDirectorMediaType.CLONE_MEDIA_PARAMS) @JAXBResponseParser - ListenableFuture clone(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn, + ListenableFuture clone(@EndpointParam(parser = URNToHref.class) String mediaUrn, @BinderParam(BindToXMLPayload.class) CloneMediaParams params); /** @@ -90,7 +88,7 @@ public interface MediaAsyncApi { @Consumes(VCloudDirectorMediaType.TASK) @Produces(VCloudDirectorMediaType.MEDIA) @JAXBResponseParser - ListenableFuture edit(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn, + ListenableFuture edit(@EndpointParam(parser = URNToHref.class) String mediaUrn, @BinderParam(BindToXMLPayload.class) Media media); /** @@ -99,7 +97,7 @@ public interface MediaAsyncApi { @DELETE @Consumes(VCloudDirectorMediaType.TASK) @JAXBResponseParser - ListenableFuture remove(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn); + ListenableFuture remove(@EndpointParam(parser = URNToHref.class) String mediaUrn); /** * @see MediaApi#getOwner(String) @@ -109,7 +107,7 @@ public interface MediaAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getOwner(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn); + ListenableFuture getOwner(@EndpointParam(parser = URNToHref.class) String mediaUrn); /** * @see MediaApi#get(URI) @@ -157,13 +155,4 @@ public interface MediaAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture 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); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataApi.java index 4e9917fe03..829822902a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataApi.java @@ -29,52 +29,43 @@ import org.jclouds.vcloud.director.v1_5.domain.Task; * @author danikov, Adrian Cole */ public interface MetadataApi { + /** + * Retrieves an list of metadata + * + * @return a list of metadata + */ + Metadata get(); - public static interface Readable extends MetadataApi { - /** - * Retrieves an list of metadata - * - * @return a list of metadata - */ - Metadata get(); + /** + * Retrieves a metadata value + * + * @return the metadata value, or null if not found + */ + String get(String key); - /** - * Retrieves a metadata value - * - * @return the metadata value, or null if not found - */ - String get(String key); - } + /** + * Merges the metadata for a media with the information provided. + * + * @return a task. This operation is asynchronous and the user should monitor the returned task status in order to + * check when it is completed. + */ + Task putAll(Map metadata); - public static interface Writeable extends Readable { + /** + * Sets the metadata for the particular key for the media to the value provided. Note: this will replace any existing + * metadata information + * + * @return a task. This operation is asynchronous and the user should monitor the returned task status in order to + * check when it is completed. + */ + Task put(String key, String value); - /** - * Merges the metadata for a media with the information provided. - * - * @return a task. This operation is asynchronous and the user should - * monitor the returned task status in order to check when it is - * completed. - */ - Task putAll(Map metadata); + /** + * Deletes a metadata entry. + * + * @return a task. This operation is asynchronous and the user should monitor the returned task status in order to + * check when it is completed. + */ + Task remove(String key); - /** - * Sets the metadata for the particular key for the media to the value - * provided. Note: this will replace any existing metadata information - * - * @return a task. This operation is asynchronous and the user should - * monitor the returned task status in order to check when it is - * completed. - */ - Task put(String key, String value); - - /** - * Deletes a metadata entry. - * - * @return a task. This operation is asynchronous and the user should - * monitor the returned task status in order to check when it is - * completed. - */ - Task remove(String key); - - } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataAsyncApi.java index 8569e59529..cf7c4c9d82 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataAsyncApi.java @@ -49,65 +49,57 @@ import com.google.common.util.concurrent.ListenableFuture; * @see MetadataApi * @author Adrian Cole, danikov */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) public interface MetadataAsyncApi { - @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) - public static interface Readable extends MetadataAsyncApi { + /** + * @see MetadataApi.Readable#get() + */ + @GET + @Path("/metadata") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + ListenableFuture get(); - /** - * @see MetadataApi.Readable#get() - */ - @GET - @Path("/metadata") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(); + /** + * @see MetadataApi.Readable#get(String) + */ + @GET + @Path("/metadata/{key}") + @Consumes + @ResponseParser(RegexValueParser.class) + @Fallback(NullOnNotFoundOr404.class) + ListenableFuture get(@PathParam("key") String key); - /** - * @see MetadataApi.Readable#get(String) - */ - @GET - @Path("/metadata/{key}") - @Consumes - @ResponseParser(RegexValueParser.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("key") String key); + /** + * @see MetadataApi.Writable#putAll + */ + @POST + @Path("/metadata") + @Consumes(VCloudDirectorMediaType.TASK) + @Produces(VCloudDirectorMediaType.METADATA) + @JAXBResponseParser + ListenableFuture putAll(@BinderParam(BindMapAsMetadata.class) Map metadata); - } + /** + * @see MetadataApi#put + */ + @PUT + @Path("/metadata/{key}") + @Consumes(VCloudDirectorMediaType.TASK) + @Produces(VCloudDirectorMediaType.METADATA_VALUE) + @JAXBResponseParser + ListenableFuture put(@PathParam("key") String key, + @BinderParam(BindStringAsMetadataValue.class) String metadataValue); - @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) - public static interface Writeable extends Readable { + /** + * @see MetadataApi.Writable#remove + */ + @DELETE + @Path("/metadata/{key}") + @Consumes(VCloudDirectorMediaType.TASK) + @JAXBResponseParser + ListenableFuture remove(@PathParam("key") String key); - /** - * @see MetadataApi.Writable#putAll - */ - @POST - @Path("/metadata") - @Consumes(VCloudDirectorMediaType.TASK) - @Produces(VCloudDirectorMediaType.METADATA) - @JAXBResponseParser - ListenableFuture putAll(@BinderParam(BindMapAsMetadata.class) Map metadata); - - /** - * @see MetadataApi.Writeable#put - */ - @PUT - @Path("/metadata/{key}") - @Consumes(VCloudDirectorMediaType.TASK) - @Produces(VCloudDirectorMediaType.METADATA_VALUE) - @JAXBResponseParser - ListenableFuture put(@PathParam("key") String key, - @BinderParam(BindStringAsMetadataValue.class) String metadataValue); - - /** - * @see MetadataApi.Writable#remove - */ - @DELETE - @Path("/metadata/{key}") - @Consumes(VCloudDirectorMediaType.TASK) - @JAXBResponseParser - ListenableFuture remove(@PathParam("key") String key); - - } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/NetworkApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/NetworkApi.java index cd09d64e08..4188fdd4f0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/NetworkApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/NetworkApi.java @@ -19,10 +19,8 @@ package org.jclouds.vcloud.director.v1_5.features; 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.functions.href.NetworkURNToHref; /** * Provides synchronous access to {@link Network}. @@ -40,13 +38,4 @@ public interface NetworkApi { Network get(String networkUrn); 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); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/NetworkAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/NetworkAsyncApi.java index f564e5dbcf..baff2dafab 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/NetworkAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/NetworkAsyncApi.java @@ -24,14 +24,13 @@ import javax.ws.rs.Consumes; import javax.ws.rs.GET; import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.RequestFilters; 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.functions.href.NetworkURNToHref; +import org.jclouds.vcloud.director.v1_5.functions.URNToHref; import com.google.common.util.concurrent.ListenableFuture; @@ -49,7 +48,7 @@ public interface NetworkAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = NetworkURNToHref.class) String networkUrn); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String networkUrn); /** * @see NetworkApi#get(URI) @@ -59,14 +58,4 @@ public interface NetworkAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgApi.java index 5f67718ee0..8e3a3ef4ef 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgApi.java @@ -19,11 +19,9 @@ package org.jclouds.vcloud.director.v1_5.features; 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.OrgList; -import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToHref; /** * Provides synchronous access to {@link Org}. @@ -56,14 +54,4 @@ public interface OrgApi { Org get(String orgUrn); 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgAsyncApi.java index 2e7ecc126a..507b369f4f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgAsyncApi.java @@ -25,7 +25,6 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; 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.OrgList; 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; @@ -60,7 +59,7 @@ public interface OrgAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = OrgURNToHref.class) String orgUrn); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String orgUrn); /** * @see OrgApi#get(URI) @@ -70,14 +69,4 @@ public interface OrgAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncApi.java index 904f06dc7f..e8ddfc51d0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncApi.java @@ -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.TasksList; 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; @@ -60,7 +60,7 @@ public interface TaskAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = TaskURNToHref.class) String taskUrn); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String taskUrn); /** * @see TaskApi#get(URI) @@ -78,7 +78,7 @@ public interface TaskAsyncApi { @Path("/action/cancel") @Consumes @JAXBResponseParser - ListenableFuture cancel(@EndpointParam(parser = TaskURNToHref.class) String taskUrn); + ListenableFuture cancel(@EndpointParam(parser = URNToHref.class) String taskUrn); /** * @see TaskApi#cancel(URI) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppApi.java index f5f7f317e0..87fd76d3ba 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppApi.java @@ -19,10 +19,9 @@ package org.jclouds.vcloud.director.v1_5.features; import java.net.URI; + import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.dmtf.ovf.StartupSection; -import org.jclouds.rest.annotations.Delegate; -import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; 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.section.LeaseSettingsSection; import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection; -import org.jclouds.vcloud.director.v1_5.functions.href.VAppURNToHref; /** * Provides synchronous access to {@link VApp} objects. @@ -488,14 +486,4 @@ public interface VAppApi { Task editStartupSection(String vAppUrn, 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncApi.java index eab8eab2b0..05c9b54682 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncApi.java @@ -44,7 +44,6 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.dmtf.ovf.StartupSection; import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; 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.NetworkConfigSection; 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; @@ -79,7 +78,7 @@ public interface VAppAsyncApi { @Consumes(VAPP) @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#edit(String, VApp) @@ -88,7 +87,7 @@ public interface VAppAsyncApi { @Produces(VAPP) @Consumes(TASK) @JAXBResponseParser - ListenableFuture edit(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, + ListenableFuture edit(@EndpointParam(parser = URNToHref.class) String vAppUrn, @BinderParam(BindToXMLPayload.class) VApp vApp); /** @@ -97,7 +96,7 @@ public interface VAppAsyncApi { @DELETE @Consumes(TASK) @JAXBResponseParser - ListenableFuture remove(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture remove(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#editControlAccess(String, ControlAccessParams) @@ -107,7 +106,7 @@ public interface VAppAsyncApi { @Produces(CONTROL_ACCESS) @Consumes(CONTROL_ACCESS) @JAXBResponseParser - ListenableFuture editControlAccess(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, + ListenableFuture editControlAccess(@EndpointParam(parser = URNToHref.class) String vAppUrn, @BinderParam(BindToXMLPayload.class) ControlAccessParams params); /** @@ -118,7 +117,7 @@ public interface VAppAsyncApi { @Produces(DEPLOY_VAPP_PARAMS) @Consumes(TASK) @JAXBResponseParser - ListenableFuture deploy(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, + ListenableFuture deploy(@EndpointParam(parser = URNToHref.class) String vAppUrn, @BinderParam(BindToXMLPayload.class) DeployVAppParams params); /** @@ -128,7 +127,7 @@ public interface VAppAsyncApi { @Path("/action/discardSuspendedState") @Consumes(TASK) @JAXBResponseParser - ListenableFuture discardSuspendedState(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture discardSuspendedState(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#enterMaintenanceMode(String) @@ -137,7 +136,7 @@ public interface VAppAsyncApi { @Path("/action/enterMaintenanceMode") @Consumes @JAXBResponseParser - ListenableFuture enterMaintenanceMode(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture enterMaintenanceMode(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#exitMaintenanceMode(String) @@ -146,7 +145,7 @@ public interface VAppAsyncApi { @Path("/action/exitMaintenanceMode") @Consumes @JAXBResponseParser - ListenableFuture exitMaintenanceMode(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture exitMaintenanceMode(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#recompose(String, RecomposeVAppParams) @@ -156,7 +155,7 @@ public interface VAppAsyncApi { @Produces(RECOMPOSE_VAPP_PARAMS) @Consumes(TASK) @JAXBResponseParser - ListenableFuture recompose(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, + ListenableFuture recompose(@EndpointParam(parser = URNToHref.class) String vAppUrn, @BinderParam(BindToXMLPayload.class) RecomposeVAppParams params); /** @@ -167,7 +166,7 @@ public interface VAppAsyncApi { @Produces(UNDEPLOY_VAPP_PARAMS) @Consumes(TASK) @JAXBResponseParser - ListenableFuture undeploy(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, + ListenableFuture undeploy(@EndpointParam(parser = URNToHref.class) String vAppUrn, @BinderParam(BindToXMLPayload.class) UndeployVAppParams params); /** @@ -178,7 +177,7 @@ public interface VAppAsyncApi { @Consumes(CONTROL_ACCESS) @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getAccessControl(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture getAccessControl(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#powerOff(String) @@ -187,7 +186,7 @@ public interface VAppAsyncApi { @Path("/power/action/powerOff") @Consumes(TASK) @JAXBResponseParser - ListenableFuture powerOff(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture powerOff(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#powerOn(String) @@ -196,7 +195,7 @@ public interface VAppAsyncApi { @Path("/power/action/powerOn") @Consumes(TASK) @JAXBResponseParser - ListenableFuture powerOn(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture powerOn(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#reboot(String) @@ -205,7 +204,7 @@ public interface VAppAsyncApi { @Path("/power/action/reboot") @Consumes(TASK) @JAXBResponseParser - ListenableFuture reboot(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture reboot(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#reset(String) @@ -214,7 +213,7 @@ public interface VAppAsyncApi { @Path("/power/action/reset") @Consumes(TASK) @JAXBResponseParser - ListenableFuture reset(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture reset(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#shutdown(String) @@ -223,7 +222,7 @@ public interface VAppAsyncApi { @Path("/power/action/shutdown") @Consumes(TASK) @JAXBResponseParser - ListenableFuture shutdown(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture shutdown(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#suspend(String) @@ -232,7 +231,7 @@ public interface VAppAsyncApi { @Path("/power/action/suspend") @Consumes(TASK) @JAXBResponseParser - ListenableFuture suspend(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture suspend(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#getLeaseSettingsSection(String) @@ -243,7 +242,7 @@ public interface VAppAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getLeaseSettingsSection( - @EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + @EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#editLeaseSettingsSection(String, LeaseSettingsSection) @@ -253,7 +252,7 @@ public interface VAppAsyncApi { @Produces(LEASE_SETTINGS_SECTION) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editLeaseSettingsSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, + ListenableFuture editLeaseSettingsSection(@EndpointParam(parser = URNToHref.class) String vAppUrn, @BinderParam(BindToXMLPayload.class) LeaseSettingsSection section); /** @@ -265,7 +264,7 @@ public interface VAppAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getNetworkConfigSection( - @EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + @EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#editNetworkConfigSection(String, NetworkConfigSection) @@ -275,7 +274,7 @@ public interface VAppAsyncApi { @Produces(NETWORK_CONFIG_SECTION) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editNetworkConfigSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, + ListenableFuture editNetworkConfigSection(@EndpointParam(parser = URNToHref.class) String vAppUrn, @BinderParam(BindToXMLPayload.class) NetworkConfigSection section); /** @@ -286,7 +285,7 @@ public interface VAppAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getNetworkSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture getNetworkSection(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#getOwner(String) @@ -296,7 +295,7 @@ public interface VAppAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getOwner(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture getOwner(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#editOwner(String, Owner) @@ -306,7 +305,7 @@ public interface VAppAsyncApi { @Produces(OWNER) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editOwner(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, + ListenableFuture editOwner(@EndpointParam(parser = URNToHref.class) String vAppUrn, @BinderParam(BindToXMLPayload.class) Owner owner); /** @@ -317,7 +316,7 @@ public interface VAppAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getProductSections(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture getProductSections(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#editProductSections(String, ProductSectionList) @@ -327,7 +326,7 @@ public interface VAppAsyncApi { @Produces(PRODUCT_SECTION_LIST) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editProductSections(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, + ListenableFuture editProductSections(@EndpointParam(parser = URNToHref.class) String vAppUrn, @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); /** @@ -338,7 +337,7 @@ public interface VAppAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getStartupSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn); + ListenableFuture getStartupSection(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * @see VAppApi#editStartupSection(String, StartupSection) @@ -348,7 +347,7 @@ public interface VAppAsyncApi { @Produces(STARTUP_SECTION) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editStartupSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn, + ListenableFuture editStartupSection(@EndpointParam(parser = URNToHref.class) String vAppUrn, @BinderParam(BindToXMLPayload.class) StartupSection section); /** @@ -625,14 +624,4 @@ public interface VAppAsyncApi { @JAXBResponseParser ListenableFuture editStartupSection(@EndpointParam URI vAppHref, @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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApi.java index 71d4878bbc..b5215f8055 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApi.java @@ -19,9 +19,8 @@ package org.jclouds.vcloud.director.v1_5.features; import java.net.URI; + 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.ProductSectionList; 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.LeaseSettingsSection; 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. @@ -296,14 +294,4 @@ public interface VAppTemplateApi { References getShadowVms(String templateUrn); 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncApi.java index 8ababc92b0..3d71259b54 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncApi.java @@ -40,13 +40,11 @@ import javax.ws.rs.Produces; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.RequestFilters; 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.ProductSectionList; 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.NetworkConfigSection; 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; @@ -75,7 +73,7 @@ public interface VAppTemplateAsyncApi { @Consumes(VAPP_TEMPLATE) @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = VAppTemplateURNToHref.class) String reference); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String reference); /** * @see VAppTemplateApi#edit(String, VAppTemplate) @@ -84,7 +82,7 @@ public interface VAppTemplateAsyncApi { @Produces(VAPP_TEMPLATE) @Consumes(TASK) @JAXBResponseParser - ListenableFuture edit(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn, + ListenableFuture edit(@EndpointParam(parser = URNToHref.class) String templateUrn, @BinderParam(BindToXMLPayload.class) VAppTemplate template); /** @@ -101,7 +99,7 @@ public interface VAppTemplateAsyncApi { @POST @Path("/action/disableDownload") @JAXBResponseParser - ListenableFuture disableDownload(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); + ListenableFuture disableDownload(@EndpointParam(parser = URNToHref.class) String templateUrn); /** * @see VAppTemplateApi#enableDownload(String) @@ -110,7 +108,7 @@ public interface VAppTemplateAsyncApi { @Consumes(TASK) @Path("/action/enableDownload") @JAXBResponseParser - ListenableFuture enableDownload(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); + ListenableFuture enableDownload(@EndpointParam(parser = URNToHref.class) String templateUrn); /** * @see VAppTemplateApi#getCustomizationSection(String) @@ -121,7 +119,7 @@ public interface VAppTemplateAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getCustomizationSection( - @EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); + @EndpointParam(parser = URNToHref.class) String templateUrn); /** * @see VAppTemplateApi#getLeaseSettingsSection(String) @@ -132,7 +130,7 @@ public interface VAppTemplateAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getLeaseSettingsSection( - @EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); + @EndpointParam(parser = URNToHref.class) String templateUrn); /** * @see VAppTemplateApi#editLeaseSettingsSection(String, LeaseSettingsSection) @@ -143,7 +141,7 @@ public interface VAppTemplateAsyncApi { @Path("/leaseSettingsSection") @JAXBResponseParser ListenableFuture editLeaseSettingsSection( - @EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn, + @EndpointParam(parser = URNToHref.class) String templateUrn, @BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection); /** @@ -155,7 +153,7 @@ public interface VAppTemplateAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getNetworkConfigSection( - @EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); + @EndpointParam(parser = URNToHref.class) String templateUrn); /** * @see VAppTemplateApi#getNetworkSection(String) @@ -166,7 +164,7 @@ public interface VAppTemplateAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getNetworkSection( - @EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); + @EndpointParam(parser = URNToHref.class) String templateUrn); /** * @see VAppTemplateApi#getOvf(String) @@ -176,7 +174,7 @@ public interface VAppTemplateAsyncApi { @Path("/ovf") @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getOvf(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); + ListenableFuture getOvf(@EndpointParam(parser = URNToHref.class) String templateUrn); /** * @see VAppTemplateApi#getOwnerOfVAppTemplate(String) @@ -186,7 +184,7 @@ public interface VAppTemplateAsyncApi { @Path("/owner") @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getOwner(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); + ListenableFuture getOwner(@EndpointParam(parser = URNToHref.class) String templateUrn); /** * @see VAppTemplateApi#getProductSectionsForVAppTemplate(String) @@ -197,7 +195,7 @@ public interface VAppTemplateAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getProductSections( - @EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); + @EndpointParam(parser = URNToHref.class) String templateUrn); /** * @see VAppTemplateApi#editProductSections(String, ProductSectionList) @@ -207,7 +205,7 @@ public interface VAppTemplateAsyncApi { @Consumes(TASK) @Path("/productSections") @JAXBResponseParser - ListenableFuture editProductSections(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn, + ListenableFuture editProductSections(@EndpointParam(parser = URNToHref.class) String templateUrn, @BinderParam(BindToXMLPayload.class) ProductSectionList sections); /** @@ -218,7 +216,7 @@ public interface VAppTemplateAsyncApi { @Path("/shadowVms") @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getShadowVms(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn); + ListenableFuture getShadowVms(@EndpointParam(parser = URNToHref.class) String templateUrn); /** * @see VAppTemplateApi#get(URI) @@ -365,14 +363,4 @@ public interface VAppTemplateAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcApi.java index 8b434047e6..70bb8b51c5 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcApi.java @@ -19,8 +19,7 @@ package org.jclouds.vcloud.director.v1_5.features; 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.VApp; 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.InstantiateVAppParams; import org.jclouds.vcloud.director.v1_5.domain.params.UploadVAppTemplateParams; -import org.jclouds.vcloud.director.v1_5.functions.href.VdcURNToHref; /** * Provides synchronous access to a vDC. @@ -188,14 +186,4 @@ public interface VdcApi { Media addMedia(String vdcUrn, 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncApi.java index e512c3accd..08c17f8fd1 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncApi.java @@ -28,7 +28,6 @@ import javax.ws.rs.Produces; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; 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.UploadVAppTemplateParams; 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; @@ -65,7 +64,7 @@ public interface VdcAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String vdcUrn); /** * @see VdcApi#captureVApp(String, CaptureVAppParams) @@ -75,7 +74,7 @@ public interface VdcAsyncApi { @Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE) @Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) @JAXBResponseParser - ListenableFuture captureVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, + ListenableFuture captureVApp(@EndpointParam(parser = URNToHref.class) String vdcUrn, @BinderParam(BindToXMLPayload.class) CaptureVAppParams params); /** @@ -86,7 +85,7 @@ public interface VdcAsyncApi { @Consumes(VCloudDirectorMediaType.MEDIA) @Produces(VCloudDirectorMediaType.CLONE_MEDIA_PARAMS) @JAXBResponseParser - ListenableFuture cloneMedia(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, + ListenableFuture cloneMedia(@EndpointParam(parser = URNToHref.class) String vdcUrn, @BinderParam(BindToXMLPayload.class) CloneMediaParams params); /** @@ -98,7 +97,7 @@ public interface VdcAsyncApi { @Produces(VCloudDirectorMediaType.CLONE_VAPP_PARAMS) // TODO fix these etc. @JAXBResponseParser - ListenableFuture cloneVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, + ListenableFuture cloneVApp(@EndpointParam(parser = URNToHref.class) String vdcUrn, @BinderParam(BindToXMLPayload.class) CloneVAppParams params); /** @@ -109,7 +108,7 @@ public interface VdcAsyncApi { @Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE) @Produces(VCloudDirectorMediaType.CLONE_VAPP_TEMPLATE_PARAMS) @JAXBResponseParser - ListenableFuture cloneVAppTemplate(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, + ListenableFuture cloneVAppTemplate(@EndpointParam(parser = URNToHref.class) String vdcUrn, @BinderParam(BindToXMLPayload.class) CloneVAppTemplateParams params); /** @@ -120,7 +119,7 @@ public interface VdcAsyncApi { @Consumes(VCloudDirectorMediaType.VAPP) @Produces(VCloudDirectorMediaType.COMPOSE_VAPP_PARAMS) @JAXBResponseParser - ListenableFuture composeVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, + ListenableFuture composeVApp(@EndpointParam(parser = URNToHref.class) String vdcUrn, @BinderParam(BindToXMLPayload.class) ComposeVAppParams params); /** @@ -131,7 +130,7 @@ public interface VdcAsyncApi { @Consumes(VCloudDirectorMediaType.VAPP) @Produces(VCloudDirectorMediaType.INSTANTIATE_VAPP_TEMPLATE_PARAMS) @JAXBResponseParser - ListenableFuture instantiateVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, + ListenableFuture instantiateVApp(@EndpointParam(parser = URNToHref.class) String vdcUrn, @BinderParam(BindToXMLPayload.class) InstantiateVAppParams params); /** @@ -142,7 +141,7 @@ public interface VdcAsyncApi { @Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE) @Produces(VCloudDirectorMediaType.UPLOAD_VAPP_TEMPLATE_PARAMS) @JAXBResponseParser - ListenableFuture uploadVAppTemplate(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, + ListenableFuture uploadVAppTemplate(@EndpointParam(parser = URNToHref.class) String vdcUrn, @BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params); /** @@ -153,7 +152,7 @@ public interface VdcAsyncApi { @Consumes(VCloudDirectorMediaType.MEDIA) @Produces(VCloudDirectorMediaType.MEDIA) @JAXBResponseParser - ListenableFuture addMedia(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, + ListenableFuture addMedia(@EndpointParam(parser = URNToHref.class) String vdcUrn, @BinderParam(BindToXMLPayload.class) Media media); /** @@ -253,13 +252,4 @@ public interface VdcAsyncApi { @JAXBResponseParser ListenableFuture 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmApi.java index 299fdcb18f..cb60318a66 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmApi.java @@ -19,12 +19,12 @@ package org.jclouds.vcloud.director.v1_5.features; 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.RasdItemsList; import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket; import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.domain.VApp; import org.jclouds.vcloud.director.v1_5.domain.Vm; import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion; 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.RuntimeInfoSection; import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection; -import org.jclouds.vcloud.director.v1_5.functions.href.VmURNToHref; /** * Provides synchronous access to {@link Vm} objects. @@ -598,14 +597,4 @@ public interface VmApi { Task editVirtualHardwareSectionSerialPorts(String vmUrn, 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncApi.java index 05c10cdafc..a375b7fbfb 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncApi.java @@ -45,8 +45,8 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.dmtf.cim.ResourceAllocationSettingData; import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; 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.filters.AddVCloudAuthorizationAndCookieToRequest; 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; @@ -90,7 +90,7 @@ public interface VmAsyncApi { @Consumes(VM) @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#edit(String, Vm) @@ -99,7 +99,7 @@ public interface VmAsyncApi { @Produces(VM) @Consumes(TASK) @JAXBResponseParser - ListenableFuture edit(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture edit(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) Vm vApp); /** @@ -108,7 +108,7 @@ public interface VmAsyncApi { @DELETE @Consumes(TASK) @JAXBResponseParser - ListenableFuture remove(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture remove(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#consolidate(String) @@ -117,7 +117,7 @@ public interface VmAsyncApi { @Path("/action/consolidate") @Consumes(TASK) @JAXBResponseParser - ListenableFuture consolidate(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture consolidate(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#deploy(String, DeployVAppParams) @@ -127,7 +127,7 @@ public interface VmAsyncApi { @Produces(DEPLOY_VAPP_PARAMS) @Consumes(TASK) @JAXBResponseParser - ListenableFuture deploy(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture deploy(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) DeployVAppParams params); /** @@ -137,7 +137,7 @@ public interface VmAsyncApi { @Path("/action/discardSuspendedState") @Consumes(TASK) @JAXBResponseParser - ListenableFuture discardSuspendedState(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture discardSuspendedState(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#installVMwareTools(String) @@ -146,7 +146,7 @@ public interface VmAsyncApi { @Path("/action/installVMwareTools") @Consumes(TASK) @JAXBResponseParser - ListenableFuture installVMwareTools(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture installVMwareTools(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#relocate(String, RelocateParams) @@ -156,7 +156,7 @@ public interface VmAsyncApi { @Produces(RELOCATE_VM_PARAMS) @Consumes(TASK) @JAXBResponseParser - ListenableFuture relocate(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture relocate(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) RelocateParams params); /** @@ -167,7 +167,7 @@ public interface VmAsyncApi { @Produces(UNDEPLOY_VAPP_PARAMS) @Consumes(TASK) @JAXBResponseParser - ListenableFuture undeploy(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture undeploy(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) UndeployVAppParams params); /** @@ -177,7 +177,7 @@ public interface VmAsyncApi { @Path("/action/upgradeHardwareVersion") @Consumes(TASK) @JAXBResponseParser - ListenableFuture upgradeHardwareVersion(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture upgradeHardwareVersion(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#powerOff(String) @@ -186,7 +186,7 @@ public interface VmAsyncApi { @Path("/power/action/powerOff") @Consumes(TASK) @JAXBResponseParser - ListenableFuture powerOff(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture powerOff(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#powerOn(String) @@ -195,7 +195,7 @@ public interface VmAsyncApi { @Path("/power/action/powerOn") @Consumes(TASK) @JAXBResponseParser - ListenableFuture powerOn(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture powerOn(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#reboot(String) @@ -204,7 +204,7 @@ public interface VmAsyncApi { @Path("/power/action/reboot") @Consumes(TASK) @JAXBResponseParser - ListenableFuture reboot(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture reboot(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#reset(String) @@ -213,7 +213,7 @@ public interface VmAsyncApi { @Path("/power/action/reset") @Consumes(TASK) @JAXBResponseParser - ListenableFuture reset(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture reset(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#shutdown(String) @@ -222,7 +222,7 @@ public interface VmAsyncApi { @Path("/power/action/shutdown") @Consumes(TASK) @JAXBResponseParser - ListenableFuture shutdown(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture shutdown(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#suspend(String) @@ -231,7 +231,7 @@ public interface VmAsyncApi { @Path("/power/action/suspend") @Consumes(TASK) @JAXBResponseParser - ListenableFuture suspend(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture suspend(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#getGuestCustomizationSection(String) @@ -242,7 +242,7 @@ public interface VmAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getGuestCustomizationSection( - @EndpointParam(parser = VmURNToHref.class) String vmUrn); + @EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#editGuestCustomizationSection(String, GuestCustomizationSection) @@ -252,7 +252,7 @@ public interface VmAsyncApi { @Produces(GUEST_CUSTOMIZATION_SECTION) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editGuestCustomizationSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture editGuestCustomizationSection(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) GuestCustomizationSection section); /** @@ -263,7 +263,7 @@ public interface VmAsyncApi { @Produces(MEDIA_PARAMS) @Consumes(TASK) @JAXBResponseParser - ListenableFuture ejectMedia(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture ejectMedia(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); /** @@ -274,7 +274,7 @@ public interface VmAsyncApi { @Produces(MEDIA_PARAMS) @Consumes(TASK) @JAXBResponseParser - ListenableFuture insertMedia(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture insertMedia(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); /** @@ -286,7 +286,7 @@ public interface VmAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getNetworkConnectionSection( - @EndpointParam(parser = VmURNToHref.class) String vmUrn); + @EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#editNetworkConnectionSection(String, NetworkConnectionSection) @@ -296,7 +296,7 @@ public interface VmAsyncApi { @Produces(NETWORK_CONNECTION_SECTION) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editNetworkConnectionSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture editNetworkConnectionSection(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) NetworkConnectionSection section); /** @@ -308,7 +308,7 @@ public interface VmAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getOperatingSystemSection( - @EndpointParam(parser = VmURNToHref.class) String vmUrn); + @EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#editOperatingSystemSection(String, OperatingSystemSection) @@ -318,7 +318,7 @@ public interface VmAsyncApi { @Produces(OPERATING_SYSTEM_SECTION) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editOperatingSystemSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture editOperatingSystemSection(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) OperatingSystemSection section); /** @@ -329,7 +329,7 @@ public interface VmAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getProductSections(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture getProductSections(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#editProductSections(String, ProductSectionList) @@ -339,7 +339,7 @@ public interface VmAsyncApi { @Produces(PRODUCT_SECTION_LIST) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editProductSections(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture editProductSections(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); /** @@ -350,7 +350,7 @@ public interface VmAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getPendingQuestion(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture getPendingQuestion(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#answerQuestion(String, VmQuestionAnswer) @@ -360,7 +360,7 @@ public interface VmAsyncApi { @Produces(VM_PENDING_ANSWER) @Consumes @JAXBResponseParser - ListenableFuture answerQuestion(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture answerQuestion(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer); /** @@ -371,7 +371,7 @@ public interface VmAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getRuntimeInfoSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture getRuntimeInfoSection(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#getScreenImage(String) @@ -381,7 +381,7 @@ public interface VmAsyncApi { @Consumes(ANY_IMAGE) @Fallback(NullOnNotFoundOr404.class) @ResponseParser(ReturnPayloadBytes.class) - ListenableFuture getScreenImage(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture getScreenImage(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#getScreenTicket(String) @@ -391,7 +391,7 @@ public interface VmAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getScreenTicket(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture getScreenTicket(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#getVirtualHardwareSection(String) @@ -402,7 +402,7 @@ public interface VmAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getVirtualHardwareSection( - @EndpointParam(parser = VmURNToHref.class) String vmUrn); + @EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#editVirtualHardwareSection(String, VirtualHardwareSection) @@ -412,7 +412,7 @@ public interface VmAsyncApi { @Produces(VIRTUAL_HARDWARE_SECTION) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editVirtualHardwareSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture editVirtualHardwareSection(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) VirtualHardwareSection section); /** @@ -423,7 +423,7 @@ public interface VmAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSectionCpu(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture getVirtualHardwareSectionCpu(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#editVirtualHardwareSectionCpu(String, ResourceAllocationSettingData) @@ -433,7 +433,7 @@ public interface VmAsyncApi { @Produces(OVF_RASD_ITEM) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editVirtualHardwareSectionCpu(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture editVirtualHardwareSectionCpu(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) RasdItem rasd); /** @@ -445,7 +445,7 @@ public interface VmAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getVirtualHardwareSectionDisks( - @EndpointParam(parser = VmURNToHref.class) String vmUrn); + @EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#editVirtualHardwareSectionDisks(String, RasdItemsList) @@ -455,7 +455,7 @@ public interface VmAsyncApi { @Produces(OVF_RASD_ITEMS_LIST) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editVirtualHardwareSectionDisks(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture editVirtualHardwareSectionDisks(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); /** @@ -467,7 +467,7 @@ public interface VmAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getVirtualHardwareSectionMedia( - @EndpointParam(parser = VmURNToHref.class) String vmUrn); + @EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#getVirtualHardwareSectionMemory(String) @@ -477,7 +477,7 @@ public interface VmAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSectionMemory(@EndpointParam(parser = VmURNToHref.class) String vmUrn); + ListenableFuture getVirtualHardwareSectionMemory(@EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#editVirtualHardwareSectionMemory(String, ResourceAllocationSettingData) @@ -487,7 +487,7 @@ public interface VmAsyncApi { @Produces(OVF_RASD_ITEM) @Consumes(TASK) @JAXBResponseParser - ListenableFuture editVirtualHardwareSectionMemory(@EndpointParam(parser = VmURNToHref.class) String vmUrn, + ListenableFuture editVirtualHardwareSectionMemory(@EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) RasdItem rasd); /** @@ -499,7 +499,7 @@ public interface VmAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getVirtualHardwareSectionNetworkCards( - @EndpointParam(parser = VmURNToHref.class) String vmUrn); + @EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#editVirtualHardwareSectionNetworkCards(String, RasdItemsList) @@ -510,7 +510,7 @@ public interface VmAsyncApi { @Consumes(TASK) @JAXBResponseParser ListenableFuture editVirtualHardwareSectionNetworkCards( - @EndpointParam(parser = VmURNToHref.class) String vmUrn, + @EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); /** @@ -522,7 +522,7 @@ public interface VmAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getVirtualHardwareSectionSerialPorts( - @EndpointParam(parser = VmURNToHref.class) String vmUrn); + @EndpointParam(parser = URNToHref.class) String vmUrn); /** * @see VmApi#editVirtualHardwareSectionSerialPorts(String, RasdItemsList) @@ -533,7 +533,7 @@ public interface VmAsyncApi { @Consumes(TASK) @JAXBResponseParser ListenableFuture editVirtualHardwareSectionSerialPorts( - @EndpointParam(parser = VmURNToHref.class) String vmUrn, + @EndpointParam(parser = URNToHref.class) String vmUrn, @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); /** @@ -975,14 +975,4 @@ public interface VmAsyncApi { @JAXBResponseParser ListenableFuture editVirtualHardwareSectionSerialPorts(@EndpointParam URI vmHref, @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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApi.java index cb269e7571..c0ad47c9f8 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApi.java @@ -19,15 +19,12 @@ package org.jclouds.vcloud.director.v1_5.features.admin; 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.Owner; import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams; import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams; import org.jclouds.vcloud.director.v1_5.features.CatalogApi; -import org.jclouds.vcloud.director.v1_5.features.MetadataApi; -import org.jclouds.vcloud.director.v1_5.functions.href.CatalogURNToAdminHref; /** * Provides synchronous access to {@link AdminCatalog} objects. @@ -157,16 +154,4 @@ public interface AdminCatalogApi extends CatalogApi { ControlAccessParams getAccessControl(String catalogUrn); 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncApi.java index e6b43ed2c6..23e1321fa9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncApi.java @@ -32,7 +32,6 @@ import javax.ws.rs.Produces; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; 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.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog; -import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams; import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams; import org.jclouds.vcloud.director.v1_5.features.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.functions.href.CatalogURNToAdminHref; -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; @@ -68,7 +64,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi { @Produces(VCloudDirectorMediaType.ADMIN_CATALOG) @JAXBResponseParser ListenableFuture addCatalogToOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog, - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); + @EndpointParam(parser = URNToAdminHref.class) String orgUrn); /** * @see AdminCatalogApi#addCatalogToOrg(AdminCatalog, URI) @@ -89,7 +85,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn); + ListenableFuture get(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); /** * @see AdminCatalogApi#get(URI) @@ -108,7 +104,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi { @Consumes(VCloudDirectorMediaType.ADMIN_CATALOG) @Produces(VCloudDirectorMediaType.ADMIN_CATALOG) @JAXBResponseParser - ListenableFuture edit(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn, + ListenableFuture edit(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, @BinderParam(BindToXMLPayload.class) AdminCatalog catalog); /** @@ -127,7 +123,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi { @DELETE @Consumes @JAXBResponseParser - ListenableFuture remove(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn); + ListenableFuture remove(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); /** * @see AdminCatalogApi#remove(URI) @@ -145,7 +141,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getOwner(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn); + ListenableFuture getOwner(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); /** * @see AdminCatalogApi#getOwner(URI) @@ -165,7 +161,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi { @Consumes @Produces(VCloudDirectorMediaType.OWNER) @JAXBResponseParser - ListenableFuture setOwner(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn, + ListenableFuture setOwner(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, @BinderParam(BindToXMLPayload.class) Owner newOwner); /** @@ -187,7 +183,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi { @Consumes @Produces(VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS) @JAXBResponseParser - ListenableFuture publish(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn, + ListenableFuture publish(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, @BinderParam(BindToXMLPayload.class) PublishCatalogParams params); /** @@ -209,7 +205,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi { @Produces(CONTROL_ACCESS) @Consumes(CONTROL_ACCESS) @JAXBResponseParser - ListenableFuture editAccessControl(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn, + ListenableFuture editAccessControl(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, @BinderParam(BindToXMLPayload.class) ControlAccessParams params); /** @@ -231,7 +227,7 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getAccessControl(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn); + ListenableFuture getAccessControl(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); /** * @see AdminCatalogApi#getAccessControl(URI) @@ -242,16 +238,4 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApi.java index 7f73a5f620..ec0cee5488 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApi.java @@ -19,14 +19,11 @@ package org.jclouds.vcloud.director.v1_5.features.admin; 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.network.Network; import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork; -import org.jclouds.vcloud.director.v1_5.features.MetadataApi; import org.jclouds.vcloud.director.v1_5.features.NetworkApi; -import org.jclouds.vcloud.director.v1_5.functions.href.NetworkURNToAdminHref; /** * Provides synchronous access to admin {@link Network} objects. @@ -89,16 +86,4 @@ public interface AdminNetworkApi extends NetworkApi { Task reset(String networkUrn); 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncApi.java index d0ea54bc83..22bd4d0f72 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncApi.java @@ -29,7 +29,6 @@ import javax.ws.rs.Produces; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; 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.network.Network; 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.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; @@ -61,7 +59,7 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn); + ListenableFuture get(@EndpointParam(parser = URNToAdminHref.class) String networkUrn); /** * @see AdminNetworkApi#get(URI) @@ -80,7 +78,7 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi { @Consumes(VCloudDirectorMediaType.TASK) @Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK) @JAXBResponseParser - ListenableFuture edit(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn, + ListenableFuture edit(@EndpointParam(parser = URNToAdminHref.class) String networkUrn, @BinderParam(BindToXMLPayload.class) OrgNetwork network); /** @@ -100,7 +98,7 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi { @Path("/action/reset") @Consumes @JAXBResponseParser - ListenableFuture reset(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn); + ListenableFuture reset(@EndpointParam(parser = URNToAdminHref.class) String networkUrn); /** * @see AdminNetworkApi#reset(URI) @@ -110,16 +108,4 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi { @Consumes @JAXBResponseParser ListenableFuture 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgApi.java index 84d7abe003..8a0e7eac41 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgApi.java @@ -19,9 +19,9 @@ package org.jclouds.vcloud.director.v1_5.features.admin; 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.Org; 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.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.OrgSettings; import org.jclouds.vcloud.director.v1_5.domain.org.OrgVAppTemplateLeaseSettings; -import org.jclouds.vcloud.director.v1_5.features.MetadataApi; import org.jclouds.vcloud.director.v1_5.features.OrgApi; -import org.jclouds.vcloud.director.v1_5.functions.href.OrgURNToAdminHref; /** * Provides synchronous access to {@link Org} objects. @@ -265,16 +263,4 @@ public interface AdminOrgApi extends OrgApi { OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(String orgUrn, 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncApi.java index 5d48f4f3a0..1abba06251 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncApi.java @@ -28,7 +28,6 @@ import javax.ws.rs.Produces; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; 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.OrgSettings; 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.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; @@ -65,7 +63,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); + ListenableFuture get(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); /** * @see AdminOrgApi#get(URI) @@ -85,7 +83,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); + ListenableFuture getSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); /** * @see AdminOrgApi#getSettings(URI) @@ -105,7 +103,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @Consumes(VCloudDirectorMediaType.ORG_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_SETTINGS) @JAXBResponseParser - ListenableFuture editSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, + ListenableFuture editSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn, @BinderParam(BindToXMLPayload.class) OrgSettings settings); /** @@ -127,7 +125,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getEmailSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); + ListenableFuture getEmailSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); /** * @see AdminOrgApi#getEmailSettings(URI) @@ -148,7 +146,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) @JAXBResponseParser ListenableFuture editEmailSettings( - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, + @EndpointParam(parser = URNToAdminHref.class) String orgUrn, @BinderParam(BindToXMLPayload.class) OrgEmailSettings settings); /** @@ -171,7 +169,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getGeneralSettings( - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); + @EndpointParam(parser = URNToAdminHref.class) String orgUrn); /** * @see AdminOrgApi#getGeneralSettings(URI) @@ -192,7 +190,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) @JAXBResponseParser ListenableFuture editGeneralSettings( - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, + @EndpointParam(parser = URNToAdminHref.class) String orgUrn, @BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings); /** @@ -214,7 +212,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getLdapSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); + ListenableFuture getLdapSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); /** * @see AdminOrgApi#getPasswordPolicy(URI) @@ -235,7 +233,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getPasswordPolicy( - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); + @EndpointParam(parser = URNToAdminHref.class) String orgUrn); /** * @see AdminOrgApi#getPasswordPolicy(URI) @@ -256,7 +254,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) @JAXBResponseParser ListenableFuture editPasswordPolicy( - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, + @EndpointParam(parser = URNToAdminHref.class) String orgUrn, @BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings); /** @@ -279,7 +277,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getVAppLeaseSettings( - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); + @EndpointParam(parser = URNToAdminHref.class) String orgUrn); /** * @see AdminOrgApi#getVAppLeaseSettings(URI) @@ -300,7 +298,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) @JAXBResponseParser ListenableFuture editVAppLeaseSettings( - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, + @EndpointParam(parser = URNToAdminHref.class) String orgUrn, @BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings); /** @@ -323,7 +321,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) ListenableFuture getVAppTemplateLeaseSettings( - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); + @EndpointParam(parser = URNToAdminHref.class) String orgUrn); /** * @see AdminOrgApi#getVAppTemplateLeaseSettings(URI) @@ -344,7 +342,7 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) @JAXBResponseParser ListenableFuture editVAppTemplateLeaseSettings( - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, + @EndpointParam(parser = URNToAdminHref.class) String orgUrn, @BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings); /** @@ -357,16 +355,4 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi { @JAXBResponseParser ListenableFuture editVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref, @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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcApi.java index 3cb3d3e207..0aa8d139a7 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcApi.java @@ -19,13 +19,10 @@ package org.jclouds.vcloud.director.v1_5.features.admin; 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.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.functions.href.VdcURNToAdminHref; /** * Provides synchronous access to {@link AdminVdc}. @@ -83,14 +80,4 @@ public interface AdminVdcApi extends VdcApi { void disable(String vdcUrn); 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncApi.java index d83a5b8cd8..ed829c8f84 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncApi.java @@ -29,7 +29,6 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; 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.domain.AdminVdc; 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.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; @@ -58,7 +56,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn); + ListenableFuture get(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn); /** * @see AdminVdcApi#edit(String, AdminVdc) @@ -67,7 +65,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi { @Consumes @Produces(VCloudDirectorMediaType.ADMIN_VDC) @JAXBResponseParser - ListenableFuture edit(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn, AdminVdc vdc); + ListenableFuture edit(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn, AdminVdc vdc); /** * @see AdminVdcApi#remove(String) @@ -75,7 +73,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi { @DELETE @Consumes @JAXBResponseParser - ListenableFuture remove(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn); + ListenableFuture remove(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn); /** * @see AdminVdcApi#enable(String) @@ -84,7 +82,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi { @Consumes @Path("/action/enable") @JAXBResponseParser - ListenableFuture enable(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn); + ListenableFuture enable(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn); /** * @see AdminVdcApi#disable(String) @@ -93,7 +91,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi { @Consumes @Path("/action/disable") @JAXBResponseParser - ListenableFuture disable(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn); + ListenableFuture disable(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn); /** * @see AdminVdcApi#get(URI) @@ -139,16 +137,4 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi { @Path("/action/disable") @JAXBResponseParser ListenableFuture 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); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/GroupAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/GroupAsyncApi.java index 6221d41f28..ab00b827f0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/GroupAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/GroupAsyncApi.java @@ -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.domain.Group; 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.href.OrgURNToAdminHref; +import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref; +import org.jclouds.vcloud.director.v1_5.functions.URNToHref; import com.google.common.util.concurrent.ListenableFuture; @@ -59,7 +59,7 @@ public interface GroupAsyncApi { @Produces(VCloudDirectorMediaType.GROUP) @JAXBResponseParser ListenableFuture addGroupToOrg(@BinderParam(BindToXMLPayload.class) Group group, - @EndpointParam(parser = OrgURNToAdminHref.class) String adminUrn); + @EndpointParam(parser = URNToAdminHref.class) String adminUrn); /** * @see GroupApi#get(String) @@ -68,7 +68,7 @@ public interface GroupAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = GroupURNToHref.class) String groupUri); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String groupUri); /** * @see GroupApi#edit(String, Group) @@ -77,7 +77,7 @@ public interface GroupAsyncApi { @Consumes(VCloudDirectorMediaType.GROUP) @Produces(VCloudDirectorMediaType.GROUP) @JAXBResponseParser - ListenableFuture edit(@EndpointParam(parser = GroupURNToHref.class) String groupUrn, + ListenableFuture edit(@EndpointParam(parser = URNToHref.class) String groupUrn, @BinderParam(BindToXMLPayload.class) Group group); /** @@ -86,7 +86,7 @@ public interface GroupAsyncApi { @DELETE @Consumes @JAXBResponseParser - ListenableFuture remove(@EndpointParam(parser = GroupURNToHref.class) String groupUrn); + ListenableFuture remove(@EndpointParam(parser = URNToHref.class) String groupUrn); /** * @see GroupApi#addGroupToOrg(Group, URI) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/UserAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/UserAsyncApi.java index 27cf636dce..caee81fb89 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/UserAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/UserAsyncApi.java @@ -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.domain.User; 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.href.UserURNToHref; +import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref; +import org.jclouds.vcloud.director.v1_5.functions.URNToHref; import com.google.common.util.concurrent.ListenableFuture; @@ -59,7 +59,7 @@ public interface UserAsyncApi { @Produces(VCloudDirectorMediaType.USER) @JAXBResponseParser ListenableFuture addUserToOrg(@BinderParam(BindToXMLPayload.class) User user, - @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); + @EndpointParam(parser = URNToAdminHref.class) String orgUrn); /** * @see UserApi#addUserToOrg(User, URI) @@ -79,7 +79,7 @@ public interface UserAsyncApi { @Consumes @JAXBResponseParser @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@EndpointParam(parser = UserURNToHref.class) String userUrn); + ListenableFuture get(@EndpointParam(parser = URNToHref.class) String userUrn); /** * @see UserApi#get(URI) @@ -97,7 +97,7 @@ public interface UserAsyncApi { @Consumes(VCloudDirectorMediaType.USER) @Produces(VCloudDirectorMediaType.USER) @JAXBResponseParser - ListenableFuture edit(@EndpointParam(parser = UserURNToHref.class) String userUrn, + ListenableFuture edit(@EndpointParam(parser = URNToHref.class) String userUrn, @BinderParam(BindToXMLPayload.class) User user); /** @@ -115,7 +115,7 @@ public interface UserAsyncApi { @DELETE @Consumes @JAXBResponseParser - ListenableFuture remove(@EndpointParam(parser = UserURNToHref.class) String userUrn); + ListenableFuture remove(@EndpointParam(parser = URNToHref.class) String userUrn); /** * @see UserApi#remove(URI) @@ -132,7 +132,7 @@ public interface UserAsyncApi { @Path("/action/unlock") @Consumes @JAXBResponseParser - ListenableFuture unlock(@EndpointParam(parser = UserURNToHref.class) String userUrn); + ListenableFuture unlock(@EndpointParam(parser = URNToHref.class) String userUrn); /** * @see UserApi#unlock(URI) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/URNToAdminHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/URNToAdminHref.java new file mode 100644 index 0000000000..976f91eefa --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/URNToAdminHref.java @@ -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 { + private final LoadingCache resolveEntityCache; + + @Inject + public URNToAdminHref(LoadingCache 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 = Iterables.tryFind(entity.getLinks(), typeContainsAdmin); + checkArgument(link.isPresent(), "no admin link found for entity %s", entity); + return link.get().getHref(); + } + + private static final Predicate typeContainsAdmin = new Predicate() { + @Override + public boolean apply(Link in) { + return in.getType().indexOf(".admin.") != -1; + } + }; +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/URNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/URNToHref.java index aaa53ff55f..7e849c8feb 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/URNToHref.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/URNToHref.java @@ -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.checkNotNull; +import static com.google.common.collect.Iterables.get; import java.net.URI; @@ -28,13 +29,9 @@ 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 org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates; import com.google.common.base.Function; -import com.google.common.base.Optional; import com.google.common.cache.LoadingCache; -import com.google.common.collect.Iterables; /** * Resolves URN to its HREF via the entity Resolver @@ -42,7 +39,7 @@ import com.google.common.collect.Iterables; * @author Adrian Cole */ @Singleton -public abstract class URNToHref implements Function { +public final class URNToHref implements Function { private final LoadingCache resolveEntityCache; @Inject @@ -50,19 +47,11 @@ public abstract class URNToHref implements Function { this.resolveEntityCache = checkNotNull(resolveEntityCache, "resolveEntityCache"); } - /** - * media type to search for. - * - * @see VCloudDirectorMediaType - */ - protected abstract String type(); - @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 = Iterables.tryFind(entity.getLinks(), LinkPredicates.typeEquals(type())); - checkArgument(link.isPresent(), "no link for type %s found for entity %s", type(), entity); - return link.get().getHref(); + checkArgument(entity.getLinks().size() >0,"no links found for entity %s", entity); + return get(entity.getLinks(), 0).getHref(); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogItemURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogItemURNToHref.java deleted file mode 100644 index 7852adbda4..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogItemURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.CATALOG_ITEM; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogURNToAdminHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogURNToAdminHref.java deleted file mode 100644 index 46f948a4f8..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogURNToAdminHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.ADMIN_CATALOG; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogURNToHref.java deleted file mode 100644 index cabff5eccc..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/CatalogURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.CATALOG; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/GroupURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/GroupURNToHref.java deleted file mode 100644 index 41f17f47e8..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/GroupURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.GROUP; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/MediaURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/MediaURNToHref.java deleted file mode 100644 index edc2dbed0a..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/MediaURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.MEDIA; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/NetworkURNToAdminHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/NetworkURNToAdminHref.java deleted file mode 100644 index 1f4b3d630f..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/NetworkURNToAdminHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.ADMIN_NETWORK; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/NetworkURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/NetworkURNToHref.java deleted file mode 100644 index 8ac975dd57..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/NetworkURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.NETWORK; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/OrgURNToAdminHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/OrgURNToAdminHref.java deleted file mode 100644 index d2cb39cf4f..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/OrgURNToAdminHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.ADMIN_ORG; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/OrgURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/OrgURNToHref.java deleted file mode 100644 index 3dd10f0d9a..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/OrgURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.ORG; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/TaskURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/TaskURNToHref.java deleted file mode 100644 index 17e94a0111..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/TaskURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.TASK; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/TasksListURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/TasksListURNToHref.java deleted file mode 100644 index d1e626fe14..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/TasksListURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.TASKS_LIST; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/UserURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/UserURNToHref.java deleted file mode 100644 index 503576d706..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/UserURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.USER; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VAppTemplateURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VAppTemplateURNToHref.java deleted file mode 100644 index 04daee441c..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VAppTemplateURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.VAPP_TEMPLATE; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VAppURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VAppURNToHref.java deleted file mode 100644 index 1e139fd972..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VAppURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.VAPP; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VdcURNToAdminHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VdcURNToAdminHref.java deleted file mode 100644 index f5f1a40cfe..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VdcURNToAdminHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.ADMIN_VDC; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VdcURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VdcURNToHref.java deleted file mode 100644 index 24d414b6fb..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VdcURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.VDC; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VmURNToHref.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VmURNToHref.java deleted file mode 100644 index fa3dabbbef..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/href/VmURNToHref.java +++ /dev/null @@ -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 resolveEntityCache) { - super(resolveEntityCache); - } - - @Override - protected String type() { - return VCloudDirectorMediaType.VM; - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorApi.java index 23ba38e5b5..7d82b64501 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorApi.java @@ -18,11 +18,25 @@ */ package org.jclouds.vcloud.director.v1_5.user; +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.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.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.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.OrgApi; 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.VdcApi; import org.jclouds.vcloud.director.v1_5.features.VmApi; +import org.jclouds.vcloud.director.v1_5.functions.URNToHref; import com.google.inject.Provides; @@ -123,4 +138,13 @@ public interface VCloudDirectorApi { */ @Delegate VmApi getVmApi(); + + /** + * @return synchronous access to {@link Metadata} features + */ + @Delegate + MetadataApi getMetadataApi(@EndpointParam(parser = URNToHref.class) String urn); + + @Delegate + MetadataApi getMetadataApi(@EndpointParam URI href); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncApi.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncApi.java index 08e36653d8..c48196003c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncApi.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncApi.java @@ -18,6 +18,8 @@ */ package org.jclouds.vcloud.director.v1_5.user; +import java.net.URI; + import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -25,16 +27,24 @@ import javax.ws.rs.PathParam; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.rest.annotations.Delegate; +import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.JAXBResponseParser; 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.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.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.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.OrgAsyncApi; 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.VmAsyncApi; 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.inject.Provides; @@ -140,4 +151,13 @@ public interface VCloudDirectorAsyncApi { */ @Delegate VmAsyncApi getVmApi(); + + /** + * @return asynchronous access to {@link Metadata} features + */ + @Delegate + MetadataAsyncApi getMetadataApi(@EndpointParam(parser = URNToHref.class) String urn); + + @Delegate + MetadataAsyncApi getMetadataApi(@EndpointParam URI href); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppApiLiveTest.java index 591daf63a8..1031eb4944 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppApiLiveTest.java @@ -98,7 +98,7 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT protected VAppTemplateApi vAppTemplateApi; protected VdcApi vdcApi; protected VmApi vmApi; - protected MetadataApi.Writeable metadataApi; + protected MetadataApi metadataApi; /* * Objects shared between tests. diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiExpectTest.java index 54fc8616fa..4f9e0bd9fb 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiExpectTest.java @@ -151,7 +151,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest { @Test public void testGetCatalogMetadataHref() { VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse); - assertEquals(api.getCatalogApi().getMetadataApi(catalogHref).get(), metadata()); + assertEquals(api.getMetadataApi(catalogHref).get(), metadata()); } static Metadata metadata() { @@ -182,7 +182,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest { @Test public void testGetCatalogMetadataEntryHref() { VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadataValue, getMetadataValueResponse); - assertEquals(api.getCatalogApi().getMetadataApi(catalogHref).get("KEY"), "VALUE"); + assertEquals(api.getMetadataApi(catalogHref).get("KEY"), "VALUE"); } static String item = "a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"; @@ -308,7 +308,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest { @Test public void testGetCatalogItemMetadataHref() { VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getItemMetadata, getItemMetadataResponse); - assertEquals(api.getCatalogApi().getMetadataApi(itemHref).get(), expected); + assertEquals(api.getMetadataApi(itemHref).get(), expected); } HttpRequest mergeItemMetadata = HttpRequest.builder() @@ -328,7 +328,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest { @Test public void testMergeCatalogItemMetadataHref() { 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() @@ -346,7 +346,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest { @Test public void testGetCatalogItemMetadataEntryHref() { 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() @@ -366,7 +366,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest { @Test public void testSetCatalogItemMetadataEntryHref() { 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() @@ -384,7 +384,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest { @Test public void testRemoveCatalogItemMetadataEntryHref() { 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() { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiLiveTest.java index 30e24d7803..2a5f22d1f7 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiLiveTest.java @@ -175,78 +175,78 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest { @Test(description = "GET /catalog/{id}/metadata") public void testGetCatalogMetadata() { - Metadata catalogMetadata = catalogApi.getMetadataApi(catalogUrn).get(); + Metadata catalogMetadata = context.getApi().getMetadataApi(catalogUrn).get(); checkMetadata(catalogMetadata); } @Test(description = "GET /catalog/{id}/metadata/{key}") public void testGetCatalogMetadataValue() { - Task mergeCatalogMetadata = adminCatalogApi.getMetadataApi(catalogUrn) + Task mergeCatalogMetadata = context.getApi().getMetadataApi(catalogUrn) .putAll(ImmutableMap.of("KEY", "MARMALADE")); 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", "MetadataValue", catalogMetadata.get("KEY"), metadataValue)); } @Test(description = "GET /catalogItem/{id}/metadata", dependsOnMethods = "testAddCatalogItem") public void testGetCatalogItemMetadata() { - Metadata catalogItemMetadata = catalogApi.getItemMetadataApi(catalogItem.getId()).get(); + Metadata catalogItemMetadata = context.getApi().getMetadataApi(catalogItem.getId()).get(); checkMetadata(catalogItemMetadata); } @Test(description = "POST /catalogItem/{id}/metadata", dependsOnMethods = "testAddCatalogItem") 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")); checkTask(mergeCatalogItemMetadata); assertTrue(retryTaskSuccess.apply(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(), "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"); - 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"); } @Test(description = "GET /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testSetCatalogItemMetadataValue") public void testGetCatalogItemMetadataValue() { - String metadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).get("KEY"); + String metadataValue = context.getApi().getMetadataApi(catalogItem.getId()).get("KEY"); assertNotNull(metadataValue); } @Test(description = "PUT /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testMergeCatalogItemMetadata") public void testSetCatalogItemMetadataValue() { - Task setCatalogItemMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).put("KEY", "NEW"); + Task setCatalogItemMetadataValue = context.getApi().getMetadataApi(catalogItem.getId()).put("KEY", "NEW"); checkTask(setCatalogItemMetadataValue); assertTrue(retryTaskSuccess.apply(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", String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", "NEW", editedMetadataValue)); } @Test(description = "DELETE /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testGetCatalogItemMetadataValue") public void testRemoveCatalogItemMetadataValue() { - Task removeCatalogItemMetadataValue = catalogApi.getItemMetadataApi(catalogItem.getId()).remove("KEY"); + Task removeCatalogItemMetadataValue = context.getApi().getMetadataApi(catalogItem.getId()).remove("KEY"); checkTask(removeCatalogItemMetadataValue); assertTrue(retryTaskSuccess.apply(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); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/KeyPairsApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/KeyPairsApiLiveTest.java index 80dac4e36c..a26a3419c4 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/KeyPairsApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/KeyPairsApiLiveTest.java @@ -92,7 +92,7 @@ public class KeyPairsApiLiveTest extends BaseVCloudDirectorApiLiveTest { Vdc currentVDC = lazyGetVdc(); Media keyPairsContainer = findOrCreateKeyPairContainerInVDCNamed(currentVDC, keyPairContainer, keyPairName); - String keypairValue = mediaApi.getMetadataApi( + String keypairValue = context.getApi().getMetadataApi( keyPairsContainer.getId()).get(keyPairName); assertEquals(keypairValue, generateKeyPair(keyPairName)); } @@ -122,7 +122,7 @@ public class KeyPairsApiLiveTest extends BaseVCloudDirectorApiLiveTest { @Override public boolean apply(Media input) { - return mediaApi.getMetadataApi(input.getId()).get( + return context.getApi().getMetadataApi(input.getId()).get( keyPairName) != null; } }); @@ -208,7 +208,7 @@ public class KeyPairsApiLiveTest extends BaseVCloudDirectorApiLiveTest { private void setKeyPairOnkeyPairsContainer(Media media, String keyPairName, String keyPair) { - Task setKeyPair = mediaApi.getMetadataApi(media.getId()).put( + Task setKeyPair = context.getApi().getMetadataApi(media.getId()).put( keyPairName, keyPair); Checks.checkTask(setKeyPair); assertTrue(retryTaskSuccess.apply(setKeyPair), diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiExpectTest.java index 6a66301594..79b232b58e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiExpectTest.java @@ -238,7 +238,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest { Metadata expected = metadata(); - assertEquals(api.getMediaApi().getMetadataApi(mediaUri).get(), expected); + assertEquals(api.getMetadataApi(mediaUri).get(), expected); } @Test @@ -258,7 +258,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest { Metadata inputMetadata = metadata(); Task expectedTask = mergeMetadataTask(); - assertEquals(api.getMediaApi().getMetadataApi(mediaUri).putAll(inputMetadata), expectedTask); + assertEquals(api.getMetadataApi(mediaUri).putAll(inputMetadata), expectedTask); } public void testGetMetadataValue() { @@ -273,7 +273,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest { .xmlFilePayload("/media/metadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE) .httpResponseBuilder().build()); - assertEquals(api.getMediaApi().getMetadataApi(mediaUri).get("key"), "value"); + assertEquals(api.getMetadataApi(mediaUri).get("key"), "value"); } @Test @@ -292,7 +292,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest { Task expectedTask = setMetadataEntryTask(); - assertEquals(api.getMediaApi().getMetadataApi(mediaUri).put("key", "value"), expectedTask); + assertEquals(api.getMetadataApi(mediaUri).put("key", "value"), expectedTask); } @Test @@ -310,7 +310,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest { Task expectedTask = removeTask(); - assertEquals(api.getMediaApi().getMetadataApi(mediaUri).remove("key"), expectedTask); + assertEquals(api.getMetadataApi(mediaUri).remove("key"), expectedTask); } @Test diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiLiveTest.java index 658ef690df..423a1bc51e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiLiveTest.java @@ -220,7 +220,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest { assertTrue(media.clone(oldMedia), 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 .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" }) public void testGetMetadata() { - metadata = mediaApi.getMetadataApi(media.getId()).get(); + metadata = context.getApi().getMetadataApi(media.getId()).get(); // required for testing 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" }) public void testMergeMetadata() { // 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); 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); assertEquals(metadata.get("testKey"), "testValue"); @@ -294,10 +294,10 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest { Checks.checkMediaFor(MEDIA, media); // test edit - mergeMetadata = mediaApi.getMetadataApi(media.getId()).put("testKey", "new testValue"); + mergeMetadata = context.getApi().getMetadataApi(media.getId()).put("testKey", "new testValue"); Checks.checkTask(mergeMetadata); 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); assertEquals(metadata.get("testKey"), "new testValue"); @@ -307,7 +307,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest { @Test(description = "GET /media/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }) public void testGetMetadataValue() { - metadataValue = mediaApi.getMetadataApi(media.getId()).get("key"); + metadataValue = context.getApi().getMetadataApi(media.getId()).get("key"); assertNotNull(metadataValue); } @@ -315,26 +315,26 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest { public void testSetMetadataValue() { metadataEntryValue = "value"; - Task setMetadataEntry = mediaApi.getMetadataApi(media.getId()).put("key", metadataEntryValue); + Task setMetadataEntry = context.getApi().getMetadataApi(media.getId()).put("key", metadataEntryValue); Checks.checkTask(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); } @Test(description = "DELETE /media/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata", "testGetMetadataValue" }) public void testRemoveMetadata() { - Task remove = mediaApi.getMetadataApi(media.getId()).remove("testKey"); + Task remove = context.getApi().getMetadataApi(media.getId()).remove("testKey"); Checks.checkTask(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", metadataValue != null ? metadataValue.toString() : "", "MetadataEntry", metadataValue != null ? metadataValue.toString() : "")); - metadataValue = mediaApi.getMetadataApi(media.getId()).get("key"); + metadataValue = context.getApi().getMetadataApi(media.getId()).get("key"); assertNotNull(metadataValue); media = mediaApi.get(media.getId()); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MetadataApiExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MetadataApiExpectTest.java new file mode 100644 index 0000000000..736d016727 --- /dev/null +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MetadataApiExpectTest.java @@ -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(); + } + +} diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiExpectTest.java index 2cd1038880..8e532f23d4 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiExpectTest.java @@ -180,7 +180,7 @@ public class NetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest { @Test public void testGetNetworkMetadataHref() { VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse); - assertEquals(api.getNetworkApi().getMetadataApi(networkHref).get(), metadata()); + assertEquals(api.getMetadataApi(networkHref).get(), metadata()); } static Metadata metadata() { @@ -215,7 +215,7 @@ public class NetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest { @Test public void testGetNetworkMetadataEntryHref() { 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() { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiLiveTest.java index 11075e88c7..82210cb2c1 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiLiveTest.java @@ -71,7 +71,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest { public void cleanUp() { if (metadataSet) { try { - Task remove = adminContext.getApi().getNetworkApi().getMetadataApi(networkUrn).remove("key"); + Task remove = adminContext.getApi().getMetadataApi(networkUrn).remove("key"); taskDoneEventually(remove); } catch (Exception e) { logger.warn(e, "Error when deleting metadata"); @@ -96,7 +96,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest { private void setupMetadata() { //TODO: block until complete - adminContext.getApi().getNetworkApi().getMetadataApi(networkUrn).put("key", "value"); + adminContext.getApi().getMetadataApi(networkUrn).put("key", "value"); metadataSet = true; } @@ -106,7 +106,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest { setupMetadata(); } - Metadata metadata = networkApi.getMetadataApi(networkUrn).get(); + Metadata metadata = context.getApi().getMetadataApi(networkUrn).get(); // required for testing assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()), 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" }) 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)); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgApiExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgApiExpectTest.java index 2beadb0a95..f3cfd7d40a 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgApiExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgApiExpectTest.java @@ -147,7 +147,7 @@ public class OrgApiExpectTest extends VCloudDirectorAdminApiExpectTest { @Test public void testGetOrgMetadataHref() { VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, getMetadata, getMetadataResponse); - assertEquals(api.getOrgApi().getMetadataApi(orgHref).get(), metadata()); + assertEquals(api.getMetadataApi(orgHref).get(), metadata()); } static Metadata metadata() { @@ -178,7 +178,7 @@ public class OrgApiExpectTest extends VCloudDirectorAdminApiExpectTest { @Test public void testGetOrgMetadataEntryHref() { 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() { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgApiLiveTest.java index 11483c74db..b20ef67544 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgApiLiveTest.java @@ -65,7 +65,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest { public void cleanUp() throws Exception { if (adminMembersSet) { try { - Task remove = adminContext.getApi().getOrgApi().getMetadataApi(orgUrn).remove("KEY"); + Task remove = adminContext.getApi().getMetadataApi(orgUrn).remove("KEY"); taskDoneEventually(remove); } catch (Exception e) { logger.warn(e, "Error when deleting metadata entry"); @@ -125,7 +125,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest { */ private void setupAdminMembers() { //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()) .description("created by testOrg()").build(); @@ -140,7 +140,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest { public void testGetOrgMetadata() { // 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 @@ -154,7 +154,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest { @Test(description = "GET /org/{id}/metadata/{key}", dependsOnMethods = { "testGetOrgMetadata" }) public void testGetOrgMetadataValue() { // 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" // )' diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppApiLiveTest.java index 131982cb3b..59a455e3f4 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppApiLiveTest.java @@ -695,10 +695,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest { public void testSetMetadataValue() { key = name("key-"); 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 - String newMetadataValue = vAppApi.getMetadataApi(vAppUrn).get(key); + String newMetadataValue = context.getApi().getMetadataApi(vAppUrn).get(key); // Check the retrieved object is well formed assertEquals(newMetadataValue, value); @@ -708,10 +708,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest { public void testGetMetadata() { key = name("key-"); String value = name("value-"); - vAppApi.getMetadataApi(vAppUrn).put(key, value); + context.getApi().getMetadataApi(vAppUrn).put(key, value); // Call the method being tested - Metadata metadata = vAppApi.getMetadataApi(vAppUrn).get(); + Metadata metadata = context.getApi().getMetadataApi(vAppUrn).get(); checkMetadata(metadata); @@ -725,10 +725,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest { key = name("key-"); String value = name("value-"); - vAppApi.getMetadataApi(vAppUrn).put(key, value); + context.getApi().getMetadataApi(vAppUrn).put(key, value); // 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)); } @@ -736,11 +736,11 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest { @Test(groups = { "live", "user" }, description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }) public void testRemoveMetadataEntry() { // Delete the entry - Task task = vAppApi.getMetadataApi(vAppUrn).remove(key); + Task task = context.getApi().getMetadataApi(vAppUrn).remove(key); retryTaskSuccess.apply(task); // 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 checkMetadataKeyAbsentFor(VAPP, newMetadata, key); @@ -748,17 +748,17 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest { @Test(groups = { "live", "user" }, description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" }) public void testMergeMetadata() { - Metadata oldMetadata = vAppApi.getMetadataApi(vAppUrn).get(); + Metadata oldMetadata = context.getApi().getMetadataApi(vAppUrn).get(); Map oldMetadataMap = Checks.metadataToMap(oldMetadata); // Store a value, to be removed String key = name("key-"); 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); // 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 expectedMetadataMap = ImmutableMap. builder().putAll(oldMetadataMap) .put(key, value).build(); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppNetworksLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppNetworksLiveTest.java index 7edb5183b2..bc95f1e7df 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppNetworksLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppNetworksLiveTest.java @@ -78,7 +78,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest { protected void tidyUp() { if (key != null) { try { - Task remove = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).remove(key); + Task remove = context.getApi().getMetadataApi(vAppTemplateUrn).remove(key); taskDoneEventually(remove); } catch (Exception e) { logger.warn(e, "Error when deleting metadata entry '%s'", key); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApiExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApiExpectTest.java index 42308aab40..a9e0844b33 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApiExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApiExpectTest.java @@ -18,12 +18,9 @@ */ package org.jclouds.vcloud.director.v1_5.features; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ANY; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CUSTOMIZATION_SECTION; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ERROR; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.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.TASK; 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.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.Owner; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Task; @@ -234,109 +229,6 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest 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) public void testErrorGetNetworkConfigSection() { @@ -427,13 +319,4 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest .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(); - } - } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApiLiveTest.java index 7ed8579882..3c5818c822 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApiLiveTest.java @@ -82,7 +82,7 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest { protected void tidyUp() { if (key != null) { try { - Task remove = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).remove(key); + Task remove = context.getApi().getMetadataApi(vAppTemplateUrn).remove(key); taskDoneEventually(remove); } catch (Exception e) { 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" }) public void testGetVAppTemplateMetadata() { - Metadata metadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(); + Metadata metadata = context.getApi().getMetadataApi(vAppTemplateUrn).get(); checkMetadata(metadata); } @@ -152,10 +152,10 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest { // otherwise no entry may exist @Test(description = "GET /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetVAppTemplateMetadata" }) public void testGetMetadataValue() { - Metadata metadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(); + Metadata metadata = context.getApi().getMetadataApi(vAppTemplateUrn).get(); 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()); } @@ -197,16 +197,16 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest { @Test(description = "POST /vAppTemplate/{id}/metadata", dependsOnMethods = { "testGetVAppTemplate" }) public void testEditMetadata() { - Metadata oldMetadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(); + Metadata oldMetadata = context.getApi().getMetadataApi(vAppTemplateUrn).get(); Map oldMetadataMap = metadataToMap(oldMetadata); key = name("key-"); 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); - Metadata newMetadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(); + Metadata newMetadata = context.getApi().getMetadataApi(vAppTemplateUrn).get(); Map expectedMetadataMap = ImmutableMap. builder().putAll(oldMetadataMap) .put(key, val).build(); checkMetadataFor("vAppTemplate", newMetadata, expectedMetadataMap); @@ -216,19 +216,19 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest { public void testEditMetadataValue() { 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); - String newMetadataValue = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(key); + String newMetadataValue = context.getApi().getMetadataApi(vAppTemplateUrn).get(key); assertEquals(newMetadataValue, val); } @Test(description = "DELETE /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadataValue" }) public void testRemoveVAppTemplateMetadataValue() { - final Task deletionTask = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).remove(key); + final Task deletionTask = context.getApi().getMetadataApi(vAppTemplateUrn).remove(key); assertTaskSucceeds(deletionTask); - Metadata newMetadata = vAppTemplateApi.getMetadataApi(vAppTemplateUrn).get(); + Metadata newMetadata = context.getApi().getMetadataApi(vAppTemplateUrn).get(); checkMetadataKeyAbsentFor("vAppTemplate", newMetadata, key); key = null; } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiExpectTest.java index 7342a443da..d1a33ab505 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiExpectTest.java @@ -354,7 +354,7 @@ public class VdcApiExpectTest extends VCloudDirectorAdminApiExpectTest { Metadata expected = metadata(); - assertEquals(api.getVdcApi().getMetadataApi(vdcUri).get(), expected); + assertEquals(api.getMetadataApi(vdcUri).get(), expected); } @Test(enabled = false) @@ -370,7 +370,7 @@ public class VdcApiExpectTest extends VCloudDirectorAdminApiExpectTest { .xmlFilePayload("/vdc/metadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE) .httpResponseBuilder().build()); - assertEquals(api.getVdcApi().getMetadataApi(vdcUri).get("key"), ""); + assertEquals(api.getMetadataApi(vdcUri).get("key"), ""); } public static Vdc getVdc() { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiLiveTest.java index 38e1f430d7..45a6a1efee 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiLiveTest.java @@ -123,7 +123,7 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest { if (metadataSet) { try { - Task remove = adminContext.getApi().getVdcApi().getMetadataApi(vdcUrn).remove("key"); + Task remove = adminContext.getApi().getMetadataApi(vdcUrn).remove("key"); taskDoneEventually(remove); } catch (Exception e) { logger.warn(e, "Error deleting metadata entry"); @@ -310,7 +310,7 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest { @Test(description = "GET /vdc/{id}/metadata", dependsOnMethods = { "testGetVdc" }) public void testGetMetadata() { - Metadata metadata = vdcApi.getMetadataApi(vdcUrn).get(); + Metadata metadata = context.getApi().getMetadataApi(vdcUrn).get(); // required for testing assertTrue(Iterables.isEmpty(metadata.getMetadataEntries()), @@ -323,12 +323,12 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest { public void testGetMetadataValue() { // setupMetadata(); // First find a key - Metadata metadata = vdcApi.getMetadataApi(vdcUrn).get(); + Metadata metadata = context.getApi().getMetadataApi(vdcUrn).get(); Map metadataMap = Checks.metadataToMap(metadata); String key = Iterables.getFirst(metadataMap.keySet(), "MadeUpKey!"); String value = metadataMap.get(key); - String metadataValue = vdcApi.getMetadataApi(vdcUrn).get(key); + String metadataValue = context.getApi().getMetadataApi(vdcUrn).get(key); assertEquals(metadataValue, value); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java index df2e3d6717..724832101a 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java @@ -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.VmQuestionAnswerChoice; 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.Network.FenceMode; 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.MediaInsertOrEjectParams; @@ -87,9 +85,7 @@ import org.testng.annotations.Test; import com.google.common.base.Function; import com.google.common.base.Predicate; -import com.google.common.base.Predicates; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Sets; @@ -851,10 +847,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest { key = name("key-"); metadataValue = name("value-"); //TODO: block!! - vmApi.getMetadataApi(vmUrn).put(key, metadataValue); + context.getApi().getMetadataApi(vmUrn).put(key, metadataValue); // 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 assertEquals(newMetadataValue, metadataValue, @@ -867,9 +863,9 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest { key = name("key-"); metadataValue = name("value-"); - vmApi.getMetadataApi(vmUrn).put(key, metadataValue); + context.getApi().getMetadataApi(vmUrn).put(key, metadataValue); // Call the method being tested - Metadata metadata = vmApi.getMetadataApi(vmUrn).get(); + Metadata metadata = context.getApi().getMetadataApi(vmUrn).get(); checkMetadata(metadata); @@ -883,10 +879,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest { metadataValue = name("value-"); //TODO: block!! - vmApi.getMetadataApi(vmUrn).put(key, metadataValue); + context.getApi().getMetadataApi(vmUrn).put(key, metadataValue); // Call the method being tested - String newMetadataValue = vmApi.getMetadataApi(vmUrn).get(key); + String newMetadataValue = context.getApi().getMetadataApi(vmUrn).get(key); assertEquals(newMetadataValue, metadataValue, 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" }) public void testRemoveMetadataEntry() { // Delete the entry - Task task = vmApi.getMetadataApi(vmUrn).remove(key); + Task task = context.getApi().getMetadataApi(vmUrn).remove(key); retryTaskSuccess.apply(task); // 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 checkMetadataKeyAbsentFor(VM, newMetadata, key); @@ -907,17 +903,17 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest { @Test(description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" }) public void testMergeMetadata() { - Metadata oldMetadata = vmApi.getMetadataApi(vmUrn).get(); + Metadata oldMetadata = context.getApi().getMetadataApi(vmUrn).get(); Map oldMetadataMap = Checks.metadataToMap(oldMetadata); // Store a value, to be removed String key = name("key-"); 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); // 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 expectedMetadataMap = ImmutableMap. builder().putAll(oldMetadataMap) .put(key, value).build(); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcApiLiveTest.java index d8ae8063ed..c494683589 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcApiLiveTest.java @@ -51,7 +51,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest { * Convenience reference to API api. */ protected AdminVdcApi vdcApi; - protected MetadataApi.Writeable metadataApi; + protected MetadataApi metadataApi; private String metadataKey; private String metadataValue; @@ -60,7 +60,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest { @BeforeClass(alwaysRun = true) public void setupRequiredApis() { vdcApi = adminContext.getApi().getVdcApi(); - metadataApi = vdcApi.getMetadataApi(vdcUrn); + metadataApi = context.getApi().getMetadataApi(vdcUrn); } @AfterClass(alwaysRun = true)