| 1 | import type * as polly from "@distilled.cloud/aws/polly"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Lexicon } from "./Lexicon.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `polly:GetLexicon` — read the PLS content and |
| 8 | * attributes of a pronunciation lexicon at runtime. |
| 9 | * |
| 10 | * Bind it to a `Lexicon` resource; the deploy-time half grants |
| 11 | * `polly:GetLexicon` scoped to that lexicon's ARN and the runtime callable |
| 12 | * injects the lexicon name. The returned `Lexicon.Content` is `Redacted` |
| 13 | * (distilled models it as sensitive) — unwrap with `Redacted.value(...)` at |
| 14 | * the point of use. Provide the implementation with |
| 15 | * `Effect.provide(AWS.Polly.GetLexiconHttp)`. |
| 16 | * |
| 17 | * ### Managing Lexicons |
| 18 | * **Example:** Read a lexicon's content at runtime |
| 19 | * ```typescript |
| 20 | * // init |
| 21 | * const getLexicon = yield* AWS.Polly.GetLexicon(lexicon); |
| 22 | * |
| 23 | * // runtime |
| 24 | * const result = yield* getLexicon(); |
| 25 | * const content = result.Lexicon?.Content; |
| 26 | * const xml = |
| 27 | * content === undefined |
| 28 | * ? undefined |
| 29 | * : Redacted.isRedacted(content) |
| 30 | * ? Redacted.value(content) |
| 31 | * : content; |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface GetLexicon extends Binding.Service< |
| 37 | GetLexicon, |
| 38 | "AWS.Polly.GetLexicon", |
| 39 | <L extends Lexicon>( |
| 40 | lexicon: L, |
| 41 | ) => Effect.Effect< |
| 42 | () => Effect.Effect<polly.GetLexiconOutput, polly.GetLexiconError> |
| 43 | > |
| 44 | > {} |
| 45 | export const GetLexicon = Binding.Service<GetLexicon>("AWS.Polly.GetLexicon"); |