Baidu AI Cloud
中国站

百度智能云

Object Storage

Initialize Compliance Retention Policy

Interface Description

This interface is used to create a time-based compliance retention policy for the specified bucket. In this case, the policy changes to the IN_PROGRESS status.

Note:

  • This status is valid for 24 hours. The bucket resources corresponding to this policy are in the PROTECTED status within 24 hours. The protection rules are as follows: Assume that you created a bucket named examplebucket on June 1, 2013, and uploaded three objects, including file1.txt, file2.txt, and file3.txt in different times. Subsequently, you created a bucket lock policy with a protection period of 5 years on July 1, 2014. The specific upload date and corresponding expiration date of three objects are as follows:
Object Name Upload Date Object Expiration Date
file1.txt June 01, 2013 May 31, 2018
file2.txt July 01, 2014 June 30, 2019
file3.txt September 30, 2018 September 29, 2023
  • If anyone (including you) attempts to delete or modify the data in the bucket in the PROTECTED status, BOS API returns “409 FileImmutable Error”.

Request URI

POST /v1/{bucketName}/?objectlock

Parameter Name Parameter Type Required Description Example Value Parameter Position
bucketName String Yes Bucket name "bucketName_example" Path

Request Body Parameters

Instructions for Data Structure of Request Body Field

Parameter Name Parameter Type Required Description Example Value
retentionDays Integer Yes Protection period (days) 30

Response Body Parameters

None

Request Example

POST /v1/bucketName_example/?objectlock
Common Request Header


{
  "retentionDays" : 30
}

Response Example

None

Error Code

Refer to the universal error code.

Previous
Get Bucket Compliance Retention Policy
Next
Lock Bucket Compliance Retention Policy