Document Database (DDS) API

For details on how to use dds, see /sdk/guides/dds (NEEDS TO BE DONE)

The DDS Class

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

Datastore Operations

class otcextensions.sdk.dds.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
datastore_types()

List supported datastore types

Returns:

A generator of supported datastore types

datastores(datastore_name)

List datastores

Parameters:

datastore_name – database store name (currently only DDS-Community and is case-sensitive.)

Returns:

A generator of supported datastore versions.

Return type:

Datastore

Flavor Operations

class otcextensions.sdk.dds.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
flavors(region, engine_name)

List flavors of all DB instances specifications in specified region

Parameters:
  • engine_name – database engine name

  • region – region

Returns:

A generator of flavor

Return type:

Flavor

Instance Operations

class otcextensions.sdk.dds.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_instance(**attrs)

Create a new instance from attributes

Parameters:

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

Returns:

The result of an instance creation.

Return type:

Instance

restart_instance(instance)

Restart an existing instance

Parameters:

instance – The value can be either the ID of an instance or a Instance instance.

Returns:

job ID.

Return type:

Instance

enlarge_instance(instance, size, group_id=None)

Enlarge storage space of a DB instance

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

  • size – New instance size.

  • group_id – ID of the group to enlarge storage space.

Returns:

job ID.

Return type:

Instance

add_instance_nodes(instance, **attrs)

Add nodes for a specific instance

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

  • attrs (dict) – Keyword arguments which will be used to add node to a Instance.

Returns:

job ID.

Return type:

Instance

resize_instance(instance, **attrs)

Change specifications of a DB instance

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

  • attrs (dict) – Keyword arguments which will be used to add node to a Instance.

Returns:

job ID.

Return type:

Instance

switchover_instance(instance)

Perform a primary/secondary switchover in a replica set instance.

Parameters:

instance – The value can be either the ID of an instance or a Instance instance.

Returns:

job ID.

Return type:

Instance

enable_instance_ssl(instance, enable=True)

Enable SSL in a replica set instance.

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

  • enable (bool) – enable or disable

Returns:

job ID.

Return type:

Instance

change_instance_name(instance, name)

Change name of a DB instance

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

  • name – New name of an instance

Return type:

Instance

change_instance_port(instance, port)

Change port of a DB instance

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

  • port – New port of an instance

Returns:

DB instance object.

Return type:

Instance

change_instance_security_group(instance, security_group_id)

Change security group of a DB instance

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

  • security_group_id – New security group ID

Returns:

job ID.

Return type:

Instance

change_instance_private_ip(instance, **attrs)

Change private IP of a DB instance

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

  • attrs (dict) – Keyword arguments which will be used to change ip.

Returns:

job ID.

Return type:

Instance

create_instance_ip(instance, **attrs)

Add IP for a DB instance

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

  • attrs (dict) – Keyword arguments which will be used to add ip

Returns:

workflow ID.

Return type:

Instance

configure_client_network(instance, network_ranges)

Configure client network of a DB instance :param instance: The value can be either the ID of an instance or a Instance instance. :param list network_ranges: List of network ranges

Returns:

workflow ID.

Return type:

Instance

delete_instance(instance, ignore_missing=True)

Delete an instance

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

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

Returns:

None

get_instance(instance)

Get a single instance

Parameters:

instance – The value can be either the ID of an instance or a Instance instance.

Returns:

One Instance

find_instance(name_or_id, ignore_missing=True)

Find a single instance

Parameters:
  • name_or_id – The name or ID of a instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource does not exist. When set to True, None will be returned when attempting to find a nonexistent resource.

Returns:

One Instance or None.

instances(**params)

Return a generator of instances

Parameters:

params (dict) – Optional query parameters to be sent to limit the instances being returned.

Returns:

A generator of instance objects.

Return type:

Instance

wait_normal_instance(instance, status='normal', failures=None, interval=60, wait=None)

Wait for normal status of an instance

Parameters:
  • instance – The value can be either the ID of an instance or a Instance instance.

  • status – The status of the instance to wait for.

  • failures – The list of failures.

  • interval – The number of seconds to wait between failures.

  • wait – Seconds to wait for response.

Returns:

One Instance

Job Operations

class otcextensions.sdk.dds.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
get_job(job)

Get information about a job

Parameters:

job – The value can be either the ID of a job or a Job job.

Returns:

One Job

wait_job(job, status='Completed', failures=None, interval=20, wait=None)

Wait for the job to complete

Parameters:
  • job – The value can be either the ID of a job or a :param status: Desired status of the job.

  • failures – List of failure statuses.

  • interval – Seconds to wait between retries.

  • wait – Seconds to wait for response.

Returns:

One Job

Eip Operations

class otcextensions.sdk.dds.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
bind_eip(node, public_ip, public_ip_id)

Bind an IP to a node

Parameters:
  • node – The value is the ID of a node

  • public_ip – The public IP address of the node.

  • public_ip_id – The public IP address of the node.

Returns:

The IP address of the node.

unbind_eip(node)

Unbind an IP to a node

Parameters:

node – The value is the ID of a node

Returns:

The ID of the node.

Recycle Bin Policy Operations

class otcextensions.sdk.dds.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
get_policy()

Get the current policy

Returns:

The current policy.

create_policy(**attrs)

Create a new policy from attributes

Parameters:

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

Returns:

The result of creation.

Return type:

RecyclePolicy

Recycle Instances Operations

class otcextensions.sdk.dds.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
recycle_instances(**params)

Get list of instances in recycle bin

Parameters:

params (dict) – Keyword arguments which will be used to get list :returns: A generator of recycle instance objects.