| 1 | import type * as mm from "@distilled.cloud/aws/mailmanager"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Archive } from "./Archive.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `ses:StartArchiveExport`. |
| 8 | * |
| 9 | * Starts an asynchronous export of messages from the bound archive to |
| 10 | * an S3 bucket, returning an `ExportId` to poll. The archive id is |
| 11 | * injected from the binding. The function also needs `s3:PutObject` on |
| 12 | * the destination. Provide the implementation with |
| 13 | * `Effect.provide(AWS.MailManager.StartArchiveExportHttp)`. |
| 14 | * ### Exporting from the Archive |
| 15 | * **Example:** Export a Day of Mail to S3 |
| 16 | * ```typescript |
| 17 | * const startExport = yield* MailManager.StartArchiveExport(archive); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { ExportId } = yield* startExport({ |
| 21 | * FromTimestamp: new Date(Date.now() - 86_400_000), |
| 22 | * ToTimestamp: new Date(), |
| 23 | * ExportDestinationConfiguration: { |
| 24 | * S3: { S3Location: "s3://my-export-bucket/mail/" }, |
| 25 | * }, |
| 26 | * }); |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | */ |
| 31 | export interface StartArchiveExport extends Binding.Service< |
| 32 | StartArchiveExport, |
| 33 | "AWS.MailManager.StartArchiveExport", |
| 34 | ( |
| 35 | archive: Archive, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request: Omit<mm.StartArchiveExportRequest, "ArchiveId">, |
| 39 | ) => Effect.Effect< |
| 40 | mm.StartArchiveExportResponse, |
| 41 | mm.StartArchiveExportError |
| 42 | > |
| 43 | > |
| 44 | > {} |
| 45 | export const StartArchiveExport = Binding.Service<StartArchiveExport>( |
| 46 | "AWS.MailManager.StartArchiveExport", |
| 47 | ); |