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

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

View File

@ -18,7 +18,18 @@
*/
package org.jclouds.vcloud.director.v1_5.admin;
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);
}

View File

@ -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);
}

View File

@ -113,8 +113,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
public static final Map<Class<?>, Class<?>> USER_DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>>builder()
.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)

View File

@ -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);
}

View File

@ -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<? extends Catalog> get(@EndpointParam(parser = CatalogURNToHref.class) String catalogUrn);
ListenableFuture<? extends Catalog> 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<CatalogItem> addItem(@EndpointParam(parser = CatalogURNToHref.class) String catalogUrn,
ListenableFuture<CatalogItem> 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<CatalogItem> getItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
ListenableFuture<CatalogItem> 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<CatalogItem> editItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn,
ListenableFuture<CatalogItem> editItem(@EndpointParam(parser = URNToHref.class) String catalogItemUrn,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/**
@ -97,7 +95,7 @@ public interface CatalogAsyncApi {
@DELETE
@Consumes
@JAXBResponseParser
ListenableFuture<Void> removeItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
ListenableFuture<Void> removeItem(@EndpointParam(parser = URNToHref.class) String catalogItemUrn);
/**
* @see CatalogApi#get(URI)
@ -145,23 +143,4 @@ public interface CatalogAsyncApi {
@Consumes
@JAXBResponseParser
ListenableFuture<Void> removeItem(@EndpointParam URI catalogItemHref);
/**
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = CatalogURNToHref.class) String catalogUrn);
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI catalogItemHref);
/**
* @see CatalogApi#getItemMetadataApi
*/
@Delegate
MetadataAsyncApi.Writeable getItemMetadataApi(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
@Delegate
MetadataAsyncApi.Writeable getItemMetadataApi(@EndpointParam URI catalogItemHref);
}

View File

@ -19,13 +19,11 @@
package org.jclouds.vcloud.director.v1_5.features;
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);
}

View File

@ -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<Media> get(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn);
ListenableFuture<Media> 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<Media> clone(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn,
ListenableFuture<Media> 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<Task> edit(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn,
ListenableFuture<Task> 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<Task> remove(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn);
ListenableFuture<Task> remove(@EndpointParam(parser = URNToHref.class) String mediaUrn);
/**
* @see MediaApi#getOwner(String)
@ -109,7 +107,7 @@ public interface MediaAsyncApi {
@Consumes
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn);
ListenableFuture<Owner> getOwner(@EndpointParam(parser = URNToHref.class) String mediaUrn);
/**
* @see MediaApi#get(URI)
@ -157,13 +155,4 @@ public interface MediaAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam URI mediaHref);
/**
* @return asynchronous access to {@link Metadata.Writeable} features
*/
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = MediaURNToHref.class) String mediaUrn);
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI mediaHref);
}

View File

