removed need to support multiple @EndpointParam annotations

This commit is contained in:
Adrian Cole 2013-01-04 11:31:06 -08:00
parent 9c64e723d6
commit a17e8e25d7
23 changed files with 213 additions and 187 deletions

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.functions;
package org.jclouds.vcloud.binders;
import static com.google.common.base.Preconditions.checkNotNull;
@ -27,11 +27,12 @@ import java.util.NoSuchElementException;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.vcloud.domain.Org;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.endpoints.Catalog;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
@ -40,7 +41,7 @@ import com.google.common.collect.Iterables;
* @author Adrian Cole
*/
@Singleton
public class OrgNameAndCatalogNameToEndpoint implements Function<Object, URI> {
public class OrgNameAndCatalogNameToEndpoint implements MapBinder {
private final Supplier<Map<String, Org>> orgMap;
private final Supplier<ReferenceType> defaultOrg;
private final Supplier<ReferenceType> defaultCatalog;
@ -55,21 +56,26 @@ public class OrgNameAndCatalogNameToEndpoint implements Function<Object, URI> {
}
@SuppressWarnings("unchecked")
public URI apply(Object from) {
Iterable<Object> orgCatalog = (Iterable<Object>) checkNotNull(from, "args");
Object org = Iterables.get(orgCatalog, 0);
Object catalog = Iterables.get(orgCatalog, 1);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Object org = postParams.get("orgName");
Object catalog = postParams.get("catalogName");
if (org == null && catalog == null)
return defaultCatalog.get().getHref();
return (R) request.toBuilder().endpoint(defaultCatalog.get().getHref()).build();
else if (org == null)
org = defaultOrg.get().getName();
try {
Map<String, ReferenceType> catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs();
return catalog == null ? Iterables.getLast(catalogs.values()).getHref() : catalogs.get(catalog).getHref();
URI endpoint = catalog == null ? Iterables.getLast(catalogs.values()).getHref() : catalogs.get(catalog).getHref();
return (R) request.toBuilder().endpoint(endpoint).build();
} catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + catalog + " not found in " + orgMap.get());
}
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException(getClass() + " needs parameters");
}
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.functions;
package org.jclouds.vcloud.binders;
import static com.google.common.base.Preconditions.checkNotNull;
@ -27,11 +27,12 @@ import java.util.NoSuchElementException;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.vcloud.domain.Org;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.endpoints.VDC;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
@ -40,7 +41,7 @@ import com.google.common.collect.Iterables;
* @author Adrian Cole
*/
@Singleton
public class OrgNameAndVDCNameToEndpoint implements Function<Object, URI> {
public class OrgNameAndVDCNameToEndpoint implements MapBinder {
private final Supplier<Map<String, Org>> orgNameToVDCEndpoint;
private final Supplier<ReferenceType> defaultOrg;
private final Supplier<ReferenceType> defaultVDC;
@ -54,21 +55,26 @@ public class OrgNameAndVDCNameToEndpoint implements Function<Object, URI> {
}
@SuppressWarnings("unchecked")
public URI apply(Object from) {
Iterable<Object> orgVdc = (Iterable<Object>) checkNotNull(from, "args");
Object org = Iterables.get(orgVdc, 0);
Object vdc = Iterables.get(orgVdc, 1);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Object org = postParams.get("orgName");
Object vdc = postParams.get("vdcName");
if (org == null && vdc == null)
return defaultVDC.get().getHref();
return (R) request.toBuilder().endpoint(defaultVDC.get().getHref()).build();
else if (org == null)
org = defaultOrg.get().getName();
try {
Map<String, ReferenceType> vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs();
return vdc == null ? Iterables.getLast(vdcs.values()).getHref() : vdcs.get(vdc).getHref();
URI endpoint = vdc == null ? Iterables.getLast(vdcs.values()).getHref() : vdcs.get(vdc).getHref();
return (R) request.toBuilder().endpoint(endpoint).build();
} catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + vdc + " not found in " + orgNameToVDCEndpoint.get());
}
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException(getClass() + " needs parameters");
}
}

