buckets
Creates, updates, deletes, gets or lists a buckets resource.
Overview
| Name | buckets |
| Type | Resource |
| Id | cloudflare.r2.buckets |
Fields
The following fields are returned by SELECT queries:
- get
- list
Get Bucket response.
| Name | Datatype | Description |
|---|---|---|
name | string | Name of the bucket. (example: example-bucket) |
creation_date | string | Creation timestamp. |
jurisdiction | string | Jurisdiction where objects in this bucket are guaranteed to be stored. (default, eu, fedramp) (default: default, x-stainless-param: jurisdiction) |
location | string | Location of the bucket. (apac, eeur, enam, weur, wnam, oc) (x-stainless-terraform-configurability: computed_optional) |
storage_class | string | Storage class for newly uploaded objects, unless specified otherwise. (Standard, InfrequentAccess) (default: Standard) |
List Buckets response.
| Name | Datatype | Description |
|---|---|---|
name | string | Name of the bucket. (example: example-bucket) |
creation_date | string | Creation timestamp. |
jurisdiction | string | Jurisdiction where objects in this bucket are guaranteed to be stored. (default, eu, fedramp) (default: default, x-stainless-param: jurisdiction) |
location | string | Location of the bucket. (apac, eeur, enam, weur, wnam, oc) (x-stainless-terraform-configurability: computed_optional) |
storage_class | string | Storage class for newly uploaded objects, unless specified otherwise. (Standard, InfrequentAccess) (default: Standard) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | account_id, bucket_name | cf-r2-jurisdiction | Gets properties of an existing R2 bucket. |
list | select | account_id | name_contains, start_after, per_page, order, direction, cursor, cf-r2-jurisdiction | Lists all R2 buckets on your account. |
create | insert | account_id, name | cf-r2-jurisdiction | Creates a new R2 bucket. |
edit | update | account_id, bucket_name | cf-r2-jurisdiction, cf-r2-storage-class | Updates properties of an existing R2 bucket. |
delete | delete | bucket_name, account_id | cf-r2-jurisdiction | Deletes an existing R2 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 | |
cf-r2-storage-class | string | |
cursor | string | |
direction | string | |
name_contains | string | |
order | string | |
per_page | number | |
start_after | string |
SELECT examples
- get
- list
Gets properties of an existing R2 bucket.
SELECT
name,
creation_date,
jurisdiction,
location,
storage_class
FROM cloudflare.r2.buckets
WHERE account_id = '{{ account_id }}' -- required
AND bucket_name = '{{ bucket_name }}' -- required
AND cf-r2-jurisdiction = '{{ cf-r2-jurisdiction }}'
;
Lists all R2 buckets on your account.
SELECT
name,
creation_date,
jurisdiction,
location,
storage_class
FROM cloudflare.r2.buckets
WHERE account_id = '{{ account_id }}' -- required
AND name_contains = '{{ name_contains }}'
AND start_after = '{{ start_after }}'
AND per_page = '{{ per_page }}'
AND order = '{{ order }}'
AND direction = '{{ direction }}'
AND cursor = '{{ cursor }}'
AND cf-r2-jurisdiction = '{{ cf-r2-jurisdiction }}'
;
INSERT examples
- create
- Manifest
Creates a new R2 bucket.
INSERT INTO cloudflare.r2.buckets (
locationHint,
name,
storageClass,
account_id,
cf-r2-jurisdiction
)
SELECT
'{{ locationHint }}',
'{{ name }}' /* required */,
'{{ storageClass }}',
'{{ account_id }}',
'{{ cf-r2-jurisdiction }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: buckets
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the buckets resource.
- name: locationHint
value: "{{ locationHint }}"
description: |
Location of the bucket.
valid_values: ['apac', 'eeur', 'enam', 'weur', 'wnam', 'oc']
- name: name
value: "{{ name }}"
description: |
Name of the bucket.
- name: storageClass
value: "{{ storageClass }}"
description: |
Storage class for newly uploaded objects, unless specified otherwise.
valid_values: ['Standard', 'InfrequentAccess']
default: Standard
- name: cf-r2-jurisdiction
value: "{{ cf-r2-jurisdiction }}"
UPDATE examples
- edit
Updates properties of an existing R2 bucket.
UPDATE cloudflare.r2.buckets
SET
-- No updatable properties
WHERE
account_id = '{{ account_id }}' --required
AND bucket_name = '{{ bucket_name }}' --required
AND cf-r2-jurisdiction = '{{ cf-r2-jurisdiction}}'
AND cf-r2-storage-class = '{{ cf-r2-storage-class}}'
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
Deletes an existing R2 bucket.
DELETE FROM cloudflare.r2.buckets
WHERE bucket_name = '{{ bucket_name }}' --required
AND account_id = '{{ account_id }}' --required
AND cf-r2-jurisdiction = '{{ cf-r2-jurisdiction }}'
;