putObjectLockConfiguration method
Sets up object locks in a versioned bucket: enables or disables object locks and configures default locks.
With object lock enabled, you can lock an object version so that it cannot be deleted or overwritten:
- When uploading the object (the upload method).
- After uploading the object (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 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 lock settings. Path: |
Mode |
Default retention type:
Path: |
Days |
Default retention period in days since the object version upload. It must be a positive integer. You cannot use it together with Path: |
Years |
Default retention period in years since the object version upload. It must be a positive integer. You cannot use it together with Path: |
Response
Headers
Responses can only contain common headers.
Response codes
For a list of possible responses, see Responses.