Available in Classic and VPC
Apply object lock settings on an Ncloud Storage bucket. With object lock, you can preserve objects so that they cannot be deleted or modified for a specified period or indefinitely.
Request
This section describes the request format. The method and URI are as follows:
| Method | URI |
|---|---|
| PUT | - |
Request headers
The following describes the request headers.
For information about the headers common to all Ncloud Storage APIs, see Ncloud Storage request headers.
| Field | Required | Description |
|---|---|---|
Content-MD5 |
Conditional | Base64-encoded 128-bit MD5 hash of the request body
|
x-amz-checksum-* |
Conditional | Checksum hash value
|
Request body
You can include the following data in the body of your request:
| Field | Type | Required | Description |
|---|---|---|---|
ObjectLockConfiguration |
Object | Required | Object lock settings |
ObjectLockConfiguration.ObjectLockEnabled |
String | Required | Whether object lock is enabled
|
ObjectLockConfiguration.Rule |
Object | Optional | Default retention rule
|
ObjectLockConfiguration.Rule.DefaultRetention |
Object | Optional | Default retention settings
|
ObjectLockConfiguration.Rule.DefaultRetention.Mode |
String | Optional | Default retention mode
|
ObjectLockConfiguration.Rule.DefaultRetention.Days |
Integer | Optional | Default retention period (days)
|
ObjectLockConfiguration.Rule.DefaultRetention.Years |
Integer | Optional | Default retention period (years)
|
Request example
The request example is as follows:
PUT /?object-lock HTTP/1.1
Host: {Bucket}.kr.ncloudstorage.com
Content-MD5: {MD5 hash value}
<?xml version="1.0" encoding="UTF-8"?>
<ObjectLockConfiguration>
<ObjectLockEnabled>Enabled</ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Mode>GOVERNANCE</Mode>
<Days>30</Days>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>
Response
This section describes the response format.
Response headers
For information about the headers common to all Ncloud Storage APIs, see Ncloud Storage response headers.
Response status codes
The following describes the response status codes.
For information about the HTTP status codes common to all Ncloud Storage APIs, see Common Ncloud Storage response status codes.
| Error code | HTTP status code | Description |
|---|---|---|
InvalidArgument |
400 | The default retention period is outside the valid range.
|
MalformedXML |
400 | The request body XML does not conform to the schema.
|
Response example
The response example is as follows:
HTTP/1.1 200 OK