The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as bqdt from "@distilled.cloud/gcp/bigquerydatatransfer_v1"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Layer from "effect/Layer"; |
| 4 | import * as GCPBindings from "../GCPBindings.ts"; |
| 5 | import { StartManualRuns, type StartManualRunsRequest } from "./StartManualRuns.ts"; |
| 6 | import type { TransferConfig } from "./TransferConfig.ts"; |
| 7 | |
| 8 | /** |
| 9 | * HTTP implementation of {@link StartManualRuns}. |
| 10 | * |
| 11 | * @layer |
| 12 | * @provides GCP.BigQueryDataTransfer.StartManualRuns |
| 13 | */ |
| 14 | export const StartManualRunsHttp = Layer.effect( |
| 15 | StartManualRuns, |
| 16 | Effect.gen(function* () { |
| 17 | const bind = yield* GCPBindings.Bind; |
| 18 | const startManualRunsProjectsLocationsTransferConfigs = yield* GCPBindings.withCredentials( |
| 19 | bqdt.startManualRunsProjectsLocationsTransferConfigs, |
| 20 | ); |
| 21 | return Effect.fn(function* (config: TransferConfig) { |
| 22 | if (!globalThis.__ALCHEMY_RUNTIME__) { |
| 23 | yield* bind`GCP.BigQueryDataTransfer.StartManualRuns(${config})`({ |
| 24 | // bigquery.transfers.update is in no narrower predefined role, and |
| 25 | // transfer configs have no resource-level IAM, so this is a project |
| 26 | // grant (see StartManualRuns JSDoc). |
| 27 | iam: [{ role: "roles/bigquery.admin" }], |
| 28 | }); |
| 29 | } |
| 30 | const name = yield* config.name; |
| 31 | return Effect.fn(`GCP.BigQueryDataTransfer.StartManualRuns(${config.LogicalId})`)(function* ( |
| 32 | request?: StartManualRunsRequest, |
| 33 | ) { |
| 34 | return yield* startManualRunsProjectsLocationsTransferConfigs({ |
| 35 | ...request, |
| 36 | parent: yield* name, |
| 37 | }); |
| 38 | }); |
| 39 | }); |
| 40 | }), |
| 41 | ); |