Service.Database

Database methods.

Summary
Service.DatabaseDatabase methods.
Functions
createCreate a database and an initial database user You may use any characters to describe the database (up to 59 in length).
renameChange the name for a Database You may use any characters to describe the database (up to 59 in length).
cloneDatabaseClone a database to a new database and an initial database user If performed on a PostgreSQL database, the username and name must be the same value.
listDatabasesList details of one or many Databases.
destroyDelete a Database
backupBackup a database
listBackupsList database backups
destroyBackupDestroy a database backup
createUserCreate a new database user
updateUserUpdate one or more aspects of a database user
listUsersList all the users on a database
destroyUserDelete a user on a database
getSlowLogsRetrieve slow logs for a given database and range
getSizeHistoryRetrieve size history for a given database and range

Functions

create

Create a database and an initial database user You may use any characters to describe the database (up to 59 in length).  This will be normalized (spaces removed, etc.) but the original name will be preserved as a friendly name.  The normalized name for the database will be returned in the DatabaseDetails.  If performed on a PostgreSQL database, the username and name must be the same value.

Parameters

typeno docs (idx: 1, type: Types.DatabaseType)
customerIdno docs (idx: 2, type: Types.CustomerId)
nameThe four character customer digest and a ‘_’ will be prefixed to this (idx: 6, type: Types.DatabaseName)
usernameThe four character customer digest and a ‘_’ will be prefixed to this (idx: 7, type: Types.DatabaseUser)
passwordThe inital password for the user created (idx: 8, type: Types.DatabasePassword, optional)
storePasswordStore the password so it can be retrieved (idx: 5, type: Thrift.bool, optional)
userTypeDefaults to ReadWrite (idx: 9, type: Types.DatabaseUserType, optional)
hostsAllowno docs (idx: 10, type: Thrift.list (Types.Hostname), optional)

Returns

Types.DatabaseCreateResult

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

rename

Change the name for a Database You may use any characters to describe the database (up to 59 in length).  This will be normalized (spaces removed, etc.) but the original name will be preserved as a friendly name.  The new normalized name for the database will be returned in the DatabaseDetails.  If performed on a PostgreSQL database, the username will also be renamed.

Parameters

idno docs (idx: 1, type: Types.DatabaseId)
nameThe four character customer digest and a ‘_’ will be prefixed to this (idx: 3, type: Types.DatabaseName)

Returns

Types.DatabaseDetails

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

cloneDatabase

Clone a database to a new database and an initial database user If performed on a PostgreSQL database, the username and name must be the same value.

Parameters

idno docs (idx: 1, type: Types.DatabaseId)
usernameThe four character customer digest and a ‘_’ will be prefixed to this (idx: 5, type: Types.DatabaseUser)
nameThe four character customer digest and a ‘_’ will be prefixed to this (idx: 6, type: Types.DatabaseName)
passwordThe inital password for the user created (idx: 7, type: Types.DatabasePassword, optional)
storePasswordStore the password so it can be retrieved (idx: 4, type: Thrift.bool, optional)
userTypeDefaults to ReadWrite (idx: 8, type: Types.DatabaseUserType, optional)
hostsAllowno docs (idx: 9, type: Thrift.list (Types.Hostname), optional)

Returns

Types.DatabaseCreateResult

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

listDatabases

List details of one or many Databases.  (always returns list)

Parameters

customerIdList all databases for this customer.  (idx: 1, type: Types.CustomerId, optional)
databaseIdList details for this database (idx: 2, type: Types.DatabaseId, optional)

Returns

Thrift.list (Types.DatabaseDetails)

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

destroy

Delete a Database

Parameters

idDatabaseId of the Database to destroy (idx: 1, type: Types.DatabaseId)
backupBool, true will dump the database before delete, false will not.  (idx: 2, type: Thrift.bool, optional)

Returns

Types.URL

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

backup

Backup a database

Parameters

idthe ID of the Database you wish to backup (idx: 1, type: Types.DatabaseId)

