| 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:GetArchiveSearch`. |
| 8 | * |
| 9 | * Fetches the parameters and status of an archive search (by |
| 10 | * `SearchId`). IAM access is granted on the bound archive's ARN. Provide the implementation with |
| 11 | * `Effect.provide(AWS.MailManager.GetArchiveSearchHttp)`. |
| 12 | * ### Searching the Archive |
| 13 | * **Example:** Poll a Search Until It Completes |
| 14 | * ```typescript |
| 15 | * const getSearch = yield* MailManager.GetArchiveSearch(archive); |
| 16 | * |
| 17 | * // runtime |
| 18 | * const search = yield* getSearch({ SearchId }).pipe( |
| 19 | * Effect.repeat({ |
| 20 | * schedule: Schedule.spaced("2 seconds"), |
| 21 | * until: (s) => s.Status?.State === "COMPLETED" || s.Status?.State === "FAILED", |
| 22 | * times: 30, |
| 23 | * }), |
| 24 | * ); |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface GetArchiveSearch extends Binding.Service< |
| 30 | GetArchiveSearch, |
| 31 | "AWS.MailManager.GetArchiveSearch", |
| 32 | ( |
| 33 | archive: Archive, |
| 34 | ) => Effect.Effect< |
| 35 | ( |
| 36 | request: mm.GetArchiveSearchRequest, |
| 37 | ) => Effect.Effect<mm.GetArchiveSearchResponse, mm.GetArchiveSearchError> |
| 38 | > |
| 39 | > {} |
| 40 | export const GetArchiveSearch = Binding.Service<GetArchiveSearch>( |
| 41 | "AWS.MailManager.GetArchiveSearch", |
| 42 | ); |