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 `DeleteIndex` operation scoped to one collection
8 * (IAM action `aoss:APIAccessAll` on the collection ARN).
9 *
10 * Deletes an index from the bound {@link Collection} — the teardown half of
11 * the runtime multi-tenant pattern built with {@link CreateIndex}. Deleting
12 * an already-deleted index surfaces the typed `ResourceNotFoundException`.
13 * The calling principal must also be granted `aoss:DeleteIndex` on the index
14 * pattern by a data {@link AccessPolicy}. Provide the implementation with
15 * `Effect.provide(AWS.OpenSearchServerless.DeleteIndexHttp)`.
16 * ### Managing Indexes at Runtime
17 * **Example:** Delete a tenant's index
18 * ```typescript
19 * const deleteIndex = yield* AWS.OpenSearchServerless.DeleteIndex(collection);
20 *
21 * yield* deleteIndex({ indexName: "tenant-42" }).pipe(
22 * Effect.catchTag("ResourceNotFoundException", () => Effect.void),
23 * );
24 * ```
25 *
26 * @binding
27 */
28export interface DeleteIndex extends Binding.Service<
29 DeleteIndex,
30 "AWS.OpenSearchServerless.DeleteIndex",
31 (
32 collection: Collection,
33 ) => Effect.Effect<
34 (
35 request: Omit<aoss.DeleteIndexRequest, "id">,
36 ) => Effect.Effect<aoss.DeleteIndexResponse, aoss.DeleteIndexError>
37 >
38> {}
39export const DeleteIndex = Binding.Service<DeleteIndex>(
40 "AWS.OpenSearchServerless.DeleteIndex",
41);