1import type * as SD from "@distilled.cloud/aws/servicediscovery";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5/**
6 * Runtime binding for `servicediscovery:GetOperation` — reads the status of
7 * an asynchronous Cloud Map operation. `RegisterInstance` and
8 * `DeregisterInstance` return an `OperationId`; poll it with this binding
9 * to await completion (`SUCCESS` / `FAIL`) before relying on the
10 * registration. Provide the implementation with
11 * `Effect.provide(AWS.CloudMap.GetOperationHttp)`.
12 * ### Registering Instances
13 * **Example:** Await a Registration Operation
14 * ```typescript
15 * const registerInstance = yield* AWS.CloudMap.RegisterInstance(service);
16 * const getOperation = yield* AWS.CloudMap.GetOperation();
17 *
18 * const { OperationId } = yield* registerInstance({
19 * InstanceId: "worker-1",
20 * Attributes: { AWS_INSTANCE_IPV4: "10.0.1.10" },
21 * });
22 * const { Operation } = yield* getOperation({ OperationId: OperationId! });
23 * console.log(Operation?.Status); // "SUBMITTED" | "PENDING" | "SUCCESS" | "FAIL"
24 * ```
25 *
26 * @binding
27 */
28export interface GetOperation extends Binding.Service<
29 GetOperation,
30 "AWS.CloudMap.GetOperation",
31 () => Effect.Effect<
32 (
33 request: SD.GetOperationRequest,
34 ) => Effect.Effect<SD.GetOperationResponse, SD.GetOperationError>
35 >
36> {}
37export const GetOperation = Binding.Service<GetOperation>(
38 "AWS.CloudMap.GetOperation",
39);