You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/r2/buckets/bucket-locks.mdx
+27-5Lines changed: 27 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,10 @@ Bucket locks prevent the deletion and overwriting of objects in an R2 bucket for
7
7
8
8
## Get started with bucket locks
9
9
10
-
### Prerequisites
11
-
12
10
Before getting started, you will need:
13
11
14
12
- 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.
16
14
17
15
### Enable bucket lock via Wrangler
18
16
@@ -35,7 +33,7 @@ The JSON file should be in the format of the request body of the [put bucket loc
35
33
36
34
### Enable bucket lock via API
37
35
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/).
39
37
40
38
Below is an example of setting a bucket lock configuration (a collection of rules):
41
39
@@ -77,10 +75,34 @@ If your bucket is setup with [jurisdictional restrictions](/r2/reference/data-lo
77
75
78
76
:::
79
77
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
81
89
82
90
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/).
83
91
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):
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
+
84
106
## Bucket lock rules
85
107
86
108
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