| 1 | import * as GCP from "@/GCP"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { serveProbes } from "../../bindingHost.ts"; |
| 4 | |
| 5 | /** Connection the host reads (roles/bigquery.connectionUser on it). */ |
| 6 | export const Cloud = GCP.BigQueryConnection.Connection("Cloud", { |
| 7 | location: "us-central1", |
| 8 | cloudResource: {}, |
| 9 | }); |
| 10 | |
| 11 | /** |
| 12 | * Effect-native Cloud Run service exercising every BigQuery Connection |
| 13 | * binding as its own runtime service account. Deployed from |
| 14 | * {@link ../Bindings.test.ts}. |
| 15 | */ |
| 16 | export default class BigQueryConnectionBindingsHost extends GCP.Function<BigQueryConnectionBindingsHost>()( |
| 17 | "BigQueryConnectionBindingsHost", |
| 18 | { main: import.meta.url, invokerIamDisabled: true }, |
| 19 | Effect.gen(function* () { |
| 20 | const getConnection = yield* GCP.BigQueryConnection.GetConnection(Cloud); |
| 21 | |
| 22 | return { |
| 23 | fetch: serveProbes({ |
| 24 | getConnection: getConnection(), |
| 25 | }), |
| 26 | }; |
| 27 | }).pipe(Effect.provide(GCP.BigQueryConnection.GetConnectionHttp)), |
| 28 | ) {} |