PUT /?object-lock HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth String
<ObjectLockConfiguration><ObjectLockEnabled>Enabled</ObjectLockEnabled><Rule><DefaultRetention><Mode>COMPLIANCE</Mode><Days>30</Days></DefaultRetention></Rule></ObjectLockConfiguration>
Node Name (Keyword) | Parent Node | Description | Type | Mandatory |
ObjectLockConfiguration | None | Object lock configuration. | Container | Yes |
ObjectLockEnabled | ObjectLockConfiguration | Whether to enable the object lock function. Only Enabled is supported for input. Once the object lock function is enabled, it cannot be disabled. | String | Yes |
Rule | ObjectLockConfiguration | Object lock rules. | Container | No |
DefaultRetention | ObjectLockConfiguration.Rule | Default retention period and mode of the object lock function for a storage bucket. For an object that does not carry a lock header, the retention period should be set in accordance with the bucket configuration. The configuration of the storage bucket supports deletion and modification. | Container | Yes |
Days | ObjectLockConfiguration.Rule.DefaultRetention | Default object lock period (range: 1-36500). | Int | Yes |
Mode | ObjectLockConfiguration.Rule.DefaultRetention | Default object lock mode. Only the enumerated value COMPLIANCE is supported.
If this field remains unfilled, the default value will be COMPLIANCE . | Enum | No |
PUT /?object-lock HTTP/1.1Host: exmaplebucket-1250000000.cos.ap-beijing.myqcloud.comContent-Length: 281Content-Type: application/x-www-form-urlencodedAuthorization: Auth String<ObjectLockConfiguration><ObjectLockEnabled>Enabled</ObjectLockEnabled></ObjectLockConfiguration>
HTTP/1.1 200 OKContent-Length: 0Connection: keep-aliveDate: Fri, 09 Dec 2022 08:17:20 GMTServer: tencent-cosx-cos-request-id: NjM5MmVmMTBfNmM0ZTQ0MGJfMjA4****
PUT /?object-lock HTTP/1.1Host: exmaplebucket-1250000000.cos.ap-beijing.myqcloud.comContent-Length: 281Content-Type: application/x-www-form-urlencodedAuthorization: Auth String<ObjectLockConfiguration><ObjectLockEnabled>Enabled</ObjectLockEnabled><Rule><DefaultRetention><Days>1</Days><Mode>COMPLIANCE</Mode></DefaultRetention></Rule></ObjectLockConfiguration>
HTTP/1.1 200 OKContent-Length: 0Connection: keep-aliveDate: Fri, 09 Dec 2022 08:17:20 GMTServer: tencent-cosx-cos-request-id: NjM5MmVmMTBfNmM0ZTQ0MGJfMjA4****
PUT /?object-lock HTTP/1.1Host: exmaplebucket-1250000000.cos.ap-beijing.myqcloud.comContent-Length: 281Content-Type: application/x-www-form-urlencodedAuthorization: Auth String<ObjectLockConfiguration><ObjectLockEnabled>Enabled</ObjectLockEnabled><Rule><DefaultRetention><Days>10</Days><Mode>COMPLIANCE</Mode></DefaultRetention></Rule></ObjectLockConfiguration>
HTTP/1.1 200 OKContent-Length: 0Connection: keep-aliveDate: Fri, 09 Dec 2022 08:17:20 GMTServer: tencent-cosx-cos-request-id: NjM5MmVmMTBfNmM0ZTQ0MGJfMjA4****
Was this page helpful?