| 1 | import * as sns from "@distilled.cloud/aws/sns"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Subscription } from "./Subscription.ts"; |
| 5 | |
| 6 | export interface ConfirmSubscriptionRequest extends Omit< |
| 7 | sns.ConfirmSubscriptionInput, |
| 8 | "TopicArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `sns:ConfirmSubscription`. |
| 13 | * |
| 14 | * Bind this operation to a {@link Subscription} inside a function runtime to |
| 15 | * confirm a pending subscription with the token SNS delivered to the |
| 16 | * endpoint (e.g. from an `https` or `email` confirmation message). The |
| 17 | * binding grants the host function `sns:ConfirmSubscription` on the topic. |
| 18 | * Provide the `ConfirmSubscriptionHttp` layer on the Function to implement |
| 19 | * the binding. |
| 20 | * ### Confirming Subscriptions |
| 21 | * **Example:** Confirm with a Delivered Token |
| 22 | * ```typescript |
| 23 | * // init (provide SNS.ConfirmSubscriptionHttp on the Function) |
| 24 | * const confirmSubscription = yield* SNS.ConfirmSubscription(subscription); |
| 25 | * |
| 26 | * // runtime: token comes from the SubscriptionConfirmation message |
| 27 | * const response = yield* confirmSubscription({ Token: token }); |
| 28 | * // response.SubscriptionArn |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface ConfirmSubscription extends Binding.Service< |
| 34 | ConfirmSubscription, |
| 35 | "AWS.SNS.ConfirmSubscription", |
| 36 | ( |
| 37 | subscription: Subscription, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request: ConfirmSubscriptionRequest, |
| 41 | ) => Effect.Effect< |
| 42 | sns.ConfirmSubscriptionResponse, |
| 43 | sns.ConfirmSubscriptionError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | export const ConfirmSubscription = Binding.Service<ConfirmSubscription>( |
| 48 | "AWS.SNS.ConfirmSubscription", |
| 49 | ); |