database methods¶
-
class
ecl.database.v1._proxy.
Proxy
(session)[source]¶ Bases:
ecl.proxy2.BaseProxy
-
create_database
(instance_id, name)[source]¶ Create a new database from attributes
Parameters: - instance_id (string) – ID of instance to assciate creating database
- name (string) – Name of database
Returns: The results of database creation
Return type: Database
-
create_instance
(name, flavor_id, volume, databases, users, datastores, nics, availability_zone=None, backup_window=None, backup_retension_period=None, maintenance_window=None, **attrs)[source]¶ Create a new instance from attributes
Parameters: - name (string) – Name of instance
- flavor_id (string) – Flavor ID of server
- volue (dict) – Volume configuration dict which has volume_size inside
- databases – Database definition list to initialize database on creating instance
- users – List of users to connect to defined databases
- datastores (dict) – Datastore name and version of instance
- nics (dict) – Network difinition of instance
- availability_zone – Availability zone for instance
- backup_window – Backup window time range
- backup_retension_period – Number of the day to retain backup
- maintenance_window – Maintenance window time range by the day of the week and from/to time
- attrs (kwargs) – Keyword arguments which will be used to create
a
Instance
, comprised of the properties on the Instance class.
Returns: The results of instance creation
Return type: Instance
-
create_user
(instance_id, name, password, databases=None)[source]¶ Create a new user from attributes
Parameters: - instance_id (string) – ID of instance to assciate creating user
- name (string) – Name of user
- password (string) – Password of user
- databases – Database list of user to grant
Returns: The results of user creation
Return type: User
-
databases
(instance_id, **query)[source]¶ Retrieve a list of databases assciated with instance
Parameters: - instance_id – Instance id to find databases
- **query (kwargs) – Optional query parameters to be sent to limit the instances being returned. Available parameters include:
Returns: A list of database instances.
-
delete_database
(instance_id, database, ignore_missing=True)[source]¶ Delete a database
Parameters: - instance_id – The value can be either the ID of a server or a
Instance
instance. - ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent database
Returns: None
- instance_id – The value can be either the ID of a server or a
-
delete_instance
(instance, ignore_missing=True)[source]¶ Delete a instance
Parameters: - instance – The value can be either the ID of a server or a
Instance
instance. - ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the server does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent instance - force (bool) – When set to
True
, the instance deletion will be forced immediatly.
Returns: None
- instance – The value can be either the ID of a server or a
-
delete_user
(instance_id, user, ignore_missing=True)[source]¶ Delete a user
Parameters: - instance_id – The value can be either the ID of a server or a
Instance
instance. - ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent user
Returns: None
- instance_id – The value can be either the ID of a server or a
-
find_database
(instance_id, name_or_id, ignore_missing=True)[source]¶ Find a single database
Parameters: - name_or_id – The name or ID of a database.
- 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
-
find_flavor
(name_or_id, ignore_missing=True)[source]¶ 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
-
find_instance
(name_or_id, ignore_missing=True)[source]¶ Find a single instance
Parameters: - name_or_id – The name or ID of a server.
- 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
-
find_user
(instance_id, name_or_id, ignore_missing=True)[source]¶ Find a single user
Parameters: - name_or_id – The name or ID of a user.
- 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
-
get_flavor
(flavor)[source]¶ Get a single flavor
Parameters: flavor – The value can be the ID of a flavor or a Flavor
instance.Returns: One Flavor
Raises: ResourceNotFound
when no resource can be found.
-
get_instance
(instance)[source]¶ Get a single instance
Parameters: instance – The value can be the ID of a instance or a Instance
instance.Returns: One Instance
Raises: ResourceNotFound
when no resource can be found.
-
instances
(**query)[source]¶ Retrieve a list of instances
Parameters: **query (kwargs) – Optional query parameters to be sent to limit the instances being returned. Returns: A list of database instances.
-
users
(instance_id, **query)[source]¶ Retrieve a list of users assciated with instance
Parameters: - instance_di – Instance id to find users
- **query (kwargs) – Optional query parameters to be sent to limit the instances being returned. Available parameters include:
Returns: A list of database instances.
-
database¶
-
class
ecl.database.v1.database.
Database
(synchronized=False, **attrs)[source]¶ Bases:
ecl.resource2.Resource
-
allow_create
= True¶
-
allow_delete
= True¶
-
allow_get
= False¶
-
allow_list
= True¶
-
allow_update
= False¶
-
base_path
= '/instances/%(instance_id)s/databases'¶
-
instance_id
= None¶ ID of instance associated with this database
-
name
= None¶ User’s name of Database.
-
resource_key
= 'database'¶
-
resources_key
= 'databases'¶
-
service
= {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'database', 'requires_project_id': False, 'api_version': None}¶
-
flavor¶
-
class
ecl.database.v1.flavor.
Flavor
(synchronized=False, **attrs)[source]¶ Bases:
ecl.resource2.Resource
-
allow_get
= True¶
-
allow_list
= True¶
-
base_path
= '/flavors'¶
-
disk
= None¶ Size of the disk this flavor offers. Type: int
-
ephemeral
= None¶ Size of the ephemeral data disk attached to this server. Type: int
-
is_disabled
= None¶ True
if this flavor is disabled,False
if not. Type: bool
-
is_public
= None¶ True
if this is a publicly visible flavor.False
if this is a private image. Type: bool
-
links
= None¶ Links pertaining to this flavor. This is a list of dictionaries, each including keys
href
andrel
.
-
name
= None¶ The name of this flavor.
-
ram
= None¶ The amount of RAM (in MB) this flavor offers. Type: int
-
resource_key
= 'flavor'¶
-
resources_key
= 'flavors'¶
-
rxtx_factor
= None¶ The bandwidth scaling factor this flavor receives on the network.
-
service
= {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'database', 'requires_project_id': False, 'api_version': None}¶
-
swap
= None¶ Size of the swap partitions.
-
vcpus
= None¶ The number of virtual CPUs this flavor offers. Type: int
-
instance¶
-
class
ecl.database.v1.instance.
Instance
(synchronized=False, **attrs)[source]¶ Bases:
ecl.resource2.Resource
-
allow_create
= True¶
-
allow_delete
= True¶
-
allow_get
= True¶
-
allow_list
= True¶
-
allow_update
= False¶
-
availability_zone
= None¶
-
backup_retention_period
= None¶ Backup retension period of this instance.
-
backup_window
= None¶ Backup window of instance.
-
base_path
= '/instances'¶
-
created_at
= None¶ Timestamp of when the instance was created.
-
databases
= None¶ Databases list of instance.
-
datastore
= None¶ The datastore property returned as instence property.
-
classmethod
find
(session, name_or_id, ignore_missing=True, **params)[source]¶ Find a resource by its name or id.
Parameters: - session (
Session
) – The session to use for making this request. - 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 toTrue
, 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: ecl.exceptions.DuplicateResource
if more than one resource is found for this request.Raises: ecl.exceptions.ResourceNotFound
if nothing is found and ignore_missing isFalse
.- session (
-
flavor
= None¶ The flavor property returned from instance.
-
flavor_id
= None¶ The flavor reference, as a ID or full URL, in case create instane.
-
hostname
= None¶ An ID representing the host of this instance.
-
id
= None¶ ID of the server
-
links
= None¶ A list of dictionaries holding links relevant to this instance.
-
maintenance_window
= None¶ Maintenance window of instance.
-
name
= None¶ Name of the instance
-
nics
= None¶ A nic definition object. Required parameter when there are multiple networks defined for the tenant.
-
region
= None¶ Region of the instance
-
resource_key
= 'instance'¶
-
resources_key
= 'instances'¶
-
service
= {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'database', 'requires_project_id': False, 'api_version': None}¶
-
status
= None¶ The state this instance is in.
-
updated_at
= None¶ Timestamp of when this instance was last updated.
-
users
= None¶ Users list of instance.
-
volume
= None¶ The volume property returned from instance.
-
user¶
-
class
ecl.database.v1.user.
User
(synchronized=False, **attrs)[source]¶ Bases:
ecl.resource2.Resource
-
allow_create
= True¶
-
allow_delete
= True¶
-
allow_get
= False¶
-
allow_list
= True¶
-
allow_update
= False¶
-
base_path
= '/instances/%(instance_id)s/users'¶
-
databases
= None¶ Relevant database of this user.
-
host
= None¶ Allowed access host of user.
-
instance_id
= None¶ ID of instance associated with this user
-
name
= None¶ User’s name of Database instance.
-
password
= None¶ User’s password of Database instance. This parameter is only used in instance creation.
-
resource_key
= 'user'¶
-
resources_key
= 'users'¶
-
service
= {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'database', 'requires_project_id': False, 'api_version': None}¶
-