| 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 { AccessReadWriteToken } from "./AccessReadWriteToken.ts"; |
| 5 | import { makeRepositoryHttpBinding } from "./BindingHttp.ts"; |
| 6 | |
| 7 | /** |
| 8 | * HTTP implementation of {@link AccessReadWriteToken}. |
| 9 | * |
| 10 | * @layer |
| 11 | * @provides GCP.CloudBuild.AccessReadWriteToken |
| 12 | */ |
| 13 | export const AccessReadWriteTokenHttp = Layer.effect( |
| 14 | AccessReadWriteToken, |
| 15 | Effect.gen(function* () { |
| 16 | const access = |
| 17 | yield* cloudbuild.accessReadWriteTokenProjectsLocationsConnectionsRepositories; |
| 18 | return yield* makeRepositoryHttpBinding< |
| 19 | cloudbuild.AccessReadWriteTokenProjectsLocationsConnectionsRepositoriesRequest, |
| 20 | cloudbuild.FetchReadWriteTokenResponse, |
| 21 | cloudbuild.AccessReadWriteTokenProjectsLocationsConnectionsRepositoriesError |
| 22 | >({ |
| 23 | tag: "GCP.CloudBuild.AccessReadWriteToken", |
| 24 | iam: { role: "roles/cloudbuild.tokenAccessor" }, |
| 25 | operation: (input) => |
| 26 | access({ |
| 27 | ...input, |
| 28 | body: input.body ?? {}, |
| 29 | }), |
| 30 | }); |
| 31 | }), |
| 32 | ); |