set_lifecycle
Replace a bucket's lifecycle rules with day-based expiration for current and noncurrent object versions. Captures the previous config for undo; supports dry-run and prefix scoping.
Instructions
[WRITE][risk=medium] Replace the bucket lifecycle. Reversible → prior config.
Pass the day-count knobs (rules are built for you: current-version expiry, noncurrent-version expiry), or lifecycle_xml to apply a configuration verbatim (used by undo restores). REPLACES any existing rules — the prior config is captured for undo.
Aborting abandoned multipart uploads is NOT available here: MinIO refuses a lifecycle rule whose only action is that, and drops the action when it is combined with an expiration. Use remove_incomplete_uploads instead.
The undo restores the RULE, not the data: objects the rule expires before you undo are deleted, and putting the prior configuration back does not bring them back.
Args: bucket_name: Bucket name (from bucket_ls). expire_days: Expire current objects after N days. noncurrent_expire_days: Expire noncurrent versions after N days. prefix: Optional key prefix the rules apply to (empty = whole bucket). lifecycle_xml: Full lifecycle configuration XML to apply verbatim. dry_run: If True, preview without applying. target: MinIO target name from config; omit for the default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prefix | No | ||
| target | No | ||
| dry_run | No | ||
| bucket_name | Yes | ||
| expire_days | No | ||
| lifecycle_xml | No | ||
| noncurrent_expire_days | No |