| 1 | import type * as athena from "@distilled.cloud/aws/athena"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { DataCatalog } from "./DataCatalog.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `athena:GetDatabase`. |
| 8 | * |
| 9 | * Reads a single database's metadata from the bound data catalog — the |
| 10 | * catalog name is injected automatically. Provide the implementation with |
| 11 | * `Effect.provide(AWS.Athena.GetDatabaseHttp)`. |
| 12 | * ### Browsing Catalog Metadata |
| 13 | * **Example:** Read a Database from the Catalog |
| 14 | * ```typescript |
| 15 | * // init — bind the operation to the data catalog |
| 16 | * const getDatabase = yield* AWS.Athena.GetDatabase(catalog); |
| 17 | * |
| 18 | * // runtime |
| 19 | * const res = yield* getDatabase({ DatabaseName: "analytics" }); |
| 20 | * console.log(res.Database?.Name); |
| 21 | * ``` |
| 22 | * |
| 23 | * @binding |
| 24 | */ |
| 25 | export interface GetDatabase extends Binding.Service< |
| 26 | GetDatabase, |
| 27 | "AWS.Athena.GetDatabase", |
| 28 | ( |
| 29 | catalog: DataCatalog, |
| 30 | ) => Effect.Effect< |
| 31 | ( |
| 32 | request: Omit<athena.GetDatabaseInput, "CatalogName">, |
| 33 | ) => Effect.Effect<athena.GetDatabaseOutput, athena.GetDatabaseError> |
| 34 | > |
| 35 | > {} |
| 36 | |
| 37 | export const GetDatabase = Binding.Service<GetDatabase>( |
| 38 | "AWS.Athena.GetDatabase", |
| 39 | ); |