1import type * as sqladmin from "@distilled.cloud/gcp/sqladmin_v1";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuntimeContext } from "../../RuntimeContext.ts";
5import type { Instance } from "./Instance.ts";
6
7export interface GetInstanceRequest extends Omit<
8 sqladmin.GetInstancesRequest,
9 "instance" | "project"
10> {}
11
12/**
13 * Runtime binding for Cloud SQL `instances.get`.
14 *
15 * Bind this operation to an {@link Instance} in a Function/Action init
16 * phase. Provide {@link GetInstanceHttp}.
17 *
18 * Grants `roles/cloudsql.viewer` on the project under an IAM Condition
19 * naming only this instance (Cloud SQL has no instance-level IAM policy).
20 *
21 * ### Observing Instances
22 * **Example:** Read the bound instance
23 * ```typescript
24 * const getInstance = yield* GCP.SQL.GetInstance(db);
25 * const live = yield* getInstance();
26 * ```
27 *
28 * @binding
29 * @category SQL
30 */
31export interface GetInstance extends Binding.Service<
32 GetInstance,
33 "GCP.SQL.GetInstance",
34 (
35 instance: Instance,
36 ) => Effect.Effect<
37 (
38 request?: GetInstanceRequest,
39 ) => Effect.Effect<
40 sqladmin.DatabaseInstance,
41 sqladmin.GetInstancesError,
42 RuntimeContext
43 >
44 >
45> {}
46
47export const GetInstance = Binding.Service<GetInstance>("GCP.SQL.GetInstance");