sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Athena/ GetDatabase.ts

import type * as athena from "@distilled.cloud/aws/athena";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { DataCatalog } from "./DataCatalog.ts";

/**
 * Runtime binding for `athena:GetDatabase`.
 *
 * Reads a single database's metadata from the bound data catalog — the
 * catalog name is injected automatically. Provide the implementation with
 * `Effect.provide(AWS.Athena.GetDatabaseHttp)`.
 * ### Browsing Catalog Metadata
 * **Example:** Read a Database from the Catalog
 * ```typescript
 * // init — bind the operation to the data catalog
 * const getDatabase = yield* AWS.Athena.GetDatabase(catalog);
 *
 * // runtime
 * const res = yield* getDatabase({ DatabaseName: "analytics" });
 * console.log(res.Database?.Name);
 * ```
 *
 * @binding
 */
export interface GetDatabase extends Binding.Service<
  GetDatabase,
  "AWS.Athena.GetDatabase",
  (
    catalog: DataCatalog,
  ) => Effect.Effect<
    (
      request: Omit<athena.GetDatabaseInput, "CatalogName">,
    ) => Effect.Effect<athena.GetDatabaseOutput, athena.GetDatabaseError>
  >
> {}

export const GetDatabase = Binding.Service<GetDatabase>("AWS.Athena.GetDatabase");