Class Instance

java.lang.Object
com.teracloud.streams.rest.Element
com.teracloud.streams.rest.Instance

public class Instance extends Element
An object describing an Streams Instance
  • Constructor Details

    • Instance

      public Instance()
  • Method Details

    • getJobs

      public List<Job> getJobs() throws IOException
      Gets a list of jobs that this instance knows about
      Returns:
      List of Streams Jobs
      Throws:
      IOException
    • getPes

      public List<ProcessingElement> getPes() throws IOException
      Gets a list of processing elements for this instance.
      Returns:
      List of Processing Elements
      Throws:
      IOException
      Since:
      1.9
    • getResourceAllocations

      public List<ResourceAllocation> getResourceAllocations() throws IOException
      Gets a list of resource allocations for this instance.
      Returns:
      List of resource allocations
      Throws:
      IOException
      Since:
      1.9
    • getJob

      public Job getJob(String jobId) throws IOException
      Gets the Job for a given jobId in this instance
      Parameters:
      jobId - String identifying the job
      Returns:
      a single Job
      Throws:
      IOException
    • getActiveVersion

      public ActiveVersion getActiveVersion()
      Gets information about the Streams Installation that was used to start this instance
      Returns:
      ActiveVersion. Please note that Streams version >= 5.x does not have this element.
    • getProductVersion

      public String getProductVersion()
      Gets the product version, please note that this is null for Streams version < 5.2
    • isProductVersionAtLeast

      public boolean isProductVersionAtLeast(int major, int minor)
      Tests if the instance has a minimum major.minor product version.
      Parameters:
      major - The minimum major version
      minor - the minimum minor version
      Returns:
      true if the product version is at least the major and minor version. When the version cannot be found in the REST object, false is returned.
    • getCreationTime

      public long getCreationTime()
      Gets the time in milliseconds when this instance was created
      Returns:
      the epoch time in milliseconds when the instance was created as a long
    • getCreationUser

      public String getCreationUser()
      Gets the user ID that created this instance
      Returns:
      the creation user ID
    • getHealth

      public String getHealth()
      Gets the summarized status of jobs in this instance
      Returns:
      the summarized status that contains one of the following values:
      • healthy
      • partiallyHealthy
      • partiallyUnhealthy
      • unhealthy
      • unknown
    • getId

      public String getId()
      Gets the Streams unique identifier for this instance
      Returns:
      the Streams unique idenitifer
    • getOwner

      public String getOwner()
      Gets the user ID that represents the owner of this instance
      Returns:
      the owner user ID
    • getResourceType

      public String getResourceType()
      Identifies the REST resource type
      Returns:
      "instance"
    • getStartTime

      public long getStartTime()
      Gets the time in milliseconds when the instance was started.
      Returns:
      the epoch time in milliseconds when the instance was started as a long
    • getStatus

      public String getStatus()
      Gets the status of the instance
      Returns:
      the instance status that contains one of the following values:
      • running
      • failed
      • stopped
      • partiallyFailed
      • partiallyRunning
      • starting
      • stopping
      • unknown
    • getApplicationConsoleURL

      public String getApplicationConsoleURL()
      Streams application console URL. Returns the Streams application console URL with a filter preset to this instance identifier.
      Returns:
      Streams application console URL
      Since:
      1.11
    • getDomain

      public Domain getDomain() throws IOException
      Get the Streams domain for this instance.
      Returns:
      Domain for this instance.ull if no domain is associated with an instance.
      Throws:
      IOException - Error communicating with REST api.
      Since:
      1.8
    • uploadBundle

      public ApplicationBundle uploadBundle(File bundle) throws IOException
      Upload a Streams application bundle (sab) to the instance. Uploading a bundle allows job submission from the returned ApplicationBundle.
      Note: When an instance does not support uploading a bundle the returned ApplicationBundle represents the local file bundle tied to this instance. The returned object may still be used for job submission.
      Parameters:
      bundle - path to a Streams application bundle (sab file) containing the application to be uploaded
      Returns:
      Application bundle representing the uploaded bundle.
      Throws:
      IOException - Error uploading the bundle.
      Since:
      1.11
    • submitJob

      public Result<Job,com.google.gson.JsonObject> submitJob(File bundle, com.google.gson.JsonObject jco) throws IOException
      Submit a Streams bundle to run.

      The returned Result instance has:

      Parameters:
      bundle - A streams application bundle
      jco - Job configuration overlay in JSON format.
      Returns:
      Result of the job submission.
      Throws:
      IOException - Error communicating with the service.
      Since:
      1.11