Issue 830: Update client get methods to use new error handler

This commit is contained in:
Andrew Donald Kennedy 2012-03-29 11:53:40 +01:00
parent 0cb175d9f2
commit 2a60e1aedb
33 changed files with 151 additions and 432 deletions

View File

@ -35,12 +35,12 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
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.PublishCatalogParams;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -59,18 +59,17 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
@Consumes(VCloudDirectorMediaType.ADMIN_CATALOG)
@Produces(VCloudDirectorMediaType.ADMIN_CATALOG)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<AdminCatalog> createCatalog(@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) AdminCatalog catalog);
/**
* @see AdminClient#getCatalog(URI)
*/
@Override
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@Override
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<AdminCatalog> getCatalog(@EndpointParam URI catalogRef);
/**
@ -80,7 +79,6 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
@Consumes(VCloudDirectorMediaType.ADMIN_CATALOG)
@Produces(VCloudDirectorMediaType.ADMIN_CATALOG)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<AdminCatalog> updateCatalog(@EndpointParam URI catalogRef,
@BinderParam(BindToXMLPayload.class) AdminCatalog catalog);
@ -90,7 +88,6 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
@DELETE
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> deleteCatalog(@EndpointParam URI catalogRef);
/**
@ -100,7 +97,7 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
@Path("/owner")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam URI catalogRef);
/**
@ -111,7 +108,6 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
@Consumes
@Produces(VCloudDirectorMediaType.OWNER)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> setOwner(@EndpointParam URI catalogRef,
@BinderParam(BindToXMLPayload.class) Owner newOwner);
@ -123,7 +119,6 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
@Consumes
@Produces(VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> publishCatalog(@EndpointParam URI catalogRef,
@BinderParam(BindToXMLPayload.class) PublishCatalogParams params);

View File

@ -34,12 +34,12 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.ExternalNetwork;
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -53,11 +53,11 @@ public interface AdminNetworkAsyncClient extends NetworkAsyncClient {
/**
* @see AdminNetworkClient#getNetwork(URI)
*/
@Override
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@Override
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ExternalNetwork> getNetwork(@EndpointParam URI networkRef);
/**
@ -67,7 +67,6 @@ public interface AdminNetworkAsyncClient extends NetworkAsyncClient {
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> updateNetwork(@EndpointParam URI networkRef,
@BinderParam(BindToXMLPayload.class) OrgNetwork network);
@ -78,7 +77,6 @@ public interface AdminNetworkAsyncClient extends NetworkAsyncClient {
@Path("/action/reset")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> resetNetwork(@EndpointParam URI networkRef);
/**

View File

@ -33,6 +33,7 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.AdminOrg;
import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings;
@ -43,7 +44,6 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -61,9 +61,8 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<AdminOrg> getOrg(
@EndpointParam URI orgRef);
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<AdminOrg> getOrg(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#getSettings(URI)
@ -72,9 +71,8 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Path("/settings")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgSettings> getSettings(
@EndpointParam URI orgRef);
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<OrgSettings> getSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateSettings(URI, OrgSettings)
@ -84,9 +82,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Consumes(VCloudDirectorMediaType.ORG_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgSettings> updateSettings(
@EndpointParam URI orgRef,
ListenableFuture<OrgSettings> updateSettings(@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgSettings settings);
/**
@ -96,9 +92,8 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Path("/settings/email")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgEmailSettings> getEmailSettings(
@EndpointParam URI orgRef);
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<OrgEmailSettings> getEmailSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateEmailSettings(URI, OrgEmailSettings)
@ -108,9 +103,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Consumes(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgEmailSettings> updateEmailSettings(
@EndpointParam URI orgRef,
ListenableFuture<OrgEmailSettings> updateEmailSettings(@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgEmailSettings settings);
/**
@ -120,9 +113,8 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Path("/settings/general")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgGeneralSettings> getGeneralSettings(
@EndpointParam URI orgRef);
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<OrgGeneralSettings> getGeneralSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateGeneralSettings(URI, OrgGeneralSettings)
@ -132,7 +124,6 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Consumes(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgGeneralSettings> updateGeneralSettings(
@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings);
@ -144,7 +135,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Path("/settings/ldap")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<OrgLdapSettings> getLdapSettings(@EndpointParam URI orgRef);
/**
@ -154,9 +145,8 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Path("/settings/passwordPolicy")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy(
@EndpointParam URI orgRef);
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updatePasswordPolicy(URI, OrgPasswordPolicySettings)
@ -166,9 +156,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Consumes(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgPasswordPolicySettings> updatePasswordPolicy(
@EndpointParam URI orgRef,
ListenableFuture<OrgPasswordPolicySettings> updatePasswordPolicy(@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings);
/**
@ -178,9 +166,8 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Path("/settings/vAppLeaseSettings")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings(
@EndpointParam URI orgRef);
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateVAppLeaseSettings(URI, OrgVAppLeaseSettings)
@ -190,9 +177,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Consumes(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgLeaseSettings> updateVAppLeaseSettings(
@EndpointParam URI orgRef,
ListenableFuture<OrgLeaseSettings> updateVAppLeaseSettings(@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings);
/**
@ -202,9 +187,8 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Path("/settings/vAppTemplateLeaseSettings")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings(
@EndpointParam URI orgRef);
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateVAppTemplateLeaseSettings(URI, OrgVAppTemplateLeaseSettings)
@ -214,9 +198,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@Consumes(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgVAppTemplateLeaseSettings> updateVAppTemplateLeaseSettings(
@EndpointParam URI orgRef,
ListenableFuture<OrgVAppTemplateLeaseSettings> updateVAppTemplateLeaseSettings(@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings);
/**

View File

@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.AdminOrg;
import org.jclouds.vcloud.director.v1_5.domain.Org;
import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgGeneralSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgLdapSettings;

View File

@ -26,14 +26,12 @@ import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.RoleReferences;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -51,56 +49,48 @@ public interface AdminQueryAsyncClient extends QueryAsyncClient {
@Path("/admin/groups/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> groupsQueryAll();
@GET
@Path("/admin/groups/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> groupsQuery(@QueryParam("filter") String filter);
@GET
@Path("/admin/orgs/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> orgsQueryAll();
@GET
@Path("/admin/orgs/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> orgsQuery(@QueryParam("filter") String filter);
@GET
@Path("/admin/rights/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> rightsQueryAll();
@GET
@Path("/admin/rights/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> rightsQuery(@QueryParam("filter") String filter);
@GET
@Path("/admin/roles/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> rolesQueryAll();
@GET
@Path("/admin/roles/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> rolesQuery(@QueryParam("filter") String filter);
@GET
@ -108,48 +98,41 @@ public interface AdminQueryAsyncClient extends QueryAsyncClient {
@Consumes
@QueryParams(keys = { "format" }, values = { "references" })
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<RoleReferences> roleReferencesQueryAll();
@GET
@Path("/admin/strandedUsers/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> strandedUsersQueryAll();
@GET
@Path("/admin/strandedUsers/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> strandedUsersQuery(@QueryParam("filter") String filter);
@GET
@Path("/admin/users/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> usersQueryAll();
@GET
@Path("/admin/users/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> usersQuery(@QueryParam("filter") String filter);
@GET
@Path("/admin/vdcs/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> vdcsQueryAll();
@GET
@Path("/admin/vdcs/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> vdcsQuery(@QueryParam("filter") String filter);
}

View File

@ -20,15 +20,8 @@ package org.jclouds.vcloud.director.v1_5.features;
import java.util.concurrent.TimeUnit;
import javax.management.relation.Role;
import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.director.v1_5.domain.Group;
import org.jclouds.vcloud.director.v1_5.domain.Org;
import org.jclouds.vcloud.director.v1_5.domain.RoleReference;
import org.jclouds.vcloud.director.v1_5.domain.RoleReferences;
import org.jclouds.vcloud.director.v1_5.domain.User;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
/**

View File

@ -33,11 +33,11 @@ import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
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.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -48,38 +48,34 @@ import com.google.common.util.concurrent.ListenableFuture;
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface AdminVdcAsyncClient extends VdcAsyncClient {
@Override
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@Override
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<AdminVdc> getVdc(@EndpointParam URI vdcRef);
@PUT
@Consumes
@Produces(VCloudDirectorMediaType.ADMIN_VDC)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> editVdc(@EndpointParam URI vdcRef, AdminVdc vdc);
@DELETE
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteVdc(@EndpointParam URI vdcRef);
@POST
@Consumes
@Path("/action/enable")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> enableVdc(@EndpointParam URI vdcRef);
@POST
@Consumes
@Path("/action/disable")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> disableVdc(@EndpointParam URI vdcRef);
/**

View File

@ -35,11 +35,11 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
import org.jclouds.vcloud.director.v1_5.domain.CatalogType;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -56,7 +56,7 @@ public interface CatalogAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends CatalogType> getCatalog(@EndpointParam URI catalogUri);
/**
@ -67,7 +67,6 @@ public interface CatalogAsyncClient {
@Consumes(VCloudDirectorMediaType.CATALOG_ITEM)
@Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogItem> addCatalogItem(@EndpointParam URI catalogUri,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
@ -77,7 +76,7 @@ public interface CatalogAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<CatalogItem> getCatalogItem(@EndpointParam URI catalogItemUri);
/**
@ -87,7 +86,6 @@ public interface CatalogAsyncClient {
@Consumes(VCloudDirectorMediaType.CATALOG_ITEM)
@Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogItem> updateCatalogItem(@EndpointParam URI catalogItemUri,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
@ -97,7 +95,6 @@ public interface CatalogAsyncClient {
@DELETE
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> deleteCatalogItem(@EndpointParam URI catalogItemUri);
/**

View File

@ -34,10 +34,10 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Group;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -53,7 +53,6 @@ public interface GroupAsyncClient {
@Consumes(VCloudDirectorMediaType.GROUP)
@Produces(VCloudDirectorMediaType.GROUP)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Group> createGroup(@EndpointParam URI adminOrgUri,
@BinderParam(BindToXMLPayload.class) Group group);
@ -63,7 +62,7 @@ public interface GroupAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Group> getGroup(@EndpointParam URI groupUri);
/**
@ -73,7 +72,6 @@ public interface GroupAsyncClient {
@Consumes(VCloudDirectorMediaType.GROUP)
@Produces(VCloudDirectorMediaType.GROUP)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Group> updateGroup(@EndpointParam URI groupRef,
@BinderParam(BindToXMLPayload.class) Group group);
@ -83,6 +81,5 @@ public interface GroupAsyncClient {
@DELETE
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> deleteGroup(@EndpointParam URI groupRef);
}

View File

@ -35,13 +35,13 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams;
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.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -58,7 +58,7 @@ public interface MediaAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Media> getMedia(@EndpointParam URI uri);
/**
@ -68,7 +68,6 @@ public interface MediaAsyncClient {
@Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Media> createMedia(@EndpointParam URI link,
@BinderParam(BindToXMLPayload.class) Media media);
@ -81,7 +80,6 @@ public interface MediaAsyncClient {
@Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.CLONE_MEDIA_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Media> cloneMedia(@EndpointParam URI vdcRef,
@BinderParam(BindToXMLPayload.class) CloneMediaParams params);
@ -92,7 +90,6 @@ public interface MediaAsyncClient {
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> updateMedia(@EndpointParam URI uri, @BinderParam(BindToXMLPayload.class) Media media);
/**
@ -101,7 +98,6 @@ public interface MediaAsyncClient {
@DELETE
@Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteMedia(@EndpointParam URI uri);
/**
@ -111,7 +107,7 @@ public interface MediaAsyncClient {
@Path("/owner")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam URI uri);
/**

View File

@ -35,12 +35,12 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -60,7 +60,7 @@ public interface MetadataAsyncClient {
@Path("/metadata")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Metadata> getMetadata(@EndpointParam URI metaDataUri);
/**
@ -70,7 +70,7 @@ public interface MetadataAsyncClient {
@Path("/metadata/{key}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam URI metaDataUri, @PathParam("key") String key);
}
@ -85,7 +85,6 @@ public interface MetadataAsyncClient {
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.METADATA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> mergeMetadata(@EndpointParam URI metaDataUri, @BinderParam(BindToXMLPayload.class) Metadata metadata);
/**
@ -96,7 +95,6 @@ public interface MetadataAsyncClient {
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.METADATA_VALUE)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> setMetadata(@EndpointParam URI metaDataUri,
@PathParam("key") String key,
@BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
@ -108,7 +106,6 @@ public interface MetadataAsyncClient {
@Path("/metadata/{key}")
@Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteMetadataEntry(@EndpointParam URI metaDataUri, @PathParam("key") String key);
}
}

View File

@ -28,9 +28,9 @@ import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.domain.Network;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -47,7 +47,7 @@ public interface NetworkAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends Network> getNetwork(@EndpointParam URI networkUri);
/**

View File

@ -36,11 +36,11 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams;
import org.jclouds.vcloud.director.v1_5.domain.Org;
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -66,7 +66,7 @@ public interface OrgAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends Org> getOrg(@EndpointParam URI orgUri);
/**
@ -77,7 +77,6 @@ public interface OrgAsyncClient {
@Produces(CONTROL_ACCESS)
@Consumes(CONTROL_ACCESS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<ControlAccessParams> modifyControlAccess(@EndpointParam URI orgRef,
@PathParam("catalogId") String catalogId,
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
@ -89,7 +88,7 @@ public interface OrgAsyncClient {
@Path("/catalog/{catalogId}/controlAccess")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ControlAccessParams> getControlAccess(@EndpointParam URI orgRef,
@PathParam("catalogId") String catalogId);

View File

@ -29,14 +29,13 @@ import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SkipEncoding;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryList;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
import org.jclouds.vcloud.director.v1_5.domain.query.VAppReferences;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +54,7 @@ public interface QueryAsyncClient {
@Path("/entity/{id}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Entity> entity(@PathParam("id") String id);
/**
@ -65,28 +64,24 @@ public interface QueryAsyncClient {
@Path("/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryList> queryList();
@GET
@Path("/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> queryAll(@QueryParam("type") String type);
@GET
@Path("/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> query(@QueryParam("type") String type, @QueryParam("filter") String filter);
@GET
@Path("/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> query(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
@QueryParam("format") String format, @QueryParam("type") String type, @QueryParam("filter") String filter);
@ -97,21 +92,18 @@ public interface QueryAsyncClient {
@Path("/catalogs/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> catalogsQueryAll();
@GET
@Path("/catalogs/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> catalogsQuery(@QueryParam("filter") String filter);
@GET
@Path("/catalogs/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> catalogsQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
@QueryParam("filter") String filter);
@ -120,7 +112,6 @@ public interface QueryAsyncClient {
@Consumes
@QueryParams(keys = { "format" }, values = { "references" })
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogReferences> catalogReferencesQueryAll();
@GET
@ -128,7 +119,6 @@ public interface QueryAsyncClient {
@Consumes
@QueryParams(keys = { "format" }, values = { "references" })
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogReferences> catalogReferencesQuery(@QueryParam("filter") String filter);
@GET
@ -136,7 +126,6 @@ public interface QueryAsyncClient {
@Consumes
@QueryParams(keys = { "format" }, values = { "references" })
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogReferences> catalogReferencesQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
@QueryParam("filter") String filter);
@ -144,14 +133,12 @@ public interface QueryAsyncClient {
@Path("/vAppTemplates/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> vAppTemplatesQueryAll();
@GET
@Path("/vAppTemplates/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> vAppTemplatesQuery(@QueryParam("filter") String filter);
/**
@ -161,21 +148,18 @@ public interface QueryAsyncClient {
@Path("/vApps/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> vAppsQueryAll();
@GET
@Path("/vApps/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> vAppsQuery(@QueryParam("filter") String filter);
@GET
@Path("/vApps/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> vAppsQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
@QueryParam("filter") String filter);
@ -184,7 +168,6 @@ public interface QueryAsyncClient {
@Consumes
@QueryParams(keys = { "format" }, values = { "references" })
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VAppReferences> vAppReferencesQueryAll();
@GET
@ -192,7 +175,6 @@ public interface QueryAsyncClient {
@Consumes
@QueryParams(keys = { "format" }, values = { "references" })
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VAppReferences> vAppReferencesQuery(@QueryParam("filter") String filter);
@GET
@ -200,7 +182,6 @@ public interface QueryAsyncClient {
@Consumes
@QueryParams(keys = { "format" }, values = { "references" })
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VAppReferences> vAppReferencesQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
@QueryParam("filter") String filter);
@ -208,27 +189,23 @@ public interface QueryAsyncClient {
@Path("/vms/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> vmsQueryAll();
@GET
@Path("/vms/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> vmsQuery(@QueryParam("filter") String filter);
@GET
@Path("/mediaList/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> mediaListQueryAll();
@GET
@Path("/mediaList/query")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<QueryResultRecords> mediaListQuery(@QueryParam("filter") String filter);
}

View File

@ -21,11 +21,7 @@ package org.jclouds.vcloud.director.v1_5.features;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.director.v1_5.domain.CatalogReference;
import org.jclouds.vcloud.director.v1_5.domain.Entity;
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.Vm;
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryList;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;

View File

@ -29,11 +29,11 @@ import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
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.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.OrgReferenceToTaskListEndpoint;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -50,7 +50,7 @@ public interface TaskAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<TasksList> getTaskList(@EndpointParam(parser = OrgReferenceToTaskListEndpoint.class) URI orgURI);
/**
@ -59,7 +59,7 @@ public interface TaskAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Task> getTask(@EndpointParam URI taskURI);
/**
@ -69,6 +69,5 @@ public interface TaskAsyncClient {
@Path("/action/cancel")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> cancelTask(@EndpointParam URI taskURI);
}

View File

@ -34,10 +34,10 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.User;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -56,7 +56,6 @@ public interface UserAsyncClient {
@Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<User> createUser(@EndpointParam URI userRef,
@BinderParam(BindToXMLPayload.class) User user);
@ -66,7 +65,7 @@ public interface UserAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<User> getUser(@EndpointParam URI userRef);
/**
@ -76,7 +75,6 @@ public interface UserAsyncClient {
@Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<User> updateUser(@EndpointParam URI userRef,
@BinderParam(BindToXMLPayload.class) User user);
@ -86,7 +84,6 @@ public interface UserAsyncClient {
@DELETE
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> deleteUser(@EndpointParam URI userRef);
/**
@ -96,6 +93,5 @@ public interface UserAsyncClient {
@Path("/action/unlock")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> unlockUser(@EndpointParam URI userRef);
}

View File

@ -58,6 +58,7 @@ import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams;
import org.jclouds.vcloud.director.v1_5.domain.DeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection;
@ -84,7 +85,6 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ReturnPayloadBytes;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -101,7 +101,7 @@ public interface VAppAsyncClient {
@GET
@Consumes(VAPP)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VApp> getVApp(@EndpointParam URI vAppURI);
/**
@ -111,7 +111,6 @@ public interface VAppAsyncClient {
@Produces(VAPP)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyVApp(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) VApp vApp);
@ -121,7 +120,6 @@ public interface VAppAsyncClient {
@DELETE
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteVApp(@EndpointParam URI vAppURI);
/**
@ -131,7 +129,6 @@ public interface VAppAsyncClient {
@Path("/action/consolidate")
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> consolidateVApp(@EndpointParam URI vAppURI);
/**
@ -142,7 +139,6 @@ public interface VAppAsyncClient {
@Produces(CONTROL_ACCESS)
@Consumes(CONTROL_ACCESS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<ControlAccessParams> controlAccess(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
@ -154,7 +150,6 @@ public interface VAppAsyncClient {
@Produces(DEPLOY_VAPP_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deploy(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) DeployVAppParams params);
@ -165,7 +160,6 @@ public interface VAppAsyncClient {
@Path("/action/discardSuspendedState")
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vAppURI);
/**
@ -175,7 +169,6 @@ public interface VAppAsyncClient {
@Path("/action/enterMaintenanceMode")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> enterMaintenanceMode(@EndpointParam URI vAppURI);
/**
@ -185,7 +178,6 @@ public interface VAppAsyncClient {
@Path("/action/exitMaintenanceMode")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> exitMaintenanceMode(@EndpointParam URI vAppURI);
/**
@ -195,7 +187,6 @@ public interface VAppAsyncClient {
@Path("/action/installVMwareTools")
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> installVMwareTools(@EndpointParam URI vAppURI);
/**
@ -206,7 +197,6 @@ public interface VAppAsyncClient {
@Produces(RECOMPOSE_VAPP_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> recomposeVApp(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RecomposeVAppParams params);
@ -218,7 +208,6 @@ public interface VAppAsyncClient {
@Produces(RELOCATE_VM_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> relocate(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RelocateParams params);
@ -230,7 +219,6 @@ public interface VAppAsyncClient {
@Produces(UNDEPLOY_VAPP_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> undeploy(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
@ -241,7 +229,6 @@ public interface VAppAsyncClient {
@Path("/action/upgradeHardwareVersion")
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam URI vAppURI);
/**
@ -251,7 +238,7 @@ public interface VAppAsyncClient {
@Path("/controlAccess")
@Consumes(CONTROL_ACCESS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ControlAccessParams> getControlAccess(@EndpointParam URI vAppURI);
/**
@ -261,7 +248,6 @@ public interface VAppAsyncClient {
@Path("/power/action/powerOff")
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> powerOff(@EndpointParam URI vAppURI);
/**
@ -271,7 +257,6 @@ public interface VAppAsyncClient {
@Path("/power/action/powerOn")
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> powerOn(@EndpointParam URI vAppURI);
/**
@ -281,7 +266,6 @@ public interface VAppAsyncClient {
@Path("/power/action/powerOff")
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> reboot(@EndpointParam URI vAppURI);
/**
@ -291,7 +275,6 @@ public interface VAppAsyncClient {
@Path("/power/action/reset")
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> reset(@EndpointParam URI vAppURI);
/**
@ -301,7 +284,6 @@ public interface VAppAsyncClient {
@Path("/power/action/shutdown")
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> shutdown(@EndpointParam URI vAppURI);
/**
@ -311,7 +293,6 @@ public interface VAppAsyncClient {
@Path("/power/action/suspend")
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> suspend(@EndpointParam URI vAppURI);
/**
@ -321,7 +302,7 @@ public interface VAppAsyncClient {
@Path("/guestCustomizationSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmURI);
/**
@ -332,7 +313,6 @@ public interface VAppAsyncClient {
@Produces(GUEST_CUSTOMIZATION_SECTION)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyGuestCustomizationSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
@ -343,7 +323,7 @@ public interface VAppAsyncClient {
@Path("/leaseSettingsSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI vAppURI);
/**
@ -354,7 +334,6 @@ public interface VAppAsyncClient {
@Produces(LEASE_SETTINGS_SECTION)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyLeaseSettingsSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
@ -366,7 +345,6 @@ public interface VAppAsyncClient {
@Produces(MEDIA_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> ejectMedia(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
@ -378,7 +356,6 @@ public interface VAppAsyncClient {
@Produces(MEDIA_PARAMS)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> insertMedia(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
@ -389,7 +366,7 @@ public interface VAppAsyncClient {
@Path("/networkConfigSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI vAppURI);
/**
@ -400,7 +377,6 @@ public interface VAppAsyncClient {
@Produces(NETWORK_CONFIG_SECTION)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyNetworkConfigSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
@ -411,7 +387,7 @@ public interface VAppAsyncClient {
@Path("/networkConnectionSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmURI);
/**
@ -422,7 +398,6 @@ public interface VAppAsyncClient {
@Produces(NETWORK_CONNECTION_SECTION)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyNetworkConnectionSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
@ -433,7 +408,7 @@ public interface VAppAsyncClient {
@Path("/networkSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI vAppURI);
/**
@ -443,7 +418,7 @@ public interface VAppAsyncClient {
@Path("/operatingSystemSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmURI);
/**
@ -454,7 +429,6 @@ public interface VAppAsyncClient {
@Produces(OPERATING_SYSTEM_SECTION)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyOperatingSystemSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
@ -465,7 +439,7 @@ public interface VAppAsyncClient {
@Path("/owner")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam URI vAppURI);
/**
@ -476,7 +450,6 @@ public interface VAppAsyncClient {
@Produces(OWNER)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> modifyOwner(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) Owner owner);
@ -487,7 +460,7 @@ public interface VAppAsyncClient {
@Path("/productSections")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vAppURI);
/**
@ -498,7 +471,6 @@ public interface VAppAsyncClient {
@Produces(PRODUCT_SECTION_LIST)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyProductSections(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
@ -509,7 +481,7 @@ public interface VAppAsyncClient {
@Path("/question")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam URI vAppURI);
/**
@ -520,7 +492,6 @@ public interface VAppAsyncClient {
@Produces(VM_PENDING_ANSWER)
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> answerQuestion(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer);
@ -531,7 +502,7 @@ public interface VAppAsyncClient {
@Path("/runtimeInfoSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam URI vmURI);
/**
@ -540,7 +511,7 @@ public interface VAppAsyncClient {
@GET
@Path("/screen")
@Consumes(ANY_IMAGE)
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@ResponseParser(ReturnPayloadBytes.class)
ListenableFuture<byte[]> getScreenImage(@EndpointParam URI vAppURI);
@ -551,7 +522,7 @@ public interface VAppAsyncClient {
@Path("/screen/action/acquireTicket")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam URI vAppURI);
/**
@ -561,7 +532,7 @@ public interface VAppAsyncClient {
@Path("/startupSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<StartupSection> getStartupSection(@EndpointParam URI vAppURI);
/**
@ -572,7 +543,6 @@ public interface VAppAsyncClient {
@Produces(STARTUP_SECTION)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyStartupSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) StartupSection section);
@ -583,7 +553,7 @@ public interface VAppAsyncClient {
@Path("/virtualHardwareSection")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmURI);
/**
@ -594,7 +564,6 @@ public interface VAppAsyncClient {
@Produces(VIRTUAL_HARDWARE_SECTION)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyVirtualHardwareSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
@ -605,7 +574,7 @@ public interface VAppAsyncClient {
@Path("/virtualHardwareSection/cpu")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ResourceAllocationSettingData> getVirtualHardwareSectionCpu(@EndpointParam URI vAppURI);
/**
@ -616,7 +585,6 @@ public interface VAppAsyncClient {
@Produces(OVF_RASD_ITEM)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyVirtualHardwareSectionCpu(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) ResourceAllocationSettingData rasd);
@ -627,7 +595,7 @@ public interface VAppAsyncClient {
@Path("/virtualHardwareSection/disks")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(@EndpointParam URI vAppURI);
/**
@ -638,7 +606,6 @@ public interface VAppAsyncClient {
@Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyVirtualHardwareSectionDisks(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
@ -649,7 +616,7 @@ public interface VAppAsyncClient {
@Path("/virtualHardwareSection/media")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia(@EndpointParam URI vAppURI);
/**
@ -659,7 +626,7 @@ public interface VAppAsyncClient {
@Path("/virtualHardwareSection/memory")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ResourceAllocationSettingData> getVirtualHardwareSectionMemory(@EndpointParam URI vAppURI);
/**
@ -670,7 +637,6 @@ public interface VAppAsyncClient {
@Produces(OVF_RASD_ITEM)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyVirtualHardwareSectionMemory(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) ResourceAllocationSettingData rasd);
@ -681,7 +647,7 @@ public interface VAppAsyncClient {
@Path("/virtualHardwareSection/networkCards")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(@EndpointParam URI vAppURI);
/**
@ -692,7 +658,6 @@ public interface VAppAsyncClient {
@Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyVirtualHardwareSectionNetworkCards(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
@ -703,7 +668,7 @@ public interface VAppAsyncClient {
@Path("/virtualHardwareSection/serialPorts")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(@EndpointParam URI vAppURI);
/**
@ -714,7 +679,6 @@ public interface VAppAsyncClient {
@Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyVirtualHardwareSectionSerialPorts(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);

View File

@ -47,6 +47,7 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.domain.CustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection;
@ -61,7 +62,6 @@ import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Envelope;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -78,7 +78,7 @@ public interface VAppTemplateAsyncClient {
@GET
@Consumes(VAPP_TEMPLATE)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VAppTemplate> getVAppTemplate(@EndpointParam URI reference);
@ -89,7 +89,6 @@ public interface VAppTemplateAsyncClient {
@Produces(VAPP_TEMPLATE)
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> editVAppTemplate(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) VAppTemplate template);
@ -99,7 +98,6 @@ public interface VAppTemplateAsyncClient {
@DELETE
@Consumes(TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteVappTemplate(@EndpointParam URI templateUri);
/**
@ -109,7 +107,6 @@ public interface VAppTemplateAsyncClient {
@Consumes(TASK)
@Path("/action/consolidate")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> consolidateVappTemplate(@EndpointParam URI templateURI);
/**
@ -118,7 +115,6 @@ public interface VAppTemplateAsyncClient {
@POST
@Path("/action/disableDownload")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> disableDownloadVappTemplate(@EndpointParam URI templateURI);
/**
@ -128,7 +124,6 @@ public interface VAppTemplateAsyncClient {
@Consumes(TASK)
@Path("/action/enableDownload")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> enableDownloadVappTemplate(@EndpointParam URI templateURI);
/**
@ -139,7 +134,6 @@ public interface VAppTemplateAsyncClient {
@Consumes(TASK)
@Path("/action/relocate")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> relocateVappTemplate(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) RelocateParams params);
@ -150,7 +144,7 @@ public interface VAppTemplateAsyncClient {
@Consumes(CUSTOMIZATION_SECTION)
@Path("/customizationSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<CustomizationSection> getVAppTemplateCustomizationSection(@EndpointParam URI templateURI);
/**
@ -161,7 +155,6 @@ public interface VAppTemplateAsyncClient {
@Consumes(TASK)
@Path("/customizationSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> editVAppTemplateCustomizationSection(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) CustomizationSection sectionType);
@ -172,7 +165,7 @@ public interface VAppTemplateAsyncClient {
@Consumes(GUEST_CUSTOMIZATION_SECTION)
@Path("/guestCustomizationSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<GuestCustomizationSection> getVAppTemplateGuestCustomizationSection(@EndpointParam URI templateURI);
/**
@ -183,7 +176,6 @@ public interface VAppTemplateAsyncClient {
@Consumes(TASK)
@Path("/guestCustomizationSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> editVAppTemplateGuestCustomizationSection(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
@ -194,7 +186,7 @@ public interface VAppTemplateAsyncClient {
@Consumes(LEASE_SETTINGS_SECTION)
@Path("/leaseSettingsSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<LeaseSettingsSection> getVappTemplateLeaseSettingsSection(@EndpointParam URI templateURI);
/**
@ -205,7 +197,6 @@ public interface VAppTemplateAsyncClient {
@Consumes(TASK)
@Path("/leaseSettingsSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> editVappTemplateLeaseSettingsSection(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection);
@ -216,7 +207,7 @@ public interface VAppTemplateAsyncClient {
@Consumes(NETWORK_CONFIG_SECTION)
@Path("/networkConfigSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkConfigSection> getVAppTemplateNetworkConfigSection(@EndpointParam URI templateURI);
/**
@ -227,7 +218,6 @@ public interface VAppTemplateAsyncClient {
@Consumes(TASK)
@Path("/networkConfigSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> editVAppTemplateNetworkConfigSection(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
@ -238,7 +228,7 @@ public interface VAppTemplateAsyncClient {
@Consumes(NETWORK_CONNECTION_SECTION)
@Path("/networkConnectionSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkConnectionSection> getVAppTemplateNetworkConnectionSection(@EndpointParam URI templateURI);
/**
@ -249,7 +239,6 @@ public interface VAppTemplateAsyncClient {
@Consumes(TASK)
@Path("/networkConnectionSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> editVAppTemplateNetworkConnectionSection(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
@ -260,7 +249,7 @@ public interface VAppTemplateAsyncClient {
@Consumes(NETWORK_SECTION)
@Path("/networkSection")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkSection> getVAppTemplateNetworkSection(@EndpointParam URI templateURI);
/**
@ -270,7 +259,7 @@ public interface VAppTemplateAsyncClient {
@Consumes
@Path("/ovf")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Envelope> getVAppTemplateOvf(@EndpointParam URI templateURI);
/**
@ -280,7 +269,7 @@ public interface VAppTemplateAsyncClient {
@Consumes(OWNER)
@Path("/owner")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwnerOfVAppTemplate(@EndpointParam URI templateURI);
/**
@ -290,7 +279,7 @@ public interface VAppTemplateAsyncClient {
@Consumes(PRODUCT_SECTION_LIST)
@Path("/productSections")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ProductSectionList> getProductSectionsForVAppTemplate(@EndpointParam URI templateURI);
/**
@ -301,7 +290,6 @@ public interface VAppTemplateAsyncClient {
@Consumes(TASK)
@Path("/productSections")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> editProductSectionsForVAppTemplate(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) ProductSectionList sections);
@ -312,7 +300,7 @@ public interface VAppTemplateAsyncClient {
@Consumes
@Path("/shadowVms")
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<References> getShadowVms(@EndpointParam URI templateURI);
/**

View File

@ -33,6 +33,7 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams;
@ -46,7 +47,6 @@ 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.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
@ -63,7 +63,7 @@ public interface VdcAsyncClient {
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends Vdc> getVdc(@EndpointParam URI vdcURI);
/**
@ -74,7 +74,6 @@ public interface VdcAsyncClient {
@Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE)
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VAppTemplate> captureVApp(@EndpointParam URI vdcURI,
@BinderParam(BindToXMLPayload.class) CaptureVAppParams params);
@ -86,7 +85,6 @@ public interface VdcAsyncClient {
@Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.CLONE_MEDIA_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Media> cloneMedia(@EndpointParam URI vdcURI,
@BinderParam(BindToXMLPayload.class) CloneMediaParams params);
@ -98,7 +96,6 @@ public interface VdcAsyncClient {
@Consumes(VCloudDirectorMediaType.VAPP)
@Produces(VCloudDirectorMediaType.CLONE_VAPP_PARAMS) //TODO fix these etc.
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VApp> cloneVApp(@EndpointParam URI vdcURI,
@BinderParam(BindToXMLPayload.class) CloneVAppParams params);
@ -110,7 +107,6 @@ public interface VdcAsyncClient {
@Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE)
@Produces(VCloudDirectorMediaType.CLONE_VAPP_TEMPLATE_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VAppTemplate> cloneVAppTemplate(@EndpointParam URI vdcURI,
@BinderParam(BindToXMLPayload.class) CloneVAppTemplateParams params);
@ -122,7 +118,6 @@ public interface VdcAsyncClient {
@Consumes(VCloudDirectorMediaType.VAPP)
@Produces(VCloudDirectorMediaType.COMPOSE_VAPP_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VApp> composeVApp(@EndpointParam URI vdcURI,
@BinderParam(BindToXMLPayload.class) ComposeVAppParams params);
@ -134,7 +129,6 @@ public interface VdcAsyncClient {
@Consumes(VCloudDirectorMediaType.VAPP)
@Produces(VCloudDirectorMediaType.INSTANTIATE_VAPP_TEMPLATE_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VApp> instantiateVApp(@EndpointParam URI vdcURI,
@BinderParam(BindToXMLPayload.class) InstantiateVAppParamsType params);
@ -146,7 +140,6 @@ public interface VdcAsyncClient {
@Consumes(VCloudDirectorMediaType.VAPP_TEMPLATE)
@Produces(VCloudDirectorMediaType.UPLOAD_VAPP_TEMPLATE_PARAMS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VAppTemplate> uploadVAppTemplate(@EndpointParam URI vdcURI,
@BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params);
@ -158,7 +151,6 @@ public interface VdcAsyncClient {
@Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Media> createMedia(@EndpointParam URI vdcURI,
@BinderParam(BindToXMLPayload.class) Media media);

View File

@ -30,7 +30,6 @@ import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppParamsType;
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.UploadVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;

View File

@ -23,6 +23,7 @@ import java.net.URI;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.Org;
@ -49,6 +50,9 @@ public class OrgReferenceToTaskListEndpoint implements Function<Object, URI> {
Preconditions.checkArgument(input instanceof URI);
URI reference = (URI) input;
Org org = client.getOrg(reference);
if (org == null) {
throw new ResourceNotFoundException();
}
for (Link link : org.getLinks()) {
if (link.getType().equals(VCloudDirectorMediaType.TASKS_LIST)) {
return link.getHref();

View File

@ -1,63 +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;
import java.io.IOException;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.xml.bind.JAXB;
import org.jclouds.http.HttpResponseException;
import org.jclouds.io.InputSuppliers;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.domain.Error;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.collect.Iterables;
/**
* @author grkvlt@apache.org
*/
@Singleton
public class ThrowVCloudErrorOn4xx implements Function<Exception, Object> {
@Inject
private ThrowVCloudErrorOn4xx() {
}
@Override
public Object apply(Exception from) {
Iterable<HttpResponseException> throwables = Iterables.filter(Throwables.getCausalChain(from), HttpResponseException.class);
HttpResponseException exception = Iterables.getFirst(throwables, null);
if (exception != null && exception.getResponse() != null && exception.getResponse().getStatusCode() >= 400 && exception.getResponse().getStatusCode() < 500) {
try {
Error error = JAXB.unmarshal(InputSuppliers.of(exception.getContent()).getInput(), Error.class);
if (exception.getResponse().getStatusCode() == 403 && error.getMinorErrorCode().equals("ACCESS_TO_RESOURCE_IS_FORBIDDEN")) {
throw new ResourceNotFoundException(error.getMessage());
}
throw new VCloudDirectorException(error);
} catch (IOException e) {
Throwables.propagate(e);
}
}
throw Throwables.propagate(from);
}
}

