The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { GcpEnvironment } from "@alchemy.run/gcp/Environment"; |
| 2 | import * as serviceusage from "@distilled.cloud/gcp/serviceusage_v1"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | |
| 5 | /** |
| 6 | * Whether `service` (e.g. `"metastore.googleapis.com"`) is enabled in the |
| 7 | * testing project. Probes that assert a create is refused while an API is |
| 8 | * disabled must not run once someone enables it: the create would then |
| 9 | * provision a real (and often slow, billed) resource. |
| 10 | */ |
| 11 | export const isServiceEnabled = Effect.fn(function* (service: string) { |
| 12 | const { project } = yield* GcpEnvironment.current; |
| 13 | const observed = yield* serviceusage.getServices({ |
| 14 | name: `projects/${project}/services/${service}`, |
| 15 | }); |
| 16 | return observed.state === "ENABLED"; |
| 17 | }); |