locks
Creates, updates, deletes, gets or lists a locks resource.
Overview
| Name | locks |
| Type | Resource |
| Id | cloudflare.r2.locks |
Fields
The following fields are returned by SELECT queries:
- list
Success Response.
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for this rule. (example: Lock all objects for 24 hours) |
condition | object | Condition to apply a lock rule to an object for how long in seconds. |
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. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | bucket_name, account_id | cf-r2-jurisdiction | Get lock rules for a bucket. |
update | exec | bucket_name, account_id | cf-r2-jurisdiction | Set lock rules for a bucket. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
bucket_name | string | The R2 bucket name. |
cf-r2-jurisdiction | string |
SELECT examples
- list
Get lock rules for a bucket.
SELECT
id,
condition,
enabled,
prefix
FROM cloudflare.r2.locks
WHERE bucket_name = '{{ bucket_name }}' -- required
AND account_id = '{{ account_id }}' -- required
AND cf-r2-jurisdiction = '{{ cf-r2-jurisdiction }}'
;
Lifecycle Methods
- update
Set lock rules for a bucket.
EXEC cloudflare.r2.locks.update
@bucket_name='{{ bucket_name }}' --required,
@account_id='{{ account_id }}' --required,
@cf-r2-jurisdiction='{{ cf-r2-jurisdiction }}'
@@json=
'{
"rules": "{{ rules }}"
}'
;