View File

@ -21,48 +21,57 @@ package org.jclouds.vcloud.director.v1_5.handlers;
import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
import javax.inject.Singleton;
import javax.xml.bind.JAXB;
import org.jclouds.http.HttpCommand;
import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.HttpResponse;
import org.jclouds.http.HttpResponseException;
import org.jclouds.io.InputSuppliers;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Error;
import com.google.common.base.Throwables;
/**
* This will parse and set an appropriate exception on the command object.
*
* @author Adrian Cole
*
*/
//TODO: is there error spec someplace? let's type errors, etc.
@Singleton
public class VCloudDirectorErrorHandler implements HttpErrorHandler {
@Override
public void handleError(HttpCommand command, HttpResponse response) {
// it is important to always read fully and close streams
byte[] data = closeClientButKeepContentStream(response);
String message = data != null ? new String(data) : null;
Exception exception = message != null ? new HttpResponseException(command, response, message)
: new HttpResponseException(command, response);
message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
response.getStatusLine());
switch (response.getStatusCode()) {
case 401:
case 403:
exception = new AuthorizationException(message, exception);
break;
case 404:
if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
exception = new ResourceNotFoundException(message, exception);
}
break;
default:
exception = new HttpResponseException(command, response, message);
break;
// Create default exception
String message = data != null
? new String(data)
: String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), response.getStatusLine());
Exception exception = new HttpResponseException(command, response, response.getPayload().getContentMetadata().getContentType());
// Try to create a VCloudDirectorException from XML payload
if (response.getPayload().getContentMetadata().getContentType().startsWith(VCloudDirectorMediaType.ERROR)) {
try {
Error error = JAXB.unmarshal(InputSuppliers.of(data).getInput(), Error.class);
exception = new VCloudDirectorException(error);
} catch (Exception e) {
Throwables.propagate(e);
}
}
// Create custom exception for error codes we know about
if (response.getStatusCode() == 401) {
exception = new AuthorizationException(message, exception);
} else if (response.getStatusCode() == 403 || response.getStatusCode() == 404) {
exception = new ResourceNotFoundException(message, exception);
}
command.setException(exception);
}
}

