DWS API

The Data Warehouse Service Class

The dws high-level interface is available through the dws member of a Connection object. The dws member will only be added if the otcextensions.sdk.register_otc_extensions(conn) method is called.

Cluster Operations

class otcextensions.sdk.dws.v1._proxy.Proxy(session, *args, **kwargs)
clusters(**query)

List all Clusters.

Returns:

a generator of (Cluster) instances

get_cluster(cluster)

Get the cluster by UUID

Parameters:

cluster – key id or an instance of Cluster

Returns:

instance of Cluster

find_cluster(name_or_id, ignore_missing=False)

Find a single cluster

Parameters:
  • name_or_id – The name or ID of a DWS cluster

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised if the cluster does not exist. When set to True, no exception will be set when attempting to find a nonexistent cluster.

Returns:

One Cluster or None

create_cluster(**attrs)

Create a cluster from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Cluster, comprised of the properties on the Cluster class.

Returns:

The results of cluster creation

Return type:

Cluster

restart_cluster(cluster)

Get the cluster by UUID

Parameters:

cluster – key id or an instance of Cluster

Returns:

instance of Cluster

scale_out_cluster(cluster, node_count)

Scaling Out a Cluster Nodes

Parameters:
  • cluster – key id or an instance of Cluster

  • count – Number of nodes to be scaled out.

Returns:

instance of Cluster

reset_password(cluster, new_password)

Reset the password of cluster administrator.

Parameters:
  • cluster – key id or an instance of Cluster

  • new_password – New password of the GaussDB(DWS) cluster administrator.

Returns:

instance of Cluster

delete_cluster(cluster, keep_last_manual_snapshot=0, ignore_missing=False)

Delete a DWS Cluster

Parameters:
  • cluster – key id or an instance of Cluster

  • keep_last_manual_snapshot (int) – The number of latest manual snapshots that need to be retained for a cluster.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the cluster does not exist. When set to True, no exception will be set when attempting to delete a nonexistent cluster.

Returns:

None

cluster_tags(cluster)

List tags for a DWS cluster.

Parameters:

cluster – Cluster ID or an instance of otcextensions.sdk.dws.v1.cluster.Cluster.

Returns:

List of otcextensions.sdk.dws.v1.tag.Tag instances.

create_cluster_tag(cluster, tag)

Create a new tag for a DWS cluster.

Parameters:
  • cluster – Cluster ID or an instance of otcextensions.sdk.dws.v1.cluster.Cluster.

  • tag – Dictionary with ‘key’ and ‘value’ for the tag.

Returns:

Created tag instance.

delete_cluster_tag(cluster, tag_key, ignore_missing=True)

Delete a single tag from a DWS cluster.

Parameters:
  • cluster – Cluster ID or an instance of otcextensions.sdk.dws.v1.cluster.Cluster.

  • tag_key – The key of the tag to be deleted.

  • ignore_missing – When False, openstack.exceptions.ResourceNotFound will be raised when the tag does not exist. When True, no exception will be set when attempting to delete a nonexistent tag.

Returns:

None

batch_create_cluster_tags(cluster, tags)

Batch addition of tags for a cluster.

Parameters:
  • cluster – Cluster ID or an instance of otcextensions.sdk.dws.v1.cluster.Cluster.

  • tags – List of dictionaries of tags to add.

Returns:

A list of created otcextensions.sdk.dws.v1.tag.Tag instances.

batch_delete_cluster_tags(cluster, tags)

Batch deletion of tags from a cluster.

Parameters:
  • cluster – Cluster ID or an instance of otcextensions.sdk.dws.v1.cluster.Cluster.

  • tags – List of dictionaries of tags to delete.

Returns:

A list of deleted otcextensions.sdk.dws.v1.tag.Tag instances.

Cluster Snapshot Operations

class otcextensions.sdk.dws.v1._proxy.Proxy(session, *args, **kwargs)
snapshots()

List all Snapshots of a cluster.

Returns:

a generator of (Snapshot) instances

get_snapshot(snapshot)

Get a Snapshot details

Parameters:

snapshot – key id or an instance of Snapshot

Returns:

instance of Snapshot

find_snapshot(name_or_id, ignore_missing=False)

Find a single snapshot

Parameters:
  • name_or_id – The name or ID of a snapshot

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised if the snapshot does not exist. When set to True, no exception will be set when attempting to find a nonexistent snapshot.

Returns:

One Snapshot or None

create_snapshot(**attrs)

Create a cluster Snapshot from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Snapshot, comprised of the properties on the Snapshot class.

Returns:

The results of cluster snapshot creation

Return type:

Snapshot

create_snapshot(**attrs)

Create a cluster Snapshot from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Snapshot, comprised of the properties on the Snapshot class.

Returns:

The results of cluster snapshot creation

Return type:

Snapshot

delete_snapshot(snapshot, ignore_missing=False)

Delete a snapshot

Parameters:
  • snapshot – key id or an instance of Snapshot

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the snapshot does not exist. When set to True, no exception will be set when attempting to delete a nonexistent snapshot.

Returns:

None

restore_snapshot(snapshot, **attrs)

Restore a snapshot.

Parameters:
  • snapshot – key id or an instance of Snapshot

  • attrs (dict) – Keyword arguments which will be used to create a Restore, comprised of the properties on the Restore class.

Returns:

instance of Cluster

Cluster Flavor Operations

class otcextensions.sdk.dws.v1._proxy.Proxy(session, *args, **kwargs)
flavors()

List all Flavors.

Returns:

a generator of (Flavor) instances