This operation returns the default WORM policy of a bucket.
To perform this operation, you must have the GetBucketObjectLockConfiguration permission. By default, only the bucket owner can perform this operation. The bucket owner can grant the permission to other users by configuring the bucket policy or user policy.
If you have never configured the default bucket-level retention policy after you enable WORM for a bucket, you can still use this API to check whether WORM is enabled.
GET /?object-lock HTTP/1.1Host: bucketname.obs.region.example.comDate: dateAuthorization: authorizationContent-Type: application/xmlContent-Length: length
This request contains no message parameters.
This request uses common headers. For details, see Table 3.
This request involves no elements.
HTTP/1.1 status_codeDate: dateContent-Type: application/xmlContent-Length: length<?xml version="1.0" encoding="UTF-8"?><ObjectLockConfiguration xmlns="http://obs.region.example.com/doc/2015-06-30/"><ObjectLockEnabled>Enabled</ObjectLockEnabled><Rule><DefaultRetention><Days>integer</Days><Mode>COMPLIANCE</Mode><Years>integer</Years></DefaultRetention></Rule></ObjectLockConfiguration>
This response uses common headers. For details, see Table 1.
Table 1 describes the elements of the default bucket-level WORM policy in the response.
Parameter | Type | Description |
|---|---|---|
ObjectLockConfiguration | Container | Definition: Container for bucket-level WORM configurations. ObjectLockConfiguration is the parent node of ObjectLockEnabled and Rule. Range: For details, see Table 2. |
Parameter | Type | Description |
|---|---|---|
ObjectLockEnabled | String | Definition: Bucket-level WORM status. Range: Enabled: Bucket-level WORM is enabled. |
Rule | Container | Definition: Rule container of a bucket-level WORM policy. If the default bucket-level WORM policy has never been configured, the returned information does not contain this part. Rule is the parent node of DefaultRetention. Range: For details, see Table 3. |
Parameter | Type | Description |
|---|---|---|
DefaultRetention | Container | Definition: Container of the bucket-level default WORM policy. DefaultRetention is the parent node of Mode, Days, and Years. Range: For details, see Table 4. |
Parameter | Type | Description |
|---|---|---|
Mode | String | Definition: Default retention policy. Range: COMPLIANCE: compliance mode |
Days | Integer | Definition: Default retention days. Range: 1 to 36500 |
Years | Integer | Definition: Default retention years. Range: 1 to 100 |
Table 5 describes possible special errors in this request.
Error Code | Description | HTTP Status Code |
|---|---|---|
InvalidRequest | The object lock is disabled for the bucket. | 400 |
For other errors, see Table 2.
Get the configuration where the bucket has WORM enabled, but has no default retention policy configured.
GET /?object-lock HTTP/1.1User-Agent: curl/7.29.0Host: examplebucket.obs.region.example.comAccept: */*Date: WED, 01 Jul 2015 02:25:05 GMTAuthorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw=Content-Length: 0
HTTP/1.1 200 OKServer: OBSx-obs-request-id: BF260000016435CE298386946AE4C482x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCT9W2tcvLmMJ+plfdopaD62S0npbaRUzDate: WED, 01 Jul 2015 02:25:06 GMTContent-Length: 157<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ObjectLockConfiguration xmlns="http://obs.region.example.com/doc/2015-06-30/"><ObjectLockEnabled>Enabled</ObjectLockEnabled></ObjectLockConfiguration>
Get the configuration where the bucket has WORM enabled and has the default retention policy configured.
GET /?object-lock HTTP/1.1User-Agent: curl/7.29.0Host: examplebucket.obs.region.example.comAccept: */*Date: WED, 01 Jul 2015 02:25:05 GMTAuthorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw=Content-Length: 0
HTTP/1.1 200 OKServer: OBSx-obs-request-id: BF260000016435CE298386946AE4C482x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCT9W2tcvLmMJ+plfdopaD62S0npbaRUzDate: WED, 01 Jul 2015 02:25:06 GMTContent-Length: 157<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ObjectLockConfiguration xmlns="http://obs.region.example.com/doc/2015-06-30/"><ObjectLockEnabled>Enabled</ObjectLockEnabled><Rule><DefaultRetention><Mode>COMPLIANCE</Mode><Days>10</Days><Years>0</Years></DefaultRetention></Rule></ObjectLockConfiguration>