@ -29,8 +29,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
* @author danikov, Adrian Cole
*/
public interface MetadataApi {
public static interface Readable extends MetadataApi {
/**
* Retrieves an list of metadata
*
@ -44,37 +42,30 @@ public interface MetadataApi {
* @return the metadata value, or null if not found
*/
String get(String key);
}
public static interface Writeable extends Readable {
/**
* 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.
* @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<String, String> metadata);
/**
* Sets the metadata for the particular key for the media to the value
* provided. Note: this will replace any existing metadata information
* 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.
* @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.
* @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);
}
}

View File

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

View File

@ -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);
}

View File

@ -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<? extends Network> get(@EndpointParam(parser = NetworkURNToHref.class) String networkUrn);
ListenableFuture<? extends Network> get(@EndpointParam(parser = URNToHref.class) String networkUrn);
/**
* @see NetworkApi#get(URI)
@ -59,14 +58,4 @@ public interface NetworkAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Network> get(@EndpointParam URI networkHref);
/**
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = NetworkURNToHref.class) String networkUrn);
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI networkHref);
}

View File

@ -19,11 +19,9 @@
package org.jclouds.vcloud.director.v1_5.features;
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);
}

View File

@ -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<? extends Org> get(@EndpointParam(parser = OrgURNToHref.class) String orgUrn);
ListenableFuture<? extends Org> get(@EndpointParam(parser = URNToHref.class) String orgUrn);
/**
* @see OrgApi#get(URI)
@ -70,14 +69,4 @@ public interface OrgAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Org> get(@EndpointParam URI orgHref);
/**
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = OrgURNToHref.class) String orgUrn);
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI orgHref);
}

View File

@ -33,7 +33,7 @@ import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.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<Task> get(@EndpointParam(parser = TaskURNToHref.class) String taskUrn);
ListenableFuture<Task> get(@EndpointParam(parser = URNToHref.class) String taskUrn);
/**
* @see TaskApi#get(URI)
@ -78,7 +78,7 @@ public interface TaskAsyncApi {
@Path("/action/cancel")
@Consumes
@JAXBResponseParser
ListenableFuture<Void> cancel(@EndpointParam(parser = TaskURNToHref.class) String taskUrn);
ListenableFuture<Void> cancel(@EndpointParam(parser = URNToHref.class) String taskUrn);
/**
* @see TaskApi#cancel(URI)

View File

@ -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);
}

View File

@ -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<VApp> get(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<VApp> 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<Task> edit(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
ListenableFuture<Task> edit(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) VApp vApp);
/**
@ -97,7 +96,7 @@ public interface VAppAsyncApi {
@DELETE
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> remove(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Task> 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<ControlAccessParams> editControlAccess(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
ListenableFuture<ControlAccessParams> 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<Task> deploy(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
ListenableFuture<Task> 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<Task> discardSuspendedState(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Task> discardSuspendedState(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/**
* @see VAppApi#enterMaintenanceMode(String)
@ -137,7 +136,7 @@ public interface VAppAsyncApi {
@Path("/action/enterMaintenanceMode")
@Consumes
@JAXBResponseParser
ListenableFuture<Void> enterMaintenanceMode(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Void> enterMaintenanceMode(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/**
* @see VAppApi#exitMaintenanceMode(String)
@ -146,7 +145,7 @@ public interface VAppAsyncApi {
@Path("/action/exitMaintenanceMode")
@Consumes
@JAXBResponseParser
ListenableFuture<Void> exitMaintenanceMode(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Void> 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<Task> recompose(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
ListenableFuture<Task> 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<Task> undeploy(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
ListenableFuture<Task> 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<ControlAccessParams> getAccessControl(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<ControlAccessParams> 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<Task> powerOff(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Task> 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<Task> powerOn(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Task> 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<Task> reboot(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Task> 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<Task> reset(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Task> 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<Task> shutdown(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Task> 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<Task> suspend(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Task> suspend(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/**
* @see VAppApi#getLeaseSettingsSection(String)
@ -243,7 +242,7 @@ public interface VAppAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<LeaseSettingsSection> 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<Task> editLeaseSettingsSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
/**
@ -265,7 +264,7 @@ public interface VAppAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkConfigSection> 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<Task> editNetworkConfigSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
ListenableFuture<Task> 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<NetworkSection> getNetworkSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/**
* @see VAppApi#getOwner(String)
@ -296,7 +295,7 @@ public interface VAppAsyncApi {
@Consumes
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<Owner> getOwner(@EndpointParam(parser = URNToHref.class) String vAppUrn);
/**
* @see VAppApi#editOwner(String, Owner)
@ -306,7 +305,7 @@ public interface VAppAsyncApi {
@Produces(OWNER)
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Void> editOwner(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
ListenableFuture<Void> 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<ProductSectionList> getProductSections(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<ProductSectionList> 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<Task> editProductSections(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
ListenableFuture<Task> 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<StartupSection> getStartupSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn);
ListenableFuture<StartupSection> 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<Task> editStartupSection(@EndpointParam(parser = VAppURNToHref.class) String vAppUrn,
ListenableFuture<Task> editStartupSection(@EndpointParam(parser = URNToHref.class) String vAppUrn,
@BinderParam(BindToXMLPayload.class) StartupSection section);
/**
@ -625,14 +624,4 @@ public interface VAppAsyncApi {
@JAXBResponseParser
ListenableFuture<Task> 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);
}

View File

@ -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);
}

View File

@ -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<VAppTemplate> get(@EndpointParam(parser = VAppTemplateURNToHref.class) String reference);
ListenableFuture<VAppTemplate> 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<Task> edit(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn,
ListenableFuture<Task> 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<Void> disableDownload(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
ListenableFuture<Void> 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<Task> enableDownload(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
ListenableFuture<Task> enableDownload(@EndpointParam(parser = URNToHref.class) String templateUrn);
/**
* @see VAppTemplateApi#getCustomizationSection(String)
@ -121,7 +119,7 @@ public interface VAppTemplateAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<CustomizationSection> 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<LeaseSettingsSection> 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<Task> 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<NetworkConfigSection> 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<NetworkSection> 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<Envelope> getOvf(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
ListenableFuture<Envelope> 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<Owner> getOwner(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
ListenableFuture<Owner> getOwner(@EndpointParam(parser = URNToHref.class) String templateUrn);
/**
* @see VAppTemplateApi#getProductSectionsForVAppTemplate(String)
@ -197,7 +195,7 @@ public interface VAppTemplateAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ProductSectionList> 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<Task> editProductSections(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn,
ListenableFuture<Task> 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<References> getShadowVms(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
ListenableFuture<References> getShadowVms(@EndpointParam(parser = URNToHref.class) String templateUrn);
/**
* @see VAppTemplateApi#get(URI)
@ -365,14 +363,4 @@ public interface VAppTemplateAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<References> getShadowVms(@EndpointParam URI templateHref);
/**
* @return asynchronous access to {@link Metadata} features
*/
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = VAppTemplateURNToHref.class) String templateUrn);
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI templateHref);
}

View File

@ -19,8 +19,7 @@
package org.jclouds.vcloud.director.v1_5.features;
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);
}

View File

@ -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<? extends Vdc> get(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn);
ListenableFuture<? extends Vdc> 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<VAppTemplate> captureVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
ListenableFuture<VAppTemplate> 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<Media> cloneMedia(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
ListenableFuture<Media> 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<VApp> cloneVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
ListenableFuture<VApp> 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<VAppTemplate> cloneVAppTemplate(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
ListenableFuture<VAppTemplate> 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<VApp> composeVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
ListenableFuture<VApp> 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<VApp> instantiateVApp(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
ListenableFuture<VApp> 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<VAppTemplate> uploadVAppTemplate(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
ListenableFuture<VAppTemplate> 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<Media> addMedia(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
ListenableFuture<Media> addMedia(@EndpointParam(parser = URNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) Media media);
/**
@ -253,13 +252,4 @@ public interface VdcAsyncApi {
@JAXBResponseParser
ListenableFuture<Media> addMedia(@EndpointParam URI vdcHref, @BinderParam(BindToXMLPayload.class) Media media);
/**
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn);
@Delegate
MetadataAsyncApi.Readable getMetadataApi(@EndpointParam URI vdcHref);
}

View File

@ -19,12 +19,12 @@
package org.jclouds.vcloud.director.v1_5.features;
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);
}

View File

@ -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<Vm> get(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Vm> 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<Task> edit(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> edit(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) Vm vApp);
/**
@ -108,7 +108,7 @@ public interface VmAsyncApi {
@DELETE
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> remove(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> 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<Task> consolidate(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> 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<Task> deploy(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> 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<Task> discardSuspendedState(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> 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<Task> installVMwareTools(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> 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<Task> relocate(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> 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<Task> undeploy(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> 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<Task> upgradeHardwareVersion(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> 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<Task> powerOff(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> 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<Task> powerOn(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> 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<Task> reboot(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> 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<Task> reset(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> 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<Task> shutdown(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> 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<Task> suspend(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<Task> suspend(@EndpointParam(parser = URNToHref.class) String vmUrn);
/**
* @see VmApi#getGuestCustomizationSection(String)
@ -242,7 +242,7 @@ public interface VmAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<GuestCustomizationSection> 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<Task> editGuestCustomizationSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> 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<Task> ejectMedia(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> 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<Task> insertMedia(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> insertMedia(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
/**
@ -286,7 +286,7 @@ public interface VmAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkConnectionSection> 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<Task> editNetworkConnectionSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> editNetworkConnectionSection(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
/**
@ -308,7 +308,7 @@ public interface VmAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OperatingSystemSection> 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<Task> editOperatingSystemSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> 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<ProductSectionList> getProductSections(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<ProductSectionList> 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<Task> editProductSections(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> 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<VmPendingQuestion> getPendingQuestion(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<VmPendingQuestion> 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<Void> answerQuestion(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Void> 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<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<RuntimeInfoSection> 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<byte[]> getScreenImage(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<byte[]> getScreenImage(@EndpointParam(parser = URNToHref.class) String vmUrn);
/**
* @see VmApi#getScreenTicket(String)
@ -391,7 +391,7 @@ public interface VmAsyncApi {
@Consumes
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam(parser = URNToHref.class) String vmUrn);
/**
* @see VmApi#getVirtualHardwareSection(String)
@ -402,7 +402,7 @@ public interface VmAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VirtualHardwareSection> 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<Task> editVirtualHardwareSection(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> 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<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<RasdItem> 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<Task> editVirtualHardwareSectionCpu(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> editVirtualHardwareSectionCpu(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
/**
@ -445,7 +445,7 @@ public interface VmAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> 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<Task> editVirtualHardwareSectionDisks(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> editVirtualHardwareSectionDisks(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/**
@ -467,7 +467,7 @@ public interface VmAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> 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<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam(parser = VmURNToHref.class) String vmUrn);
ListenableFuture<RasdItem> 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<Task> editVirtualHardwareSectionMemory(@EndpointParam(parser = VmURNToHref.class) String vmUrn,
ListenableFuture<Task> editVirtualHardwareSectionMemory(@EndpointParam(parser = URNToHref.class) String vmUrn,
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
/**
@ -499,7 +499,7 @@ public interface VmAsyncApi {
@JAXBResponseParser
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> 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<Task> 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<RasdItemsList> 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<Task> 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<Task> 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);
}

View File

@ -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);
}

View File

@ -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<AdminCatalog> 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<AdminCatalog> get(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn);
ListenableFuture<AdminCatalog> 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<AdminCatalog> edit(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn,
ListenableFuture<AdminCatalog> 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<Void> remove(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn);
ListenableFuture<Void> 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<Owner> getOwner(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn);
ListenableFuture<Owner> 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<Void> setOwner(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn,
ListenableFuture<Void> 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<Void> publish(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn,
ListenableFuture<Void> 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<ControlAccessParams> editAccessControl(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn,
ListenableFuture<ControlAccessParams> 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<ControlAccessParams> getAccessControl(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn);
ListenableFuture<ControlAccessParams> 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<ControlAccessParams> getAccessControl(@EndpointParam URI catalogAdminHref);
/**
* @return synchronous access to {@link Metadata.Writeable} features
*/
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn);
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI catalogAdminHref);
}

View File

@ -19,14 +19,11 @@
package org.jclouds.vcloud.director.v1_5.features.admin;
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);
}

