Skip to content
Start here

Locks

Get Bucket Lock Rules
client.r2.buckets.locks.get(stringbucketName, LockGetParams { account_id, jurisdiction } params, RequestOptionsoptions?): LockGetResponse { rules }
GET/accounts/{account_id}/r2/buckets/{bucket_name}/lock
Put Bucket Lock Rules
client.r2.buckets.locks.update(stringbucketName, LockUpdateParams { account_id, rules, jurisdiction } params, RequestOptionsoptions?): LockUpdateResponse
PUT/accounts/{account_id}/r2/buckets/{bucket_name}/lock
ModelsExpand Collapse
LockGetResponse { rules }
rules?: Array<Rule>
id: string

Unique identifier for this rule.

condition: R2LockRuleAgeCondition { maxAgeSeconds, type } | R2LockRuleDateCondition { date, type } | R2LockRuleIndefiniteCondition { type }

Condition to apply a lock rule to an object for how long in seconds.

One of the following:
R2LockRuleAgeCondition { maxAgeSeconds, type }

Condition to apply a lock rule to an object for how long in seconds.

maxAgeSeconds: number
type: "Age"
R2LockRuleDateCondition { date, type }

Condition to apply a lock rule to an object until a specific date.

date: string
formatdate-time
type: "Date"
R2LockRuleIndefiniteCondition { type }

Condition to apply a lock rule indefinitely.

type: "Indefinite"
enabled: boolean

Whether or not this rule is in effect.

prefix?: string

Rule will only apply to objects/uploads in the bucket that start with the given prefix, an empty prefix can be provided to scope rule to all objects/uploads.

LockUpdateResponse = unknown