Service Instances#

A service instance is a provisioned instance of a Cloud Pak for Data service that allows you to execute and manage workloads, such as jobs and flows, through its dedicated compute resources.

The SDK provides functionality to interact with service instances on the watsonx.data integration platform.

This includes operations such as:
  • Creating Service Instances

  • Retrieving Service Instances

  • Deleting Service Instances

Note

Working with service instances is only supported on Cloud Pak for Data SaaS.

Creating Service Instances#

To create a new Service object within the watsonx.data integration platform, use the Platform.create_service_instance() method.

You must specify instance_type and name. Optionally, you can also specify target and tags.

>>> service_instance = platform.create_service_instance(
...     instance_type='datastage',
...     name='My Datastage Service Instance',
...     target='us-south',
...     tags=['DatastageInstance']
... )

Retrieving Service Instances#

To retrieve existing service instances, use the service_instances property of the Platform class. This returns a Services object.

>>> # Returns a CollectionModel of all service instances
>>> service_instances = platform.service_instances

>>> # Returns a CollectionModel of the first five service instances
>>> service_instances = platform.service_instances.get_all(limit=5)

Deleting Service Instances#

To delete a service instance, pass the Service object you want to delete to the Platform.delete_service_instance() method.

This method returns an HTTP response indicating the status of the delete operation.

>>> service_instance = platform.service_instances.get(name='My Datastage Service Instance')
>>> platform.delete_service_instance(service_instance)