S3 put object lock

The put object lock API places a lock configuration on the selected bucket. With object lock, you can store objects using a Write-Once-Read-Many (WORM) model. Object lock ensures an object is not deleted or overwritten, for a fixed amount of time or indefinitely. The rule specified in the object lock configuration is applied by default to every new object placed in the selected bucket.

For more information about the WORM model, see Ceph Object Gateway.

Note: Enable the object lock when creating a bucket otherwise, the operation fails.

Syntax

PUT /BUCKET?object-lock HTTP/1.1

Example

PUT /testbucket?object-lock HTTP/1.1

Request Entities

ObjectLockConfiguration

Description

A container for the request.

Type

Container

Required

Yes

ObjectLockEnabled

Description

Indicates whether this bucket has an object lock configuration enabled.

Type

String

Required

Yes

Rule

Description

The object lock rule in place for the specified bucket.

Type

Container

Required

No

DefaultRetention

Description

The default retention period applied to new objects placed in the specified bucket.

Type

Container

Required

No

Mode

Description

The default object lock retention mode. Valid values: GOVERNANCE/COMPLIANCE.

Type

Container

Required

Yes

Days

Description

The number of days specified for the default retention period.

Type

Integer

Required

No

Years

Description

The number of years specified for the default retention period.

Type

Integer

Required

No

HTTP Response

400

Status Code

MalformedXML

Description

The XML is not well-formed.

409

Status Code

InvalidBucketState

Description

The bucket object lock is not enabled.

Reference

  • For more information about this API call, see S3 API.