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 `UpdateIndex` operation scoped to one collection
8 * (IAM action `aoss:APIAccessAll` on the collection ARN).
9 *
10 * Updates an index's schema in the bound {@link Collection} — add new fields
11 * or change field mappings at runtime. The calling principal must also be
12 * granted `aoss:UpdateIndex` on the index pattern by a data
13 * {@link AccessPolicy}. Provide the implementation with
14 * `Effect.provide(AWS.OpenSearchServerless.UpdateIndexHttp)`.
15 * ### Managing Indexes at Runtime
16 * **Example:** Add a field to an index
17 * ```typescript
18 * const updateIndex = yield* AWS.OpenSearchServerless.UpdateIndex(collection);
19 *
20 * yield* updateIndex({
21 * indexName: "tenant-42",
22 * indexSchema: {
23 * mappings: { properties: { title: { type: "text" } } },
24 * },
25 * });
26 * ```
27 *
28 * @binding
29 */
30export interface UpdateIndex extends Binding.Service<
31 UpdateIndex,
32 "AWS.OpenSearchServerless.UpdateIndex",
33 (
34 collection: Collection,
35 ) => Effect.Effect<
36 (
37 request: Omit<aoss.UpdateIndexRequest, "id">,
38 ) => Effect.Effect<aoss.UpdateIndexResponse, aoss.UpdateIndexError>
39 >
40> {}
41export const UpdateIndex = Binding.Service<UpdateIndex>(
42 "AWS.OpenSearchServerless.UpdateIndex",
43);