View File

@ -16,31 +16,30 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.functions;
package org.jclouds.vcloud.binders;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Map;
import java.util.NoSuchElementException;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.endpoints.Catalog;
import org.jclouds.vcloud.endpoints.Org;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
/**
*
* @author Adrian Cole
*/
@Singleton
public class OrgNameCatalogNameItemNameToEndpoint implements Function<Object, URI> {
public class OrgNameCatalogNameItemNameToEndpoint implements MapBinder {
private final Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>> orgCatalogMap;
private final Supplier<ReferenceType> defaultOrg;
private final Supplier<ReferenceType> defaultCatalog;
@ -55,22 +54,26 @@ public class OrgNameCatalogNameItemNameToEndpoint implements Function<Object, UR
}
@SuppressWarnings("unchecked")
public URI apply(Object from) {
Iterable<Object> orgCatalog = (Iterable<Object>) checkNotNull(from, "args");
Object org = Iterables.get(orgCatalog, 0);
Object catalog = Iterables.get(orgCatalog, 1);
Object catalogItem = Iterables.get(orgCatalog, 2);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Object org = postParams.get("orgName");
Object catalog = postParams.get("catalogName");
Object catalogItem = postParams.get("itemName");
if (org == null)
org = defaultOrg.get().getName();
if (catalog == null)
catalog = defaultCatalog.get().getName();
try {
Map<String, org.jclouds.vcloud.domain.Catalog> catalogs = checkNotNull(orgCatalogMap.get().get(org));
return catalogs.get(catalog).get(catalogItem).getHref();
return (R) request.toBuilder().endpoint(catalogs.get(catalog).get(catalogItem).getHref()).build();
} catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in "
+ orgCatalogMap.get());
}
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException(getClass() + " needs parameters");
}
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.functions;
package org.jclouds.vcloud.binders;
import static com.google.common.base.Preconditions.checkNotNull;
@ -27,21 +27,21 @@ import java.util.NoSuchElementException;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.endpoints.Catalog;
import org.jclouds.vcloud.endpoints.Org;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
/**
*
* @author Adrian Cole
*/
@Singleton
public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Object, URI> {
public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements MapBinder {
private final Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> orgCatalogItemMap;
private final Supplier<ReferenceType> defaultOrg;
private final Supplier<ReferenceType> defaultCatalog;
@ -56,11 +56,11 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
}
@SuppressWarnings("unchecked")
public URI apply(Object from) {
Iterable<Object> orgCatalog = (Iterable<Object>) checkNotNull(from, "args");
Object org = Iterables.get(orgCatalog, 0);
Object catalog = Iterables.get(orgCatalog, 1);
Object catalogItem = Iterables.get(orgCatalog, 2);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Object org = postParams.get("orgName");
Object catalog = postParams.get("catalogName");
Object catalogItem = postParams.get("itemName");
if (org == null)
org = defaultOrg.get().getName();
if (catalog == null)
@ -80,8 +80,13 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
+ catalogMap.keySet());
CatalogItem item = catalogMap.get(catalogItem);
return checkNotNull(item.getEntity(), "item: " + org + "/" + catalog + "/" + catalogItem + " has no entity")
.getHref();
URI endpoint = checkNotNull(item.getEntity(),
"item: " + org + "/" + catalog + "/" + catalogItem + " has no entity").getHref();
return (R) request.toBuilder().endpoint(endpoint).build();
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException(getClass() + " needs parameters");
}
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.functions;
package org.jclouds.vcloud.binders;
import java.net.URI;
import java.util.Map;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.functions;
package org.jclouds.vcloud.binders;
import java.net.URI;
import java.util.Map;

View File

