Database RDS API

For details on how to use database, see /user/guides/rds (NEEDS TO BE DONE)

The Database Class

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

Datastore Operations

class otcextensions.sdk.rds.v1._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

Rtype object

object with name attribte

datastore_versions(datastore)

List datastores

Parameters

dbId – database store name (MySQL, PostgreSQL, or SQLServer and is case-sensitive.)

Returns

A generator of datastore versions

Return type

Flavor

get_datastore_version(datastore, datastore_version)

Get the detail of a datastore version

Parameters
  • datastore – datastore name

  • datastore_Version – id of the datastore version

Returns

Detail of datastore version

Return type

Datastore

Flavor Operations

class otcextensions.sdk.rds.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
flavors(dbId, region)

List flavors of given datastore id and region

Parameters
  • dbId – database store id

  • region – region

Returns

A generator of flavor

Return type

Flavor

get_flavor(flavor)

Get the detail of a flavor

Parameters

id – Flavor id or an object of class Flavor

Returns

Detail of flavor

Return type

Flavor

Instance Operations

class otcextensions.sdk.rds.v1._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 results of server creation

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

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

get_instance(instance)

Get a single instance

Parameters

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

Returns

One Instance

Raises

ResourceNotFound when no resource can be found.

instances()

Return a generator of instances

Returns

A generator of instance objects

Return type

Instance

update_instance(instance, **attrs)

Update a instance

Parameters

instance – Either the id of a instance or a Instance instance.

Attrs attrs

The attributes to update on the instance represented by value.

Returns

The updated instance

Return type

Instance

Backup Operations

class otcextensions.sdk.rds.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
backups()

List Backups

Returns

A generator of backup

Return type

Backup

create_backup(instance, **attrs)

Create a backups of instance

Returns

A new backup object

Return type

Backup

delete_backup(backup, ignore_missing=True)

Deletes given backup

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_backup_policy(instance)

Obtaining a backup policy of the instance

Parameters

instance – This parameter can be either the ID of an instance or a Instance

Returns

A Backup policy

Return type

BackupPolicy

set_backup_policy(backup_policy, instance, **attrs)

Sets the backup policy of the instance

Parameters
  • instance – This parameter can be either the ID of an instance or a Instance

  • attrs (dict) – The attributes to update on the backup_policy represented by backup_policy.

Returns

None