putObjectLockConfiguration method
Sets up object lock in a versioned bucket: enables or disables object locks and configures default locks.
When object lock is enabled, you can lock an object version so that it can't be deleted or overwritten:
- When loading the object (upload method).
- On object upload (the putObjectRetention and putObjectLegalHold methods).
For more information on getting started with the API and the general request format, see How to use the S3 API.
Request
PUT /{bucket}?object-lock HTTP/2
Path parameters
Parameter | Description |
---|---|
bucket |
Bucket name. |
Headers
Use only common request headers in your requests.
Data schema
<ObjectLockConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<ObjectLockEnabled>string</ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Mode>string</Mode>
<Days>integer</Days>
<Years>integer</Years>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>
Element | Description |
---|---|
ObjectLockConfiguration |
Root element. To disable object lock, provide this parameter with an empty value, e.g., Path: |
ObjectLockEnabled |
Object lock status:
If you do not specify this item, you will get the Path: |
Rule |
Lock settings. Path: |
DefaultRetention |
Default retention settings. Path: |
Mode |
Default retention type:
Path: |
Days |
Retention period in days since the object version upload. It must be a positive integer. You cannot use it along with Path: |
Years |
Retention period in years since the object version upload. It must be a positive integer. You cannot use it along with Path: |
Response
Headers
Responses can only contain common response headers.
Response codes
For a list of possible responses, see Responses.