@ -16,9 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.functions;
package org.jclouds.vcloud.binders;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import java.net.URI;
@ -27,18 +26,18 @@ import java.util.NoSuchElementException;
import javax.inject.Inject;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.endpoints.Org;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
/**
*
* @author Adrian Cole
*/
public abstract class OrgNameVDCNameResourceNameToEndpoint implements Function<Object, URI>{
public abstract class OrgNameVDCNameResourceNameToEndpoint implements MapBinder {
protected final Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap;
protected final Supplier<ReferenceType> defaultOrg;
@ -54,11 +53,11 @@ public abstract class OrgNameVDCNameResourceNameToEndpoint implements Function<
}
@SuppressWarnings("unchecked")
public URI apply(Object from) {
Iterable<Object> orgVDC = (Iterable<Object>) checkNotNull(from, "args");
Object org = Iterables.get(orgVDC, 0);
Object vDC = Iterables.get(orgVDC, 1);
Object resource = Iterables.get(orgVDC, 2);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Object org = postParams.get("orgName");
Object vDC = postParams.get("vdcName");
Object resource = postParams.get("resourceName");
if (org == null)
org = defaultOrg.get().getName();
if (vDC == null)
@ -71,9 +70,14 @@ public abstract class OrgNameVDCNameResourceNameToEndpoint implements Function<
org.jclouds.vcloud.domain.VDC vDCObject = vDCs.get(vDC);
if (vDCObject == null)
throw new NoSuchElementException("vdc " + vDC + " in org " + org + " not found in " + vDCs.keySet());
return getEndpointOfResourceInVDC(org, vDC, resource, vDCObject);
URI endpoint = getEndpointOfResourceInVDC(org, vDC, resource, vDCObject);
return (R) request.toBuilder().endpoint(endpoint).build();
}
protected abstract URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource, VDC vDCObject);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException(getClass() + " needs parameters");
}
}

View File