View File

@ -34,7 +34,7 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* Test the {@link GroupClient} by observing its side effects.
* Test the {@link AdminNetworkClient} by observing its side effects.
*
* @author danikov
*/

View File

@ -30,7 +30,7 @@ import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExp
import org.testng.annotations.Test;
/**
* Allows us to test a client via its side effects.
* Test the {@link AdminVdcClient} by observing its side effects.
*
* @author danikov
*/

View File

@ -19,11 +19,11 @@
package org.jclouds.vcloud.director.v1_5.features;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.fail;
import java.net.URI;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
@ -44,7 +44,7 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* Allows us to test a client via its side effects.
* Test the {@link MediaClient} via its side effects.
*
* @author danikov
*/
@ -154,7 +154,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
}
@Test
public void testResponse403ForCatalogIdUsedAsMediaId() {
public void testNullResponseForCatalogIdUsedAsMediaId() {
URI mediaUri = URI.create(endpoint + "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
@ -166,16 +166,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
.xmlFilePayload("/media/error403-catalog.xml", VCloudDirectorMediaType.ERROR)
.httpResponseBuilder().statusCode(403).build());
String message = "No access to entity \"(com.vmware.vcloud.entity.media:e9cd3387-ac57-4d27-a481-9bee75e0690f)\".";
try {
client.getMediaClient().getMedia(mediaUri);
fail("Should give HTTP 403 error");
} catch (ResourceNotFoundException rnfe) {
assertEquals(rnfe.getMessage(), message);
} catch (Exception e) {
fail("Should have thrown a ResourceNotFoundException");
}
assertNull(client.getMediaClient().getMedia(mediaUri));
}
@Test
@ -191,16 +182,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
.xmlFilePayload("/media/error403-fake.xml", VCloudDirectorMediaType.ERROR)
.httpResponseBuilder().statusCode(403).build());
String message = "No access to entity \"(com.vmware.vcloud.entity.media:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee)\".";
try {
client.getMediaClient().getMedia(mediaUri);
fail("Should give HTTP 403 error");
} catch (ResourceNotFoundException rnfe) {
assertEquals(rnfe.getMessage(), message);
} catch (Exception e) {
fail("Should have thrown a ResourceNotFoundException");
}
assertNull(client.getMediaClient().getMedia(mediaUri));
}
@Test

