tencent cloud

Feedback

GET Bucket ObjectLockConfiguration

Last updated: 2024-03-28 18:12:17

    Function Description

    The GET Bucket ObjectLockConfiguration interface is used to retrieve the object lock configuration of a bucket.

    Request

    Request Example

    GET /?object-lock HTTP/1.1
    Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
    Date: GMT Date
    Authorization: Auth String
    Note:
    Host: <BucketName-APPID>.cos.<Region>.myqcloud.com. <BucketName-APPID> indicates the bucket name suffixed with APPID, for instance, examplebucket-1250000000. Refer to Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions. <Region> indicates the available regions of COS, for which you can refer to Regions and Access Endpoints.
    Authorization: Auth String (for details, refer to Request Signature).

    Request Headers

    This interface only uses common request headers. For further details, refer to Common Request Headers.

    Request Body

    The request body is empty.

    Response

    Response Headers

    This interface only returns common response headers. For more information, refer to Common Response Headers.

    Response Body

    <?xml version="1.0" encoding="UTF-8" ?>
    <ObjectLockConfiguration>
    <ObjectLockEnabled>Enabled</ObjectLockEnabled>
    <Rule>
    <DefaultRetention>
    <Mode>COMPLIANCE</Mode>
    <Days>30</Days>
    </DefaultRetention>
    </Rule>
    </ObjectLockConfiguration>
    The specific data is described as follows:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    ObjectLockConfiguration
    None
    Object lock configuration.
    Container
    ObjectLockEnabled
    ObjectLockConfiguration
    Whether to enable the object lock function. Only Enabled is supported. Once the object lock function is enabled, it cannot be disabled.
    String
    Rule
    ObjectLockConfiguration
    Object lock rule, which is used for stipulating the default period and mode of object lock in a bucket. This rule supports deletion and modification, and may potentially be left blank.
    Container
    DefaultRetention
    ObjectLockConfiguration.Rule
    Default period and mode of the bucket object lock. Objects without carrying lock headers adhere to the retention period set by the bucket configuration.
    Container
    Days
    ObjectLockConfiguration.Rule.DefaultRetention
    Default period of object lock (ranging from 1 to 36500).
    Int
    Mode
    ObjectLockConfiguration.Rule.DefaultRetention
    Default mode of object lock, which only supports the enumerated value COMPLIANCE.
    Enum

    Error Codes

    This interface adheres to unified error responses and error codes. For details, refer to Error Codes.

    Examples

    Example 1: Obtaining Object Lock Configuration Information When Default Lock Mode and Retention Period Are Not Set

    Request

    GET /?object-lock HTTP/1.1
    Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
    Authorization: Auth String

    Response

    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 180
    Connection: keep-alive
    Date: Fri, 09 Dec 2022 08:31:25 GMT
    Server: tencent-cos
    x-cos-request-id: NjM5MmYyNWNfMzBkMDM4MGJfMmUzNzFfM****
    
    <ObjectLockConfiguration>
    <ObjectLockEnabled>Enabled</ObjectLockEnabled>
    </ObjectLockConfiguration>

    Example 2: Obtaining Object Lock Configuration Information When Default Lock Mode and Retention Period Are Set

    Request

    GET /?object-lock HTTP/1.1
    Host: examplebucket2-1250000000.cos.ap-beijing.myqcloud.com
    Authorization: Auth String

    Response

    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 180
    Connection: keep-alive
    Date: Fri, 09 Dec 2022 08:31:25 GMT
    Server: tencent-cos
    x-cos-request-id: NjM5MmYyNWNfMzBkMDM4MGJfMmUzNzFfM****
    
    <ObjectLockConfiguration>
    <ObjectLockEnabled>Enabled</ObjectLockEnabled>
    <Rule>
    <DefaultRetention>
    <Mode>COMPLIANCE</Mode>
    <Days>30</Days>
    </DefaultRetention>
    </Rule>
    </ObjectLockConfiguration>