Package com.teracloud.streams.rest
Class Instance
java.lang.Object
com.teracloud.streams.rest.Element
com.teracloud.streams.rest.Instance
An object describing an Streams Instance
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets information about the Streams Installation that was used to start this instanceStreams application console URL.long
Gets the time in milliseconds when this instance was createdGets the user ID that created this instanceGet the Streams domain for this instance.Gets the summarized status of jobs in this instancegetId()
Gets the Streams unique identifier for this instanceGets theJob
for a given jobId in this instancegetJobs()
Gets a list ofjobs
that this instance knows aboutgetOwner()
Gets the user ID that represents the owner of this instancegetPes()
Gets a list ofprocessing elements
for this instance.Gets the product version, please note that this is null for Streams version < 5.2Gets a list ofresource allocations
for this instance.Identifies the REST resource typelong
Gets the time in milliseconds when the instance was started.Gets the status of the instanceboolean
isProductVersionAtLeast
(int major, int minor) Tests if the instance has a minimum major.minor product version.Submit a Streams bundle to run.uploadBundle
(File bundle) Upload a Streams application bundle (sab) to the instance.Methods inherited from class com.teracloud.streams.rest.Element
getStreamsConnection, refresh, toString
-
Constructor Details
-
Instance
public Instance()
-
-
Method Details
-
getJobs
Gets a list ofjobs
that this instance knows about- Returns:
- List of
Streams Jobs
- Throws:
IOException
-
getPes
Gets a list ofprocessing elements
for this instance.- Returns:
- List of
Processing Elements
- Throws:
IOException
- Since:
- 1.9
-
getResourceAllocations
Gets a list ofresource allocations
for this instance.- Returns:
- List of
resource allocations
- Throws:
IOException
- Since:
- 1.9
-
getJob
Gets theJob
for a given jobId in this instance- Parameters:
jobId
- String identifying the job- Returns:
- a single
Job
- Throws:
IOException
-
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
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 versionminor
- 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
Gets the user ID that created this instance- Returns:
- the creation user ID
-
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
Gets the Streams unique identifier for this instance- Returns:
- the Streams unique idenitifer
-
getOwner
Gets the user ID that represents the owner of this instance- Returns:
- the owner user ID
-
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
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
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
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
Upload a Streams application bundle (sab) to the instance. Uploading a bundle allows job submission from the returnedApplicationBundle
.
Note: When an instance does not support uploading a bundle the returnedApplicationBundle
represents the local filebundle
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:Result.getId()
returning the job identifier ornull
if a job was not created..Result.getElement()
returning aJob
instance for the submitted job ornull
if a job was not created.Result.getRawResult()
return the raw JSON response.
- Parameters:
bundle
- A streams application bundlejco
- Job configuration overlay in JSON format.- Returns:
- Result of the job submission.
- Throws:
IOException
- Error communicating with the service.- Since:
- 1.11
-