View File

@ -19,11 +19,11 @@
package org.jclouds.vcloud.director.v1_5.features;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.fail;
import java.net.URI;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
@ -48,7 +48,7 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* Allows us to test a client via its side effects.
* Test the {@link NetworkClient} via its side effects.
*
* @author danikov
*/
@ -114,16 +114,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
.xmlFilePayload("/network/error403-catalog.xml", VCloudDirectorMediaType.ERROR)
.httpResponseBuilder().statusCode(403).build());
String message = "This operation is denied.";
try {
client.getNetworkClient().getNetwork(networkUri);
fail("Should give HTTP 403 error");
} catch (ResourceNotFoundException rnfe) {
assertEquals(rnfe.getMessage(), message);
} catch (Exception e) {
fail("Should have thrown a ResourceNotFoundException");
}
assertNull(client.getNetworkClient().getNetwork(networkUri));
}
@Test
@ -139,16 +130,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
.xmlFilePayload("/network/error403-fake.xml", VCloudDirectorMediaType.ERROR)
.httpResponseBuilder().statusCode(403).build());
String message = "This operation is denied.";
try {
client.getNetworkClient().getNetwork(networkUri);
fail("Should give HTTP 403 error");
} catch (ResourceNotFoundException rnfe) {
assertEquals(rnfe.getMessage(), message);
} catch (Exception e) {
fail("Should have thrown a ResourceNotFoundException");
}
assertNull(client.getNetworkClient().getNetwork(networkUri));
}
@Test

