Skip to content

Commit 4e11632

Browse files
committed
Document wrangler r2 bucket lifecycle command (list, add, remove, set)
1 parent 0da0524 commit 4e11632

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

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

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,76 @@ wrangler r2 bucket notification list <NAME>
10471047
- `NAME` <Type text="string" /> <MetaInfo text="required" />
10481048
- The name of the R2 bucket to get event notification rules for.
10491049

1050+
### `lifecycle add`
1051+
1052+
Add an [object lifecycle](/r2/buckets/object-lifecycles/) rule to an R2 bucket.
1053+
1054+
```txt
1055+
wrangler r2 bucket lifecycle add <NAME> [OPTIONS]
1056+
```
1057+
1058+
- `NAME` <Type text="string" /> <MetaInfo text="required" />
1059+
- The name of the R2 bucket to add a lifecycle rule to.
1060+
- `--id` <Type text="string" /> <MetaInfo text="optional" />
1061+
- A unique identifier for the lifecycle rule.
1062+
- `--prefix` <Type text="string" /> <MetaInfo text="optional" />
1063+
- Prefix condition for the lifecycle rule (leave empty for all prefixes).
1064+
- `--expire-days` <Type text="number" /> <MetaInfo text="optional" />
1065+
- Sets the lifecycle rule action to expire objects after this number of days. Note you can provide only one of `--expire-days` or `--expire-date`.
1066+
- `--expire-date` <Type text="string" /> <MetaInfo text="optional" />
1067+
- Sets the lifecycle rule action to expire objects after this date (YYYY-MM-DD). Note you can provide only one of `--expire-days` or `--expire-date`.
1068+
- `--ia-transition-days` <Type text="number" /> <MetaInfo text="optional" />
1069+
- Sets the lifecycle rule action to transition objects to Infrequent Access storage after this number of days. Note you can provide only one of `--ia-transition-days` or `--ia-transition-date`.
1070+
- `--ia-transition-date` <Type text="string" /> <MetaInfo text="optional" />
1071+
- Sets the lifecycle rule action to transition objects to Infrequent Access storage after this date (YYYY-MM-DD). Note you can provide only one of `--ia-transition-days` or `--ia-transition-date`.
1072+
- `--abort-multipart-days` <Type text="number" /> <MetaInfo text="optional" />
1073+
- Sets the lifecycle rule action to abort incomplete multipart uploads after this number of days.
1074+
- `--jurisdiction` <Type text="string" /> <MetaInfo text="optional" />
1075+
- The jurisdiction where the bucket exists, if a jurisdiction has been specified. Refer to [jurisdictional restrictions](/r2/reference/data-location/#jurisdictional-restrictions).
1076+
1077+
### `lifecycle remove`
1078+
1079+
Remove an [object lifecycle](/r2/buckets/object-lifecycles/) rule from an R2 bucket.
1080+
1081+
```txt
1082+
wrangler r2 bucket lifecycle remove <NAME> [OPTIONS]
1083+
```
1084+
1085+
- `NAME` <Type text="string" /> <MetaInfo text="required" />
1086+
- The name of the R2 bucket to remove a lifecycle rule from.
1087+
- `--id` <Type text="string" /> <MetaInfo text="required" />
1088+
- The unique identifier of the lifecycle rule to remove.
1089+
- `--jurisdiction` <Type text="string" /> <MetaInfo text="optional" />
1090+
- The jurisdiction where the bucket exists, if a jurisdiction has been specified. Refer to [jurisdictional restrictions](/r2/reference/data-location/#jurisdictional-restrictions).
1091+
1092+
### `lifecycle list`
1093+
1094+
List [object lifecycle](/r2/buckets/object-lifecycles/) rules for an R2 bucket.
1095+
1096+
```txt
1097+
wrangler r2 bucket lifecycle list <NAME> [OPTIONS]
1098+
```
1099+
1100+
- `NAME` <Type text="string" /> <MetaInfo text="required" />
1101+
- The name of the R2 bucket to list lifecycle rules for.
1102+
- `--jurisdiction` <Type text="string" /> <MetaInfo text="optional" />
1103+
- The jurisdiction where the bucket exists, if a jurisdiction has been specified. Refer to [jurisdictional restrictions](/r2/reference/data-location/#jurisdictional-restrictions).
1104+
1105+
### `lifecycle set`
1106+
1107+
Set the [object lifecycle](/r2/buckets/object-lifecycles/) policy for an R2 bucket from a JSON file.
1108+
1109+
```txt
1110+
wrangler r2 bucket lifecycle set <NAME> [OPTIONS]
1111+
```
1112+
1113+
- `NAME` <Type text="string" /> <MetaInfo text="required" />
1114+
- The name of the R2 bucket to set lifecycle policy for.
1115+
- `--file` <Type text="string" /> <MetaInfo text="required" />
1116+
- Path to the JSON file containing lifecycle policy (file must be in format of request body of [put object lifecycle API](/api/operations/r2-put-bucket-lifecycle-configuration)).
1117+
- `--jurisdiction` <Type text="string" /> <MetaInfo text="optional" />
1118+
- The jurisdiction where the bucket exists, if a jurisdiction has been specified. Refer to [jurisdictional restrictions](/r2/reference/data-location/#jurisdictional-restrictions).
1119+
10501120
### `sippy enable`
10511121

10521122
Enable [Sippy](/r2/data-migration/sippy/) incremental migration for a bucket.

0 commit comments

Comments
 (0)