@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 44 lines 1.55 KB
Raw
1 import * as GCP from "@alchemy.run/gcp";
2 import * as Effect from "effect/Effect";
3 import { serveProbes } from "../../bindingHost.ts";
4 import { TEST_ATTESTATION, TEST_RESOURCE_URI } from "../common.ts";
5
6 /** Note GetNote is granted on (roles/containeranalysis.notes.viewer). */
7 export const Authority = GCP.ContainerAnalysis.Note("Authority", {
8 shortDescription: "binding attestor",
9 attestation: { hint: { humanReadableName: "Alchemy Bind" } },
10 });
11
12 /** Occurrence GetOccurrence reads (roles/containeranalysis.occurrences.viewer). */
13 export const Signed = Effect.gen(function* () {
14 const note = yield* Authority;
15 return yield* GCP.ContainerAnalysis.Occurrence("Signed", {
16 noteName: note.name,
17 resourceUri: TEST_RESOURCE_URI,
18 attestation: TEST_ATTESTATION,
19 });
20 });
21
22 /**
23 * Effect-native Cloud Run service exercising every Container Analysis
24 * binding as its own runtime service account. Deployed from
25 * {@link ../Bindings.test.ts}.
26 */
27 export default class ContainerAnalysisBindingsHost extends GCP.Function<ContainerAnalysisBindingsHost>()(
28 "ContainerAnalysisBindingsHost",
29 { main: import.meta.url, invokerIamDisabled: true },
30 Effect.gen(function* () {
31 const getNote = yield* GCP.ContainerAnalysis.GetNote(Authority);
32 const getOccurrence = yield* GCP.ContainerAnalysis.GetOccurrence(Signed);
33
34 return {
35 fetch: serveProbes({
36 getNote: getNote(),
37 getOccurrence: getOccurrence(),
38 }),
39 };
40 }).pipe(
41 Effect.provide(GCP.ContainerAnalysis.GetNoteHttp),
42 Effect.provide(GCP.ContainerAnalysis.GetOccurrenceHttp),
43 ),
44 ) {}