Updated on 2022-12-12 GMT+08:00

Setting an Automated Backup Policy

Description

This API is used to set an automated backup policy.

URI

  • URI format

    PUT https://{Endpoint}/v3/{project_id}/instances/{instance_id}/backups/policy

  • URI example

    https://dds.ap-southeast-1.myhuaweicloud.com/v3/97b026aa9cc4417888c14c84a1ad9860/instances/cc6345c64cec47499182467ea0dd432ain02/backups/policy

Table 1 Request parameters

Name

Type

IN

Mandatory

Description

x-auth-token

string

header

Yes

User token

project_id

string

path

Yes

Project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID.

instance_id

string

path

Yes

Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one.

Requests

  • Parameter description
    Table 2 Parameter description

    Name

    Type

    Mandatory

    Description

    backup_policy

    Object

    Yes

    The backup policy object, including the backup retention period (days) and start time. For more information, see Table 3.

    Table 3 Data structure description of the backup_policy field

    Name

    Type

    Mandatory

    Description

    keep_days

    String

    Yes

    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

    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.

    Example value:

    23:00-00:00

    period

    String

    No

    The backup cycle configuration. Data will be automatically backed up on the selected days every week.

    Value range: The value is a list of digits separated by commas (,). Each digit indicates a day of 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
  • Request example
    Enable or modify an automated backup policy.
    {  
        "backup_policy": { 
            "keep_days": 9,
            "start_time": "23:00-00:00",
            "period": "1,4,5,6,7" 
        }
    }
    Disable an automated backup policy.
    {
        "backup_policy": {
            "keep_days": 0
        }
    }

Responses

{}

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.