View File

@ -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<? extends Network> get(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn);
ListenableFuture<? extends Network> 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<Task> edit(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn,
ListenableFuture<Task> 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<Task> reset(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn);
ListenableFuture<Task> reset(@EndpointParam(parser = URNToAdminHref.class) String networkUrn);
/**
* @see AdminNetworkApi#reset(URI)
@ -110,16 +108,4 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi {
@Consumes
@JAXBResponseParser
ListenableFuture<Task> reset(@EndpointParam URI networkAdminHref);
/**
* @return asynchronous access to admin {@link MetadataAsyncApi.Writeable} features
*/
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn);
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI networkAdminHref);
}

View File

@ -19,9 +19,9 @@
package org.jclouds.vcloud.director.v1_5.features.admin;
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);
}

View File

@ -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<AdminOrg> get(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
ListenableFuture<AdminOrg> 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<OrgSettings> getSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
ListenableFuture<OrgSettings> 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<OrgSettings> editSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
ListenableFuture<OrgSettings> 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<OrgEmailSettings> getEmailSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
ListenableFuture<OrgEmailSettings> 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<OrgEmailSettings> 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<OrgGeneralSettings> 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<OrgGeneralSettings> 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<OrgLdapSettings> getLdapSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
ListenableFuture<OrgLdapSettings> 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<OrgPasswordPolicySettings> 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<OrgPasswordPolicySettings> 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<OrgLeaseSettings> 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<OrgLeaseSettings> 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<OrgVAppTemplateLeaseSettings> 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<OrgVAppTemplateLeaseSettings> 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<OrgVAppTemplateLeaseSettings> 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);
}