@ -40,11 +40,11 @@ import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.vcloud.binders.BindCatalogItemToXmlPayload;
import org.jclouds.vcloud.binders.OrgNameAndCatalogNameToEndpoint;
import org.jclouds.vcloud.binders.OrgNameCatalogNameItemNameToEndpoint;
import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.functions.OrgNameAndCatalogNameToEndpoint;
import org.jclouds.vcloud.functions.OrgNameCatalogNameItemNameToEndpoint;
import org.jclouds.vcloud.options.CatalogItemOptions;
import org.jclouds.vcloud.xml.CatalogHandler;
import org.jclouds.vcloud.xml.CatalogItemHandler;
@ -76,9 +76,9 @@ public interface CatalogAsyncClient {
@XMLResponseParser(CatalogHandler.class)
@Fallback(NullOnNotFoundOr404.class)
@Consumes(CATALOG_XML)
ListenableFuture<Catalog> findCatalogInOrgNamed(
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String catalogName);
@MapBinder(OrgNameAndCatalogNameToEndpoint.class)
ListenableFuture<Catalog> findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("catalogName") String catalogName);
/**
* @see CatalogClient#getCatalogItem
@ -96,10 +96,9 @@ public interface CatalogAsyncClient {
@Consumes(CATALOGITEM_XML)
@XMLResponseParser(CatalogItemHandler.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<CatalogItem> findCatalogItemInOrgCatalogNamed(
@Nullable @EndpointParam(parser = OrgNameCatalogNameItemNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameCatalogNameItemNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameCatalogNameItemNameToEndpoint.class) String itemName);
@MapBinder(OrgNameCatalogNameItemNameToEndpoint.class)
ListenableFuture<CatalogItem> findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName);
/**
* @see CatalogClient#addVAppTemplateOrMediaImageToCatalog

View File

@ -29,11 +29,13 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.vcloud.binders.OrgNameVDCNameNetworkNameToEndpoint;
import org.jclouds.vcloud.domain.network.OrgNetwork;
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
import org.jclouds.vcloud.xml.OrgNetworkHandler;
import com.google.common.util.concurrent.ListenableFuture;
@ -54,10 +56,9 @@ public interface NetworkAsyncClient {
@Consumes(NETWORK_XML)
@XMLResponseParser(OrgNetworkHandler.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OrgNetwork> findNetworkInOrgVDCNamed(
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String networkName);
@MapBinder(OrgNameVDCNameNetworkNameToEndpoint.class)
ListenableFuture<OrgNetwork> findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName);
/**
* @see NetworkClient#getNetwork

View File

@ -47,10 +47,10 @@ import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
import org.jclouds.vcloud.binders.OrgNameVDCNameResourceEntityNameToEndpoint;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
import org.jclouds.vcloud.options.CloneVAppOptions;
import org.jclouds.vcloud.xml.TaskHandler;
import org.jclouds.vcloud.xml.VAppHandler;
@ -100,10 +100,9 @@ public interface VAppAsyncClient {
@Consumes(VAPP_XML)
@XMLResponseParser(VAppHandler.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VApp> findVAppInOrgVDCNamed(
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String vAppName);
@MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
ListenableFuture<VApp> findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName);
/**
* @see VAppClient#getVApp

View File

@ -49,11 +49,11 @@ import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.vcloud.binders.BindCaptureVAppParamsToXmlPayload;
import org.jclouds.vcloud.binders.BindCloneVAppTemplateParamsToXmlPayload;
import org.jclouds.vcloud.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
import org.jclouds.vcloud.binders.OrgNameCatalogNameVAppTemplateNameToEndpoint;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VAppTemplate;
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint;
import org.jclouds.vcloud.options.CaptureVAppOptions;
import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
@ -142,10 +142,9 @@ public interface VAppTemplateAsyncClient {
@Consumes(VAPPTEMPLATE_XML)
@XMLResponseParser(VAppTemplateHandler.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VAppTemplate> findVAppTemplateInOrgCatalogNamed(
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
@MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class)
ListenableFuture<VAppTemplate> findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName);
/**
* @see VAppTemplateClient#getVAppTemplate

View File

@ -29,11 +29,13 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.vcloud.binders.OrgNameAndVDCNameToEndpoint;
import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
import org.jclouds.vcloud.functions.OrgNameAndVDCNameToEndpoint;
import org.jclouds.vcloud.xml.VDCHandler;
import com.google.common.util.concurrent.ListenableFuture;
@ -63,7 +65,7 @@ public interface VDCAsyncClient {
@XMLResponseParser(VDCHandler.class)
@Consumes(VDC_XML)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VDC> findVDCInOrgNamed(
@Nullable @EndpointParam(parser = OrgNameAndVDCNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameAndVDCNameToEndpoint.class) String vdcName);
@MapBinder(OrgNameAndVDCNameToEndpoint.class)
ListenableFuture<VDC> findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("vdcName") String vdcName);
}

View File

@ -60,7 +60,7 @@ public class NetworkAsyncClientTest extends BaseVCloudAsyncClientTest<NetworkAsy
String.class);
HttpRequest request = processor.createRequest(method, "org", "vdc", "network");
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2 HTTP/1.1");
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/network/1990 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
assertPayloadEquals(request, null, null, false);

View File

@ -69,7 +69,7 @@ public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest<VDCAsyncClient
public void testFindVDCInOrgNamedNullOrgAndVDC() throws SecurityException, NoSuchMethodException, IOException {
Method method = VDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
HttpRequest request = processor.createRequest(method, null, null);
HttpRequest request = processor.createRequest(method, new Object[] { null, null });
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");

View File

@ -64,6 +64,11 @@ import org.jclouds.trmk.vcloud_0_8.binders.BindCloneVAppParamsToXmlPayload;
import org.jclouds.trmk.vcloud_0_8.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
import org.jclouds.trmk.vcloud_0_8.binders.BindNodeConfigurationToXmlPayload;
import org.jclouds.trmk.vcloud_0_8.binders.BindVAppConfigurationToXmlPayload;
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndCatalogNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndVDCNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameCatalogNameItemNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameCatalogNameVAppTemplateNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameVDCNameResourceEntityNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.domain.Catalog;
import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
import org.jclouds.trmk.vcloud_0_8.domain.CustomizationParameters;
@ -81,14 +86,8 @@ import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
import org.jclouds.trmk.vcloud_0_8.domain.VDC;
import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameAndCatalogNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameAndTasksListNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameAndVDCNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameCatalogNameItemNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameVDCNameNetworkNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.ParseTaskFromLocationHeader;
import org.jclouds.trmk.vcloud_0_8.functions.VDCURIToInternetServicesEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.VDCURIToPublicIPsEndpoint;
@ -134,10 +133,9 @@ public interface TerremarkVCloudAsyncClient {
@Consumes(CATALOGITEM_XML)
@XMLResponseParser(CatalogItemHandler.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends CatalogItem> findCatalogItemInOrgCatalogNamed(
@Nullable @EndpointParam(parser = OrgNameCatalogNameItemNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameCatalogNameItemNameToEndpoint.class) String catalogName,
@Nullable @EndpointParam(parser = OrgNameCatalogNameItemNameToEndpoint.class) String itemName);
@MapBinder(OrgNameCatalogNameItemNameToEndpoint.class)
ListenableFuture<? extends CatalogItem> findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName);
/**
* @see TerremarkVCloudClient#getCatalogItem
@ -199,9 +197,9 @@ public interface TerremarkVCloudAsyncClient {
@XMLResponseParser(CatalogHandler.class)
@Fallback(NullOnNotFoundOr404.class)
@Consumes(CATALOG_XML)
ListenableFuture<? extends Catalog> findCatalogInOrgNamed(
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String catalogName);
@MapBinder(OrgNameAndCatalogNameToEndpoint.class)
ListenableFuture<? extends Catalog> findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("catalogName") String catalogName);
/**
* @see VCloudClient#getVAppTemplate
@ -219,10 +217,9 @@ public interface TerremarkVCloudAsyncClient {
@Consumes(VAPPTEMPLATE_XML)
@XMLResponseParser(VAppTemplateHandler.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends VAppTemplate> findVAppTemplateInOrgCatalogNamed(
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
@MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class)
ListenableFuture<? extends VAppTemplate> findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName);
/**
* @see VCloudClient#findNetworkInOrgVDCNamed
@ -231,10 +228,9 @@ public interface TerremarkVCloudAsyncClient {
@Consumes(NETWORK_XML)
@XMLResponseParser(NetworkHandler.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Network> findNetworkInOrgVDCNamed(
@Nullable @EndpointParam(parser = OrgNameVDCNameNetworkNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameVDCNameNetworkNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameVDCNameNetworkNameToEndpoint.class) String networkName);
@MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
ListenableFuture<? extends Network> findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName);
/**
* @see VCloudClient#getNetwork
@ -264,10 +260,9 @@ public interface TerremarkVCloudAsyncClient {
@Consumes(VAPP_XML)
@XMLResponseParser(VAppHandler.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends VApp> findVAppInOrgVDCNamed(
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String vAppName);
@MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
ListenableFuture<? extends VApp> findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName);
/**
* @see VCloudClient#getVApp
@ -388,9 +383,9 @@ public interface TerremarkVCloudAsyncClient {
@XMLResponseParser(VDCHandler.class)
@Consumes(VDC_XML)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends VDC> findVDCInOrgNamed(
@Nullable @EndpointParam(parser = OrgNameAndVDCNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameAndVDCNameToEndpoint.class) String vdcName);
@MapBinder(OrgNameAndVDCNameToEndpoint.class)
ListenableFuture<? extends VDC> findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("vdcName") String vdcName);
/**
* @see TerremarkVCloudClient#instantiateVAppTemplateInVDC

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.trmk.vcloud_0_8.functions;
package org.jclouds.trmk.vcloud_0_8.binders;
import static com.google.common.base.Preconditions.checkNotNull;
@ -27,11 +27,12 @@ import java.util.NoSuchElementException;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.trmk.vcloud_0_8.domain.Org;
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
import org.jclouds.trmk.vcloud_0_8.endpoints.Catalog;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
@ -40,7 +41,7 @@ import com.google.common.collect.Iterables;
* @author Adrian Cole
*/
@Singleton
public class OrgNameAndCatalogNameToEndpoint implements Function<Object, URI> {
public class OrgNameAndCatalogNameToEndpoint implements MapBinder {
private final Supplier<Map<String, ? extends Org>> orgMap;
private final Supplier<ReferenceType> defaultOrg;
private final Supplier<ReferenceType> defaultCatalog;
@ -54,21 +55,26 @@ public class OrgNameAndCatalogNameToEndpoint implements Function<Object, URI> {
}
@SuppressWarnings("unchecked")
public URI apply(Object from) {
Iterable<Object> orgCatalog = (Iterable<Object>) checkNotNull(from, "args");
Object org = Iterables.get(orgCatalog, 0);
Object catalog = Iterables.get(orgCatalog, 1);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Object org = postParams.get("orgName");
Object catalog = postParams.get("catalogName");
if (org == null && catalog == null)
return defaultCatalog.get().getHref();
return (R) request.toBuilder().endpoint(defaultCatalog.get().getHref()).build();
else if (org == null)
org = defaultOrg.get().getName();
try {
Map<String, ReferenceType> catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs();
return catalog == null ? Iterables.getLast(catalogs.values()).getHref() : catalogs.get(catalog).getHref();
URI endpoint = catalog == null ? Iterables.getLast(catalogs.values()).getHref() : catalogs.get(catalog).getHref();
return (R) request.toBuilder().endpoint(endpoint).build();
} catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + catalog + " not found in " + orgMap.get());
}
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException(getClass() + " needs parameters");
}
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.trmk.vcloud_0_8.functions;
package org.jclouds.trmk.vcloud_0_8.binders;
import static com.google.common.base.Preconditions.checkNotNull;
@ -27,11 +27,12 @@ import java.util.NoSuchElementException;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.trmk.vcloud_0_8.domain.Org;
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
import org.jclouds.trmk.vcloud_0_8.endpoints.VDC;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
@ -40,7 +41,7 @@ import com.google.common.collect.Iterables;
* @author Adrian Cole
*/
@Singleton
public class OrgNameAndVDCNameToEndpoint implements Function<Object, URI> {
public class OrgNameAndVDCNameToEndpoint implements MapBinder {
private final Supplier<Map<String, ? extends Org>> orgNameToVDCEndpoint;
private final Supplier<ReferenceType> defaultOrg;
private final Supplier<ReferenceType> defaultVDC;
@ -54,21 +55,26 @@ public class OrgNameAndVDCNameToEndpoint implements Function<Object, URI> {
}
@SuppressWarnings("unchecked")
public URI apply(Object from) {
Iterable<Object> orgVdc = (Iterable<Object>) checkNotNull(from, "args");
Object org = Iterables.get(orgVdc, 0);
Object vdc = Iterables.get(orgVdc, 1);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Object org = postParams.get("orgName");
Object vdc = postParams.get("vdcName");
if (org == null && vdc == null)
return defaultVDC.get().getHref();
return (R) request.toBuilder().endpoint(defaultVDC.get().getHref()).build();
else if (org == null)
org = defaultOrg.get().getName();
try {
Map<String, ReferenceType> vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs();
return vdc == null ? Iterables.getLast(vdcs.values()).getHref() : vdcs.get(vdc).getHref();
URI endpoint = vdc == null ? Iterables.getLast(vdcs.values()).getHref() : vdcs.get(vdc).getHref();
return (R) request.toBuilder().endpoint(endpoint).build();
} catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + vdc + " not found in " + orgNameToVDCEndpoint.get());
}
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException(getClass() + " needs parameters");
}
}

