Skip to content

PutObjectLegalHold

Source: src/AWS/S3/PutObjectLegalHold.ts

Runtime binding for s3:PutObjectLegalHold.

Bind this operation to a bucket to get a callable that applies or removes a legal hold on an object — the bucket name is injected automatically and s3:PutObjectLegalHold is granted on the bucket’s objects. Requires a bucket created with objectLockEnabled: true. Provide the implementation with Effect.provide(AWS.S3.PutObjectLegalHoldHttp).

const putObjectLegalHold = yield* AWS.S3.PutObjectLegalHold(bucket);
yield* putObjectLegalHold({
Key: "records/1.json",
LegalHold: { Status: "ON" },
});
// … later, release it so the object can be deleted
yield* putObjectLegalHold({
Key: "records/1.json",
LegalHold: { Status: "OFF" },
});