org.jclouds.trmk.vcloud_0_8.compute
Class TerremarkVCloudComputeClient

java.lang.Object
  extended by org.jclouds.trmk.vcloud_0_8.compute.TerremarkVCloudComputeClient

@Singleton
public class TerremarkVCloudComputeClient
extends Object

Author:
Adrian Cole

Field Summary
protected  TerremarkVCloudClient client
           
protected  PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider
           
protected  Map<String,Credentials> credentialStore
           
protected  InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier
           
protected  Logger logger
           
protected  javax.inject.Provider<String> passwordGenerator
           
protected  com.google.common.base.Predicate<URI> taskTester
           
protected  Map<Status,NodeState> vAppStatusToNodeState
           
 
Constructor Summary
protected TerremarkVCloudComputeClient(TerremarkVCloudClient client, PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider, javax.inject.Provider<String> passwordGenerator, com.google.common.base.Predicate<URI> successTester, Map<Status,NodeState> vAppStatusToNodeState, Map<String,Credentials> credentialStore, InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier)
           
 
Method Summary
 String createPublicAddressMappedToPorts(URI vAppId, int... ports)
           
protected  void deleteVApp(VApp vApp)
           
 Set<String> getPrivateAddresses(URI id)
          returns a set of addresses that are only visible to the private network.
 Set<String> getPublicAddresses(URI id)
          returns a set of addresses that are publically visible
protected  Status getStatus(VApp vApp)
           
protected  Task powerOff(VApp vApp)
           
protected  VApp refreshVApp(URI id)
           
 void reset(URI id)
          reboots the vApp, blocking until the following state transition is complete:

current -> VAppStatus#OFF -> VAppStatus#ON

protected  Task reset(VApp vApp)
           
 VApp start(URI VDC, URI templateId, String name, InstantiateVAppTemplateOptions options, int... portsToOpen)
          Runs through all commands necessary to startup a vApp, opening at least one ip address to the public network.
 void stop(URI id)
          Destroys dependent resources, powers off and deletes the vApp, blocking until the following state transition is complete:

current -> VAppStatus#OFF -> deleted

* deletes the internet service and nodes associated with the vapp.

protected  Task undeploy(VApp vApp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

@Named(value="jclouds.compute")
protected Logger logger

client

protected final TerremarkVCloudClient client

credentialsProvider

protected final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider

passwordGenerator

protected final javax.inject.Provider<String> passwordGenerator

credentialStore

protected final Map<String,Credentials> credentialStore

internetServiceAndPublicIpAddressSupplier

protected final InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier

vAppStatusToNodeState

protected final Map<Status,NodeState> vAppStatusToNodeState

taskTester

protected final com.google.common.base.Predicate<URI> taskTester
Constructor Detail

TerremarkVCloudComputeClient

@Inject
protected TerremarkVCloudComputeClient(TerremarkVCloudClient client,
                                              PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
                                              @Named(value="PASSWORD")
                                              javax.inject.Provider<String> passwordGenerator,
                                              com.google.common.base.Predicate<URI> successTester,
                                              Map<Status,NodeState> vAppStatusToNodeState,
                                              Map<String,Credentials> credentialStore,
                                              InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier)
Method Detail

getStatus

protected Status getStatus(VApp vApp)

start

public VApp start(@Nullable
                  URI VDC,
                  URI templateId,
                  String name,
                  InstantiateVAppTemplateOptions options,
                  int... portsToOpen)
Runs through all commands necessary to startup a vApp, opening at least one ip address to the public network. These are the steps:

instantiate -> deploy -> powerOn

This command blocks until the vApp is in state VAppStatus#ON

Parameters:
VDC - id of the virtual datacenter VCloudClient#getDefaultVDC
templateId - id of the vAppTemplate you wish to instantiate
name - name of the vApp
cores - amount of virtual cpu cores
megs - amount of ram in megabytes
options - options for instantiating the vApp; null is ok
portsToOpen - opens the following ports on the public ip address
Returns:
map contains at least the following properties
  1. id - vApp id
  2. username - console login user
  3. password - console login password

createPublicAddressMappedToPorts

public String createPublicAddressMappedToPorts(URI vAppId,
                                               int... ports)

stop

public void stop(URI id)
Destroys dependent resources, powers off and deletes the vApp, blocking until the following state transition is complete:

current -> VAppStatus#OFF -> deleted

* deletes the internet service and nodes associated with the vapp. Deletes the IP address, if there are no others using it. Finally, it powers off and deletes the vapp. Note that we do not call undeploy, as terremark does not support the command.

Parameters:
vAppId - vApp to stop

getPrivateAddresses

public Set<String> getPrivateAddresses(URI id)
returns a set of addresses that are only visible to the private network.


getPublicAddresses

public Set<String> getPublicAddresses(URI id)
returns a set of addresses that are publically visible


reset

public void reset(URI id)
reboots the vApp, blocking until the following state transition is complete:

current -> VAppStatus#OFF -> VAppStatus#ON

Parameters:
vAppId - vApp to reboot

deleteVApp

protected void deleteVApp(VApp vApp)

refreshVApp

protected VApp refreshVApp(URI id)

powerOff

protected Task powerOff(VApp vApp)

reset

protected Task reset(VApp vApp)

undeploy

protected Task undeploy(VApp vApp)


Copyright © 2009-2011 jclouds. All Rights Reserved.