View File

@ -19,11 +19,11 @@
package org.jclouds.vcloud.director.v1_5.features;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.fail;
import java.net.URI;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
@ -128,16 +128,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
getStandardRequest("GET", "/org/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"),
getStandardPayloadResponse(403, "/org/error403-catalog.xml", VCloudDirectorMediaType.ERROR));
String message = "No access to entity \"com.vmware.vcloud.entity.org:9e08c2f6-077a-42ce-bece-d5332e2ebb5c\".";
try {
client.getOrgClient().getOrg(orgUri);
fail("Should give HTTP 403 error");
} catch (ResourceNotFoundException rnfe) {
assertEquals(rnfe.getMessage(), message);
} catch (Exception e) {
fail("Should have thrown a ResourceNotFoundException");
}
assertNull(client.getOrgClient().getOrg(orgUri));
}
@Test
@ -148,16 +139,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
getStandardRequest("GET", "/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"),
getStandardPayloadResponse(403, "/org/error403-fake.xml", VCloudDirectorMediaType.ERROR));
String message = "No access to entity \"com.vmware.vcloud.entity.org:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\".";
try {
client.getOrgClient().getOrg(orgUri);
fail("Should give HTTP 403 error");
} catch (ResourceNotFoundException rnfe) {
assertEquals(rnfe.getMessage(), message);
} catch (Exception e) {
fail("Should have thrown a ResourceNotFoundException");
}
assertNull(client.getOrgClient().getOrg(orgUri));
}
@Test

