Issue 286: normalized names trmk-vcloudexpress -> TerremarkVCloudExpressClient; tmrk-ecloud -> TerremarkECloudClient

This commit is contained in:
Adrian Cole 2010-07-05 23:46:33 -07:00
parent ef00266b54
commit 88d64ee76c
38 changed files with 857 additions and 775 deletions

View File

@ -20,8 +20,8 @@
"A clojure binding to the jclouds ComputeService. "A clojure binding to the jclouds ComputeService.
Current supported services are: Current supported services are:
[ec2, rimuhosting, cloudservers, terremark, vcloud, bluelock, ibmdev, [ec2, rimuhosting, cloudservers, trmk-ecloud, trmk-vcloudexpress, vcloud, bluelock,
eucalyptus, hostingdotcom] ibmdev, eucalyptus, hostingdotcom]
Here's an example of getting some compute configuration from rackspace: Here's an example of getting some compute configuration from rackspace:

View File

@ -47,11 +47,11 @@ ec2.propertiesbuilder=org.jclouds.aws.ec2.EC2PropertiesBuilder
rimuhosting.contextbuilder=org.jclouds.rimuhosting.miro.RimuHostingContextBuilder rimuhosting.contextbuilder=org.jclouds.rimuhosting.miro.RimuHostingContextBuilder
rimuhosting.propertiesbuilder=org.jclouds.rimuhosting.miro.RimuHostingPropertiesBuilder rimuhosting.propertiesbuilder=org.jclouds.rimuhosting.miro.RimuHostingPropertiesBuilder
terremark.contextbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudContextBuilder trmk-vcloudexpress.contextbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudExpressContextBuilder
terremark.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudPropertiesBuilder trmk-vcloudexpress.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkVCloudExpressPropertiesBuilder
ecloud.contextbuilder=org.jclouds.vcloud.terremark.TerremarkECloudContextBuilder trmk-ecloud.contextbuilder=org.jclouds.vcloud.terremark.TerremarkECloudContextBuilder
ecloud.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkECloudPropertiesBuilder trmk-ecloud.propertiesbuilder=org.jclouds.vcloud.terremark.TerremarkECloudPropertiesBuilder
hostingdotcom.contextbuilder=org.jclouds.vcloud.hostingdotcom.HostingDotComVCloudContextBuilder hostingdotcom.contextbuilder=org.jclouds.vcloud.hostingdotcom.HostingDotComVCloudContextBuilder
hostingdotcom.propertiesbuilder=org.jclouds.vcloud.hostingdotcom.HostingDotComVCloudPropertiesBuilder hostingdotcom.propertiesbuilder=org.jclouds.vcloud.hostingdotcom.HostingDotComVCloudPropertiesBuilder

View File

@ -1,4 +1,4 @@
service=terremark service=trmk-ecloud
driver=terremark driver=terremark
account=user@youregistered.com account=user@youregistered.com
key=password key=password

View File

@ -0,0 +1,5 @@
service=trmk-vcloudexpress
driver=terremark
account=user@youregistered.com
key=password
nodetag=name_of_your_vapp

View File

