com.ibm.streamsx.rest.internal.icp4d

Interface ICP4DService

  • All Known Implementing Classes:
    ICP4DServiceImpl


    public interface ICP4DService
    Represents the REST service of the ICP4D platform. Abstracts the REST API of the CP4D. Use this interface only with CP4D >= 3.5 and Streams >= 5.5.
    Since:
    1.17
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      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
      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, false otherwise.
      static ICP4DService of(com.google.gson.JsonObject service, boolean verify)
      Creates a new ICP4DService instance from the service definition JSON object.
      void test()
      Performs a GET request on the Spaces API to verify it is working
    • Method Detail

      • of

        static ICP4DService of(com.google.gson.JsonObject service,
                               boolean verify)
        Creates a new ICP4DService instance from the service definition JSON object. CP4D must be at least version 3.5.
        Parameters:
        service - the service definition object 'topology.service.definition'
        Returns:
        a new Service instance
      • getJobsRestUrl

        java.lang.String getJobsRestUrl()
        Returns the REST URl for the jobs REST API, for example https://host.com/v2/jobs
        Returns:
        the URL for the Jobs API
      • getSpacesRestUrl

        java.lang.String getSpacesRestUrl()
        Returns the REST URl for the spaces REST API, for example https://host.com/v2/spaces
        Returns:
        the URL for the Jobs API
      • isExternalClient

        boolean isExternalClient()
        true if the client is external to the CP4D, false otherwise.
        Returns:
      • test

        void test()
           throws java.io.IOException
        Performs a GET request on the Spaces API to verify it is working
        Throws:
        java.io.IOException - test failed
      • getSpaceIdForName

        java.lang.String getSpaceIdForName(java.lang.String spaceName)
                                    throws java.io.IOException
        Gets the spaceId for a deployment space given by its name.
        Parameters:
        spaceName - the space name
        Returns:
        the space ID or null if the space name doesn't exist.
        Throws:
        java.io.IOException
      • getOrCreateSpace

        DeploymentSpace getOrCreateSpace(java.lang.String spaceName)
                                  throws java.io.IOException
        Gets or creates a CP4D deployment space.
        Parameters:
        spaceName - the name of the deployment space
        Returns:
        the Space object.
        Throws:
        java.io.IOException
      • getOrCreateJobDescription

        JobDescription getOrCreateJobDescription(java.lang.String jobName,
                                                 java.lang.String spaceId,
                                                 java.lang.String projectId)
                                          throws java.io.IOException
        Gets or creates a CP4D job description associated with either a project or a deployment space.
        Parameters:
        jobName - the name of the job
        spaceId - 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.
        Returns:
        the Job object.
        Throws:
        java.io.IOException
      • createJobRun

        JobRunConfiguration createJobRun(JobDescription jobDescrition,
                                         java.lang.String sabUrl,
                                         com.google.gson.JsonArray jobConfigOverlaysArray)
                                  throws java.io.IOException
        Creates a Job run for a job description
        Parameters:
        jobDescrition - the job description
        sabUrl - the URL of the Streams application bundle
        jobConfigOverlaysArray - the job configurations
        Returns:
        a JobRunConfiguration instance
        Throws:
        java.io.IOException
streamsx.topology 2.1 @ IBMStreams GitHub