CloudDB

class CloudDB.CloudDB(*args)[source]

Bases: Cloud.Cloud

A class that handles actions to Cloud Databases via public methods listed.

service = 'Databases'
flavors = {}
createInstance(flavor, size, name, db=None, user=None)[source]

Creates a mysql instance using the provided flavor id and size(1-50 GB) for allocating databases to.

Arguments: flavor – Instance flavor size(int) size – Instance storage size(int) name – Instance name(string) db – List of databses with optional keys(list)

name – Database name(string) character_set – Default utf8(string) collate – Rules default is utf8_general_ci(string)
user – List of users with optional keys(list)
name – User name(string) password – User pass(string) databases – List of databases w/ name key(list)

Returns: result – JSON response converted to python Dict

getInstance(iId=None)[source]

Lists mysql instance details. Either all or one with the provided instance id

Arguments: iId – Instance id(str)

Returns: result – JSON response converted to python Dict

deleteInstance(iId)[source]

Deletes mysql instance using provided instance id

Arguments: iId – Instance id(str)

Returns: status code

getRoot(iId, check=False)[source]

Enable and get root credentials for mysql instance using provided instance id Or if check=True, return status of root enabled on the instance.

Arguments: iId – Instance id(str)

Returns: JSON results as a python dict

setAction(iId, reboot=False, flavor=False, volume=False)[source]

Perfom action on instance such as reboot mysql or resize flavor/volume.

Arguments: iId – Instance id(string) reboot – Boolean flavor – Flavor id(int) volume – Storage size in GB(int)

Returns: status code

createDatabase(iId, name, charset=None, collate=None)[source]

Create new database within an instance id given the provided name

Arguments: iId – Instance id(str) name – Database name(str) charset – Default utf8(string)(optional) collate – Rules default is utf8_general_ci(string)(optional)

Returns: status code

getDatabases(iId)[source]

Lists databases within an instance

Arguments: id – Instance id(str)

Returns: JSON results as python dict

deleteDatabase(iId, name)[source]

Deletes specified database name within specified instance id

Arguments: id – Instance id(str) name – Instance name(str)

Returns: status code

createUser(iId, name, password, databases=None)[source]

Creates a user for the specified instance, optionally to specific databases with specified name and pass.

Arguments: id – name – Name of the user for the database. password – User password for database access. databases – Optional(list of database names)

Returns: status code

getUsers(iId)[source]

Lists users associated with a specific instance

Arguments: iId – Instance id(string)

Returns: JSON results as a python dict

getUser(iId, name)[source]

Lists a specified user associated with a specified instance

Arguments: iId – Instance id(string) name – User name(string)

Returns: status code

getUserAccess(iId, name)[source]

Lists a specified user associated with a specified instance

Arguments: iId – Instance id(string) name – User name(string)

Returns: status code

grantUserAccess(iId, username, dbName)[source]

Grants access for the specified user to one or more databases for the specified instance.

Arguments: iId – Instance id(string) username – User name (string) dbName – New user password for database access

Returns: status code

revokeUserAccess(iId, username, dbName)[source]

Revokes access for the specified user to one or more databases for the specified instance.

Arguments: iId – Instance id(string) username – User name (string) dbName – New user password for database access

Returns: status code

deleteUser(iId, name)[source]

Deletes a specified user from a specified instance

Arguments: iId – Instance id(string) name – User name(string)

Returns: status code

changePass(iId, name, password)[source]

Changes the MySQL password of the specified user.

Arguments: iId – Instance id(string) name – User name (string) password – New user password for database access

Returns: status code

getFlavor(fId=None)[source]

Lists info about flavor(s). Can specify an id for detailed info on flavor

Arguments: fId – Flavor id(int)(optional)

Returns: JSON results as python dict

Previous topic

CloudBS

Next topic

CloudDNS