文档数据库服务
| Details
  • 查询API版本
    • ListApiVersion
    • ShowApiVersion
  • 引擎版本和规格
    • ListDatastoreVersions
    • ListFlavorInfos
    • ListFlavors
    • ListStorageType
  • 实例管理
    • AddReadonlyNode
    • AddShardingNode
    • AttachEip
    • AttachInternalIp
    • BatchUpgradeDatabaseVersion
    • CancelEip
    • ChangeOpsWindow
    • CheckWeakPassword
    • CreateInstance
    • CreateIp
    • DeleteInstance
    • DeleteLtsConfig
    • DeleteReadonlyNode
    • ExpandReplicasetNode
    • ListAz2Migrate
    • ListInstances
    • ListLtsConfigs
    • ListRecycleInstances
    • ListSslCertDownloadAddress
    • MigrateAz
    • ResizeInstance
    • ResizeInstanceVolume
    • RestartInstance
    • SetAutoEnlargePolicies
    • SetRecyclePolicy
    • ShowAutoEnlargePolicy
    • ShowClientNetwork
    • ShowDiskUsage
    • ShowRecyclePolicy
    • ShowReplSetName
    • ShowSecondLevelMonitoringStatus
    • ShowUpgradeDuration
    • ShrinkInstanceNodes
    • SwitchoverReplicaSet
    • SwitchSecondLevelMonitoring
    • SwitchSsl
    • UpdateClientNetwork
    • UpdateInstanceName
    • UpdateInstancePort
    • UpdateInstanceRemark
    • UpdateLtsConfig
    • UpdateReplSetName
    • UpdateSecurityGroup
    • UpgradeDatabaseVersion
  • 连接管理
    • DeleteSession
    • ListSessions
    • ShowConnectionStatistics
  • 备份与恢复
    • BatchDeleteBackup
    • CreateManualBackup
    • DeleteManualBackup
    • ListBackups
    • ListRestoreCollections
    • ListRestoreDatabases
    • ListRestoreTimes
    • RestoreInstance
    • RestoreInstanceFromCollection
    • RestoreNewInstance
    • SetBackupPolicy
    • ShowBackupDownloadLink
    • ShowBackupPolicy
    • StopBackup
  • 获取日志信息
    • DeleteAuditLog
    • DownloadErrorlog
    • DownloadSlowlog
    • ListAuditlogLinks
    • ListAuditlogs
    • ListErrorLogs
    • ListLtsErrorLogs
    • ListLtsSlowLogs
    • ListSlowLogs
    • SetAuditlogPolicy
    • ShowAuditlogPolicy
    • ShowSlowlogDesensitizationSwitch
    • SwitchSlowlogDesensitization
  • 标签管理
    • BatchTagAction
    • ListInstancesByTags
    • ListInstanceTags
    • ListProjectTags
  • 管理数据库和用户
    • CheckPassword
    • CreateDatabaseRole
    • CreateDatabaseUser
    • DeleteDatabaseRole
    • DeleteDatabaseUser
    • ListDatabaseRoles
    • ListDatabases
    • ListDatabaseUsers
    • ResetPassword
    • SetBalancerSwitch
    • SetBalancerWindow
    • ShowShardingBalancer
  • 参数配置
    • CompareConfiguration
    • CopyConfiguration
    • CreateConfiguration
    • DeleteConfiguration
    • ListAppliedInstances
    • ListConfigurations
    • ResetConfiguration
    • ShowConfigurationAppliedHistory
    • ShowConfigurationModifyHistory
    • ShowConfigurationParameter
    • ShowEntityConfiguration
    • ShowInstanceConfigurationModifyHistory
    • SwitchConfiguration
    • UpdateConfigurationParameter
    • UpdateEntityConfiguration
    • ValidateConfigurationName
  • 配额管理
    • ShowQuotas
  • 任务管理
    • ListTasks
    • ShowJobDetail
  • 数据库运维
    • CreateKillOpRule
    • DeleteKillOpRuleList
    • ShowKillOpRuleRuleList
    • SwitchInstancePrimary
    • UpdateKillOpRule
  • 定时任务
    • CancelScheduledTask
    • ListScheduledTasks

SetBackupPolicy

PUT
https://dds.af-south-1.myhuaweicloud.com/v3/{project_id}/instances/{instance_id}/backups/policy
Advanced
Required parameters only
Default
Encrypt sensitive parameters
*
Region
Headers
*
Authorization
Parameters
*
project_id
*
instance_id
Body
*{
*
backup_policy
: {
*
keep_days
:
*
start_time
:
*
period
:
*}
}
API Description

This API is used to set an automated backup policy.

URL
PUT  https://dds.af-south-1.myhuaweicloud.com/v3/{project_id}/instances/{instance_id}/backups/policy
Request Parameters
NameTypeINMandatoryDescription
x-auth-token
stringheader Yes

Specifies the user token obtained from the IAM service.

instance_id
stringpath Yes

Specifies the instance ID, which can be obtained by calling the API for querying instances and details. If you do not have an instance, you can call the API used for creating an instance.

project_id
stringpath Yes

Specifies the project ID of a tenant in a region.

Body Parameters
NameTypeMandatoryDescription
backup_policy
BackupPolicy object Yes

Specifies the backup policy object, including the backup retention period (days) and start time.

Parameter:
backup_policy
NameTypeMandatoryDescription
keep_days
string Yes

Specifies the number of days to retain the generated backup files.The value range is from 0 to 732. The value 0 indicates that the automated backup policy is disabled.

start_time
string No

Specifies the backup time window. Automated backups will be triggered during the backup time window. This parameter is mandatory if the automated backup policy is enabled. This parameter is not transferred if the automated backup policy is disabled. The value must be a valid value in the "hh:mm-HH:MM" format. The current time is in the UTC format.

  • The HH value must be 1 greater than the hh value.
  • The values of mm and MM must be the same and must be set to 00, 15, 30, or 45. Example value:
  • 08:15-09:15
  • 23:00-00:00
period
string No

Specifies the backup cycle configuration. Data will be automatically backed up on the selected days every week. Value range: The value is a number separated by DBS case commas (,). The number indicates the week. The restrictions on the backup retention period are as follows:

  • This parameter is not transferred if its value is set to 0.
  • If you set the retention period to 1 to 6 days, data is automatically backed up each day of the week. Set the parameter value to 1,2,3,4,5,6,7.
  • If you set the retention period to 7 to 732 days, select at least one day of the week for the backup cycle. Example value: 1,2,3,4
Response Parameters
Status code: 200

Success.

Status code: default

Client or server error.

NameTypeDescription
error_code
string

Specifies the error returned when a task submission exception occurs.

error_msg
string

Specifies the description of the error returned when a task submission exception occurs.

Example Request
Example 1

Enable or modify an automated backup policy.

"PUT https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/3d39c18788b54a919bab633874c159dfin02/backups/policy"
{ "backup_policy": { "keep_days": 9, "start_time": "08:15-09:15", "period": "1,4,5,6,7" } }
Example 2

Disable an automated backup policy.

"PUT https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/3d39c18788b54a919bab633874c159dfin02/backups/policy"
{ "backup_policy": { "keep_days": 0 } }
SDK
Click 文档数据库服务 (DDS) SDK to download the SDK in your programming language or view the SDK documentation. To learn how to install an SDK and perform authentication, read Usage.
Error Code

Outline

API Description
URL
Request Parameters
Response Parameters
Example Request
SDK
Error Code