@ -25,7 +25,7 @@ import javax.ws.rs.core.MediaType;
* *
* @see MediaType * @see MediaType
*/ */
public class VCloudMediaType { public interface VCloudMediaType {
/** /**
* "application/vnd.vmware.vcloud.organizationList+xml" * "application/vnd.vmware.vcloud.organizationList+xml"
*/ */

View File

@ -1,363 +0,0 @@
/**
*
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.terremark;
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.CATALOGITEMCUSTOMIZATIONPARAMETERS_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.INTERNETSERVICESLIST_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.INTERNETSERVICE_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.NODESERVICE_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.PUBLICIPSLIST_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.PUBLICIP_XML;
import java.util.SortedSet;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.jclouds.predicates.validators.DnsNameValidator;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.MapPayloadParam;
import org.jclouds.rest.annotations.ParamParser;
import org.jclouds.rest.annotations.ParamValidators;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.vcloud.VCloudAsyncClient;
import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.endpoints.Org;
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
import org.jclouds.vcloud.functions.CatalogIdToUri;
import org.jclouds.vcloud.functions.VAppId;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import org.jclouds.vcloud.terremark.binders.BindNodeConfigurationToXmlPayload;
import org.jclouds.vcloud.terremark.binders.BindVAppConfigurationToXmlPayload;
import org.jclouds.vcloud.terremark.binders.TerremarkBindInstantiateVAppTemplateParamsToXmlPayload;
import org.jclouds.vcloud.terremark.domain.CustomizationParameters;
import org.jclouds.vcloud.terremark.domain.InternetService;
import org.jclouds.vcloud.terremark.domain.Node;
import org.jclouds.vcloud.terremark.domain.NodeConfiguration;
import org.jclouds.vcloud.terremark.domain.Protocol;
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
import org.jclouds.vcloud.terremark.domain.TerremarkOrganization;
import org.jclouds.vcloud.terremark.domain.VAppConfiguration;
import org.jclouds.vcloud.terremark.functions.ParseTaskFromLocationHeader;
import org.jclouds.vcloud.terremark.functions.ReturnEmptySetOnResourceNotFoundException;
import org.jclouds.vcloud.terremark.functions.ReturnVoidOnDeleteDefaultIp;
import org.jclouds.vcloud.terremark.options.AddInternetServiceOptions;
import org.jclouds.vcloud.terremark.options.AddNodeOptions;
import org.jclouds.vcloud.terremark.xml.CustomizationParametersHandler;
import org.jclouds.vcloud.terremark.xml.InternetServiceHandler;
import org.jclouds.vcloud.terremark.xml.InternetServicesHandler;
import org.jclouds.vcloud.terremark.xml.NodeHandler;
import org.jclouds.vcloud.terremark.xml.NodesHandler;
import org.jclouds.vcloud.terremark.xml.PublicIpAddressesHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkOrgHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler;
import org.jclouds.vcloud.xml.CatalogHandler;
import org.jclouds.vcloud.xml.VAppHandler;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides access to VCloud resources via their REST API.
* <p/>
*
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
* @author Adrian Cole
*/
@RequestFilters(SetVCloudTokenCookie.class)
public interface TerremarkAsyncClient extends VCloudAsyncClient {
@GET
@Endpoint(Org.class)
@Consumes(ORG_XML)
@XMLResponseParser(TerremarkOrgHandler.class)
ListenableFuture<? extends TerremarkOrganization> getDefaultOrganization();
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/org/{orgId}")
@XMLResponseParser(TerremarkOrgHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Consumes(ORG_XML)
ListenableFuture<? extends TerremarkOrganization> getOrganization(
@PathParam("orgId") String orgId);
/**
* @see TerremarkVCloudClient#getDefaultVDC
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VDC.class)
@XMLResponseParser(TerremarkVDCHandler.class)
@Consumes(VDC_XML)
ListenableFuture<? extends VDC> getDefaultVDC();
/**
* Terremark does not have multiple catalogs, so we ignore this parameter.
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.Catalog.class)
@XMLResponseParser(CatalogHandler.class)
@Consumes(CATALOG_XML)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends Catalog> getCatalog(String catalogId);
/**
* @see TerremarkVCloudClient#getVDC
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/vdc/{vDCId}")
@XMLResponseParser(TerremarkVDCHandler.class)
@Consumes(VDC_XML)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends VDC> getVDC(@PathParam("vDCId") String vDCId);
/**
* @see TerremarkVCloudClient#instantiateVAppTemplateInVDC
*/
@POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/vdc/{vDCId}/action/instantiateVAppTemplate")
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
@Consumes(VAPP_XML)
@XMLResponseParser(VAppHandler.class)
@MapBinder(TerremarkBindInstantiateVAppTemplateParamsToXmlPayload.class)
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@PathParam("vDCId") String vDCId,
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
@MapPayloadParam("template") @ParamParser(CatalogIdToUri.class) String templateId,
InstantiateVAppTemplateOptions... options);
/**
* @see TerremarkVCloudClient#addInternetService
*/
@POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/vdc/{vDCId}/internetServices")
@Produces(INTERNETSERVICE_XML)
@Consumes(INTERNETSERVICE_XML)
@XMLResponseParser(InternetServiceHandler.class)
@MapBinder(AddInternetServiceOptions.class)
ListenableFuture<? extends InternetService> addInternetServiceToVDC(
@PathParam("vDCId") String vDCId, @MapPayloadParam("name") String serviceName,
@MapPayloadParam("protocol") Protocol protocol, @MapPayloadParam("port") int port,
AddInternetServiceOptions... options);
/**
* @see TerremarkVCloudClient#getAllInternetServices
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/vdc/{vDCId}/internetServices")
@Consumes(INTERNETSERVICESLIST_XML)
@XMLResponseParser(InternetServicesHandler.class)
ListenableFuture<? extends SortedSet<InternetService>> getAllInternetServicesInVDC(
@PathParam("vDCId") String vDCId);
/**
* @see TerremarkVCloudClient#addInternetServiceToExistingIp
*/
@POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/publicIp/{ipId}/internetServices")
@Produces(INTERNETSERVICE_XML)
@Consumes(INTERNETSERVICE_XML)
@XMLResponseParser(InternetServiceHandler.class)
@MapBinder(AddInternetServiceOptions.class)
ListenableFuture<? extends InternetService> addInternetServiceToExistingIp(
@PathParam("ipId") int existingIpId, @MapPayloadParam("name") String serviceName,
@MapPayloadParam("protocol") Protocol protocol, @MapPayloadParam("port") int port,
AddInternetServiceOptions... options);
/**
* @see TerremarkVCloudClient#deletePublicIp
*/
@DELETE
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/publicIp/{ipId}")
@ExceptionParser(ReturnVoidOnDeleteDefaultIp.class)
ListenableFuture<Void> deletePublicIp(@PathParam("ipId") int ipId);
/**
* @see TerremarkVCloudClient#getInternetServicesOnPublicIP
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/publicIp/{ipId}/internetServices")
@Consumes(INTERNETSERVICESLIST_XML)
@XMLResponseParser(InternetServicesHandler.class)
ListenableFuture<? extends SortedSet<InternetService>> getInternetServicesOnPublicIp(
@PathParam("ipId") int ipId);
/**
* @see TerremarkVCloudClient#getPublicIp
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/publicIp/{ipId}")
@Consumes(PUBLICIP_XML)
@XMLResponseParser(InternetServicesHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends SortedSet<InternetService>> getPublicIp(@PathParam("ipId") int ipId);
/**
* @see TerremarkVCloudClient#getPublicIpsAssociatedWithVDC
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/vdc/{vDCId}/publicIps")
@Consumes(PUBLICIPSLIST_XML)
@XMLResponseParser(PublicIpAddressesHandler.class)
ListenableFuture<? extends SortedSet<PublicIpAddress>> getPublicIpsAssociatedWithVDC(
@PathParam("vDCId") String vDCId);
/**
* @see TerremarkVCloudClient#activatePublicIpInVDC
*/
@POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/{vDCId}/publicIps")
@XMLResponseParser(PublicIpAddressesHandler.class)
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<PublicIpAddress> activatePublicIpInVDC(@PathParam("vDCId") String vDCId);
/**
* @see TerremarkVCloudClient#deleteInternetService
*/
@DELETE
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/internetService/{internetServiceId}")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteInternetService(
@PathParam("internetServiceId") int internetServiceId);
/**
* @see TerremarkVCloudClient#getInternetService
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/internetService/{internetServiceId}")
@Consumes(INTERNETSERVICESLIST_XML)
@XMLResponseParser(InternetServiceHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends InternetService> getInternetService(
@PathParam("internetServiceId") int internetServiceId);
/**
* @see TerremarkVCloudClient#addNode
*/
@POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/internetService/{internetServiceId}/nodeServices")
@Produces(NODESERVICE_XML)
@Consumes(NODESERVICE_XML)
@XMLResponseParser(NodeHandler.class)
@MapBinder(AddNodeOptions.class)
ListenableFuture<? extends Node> addNode(@PathParam("internetServiceId") int internetServiceId,
@MapPayloadParam("ipAddress") String ipAddress, @MapPayloadParam("name") String name,
@MapPayloadParam("port") int port, AddNodeOptions... options);
/**
* @see TerremarkVCloudClient#getNodes
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/internetService/{internetServiceId}/nodeServices")
@XMLResponseParser(NodesHandler.class)
@ExceptionParser(ReturnEmptySetOnResourceNotFoundException.class)
@Consumes(NODESERVICE_XML)
ListenableFuture<? extends SortedSet<Node>> getNodes(
@PathParam("internetServiceId") int internetServiceId);
/**
* @see TerremarkVCloudClient#getNode
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/nodeService/{nodeId}")
@XMLResponseParser(NodeHandler.class)
@Consumes(NODESERVICE_XML)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends Node> getNode(@PathParam("nodeId") int nodeId);
/**
* @see TerremarkVCloudClient#configureNode
*/
@PUT
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/nodeService/{nodeId}")
@Produces(NODESERVICE_XML)
@Consumes(NODESERVICE_XML)
@XMLResponseParser(NodeHandler.class)
ListenableFuture<? extends Node> configureNode(
@PathParam("nodeId") int nodeId,
@BinderParam(BindNodeConfigurationToXmlPayload.class) NodeConfiguration nodeConfiguration);
/**
* @see TerremarkVCloudClient#deleteNode
*/
@DELETE
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/nodeService/{nodeId}")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteNode(@PathParam("nodeId") int nodeId);
/**
* @see TerremarkVCloudClient#configureVApp
*/
@PUT
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/vapp/{vAppId}")
@Produces(VAPP_XML)
@Consumes(VAPP_XML)
@MapBinder(BindVAppConfigurationToXmlPayload.class)
@ResponseParser(ParseTaskFromLocationHeader.class)
ListenableFuture<? extends Task> configureVApp(
@PathParam("vAppId") @ParamParser(VAppId.class) VApp vApp,
VAppConfiguration configuration);
/**
* @see TerremarkVCloudClient#getCustomizationOptionsOfCatalogItem
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/template/{catalogItemId}/options/customization")
@XMLResponseParser(CustomizationParametersHandler.class)
@Consumes(CATALOGITEMCUSTOMIZATIONPARAMETERS_XML)
ListenableFuture<? extends CustomizationParameters> getCustomizationOptionsOfCatalogItem(
@PathParam("catalogItemId") String catalogItemId);
}

View File

@ -1,146 +0,0 @@
/**
*
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.terremark;
import java.util.SortedSet;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.terremark.domain.CustomizationParameters;
import org.jclouds.vcloud.terremark.domain.InternetService;
import org.jclouds.vcloud.terremark.domain.Node;
import org.jclouds.vcloud.terremark.domain.NodeConfiguration;
import org.jclouds.vcloud.terremark.domain.Protocol;
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
import org.jclouds.vcloud.terremark.domain.TerremarkOrganization;
import org.jclouds.vcloud.terremark.domain.VAppConfiguration;
import org.jclouds.vcloud.terremark.options.AddInternetServiceOptions;
import org.jclouds.vcloud.terremark.options.AddNodeOptions;
/**
* Provides access to VCloud resources via their REST API.
* <p/>
*
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
* @author Adrian Cole
*/
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
public interface TerremarkClient extends VCloudClient {
TerremarkOrganization getDefaultOrganization();
TerremarkOrganization getOrganization(String orgId);
CustomizationParameters getCustomizationOptionsOfCatalogItem(String catalogItemId);
/**
* This call returns a list of public IP addresses.
*/
SortedSet<PublicIpAddress> getPublicIpsAssociatedWithVDC(String vDCId);
void deletePublicIp(int ipId);
/**
* Allocate a new public IP
*
* @param vDCId
* @return
*/
PublicIpAddress activatePublicIpInVDC(String vDCId);
/**
* The call creates a new internet server, including protocol and port information. The public IP
* is dynamically allocated.
*
*/
InternetService addInternetServiceToVDC(String vDCId, String serviceName, Protocol protocol,
int port, AddInternetServiceOptions... options);
/**
* This call adds an internet service to a known, existing public IP. This call is identical to
* Add Internet Service except you specify the public IP in the request.
*
*/
InternetService addInternetServiceToExistingIp(int existingIpId, String serviceName,
Protocol protocol, int port, AddInternetServiceOptions... options);
void deleteInternetService(int internetServiceId);
InternetService getInternetService(int internetServiceId);
SortedSet<InternetService> getAllInternetServicesInVDC(String vDCId);
/**
* This call returns information about the internet service on a public IP.
*/
SortedSet<InternetService> getInternetServicesOnPublicIp(int ipId);
SortedSet<InternetService> getPublicIp(int ipId);
/**
* This call adds a node to an existing internet service.
* <p/>
* Every vDC is assigned a network of 60 IP addresses that can be used as nodes. Each node can
* associated with multiple internet service. You can get a list of the available IP addresses by
* calling Get IP Addresses for a Network.
*
* @param internetServiceId
* @param ipAddress
* @param name
* @param port
* @param options
* @return
*/
Node addNode(int internetServiceId, String ipAddress, String name, int port,
AddNodeOptions... options);
Node getNode(int nodeId);
Node configureNode(int nodeId, NodeConfiguration nodeConfiguration);
void deleteNode(int nodeId);
SortedSet<Node> getNodes(int internetServiceId);
/**
* This call configures the settings of an existing vApp by passing the new configuration. The
* existing vApp must be in a powered off state (status = 2).
* <p/>
* You can change the following items for a vApp.
* <ol>
* <li>vApp name Number of virtual CPUs</li>
* <li>Amount of virtual memory</li>
* <li>Add a virtual disk</li>
* <li>Delete a virtual disk</li>
* </ol>
* You can make more than one change in a single request. For example, you can increase the
* number of virtual CPUs and the amount of virtual memory in the same request.
*
* @param vApp
* vApp to change in power state off
* @param configuration
* (s) to change
* @return task of configuration change
*/
Task configureVApp(VApp vApp, VAppConfiguration configuration);
}

View File

@ -18,6 +18,9 @@
*/ */
package org.jclouds.vcloud.terremark; package org.jclouds.vcloud.terremark;
import static org.jclouds.vcloud.terremark.TerremarkECloudMediaType.INTERNETSERVICESLIST_XML;
import static org.jclouds.vcloud.terremark.TerremarkECloudMediaType.INTERNETSERVICE_XML;
import java.util.SortedSet; import java.util.SortedSet;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
@ -51,16 +54,16 @@ import com.google.common.util.concurrent.ListenableFuture;
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(SetVCloudTokenCookie.class) @RequestFilters(SetVCloudTokenCookie.class)
public interface TerremarkECloudAsyncClient extends TerremarkAsyncClient { public interface TerremarkECloudAsyncClient extends TerremarkVCloudAsyncClient {
/** /**
* @see TerremarkVCloudClient#addInternetService * @see TerremarkVCloudExpressClient#addInternetService
*/ */
@POST @POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class) @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/vdc/{vDCId}/internetServices") @Path("/extensions/vdc/{vDCId}/internetServices")
@Produces("application/vnd.tmrk.ecloud.internetService+xml") @Produces(INTERNETSERVICE_XML)
@Consumes("application/vnd.tmrk.ecloud.internetService+xml") @Consumes(INTERNETSERVICE_XML)
@XMLResponseParser(InternetServiceHandler.class) @XMLResponseParser(InternetServiceHandler.class)
@MapBinder(AddInternetServiceOptions.class) @MapBinder(AddInternetServiceOptions.class)
@Override @Override
@ -70,25 +73,25 @@ public interface TerremarkECloudAsyncClient extends TerremarkAsyncClient {
AddInternetServiceOptions... options); AddInternetServiceOptions... options);
/** /**
* @see TerremarkVCloudClient#getAllInternetServices * @see TerremarkVCloudExpressClient#getAllInternetServices
*/ */
@GET @GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class) @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/vdc/{vDCId}/internetServices") @Path("/extensions/vdc/{vDCId}/internetServices")
@Consumes("application/vnd.tmrk.ecloud.internetServicesList+xml") @Consumes(INTERNETSERVICESLIST_XML)
@XMLResponseParser(InternetServicesHandler.class) @XMLResponseParser(InternetServicesHandler.class)
@Override @Override
ListenableFuture<? extends SortedSet<InternetService>> getAllInternetServicesInVDC( ListenableFuture<? extends SortedSet<InternetService>> getAllInternetServicesInVDC(
@PathParam("vDCId") String vDCId); @PathParam("vDCId") String vDCId);
/** /**
* @see TerremarkVCloudClient#addInternetServiceToExistingIp * @see TerremarkVCloudExpressClient#addInternetServiceToExistingIp
*/ */
@POST @POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class) @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/publicIp/{ipId}/internetServices") @Path("/extensions/publicIp/{ipId}/internetServices")
@Produces("application/vnd.tmrk.ecloud.internetService+xml") @Produces(INTERNETSERVICE_XML)
@Consumes("application/vnd.tmrk.ecloud.internetService+xml") @Consumes(INTERNETSERVICE_XML)
@XMLResponseParser(InternetServiceHandler.class) @XMLResponseParser(InternetServiceHandler.class)
@MapBinder(AddInternetServiceOptions.class) @MapBinder(AddInternetServiceOptions.class)
@Override @Override
@ -98,24 +101,24 @@ public interface TerremarkECloudAsyncClient extends TerremarkAsyncClient {
AddInternetServiceOptions... options); AddInternetServiceOptions... options);
/** /**
* @see TerremarkVCloudClient#getInternetServicesOnPublicIP * @see TerremarkVCloudExpressClient#getInternetServicesOnPublicIP
*/ */
@GET @GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class) @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/publicIp/{ipId}/internetServices") @Path("/extensions/publicIp/{ipId}/internetServices")
@Consumes("application/vnd.tmrk.ecloud.internetServicesList+xml") @Consumes(INTERNETSERVICESLIST_XML)
@XMLResponseParser(InternetServicesHandler.class) @XMLResponseParser(InternetServicesHandler.class)
@Override @Override
ListenableFuture<? extends SortedSet<InternetService>> getInternetServicesOnPublicIp( ListenableFuture<? extends SortedSet<InternetService>> getInternetServicesOnPublicIp(
@PathParam("ipId") int ipId); @PathParam("ipId") int ipId);
/** /**
* @see TerremarkVCloudClient#getInternetService * @see TerremarkVCloudExpressClient#getInternetService
*/ */
@GET @GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class) @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/internetService/{internetServiceId}") @Path("/extensions/internetService/{internetServiceId}")
@Consumes("application/vnd.tmrk.ecloud.internetServicesList+xml") @Consumes(INTERNETSERVICESLIST_XML)
@XMLResponseParser(InternetServiceHandler.class) @XMLResponseParser(InternetServiceHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Override @Override

View File

@ -30,7 +30,7 @@ import org.jclouds.concurrent.Timeout;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
public interface TerremarkECloudClient extends TerremarkClient { public interface TerremarkECloudClient extends TerremarkVCloudClient {
//TODO //TODO
} }

View File

@ -0,0 +1,32 @@
package org.jclouds.vcloud.terremark;
import javax.ws.rs.core.MediaType;
/**
* Resource Types used in Terremark eCloud
*
* @see MediaType
*/
public interface TerremarkECloudMediaType extends TerremarkVCloudMediaType {
/**
* "application/vnd.tmrk.ecloud.internetService+xml"
*/
public final static String INTERNETSERVICE_XML = "application/vnd.tmrk.ecloud.internetService+xml";
/**
* "application/vnd.tmrk.ecloud.internetService+xml"
*/
public final static MediaType INTERNETSERVICE_XML_TYPE = new MediaType("application",
"vnd.tmrk.ecloud.internetService+xml");
/**
* "application/vnd.tmrk.ecloud.internetServicesList+xml"
*/
public final static String INTERNETSERVICESLIST_XML = "application/vnd.tmrk.ecloud.internetServicesList+xml";
/**
* "application/vnd.tmrk.ecloud.internetServicesList+xml"
*/
public final static MediaType INTERNETSERVICESLIST_XML_TYPE = new MediaType("application",
"vnd.tmrk.ecloud.internetServicesList+xml");
}

View File

@ -18,36 +18,79 @@
*/ */
package org.jclouds.vcloud.terremark; package org.jclouds.vcloud.terremark;
import static javax.ws.rs.core.MediaType.APPLICATION_XML; import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.KEYSLIST_XML; import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.CATALOGITEMCUSTOMIZATIONPARAMETERS_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.INTERNETSERVICESLIST_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.INTERNETSERVICE_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.NODESERVICE_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.PUBLICIPSLIST_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.PUBLICIP_XML;
import java.util.Set; import java.util.SortedSet;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE; import javax.ws.rs.DELETE;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import org.jclouds.predicates.validators.DnsNameValidator;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Endpoint; import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.MapBinder; import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.MapPayloadParam; import org.jclouds.rest.annotations.MapPayloadParam;
import org.jclouds.rest.annotations.ParamParser;
import org.jclouds.rest.annotations.ParamValidators;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.vcloud.VCloudAsyncClient;
import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.endpoints.Org;
import org.jclouds.vcloud.filters.SetVCloudTokenCookie; import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
import org.jclouds.vcloud.terremark.binders.BindCreateKeyToXmlPayload; import org.jclouds.vcloud.functions.CatalogIdToUri;
import org.jclouds.vcloud.terremark.domain.KeyPair; import org.jclouds.vcloud.functions.VAppId;
import org.jclouds.vcloud.terremark.endpoints.KeysList; import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import org.jclouds.vcloud.terremark.xml.KeyPairHandler; import org.jclouds.vcloud.terremark.binders.BindNodeConfigurationToXmlPayload;
import org.jclouds.vcloud.terremark.xml.KeyPairsHandler; import org.jclouds.vcloud.terremark.binders.BindVAppConfigurationToXmlPayload;
import org.jclouds.vcloud.terremark.binders.TerremarkBindInstantiateVAppTemplateParamsToXmlPayload;
import org.jclouds.vcloud.terremark.domain.CustomizationParameters;
import org.jclouds.vcloud.terremark.domain.InternetService;
import org.jclouds.vcloud.terremark.domain.Node;
import org.jclouds.vcloud.terremark.domain.NodeConfiguration;
import org.jclouds.vcloud.terremark.domain.Protocol;
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
import org.jclouds.vcloud.terremark.domain.TerremarkOrganization;
import org.jclouds.vcloud.terremark.domain.VAppConfiguration;
import org.jclouds.vcloud.terremark.functions.ParseTaskFromLocationHeader;
import org.jclouds.vcloud.terremark.functions.ReturnEmptySetOnResourceNotFoundException;
import org.jclouds.vcloud.terremark.functions.ReturnVoidOnDeleteDefaultIp;
import org.jclouds.vcloud.terremark.options.AddInternetServiceOptions;
import org.jclouds.vcloud.terremark.options.AddNodeOptions;
import org.jclouds.vcloud.terremark.xml.CustomizationParametersHandler;
import org.jclouds.vcloud.terremark.xml.InternetServiceHandler;
import org.jclouds.vcloud.terremark.xml.InternetServicesHandler;
import org.jclouds.vcloud.terremark.xml.NodeHandler;
import org.jclouds.vcloud.terremark.xml.NodesHandler;
import org.jclouds.vcloud.terremark.xml.PublicIpAddressesHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkOrgHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler;
import org.jclouds.vcloud.xml.CatalogHandler;
import org.jclouds.vcloud.xml.VAppHandler;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
/** /**
* Provides access to VCloud resources via their REST API. * Provides access to VCloud resources via their REST API.
* <p/> * <p/>
@ -56,73 +99,265 @@ import com.google.common.util.concurrent.ListenableFuture;
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(SetVCloudTokenCookie.class) @RequestFilters(SetVCloudTokenCookie.class)
public interface TerremarkVCloudAsyncClient extends TerremarkAsyncClient { public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
@GET
@Endpoint(Org.class)
@Consumes(ORG_XML)
@XMLResponseParser(TerremarkOrgHandler.class)
ListenableFuture<? extends TerremarkOrganization> getDefaultOrganization();
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/org/{orgId}")
@XMLResponseParser(TerremarkOrgHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Consumes(ORG_XML)
ListenableFuture<? extends TerremarkOrganization> getOrganization(
@PathParam("orgId") String orgId);
/** /**
* @see TerremarkVCloudClient#listKeyPairs * @see TerremarkVCloudExpressClient#getDefaultVDC
*/ */
@GET @GET
@Endpoint(KeysList.class) @Endpoint(org.jclouds.vcloud.endpoints.VDC.class)
@Consumes(KEYSLIST_XML) @XMLResponseParser(TerremarkVDCHandler.class)
@XMLResponseParser(KeyPairsHandler.class) @Consumes(VDC_XML)
ListenableFuture<? extends Set<KeyPair>> listKeyPairs(); ListenableFuture<? extends VDC> getDefaultVDC();
/** /**
* @see TerremarkVCloudClient#listKeyPairsInOrg * Terremark does not have multiple catalogs, so we ignore this parameter.
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.Catalog.class)
@XMLResponseParser(CatalogHandler.class)
@Consumes(CATALOG_XML)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends Catalog> getCatalog(String catalogId);
/**
* @see TerremarkVCloudExpressClient#getVDC
*/ */
@GET @GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class) @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/org/{orgId}/keys") @Path("/vdc/{vDCId}")
@Consumes(KEYSLIST_XML) @XMLResponseParser(TerremarkVDCHandler.class)
@XMLResponseParser(KeyPairsHandler.class) @Consumes(VDC_XML)
ListenableFuture<? extends Set<KeyPair>> listKeyPairsInOrg(@PathParam("orgId") String orgId); @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends VDC> getVDC(@PathParam("vDCId") String vDCId);
/** /**
* @see TerremarkVCloudClient#generateKeyPairInOrg * @see TerremarkVCloudExpressClient#instantiateVAppTemplateInVDC
*/ */
@POST @POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class) @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/org/{orgId}/keys") @Path("/vdc/{vDCId}/action/instantiateVAppTemplate")
@Produces(KEYSLIST_XML) @Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
@Consumes(KEYSLIST_XML) @Consumes(VAPP_XML)
@XMLResponseParser(KeyPairHandler.class) @XMLResponseParser(VAppHandler.class)
@MapBinder(BindCreateKeyToXmlPayload.class) @MapBinder(TerremarkBindInstantiateVAppTemplateParamsToXmlPayload.class)
ListenableFuture<? extends KeyPair> generateKeyPairInOrg(@PathParam("orgId") String orgId, ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@PathParam("vDCId") String vDCId,
@MapPayloadParam("name") String name, @MapPayloadParam("isDefault") boolean makeDefault); @MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
@MapPayloadParam("template") @ParamParser(CatalogIdToUri.class) String templateId,
InstantiateVAppTemplateOptions... options);
/** /**
* @see TerremarkVCloudClient#getKeyPair * @see TerremarkVCloudExpressClient#addInternetService
*/
@POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/vdc/{vDCId}/internetServices")
@Produces(INTERNETSERVICE_XML)
@Consumes(INTERNETSERVICE_XML)
@XMLResponseParser(InternetServiceHandler.class)
@MapBinder(AddInternetServiceOptions.class)
ListenableFuture<? extends InternetService> addInternetServiceToVDC(
@PathParam("vDCId") String vDCId, @MapPayloadParam("name") String serviceName,
@MapPayloadParam("protocol") Protocol protocol, @MapPayloadParam("port") int port,
AddInternetServiceOptions... options);
/**
* @see TerremarkVCloudExpressClient#getAllInternetServices
*/ */
@GET @GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class) @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/key/{keyId}") @Path("/extensions/vdc/{vDCId}/internetServices")
@XMLResponseParser(KeyPairHandler.class) @Consumes(INTERNETSERVICESLIST_XML)
@Consumes(APPLICATION_XML) @XMLResponseParser(InternetServicesHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) ListenableFuture<? extends SortedSet<InternetService>> getAllInternetServicesInVDC(
ListenableFuture<? extends KeyPair> getKeyPair(@PathParam("keyId") int keyId); @PathParam("vDCId") String vDCId);
// 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 TerremarkVCloudClient#deleteKeyPair * @see TerremarkVCloudExpressClient#addInternetServiceToExistingIp
*/
@POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/publicIp/{ipId}/internetServices")
@Produces(INTERNETSERVICE_XML)
@Consumes(INTERNETSERVICE_XML)
@XMLResponseParser(InternetServiceHandler.class)
@MapBinder(AddInternetServiceOptions.class)
ListenableFuture<? extends InternetService> addInternetServiceToExistingIp(
@PathParam("ipId") int existingIpId, @MapPayloadParam("name") String serviceName,
@MapPayloadParam("protocol") Protocol protocol, @MapPayloadParam("port") int port,
AddInternetServiceOptions... options);
/**
* @see TerremarkVCloudExpressClient#deletePublicIp
*/ */
@DELETE @DELETE
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class) @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/key/{keyId}") @Path("/extensions/publicIp/{ipId}")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @ExceptionParser(ReturnVoidOnDeleteDefaultIp.class)
ListenableFuture<Void> deleteKeyPair(@PathParam("keyId") int keyId); ListenableFuture<Void> deletePublicIp(@PathParam("ipId") int ipId);
} /**
* @see TerremarkVCloudExpressClient#getInternetServicesOnPublicIP
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/publicIp/{ipId}/internetServices")
@Consumes(INTERNETSERVICESLIST_XML)
@XMLResponseParser(InternetServicesHandler.class)
ListenableFuture<? extends SortedSet<InternetService>> getInternetServicesOnPublicIp(
@PathParam("ipId") int ipId);
/**
* @see TerremarkVCloudExpressClient#getPublicIp
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/publicIp/{ipId}")
@Consumes(PUBLICIP_XML)
@XMLResponseParser(InternetServicesHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends SortedSet<InternetService>> getPublicIp(@PathParam("ipId") int ipId);
/**
* @see TerremarkVCloudExpressClient#getPublicIpsAssociatedWithVDC
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/vdc/{vDCId}/publicIps")
@Consumes(PUBLICIPSLIST_XML)
@XMLResponseParser(PublicIpAddressesHandler.class)
ListenableFuture<? extends SortedSet<PublicIpAddress>> getPublicIpsAssociatedWithVDC(
@PathParam("vDCId") String vDCId);
/**
* @see TerremarkVCloudExpressClient#activatePublicIpInVDC
*/
@POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/{vDCId}/publicIps")
@XMLResponseParser(PublicIpAddressesHandler.class)
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<PublicIpAddress> activatePublicIpInVDC(@PathParam("vDCId") String vDCId);
/**
* @see TerremarkVCloudExpressClient#deleteInternetService
*/
@DELETE
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/internetService/{internetServiceId}")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteInternetService(
@PathParam("internetServiceId") int internetServiceId);
/**
* @see TerremarkVCloudExpressClient#getInternetService
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/internetService/{internetServiceId}")
@Consumes(INTERNETSERVICESLIST_XML)
@XMLResponseParser(InternetServiceHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends InternetService> getInternetService(
@PathParam("internetServiceId") int internetServiceId);
/**
* @see TerremarkVCloudExpressClient#addNode
*/
@POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/internetService/{internetServiceId}/nodeServices")
@Produces(NODESERVICE_XML)
@Consumes(NODESERVICE_XML)
@XMLResponseParser(NodeHandler.class)
@MapBinder(AddNodeOptions.class)
ListenableFuture<? extends Node> addNode(@PathParam("internetServiceId") int internetServiceId,
@MapPayloadParam("ipAddress") String ipAddress, @MapPayloadParam("name") String name,
@MapPayloadParam("port") int port, AddNodeOptions... options);
/**
* @see TerremarkVCloudExpressClient#getNodes
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/internetService/{internetServiceId}/nodeServices")
@XMLResponseParser(NodesHandler.class)
@ExceptionParser(ReturnEmptySetOnResourceNotFoundException.class)
@Consumes(NODESERVICE_XML)
ListenableFuture<? extends SortedSet<Node>> getNodes(
@PathParam("internetServiceId") int internetServiceId);
/**
* @see TerremarkVCloudExpressClient#getNode
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/nodeService/{nodeId}")
@XMLResponseParser(NodeHandler.class)
@Consumes(NODESERVICE_XML)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends Node> getNode(@PathParam("nodeId") int nodeId);
/**
* @see TerremarkVCloudExpressClient#configureNode
*/
@PUT
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/nodeService/{nodeId}")
@Produces(NODESERVICE_XML)
@Consumes(NODESERVICE_XML)
@XMLResponseParser(NodeHandler.class)
ListenableFuture<? extends Node> configureNode(
@PathParam("nodeId") int nodeId,
@BinderParam(BindNodeConfigurationToXmlPayload.class) NodeConfiguration nodeConfiguration);
/**
* @see TerremarkVCloudExpressClient#deleteNode
*/
@DELETE
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/nodeService/{nodeId}")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteNode(@PathParam("nodeId") int nodeId);
/**
* @see TerremarkVCloudExpressClient#configureVApp
*/
@PUT
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/vapp/{vAppId}")
@Produces(VAPP_XML)
@Consumes(VAPP_XML)
@MapBinder(BindVAppConfigurationToXmlPayload.class)
@ResponseParser(ParseTaskFromLocationHeader.class)
ListenableFuture<? extends Task> configureVApp(
@PathParam("vAppId") @ParamParser(VAppId.class) VApp vApp,
VAppConfiguration configuration);
/**
* @see TerremarkVCloudExpressClient#getCustomizationOptionsOfCatalogItem
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/template/{catalogItemId}/options/customization")
@XMLResponseParser(CustomizationParametersHandler.class)
@Consumes(CATALOGITEMCUSTOMIZATIONPARAMETERS_XML)
ListenableFuture<? extends CustomizationParameters> getCustomizationOptionsOfCatalogItem(
@PathParam("catalogItemId") String catalogItemId);
}

View File

@ -18,11 +18,23 @@
*/ */
package org.jclouds.vcloud.terremark; package org.jclouds.vcloud.terremark;
import java.util.Set; import java.util.SortedSet;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.terremark.domain.KeyPair; import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.terremark.domain.CustomizationParameters;
import org.jclouds.vcloud.terremark.domain.InternetService;
import org.jclouds.vcloud.terremark.domain.Node;
import org.jclouds.vcloud.terremark.domain.NodeConfiguration;
import org.jclouds.vcloud.terremark.domain.Protocol;
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
import org.jclouds.vcloud.terremark.domain.TerremarkOrganization;
import org.jclouds.vcloud.terremark.domain.VAppConfiguration;
import org.jclouds.vcloud.terremark.options.AddInternetServiceOptions;
import org.jclouds.vcloud.terremark.options.AddNodeOptions;
/** /**
* Provides access to VCloud resources via their REST API. * Provides access to VCloud resources via their REST API.
@ -32,22 +44,103 @@ import org.jclouds.vcloud.terremark.domain.KeyPair;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
public interface TerremarkVCloudClient extends TerremarkClient { public interface TerremarkVCloudClient extends VCloudClient {
TerremarkOrganization getDefaultOrganization();
TerremarkOrganization getOrganization(String orgId);
CustomizationParameters getCustomizationOptionsOfCatalogItem(String catalogItemId);
/** /**
* This call returns the keys previously created for your organization. * This call returns a list of public IP addresses.
*/ */
Set<KeyPair> listKeyPairs(); SortedSet<PublicIpAddress> getPublicIpsAssociatedWithVDC(String vDCId);
Set<KeyPair> listKeyPairsInOrg(String orgId); void deletePublicIp(int ipId);
KeyPair generateKeyPairInOrg(String orgId, String name, boolean makeDefault); /**
* Allocate a new public IP
*
* @param vDCId
* @return
*/
PublicIpAddress activatePublicIpInVDC(String vDCId);
KeyPair getKeyPair(int keyPairId); /**
* The call creates a new internet server, including protocol and port information. The public IP
* is dynamically allocated.
*
*/
InternetService addInternetServiceToVDC(String vDCId, String serviceName, Protocol protocol,
int port, AddInternetServiceOptions... options);
// TODO /**
// KeyPair configureKeyPair(int keyPairId, KeyPairConfiguration * This call adds an internet service to a known, existing public IP. This call is identical to
// keyPairConfiguration); * Add Internet Service except you specify the public IP in the request.
*
*/
InternetService addInternetServiceToExistingIp(int existingIpId, String serviceName,
Protocol protocol, int port, AddInternetServiceOptions... options);
void deleteKeyPair(int keyPairId); void deleteInternetService(int internetServiceId);
}
InternetService getInternetService(int internetServiceId);
SortedSet<InternetService> getAllInternetServicesInVDC(String vDCId);
/**
* This call returns information about the internet service on a public IP.
*/
SortedSet<InternetService> getInternetServicesOnPublicIp(int ipId);
SortedSet<InternetService> getPublicIp(int ipId);
/**
* This call adds a node to an existing internet service.
* <p/>
* Every vDC is assigned a network of 60 IP addresses that can be used as nodes. Each node can
* associated with multiple internet service. You can get a list of the available IP addresses by
* calling Get IP Addresses for a Network.
*
* @param internetServiceId
* @param ipAddress
* @param name
* @param port
* @param options
* @return
*/
Node addNode(int internetServiceId, String ipAddress, String name, int port,
AddNodeOptions... options);
Node getNode(int nodeId);
Node configureNode(int nodeId, NodeConfiguration nodeConfiguration);
void deleteNode(int nodeId);
SortedSet<Node> getNodes(int internetServiceId);
/**
* This call configures the settings of an existing vApp by passing the new configuration. The
* existing vApp must be in a powered off state (status = 2).
* <p/>
* You can change the following items for a vApp.
* <ol>
* <li>vApp name Number of virtual CPUs</li>
* <li>Amount of virtual memory</li>
* <li>Add a virtual disk</li>
* <li>Delete a virtual disk</li>
* </ol>
* You can make more than one change in a single request. For example, you can increase the
* number of virtual CPUs and the amount of virtual memory in the same request.
*
* @param vApp
* vApp to change in power state off
* @param configuration
* (s) to change
* @return task of configuration change
*/
Task configureVApp(VApp vApp, VAppConfiguration configuration);
}

View File

@ -0,0 +1,128 @@
/**
*
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.terremark;
import static javax.ws.rs.core.MediaType.APPLICATION_XML;
import static org.jclouds.vcloud.terremark.TerremarkVCloudExpressMediaType.KEYSLIST_XML;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.MapPayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
import org.jclouds.vcloud.terremark.binders.BindCreateKeyToXmlPayload;
import org.jclouds.vcloud.terremark.domain.KeyPair;
import org.jclouds.vcloud.terremark.endpoints.KeysList;
import org.jclouds.vcloud.terremark.xml.KeyPairHandler;
import org.jclouds.vcloud.terremark.xml.KeyPairsHandler;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides access to VCloud resources via their REST API.
* <p/>
*
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
* @author Adrian Cole
*/
@RequestFilters(SetVCloudTokenCookie.class)
public interface TerremarkVCloudExpressAsyncClient extends TerremarkVCloudAsyncClient {
/**
* @see TerremarkVCloudExpressClient#listKeyPairs
*/
@GET
@Endpoint(KeysList.class)
@Consumes(KEYSLIST_XML)
@XMLResponseParser(KeyPairsHandler.class)
ListenableFuture<? extends Set<KeyPair>> listKeyPairs();
/**
* @see TerremarkVCloudExpressClient#listKeyPairsInOrg
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/org/{orgId}/keys")
@Consumes(KEYSLIST_XML)
@XMLResponseParser(KeyPairsHandler.class)
ListenableFuture<? extends Set<KeyPair>> listKeyPairsInOrg(@PathParam("orgId") String orgId);
/**
* @see TerremarkVCloudExpressClient#generateKeyPairInOrg
*/
@POST
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/org/{orgId}/keys")
@Produces(KEYSLIST_XML)
@Consumes(KEYSLIST_XML)
@XMLResponseParser(KeyPairHandler.class)
@MapBinder(BindCreateKeyToXmlPayload.class)
ListenableFuture<? extends KeyPair> generateKeyPairInOrg(@PathParam("orgId") String orgId,
@MapPayloadParam("name") String name, @MapPayloadParam("isDefault") boolean makeDefault);
/**
* @see TerremarkVCloudExpressClient#getKeyPair
*/
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/key/{keyId}")
@XMLResponseParser(KeyPairHandler.class)
@Consumes(APPLICATION_XML)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends KeyPair> getKeyPair(@PathParam("keyId") int 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 TerremarkVCloudExpressClient#deleteKeyPair
*/
@DELETE
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/extensions/key/{keyId}")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteKeyPair(@PathParam("keyId") int keyId);
}

View File

@ -0,0 +1,53 @@
/**
*
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.terremark;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.terremark.domain.KeyPair;
/**
* Provides access to VCloud resources via their REST API.
* <p/>
*
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
* @author Adrian Cole
*/
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
public interface TerremarkVCloudExpressClient extends TerremarkVCloudClient {
/**
* This call returns the keys previously created for your organization.
*/
Set<KeyPair> listKeyPairs();
Set<KeyPair> listKeyPairsInOrg(String orgId);
KeyPair generateKeyPairInOrg(String orgId, String name, boolean makeDefault);
KeyPair getKeyPair(int keyPairId);
// TODO
// KeyPair configureKeyPair(int keyPairId, KeyPairConfiguration
// keyPairConfiguration);
void deleteKeyPair(int keyPairId);
}

View File

@ -25,7 +25,7 @@ import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
import org.jclouds.logging.jdk.config.JDKLoggingModule; import org.jclouds.logging.jdk.config.JDKLoggingModule;
import org.jclouds.vcloud.VCloudContextBuilder; import org.jclouds.vcloud.VCloudContextBuilder;
import org.jclouds.vcloud.terremark.compute.config.TerremarkVCloudComputeServiceContextModule; import org.jclouds.vcloud.terremark.compute.config.TerremarkVCloudComputeServiceContextModule;
import org.jclouds.vcloud.terremark.config.TerremarkVCloudRestClientModule; import org.jclouds.vcloud.terremark.config.TerremarkVCloudExpressRestClientModule;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Module; import com.google.inject.Module;
@ -43,9 +43,9 @@ import com.google.inject.Module;
* @author Adrian Cole * @author Adrian Cole
* @see TerremarkVCloudComputeServiceContext * @see TerremarkVCloudComputeServiceContext
*/ */
public class TerremarkVCloudContextBuilder extends VCloudContextBuilder { public class TerremarkVCloudExpressContextBuilder extends VCloudContextBuilder {
public TerremarkVCloudContextBuilder(Properties props) { public TerremarkVCloudExpressContextBuilder(Properties props) {
super(props); super(props);
} }
@ -56,7 +56,7 @@ public class TerremarkVCloudContextBuilder extends VCloudContextBuilder {
@Override @Override
protected void addClientModule(List<Module> modules) { protected void addClientModule(List<Module> modules) {
modules.add(new TerremarkVCloudRestClientModule()); modules.add(new TerremarkVCloudExpressRestClientModule());
} }
} }

View File

@ -0,0 +1,22 @@
package org.jclouds.vcloud.terremark;
import javax.ws.rs.core.MediaType;
/**
* Resource Types used in Terremark VCloud express
*
* @see MediaType
*/
public interface TerremarkVCloudExpressMediaType extends TerremarkVCloudMediaType {
/**
* "application/vnd.tmrk.vcloudExpress.keysList+xml"
*/
public final static String KEYSLIST_XML = "application/vnd.tmrk.vcloudExpress.keysList+xml";
/**
* "application/vnd.tmrk.vCloudExpress.keysList+xml"
*/
public final static MediaType KEYSLIST_XML_TYPE = new MediaType("application",
"vnd.tmrk.vcloudExpress.keysList+xml");
}

View File

@ -0,0 +1,48 @@
/**
*
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.terremark;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.vcloud.terremark.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_NAME;
import static org.jclouds.vcloud.terremark.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_VERSION;
import java.util.Properties;
/**
* Builds properties used in Terremark VCloud Clients
*
* @author Adrian Cole
*/
public class TerremarkVCloudExpressPropertiesBuilder extends TerremarkVCloudPropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_API_VERSION, "0.8a-ext1.6");
properties.setProperty(PROPERTY_TERREMARK_EXTENSION_NAME, "vCloudExpressExtensions");
properties.setProperty(PROPERTY_TERREMARK_EXTENSION_VERSION, "1.6");
properties.setProperty(PROPERTY_ENDPOINT, "https://services.vcloudexpress.terremark.com/api");
return properties;
}
public TerremarkVCloudExpressPropertiesBuilder(Properties properties) {
super(properties);
}
}

