| 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 RestoreObjectRequest extends Omit< |
| 8 | S3.RestoreObjectRequest, |
| 9 | "Bucket" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `s3:RestoreObject`. |
| 14 | * |
| 15 | * Bind this operation to a bucket to get a callable that initiates a restore |
| 16 | * of an archived (Glacier / Deep Archive) object — the bucket name is |
| 17 | * injected automatically and `s3:RestoreObject` is granted on the bucket's |
| 18 | * objects. Provide the implementation with |
| 19 | * `Effect.provide(AWS.S3.RestoreObjectHttp)`. |
| 20 | * ### Archived Objects |
| 21 | * **Example:** Restore an Archived Object for 3 Days |
| 22 | * ```typescript |
| 23 | * const restoreObject = yield* AWS.S3.RestoreObject(bucket); |
| 24 | * |
| 25 | * yield* restoreObject({ |
| 26 | * Key: "archive/2024.tar", |
| 27 | * RestoreRequest: { |
| 28 | * Days: 3, |
| 29 | * GlacierJobParameters: { Tier: "Standard" }, |
| 30 | * }, |
| 31 | * }); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface RestoreObject extends Binding.Service< |
| 37 | RestoreObject, |
| 38 | "AWS.S3.RestoreObject", |
| 39 | ( |
| 40 | bucket: Bucket, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: RestoreObjectRequest, |
| 44 | ) => Effect.Effect<S3.RestoreObjectOutput, S3.RestoreObjectError> |
| 45 | > |
| 46 | > {} |
| 47 | export const RestoreObject = Binding.Service<RestoreObject>( |
| 48 | "AWS.S3.RestoreObject", |
| 49 | ); |