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
Parameters: Returns: The results of server creation
Return type:
-
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
Databaseinstance. - 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
FalseResourceNotFoundwill 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- database – The value can be either the ID of a database or a
-
get_database(database, instance=None)¶ Get a single database
Parameters: Returns: One
DatabaseRaises: ResourceNotFoundwhen no resource can be found.
-
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
FalseResourceNotFoundwill be raised when the resource does not exist. When set toTrue, None will be returned when attempting to find a nonexistent resource.
Returns: One
Databaseor None
-
databases(instance, **query)¶ Return a generator of databases
Parameters: - instance – This can be either the ID of an instance
or a
Instanceinstance that the interface belongs to. - query (kwargs) – Optional query parameters to be sent to limit the resources being returned.
Returns: A generator of database objects
Return type: - instance – This can be either the ID of an instance
or a
-
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) -
get_flavor(flavor)¶ Get a single flavor
Parameters: flavor – The value can be the ID of a flavor or a Flavorinstance.Returns: One FlavorRaises: ResourceNotFoundwhen no resource can be found.
-
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
FalseResourceNotFoundwill be raised when the resource does not exist. When set toTrue, None will be returned when attempting to find a nonexistent resource.
Returns: One
Flavoror None
-
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
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
-
update_instance(instance, **attrs)¶ Update a instance
Parameters: instance – Either the id of a instance or a Instanceinstance.Attrs kwargs: The attributes to update on the instance represented by value.Returns: The updated instance 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
Instanceinstance. - ignore_missing (bool) – When set to
FalseResourceNotFoundwill 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- instance – The value can be either the ID of an instance or a
-
get_instance(instance)¶ Get a single instance
Parameters: instance – The value can be the ID of an instance or a Instanceinstance.Returns: One InstanceRaises: ResourceNotFoundwhen no resource can be found.
-
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
FalseResourceNotFoundwill be raised when the resource does not exist. When set toTrue, None will be returned when attempting to find a nonexistent resource.
Returns: One
Instanceor None
-
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
Parameters: Returns: The results of server creation
Return type:
-
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
Userinstance. - 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
FalseResourceNotFoundwill 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- user – The value can be either the ID of a user or a
-
get_user(user, instance=None)¶ Get a single user
Parameters: Returns: One
UserRaises: ResourceNotFoundwhen no resource can be found.
-
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
FalseResourceNotFoundwill be raised when the resource does not exist. When set toTrue, None will be returned when attempting to find a nonexistent resource.
Returns: One
Useror None
-