mc retention set

Sets a retention lock for a bucket or object.

Syntax

CLI
mc retention set [FLAGS] [governance | compliance] VALIDITY TARGET

FLAGS:
  --recursive, -r                  apply retention recursively
  --bypass                         bypass governance
  --version-id value, --vid value  apply retention to a specific object version
  --rewind value                   roll back object(s) to current version at specified time
  --versions                       apply retention object(s) and all its versions
  --default                        set bucket default retention mode
  --json                           enable JSON lines formatted output
  --debug                          enable debug output
  --insecure                       disable SSL certificate verification
  --help, -h                       show help

VALIDITY:
  This argument must be formatted like Nd or Ny where 'd' denotes days and 'y' 
  denotes years e.g. 10d, 3y.

Parameters

Parameter Description
recursive Apply the retention lock recursively to all objects.
bypass Allows a user with the s3:BypassGovernanceRetention permission to modify the object. Requires the Governance Retention mode.
version-id Apply retention only to the specified version of the object.
rewind Rollback objects to the version that was present in the specified point of time.
versions Apply retention to all versions of the object.
json Enable JSON formatted output.
debug Enable output for debugging.
insecure Disable SSL verification.
help Show this help.

Examples

  1. Set governance mode to 1 day as the default for all objects in a bucket named finance:
    CLI
    /opt/mapr/bin/mc retention set governance 1d newmooss/finance --default
    
       GOVERNANCE mode is enabled for 1DAYS.
  2. Set retention for a specific version of an object:
    CLI
    /opt/mapr/bin/mc retention set governance 30d newmoss/worm1/f2 --version-id 00000000000000000002
       
       Object retention successfully set for newmoss/worm1/f2 (version-id=00000000000000000002).