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, 06:00 UTC
| 1 | import { makeNamedHttpBinding, type BindingIam, type GcpHttpOp } from "../HttpBinding.ts"; |
| 2 | import type { AclPolicy } from "./AclPolicy.ts"; |
| 3 | import type { Instance } from "./Instance.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Shared HTTP scaffolding for Memorystore Redis ACL policy bindings. |
| 7 | * NOT exported from index.ts. |
| 8 | */ |
| 9 | export const makeRedisHttpBinding = <I extends { name?: string }, A, E>(options: { |
| 10 | tag: string; |
| 11 | operation: GcpHttpOp<I, A, E>; |
| 12 | }) => |
| 13 | // Memorystore has no resource-level IAM; viewer under an IAM Condition on |
| 14 | // the policy name covers reads. |
| 15 | makeNamedHttpBinding<AclPolicy, I, A, E>({ |
| 16 | tag: options.tag, |
| 17 | operation: options.operation, |
| 18 | iam: { role: "roles/redis.viewer", scopeByCondition: true }, |
| 19 | resourceName: (policy) => policy.name, |
| 20 | }); |
| 21 | |
| 22 | /** |
| 23 | * Shared HTTP scaffolding for Memorystore Redis instance bindings. |
| 24 | * NOT exported from index.ts. |
| 25 | */ |
| 26 | export const makeRedisInstanceHttpBinding = <I extends { name?: string }, A, E>(options: { |
| 27 | tag: string; |
| 28 | iam: BindingIam; |
| 29 | operation: GcpHttpOp<I, A, E>; |
| 30 | }) => |
| 31 | makeNamedHttpBinding<Instance, I, A, E>({ |
| 32 | tag: options.tag, |
| 33 | operation: options.operation, |
| 34 | iam: options.iam, |
| 35 | resourceName: (instance) => instance.name, |
| 36 | }); |