Jump to Content

New API Documentation - Developer Preview Available

We are excited to announce the developer preview of our new API documentation for AWS SDK for JavaScript v3. Please follow instructions on the landing page to leave us your feedback.

Class PutObjectLegalHoldCommandProtected

Applies a legal hold configuration to the specified object. For more information, see Locking Objects.

This action is not supported by Amazon S3 on Outposts.

Example

Use a bare-bones client and the command you need to make an API call.

import { S3Client, PutObjectLegalHoldCommand } from "@aws-sdk/client-s3"; // ES Modules import
// const { S3Client, PutObjectLegalHoldCommand } = require("@aws-sdk/client-s3"); // CommonJS import
const client = new S3Client(config);
const input = { // PutObjectLegalHoldRequest
Bucket: "STRING_VALUE", // required
Key: "STRING_VALUE", // required
LegalHold: { // ObjectLockLegalHold
Status: "ON" || "OFF",
},
RequestPayer: "requester",
VersionId: "STRING_VALUE",
ContentMD5: "STRING_VALUE",
ChecksumAlgorithm: "CRC32" || "CRC32C" || "SHA1" || "SHA256",
ExpectedBucketOwner: "STRING_VALUE",
};
const command = new PutObjectLegalHoldCommand(input);
const response = await client.send(command);
// { // PutObjectLegalHoldOutput
// RequestCharged: "requester",
// };

Param

PutObjectLegalHoldCommandInput

Returns

PutObjectLegalHoldCommandOutput

See

Throws

S3ServiceException

Base exception class for all service exceptions from S3 service.

Hierarchy

Constructors

Properties

Methods