| 1 | import type * as apprunner from "@distilled.cloud/aws/apprunner"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Service } from "./Service.ts"; |
| 5 | |
| 6 | export interface AssociateCustomDomainRequest extends Omit< |
| 7 | apprunner.AssociateCustomDomainRequest, |
| 8 | "ServiceArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Associate a custom domain with an App Runner {@link Service} from a |
| 13 | * Lambda (or other AWS runtime) — the multi-tenant SaaS "bring your own |
| 14 | * domain" flow: a customer adds their domain, the platform associates it at |
| 15 | * runtime and hands back the DNS validation records App Runner returns. |
| 16 | * Track validation with {@link DescribeCustomDomains}. |
| 17 | * |
| 18 | * Provide `AppRunner.AssociateCustomDomainHttp` on the hosting function's |
| 19 | * Effect to implement the binding. |
| 20 | * |
| 21 | * ### Custom Domains |
| 22 | * **Example:** Associate a customer domain |
| 23 | * ```typescript |
| 24 | * const associateCustomDomain = yield* AppRunner.AssociateCustomDomain(service); |
| 25 | * const { CustomDomain, DNSTarget } = yield* associateCustomDomain({ |
| 26 | * DomainName: "app.customer.com", |
| 27 | * EnableWWWSubdomain: false, |
| 28 | * }); |
| 29 | * // CustomDomain.CertificateValidationRecords -> CNAMEs the customer creates |
| 30 | * // DNSTarget -> where the customer points app.customer.com |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface AssociateCustomDomain extends Binding.Service< |
| 36 | AssociateCustomDomain, |
| 37 | "AWS.AppRunner.AssociateCustomDomain", |
| 38 | ( |
| 39 | service: Service, |
| 40 | ) => Effect.Effect< |
| 41 | ( |
| 42 | request: AssociateCustomDomainRequest, |
| 43 | ) => Effect.Effect< |
| 44 | apprunner.AssociateCustomDomainResponse, |
| 45 | apprunner.AssociateCustomDomainError |
| 46 | > |
| 47 | > |
| 48 | > {} |
| 49 | export const AssociateCustomDomain = Binding.Service<AssociateCustomDomain>( |
| 50 | "AWS.AppRunner.AssociateCustomDomain", |
| 51 | ); |