1import type * as SD from "@distilled.cloud/aws/servicediscovery";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Service } from "./Service.ts";
5
6/**
7 * `ListInstances` request with `ServiceId` injected from the bound
8 * {@link Service}.
9 */
10export interface ListInstancesRequest extends Omit<
11 SD.ListInstancesRequest,
12 "ServiceId"
13> {}
14
15/**
16 * Runtime binding for `servicediscovery:ListInstances` — lists summary
17 * information (id + attributes) for every instance registered with the
18 * bound {@link Service}. Unlike `DiscoverInstances` this is the
19 * control-plane view: strongly consistent with registration, one page at a
20 * time via `NextToken`. Provide the implementation with
21 * `Effect.provide(AWS.CloudMap.ListInstancesHttp)`.
22 * ### Reading Instances
23 * **Example:** List Registered Instances
24 * ```typescript
25 * const listInstances = yield* AWS.CloudMap.ListInstances(service);
26 *
27 * const { Instances } = yield* listInstances();
28 * for (const instance of Instances ?? []) {
29 * console.log(instance.Id, instance.Attributes);
30 * }
31 * ```
32 *
33 * @binding
34 */
35export interface ListInstances extends Binding.Service<
36 ListInstances,
37 "AWS.CloudMap.ListInstances",
38 <S extends Service>(
39 service: S,
40 ) => Effect.Effect<
41 (
42 request?: ListInstancesRequest,
43 ) => Effect.Effect<SD.ListInstancesResponse, SD.ListInstancesError>
44 >
45> {}
46export const ListInstances = Binding.Service<ListInstances>(
47 "AWS.CloudMap.ListInstances",
48);