Database API¶
For details on how to use database, see Using OpenStack Database
The Database Class¶
The database high-level interface is available through the database
member of a Connection
object. The
database
member will only be added if the service is detected.
Database Operations¶
-
class
openstack.database.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_database
(instance, **attrs) Create a new database from attributes
-
delete_database
(database, instance=None, ignore_missing=True) Delete a database
- Parameters
database – The value can be either the ID of a database or a
Database
instance.instance – This parameter needs to be specified when an ID is given as database. It can be either the ID of an instance or a
Instance
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the database does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent database.
- Returns
None
-
find_database
(name_or_id, instance, ignore_missing=True) Find a single database
- Parameters
name_or_id – The name or ID of a database.
instance – This can be either the ID of an instance or a
Instance
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, None will be returned when attempting to find a nonexistent resource.
- Returns
One
Database
or None
-
databases
(instance, **query) Return a generator of databases
-
get_database
(database, instance=None) Get a single database
-
Flavor Operations¶
-
class
openstack.database.v1._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs) -
find_flavor
(name_or_id, ignore_missing=True) Find a single flavor
- Parameters
name_or_id – The name or ID of a flavor.
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, None will be returned when attempting to find a nonexistent resource.
- Returns
One
Flavor
or None
-
get_flavor
(flavor) Get a single flavor
-
flavors
(**query) Return a generator of flavors
- Parameters
query (kwargs) – Optional query parameters to be sent to limit the resources being returned.
- Returns
A generator of flavor objects
- Return type
-
Instance Operations¶
-
class
openstack.database.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
-
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 toTrue
, 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 toTrue
, None will be returned when attempting to find a nonexistent resource.
- Returns
One
Instance
or None
-
get_instance
(instance) Get a single instance
-
instances
(**query) Return a generator of instances
- Parameters
query (kwargs) – Optional query parameters to be sent to limit the resources being returned.
- Returns
A generator of instance objects
- Return type
-
User Operations¶
-
class
openstack.database.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_user
(instance, **attrs) Create a new user from attributes
-
delete_user
(user, instance=None, ignore_missing=True) Delete a user
- Parameters
user – The value can be either the ID of a user or a
User
instance.instance – This parameter needs to be specified when an ID is given as user. It can be either the ID of an instance or a
Instance
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the user does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent user.
- Returns
None
-
find_user
(name_or_id, instance, ignore_missing=True) Find a single user
- Parameters
name_or_id – The name or ID of a user.
instance – This can be either the ID of an instance or a
Instance
ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, None will be returned when attempting to find a nonexistent resource.
- Returns
One
User
or None
-
users
(instance, **query) Return a generator of users
-
get_user
(user, instance=None) Get a single user
-