Recover Database from Backup

PUT/zstack/v1/database-backups/actions?uuid={uuid}

Recover database backup from backup storage.

Headers

Authorization: OAuth the-session-uuid

Body

{
  "recoverDatabaseFromBackup": {
    "backupStorageUrl": "ssh://root:password@localhost:22/Cloud_bs",
    "backupInstallPath": "zstore://zsbak/0ed599ec519249489475112a058bb93a",
    "mysqlRootPassword": "password"
  },
  "systemTags": [],
  "userTags": []
}

The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"recoverDatabaseFromBackup":{"backupStorageUrl":"ssh://root:password@localhost:22/Cloud_bs","backupInstallPath":"zstore://zsbak/0ed599ec519249489475112a058bb93a","mysqlRootPassword":"password"}}' http://localhost:8080/zstack/v1/database-backups/actions

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
uuid (Optional)StringurlThe UUID of the resource. Uniquely identifies the resource 3.0.0
backupStorageUrl (Optional)Stringbody (Contained in the recoverDatabaseFromBackup structure)Image Storage URL 3.0.0
backupInstallPath (Optional)Stringbody (Contained in the recoverDatabaseFromBackup structure)Database backup storage path 3.0.0
mysqlRootPasswordStringbody (Contained in the recoverDatabaseFromBackup structure)MySQL database ROOT password 3.0.0
systemTags (Optional)Listbody  3.0.0
userTags (Optional)Listbody  3.0.0

API Response

Response Example

{
  "logListenPort": 0.0
}
NameTypeDescriptionStarting Version
logListenPortintBrowsers can use this port number to print logs in real time3.0.0
errorErrorCodeThe error code. If not null, the operation failed. This field is null on success. For details, see error3.0.0

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.10013.0.0
descriptionStringA brief description of the error3.0.0
detailsStringThe detailed error information3.0.0
elaborationStringReserved field. Default is null3.0.0
opaqueLinkedHashMapReserved field. Default is null3.0.0
causeErrorCodeThe root error. The source error that caused the current error. This field is null if there is no root error3.0.0

SDK Examples

Java SDK

RecoverDatabaseFromBackupAction action = new RecoverDatabaseFromBackupAction();
action.backupStorageUrl = "ssh://root:password@localhost:22/Cloud_bs";
action.backupInstallPath = "zstore://zsbak/0ed599ec519249489475112a058bb93a";
action.mysqlRootPassword = "password";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RecoverDatabaseFromBackupAction.Result res = action.call();

Python SDK

RecoverDatabaseFromBackupAction action = RecoverDatabaseFromBackupAction()
action.backupStorageUrl = "ssh://root:password@localhost:22/Cloud_bs"
action.backupInstallPath = "zstore://zsbak/0ed599ec519249489475112a058bb93a"
action.mysqlRootPassword = "password"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RecoverDatabaseFromBackupAction.Result res = action.call()