View File

@ -16,31 +16,30 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.trmk.vcloud_0_8.functions;
package org.jclouds.trmk.vcloud_0_8.binders;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Map;
import java.util.NoSuchElementException;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
import org.jclouds.trmk.vcloud_0_8.endpoints.Catalog;
import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
/**
*
* @author Adrian Cole
*/
@Singleton
public class OrgNameCatalogNameItemNameToEndpoint implements Function<Object, URI> {
public class OrgNameCatalogNameItemNameToEndpoint implements MapBinder {
private final Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Catalog>>> orgCatalogMap;
private final Supplier<ReferenceType> defaultOrg;
private final Supplier<ReferenceType> defaultCatalog;
@ -55,22 +54,26 @@ public class OrgNameCatalogNameItemNameToEndpoint implements Function<Object, UR
}
@SuppressWarnings("unchecked")
public URI apply(Object from) {
Iterable<Object> orgCatalog = (Iterable<Object>) checkNotNull(from, "args");
Object org = Iterables.get(orgCatalog, 0);
Object catalog = Iterables.get(orgCatalog, 1);
Object catalogItem = Iterables.get(orgCatalog, 2);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Object org = postParams.get("orgName");
Object catalog = postParams.get("catalogName");
Object catalogItem = postParams.get("itemName");
if (org == null)
org = defaultOrg.get().getName();
if (catalog == null)
catalog = defaultCatalog.get().getName();
try {
Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Catalog> catalogs = checkNotNull(orgCatalogMap.get().get(org));
return catalogs.get(catalog).get(catalogItem).getHref();
return (R) request.toBuilder().endpoint(catalogs.get(catalog).get(catalogItem).getHref()).build();
} catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in "
+ orgCatalogMap.get());
}
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException(getClass() + " needs parameters");
}
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.trmk.vcloud_0_8.functions;
package org.jclouds.trmk.vcloud_0_8.binders;
import static com.google.common.base.Preconditions.checkNotNull;
@ -27,21 +27,21 @@ import java.util.NoSuchElementException;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
import org.jclouds.trmk.vcloud_0_8.endpoints.Catalog;
import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
/**
*
* @author Adrian Cole
*/
@Singleton
public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Object, URI> {
public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements MapBinder {
private final Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.CatalogItem>>>> orgCatalogItemMap;
private final Supplier<ReferenceType> defaultOrg;
private final Supplier<ReferenceType> defaultCatalog;
@ -56,11 +56,11 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
}
@SuppressWarnings("unchecked")
public URI apply(Object from) {
Iterable<Object> orgCatalog = (Iterable<Object>) checkNotNull(from, "args");
Object org = Iterables.get(orgCatalog, 0);
Object catalog = Iterables.get(orgCatalog, 1);
Object catalogItem = Iterables.get(orgCatalog, 2);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Object org = postParams.get("orgName");
Object catalog = postParams.get("catalogName");
Object catalogItem = postParams.get("itemName");
if (org == null)
org = defaultOrg.get().getName();
if (catalog == null)
@ -80,8 +80,13 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
+ catalogMap.keySet());
CatalogItem item = catalogMap.get(catalogItem);
return checkNotNull(item.getEntity(), "item: " + org + "/" + catalog + "/" + catalogItem + " has no entity")
.getHref();
URI endpoint = checkNotNull(item.getEntity(),
"item: " + org + "/" + catalog + "/" + catalogItem + " has no entity").getHref();
return (R) request.toBuilder().endpoint(endpoint).build();
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException(getClass() + " needs parameters");
}
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.trmk.vcloud_0_8.functions;
package org.jclouds.trmk.vcloud_0_8.binders;
import java.net.URI;
import java.util.Map;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.trmk.vcloud_0_8.functions;
package org.jclouds.trmk.vcloud_0_8.binders;
import java.net.URI;
import java.util.Map;

