All Products
Search
Document Center

Cloud Backup:CreatePolicyV2

Last Updated:Nov 06, 2024

Creates a backup policy.

Operation description

A backup policy records the information required for backup. After you execute a backup policy, a backup job is generated to record the backup progress and the backup result. If a backup job is completed, a backup snapshot is generated. You can use a backup snapshot to create a restore job.

  • A backup policy supports multiple data sources. The data sources can be only Elastic Compute Service (ECS) instances.
  • You can specify only one interval as a backup cycle in a backup policy.
  • Each backup policy allows you to back up data to only one backup vault.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
hbr:CreatePolicyV2create
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
PolicyNamestringNo

The name of the backup policy.

Daily Local Backup + Remote Backup
PolicyTypestringNo

The policy type. Valid values:

  • STANDARD: the general backup policy. This type of policy applies to backups other than Elastic Compute Service (ECS) instance backup.
  • UDM_ECS_ONLY: This type of policy applies only to ECS instance backup.

If the policy type is not specified, Cloud Backup automatically sets the policy type based on whether the backup vault is specified in the rules of the policy:

  • If the backup vault is specified, Cloud Backup sets the policy type to STANDARD.
  • If the backup vault is not specified, Cloud Backup sets the policy type to UDM_ECS_ONLY.
STANDARD
PolicyDescriptionstringNo

The description of the backup policy.

Data is backed up at 10:00:00 every day and replicated to the China (Shanghai) region for geo-redundancy.
Rulesarray<object>No

The rules in the backup policy.

RuleobjectNo

The details of the rule.

RuleTypestringYes

The type of the rule. Each backup policy must have at least one rule of the BACKUP type and only one rule of the TRANSITION type. Valid values:

  • BACKUP: backup rule
  • TRANSITION: lifecycle rule
  • REPLICATION: replication rule
BACKUP
SchedulestringNo

This parameter is required only if the RuleType parameter is set to BACKUP. This parameter specifies the backup schedule settings. Format: I|{startTime}|{interval}. The system runs the first backup job at a point in time that is specified in the {startTime} parameter and the subsequent backup jobs at an interval that is specified in the {interval} parameter. The system does not run a backup job before the specified point in time. Each backup job, except the first one, starts only after the previous backup job is completed. For example, I|1631685600|P1D specifies that the system runs the first backup job at 14:00:00 on September 15, 2021 and the subsequent backup jobs once a day.

  • startTime: the time at which the system starts to run a backup job. The time must follow the UNIX time format. Unit: seconds.
  • interval: the interval at which the system runs a backup job. The interval must follow the ISO 8601 standard. For example, PT1H specifies an interval of 1 hour. P1D specifies an interval of one day.
I|1648647166|P1D
BackupTypestringNo

This parameter is required only if the RuleType parameter is set to BACKUP. This parameter specifies the backup type. Valid value: COMPLETE, which indicates full backup.

COMPLETE
RetentionlongNo

This parameter is required only if the RuleType parameter is set to TRANSITION or REPLICATION.

  • If the RuleType parameter is set to TRANSITION, this parameter specifies the retention period of the backup data. Minimum value: 1. Maximum value: 364635. Unit: days.
  • If the RuleType parameter is set to REPLICATION, this parameter specifies the retention period of remote backups. Minimum value: 1. Maximum value: 364635. Unit: days.
7
ReplicationRegionIdstringNo

This parameter is required only if the RuleType parameter is set to REPLICATION. This parameter specifies the ID of the destination region.

cn-shanghai
RetentionRulesarray<object>No

This parameter is required only if the RuleType parameter is set to TRANSITION. This parameter specifies the special retention rules.

objectNo

The special retention rule.

AdvancedRetentionTypestringNo

The type of the special retention rule. Valid values:

  • DAILY: retains daily backups
  • WEEKLY: retains weekly backups
  • MONTHLY: retains monthly backups
  • YEARLY: retains yearly backups
YEARLY
WhichSnapshotlongNo

Specifies which backup is retained based on the special retention rule. Only the first backup can be retained.

1
RetentionlongNo

The special retention period of backups. Minimum value: 1. Unit: days.

730
KeepLatestSnapshotslongNo

Specifies whether to enable the feature of keeping at least one backup version. Valid values:

  • 0: The feature is disabled.
  • 1: The feature is enabled.
1

Response parameters

ParameterTypeDescriptionExample
object

CreatePolicyResponse

Successboolean

Indicates whether the call is successful. Valid values:

  • true: The call is successful.
  • false: The call fails.
true
Codestring

The HTTP status code. The status code 200 indicates that the call is successful.

200
Messagestring

The message that is returned. If the call is successful, "successful" is returned. If the call fails, an error message is returned.

successful
RequestIdstring

The ID of the request.

EEC65C22-2152-5E31-8AD6-D6CBF1BFF49F
PolicyIdstring

The ID of the backup policy.

po-000000zemnuyx2li3y9y

Examples

Sample success responses

JSONformat

{
  "Success": true,
  "Code": "200",
  "Message": "successful",
  "RequestId": "EEC65C22-2152-5E31-8AD6-D6CBF1BFF49F",
  "PolicyId": "po-000000zemnuyx2li3y9y"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-09-25The internal configuration of the API is changed, but the call is not affectedView Change Details
2024-09-19The internal configuration of the API is changed, but the call is not affectedView Change Details
2024-07-23The request parameters of the API has changedView Change Details
2024-04-18The internal configuration of the API is changed, but the call is not affectedView Change Details