hudson.plugins.ec2
Class EC2Computer

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Actionable
          extended by hudson.model.Computer
              extended by hudson.slaves.SlaveComputer
                  extended by hudson.plugins.ec2.EC2Computer
All Implemented Interfaces:
hudson.model.ExecutorListener, hudson.model.ModelObject, hudson.search.SearchableModelObject, hudson.search.SearchItem, hudson.security.AccessControlled

public class EC2Computer
extends hudson.slaves.SlaveComputer

Author:
Kohsuke Kawaguchi

Field Summary
 
Fields inherited from class hudson.model.Computer
CONFIGURE, DELETE, nodeName, offlineCause, PERMISSIONS, threadPoolForRemoting
 
Constructor Summary
EC2Computer(EC2Slave slave)
           
 
Method Summary
 com.amazonaws.services.ec2.model.Instance describeInstance()
          Obtains the instance state description in EC2.
 org.kohsuke.stapler.HttpResponse doDoDelete()
          When the slave is deleted, terminate the instance.
 String getConsoleOutput()
          Gets the EC2 console output.
 String getInstanceId()
           
 EC2Slave getNode()
           
 String getRemoteAdmin()
          What username to use to run root-like commands
 String getRootCommandPrefix()
           
 int getSshPort()
           
 InstanceState getState()
          Gets the current state of the instance.
 long getUptime()
          Number of milli-secs since the instance was started.
 String getUptimeString()
          Returns uptime in the human readable form.
 com.amazonaws.services.ec2.model.Instance updateInstanceDescription()
          This will flush any cached description held by describeInstance().
 
Methods inherited from class hudson.slaves.SlaveComputer
_connect, disconnect, doDoDisconnect, doLaunchSlaveAgent, getChannel, getChannelToMaster, getDefaultCharset, getIcon, getJnlpJars, getLauncher, getLogRecords, getRetentionStrategy, grabLauncher, isAcceptingTasks, isConnecting, isJnlpAgent, isLaunchSupported, isUnix, kill, openLogFile, setAcceptingTasks, setChannel, setChannel, setNode, taskAccepted, taskCompleted, taskCompletedWithProblems, tryReconnect
 
Methods inherited from class hudson.model.Computer
_doScript, checkPermission, cliConnect, cliDisconnect, cliOffline, cliOnline, connect, countBusy, countExecutors, countIdle, currentComputer, disconnect, doConfigSubmit, doDeleteWithParam, doDumpExportTable, doProgressiveLog, doRssAll, doRssFailed, doScript, doScriptText, doToggleOffline, getACL, getApi, getBuilds, getBusyCount, getCaption, getConnectTime, getDemandStartMilliseconds, getDisplayName, getEnvironment, getEnvVars, getExecutors, getExecutorsCount, getHeapDump, getHostName, getIconAltText, getIdleCount, getIdleStartMilliseconds, getLoadStatistics, getLog, getLogFile, getLogText, getMonitorData, getName, getNumExecutors, getOfflineCause, getOneOffExecutors, getOneOffExecutorsCount, getRunningJobs, getSearchUrl, getSystemProperties, getThreadDump, getTiedJobs, getTimeline, getUrl, getWorkspaceList, hasPermission, interrupt, isIdle, isManualLaunchAllowed, isOffline, isOnline, isTemporarilyOffline, launch, setTemporarilyOffline, setTemporarilyOffline
 
Methods inherited from class hudson.model.Actionable
addAction, getAction, getAction, getActions, getActions, getDynamic
 
Methods inherited from class hudson.model.AbstractModelObject
getConfiguredHudsonProperty, getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EC2Computer

public EC2Computer(EC2Slave slave)
Method Detail

getNode

public EC2Slave getNode()
Overrides:
getNode in class hudson.slaves.SlaveComputer

getInstanceId

public String getInstanceId()

getConsoleOutput

public String getConsoleOutput()
                        throws com.amazonaws.AmazonClientException
Gets the EC2 console output.

Throws:
com.amazonaws.AmazonClientException

describeInstance

public com.amazonaws.services.ec2.model.Instance describeInstance()
                                                           throws com.amazonaws.AmazonClientException
Obtains the instance state description in EC2.

This method returns a cached state, so it's not suitable to check Instance.getState() and Instance#getStateCode() from the returned instance (but all the other fields are valid as it won't change.) The cache can be flushed using updateInstanceDescription()

Throws:
com.amazonaws.AmazonClientException

updateInstanceDescription

public com.amazonaws.services.ec2.model.Instance updateInstanceDescription()
                                                                    throws com.amazonaws.AmazonClientException
This will flush any cached description held by describeInstance().

Throws:
com.amazonaws.AmazonClientException

getState

public InstanceState getState()
                       throws com.amazonaws.AmazonClientException
Gets the current state of the instance.

Unlike describeInstance(), this method always return the current status by calling EC2.

Throws:
com.amazonaws.AmazonClientException

getUptime

public long getUptime()
               throws com.amazonaws.AmazonClientException
Number of milli-secs since the instance was started.

Throws:
com.amazonaws.AmazonClientException

getUptimeString

public String getUptimeString()
                       throws com.amazonaws.AmazonClientException
Returns uptime in the human readable form.

Throws:
com.amazonaws.AmazonClientException

doDoDelete

public org.kohsuke.stapler.HttpResponse doDoDelete()
                                            throws IOException
When the slave is deleted, terminate the instance.

Overrides:
doDoDelete in class hudson.model.Computer
Throws:
IOException

getRemoteAdmin

public String getRemoteAdmin()
What username to use to run root-like commands


getSshPort

public int getSshPort()

getRootCommandPrefix

public String getRootCommandPrefix()


Copyright © 2004-2012 Hudson. All Rights Reserved.