Class EC2Computer

All Implemented Interfaces:
ExtensionPoint, DescriptorByNameOwner, ExecutorListener, ModelObject, SearchableModelObject, SearchItem, AccessControlled, ModelObjectWithContextMenu, HasWidgets, org.kohsuke.stapler.StaplerProxy

public class EC2Computer extends SlaveComputer
Author:
Kohsuke Kawaguchi
  • Constructor Details

  • Method Details

    • getNode

      public EC2AbstractSlave getNode()
      Overrides:
      getNode in class SlaveComputer
    • getInstanceId

      @CheckForNull public String getInstanceId()
    • getEc2Type

      public String getEc2Type()
    • getSpotInstanceRequestId

      public String getSpotInstanceRequestId()
    • getCloud

      public EC2Cloud getCloud()
    • getSlaveTemplate

      @CheckForNull public SlaveTemplate getSlaveTemplate()
    • getConsoleOutput

      public String getConsoleOutput() throws software.amazon.awssdk.core.exception.SdkException
      Gets the EC2 console output.
      Throws:
      software.amazon.awssdk.core.exception.SdkException
    • getDecodedConsoleOutput

      public String getDecodedConsoleOutput() throws software.amazon.awssdk.core.exception.SdkException
      Gets the EC2 decoded console output.
      Throws:
      software.amazon.awssdk.core.exception.SdkException
      Since:
      TODO
    • describeInstance

      public software.amazon.awssdk.services.ec2.model.Instance describeInstance() throws software.amazon.awssdk.core.exception.SdkException, InterruptedException
      Obtains the instance state description in EC2.

      This method returns a cached state, so it's not suitable to check Instance.state() from the returned instance (but all the other fields are valid as it won't change.)

      The cache can be flushed using updateInstanceDescription()

      Throws:
      software.amazon.awssdk.core.exception.SdkException
      InterruptedException
    • updateInstanceDescription

      public software.amazon.awssdk.services.ec2.model.Instance updateInstanceDescription() throws software.amazon.awssdk.core.exception.SdkException, InterruptedException
      This will flush any cached description held by describeInstance().
      Throws:
      software.amazon.awssdk.core.exception.SdkException
      InterruptedException
    • getState

      public InstanceState getState() throws software.amazon.awssdk.core.exception.SdkException, InterruptedException
      Gets the current state of the instance.

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

      Throws:
      software.amazon.awssdk.core.exception.SdkException
      InterruptedException
    • getUptime

      public long getUptime() throws software.amazon.awssdk.core.exception.SdkException, InterruptedException
      Number of milli-secs since the instance was started.
      Throws:
      software.amazon.awssdk.core.exception.SdkException
      InterruptedException
    • getUptimeString

      public String getUptimeString() throws software.amazon.awssdk.core.exception.SdkException, InterruptedException
      Returns uptime in the human readable form.
      Throws:
      software.amazon.awssdk.core.exception.SdkException
      InterruptedException
    • getLaunchTime

      public Instant getLaunchTime() throws InterruptedException
      Return the Instant this instance was launched
      Returns:
      Instant this instance was launched
      Throws:
      InterruptedException
    • doDoDelete

      @POST public org.kohsuke.stapler.HttpResponse doDoDelete() throws IOException
      When the agent is deleted, terminate the instance.
      Overrides:
      doDoDelete in class Computer
      Throws:
      IOException
    • getRemoteAdmin

      @CheckForNull public String getRemoteAdmin()
      What username to use to run root-like commands
      Returns:
      remote admin or null if the associated Node is null
    • getSshPort

      public int getSshPort()
    • getRootCommandPrefix

      public String getRootCommandPrefix()
    • getSlaveCommandPrefix

      public String getSlaveCommandPrefix()
    • getSlaveCommandSuffix

      public String getSlaveCommandSuffix()
    • onConnected

      public void onConnected()