Skip to content
Start here

Locks

Get Bucket Lock Rules
r2.buckets.locks.get(strbucket_name, LockGetParams**kwargs) -> LockGetResponse
GET/accounts/{account_id}/r2/buckets/{bucket_name}/lock
Put Bucket Lock Rules
r2.buckets.locks.update(strbucket_name, LockUpdateParams**kwargs) -> object
PUT/accounts/{account_id}/r2/buckets/{bucket_name}/lock
ModelsExpand Collapse
class LockGetResponse:
rules: Optional[List[Rule]]
id: str

Unique identifier for this rule.

condition: RuleCondition

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

One of the following:
class RuleConditionR2LockRuleAgeCondition:

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

max_age_seconds: int
type: Literal["Age"]
class RuleConditionR2LockRuleDateCondition:

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

date: datetime
formatdate-time
type: Literal["Date"]
class RuleConditionR2LockRuleIndefiniteCondition:

Condition to apply a lock rule indefinitely.

type: Literal["Indefinite"]
enabled: bool

Whether or not this rule is in effect.

prefix: Optional[str]

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.