| 1 | import * as GCP from "@/GCP"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { serveProbes } from "../../bindingHost.ts"; |
| 4 | import TargetFunction from "./target-function.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Effect-native Cloud Run service exercising every Cloud Functions binding |
| 8 | * as its own runtime service account. Deployed from |
| 9 | * {@link ../Bindings.test.ts}. |
| 10 | */ |
| 11 | export default class CloudFunctionsBindingsHost extends GCP.Function<CloudFunctionsBindingsHost>()( |
| 12 | "CloudFunctionsBindingsHost", |
| 13 | { main: import.meta.url, invokerIamDisabled: true }, |
| 14 | Effect.gen(function* () { |
| 15 | const getFunction = yield* GCP.CloudFunctions.GetFunction(TargetFunction); |
| 16 | const download = |
| 17 | yield* GCP.CloudFunctions.GenerateDownloadUrl(TargetFunction); |
| 18 | |
| 19 | return { |
| 20 | fetch: serveProbes({ |
| 21 | getFunction: getFunction(), |
| 22 | generateDownloadUrl: download(), |
| 23 | }), |
| 24 | }; |
| 25 | }).pipe( |
| 26 | Effect.provide(GCP.CloudFunctions.GetFunctionHttp), |
| 27 | Effect.provide(GCP.CloudFunctions.GenerateDownloadUrlHttp), |
| 28 | ), |
| 29 | ) {} |