streamsx.build

REST API bindings for IBM® Streams Cloud Pak for Data build service.

Streams Build REST API

The REST Build API provides programmatic support for creating, submitting and managing Streams builds. You can use the REST Build API from any application that can establish an HTTPS connection to the server that is running the build service. The current support includes methods for managing toolkits in the build service and for retrieving base images for Edge image builds.

Cloud Pak for Data

of_endpoint() or of_service() is the entry point to using the Streams Build REST API bindings, returning a BuildService.

Module contents

Classes

BuildService

IBM Streams build service.

class streamsx.build.BuildService(username=None, password=None, resource_url=None, buildpools_url=None, auth=None)

Bases: streamsx.rest._AbstractStreamsConnection

IBM Streams build service.

An instance of a BuildService is created using of_endpoint() or of_service().

New in version 1.13.

get_base_images()

Retrieves a list of all installed base images for Edge applications.

Returns

List of all base images, None if there are no base images

Return type

list of BaseImage

New in version 1.15.

get_resources()

Retrieves a list of all known Streams high-level Build REST resources.

Returns

List of all Streams high-level Build REST resources.

Return type

list of RestResource

get_toolkit(id)

Retrieves available toolkit matching a specific toolkit ID.

Parameters

id (str) – Toolkit identifier to retrieve. This is the name and version of a toolkit. For sample, com.ibm.streamsx.rabbitmq-1.1.3

Returns

Toolkit matching id.

Return type

Toolkit

Raises

ValueError – No matching toolkit exists.

get_toolkits(name=None)

Retrieves a list of all installed Streams Toolkits.

Returns

List of all Toolkit resources.

Return type

list of Toolkit

Parameters

name (str) – Return toolkits matching name as a regular expression.

static of_endpoint(endpoint=None, service_name=None, username=None, password=None, verify=None)

Connect to a Cloud Pak for Data IBM Streams build service instance.

Two configurations are supported.

Integrated configuration

The build service is bound to a Streams instance and is defined using the Cloud Pak for Data deployment endpoint (URL) and the Streams service name.

The endpoint is passed in as endpoint defaulting the the environment variable CP4D_URL. An example is https://cp4d_server:31843.

The Streams service name is passed in as service_name defaulting to the environment variable STREAMS_INSTANCE_ID.

Standalone configuration

A build service is independent of a Streams instance and is defined using the build service endpoint.

The endpoint is passed in as endpoint defaulting the the environment variable STREAMS_BUILD_URL. An example is https://build_service:34679.

No service name is specified thus service_name should be passed as None or not set.

Parameters
  • endpoint (str) – Endpoint defining the build service.

  • service_name (str) – Streams instance name for a integrated configuration. This value is ignored for a standalone configuration.

  • username (str) – User name to authenticate as. Defaults to the environment variable STREAMS_USERNAME or the operating system identifier if not set.

  • password (str) – Password for authentication. Defaults to the environment variable STREAMS_PASSWORD or the operating system identifier if not set.

  • verify – SSL verification. Set to False to disable SSL verification. Defaults to SSL verification being enabled.

Returns

Connection to Streams build service or None if insufficient configuration was provided.

Return type

BuildService

static of_service(config)

Connect to a Cloud Pak for Data IBM Streams build service instance.

The instance is specified in config. The configuration may be code injected from the list of services in a Jupyter notebook running in ICPD or manually created. The code that selects a service instance by name is:

from icpd_core import ipcd_util
cfg = icpd_util.get_service_details(name='instanceName', instance_type='streams')

buildService = BuildService.of_service(cfg)

SSL host verification is disabled by setting SSL_VERIFY to False within config before calling this method:

from icpd_core import ipcd_util
cfg = icpd_util.get_service_details(name='instanceName', instance_type='streams')

cfg[ConfigParams.SSL_VERIFY] = False
buildService = BuildService.of_service(cfg)
Parameters

config (dict) – Configuration of IBM Streams service instance.

Returns

Connection to Streams build service.

Return type

BuildService

Note

Only supported when running within the ICPD cluster, for example in a Jupyter notebook within an ICPD project.

New in version 1.15.

property resource_url

Endpoint URL for IBM Streams REST build API.

Type

str

upload_toolkit(path)

Upload a toolkit from a directory in the local filesystem to the Streams build service.

Multiple versions of a toolkit may be uploaded as long as each has a unique version. If a toolkit is uploaded with a name and version matching an existing toolkit, it will not replace the existing toolkit, and None will be returned.

Parameters

path (str) – The path to the toolkit directory in the local filesystem.

Returns

The created Toolkit, or None if it was not uploaded.

Return type

Toolkit