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
- 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 toTrue
, no exception will be set when attempting to find a nonexistent cluster.
- Returns:
One
Cluster
orNone
- create_cluster(**attrs)
Create a cluster from attributes
- restart_cluster(cluster)
Restart a cluster.
- 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 toTrue
, no exception will be set when attempting to delete a nonexistent cluster.
- Returns:
None
- update_cluster_name(cluster, new_name)
Update cluster name
- Parameters:
cluster – key id or an instance of
Cluster
new_name – new name for the CSS cluster
- Returns:
None
- update_cluster_password(cluster, new_password)
Update cluster password
- Parameters:
cluster – key id or an instance of
Cluster
new_password – new password for the CSS cluster
- Returns:
None
- update_cluster_flavor(cluster, new_flavor, node_type=None, check_replica=True)
Update cluster flavor
- Parameters:
cluster – key id or an instance of
Cluster
check_replica – indicates whether to verify replicas
new_flavor – ID of the new flavor
node_type – the type of node
- Returns:
None
- update_cluster_security_mode(cluster, https_enable=None, authority_enable=None, admin_pwd=None)
Update cluster security mode
- Parameters:
cluster – key id or an instance of
Cluster
authority_enable – indicates whether to enable the security mode
admin_pwd – cluster password in security mode
https_enable – indicates whether to enable HTTPS
- Returns:
None
- update_cluster_security_group(cluster, security_group_id)
Update cluster security group
- Parameters:
cluster – key id or an instance of
Cluster
security_group_id – new security group id for the CSS cluster
- Returns:
None
- update_cluster_kernel(cluster, target_image_id, upgrade_type, indices_backup_check, agency, cluster_load_check=False)
Update cluster kernel
- Parameters:
cluster – key id or an instance of
Cluster
target_image_id – ID of the target image version.
upgrade_type – upgrade type
indices_backup_check – indicates whether to perform backup verification
agency – agency name
cluster_load_check – indicates whether to verify the load
- Returns:
None
- get_cluster_version_upgrades(cluster, upgrade_type)
Get cluster version upgrade info
- Parameters:
cluster – key id or an instance of
Cluster
upgrade_type – version type
- Returns:
image info list
- scale_in_cluster(cluster, nodes)
Scale in a cluster by removing specified nodes
- Parameters:
cluster – key id or an instance of
Cluster
nodes – list of node id
- Returns:
None
- scale_in_cluster_by_node_type(cluster, nodes)
- Remove instances of specific types and reduce instance
storage capacity in a cluster
- Parameters:
cluster – key id or an instance of
Cluster
nodes – type and quantity of nodes Type and quantity of nodes to remove
- Returns:
None
- replace_cluster_node(cluster, node_id)
Replace a failed node
- Parameters:
cluster – key id or an instance of
Cluster
node_id – ID of the node to be replaced
- Returns:
None
- add_cluster_nodes(cluster, node_type, flavor, node_size, volume_type)
Add master and client nodes to a cluster
- Parameters:
cluster – key id or an instance of
Cluster
node_type – node type
flavor – flavor ID
node_size – number of nodes
volume_type – node storage type
- Returns:
None
- get_cluster_upgrade_status(cluster, **params)
Obtain the cluster updgrade details
- Parameters:
cluster – key id or an instance of
Cluster
return:None
- retry_cluster_upgrade_job(cluster, job_id, retry_mode=None)
Retry a task or terminate the impact of a task
- Parameters:
cluster – key id or an instance of
Cluster
job_id – ID of the task to be retried
retry_mode – if this parameter is not left blank, the impact of the task is terminated
- Returns:
None
- retry_cluster_upgrade_job(cluster, job_id, retry_mode=None)
Retry a task or terminate the impact of a task
- Parameters:
cluster – key id or an instance of
Cluster
job_id – ID of the task to be retried
retry_mode – if this parameter is not left blank, the impact of the task is terminated
- Returns:
None
Cluster Snapshot Operations¶
- class otcextensions.sdk.css.v1._proxy.Proxy(session, *args, **kwargs)
- snapshots(cluster)
List all Snapshots of a cluster.
- create_snapshot(cluster, **attrs)
Create a cluster Snapshot from attributes
- find_snapshot(cluster, name_or_id, ignore_missing=True)
Find a single snapshot
- Parameters:
cluster – key id or an instance of
Cluster
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 toTrue
, no exception will be set when attempting to find a nonexistent snapshot.
- Returns:
One
Snapshot
orNone
- delete_snapshot(cluster, snapshot, ignore_missing=True)
Delete a snapshot
- Parameters:
- Returns:
None
- set_snapshot_configuration(cluster, auto_configure=False, **attrs)
Setting Basic Configurations of a Cluster Snapshot
- Parameters:
- Returns:
None
- disable_snapshot_function(cluster)
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.
- 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.