Returns

Types.DatabaseBackup

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

listBackups

List database backups

Parameters

idthe database id.  (idx: 1, type: Types.DatabaseId)

Returns

Thrift.list (Types.DatabaseBackup)

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

destroyBackup

Destroy a database backup

Parameters

databaseIdthe database id.  (idx: 1, type: Types.DatabaseId)
backupIdthe backup id.  (idx: 2, type: Types.DatabaseBackupId)

Returns

Thrift.void

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

createUser

Create a new database user

Parameters

databaseIdno docs (idx: 1, type: Types.DatabaseId)
usernameThe four character customer digest and a ‘_’ will be prefixed to this (idx: 2, type: Types.DatabaseUser)
passwordIf not provided, a random password will be created (idx: 3, type: Types.DatabasePassword, optional)
storePasswordStore the password so it can be retrieved (idx: 4, type: Thrift.bool, optional)
userTypeDefaults to ReadWrite (idx: 5, type: Types.DatabaseUserType, optional)
hostsAllowPgSQL specific options (idx: 6, type: Thrift.list (Types.Hostname), optional)
pgDatabaseOwnerFor a PostgreSQL database, this will make the new user the owner of the database (idx: 7, type: Thrift.bool, optional)

Returns

Types.DatabaseUserDetails

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

updateUser

Update one or more aspects of a database user

Parameters

idno docs (idx: 1, type: Types.DatabaseUserId)
passwordno docs (idx: 2, type: Types.DatabasePassword, optional)
storePasswordno docs (idx: 3, type: Thrift.bool, optional)
userTypeno docs (idx: 4, type: Types.DatabaseUserType, optional)
hostsAllowIf present, replaces the previous values PgSQL specific options (idx: 5, type: Thrift.list (Types.Hostname), optional)
pgDatabaseOwnerFor a PostgreSQL database, this will make the user the owner of the database (idx: 6, type: Thrift.bool, optional)

Returns

Types.DatabaseUserDetails

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

listUsers

List all the users on a database

Parameters

databaseIdno docs (idx: 1, type: Types.DatabaseId)

Returns

Thrift.list (Types.DatabaseUserDetails)

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

destroyUser

Delete a user on a database

Parameters

idno docs (idx: 1, type: Types.DatabaseUserId)

Returns

Thrift.void

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

getSlowLogs

Retrieve slow logs for a given database and range

Parameters

databaseIdno docs (idx: 1, type: Types.DatabaseId)
userIdno docs (idx: 2, type: Types.DatabaseUserId, optional)
startTimeno docs (idx: 3, type: Types.UnixTime, optional)
endTimeno docs (idx: 4, type: Types.UnixTime, optional)
limitno docs (idx: 5, type: Thrift.i16, optional)

Returns

Thrift.list (Types.DatabaseSlowLog)

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer

getSizeHistory

Retrieve size history for a given database and range

Parameters

databaseIdno docs (idx: 1, type: Types.DatabaseId)
startTimeno docs (idx: 2, type: Types.UnixTime, optional)
endTimeno docs (idx: 3, type: Types.UnixTime, optional)
limitno docs (idx: 4, type: Thrift.i16, optional)

Returns

Thrift.list (Types.DatabaseSizeHistory)

Throws

Exceptions.InvalidArguments (idx: 1)

Roles

  • customer
Base type Thrift.i16
Base type Thrift.string
Base type Thrift.string
Base type Thrift.string
A Thrift built-in type.
A Thrift built-in type.
Base type Thrift.string
The result of a Database.create or .clone call
Base type Thrift.i16
Details for a shared database
Base type Thrift.string
Record for a database backup.
Base type Thrift.string
A Thrift built-in type.
Details for a shared database user
Base type Thrift.i32
Base type Thrift.i32
A Thrift built-in type.
Wrapper for db rows from CustomerDatabaseUserSlowLog
Wrapper for db rows from CustomerDatabaseSizeHistory
Close