| 1 | import * as S3 from "@distilled.cloud/aws/s3"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | |
| 4 | import * as Binding from "../../Binding.ts"; |
| 5 | import type { Bucket } from "./Bucket.ts"; |
| 6 | |
| 7 | export interface GetObjectLegalHoldRequest extends Omit< |
| 8 | S3.GetObjectLegalHoldRequest, |
| 9 | "Bucket" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `s3:GetObjectLegalHold`. |
| 14 | * |
| 15 | * Bind this operation to a bucket to get a callable that reads an object's |
| 16 | * legal-hold status — the bucket name is injected automatically and |
| 17 | * `s3:GetObjectLegalHold` is granted on the bucket's objects. Requires a |
| 18 | * bucket created with `objectLockEnabled: true`. Provide the implementation |
| 19 | * with `Effect.provide(AWS.S3.GetObjectLegalHoldHttp)`. |
| 20 | * ### Object Lock |
| 21 | * **Example:** Read an Object's Legal-Hold Status |
| 22 | * ```typescript |
| 23 | * const getObjectLegalHold = yield* AWS.S3.GetObjectLegalHold(bucket); |
| 24 | * |
| 25 | * const { LegalHold } = yield* getObjectLegalHold({ Key: "records/1.json" }); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface GetObjectLegalHold extends Binding.Service< |
| 31 | GetObjectLegalHold, |
| 32 | "AWS.S3.GetObjectLegalHold", |
| 33 | ( |
| 34 | bucket: Bucket, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request: GetObjectLegalHoldRequest, |
| 38 | ) => Effect.Effect<S3.GetObjectLegalHoldOutput, S3.GetObjectLegalHoldError> |
| 39 | > |
| 40 | > {} |
| 41 | export const GetObjectLegalHold = Binding.Service<GetObjectLegalHold>( |
| 42 | "AWS.S3.GetObjectLegalHold", |
| 43 | ); |