View File

@ -19,13 +19,13 @@
package org.jclouds.vcloud.director.v1_5.features;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.fail;
import java.net.URI;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
@ -163,16 +163,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse);
String message = "No access to entity \"com.vmware.vcloud.entity.org:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\".";
try {
client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"));
fail("Should give HTTP 403 error");
} catch (ResourceNotFoundException rnfe) {
assertEquals(rnfe.getMessage(), message);
} catch (Exception e) {
fail("Should have thrown a ResourceNotFoundException");
}
assertNull(client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")));
}
@Test

View File

@ -23,8 +23,8 @@ import static org.testng.Assert.assertEquals;
import java.net.URI;
import java.util.Collections;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
@ -33,11 +33,11 @@ import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExp
import org.testng.annotations.Test;
/**
* Test the {@link GroupClient} by observing its side effects.
* Test the {@link UserClient} by observing its side effects.
*
* @author danikov
*/
@Test(groups = { "unit", "admin", "adminUser"}, singleThreaded = true, testName = "UserClientExpectTest")
@Test(groups = { "unit", "admin", "adminUser" }, singleThreaded = true, testName = "UserClientExpectTest")
public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
private Reference orgRef = Reference.builder()
@ -199,7 +199,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
client.getUserClient().unlockUser(userRef.getHref());
}
@Test(expectedExceptions = VCloudDirectorException.class)
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testUnlockUserFailNotFound() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()

