| 1 | import * as GCP from "@/GCP"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { serveProbes } from "../../bindingHost.ts"; |
| 4 | |
| 5 | export const OnPrem = GCP.RapidMigrationAssessment.Collector("BindOnPrem", { |
| 6 | location: "us-central1", |
| 7 | displayName: "bind collector", |
| 8 | collectionDays: 7, |
| 9 | expectedAssetCount: 1, |
| 10 | labels: { env: "bind" }, |
| 11 | }); |
| 12 | |
| 13 | /** |
| 14 | * Effect-native Cloud Run service exercising every Rapid Migration |
| 15 | * Assessment binding as its own runtime service account. Deployed from |
| 16 | * {@link ../Bindings.test.ts}. |
| 17 | */ |
| 18 | export default class RmaBindingsHost extends GCP.Function<RmaBindingsHost>()( |
| 19 | "RmaBindingsHost", |
| 20 | { main: import.meta.url, invokerIamDisabled: true }, |
| 21 | Effect.gen(function* () { |
| 22 | const pause = yield* GCP.RapidMigrationAssessment.PauseCollector(OnPrem); |
| 23 | const resume = yield* GCP.RapidMigrationAssessment.ResumeCollector(OnPrem); |
| 24 | const register = |
| 25 | yield* GCP.RapidMigrationAssessment.RegisterCollector(OnPrem); |
| 26 | |
| 27 | return { |
| 28 | fetch: serveProbes({ |
| 29 | pause: pause(), |
| 30 | resume: resume(), |
| 31 | register: register(), |
| 32 | }), |
| 33 | }; |
| 34 | }).pipe( |
| 35 | Effect.provide(GCP.RapidMigrationAssessment.PauseCollectorHttp), |
| 36 | Effect.provide(GCP.RapidMigrationAssessment.ResumeCollectorHttp), |
| 37 | Effect.provide(GCP.RapidMigrationAssessment.RegisterCollectorHttp), |
| 38 | ), |
| 39 | ) {} |