1import type * as redis from "@distilled.cloud/gcp/redis_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 GetAuthStringRequest extends Omit<
8 redis.GetAuthStringProjectsLocationsInstancesRequest,
9 "name"
10> {}
11
12/**
13 * Runtime binding for Memorystore Redis `instances.getAuthString`.
14 *
15 * Bind this operation to an {@link Instance} in a Function/Action init
16 * phase. Provide {@link GetAuthStringHttp}. If AUTH is not enabled the
17 * response `authString` is empty. `redis.instances.getAuthString` is only
18 * in `roles/redis.admin`, so the host is granted that role on the project
19 * under an IAM Condition matching the bound instance.
20 *
21 * ### Reading AUTH
22 * **Example:** Fetch the AUTH string
23 * ```typescript
24 * const getAuthString = yield* GCP.Redis.GetAuthString(cache);
25 * const { authString } = yield* getAuthString();
26 * ```
27 *
28 * @binding
29 * @category Redis
30 */
31export interface GetAuthString extends Binding.Service<
32 GetAuthString,
33 "GCP.Redis.GetAuthString",
34 (
35 instance: Instance,
36 ) => Effect.Effect<
37 (
38 request?: GetAuthStringRequest,
39 ) => Effect.Effect<
40 redis.InstanceAuthString,
41 redis.GetAuthStringProjectsLocationsInstancesError,
42 RuntimeContext
43 >
44 >
45> {}
46
47export const GetAuthString = Binding.Service<GetAuthString>(
48 "GCP.Redis.GetAuthString",
49);