View File

@ -31,6 +31,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP_TEMPLATE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import java.net.URI;
import java.text.ParseException;
@ -275,7 +276,6 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
assertNotNull(task);
}
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testErrorGetCustomizationSection() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
@ -284,7 +284,7 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/customizationSection").acceptMedia(CUSTOMIZATION_SECTION).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
client.getVAppTemplateCustomizationSection(uri);
assertNull(client.getVAppTemplateCustomizationSection(uri));
}
@Test(expectedExceptions = ResourceNotFoundException.class)
@ -363,7 +363,6 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
assertNotNull(task);
}
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testErrorGetLeaseSettingsSection() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
@ -372,7 +371,7 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/leaseSettingsSection").acceptMedia(LEASE_SETTINGS_SECTION).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
client.getVappTemplateLeaseSettingsSection(uri);
assertNull(client.getVappTemplateLeaseSettingsSection(uri));
}
@Test(expectedExceptions = ResourceNotFoundException.class)
@ -456,7 +455,6 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
assertNotNull(task);
}
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testErrorGetMetadataValue() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
@ -465,7 +463,7 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata/12345").acceptMedia(METADATA_ENTRY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
client.getMetadataClient().getMetadataValue(uri, "12345");
assertNull(client.getMetadataClient().getMetadataValue(uri, "12345"));
}
@Test(expectedExceptions = VCloudDirectorException.class)

View File

@ -19,11 +19,11 @@
package org.jclouds.vcloud.director.v1_5.features;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.fail;
import java.net.URI;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
@ -120,16 +120,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.xmlFilePayload("/vdc/error403-fake.xml", VCloudDirectorMediaType.ERROR)
.httpResponseBuilder().statusCode(403).build());
String message = "No access to entity \"com.vmware.vcloud.entity.vdc:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\".";
try {
client.getVdcClient().getVdc(URI.create(endpoint + "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"));
fail("Should give HTTP 403 error");
} catch (ResourceNotFoundException rnfe) {
assertEquals(rnfe.getMessage(), message);
} catch (Exception e) {
fail("Should have thrown a ResourceNotFoundException");
}
assertNull(client.getVdcClient().getVdc(URI.create(endpoint + "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")));
}
@Test(enabled = false)