| 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 GetObjectRetentionRequest extends Omit< |
| 8 | S3.GetObjectRetentionRequest, |
| 9 | "Bucket" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `s3:GetObjectRetention`. |
| 14 | * |
| 15 | * Bind this operation to a bucket to get a callable that reads an object's |
| 16 | * Object Lock retention settings — the bucket name is injected automatically |
| 17 | * and `s3:GetObjectRetention` is granted on the bucket's objects. Requires a |
| 18 | * bucket created with `objectLockEnabled: true`. Provide the implementation |
| 19 | * with `Effect.provide(AWS.S3.GetObjectRetentionHttp)`. |
| 20 | * ### Object Lock |
| 21 | * **Example:** Read an Object's Retention |
| 22 | * ```typescript |
| 23 | * const getObjectRetention = yield* AWS.S3.GetObjectRetention(bucket); |
| 24 | * |
| 25 | * const { Retention } = yield* getObjectRetention({ Key: "records/1.json" }); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface GetObjectRetention extends Binding.Service< |
| 31 | GetObjectRetention, |
| 32 | "AWS.S3.GetObjectRetention", |
| 33 | ( |
| 34 | bucket: Bucket, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request: GetObjectRetentionRequest, |
| 38 | ) => Effect.Effect<S3.GetObjectRetentionOutput, S3.GetObjectRetentionError> |
| 39 | > |
| 40 | > {} |
| 41 | export const GetObjectRetention = Binding.Service<GetObjectRetention>( |
| 42 | "AWS.S3.GetObjectRetention", |
| 43 | ); |