otcextensions.sdk.rds.v3.instance

The Instance Class

The Instance class inherits from Resource.

class otcextensions.sdk.rds.v3.instance.Instance(_synchronized=False, connection=None, **attrs)

The base resource

Parameters
  • _synchronized (bool) – This is not intended to be used directly. See new() and existing().

  • connection (openstack.connection.Connection) – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of self._connection in Resource code should protect itself with a check for None.

availability_zone

Availability Zone. Type:string

backup_strategy

Backup Strategy. Type: dict

charge_info

Specifies the billing information, which is pay-per-use. Type:dict

configuration_id

Parameter configuration ID. Type:uuid

created_at

Instance created time. Type:string

datastore

Data store information. Type:dict

datastore_type

Datastore type information (for querying). Type:string

disk_encryption_id

Disk Encryption Key Id. Type:uuid

flavor_ref

Flavor ID Type:uuid

job_id

Async job id Type:uuid

ha

HighAvailability configuration parameters. Type:dict

maintenance_window

Maintenance time window. Type:string

nodes

Node information Indicates the primary/standby DB instance information. Type:list

password

Password of the default user. Type:string

port

Database listen port number. Type:int

private_ips

Private IP address List. Type:list

public_ips

Public IP address List, Type:list

region

Region where DB is deployed. Type:string

related_instances

list of associated DB instances. Type:list

replica_of_id

Specifies the DB instance ID, which is used to create a read replica. Type:uuid

restore_point

Specifies the restoration point for instance recovery. Type:dict

restore_time

Recovery time period for instance. Type:string

router_id

Neutron router ID. Type:uuid

security_group_id

Security Group Id. Type:uuid

network_id

Id of network. Type:uuid

status

Instance status. Type:string

switch_strategy

Switch Strategy. The value can be reliability or availability, indicating the reliability first and availability first, respectively. Type:string

tags

Lists the tags and their values attached to the instance. Type:dict

time_zone

Time Zone. Type:string

type

Instance type Single/Ha/Replica., Type:string

updated_at

Type:string

user_name

Default user of the DB Type:string

volume

Volume information Type:dict

classmethod find(session, name_or_id, ignore_missing=True, **params)

Find a resource by its name or id.

Parameters
  • session – The session to use for making this request. :type session: Adapter

  • name_or_id – This resource’s identifier, if needed by the request. The default is None.

  • 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.

  • params (dict) – Any additional parameters to be passed into underlying methods, such as to existing() in order to pass on URI parameters.

Returns

The Resource object matching the given name or id or None if nothing matches.

Raises

openstack.exceptions.DuplicateResource if more than one resource is found for this request.

Raises

openstack.exceptions.ResourceNotFound if nothing is found and ignore_missing is False.

fetch(session, requires_id=True, base_path=None, error_message=None, **params)

Get a remote resource based on this instance.

Parameters
  • session – The session to use for making this request. :type session: Adapter

  • requires_id (boolean) – A boolean indicating whether resource ID should be part of the requested URI.

  • base_path (str) – Base part of the URI for fetching resources, if different from base_path.

  • error_message (str) – An Error message to be returned if requested object does not exist.

  • params (dict) – Additional parameters that can be consumed.

Returns

This Resource instance.

Raises

MethodNotSupported if Resource.allow_fetch is not set to True.

Raises

ResourceNotFound if the resource was not found.

fetch_restore_times(session)

List possible restore times for the instance.

restore(session, backup=None, restore_time=None)

Restore instance from the backup of PIR.

get_backup_policy(session)

Get instance backup policy

set_backup_policy(session, keep_days, start_time=None, period=None)

Set instance backup policy

get_logs(session, log_type, start_date, end_date, offset, limit, level)

Get instance logs

Parameters
  • session – The session to use for making this request. :type session: Adapter

  • log_type (str) – The type of logs to query: ‘errorlog’ or ‘slowlog’.

  • start_date (str) – Start date of the of the log query. Format: %Y-%m-%dT%H:%M:%S%z where z is the tzinfo in HHMM format.

  • end_date (str) – End date of the of the log query. Format: %Y-%m-%dT%H:%M:%S%z where z is the tzinfo in HHMM format.

  • offset (int) –

    .

  • limit (int) – Specifies the number of records on a page. Its value range is from 1 to 100.

  • level (str) – Specifies the log level.

restart(session)

Restart the database instance

enlarge_volume(session, size)

Enlarge the instance volume

update_flavor(session, spec_code)

Chage the instance’s flavor

add_tag(session, key, value)

Add tag to instance

remove_tag(session, key)

Remove tag from instance