1import type * as dsql from "@distilled.cloud/aws/dsql";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Cluster } from "./Cluster.ts";
5
6/**
7 * Retrieves the VPC endpoint service name of an Aurora DSQL cluster — the
8 * `com.amazonaws.{region}.dsql-{suffix}` PrivateLink service name used to
9 * create a VPC interface endpoint that reaches the cluster privately.
10 *
11 * Bind a {@link Cluster} inside a function runtime to look the name up on
12 * demand (e.g. from an operations function that provisions VPC endpoints).
13 * Provide `DSQL.GetVpcEndpointServiceNameHttp` on the Function effect to
14 * implement the binding.
15 *
16 * ### Resolving the VPC Endpoint Service Name
17 * **Example:** Look Up the PrivateLink Service Name
18 * ```typescript
19 * // init
20 * const getVpcEndpointServiceName =
21 * yield* DSQL.GetVpcEndpointServiceName(cluster);
22 *
23 * return {
24 * fetch: Effect.gen(function* () {
25 * // runtime
26 * const { serviceName } = yield* getVpcEndpointServiceName();
27 * return HttpServerResponse.json({ serviceName });
28 * }),
29 * };
30 * ```
31 *
32 * @binding
33 */
34export interface GetVpcEndpointServiceName extends Binding.Service<
35 GetVpcEndpointServiceName,
36 "AWS.DSQL.GetVpcEndpointServiceName",
37 <R extends Cluster>(
38 cluster: R,
39 ) => Effect.Effect<
40 () => Effect.Effect<
41 dsql.GetVpcEndpointServiceNameOutput,
42 dsql.GetVpcEndpointServiceNameError
43 >
44 >
45> {}
46export const GetVpcEndpointServiceName =
47 Binding.Service<GetVpcEndpointServiceName>(
48 "AWS.DSQL.GetVpcEndpointServiceName",
49 );