View File

@ -5,21 +5,11 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.VCloudMediaType;
/** /**
* Resource Types used in Terremark VCloud express * Resource Types used in Terremark VCloud
* *
* @see MediaType * @see MediaType
*/ */
public class TerremarkVCloudMediaType extends VCloudMediaType { public interface TerremarkVCloudMediaType extends VCloudMediaType {
/**
* "application/vnd.tmrk.vcloudExpress.keysList+xml"
*/
public final static String KEYSLIST_XML = "application/vnd.tmrk.vcloudExpress.keysList+xml";
/**
* "application/vnd.tmrk.vCloudExpress.keysList+xml"
*/
public final static MediaType KEYSLIST_XML_TYPE = new MediaType(
"application", "vnd.tmrk.vcloudExpress.keysList+xml");
/** /**
* "application/vnd.tmrk.vCloud.publicIp+xml" * "application/vnd.tmrk.vCloud.publicIp+xml"
@ -29,8 +19,8 @@ public class TerremarkVCloudMediaType extends VCloudMediaType {
/** /**
* "application/vnd.tmrk.vCloud.publicIp+xml" * "application/vnd.tmrk.vCloud.publicIp+xml"
*/ */
public final static MediaType PUBLICIP_XML_TYPE = new MediaType( public final static MediaType PUBLICIP_XML_TYPE = new MediaType("application",
"application", "vnd.tmrk.vCloud.publicIp+xml"); "vnd.tmrk.vCloud.publicIp+xml");
/** /**
* "application/vnd.tmrk.vCloud.publicIpsList+xml" * "application/vnd.tmrk.vCloud.publicIpsList+xml"
@ -40,8 +30,8 @@ public class TerremarkVCloudMediaType extends VCloudMediaType {
/** /**
* "application/vnd.tmrk.vCloud.publicIpsList+xml" * "application/vnd.tmrk.vCloud.publicIpsList+xml"
*/ */
public final static MediaType PUBLICIPSLIST_XML_TYPE = new MediaType( public final static MediaType PUBLICIPSLIST_XML_TYPE = new MediaType("application",
"application", "vnd.tmrk.vCloud.publicIpsList+xml"); "vnd.tmrk.vCloud.publicIpsList+xml");
/** /**
* "application/vnd.tmrk.vCloud.internetService+xml" * "application/vnd.tmrk.vCloud.internetService+xml"
@ -51,8 +41,8 @@ public class TerremarkVCloudMediaType extends VCloudMediaType {
/** /**
* "application/vnd.tmrk.vCloud.internetService+xml" * "application/vnd.tmrk.vCloud.internetService+xml"
*/ */
public final static MediaType INTERNETSERVICE_XML_TYPE = new MediaType( public final static MediaType INTERNETSERVICE_XML_TYPE = new MediaType("application",
"application", "vnd.tmrk.vCloud.internetService+xml"); "vnd.tmrk.vCloud.internetService+xml");
/** /**
* "application/vnd.tmrk.vCloud.internetServicesList+xml" * "application/vnd.tmrk.vCloud.internetServicesList+xml"
@ -62,8 +52,8 @@ public class TerremarkVCloudMediaType extends VCloudMediaType {
/** /**
* "application/vnd.tmrk.vCloud.internetServicesList+xml" * "application/vnd.tmrk.vCloud.internetServicesList+xml"
*/ */
public final static MediaType INTERNETSERVICESLIST_XML_TYPE = new MediaType( public final static MediaType INTERNETSERVICESLIST_XML_TYPE = new MediaType("application",
"application", "vnd.tmrk.vCloud.internetServicesList+xml"); "vnd.tmrk.vCloud.internetServicesList+xml");
/** /**
* "application/vnd.tmrk.vCloud.nodeService+xml" * "application/vnd.tmrk.vCloud.nodeService+xml"
@ -73,8 +63,8 @@ public class TerremarkVCloudMediaType extends VCloudMediaType {
/** /**
* "application/vnd.tmrk.vCloud.nodeService+xml" * "application/vnd.tmrk.vCloud.nodeService+xml"
*/ */
public final static MediaType NODESERVICE_XML_TYPE = new MediaType( public final static MediaType NODESERVICE_XML_TYPE = new MediaType("application",
"application", "vnd.tmrk.vCloud.nodeService+xml"); "vnd.tmrk.vCloud.nodeService+xml");
/** /**
* "application/vnd.tmrk.vCloud.catalogItemCustomizationParameters+xml" * "application/vnd.tmrk.vCloud.catalogItemCustomizationParameters+xml"
@ -85,6 +75,5 @@ public class TerremarkVCloudMediaType extends VCloudMediaType {
* "application/vnd.tmrk.vCloud.catalogItemCustomizationParameters+xml" * "application/vnd.tmrk.vCloud.catalogItemCustomizationParameters+xml"
*/ */
public final static MediaType CATALOGITEMCUSTOMIZATIONPARAMETERS_XML_TYPE = new MediaType( public final static MediaType CATALOGITEMCUSTOMIZATIONPARAMETERS_XML_TYPE = new MediaType(
"application", "application", "vnd.tmrk.vCloud.catalogItemCustomizationParameters+xml");
"vnd.tmrk.vCloud.catalogItemCustomizationParameters+xml");
} }