View File

@ -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);
}

View File

@ -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<AdminVdc> get(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
ListenableFuture<AdminVdc> 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<Task> edit(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn, AdminVdc vdc);
ListenableFuture<Task> edit(@EndpointParam(parser = URNToAdminHref.class) String vdcUrn, AdminVdc vdc);
/**
* @see AdminVdcApi#remove(String)
@ -75,7 +73,7 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
@DELETE
@Consumes
@JAXBResponseParser
ListenableFuture<Task> remove(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
ListenableFuture<Task> 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<Void> enable(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
ListenableFuture<Void> 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<Void> disable(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
ListenableFuture<Void> 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<Void> disable(@EndpointParam URI vdcAdminHref);
/**
* @return asynchronous access to {@link Writeable} features
*/
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
@Override
@Delegate
MetadataAsyncApi.Writeable getMetadataApi(@EndpointParam URI vdcAdminHref);
}

View File

@ -38,8 +38,8 @@ import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.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<Group> 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<Group> get(@EndpointParam(parser = GroupURNToHref.class) String groupUri);
ListenableFuture<Group> 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<Group> edit(@EndpointParam(parser = GroupURNToHref.class) String groupUrn,
ListenableFuture<Group> edit(@EndpointParam(parser = URNToHref.class) String groupUrn,
@BinderParam(BindToXMLPayload.class) Group group);
/**
@ -86,7 +86,7 @@ public interface GroupAsyncApi {
@DELETE
@Consumes
@JAXBResponseParser
ListenableFuture<Void> remove(@EndpointParam(parser = GroupURNToHref.class) String groupUrn);
ListenableFuture<Void> remove(@EndpointParam(parser = URNToHref.class) String groupUrn);
/**
* @see GroupApi#addGroupToOrg(Group, URI)

View File

@ -38,8 +38,8 @@ import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.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<User> 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<User> get(@EndpointParam(parser = UserURNToHref.class) String userUrn);
ListenableFuture<User> 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<User> edit(@EndpointParam(parser = UserURNToHref.class) String userUrn,
ListenableFuture<User> edit(@EndpointParam(parser = URNToHref.class) String userUrn,
@BinderParam(BindToXMLPayload.class) User user);
/**
@ -115,7 +115,7 @@ public interface UserAsyncApi {
@DELETE
@Consumes
@JAXBResponseParser
ListenableFuture<Void> remove(@EndpointParam(parser = UserURNToHref.class) String userUrn);
ListenableFuture<Void> remove(@EndpointParam(parser = URNToHref.class) String userUrn);
/**
* @see UserApi#remove(URI)
@ -132,7 +132,7 @@ public interface UserAsyncApi {
@Path("/action/unlock")
@Consumes
@JAXBResponseParser
ListenableFuture<Void> unlock(@EndpointParam(parser = UserURNToHref.class) String userUrn);
ListenableFuture<Void> unlock(@EndpointParam(parser = URNToHref.class) String userUrn);
/**
* @see UserApi#unlock(URI)

View File

@ -0,0 +1,68 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.Iterables;
/**
* Resolves URN to its Admin HREF via the entity Resolver
*
* @author Adrian Cole
*/
@Singleton
public final class URNToAdminHref implements Function<Object, URI> {
private final LoadingCache<String, Entity> resolveEntityCache;
@Inject
public URNToAdminHref(LoadingCache<String, Entity> resolveEntityCache) {
this.resolveEntityCache = checkNotNull(resolveEntityCache, "resolveEntityCache");
}
@Override
public URI apply(@Nullable Object from) {
checkArgument(checkNotNull(from, "urn") instanceof String, "urn is a String argument");
Entity entity = resolveEntityCache.getUnchecked(from.toString());
Optional<Link> link = Iterables.tryFind(entity.getLinks(), typeContainsAdmin);
checkArgument(link.isPresent(), "no admin link found for entity %s", entity);
return link.get().getHref();
}
private static final Predicate<Link> typeContainsAdmin = new Predicate<Link>() {
@Override
public boolean apply(Link in) {
return in.getType().indexOf(".admin.") != -1;
}
};
}

View File

@ -20,6 +20,7 @@ package org.jclouds.vcloud.director.v1_5.functions;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.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<Object, URI> {
public final class URNToHref implements Function<Object, URI> {
private final LoadingCache<String, Entity> resolveEntityCache;
@Inject
@ -50,19 +47,11 @@ public abstract class URNToHref implements Function<Object, URI> {
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> 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();
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class CatalogItemURNToHref extends URNToHref {
@Inject
public CatalogItemURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.CATALOG_ITEM;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class CatalogURNToAdminHref extends URNToHref {
@Inject
public CatalogURNToAdminHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.ADMIN_CATALOG;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class CatalogURNToHref extends URNToHref {
@Inject
public CatalogURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.CATALOG;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class GroupURNToHref extends URNToHref {
@Inject
public GroupURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.GROUP;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class MediaURNToHref extends URNToHref {
@Inject
public MediaURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.MEDIA;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class NetworkURNToAdminHref extends URNToHref {
@Inject
public NetworkURNToAdminHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.ADMIN_NETWORK;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class NetworkURNToHref extends URNToHref {
@Inject
public NetworkURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.NETWORK;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class OrgURNToAdminHref extends URNToHref {
@Inject
public OrgURNToAdminHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.ADMIN_ORG;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class OrgURNToHref extends URNToHref {
@Inject
public OrgURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.ORG;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class TaskURNToHref extends URNToHref {
@Inject
public TaskURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.TASK;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class TasksListURNToHref extends URNToHref {
@Inject
public TasksListURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.TASKS_LIST;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class UserURNToHref extends URNToHref {
@Inject
public UserURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.USER;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class VAppTemplateURNToHref extends URNToHref {
@Inject
public VAppTemplateURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.VAPP_TEMPLATE;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class VAppURNToHref extends URNToHref {
@Inject
public VAppURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.VAPP;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class VdcURNToAdminHref extends URNToHref {
@Inject
public VdcURNToAdminHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.ADMIN_VDC;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class VdcURNToHref extends URNToHref {
@Inject
public VdcURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.VDC;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions.href;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.functions.URNToHref;
import com.google.common.cache.LoadingCache;
@Singleton
public class VmURNToHref extends URNToHref {
@Inject
public VmURNToHref(LoadingCache<String, Entity> resolveEntityCache) {
super(resolveEntityCache);
}
@Override
protected String type() {
return VCloudDirectorMediaType.VM;
}
}

View File

@ -18,11 +18,25 @@
*/
package org.jclouds.vcloud.director.v1_5.user;
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);
}

View File

@ -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);
}

View File

@ -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.

View File

@ -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() {

View File

@ -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);
}

View File

@ -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),

View File

@ -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

View File

@ -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());

View File

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

View File

@ -180,7 +180,7 @@ public class NetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test
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() {

View File

@ -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));
}

View File

@ -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() {

View File

@ -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"
// )'

View File

@ -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<String, String> 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<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
.put(key, value).build();

View File

@ -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);

View File

@ -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();
}
}

View File

@ -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<String, String> 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<String, String> expectedMetadataMap = ImmutableMap.<String, String> 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;
}

View File

@ -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() {

View File

@ -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<String, String> 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);
}

View File

@ -69,9 +69,7 @@ import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
import org.jclouds.vcloud.director.v1_5.domain.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<String, String> 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<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
.put(key, value).build();

View File

@ -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)