The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as cloudbuild from "@distilled.cloud/gcp/cloudbuild_v2"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Layer from "effect/Layer"; |
| 4 | import * as GCPBindings from "../GCPBindings.ts"; |
| 5 | import { AccessReadWriteToken } from "./AccessReadWriteToken.ts"; |
| 6 | import { makeRepositoryHttpBinding } from "./BindingHttp.ts"; |
| 7 | |
| 8 | /** |
| 9 | * HTTP implementation of {@link AccessReadWriteToken}. |
| 10 | * |
| 11 | * @layer |
| 12 | * @provides GCP.CloudBuild.AccessReadWriteToken |
| 13 | */ |
| 14 | export const AccessReadWriteTokenHttp = Layer.effect( |
| 15 | AccessReadWriteToken, |
| 16 | Effect.gen(function* () { |
| 17 | const access = yield* GCPBindings.withCredentials( |
| 18 | cloudbuild.accessReadWriteTokenProjectsLocationsConnectionsRepositories, |
| 19 | ); |
| 20 | return yield* makeRepositoryHttpBinding< |
| 21 | cloudbuild.AccessReadWriteTokenProjectsLocationsConnectionsRepositoriesRequest, |
| 22 | cloudbuild.FetchReadWriteTokenResponse, |
| 23 | cloudbuild.AccessReadWriteTokenProjectsLocationsConnectionsRepositoriesError |
| 24 | >({ |
| 25 | tag: "GCP.CloudBuild.AccessReadWriteToken", |
| 26 | iam: { role: "roles/cloudbuild.tokenAccessor" }, |
| 27 | operation: (input) => |
| 28 | access({ |
| 29 | ...input, |
| 30 | body: input.body ?? {}, |
| 31 | }), |
| 32 | }); |
| 33 | }), |
| 34 | ); |