View File

@ -18,8 +18,6 @@
*/ */
package org.jclouds.vcloud.terremark; package org.jclouds.vcloud.terremark;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED; import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
import static org.jclouds.vcloud.terremark.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_NAME; import static org.jclouds.vcloud.terremark.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_NAME;
import static org.jclouds.vcloud.terremark.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_NS; import static org.jclouds.vcloud.terremark.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_NS;
@ -38,10 +36,6 @@ public class TerremarkVCloudPropertiesBuilder extends VCloudPropertiesBuilder {
@Override @Override
protected Properties defaultProperties() { protected Properties defaultProperties() {
Properties properties = super.defaultProperties(); Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_API_VERSION, "0.8a-ext1.6");
properties.setProperty(PROPERTY_TERREMARK_EXTENSION_NAME, "vCloudExpressExtensions");
properties.setProperty(PROPERTY_TERREMARK_EXTENSION_VERSION, "1.6");
properties.setProperty(PROPERTY_ENDPOINT, "https://services.vcloudexpress.terremark.com/api");
properties.setProperty("jclouds.dns_name_length_min", "1"); properties.setProperty("jclouds.dns_name_length_min", "1");
properties.setProperty("jclouds.dns_name_length_max", "15"); properties.setProperty("jclouds.dns_name_length_max", "15");
// with ssh key injection comes another reboot. allowing more time // with ssh key injection comes another reboot. allowing more time

View File

@ -43,7 +43,7 @@ import org.jclouds.vcloud.domain.TasksList;
import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VAppStatus; import org.jclouds.vcloud.domain.VAppStatus;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions; import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import org.jclouds.vcloud.terremark.TerremarkVCloudClient; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
import org.jclouds.vcloud.terremark.domain.InternetService; import org.jclouds.vcloud.terremark.domain.InternetService;
import org.jclouds.vcloud.terremark.domain.Node; import org.jclouds.vcloud.terremark.domain.Node;
import org.jclouds.vcloud.terremark.domain.Protocol; import org.jclouds.vcloud.terremark.domain.Protocol;
@ -59,12 +59,12 @@ import com.google.inject.internal.ImmutableSet;
@Singleton @Singleton
public class TerremarkVCloudComputeClient extends BaseVCloudComputeClient { public class TerremarkVCloudComputeClient extends BaseVCloudComputeClient {
private final TerremarkVCloudClient client; private final TerremarkVCloudExpressClient client;
private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider; private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
private Provider<String> passwordGenerator; private Provider<String> passwordGenerator;
@Inject @Inject
protected TerremarkVCloudComputeClient(TerremarkVCloudClient client, protected TerremarkVCloudComputeClient(TerremarkVCloudExpressClient client,
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider, PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
@Named("PASSWORD") Provider<String> passwordGenerator, Predicate<String> successTester, @Named("PASSWORD") Provider<String> passwordGenerator, Predicate<String> successTester,
Map<VAppStatus, NodeState> vAppStatusToNodeState) { Map<VAppStatus, NodeState> vAppStatusToNodeState) {

View File

@ -55,7 +55,7 @@ import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
import org.jclouds.vcloud.compute.strategy.VCloudDestroyNodeStrategy; import org.jclouds.vcloud.compute.strategy.VCloudDestroyNodeStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudListNodesStrategy; import org.jclouds.vcloud.compute.strategy.VCloudListNodesStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudRebootNodeStrategy; import org.jclouds.vcloud.compute.strategy.VCloudRebootNodeStrategy;
import org.jclouds.vcloud.terremark.TerremarkClient; import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
import org.jclouds.vcloud.terremark.compute.TerremarkVCloudComputeClient; import org.jclouds.vcloud.terremark.compute.TerremarkVCloudComputeClient;
import org.jclouds.vcloud.terremark.compute.TerremarkVCloudComputeService; import org.jclouds.vcloud.terremark.compute.TerremarkVCloudComputeService;
import org.jclouds.vcloud.terremark.compute.config.providers.QueryCatalogForVAppTemplatesAndConvertToImagesProvider; import org.jclouds.vcloud.terremark.compute.config.providers.QueryCatalogForVAppTemplatesAndConvertToImagesProvider;
@ -96,13 +96,13 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudComputeSer
@Singleton @Singleton
public static class TerremarkVCloudAddNodeWithTagStrategy implements AddNodeWithTagStrategy { public static class TerremarkVCloudAddNodeWithTagStrategy implements AddNodeWithTagStrategy {
protected final TerremarkClient client; protected final TerremarkVCloudClient client;
protected final TerremarkVCloudComputeClient computeClient; protected final TerremarkVCloudComputeClient computeClient;
protected final GetNodeMetadataStrategy getNode; protected final GetNodeMetadataStrategy getNode;
protected final TemplateToInstantiateOptions getOptions; protected final TemplateToInstantiateOptions getOptions;
@Inject @Inject
protected TerremarkVCloudAddNodeWithTagStrategy(TerremarkClient client, protected TerremarkVCloudAddNodeWithTagStrategy(TerremarkVCloudClient client,
TerremarkVCloudComputeClient computeClient, GetNodeMetadataStrategy getNode, TerremarkVCloudComputeClient computeClient, GetNodeMetadataStrategy getNode,
TemplateToInstantiateOptions getOptions) { TemplateToInstantiateOptions getOptions) {
this.client = client; this.client = client;

View File

@ -29,7 +29,7 @@ import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.http.HttpResponseException; import org.jclouds.http.HttpResponseException;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import org.jclouds.vcloud.terremark.TerremarkVCloudClient; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
import org.jclouds.vcloud.terremark.compute.domain.OrgAndName; import org.jclouds.vcloud.terremark.compute.domain.OrgAndName;
import org.jclouds.vcloud.terremark.domain.KeyPair; import org.jclouds.vcloud.terremark.domain.KeyPair;
@ -45,11 +45,11 @@ public class CreateUniqueKeyPair implements Function<OrgAndName, KeyPair> {
@Resource @Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER) @Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
protected final TerremarkVCloudClient trmkClient; protected final TerremarkVCloudExpressClient trmkClient;
protected Supplier<String> randomSuffix; protected Supplier<String> randomSuffix;
@Inject @Inject
CreateUniqueKeyPair(TerremarkVCloudClient trmkClient, CreateUniqueKeyPair(TerremarkVCloudExpressClient trmkClient,
Supplier<String> randomSuffix) { Supplier<String> randomSuffix) {
this.trmkClient = trmkClient; this.trmkClient = trmkClient;
this.randomSuffix = randomSuffix; this.randomSuffix = randomSuffix;

View File

@ -27,7 +27,7 @@ import javax.inject.Singleton;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.vcloud.terremark.TerremarkVCloudClient; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
import org.jclouds.vcloud.terremark.compute.domain.OrgAndName; import org.jclouds.vcloud.terremark.compute.domain.OrgAndName;
import org.jclouds.vcloud.terremark.domain.KeyPair; import org.jclouds.vcloud.terremark.domain.KeyPair;
@ -42,11 +42,11 @@ public class DeleteKeyPair {
@Named(ComputeServiceConstants.COMPUTE_LOGGER) @Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
final TerremarkVCloudClient terremarkClient; final TerremarkVCloudExpressClient terremarkClient;
final ConcurrentMap<OrgAndName, KeyPair> credentialsMap; final ConcurrentMap<OrgAndName, KeyPair> credentialsMap;
@Inject @Inject
DeleteKeyPair(TerremarkVCloudClient terremarkClient, DeleteKeyPair(TerremarkVCloudExpressClient terremarkClient,
ConcurrentMap<OrgAndName, KeyPair> credentialsMap) { ConcurrentMap<OrgAndName, KeyPair> credentialsMap) {
this.terremarkClient = terremarkClient; this.terremarkClient = terremarkClient;
this.credentialsMap = credentialsMap; this.credentialsMap = credentialsMap;

View File

@ -24,8 +24,8 @@ import org.jclouds.http.RequiresHttp;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.VCloudAsyncClient;
import org.jclouds.vcloud.VCloudClient; import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.terremark.TerremarkAsyncClient; import org.jclouds.vcloud.terremark.TerremarkVCloudAsyncClient;
import org.jclouds.vcloud.terremark.TerremarkClient; import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
import org.jclouds.vcloud.terremark.TerremarkECloudAsyncClient; import org.jclouds.vcloud.terremark.TerremarkECloudAsyncClient;
import org.jclouds.vcloud.terremark.TerremarkECloudClient; import org.jclouds.vcloud.terremark.TerremarkECloudClient;
@ -59,13 +59,13 @@ public class TerremarkECloudRestClientModule extends
@Provides @Provides
@Singleton @Singleton
protected TerremarkAsyncClient provideTerremarkAsyncClient(TerremarkECloudAsyncClient in) { protected TerremarkVCloudAsyncClient provideTerremarkAsyncClient(TerremarkECloudAsyncClient in) {
return in; return in;
} }
@Provides @Provides
@Singleton @Singleton
protected TerremarkClient provideTerremarkClient(TerremarkECloudClient in) { protected TerremarkVCloudClient provideTerremarkClient(TerremarkECloudClient in) {
return in; return in;
} }

View File

@ -34,13 +34,13 @@ import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError; import org.jclouds.http.annotation.ServerError;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import org.jclouds.vcloud.config.BaseVCloudRestClientModule; import org.jclouds.vcloud.config.BaseVCloudRestClientModule;
import org.jclouds.vcloud.terremark.TerremarkAsyncClient; import org.jclouds.vcloud.terremark.TerremarkVCloudAsyncClient;
import org.jclouds.vcloud.terremark.TerremarkClient; import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
import org.jclouds.vcloud.terremark.handlers.ParseTerremarkVCloudErrorFromHttpResponse; import org.jclouds.vcloud.terremark.handlers.ParseTerremarkVCloudErrorFromHttpResponse;
import com.google.inject.Provides; import com.google.inject.Provides;
public abstract class TerremarkRestClientModule<S extends TerremarkClient, A extends TerremarkAsyncClient> public abstract class TerremarkRestClientModule<S extends TerremarkVCloudClient, A extends TerremarkVCloudAsyncClient>
extends BaseVCloudRestClientModule<S, A> { extends BaseVCloudRestClientModule<S, A> {
public TerremarkRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) { public TerremarkRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) {

View File

@ -30,10 +30,10 @@ import org.jclouds.util.Utils;
import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.VCloudAsyncClient;
import org.jclouds.vcloud.VCloudClient; import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.domain.Organization; import org.jclouds.vcloud.domain.Organization;
import org.jclouds.vcloud.terremark.TerremarkAsyncClient;
import org.jclouds.vcloud.terremark.TerremarkClient;
import org.jclouds.vcloud.terremark.TerremarkVCloudAsyncClient; import org.jclouds.vcloud.terremark.TerremarkVCloudAsyncClient;
import org.jclouds.vcloud.terremark.TerremarkVCloudClient; import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClient;
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
import org.jclouds.vcloud.terremark.domain.TerremarkOrganization; import org.jclouds.vcloud.terremark.domain.TerremarkOrganization;
import org.jclouds.vcloud.terremark.endpoints.KeysList; import org.jclouds.vcloud.terremark.endpoints.KeysList;
@ -46,34 +46,34 @@ import com.google.inject.Provides;
*/ */
@RequiresHttp @RequiresHttp
@ConfiguresRestClient @ConfiguresRestClient
public class TerremarkVCloudRestClientModule extends public class TerremarkVCloudExpressRestClientModule extends
TerremarkRestClientModule<TerremarkVCloudClient, TerremarkVCloudAsyncClient> { TerremarkRestClientModule<TerremarkVCloudExpressClient, TerremarkVCloudExpressAsyncClient> {
public TerremarkVCloudRestClientModule() { public TerremarkVCloudExpressRestClientModule() {
super(TerremarkVCloudClient.class, TerremarkVCloudAsyncClient.class); super(TerremarkVCloudExpressClient.class, TerremarkVCloudExpressAsyncClient.class);
} }
@Provides @Provides
@Singleton @Singleton
protected VCloudAsyncClient provideVCloudAsyncClient(TerremarkVCloudAsyncClient in) { protected VCloudAsyncClient provideVCloudAsyncClient(TerremarkVCloudExpressAsyncClient in) {
return in; return in;
} }
@Provides @Provides
@Singleton @Singleton
protected VCloudClient provideVCloudClient(TerremarkVCloudClient in) { protected VCloudClient provideVCloudClient(TerremarkVCloudExpressClient in) {
return in; return in;
} }
@Provides @Provides
@Singleton @Singleton
protected TerremarkAsyncClient provideTerremarkAsyncClient(TerremarkVCloudAsyncClient in) { protected TerremarkVCloudAsyncClient provideTerremarkAsyncClient(TerremarkVCloudExpressAsyncClient in) {
return in; return in;
} }
@Provides @Provides
@Singleton @Singleton
protected TerremarkClient provideTerremarkClient(TerremarkVCloudClient in) { protected TerremarkVCloudClient provideTerremarkClient(TerremarkVCloudExpressClient in) {
return in; return in;
} }

View File

@ -18,7 +18,7 @@
*/ */
package org.jclouds.vcloud.terremark.xml; package org.jclouds.vcloud.terremark.xml;
import static org.jclouds.vcloud.terremark.TerremarkVCloudMediaType.KEYSLIST_XML; import static org.jclouds.vcloud.terremark.TerremarkVCloudExpressMediaType.KEYSLIST_XML;
import static org.jclouds.vcloud.util.Utils.newNamedResource; import static org.jclouds.vcloud.util.Utils.newNamedResource;
import org.jclouds.vcloud.domain.NamedResource; import org.jclouds.vcloud.domain.NamedResource;
@ -36,13 +36,13 @@ public class TerremarkOrgHandler extends OrgHandler {
private NamedResource keysList; private NamedResource keysList;
public TerremarkOrganization getResult() { public TerremarkOrganization getResult() {
return new TerremarkOrganizationImpl(org.getId(), org.getName(), org return new TerremarkOrganizationImpl(org.getId(), org.getName(), org.getLocation(), catalogs,
.getLocation(), catalogs, vdcs, tasksLists, keysList); vdcs, tasksLists, keysList);
} }
@Override @Override
public void startElement(String uri, String localName, String qName, public void startElement(String uri, String localName, String qName, Attributes attributes)
Attributes attributes) throws SAXException { throws SAXException {
super.startElement(uri, localName, qName, attributes); super.startElement(uri, localName, qName, attributes);
if (qName.equals("Link")) { if (qName.equals("Link")) {
int typeIndex = attributes.getIndex("type"); int typeIndex = attributes.getIndex("type");

View File

@ -48,11 +48,11 @@ import com.google.inject.Module;
*/ */
@Test(groups = "live", sequential = true, testName = "vcloud.TerremarkVCloudClientLiveTest") @Test(groups = "live", sequential = true, testName = "vcloud.TerremarkVCloudClientLiveTest")
public class InternetServiceLiveTest { public class InternetServiceLiveTest {
TerremarkVCloudClient tmClient; TerremarkVCloudExpressClient tmClient;
private SortedSet<InternetService> services = Sets.newTreeSet(); private SortedSet<InternetService> services = Sets.newTreeSet();
private RestContext<TerremarkVCloudClient, TerremarkVCloudAsyncClient> context; private RestContext<TerremarkVCloudExpressClient, TerremarkVCloudExpressAsyncClient> context;
public static final String PREFIX = System.getProperty("user.name") + "-terremark"; public static final String PREFIX = System.getProperty("user.name") + "-terremark";
@ -97,7 +97,7 @@ public class InternetServiceLiveTest {
Properties props = new Properties(); Properties props = new Properties();
if (endpoint != null && !"".equals(endpoint)) if (endpoint != null && !"".equals(endpoint))
props.setProperty("terremark.endpoint", endpoint); props.setProperty("terremark.endpoint", endpoint);
context = new RestContextFactory().createContext("terremark", identity, credential, ImmutableSet context = new RestContextFactory().createContext("trmk-vcloudexpress", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), props); .<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), props);
tmClient = context.getApi(); tmClient = context.getApi();

View File

@ -17,16 +17,16 @@ public class ProvidersInPropertiesTest {
@Test @Test
public void testSupportedProviders() { public void testSupportedProviders() {
Iterable<String> providers = Utils.getSupportedProviders(); Iterable<String> providers = Utils.getSupportedProviders();
assert Iterables.contains(providers, "terremark") : providers; assert Iterables.contains(providers, "trmk-vcloudexpress") : providers;
assert Iterables.contains(providers, "ecloud") : providers; assert Iterables.contains(providers, "trmk-ecloud") : providers;
} }
@Test @Test
public void testSupportedComputeServiceProviders() { public void testSupportedComputeServiceProviders() {
Iterable<String> providers = ComputeServiceUtils.getSupportedProviders(); Iterable<String> providers = ComputeServiceUtils.getSupportedProviders();
assert Iterables.contains(providers, "terremark") : providers; assert Iterables.contains(providers, "trmk-vcloudexpress") : providers;
assert Iterables.contains(providers, "ecloud") : providers; assert Iterables.contains(providers, "trmk-ecloud") : providers;
} }

View File

@ -79,11 +79,11 @@ import com.google.inject.Module;
public abstract class TerremarkClientLiveTest extends VCloudClientLiveTest { public abstract class TerremarkClientLiveTest extends VCloudClientLiveTest {
protected String provider = "terremark"; protected String provider = "trmk-vcloudexpress";
protected String expectedOs = "Ubuntu Linux (32-bit)"; protected String expectedOs = "Ubuntu Linux (32-bit)";
protected String itemName = "Ubuntu JeOS 9.10 (32-bit)"; protected String itemName = "Ubuntu JeOS 9.10 (32-bit)";
protected TerremarkClient tmClient; protected TerremarkVCloudClient tmClient;
protected Factory sshFactory; protected Factory sshFactory;
private String publicIp; private String publicIp;
private InternetService is; private InternetService is;
@ -467,7 +467,7 @@ public abstract class TerremarkClientLiveTest extends VCloudClientLiveTest {
ImmutableSet.<Module> of(new Log4JLoggingModule(), ImmutableSet.<Module> of(new Log4JLoggingModule(),
new JschSshClientModule()), props).buildInjector(); new JschSshClientModule()), props).buildInjector();
connection = tmClient = injector.getInstance(TerremarkClient.class); connection = tmClient = injector.getInstance(TerremarkVCloudClient.class);
sshFactory = injector.getInstance(SshClient.Factory.class); sshFactory = injector.getInstance(SshClient.Factory.class);
socketTester = new RetryablePredicate<IPSocket>(injector.getInstance(SocketOpen.class), 130, socketTester = new RetryablePredicate<IPSocket>(injector.getInstance(SocketOpen.class), 130,

View File

@ -35,7 +35,7 @@ import org.testng.annotations.Test;
public class TerremarkECloudClientLiveTest extends TerremarkClientLiveTest { public class TerremarkECloudClientLiveTest extends TerremarkClientLiveTest {
@BeforeClass @BeforeClass
void setProvider() { void setProvider() {
this.provider = "ecloud"; this.provider = "trmk-ecloud";
this.itemName = "Ubuntu 8.04 LTS (x86)"; this.itemName = "Ubuntu 8.04 LTS (x86)";
} }

View File

@ -51,7 +51,7 @@ import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
import org.jclouds.vcloud.internal.VCloudVersionsAsyncClient; import org.jclouds.vcloud.internal.VCloudVersionsAsyncClient;
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession; import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions; import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import org.jclouds.vcloud.terremark.config.TerremarkVCloudRestClientModule; import org.jclouds.vcloud.terremark.config.TerremarkVCloudExpressRestClientModule;
import org.jclouds.vcloud.terremark.domain.NodeConfiguration; import org.jclouds.vcloud.terremark.domain.NodeConfiguration;
import org.jclouds.vcloud.terremark.domain.Protocol; import org.jclouds.vcloud.terremark.domain.Protocol;
import org.jclouds.vcloud.terremark.functions.ReturnEmptySetOnResourceNotFoundException; import org.jclouds.vcloud.terremark.functions.ReturnEmptySetOnResourceNotFoundException;
@ -80,12 +80,12 @@ import com.google.inject.TypeLiteral;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "unit", sequential = true, testName = "vcloud.TerremarkVCloudAsyncClientTest") @Test(groups = "unit", sequential = true, testName = "vcloud.TerremarkVCloudAsyncClientTest")
public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVCloudAsyncClient> { public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVCloudExpressAsyncClient> {
/** /**
* ignore parameter of catalog id since this doesn't work * ignore parameter of catalog id since this doesn't work
*/ */
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException { public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("getCatalog", String.class); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("getCatalog", String.class);
HttpRequest request = processor.createRequest(method, "1"); HttpRequest request = processor.createRequest(method, "1");
assertRequestLineEquals(request, "GET https://catalog HTTP/1.1"); assertRequestLineEquals(request, "GET https://catalog HTTP/1.1");
@ -100,7 +100,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testGetDefaultVDC() throws SecurityException, NoSuchMethodException, IOException { public void testGetDefaultVDC() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("getDefaultVDC"); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("getDefaultVDC");
HttpRequest request = processor.createRequest(method); HttpRequest request = processor.createRequest(method);
assertRequestLineEquals(request, "GET https://vdc/1 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vdc/1 HTTP/1.1");
@ -115,7 +115,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException { public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("getVDC", String.class); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("getVDC", String.class);
HttpRequest request = processor.createRequest(method, "1"); HttpRequest request = processor.createRequest(method, "1");
assertRequestLineEquals(request, "GET https://vcloud/vdc/1 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud/vdc/1 HTTP/1.1");
@ -131,7 +131,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testInstantiateVAppTemplate() throws SecurityException, NoSuchMethodException, public void testInstantiateVAppTemplate() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC",
String.class, String.class, String.class, Array.newInstance( String.class, String.class, String.class, Array.newInstance(
InstantiateVAppTemplateOptions.class, 0).getClass()); InstantiateVAppTemplateOptions.class, 0).getClass());
HttpRequest request = processor.createRequest(method, "1", "name", 3 + ""); HttpRequest request = processor.createRequest(method, "1", "name", 3 + "");
@ -153,7 +153,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testInstantiateVAppTemplateOptions() throws SecurityException, public void testInstantiateVAppTemplateOptions() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC",
String.class, String.class, String.class, Array.newInstance( String.class, String.class, String.class, Array.newInstance(
InstantiateVAppTemplateOptions.class, 0).getClass()); InstantiateVAppTemplateOptions.class, 0).getClass());
HttpRequest request = processor.createRequest(method, "1", "name", 3 + "", HttpRequest request = processor.createRequest(method, "1", "name", 3 + "",
@ -178,7 +178,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testActivatePublicIpInVDC() throws SecurityException, NoSuchMethodException, public void testActivatePublicIpInVDC() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("activatePublicIpInVDC", Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("activatePublicIpInVDC",
String.class); String.class);
HttpRequest request = processor.createRequest(method, "1"); HttpRequest request = processor.createRequest(method, "1");
@ -195,7 +195,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testAddInternetService() throws SecurityException, NoSuchMethodException, public void testAddInternetService() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("addInternetServiceToVDC", Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("addInternetServiceToVDC",
String.class, String.class, Protocol.class, int.class, Array.newInstance( String.class, String.class, Protocol.class, int.class, Array.newInstance(
AddInternetServiceOptions.class, 0).getClass()); AddInternetServiceOptions.class, 0).getClass());
HttpRequest request = processor.createRequest(method, "1", "name", Protocol.TCP, 22); HttpRequest request = processor.createRequest(method, "1", "name", Protocol.TCP, 22);
@ -217,7 +217,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testAddInternetServiceOptions() throws SecurityException, NoSuchMethodException, public void testAddInternetServiceOptions() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("addInternetServiceToVDC", Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("addInternetServiceToVDC",
String.class, String.class, Protocol.class, int.class, Array.newInstance( String.class, String.class, Protocol.class, int.class, Array.newInstance(
AddInternetServiceOptions.class, 0).getClass()); AddInternetServiceOptions.class, 0).getClass());
HttpRequest request = processor.createRequest(method, "1", "name", Protocol.TCP, 22, HttpRequest request = processor.createRequest(method, "1", "name", Protocol.TCP, 22,
@ -239,7 +239,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testGetAllInternetServices() throws SecurityException, NoSuchMethodException, public void testGetAllInternetServices() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("getAllInternetServicesInVDC", Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("getAllInternetServicesInVDC",
String.class); String.class);
HttpRequest request = processor.createRequest(method, "1"); HttpRequest request = processor.createRequest(method, "1");
@ -257,7 +257,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testGetInternetService() throws SecurityException, NoSuchMethodException, public void testGetInternetService() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("getInternetService", int.class); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("getInternetService", int.class);
HttpRequest request = processor.createRequest(method, 12); HttpRequest request = processor.createRequest(method, 12);
assertRequestLineEquals(request, "GET https://vcloud/extensions/internetService/12 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud/extensions/internetService/12 HTTP/1.1");
@ -273,7 +273,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testDeleteInternetService() throws SecurityException, NoSuchMethodException, public void testDeleteInternetService() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = TerremarkVCloudAsyncClient.class Method method = TerremarkVCloudExpressAsyncClient.class
.getMethod("deleteInternetService", int.class); .getMethod("deleteInternetService", int.class);
HttpRequest request = processor.createRequest(method, 12); HttpRequest request = processor.createRequest(method, 12);
@ -291,7 +291,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testAddInternetServiceToExistingIp() throws SecurityException, public void testAddInternetServiceToExistingIp() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("addInternetServiceToExistingIp", Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("addInternetServiceToExistingIp",
int.class, String.class, Protocol.class, int.class, Array.newInstance( int.class, String.class, Protocol.class, int.class, Array.newInstance(
AddInternetServiceOptions.class, 0).getClass()); AddInternetServiceOptions.class, 0).getClass());
HttpRequest request = processor.createRequest(method, 12, "name", Protocol.TCP, 22); HttpRequest request = processor.createRequest(method, 12, "name", Protocol.TCP, 22);
@ -313,7 +313,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testAddInternetServiceToExistingIpOptions() throws SecurityException, public void testAddInternetServiceToExistingIpOptions() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("addInternetServiceToExistingIp", Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("addInternetServiceToExistingIp",
int.class, String.class, Protocol.class, int.class, Array.newInstance( int.class, String.class, Protocol.class, int.class, Array.newInstance(
AddInternetServiceOptions.class, 0).getClass()); AddInternetServiceOptions.class, 0).getClass());
HttpRequest request = processor.createRequest(method, 12, "name", Protocol.TCP, 22, HttpRequest request = processor.createRequest(method, 12, "name", Protocol.TCP, 22,
@ -334,7 +334,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testAddNode() throws SecurityException, NoSuchMethodException, IOException { public void testAddNode() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("addNode", int.class, Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("addNode", int.class,
String.class, String.class, int.class, Array.newInstance(AddNodeOptions.class, 0) String.class, String.class, int.class, Array.newInstance(AddNodeOptions.class, 0)
.getClass()); .getClass());
HttpRequest request = processor.createRequest(method, 12, "10.2.2.2", "name", 22); HttpRequest request = processor.createRequest(method, 12, "10.2.2.2", "name", 22);
@ -355,7 +355,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testAddNodeOptions() throws SecurityException, NoSuchMethodException, IOException { public void testAddNodeOptions() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("addNode", int.class, Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("addNode", int.class,
String.class, String.class, int.class, Array.newInstance(AddNodeOptions.class, 0) String.class, String.class, int.class, Array.newInstance(AddNodeOptions.class, 0)
.getClass()); .getClass());
HttpRequest request = processor.createRequest(method, 12, "10.2.2.2", "name", 22, HttpRequest request = processor.createRequest(method, 12, "10.2.2.2", "name", 22,
@ -377,7 +377,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testGetKeyPair() throws SecurityException, NoSuchMethodException, IOException { public void testGetKeyPair() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("getNode", int.class); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("getNode", int.class);
HttpRequest request = processor.createRequest(method, 12); HttpRequest request = processor.createRequest(method, 12);
assertRequestLineEquals(request, "GET https://vcloud/extensions/nodeService/12 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud/extensions/nodeService/12 HTTP/1.1");
@ -392,7 +392,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testConfigureNode() throws SecurityException, NoSuchMethodException, IOException { public void testConfigureNode() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("configureNode", int.class, Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("configureNode", int.class,
NodeConfiguration.class); NodeConfiguration.class);
HttpRequest request = processor.createRequest(method, 12, new NodeConfiguration() HttpRequest request = processor.createRequest(method, 12, new NodeConfiguration()
.changeDescriptionTo("eggs")); .changeDescriptionTo("eggs"));
@ -412,7 +412,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testGetNodes() throws SecurityException, NoSuchMethodException, IOException { public void testGetNodes() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("getNodes", int.class); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("getNodes", int.class);
HttpRequest request = processor.createRequest(method, 12); HttpRequest request = processor.createRequest(method, 12);
assertRequestLineEquals(request, assertRequestLineEquals(request,
@ -428,7 +428,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testDeleteNode() throws SecurityException, NoSuchMethodException, IOException { public void testDeleteNode() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("deleteNode", int.class); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("deleteNode", int.class);
HttpRequest request = processor.createRequest(method, 12); HttpRequest request = processor.createRequest(method, 12);
assertRequestLineEquals(request, "DELETE https://vcloud/extensions/nodeService/12 HTTP/1.1"); assertRequestLineEquals(request, "DELETE https://vcloud/extensions/nodeService/12 HTTP/1.1");
@ -444,7 +444,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
public void testGetCustomizationOptionsOfCatalogItem() throws SecurityException, public void testGetCustomizationOptionsOfCatalogItem() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod( Method method = TerremarkVCloudExpressAsyncClient.class.getMethod(
"getCustomizationOptionsOfCatalogItem", String.class); "getCustomizationOptionsOfCatalogItem", String.class);
HttpRequest request = processor.createRequest(method, 12); HttpRequest request = processor.createRequest(method, 12);
@ -462,7 +462,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testListKeyPairs() throws SecurityException, NoSuchMethodException, IOException { public void testListKeyPairs() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("listKeyPairs"); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("listKeyPairs");
HttpRequest request = processor.createRequest(method); HttpRequest request = processor.createRequest(method);
assertRequestLineEquals(request, "GET https://keysList HTTP/1.1"); assertRequestLineEquals(request, "GET https://keysList HTTP/1.1");
@ -477,7 +477,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testListKeyPairsInOrg() throws SecurityException, NoSuchMethodException, IOException { public void testListKeyPairsInOrg() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("listKeyPairsInOrg", String.class); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("listKeyPairsInOrg", String.class);
HttpRequest request = processor.createRequest(method, "org1"); HttpRequest request = processor.createRequest(method, "org1");
assertRequestLineEquals(request, "GET https://vcloud/extensions/org/org1/keys HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud/extensions/org/org1/keys HTTP/1.1");
@ -492,7 +492,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
public void testGetNode() throws SecurityException, NoSuchMethodException, IOException { public void testGetNode() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("getNode", int.class); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("getNode", int.class);
HttpRequest request = processor.createRequest(method, 12); HttpRequest request = processor.createRequest(method, 12);
assertRequestLineEquals(request, "GET https://vcloud/extensions/nodeService/12 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud/extensions/nodeService/12 HTTP/1.1");
@ -531,7 +531,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
// } // }
public void testDeleteKeyPair() throws SecurityException, NoSuchMethodException, IOException { public void testDeleteKeyPair() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkVCloudAsyncClient.class.getMethod("deleteKeyPair", int.class); Method method = TerremarkVCloudExpressAsyncClient.class.getMethod("deleteKeyPair", int.class);
HttpRequest request = processor.createRequest(method, 12); HttpRequest request = processor.createRequest(method, 12);
assertRequestLineEquals(request, "DELETE https://vcloud/extensions/key/12 HTTP/1.1"); assertRequestLineEquals(request, "DELETE https://vcloud/extensions/key/12 HTTP/1.1");
@ -552,8 +552,8 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
} }
@Override @Override
protected TypeLiteral<RestAnnotationProcessor<TerremarkVCloudAsyncClient>> createTypeLiteral() { protected TypeLiteral<RestAnnotationProcessor<TerremarkVCloudExpressAsyncClient>> createTypeLiteral() {
return new TypeLiteral<RestAnnotationProcessor<TerremarkVCloudAsyncClient>>() { return new TypeLiteral<RestAnnotationProcessor<TerremarkVCloudExpressAsyncClient>>() {
}; };
} }
@ -564,14 +564,14 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
@Override @Override
public ContextSpec<?, ?> createContextSpec() { public ContextSpec<?, ?> createContextSpec() {
return new RestContextFactory().createContextSpec("terremark", "identity", "credential", return new RestContextFactory().createContextSpec("trmk-vcloudexpress", "identity", "credential",
new Properties()); new Properties());
} }
@RequiresHttp @RequiresHttp
@ConfiguresRestClient @ConfiguresRestClient
protected static class TerremarkVCloudRestClientModuleExtension extends protected static class TerremarkVCloudRestClientModuleExtension extends
TerremarkVCloudRestClientModule { TerremarkVCloudExpressRestClientModule {
@Override @Override
protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService, protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
@Named(PROPERTY_API_VERSION) String version) { @Named(PROPERTY_API_VERSION) String version) {

View File

@ -46,34 +46,34 @@ public class TerremarkVCloudClientLiveTest extends TerremarkClientLiveTest {
@Test @Test
public void testKeysList() throws Exception { public void testKeysList() throws Exception {
TerremarkVCloudClient tmVCloudClient = TerremarkVCloudClient.class.cast(tmClient); TerremarkVCloudExpressClient vCloudExpressClient = TerremarkVCloudExpressClient.class.cast(tmClient);
TerremarkOrganization org = tmVCloudClient.getDefaultOrganization(); TerremarkOrganization org = vCloudExpressClient.getDefaultOrganization();
Set<KeyPair> response = tmVCloudClient.listKeyPairs(); Set<KeyPair> response = vCloudExpressClient.listKeyPairs();
assertNotNull(response); assertNotNull(response);
System.err.println(response); System.err.println(response);
assertEquals(response, tmVCloudClient.listKeyPairsInOrg(org.getId())); assertEquals(response, vCloudExpressClient.listKeyPairsInOrg(org.getId()));
} }
@Override @Override
protected void prepare() { protected void prepare() {
TerremarkVCloudClient tmVCloudClient = TerremarkVCloudClient.class.cast(tmClient); TerremarkVCloudExpressClient vCloudExpressClient = TerremarkVCloudExpressClient.class.cast(tmClient);
TerremarkOrganization org = tmVCloudClient.getDefaultOrganization(); TerremarkOrganization org = vCloudExpressClient.getDefaultOrganization();
key = tmVCloudClient.generateKeyPairInOrg(org.getId(), "livetest", false); key = vCloudExpressClient.generateKeyPairInOrg(org.getId(), "livetest", false);
assertNotNull(key); assertNotNull(key);
System.err.println(key); System.err.println(key);
assertEquals(key.getName(), "livetest"); assertEquals(key.getName(), "livetest");
assertNotNull(key.getPrivateKey()); assertNotNull(key.getPrivateKey());
assertNotNull(key.getFingerPrint()); assertNotNull(key.getFingerPrint());
assertEquals(key.isDefault(), false); assertEquals(key.isDefault(), false);
assertEquals(key.getFingerPrint(), tmVCloudClient.getKeyPair(key.getId()).getFingerPrint()); assertEquals(key.getFingerPrint(), vCloudExpressClient.getKeyPair(key.getId()).getFingerPrint());
} }
@AfterTest @AfterTest
void cleanup1() throws InterruptedException, ExecutionException, TimeoutException { void cleanup1() throws InterruptedException, ExecutionException, TimeoutException {
if (key != null) { if (key != null) {
TerremarkVCloudClient tmVCloudClient = TerremarkVCloudClient.class.cast(tmClient); TerremarkVCloudExpressClient vCloudExpressClient = TerremarkVCloudExpressClient.class.cast(tmClient);
tmVCloudClient.deleteKeyPair(key.getId()); vCloudExpressClient.deleteKeyPair(key.getId());
} }
} }

View File

@ -29,7 +29,7 @@ import java.net.URI;
import java.util.Properties; import java.util.Properties;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.vcloud.terremark.TerremarkVCloudPropertiesBuilder; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressPropertiesBuilder;
import org.jclouds.vcloud.terremark.domain.NodeConfiguration; import org.jclouds.vcloud.terremark.domain.NodeConfiguration;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -53,8 +53,8 @@ public class BindNodeConfigurationToXmlPayloadTest {
@Override @Override
protected void configure() { protected void configure() {
Properties props = new Properties(); Properties props = new Properties();
Names.bindProperties(binder(), checkNotNull(new TerremarkVCloudPropertiesBuilder(props).build(), Names.bindProperties(binder(), checkNotNull(new TerremarkVCloudExpressPropertiesBuilder(
"properties")); props).build(), "properties"));
} }
}); });

View File

@ -35,7 +35,7 @@ import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VAppStatus; import org.jclouds.vcloud.domain.VAppStatus;
import org.jclouds.vcloud.domain.VAppTemplate; import org.jclouds.vcloud.domain.VAppTemplate;
import org.jclouds.vcloud.terremark.TerremarkVCloudClient; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptionToGetDefaultLoginCredentials; import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptionToGetDefaultLoginCredentials;
import org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions; import org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -56,7 +56,7 @@ public class TerremarkVCloudComputeClientTest {
String description = new String(ByteStreams.toByteArray(is)); String description = new String(ByteStreams.toByteArray(is));
VAppTemplate template = createMock(VAppTemplate.class); VAppTemplate template = createMock(VAppTemplate.class);
expect(template.getDescription()).andReturn(description).atLeastOnce(); expect(template.getDescription()).andReturn(description).atLeastOnce();
TerremarkVCloudClient client = createMock(TerremarkVCloudClient.class); TerremarkVCloudExpressClient client = createMock(TerremarkVCloudExpressClient.class);
expect(client.getVAppTemplate("templateId")).andReturn(template); expect(client.getVAppTemplate("templateId")).andReturn(template);
VApp vApp = createMock(VApp.class); VApp vApp = createMock(VApp.class);

View File

@ -30,8 +30,8 @@ import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest; import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
import org.jclouds.vcloud.terremark.TerremarkVCloudAsyncClient; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClient;
import org.jclouds.vcloud.terremark.TerremarkVCloudClient; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -49,7 +49,7 @@ public class TerremarkVCloudComputeServiceLiveTest extends VCloudComputeServiceL
String endpoint = System.getProperty("jclouds.test.endpoint"); String endpoint = System.getProperty("jclouds.test.endpoint");
if (endpoint != null && !"".equals(endpoint)) if (endpoint != null && !"".equals(endpoint))
System.setProperty("terremark.endpoint", endpoint); System.setProperty("terremark.endpoint", endpoint);
provider = "terremark"; provider = "trmk-vcloudexpress";
tag = "trmk"; tag = "trmk";
} }
@ -64,7 +64,7 @@ public class TerremarkVCloudComputeServiceLiveTest extends VCloudComputeServiceL
public void testAssignability() throws Exception { public void testAssignability() throws Exception {
@SuppressWarnings("unused") @SuppressWarnings("unused")
RestContext<TerremarkVCloudClient, TerremarkVCloudAsyncClient> tmContext = new ComputeServiceContextFactory() RestContext<TerremarkVCloudExpressClient, TerremarkVCloudExpressAsyncClient> tmContext = new ComputeServiceContextFactory()
.createContext(provider, identity, credential).getProviderSpecificContext(); .createContext(provider, identity, credential).getProviderSpecificContext();
} }

View File

@ -25,7 +25,7 @@ import static org.easymock.classextension.EasyMock.verify;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import org.jclouds.vcloud.terremark.TerremarkVCloudClient; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
import org.jclouds.vcloud.terremark.compute.domain.OrgAndName; import org.jclouds.vcloud.terremark.compute.domain.OrgAndName;
import org.jclouds.vcloud.terremark.domain.KeyPair; import org.jclouds.vcloud.terremark.domain.KeyPair;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -122,7 +122,7 @@ public class DeleteKeyPairTest {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private DeleteKeyPair setupStrategy() { private DeleteKeyPair setupStrategy() {
ConcurrentMap<OrgAndName, KeyPair> credentialsMap = createMock(ConcurrentMap.class); ConcurrentMap<OrgAndName, KeyPair> credentialsMap = createMock(ConcurrentMap.class);
TerremarkVCloudClient terremarkClient = createMock(TerremarkVCloudClient.class); TerremarkVCloudExpressClient terremarkClient = createMock(TerremarkVCloudExpressClient.class);
return new DeleteKeyPair(terremarkClient, credentialsMap); return new DeleteKeyPair(terremarkClient, credentialsMap);
} }

View File

@ -14,7 +14,7 @@ import org.jclouds.http.functions.ParseSax;
import org.jclouds.http.functions.config.ParserModule; import org.jclouds.http.functions.config.ParserModule;
import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.domain.internal.NamedResourceImpl; import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
import org.jclouds.vcloud.terremark.TerremarkVCloudMediaType; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressMediaType;
import org.jclouds.vcloud.terremark.TerremarkVCloudPropertiesBuilder; import org.jclouds.vcloud.terremark.TerremarkVCloudPropertiesBuilder;
import org.jclouds.vcloud.terremark.domain.TerremarkOrganization; import org.jclouds.vcloud.terremark.domain.TerremarkOrganization;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
@ -39,9 +39,8 @@ public class TerremarkOrgHandlerTest extends BaseHandlerTest {
public void configure() { public void configure() {
super.configure(); super.configure();
Properties props = new Properties(); Properties props = new Properties();
Names.bindProperties(binder(), checkNotNull( Names.bindProperties(binder(), checkNotNull(new TerremarkVCloudPropertiesBuilder(props)
new TerremarkVCloudPropertiesBuilder(props).build(), .build(), "properties"));
"properties"));
} }
}); });
factory = injector.getInstance(ParseSax.Factory.class); factory = injector.getInstance(ParseSax.Factory.class);
@ -53,55 +52,45 @@ public class TerremarkOrgHandlerTest extends BaseHandlerTest {
InputStream is = getClass().getResourceAsStream("/terremark/org.xml"); InputStream is = getClass().getResourceAsStream("/terremark/org.xml");
TerremarkOrganization result = (TerremarkOrganization) factory.create( TerremarkOrganization result = (TerremarkOrganization) factory.create(
injector.getInstance(TerremarkOrgHandler.class)).parse(is); injector.getInstance(TerremarkOrgHandler.class)).parse(is);
assertEquals(result.getName(), "adrian@jclouds.org"); assertEquals(result.getName(), "adrian@jclouds.org");
assertEquals(result.getId(), 48 + ""); assertEquals(result.getId(), 48 + "");
assertEquals(result.getLocation(), URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/org/48"));
assertEquals( assertEquals(
result.getLocation(), result.getCatalogs(),
URI ImmutableMap
.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/org/48")); .of(
assertEquals( "Miami Environment 1 Catalog",
result.getCatalogs(), new NamedResourceImpl(
ImmutableMap "catalog",
.of( "Miami Environment 1 Catalog",
"Miami Environment 1 Catalog", CATALOG_XML,
new NamedResourceImpl( URI
"catalog", .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32/catalog"))));
"Miami Environment 1 Catalog",
CATALOG_XML,
URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32/catalog"))));
assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new NamedResourceImpl(
"32", "Miami Environment 1", VCloudMediaType.VDC_XML,
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"))));
assertEquals( assertEquals(
result.getVDCs(), result.getTasksLists(),
ImmutableMap ImmutableMap
.of( .of(
"Miami Environment 1", "Miami Environment 1 Tasks List",
new NamedResourceImpl( new NamedResourceImpl(
"32", "tasksList",
"Miami Environment 1", "Miami Environment 1 Tasks List",
VCloudMediaType.VDC_XML, TASKSLIST_XML,
URI URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32")))); .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32/tasksList"))));
assertEquals( assertEquals(
result.getTasksLists(), result.getKeysList(),
ImmutableMap new NamedResourceImpl(
.of( "keys",
"Miami Environment 1 Tasks List", "Keys",
new NamedResourceImpl( TerremarkVCloudExpressMediaType.KEYSLIST_XML,
"tasksList", URI
"Miami Environment 1 Tasks List", .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/org/48/keys")));
TASKSLIST_XML,
URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32/tasksList"))));
assertEquals(
result.getKeysList(),
new NamedResourceImpl(
"keys",
"Keys",
TerremarkVCloudMediaType.KEYSLIST_XML,
URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/org/48/keys")));
} }
} }