public class ICP4DServiceImpl extends AbstractConnection implements ICP4DService
Constructor and Description |
---|
ICP4DServiceImpl(com.google.gson.JsonObject service,
boolean verify,
java.util.function.Function<org.apache.http.client.fluent.Executor,java.lang.String> authenticator) |
Modifier and Type | Method and Description |
---|---|
JobRunConfiguration |
createJobRun(JobDescription jobDescrition,
java.lang.String sabUrl,
com.google.gson.JsonArray jobConfigOverlaysArray)
Creates a Job run for a job description via REST.
|
java.lang.String |
getAuthorization()
Returns the Authorization header without the Authorization: keyword.
|
java.lang.String |
getJobsRestUrl()
Returns the REST URl for the jobs REST API, for example https://host.com/v2/jobs
|
JobDescription |
getOrCreateJobDescription(java.lang.String jobName,
java.lang.String spaceId,
java.lang.String projectId)
Gets or creates a CP4D job description associated with either a project or a deployment space.
|
DeploymentSpace |
getOrCreateSpace(java.lang.String spaceName)
Gets or creates a CP4D deployment space.
|
java.lang.String |
getSpaceIdForName(java.lang.String spaceName)
Gets the spaceId for a deployment space given by its name.
|
java.lang.String |
getSpacesRestUrl()
Returns the REST URl for the spaces REST API, for example https://host.com/v2/spaces
|
boolean |
isExternalClient()
true if the client is external to the CP4D.
|
void |
test()
Performs a GET request on the Spaces API to verify it is working
|
java.lang.String |
toString() |
allowInsecureHosts, getExecutor, getResponseString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
of
public ICP4DServiceImpl(com.google.gson.JsonObject service, boolean verify, java.util.function.Function<org.apache.http.client.fluent.Executor,java.lang.String> authenticator)
public java.lang.String getJobsRestUrl()
ICP4DService
getJobsRestUrl
in interface ICP4DService
ICP4DService.getJobsRestUrl()
public java.lang.String getSpacesRestUrl()
ICP4DService
getSpacesRestUrl
in interface ICP4DService
ICP4DService.getSpacesRestUrl()
public boolean isExternalClient()
isExternalClient
in interface ICP4DService
public void test() throws java.io.IOException
ICP4DService
test
in interface ICP4DService
java.io.IOException
public java.lang.String getSpaceIdForName(java.lang.String spaceName) throws java.io.IOException
getSpaceIdForName
in interface ICP4DService
spaceName
- the space namejava.io.IOException
public DeploymentSpace getOrCreateSpace(java.lang.String spaceName) throws java.io.IOException
getOrCreateSpace
in interface ICP4DService
spaceName
- the name of the deployment spacejava.io.IOException
ICP4DService.getOrCreateSpace(java.lang.String)
public JobDescription getOrCreateJobDescription(java.lang.String jobName, java.lang.String spaceId, java.lang.String projectId) throws java.io.IOException
getOrCreateJobDescription
in interface ICP4DService
jobName
- the name of the jobspaceId
- the space_id to associate the job with a deployment space. projectId must be null.projectId
- the project_id to associate the job with a project. space_id must be null.java.io.IOException
public JobRunConfiguration createJobRun(JobDescription jobDescrition, java.lang.String sabUrl, com.google.gson.JsonArray jobConfigOverlaysArray) throws java.io.IOException
createJobRun
in interface ICP4DService
jobDescrition
- the job descriptionsabUrl
- the URL of the Streams application bundlejobConfigOverlaysArray
- the job configurationsjava.io.IOException
com.ibm.streamsx.rest.internal.icp4d.ICP4DService#createJobRun(com.ibm.streamsx.rest.internal.icp4d.JobDescription, java.lang.String)
public java.lang.String getAuthorization()
getAuthorization
in class AbstractConnection
public java.lang.String toString()
toString
in class java.lang.Object