1import type * as aoss from "@distilled.cloud/aws/opensearchserverless";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Collection } from "./Collection.ts";
5
6/**
7 * Runtime binding for the `GetIndex` operation scoped to one collection
8 * (IAM action `aoss:APIAccessAll` on the collection ARN).
9 *
10 * Reads an index's schema definition from the bound {@link Collection}. A
11 * missing index surfaces the typed `ResourceNotFoundException`. The calling
12 * principal must also be granted `aoss:DescribeIndex` on the index pattern by
13 * a data {@link AccessPolicy}. Provide the implementation with
14 * `Effect.provide(AWS.OpenSearchServerless.GetIndexHttp)`.
15 * ### Managing Indexes at Runtime
16 * **Example:** Read an index's schema
17 * ```typescript
18 * const getIndex = yield* AWS.OpenSearchServerless.GetIndex(collection);
19 *
20 * const { indexSchema } = yield* getIndex({ indexName: "tenant-42" });
21 * ```
22 *
23 * @binding
24 */
25export interface GetIndex extends Binding.Service<
26 GetIndex,
27 "AWS.OpenSearchServerless.GetIndex",
28 (
29 collection: Collection,
30 ) => Effect.Effect<
31 (
32 request: Omit<aoss.GetIndexRequest, "id">,
33 ) => Effect.Effect<aoss.GetIndexResponse, aoss.GetIndexError>
34 >
35> {}
36export const GetIndex = Binding.Service<GetIndex>(
37 "AWS.OpenSearchServerless.GetIndex",
38);