Skip to content

Commit 6b7af22

Browse files
committed
Added sections to R2 bucket lock docs for listing and removing rules
1 parent 01b17d4 commit 6b7af22

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

src/content/docs/r2/buckets/bucket-locks.mdx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ Bucket locks prevent the deletion and overwriting of objects in an R2 bucket for
77

88
## Get started with bucket locks
99

10-
### Prerequisites
11-
1210
Before getting started, you will need:
1311

1412
- An existing R2 bucket. If you do not already have an existing R2 bucket, refer to [Create buckets](/r2/buckets/create-buckets/).
15-
- An API token with [permissions](/r2/api/s3/tokens/#permissions) to edit R2 bucket configuration.
13+
- (API only) An API token with [permissions](/r2/api/s3/tokens/#permissions) to edit R2 bucket configuration.
1614

1715
### Enable bucket lock via Wrangler
1816

@@ -35,7 +33,7 @@ The JSON file should be in the format of the request body of the [put bucket loc
3533

3634
### Enable bucket lock via API
3735

38-
For more information on required parameters and examples of how to enable bucket lock, refer to the [API documentation](/api/resources/r2/subresources/buckets/subresources/locks/methods/update/). For information about getting started with the Cloudflare API, refer to [Make API calls](/fundamentals/api/how-to/make-api-calls/).
36+
For information about getting started with the Cloudflare API, refer to [Make API calls](/fundamentals/api/how-to/make-api-calls/). For information on required parameters and more examples of how to set bucket lock configuration, refer to the [API documentation](/api/resources/r2/subresources/buckets/subresources/locks/methods/update/).
3937

4038
Below is an example of setting a bucket lock configuration (a collection of rules):
4139

@@ -77,10 +75,34 @@ If your bucket is setup with [jurisdictional restrictions](/r2/reference/data-lo
7775

7876
:::
7977

80-
### Get bucket lock rules via API
78+
## Get bucket lock rules for your R2 bucket
79+
80+
### Wrangler
81+
82+
To list bucket lock rules, run the [`r2 bucket lock list` command](/workers/wrangler/commands/#r2-bucket-lock-list):
83+
84+
```sh
85+
npx wrangler r2 bucket lock list <BUCKET_NAME>
86+
```
87+
88+
### API
8189

8290
For more information on required parameters and examples of how to get bucket lock rules, refer to the [API documentation](/api/resources/r2/subresources/buckets/subresources/locks/methods/get/).
8391

92+
## Remove bucket lock rules from your R2 bucket
93+
94+
### Wrangler
95+
96+
To remove a bucket lock rule, run the [`r2 bucket lock remove` command](/workers/wrangler/commands/#r2-bucket-lock-remove):
97+
98+
```sh
99+
npx wrangler r2 bucket lock remove <BUCKET_NAME> --id <RULE_ID>
100+
```
101+
102+
### API
103+
104+
To remove bucket lock rules via API, exclude them from your updated configuration and use the [put bucket lock configuration API](/api/resources/r2/subresources/buckets/subresources/locks/methods/update/).
105+
84106
## Bucket lock rules
85107

86108
A bucket lock configuration can include up to 1,000 rules. Each rule specifies which objects it covers (via prefix) and how long those objects must remain locked. You can:

0 commit comments

Comments
 (0)