CSS API

The Cloud Search Service Class

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

Cluster Operations

class otcextensions.sdk.css.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=True)

Find a single cluster

Parameters:
  • name_or_id – The name or ID of a CSS 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:

None

extend_cluster(cluster, add_nodes)

Scaling Out a Cluster with only Common Nodes

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

  • add_nodes – Number of common nodes to be scaled out.

Returns:

None

extend_cluster_nodes(cluster, **attrs)

Scaling Out a Cluster with Special Nodes

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

  • data – Cluster scale-out request data.

Returns:

None

delete_cluster(cluster, ignore_missing=True)

Delete a cluster

Parameters:
  • cluster – The value can be the ID of a cluster or a Cluster instance.

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

Returns:

None

Cluster Snapshot Operations

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

List all Snapshots of a cluster.

Parameters:

cluster – key id or an instance of Cluster

Returns:

a generator of (Snapshot) instances

create_snapshot(cluster, **attrs)

Create a cluster Snapshot from attributes

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

  • 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(cluster, snapshot, ignore_missing=True)

Delete a snapshot

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

  • 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

set_snapshot_configuration(cluster, auto_configure=False, **attrs)

Setting Basic Configurations of a Cluster Snapshot

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

  • auto_configure (bool) – When set to True Basic Configurations of a Cluster Snapshot will be set automatically.

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

Returns:

None

disable_snapshot_function(cluster, ignore_missing=False)

Disable the snapshot function of a cluster.

Parameters:

cluster – key id or an instance of Cluster

Returns:

None

set_snapshot_policy(cluster, **attrs)

Set parameters related to automatic snapshot creation.

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

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

Returns:

None

get_snapshot_policy(cluster)

Query the automatic snapshot creation policy for a cluster.

Parameters:

cluster – key id or an instance of Cluster

Returns:

instance of SnapshotPolicy

restore_snapshot(cluster, snapshot, **attrs)

Restore a snapshot.

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

  • snapshot – key id or an instance of Snapshot

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

Returns:

None