百度智能云

All Product Document

          Object Storage

          InitBucketObjectLock

          Interface Description

          It is used to create a time-based compliance retention policy for the specified bucket. At this moment, 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 at 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 when the data in the bucket is in the PROTECTED status, the BOS API returns “409 FileImmutable Error?”.

          Request

          • Request syntax

            POST /?objectlock HTTP/1.1
            Host: <BucketName>.bj.bcebos.com
            Date: <Date>
            Authorization: <AuthorizationString>
            Content-Type: application/json; charset=utf-8
            Content-Length: <ContentLength>
            
            { 
               "retentionDays" : 30
            }
          • Request header field

            No special request header field.

          • Request parameters

          Name Type Description Required?
          retentionDays int Protection period (days) Yes

          Response

          • Response header field

            No special parameters.

          • Response element

            No special parameters.

          Example

          • Request example

            POST /?objectlock HTTP/1.1
            Host: <BucketName>.bj.bcebos.com
            x-bce-date: 2016-04-06T06:34:40Z
            Authorization: AuthorizationString
            
            { 
                "retentionDays" : 30
            }
          • Response example

            HTTP/1.1 200 OK
            x-bce-request-id: 4db2b34d-654d-4d8a-b49b-3049ca786409
            Content-Length: 0
            Date: Wed, 06 Apr 2016 06:34:40 GMT
            Server: BceBos
          Previous
          GetBucketObjectLock
          Next
          Copyright Protection