| 1 | import type * as dms from "@distilled.cloud/aws/database-migration-service"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Endpoint } from "./Endpoint.ts"; |
| 5 | import type { ReplicationInstance } from "./ReplicationInstance.ts"; |
| 6 | |
| 7 | /** |
| 8 | * Runtime binding for `dms:TestConnection`. |
| 9 | * |
| 10 | * Bind this operation to a ({@link ReplicationInstance}, {@link Endpoint}) |
| 11 | * pair to initiate a connectivity test from the instance to the endpoint's |
| 12 | * database. The test runs asynchronously — poll the result with |
| 13 | * {@link DescribeConnections}. Provide the implementation with |
| 14 | * `Effect.provide(AWS.DMS.TestConnectionHttp)`. |
| 15 | * ### Testing Connectivity |
| 16 | * **Example:** Kick Off a Connection Test |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the instance + endpoint |
| 19 | * const testConnection = yield* AWS.DMS.TestConnection(instance, source); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const { Connection } = yield* testConnection(); |
| 23 | * // Connection.Status === "testing" — poll DescribeConnections for the result |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface TestConnection extends Binding.Service< |
| 29 | TestConnection, |
| 30 | "AWS.DMS.TestConnection", |
| 31 | ( |
| 32 | instance: ReplicationInstance, |
| 33 | endpoint: Endpoint, |
| 34 | ) => Effect.Effect< |
| 35 | () => Effect.Effect<dms.TestConnectionResponse, dms.TestConnectionError> |
| 36 | > |
| 37 | > {} |
| 38 | |
| 39 | export const TestConnection = Binding.Service<TestConnection>( |
| 40 | "AWS.DMS.TestConnection", |
| 41 | ); |