View File

@ -16,9 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.trmk.vcloud_0_8.functions;
package org.jclouds.trmk.vcloud_0_8.binders;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import java.net.URI;
@ -27,18 +26,18 @@ import java.util.NoSuchElementException;
import javax.inject.Inject;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
import org.jclouds.trmk.vcloud_0_8.domain.VDC;
import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
/**
*
* @author Adrian Cole
*/
public abstract class OrgNameVDCNameResourceNameToEndpoint implements Function<Object, URI>{
public abstract class OrgNameVDCNameResourceNameToEndpoint implements MapBinder {
protected final Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>>> orgVDCMap;
protected final Supplier<ReferenceType> defaultOrg;
@ -54,11 +53,11 @@ public abstract class OrgNameVDCNameResourceNameToEndpoint implements Function<
}
@SuppressWarnings("unchecked")
public URI apply(Object from) {
Iterable<Object> orgVDC = (Iterable<Object>) checkNotNull(from, "args");
Object org = Iterables.get(orgVDC, 0);
Object vDC = Iterables.get(orgVDC, 1);
Object resource = Iterables.get(orgVDC, 2);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Object org = postParams.get("orgName");
Object vDC = postParams.get("vdcName");
Object resource = postParams.get("resourceName");
if (org == null)
org = defaultOrg.get().getName();
if (vDC == null)
@ -71,9 +70,14 @@ public abstract class OrgNameVDCNameResourceNameToEndpoint implements Function<
org.jclouds.trmk.vcloud_0_8.domain.VDC vDCObject = vDCs.get(vDC);
if (vDCObject == null)
throw new NoSuchElementException("vdc " + vDC + " in org " + org + " not found in " + vDCs.keySet());
return getEndpointOfResourceInVDC(org, vDC, resource, vDCObject);
URI endpoint = getEndpointOfResourceInVDC(org, vDC, resource, vDCObject);
return (R) request.toBuilder().endpoint(endpoint).build();
}
protected abstract URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource, VDC vDCObject);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
throw new IllegalStateException(getClass() + " needs parameters");
}
}

