put-object-legal-hold

Prev Next

Available in Classic and VPC

Set or remove a legal hold on an Ncloud Storage object. Objects under a legal hold cannot be deleted or changed regardless of their retention period.

Note

For a Sub Account user to execute this command, they must have the Change/PutObjectLegalHold action permission.

Syntax

The put-object-legal-hold syntax is as follows:

aws s3api put-object-legal-hold \
    --bucket <bucket> \
    --key <key> \
    --legal-hold <legal-hold> \
    [--version-id <version-id>] \
    [--content-md5 <content-md5>] \
    [--checksum-algorithm <checksum-algorithm>] \
    --endpoint-url <endpoint-url>

Options

This section describes the options available when running put-object-legal-hold.

Required options

The following options are required for put-object-legal-hold.

Options Type Required Description
--bucket String Required Bucket name
--key String Required Object name
--legal-hold String Required Legal hold settings
  • Enter in JSON format.
    • Status: Whether to apply the legal hold.
      • ON | OFF

Optional options

These are the optional options for put-object-legal-hold. Options that are not specified will use their default values.

Options Type Required Description
--version-id String Optional Object version ID
--content-md5 String Optional Base64-encoded 128-bit MD5 hash of the request data
  • Used to validate the integrity of the request data
  • Calculated automatically if not entered
--checksum-algorithm String Optional Checksum algorithm used to validate the request data
  • CRC32 | CRC32C | SHA1 | SHA256 | CRC64NVME

Common options

For information about the options common to all aws subcommands, see Ncloud Storage options.

Examples

If the request to set legal retention is successful, the settings are applied, and no result is displayed.

Command

The command example is as follows:

aws s3api put-object-legal-hold --bucket my-locked-bucket \
    --key locked.txt \
    --legal-hold Status=ON \
    --endpoint-url=https://kr.ncloudstorage.com

Related commands

Related commands are as follows: