Skip to content

Commit 80bbb8f

Browse files
authored
Document Wrangler r2 bucket cors command (list, set, delete) (#18468)
1 parent ae73897 commit 80bbb8f

File tree

1 file changed

+107
-54
lines changed

1 file changed

+107
-54
lines changed

src/content/docs/workers/wrangler/commands.mdx

Lines changed: 107 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,57 @@ wrangler r2 bucket list
699699

700700
<Render file="wrangler-commands/global-flags" product="workers" />
701701

702+
### `cors set`
703+
704+
Set the [CORS configuration](/r2/buckets/cors/) for an R2 bucket from a JSON file.
705+
706+
```txt
707+
wrangler r2 bucket cors set <NAME> [OPTIONS]
708+
```
709+
710+
- `NAME` <Type text="string" /> <MetaInfo text="required" />
711+
- The name of the R2 bucket to set the CORS configuration for.
712+
- `--file` <Type text="string" /> <MetaInfo text="required" />
713+
- Path to the JSON file containing CORS configuration (file must be in format of request body of [put bucket CORS policy API](/api/operations/r2-put-bucket-cors-policy)).
714+
- `--jurisdiction` <Type text="string" /> <MetaInfo text="optional" />
715+
- The jurisdiction where the bucket exists, if a jurisdiction has been specified. Refer to [jurisdictional restrictions](/r2/reference/data-location/#jurisdictional-restrictions).
716+
- `--force` <Type text="boolean" /> <MetaInfo text="optional" />
717+
- Skip confirmation when setting CORS configuration.
718+
719+
<Render file="wrangler-commands/global-flags" product="workers" />
720+
721+
### `cors delete`
722+
723+
Clear the [CORS configuration](/r2/buckets/cors/) for an R2 bucket.
724+
725+
```txt
726+
wrangler r2 bucket cors delete <NAME> [OPTIONS]
727+
```
728+
729+
- `NAME` <Type text="string" /> <MetaInfo text="required" />
730+
- The name of the R2 bucket to delete the CORS configuration for.
731+
- `--jurisdiction` <Type text="string" /> <MetaInfo text="optional" />
732+
- The jurisdiction where the bucket exists, if a jurisdiction has been specified. Refer to [jurisdictional restrictions](/r2/reference/data-location/#jurisdictional-restrictions).
733+
- `--force` <Type text="boolean" /> <MetaInfo text="optional" />
734+
- Skip confirmation when clearing the CORS configuration.
735+
736+
<Render file="wrangler-commands/global-flags" product="workers" />
737+
738+
### `cors list`
739+
740+
List the [CORS configuration](/r2/buckets/cors/) rules for an R2 bucket.
741+
742+
```txt
743+
wrangler r2 bucket cors list <NAME> [OPTIONS]
744+
```
745+
746+
- `NAME` <Type text="string" /> <MetaInfo text="required" />
747+
- The name of the R2 bucket to list the CORS rules for.
748+
- `--jurisdiction` <Type text="string" /> <MetaInfo text="optional" />
749+
- The jurisdiction where the bucket exists, if a jurisdiction has been specified. Refer to [jurisdictional restrictions](/r2/reference/data-location/#jurisdictional-restrictions).
750+
751+
<Render file="wrangler-commands/global-flags" product="workers" />
752+
702753
### `dev-url enable`
703754

704755
Enable public access via the [r2.dev URL](/r2/buckets/public-buckets/#enable-managed-public-access) for an R2 bucket.
@@ -824,59 +875,6 @@ wrangler r2 bucket domain list <NAME> [OPTIONS]
824875

825876
<Render file="wrangler-commands/global-flags" product="workers" />
826877

827-
### `notification create`
828-
829-
Create an [event notification](/r2/buckets/event-notifications/) rule for an R2 bucket.
830-
831-
```txt
832-
wrangler r2 bucket notification create <NAME> [OPTIONS]
833-
```
834-
835-
- `NAME` <Type text="string" /> <MetaInfo text="required" />
836-
- The name of the R2 bucket to create an event notification rule for.
837-
- `--event-type` <Type text="'object-create'|'object-delete'[]" /> <MetaInfo text="required" />
838-
- The [type of event(s)](/r2/buckets/event-notifications/#event-types) that will trigger event notifications.
839-
- `--queue` <Type text="string" /> <MetaInfo text="required" />
840-
- The name of the queue that will receive event notification messages.
841-
- `--prefix` <Type text="string" /> <MetaInfo text="optional" />
842-
- The prefix that an object must match to emit event notifications (note: regular expressions are not supported).
843-
- `--suffix` <Type text="string" /> <MetaInfo text="optional" />
844-
- The suffix that an object must match to emit event notifications (note: regular expressions are not supported).
845-
- `--description` <Type text="string" /> <MetaInfo text="optional" />
846-
- A description that can be used to identify the event notification rule after creation.
847-
848-
<Render file="wrangler-commands/global-flags" product="workers" />
849-
850-
### `notification delete`
851-
852-
Remove an event notification rule from a bucket's [event notification](/r2/buckets/event-notifications/) configuration.
853-
854-
```txt
855-
wrangler r2 bucket notification delete <NAME> [OPTIONS]
856-
```
857-
858-
- `NAME` <Type text="string" /> <MetaInfo text="required" />
859-
- The name of the R2 bucket to delete an event notification rule for.
860-
- `--queue` <Type text="string" /> <MetaInfo text="required" />
861-
- The name of the queue that corresponds to the event notification rule. If no `rule` is provided, all event notification rules associated with the queue will be deleted.
862-
- `--rule` <Type text="string" /> <MetaInfo text="optional" />
863-
- The ID of the event notification rule to delete.
864-
865-
<Render file="wrangler-commands/global-flags" product="workers" />
866-
867-
### `notification list`
868-
869-
List the [event notification](/r2/buckets/event-notifications/) rules for a bucket.
870-
871-
```txt
872-
wrangler r2 bucket notification list <NAME>
873-
```
874-
875-
- `NAME` <Type text="string" /> <MetaInfo text="required" />
876-
- The name of the R2 bucket to get event notification rules for.
877-
878-
<Render file="wrangler-commands/global-flags" product="workers" />
879-
880878
### `lifecycle add`
881879

882880
Add an [object lifecycle](/r2/buckets/object-lifecycles/) rule to an R2 bucket.
@@ -954,6 +952,61 @@ wrangler r2 bucket lifecycle set <NAME> [OPTIONS]
954952
- Path to the JSON file containing lifecycle configuration (file must be in format of request body of [put object lifecycle configuration API](/api/resources/r2/subresources/buckets/subresources/lifecycle/methods/update/)).
955953
- `--jurisdiction` <Type text="string" /> <MetaInfo text="optional" />
956954
- The jurisdiction where the bucket exists, if a jurisdiction has been specified. Refer to [jurisdictional restrictions](/r2/reference/data-location/#jurisdictional-restrictions).
955+
- `--force` <Type text="boolean" /> <MetaInfo text="optional" />
956+
- Skip confirmation when setting object lifecycle configuration.
957+
958+
<Render file="wrangler-commands/global-flags" product="workers" />
959+
960+
### `notification create`
961+
962+
Create an [event notification](/r2/buckets/event-notifications/) rule for an R2 bucket.
963+
964+
```txt
965+
wrangler r2 bucket notification create <NAME> [OPTIONS]
966+
```
967+
968+
- `NAME` <Type text="string" /> <MetaInfo text="required" />
969+
- The name of the R2 bucket to create an event notification rule for.
970+
- `--event-type` <Type text="'object-create'|'object-delete'[]" /> <MetaInfo text="required" />
971+
- The [type of event(s)](/r2/buckets/event-notifications/#event-types) that will trigger event notifications.
972+
- `--queue` <Type text="string" /> <MetaInfo text="required" />
973+
- The name of the queue that will receive event notification messages.
974+
- `--prefix` <Type text="string" /> <MetaInfo text="optional" />
975+
- The prefix that an object must match to emit event notifications (note: regular expressions are not supported).
976+
- `--suffix` <Type text="string" /> <MetaInfo text="optional" />
977+
- The suffix that an object must match to emit event notifications (note: regular expressions are not supported).
978+
- `--description` <Type text="string" /> <MetaInfo text="optional" />
979+
- A description that can be used to identify the event notification rule after creation.
980+
981+
<Render file="wrangler-commands/global-flags" product="workers" />
982+
983+
### `notification delete`
984+
985+
Remove an event notification rule from a bucket's [event notification](/r2/buckets/event-notifications/) configuration.
986+
987+
```txt
988+
wrangler r2 bucket notification delete <NAME> [OPTIONS]
989+
```
990+
991+
- `NAME` <Type text="string" /> <MetaInfo text="required" />
992+
- The name of the R2 bucket to delete an event notification rule for.
993+
- `--queue` <Type text="string" /> <MetaInfo text="required" />
994+
- The name of the queue that corresponds to the event notification rule. If no `rule` is provided, all event notification rules associated with the queue will be deleted.
995+
- `--rule` <Type text="string" /> <MetaInfo text="optional" />
996+
- The ID of the event notification rule to delete.
997+
998+
<Render file="wrangler-commands/global-flags" product="workers" />
999+
1000+
### `notification list`
1001+
1002+
List the [event notification](/r2/buckets/event-notifications/) rules for a bucket.
1003+
1004+
```txt
1005+
wrangler r2 bucket notification list <NAME>
1006+
```
1007+
1008+
- `NAME` <Type text="string" /> <MetaInfo text="required" />
1009+
- The name of the R2 bucket to get event notification rules for.
9571010

9581011
<Render file="wrangler-commands/global-flags" product="workers" />
9591012

@@ -1750,7 +1803,7 @@ wrangler queues info <name>
17501803
```
17511804

17521805
- `name` <Type text="string" /> <MetaInfo text="required" />
1753-
- The name of the queue to inspect.
1806+
- The name of the queue to inspect.
17541807

17551808
### `consumer`
17561809

0 commit comments

Comments
 (0)