View File

@ -55,6 +55,7 @@ import org.jclouds.trmk.ecloud.features.TagOperationsAsyncClient;
import org.jclouds.trmk.ecloud.xml.ECloudOrgHandler;
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient;
import org.jclouds.trmk.vcloud_0_8.binders.BindCreateKeyToXmlPayload;
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameVDCNameNetworkNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
import org.jclouds.trmk.vcloud_0_8.domain.IpAddress;
import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
@ -65,8 +66,6 @@ import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress;
import org.jclouds.trmk.vcloud_0_8.domain.VAppExtendedInfo;
import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameVDCNameNetworkNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.OrgURIToKeysListEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.VDCURIToInternetServicesEndpoint;
import org.jclouds.trmk.vcloud_0_8.functions.VDCURIToPublicIPsEndpoint;
@ -230,21 +229,6 @@ public interface TerremarkECloudAsyncClient extends TerremarkVCloudAsyncClient {
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends KeyPair> getKeyPair(@EndpointParam URI keyId);
// TODO
// /**
// * @see TerremarkVCloudClient#configureKeyPair
// */
// @PUT
// @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
// @Path("/extensions/key/{keyId}")
// @Produces(APPLICATION_XML)
// @Consumes(APPLICATION_XML)
// @XMLResponseParser(KeyPairHandler.class)
// ListenableFuture<? extends KeyPair> configureKeyPair(
// @PathParam("keyId") int keyId,
// @BinderParam(BindKeyPairConfigurationToXmlPayload.class)
// KeyPairConfiguration keyConfiguration);
/**
* @see TerremarkECloudClient#deleteKeyPair
*/
@ -260,10 +244,9 @@ public interface TerremarkECloudAsyncClient extends TerremarkVCloudAsyncClient {
@Consumes(NETWORK_XML)
@XMLResponseParser(NetworkHandler.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<? extends Network> findNetworkInOrgVDCNamed(
@Nullable @EndpointParam(parser = OrgNameVDCNameNetworkNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameVDCNameNetworkNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String networkName);
@MapBinder(OrgNameVDCNameNetworkNameToEndpoint.class)
ListenableFuture<? extends Network> findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName);
/**
* @see TerremarkECloudClient#getNetwork