CreatePolicyV2
Creates a policy.
Operation description
A backup policy records the information required for backups. After a backup policy is executed, a backup job is generated to record the backup progress and results. If the backup job succeeds, a backup snapshot is generated. You can use the backup snapshot to create a restore job.
-
A backup policy supports multiple data sources, including NAS backup, OSS backup, ECS instance backup, ECS File Backup Standard Edition, local file backup, Tablestore backup, and CPFS backup.
-
A backup policy supports only a single backup cycle policy with a fixed interval.
-
A backup policy can back up data to only one backup vault.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hbr:CreatePolicyV2 |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| PolicyName |
string |
No |
The policy name. |
Daily local backup + cross-region backup |
| PolicyType |
string |
No |
The policy type. Valid values:
If you do not specify the policy type, Cloud Backup automatically sets the policy type based on whether a backup vault is specified in the policy rules:
|
STANDARD |
| PolicyDescription |
string |
No |
The policy description. |
Back up once every day at 10:00 AM, and perform cross-region backup to Shanghai. |
| Rules |
array<object> |
No |
The list of policy rules. |
|
|
array<object> |
No |
The policy rule. |
||
| RuleType |
string |
Yes |
The rule type. Each policy must contain at least one BACKUP rule and exactly one TRANSITION rule. Valid values:
Valid values:
|
BACKUP |
| Schedule |
string |
No |
The backup schedule. This parameter is required only when RuleType is set to BACKUP. Valid formats:
Missed backup jobs are not compensated. If the previous backup job is not completed, the next backup job is not triggered. |
I|1648647166|P1D |
| BackupType |
string |
No |
The backup type. This parameter is required only when RuleType is set to BACKUP. A value of COMPLETE indicates a full backup. Valid values:
|
COMPLETE |
| Retention |
integer |
No |
The retention period. This parameter is required only when RuleType is set to BACKUP, TRANSITION, or REPLICATION.
|
7 |
| ReplicationRegionId |
string |
No |
The ID of the destination region for replication. This parameter is required only when RuleType is set to REPLICATION. |
cn-shanghai |
| ArchiveDays |
integer |
No |
The number of days after a backup is completed before it is automatically transitioned to the archive tier. This parameter is required only when RuleType is set to TRANSITION. The backup must be retained in the standard tier for at least 30 days and in the archive tier for at least 60 days after the transition. Unit: days. |
90 |
| RetentionRules |
array<object> |
No |
The special retention rules. This parameter is required only when RuleType is set to TRANSITION. |
|
|
object |
No |
The special retention rule. |
||
| AdvancedRetentionType |
string |
No |
The type of the special retention rule. Valid values:
|
YEARLY |
| WhichSnapshot |
integer |
No |
The sequence number of the backup to which the rule applies. Currently, only the first backup is supported. Set the value to 1. |
1 |
| Retention |
integer |
No |
The special retention period of the backup. Minimum value: 1. Unit: days. |
730 |
| VaultId |
string |
No |
The ID of the backup vault. This parameter is required only when RuleType is set to BACKUP. |
v-0001************aseg |
| KeepLatestSnapshots |
integer |
No |
Specifies whether to retain at least one backup version. Valid values:
|
1 |
| Immutable |
boolean |
No |
Specifies whether to enable backup locking. This parameter is required only when PolicyType is set to UDM_ECS_ONLY and RuleType is set to SECURITY. |
true |
| DataSourceFilters |
array<object> |
No |
The data source filtering rules. This parameter is required only when RuleType is set to TAG. |
|
|
array<object> |
No |
|||
| SourceType |
string |
No |
The data source type. Valid values:
|
UDM_ECS |
DataSourceIds
deprecated
|
array |
No |
[Deprecated] |
|
deprecated
|
string |
No |
[Deprecated] |
**[Deprecated]** |
| AccountScope |
string |
No |
The account scope to which the policy applies. |
SPECIFIED_ACCOUNT |
| Accounts |
array<object> |
No |
The list of account information in the data source filtering conditions. |
|
|
object |
No |
|||
| CrossAccountType |
string |
No |
The account association type, which is used to distinguish between the current account and cross-account. |
CROSS_ACCOUNT_BY_RD |
| CrossAccountUserId |
integer |
No |
The Alibaba Cloud account ID of the account that owns the resources to be backed up. |
1234567890123456 |
| CrossAccountRoleName |
string |
No |
The name of the RAM role created in the account that owns the resources to be backed up. |
hbrcrossrole |
| TagFilters |
array<object> |
No |
The resource tag filtering rules. This parameter is required only when RuleType is set to TAG. |
|
|
object |
No |
|||
| Key |
string |
No |
The tag key. |
env |
| Value |
string |
No |
The tag value. An empty value indicates any value. |
prod |
| Operator |
string |
No |
The tag matching rule. Valid values:
|
EQUAL |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
CreatePolicyResponse |
||
| Success |
boolean |
Indicates whether the request is successful. Valid values:
|
true |
| Code |
string |
The return code. A value of 200 indicates success. |
200 |
| Message |
string |
The return message. Generally, "successful" is returned for a successful request, and an error message is returned for a failed request. |
successful |
| RequestId |
string |
The request ID. |
EEC65C22-2152-5E31-8AD6-D6CBF1BFF49F |
| PolicyId |
string |
The policy ID. |
po-000000zemnuyx2li3y9y |
Examples
Success response
JSON format
{
"Success": true,
"Code": "200",
"Message": "successful",
"RequestId": "EEC65C22-2152-5E31-8AD6-D6CBF1BFF49F",
"PolicyId": "po-000000zemnuyx2li3y9y"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.