Configuring Same-Region Backup Policies in Batches
Function
This API is used to configure same-region backup policies in batches. Standard and sparse backup policies are supported. Before calling this API:
- Learn how to authenticate it.
- Obtain the required region and endpoint.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependency
gaussdbformysql:backup:modifyPolicy
Permission_management
-
gaussdbformysql:ReplicationTargetRegion
gaussdb:instance:modifyBackupPolicy
-
URI
POST /v3/{project_id}/instances/backups/policy
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. Constraints N/A Range The value contains 32 characters. Only letters and digits are allowed. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. To obtain this value, call the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the token value. Constraints N/A Range N/A Default Value N/A |
| Content-Type | Yes | String | Definition Content type. Constraints N/A Range application/json Default Value application/json |
| X-Language | No | String | Definition Request language type. Constraints N/A Range Default Value en-us |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| instance_ids | Yes | Array of strings | Definition IDs of the instances for which you want to configure a backup policy. To obtain this value, see Querying DB Instances. Constraints A maximum of 50 IDs are allowed. |
| backup_policy | Yes | MysqlBackupPolicy object | Definition Database backup policy information. Constraints N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| begin_time | Yes | String | Definition Start time of the backup time window. Constraints N/A Range The value cannot be left blank. It must be a valid value in the hh:mm format. The current time is the UTC time. Default Value N/A |
| end_time | Yes | String | Definition End time of the backup time window. Constraints The value of end_time must be later than that of begin_time. Range The value cannot be left blank. It must be a valid value in the hh:mm format. The current time is the UTC time. Default Value N/A |
| retention_num_backup_level1 | No | Integer | Definition Number of retained level-1 backups. Constraints This parameter is mandatory when the level-1 backup function is enabled. Otherwise, this parameter cannot be transferred. Range Default Value 0 |
| policies | Yes | Array of Policy objects | Definition Backup policies. Constraints N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| failed_results | Array of UpdateBackupPolicyResult objects | Definition Error information about the backup policy configuration. If the backup policy is successfully configured for all instances, the value is empty. |
| success_count | Integer | Definition Number of instances for which the backup policy is successfully configured. Range 0–50 |
| failed_count | Integer | Definition Number of instances for which the backup policy configuration failed. Range 0–50 |
| Parameter | Type | Description |
|---|---|---|
| instance_id | String | Definition Instance ID. Range N/A |
| error_code | String | Definition Code returned when an error occurs during backup policy submission. Range N/A |
| error_msg | String | Definition Message returned when an error occurs during backup policy submission. Range N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Example Request
-
Batch configuring a sparse backup policy for multiple instances (Data is backed up from 19:00 to 20:00 every week. Backups are stored for seven days.)
POST https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/backups/policy { "instance_ids" : [ "61a4ea66210545909d74a05c27a7179ein07", "61a4ea66210545909d74a05c27a7180in07", "61a4ea66210545909d74a05c27a7181in07" ], "backup_policy" : { "begin_time" : "19:00", "end_time" : "20:00", "policies" : [ { "period" : "* * 1,2,3,4,5,6,7", "retention_days" : 7, "policy_type" : "base" } ] } } -
Modifying the sparse backup policy and standard backup policy of an instance (The standard backup policy is to back up data from 19:00 to 20:00 every day of the week. Backups are stored for seven days. The sparse backup policy is to back up data from Monday to Friday every week. Backups are stored for one day.)
POST https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/backups/policy { "instance_ids" : [ "61a4ea66210545909d74a05c27a7179ein07", "61a4ea66210545909d74a05c27a7180in07", "61a4ea66210545909d74a05c27a7181in07" ], "backup_policy" : { "begin_time" : "19:00", "end_time" : "20:00", "policies" : [ { "period" : "* * 1,2,3,4,5,6,7", "retention_days" : 7, "policy_type" : "base" }, { "period" : "* * 1,2,3,4,7", "retention_days" : 1, "policy_type" : "sparse" } ] } }
Example Response
Status code: 200
Success.
{
"failed_results" : [ {
"instance_id" : "61a4ea66210545909d74a05c27a7179ein07",
"error_code" : "DBS.280500",
"error_msg" : "Instance status not allowed"
}, {
"instance_id" : "71a4ea66210545909d74a05c27a7179ein07",
"error_code" : "DBS.280404",
"error_msg" : "Instance not found"
} ],
"success_count" : 3,
"failed_count" : 2
} Status Code
For details, see Status Codes.
Error Code
For details, see Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot