set_object_retention
Apply retention to an object version to protect it from deletion or modification for a specified period, using GOVERNANCE or COMPLIANCE modes.
Instructions
[WRITE][risk=critical] Put retention on one object version. NO UNDO EXISTS.
This is extend-only and irreversible through this tool, not by policy but by construction: S3 refuses to shorten or remove retention without the x-amz-bypass-governance-retention header, and the minio SDK never sends it. COMPLIANCE mode cannot be shortened by any credential at all — not root — until the date passes, and the storage cannot be reclaimed before then.
No undo token is recorded. Calls that would shorten or downgrade retention already in force are refused, and COMPLIANCE requires acknowledge_irreversible=True. Both refusals fire under dry_run.
Args:
bucket_name: Bucket name (must have object lock enabled).
object_name: Object key (from bucket_objects).
mode: "GOVERNANCE" (liftable out of band with mc retention clear by a
holder of s3:BypassGovernanceRetention — note that command has no
--bypass flag) or "COMPLIANCE" (liftable by nobody before the date,
root included).
days: Retain for this many days from now.
version_id: Specific version; omit for the current version.
acknowledge_irreversible: Required True for COMPLIANCE mode.
dry_run: If True, run every guard and report the before-state without writing.
target: MinIO target name from config; omit for the default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | Yes | ||
| mode | Yes | ||
| target | No | ||
| dry_run | No | ||
| version_id | No | ||
| bucket_name | Yes | ||
| object_name | Yes | ||
| acknowledge_irreversible | No |