| 1 | import type * as aoss from "@distilled.cloud/aws/opensearchserverless"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Collection } from "./Collection.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `BatchGetCollection` operation scoped to one |
| 8 | * collection (IAM action `aoss:BatchGetCollection` on the collection ARN). |
| 9 | * |
| 10 | * Reads the bound {@link Collection}'s live detail — status, endpoints, KMS |
| 11 | * key — from inside a function runtime. Useful for discovering the data-plane |
| 12 | * `collectionEndpoint` at runtime. Provide the implementation with |
| 13 | * `Effect.provide(AWS.OpenSearchServerless.GetCollectionHttp)`. |
| 14 | * ### Inspecting Collections |
| 15 | * **Example:** Read the collection's endpoint and status |
| 16 | * ```typescript |
| 17 | * // init — bind the operation to the collection |
| 18 | * const getCollection = yield* AWS.OpenSearchServerless.GetCollection(collection); |
| 19 | * |
| 20 | * // runtime |
| 21 | * const detail = yield* getCollection(); |
| 22 | * yield* Effect.log(`${detail?.status}: ${detail?.collectionEndpoint}`); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface GetCollection extends Binding.Service< |
| 28 | GetCollection, |
| 29 | "AWS.OpenSearchServerless.GetCollection", |
| 30 | ( |
| 31 | collection: Collection, |
| 32 | ) => Effect.Effect< |
| 33 | () => Effect.Effect< |
| 34 | aoss.CollectionDetail | undefined, |
| 35 | aoss.BatchGetCollectionError |
| 36 | > |
| 37 | > |
| 38 | > {} |
| 39 | export const GetCollection = Binding.Service<GetCollection>( |
| 40 | "AWS.OpenSearchServerless.GetCollection", |
| 41 | ); |