@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 35 lines 1.24 KB
Raw
1 import * as Binding from "alchemy/Binding";
2 import type * as Effect from "effect/Effect";
3 import type { SecretBindingTarget } from "./BindingHttp.ts";
4 import type { ReadSecretClient } from "./ReadSecret.ts";
5 import type { WriteSecretClient } from "./WriteSecret.ts";
6
7 export interface ReadWriteSecretClient extends ReadSecretClient, WriteSecretClient {}
8
9 /**
10 * Read and version-management access to a Secret Manager {@link Secret}.
11 * No predefined role covers both, so this grants
12 * `roles/secretmanager.secretAccessor` and
13 * `roles/secretmanager.secretVersionManager` on the secret only.
14 *
15 * ### Reading and rotating
16 * **Example:** Rotate and read back
17 * ```typescript
18 * const apiKey = yield* GCP.SecretManager.ReadWriteSecret(secret);
19 * const current = yield* apiKey.access();
20 * yield* apiKey.addVersion(rotate(current));
21 * // …provided with Effect.provide(GCP.SecretManager.ReadWriteSecretHttp)
22 * ```
23 *
24 * @binding
25 * @category SecretManager
26 */
27 export interface ReadWriteSecret extends Binding.Service<
28 ReadWriteSecret,
29 "GCP.SecretManager.ReadWriteSecret",
30 (secret: SecretBindingTarget) => Effect.Effect<ReadWriteSecretClient>
31 > {}
32
33 export const ReadWriteSecret = Binding.Service<ReadWriteSecret>(
34 "GCP.SecretManager.ReadWriteSecret",
35 );