CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/lib/api/schema/compute/get-log.ts
Views: 688
1
import { z } from "../../framework";
2
3
import { FailedAPIOperationSchema } from "../common";
4
5
import { ProjectIdSchema } from "../projects/common";
6
import { AccountIdSchema } from "../accounts/common";
7
8
import { ComputeServerIdSchema } from "./common";
9
10
// OpenAPI spec
11
//
12
export const GetComputeServerLogInputSchema = z
13
.object({
14
id: ComputeServerIdSchema,
15
})
16
.describe("Get event log for a particular compute server.");
17
18
export const GetComputeServerLogOutputSchema = z.union([
19
FailedAPIOperationSchema,
20
z.array(
21
z
22
.object({
23
account_id: AccountIdSchema,
24
project_id: ProjectIdSchema,
25
id: z.string().uuid().describe("Event id."),
26
time: z.string().describe("ISO 8601 event timestamp."),
27
event: z
28
.object({
29
server_id: ComputeServerIdSchema,
30
event: z.string().describe("Event name (e.g., `compute-server`"),
31
action: z.string().describe("Event action (e.g., `configuration`"),
32
changes: z
33
.record(
34
z.string(),
35
z.object({
36
to: z.any().describe("Previous state."),
37
from: z.any().describe("New state."),
38
}),
39
)
40
.describe("Changes made to the compute server."),
41
})
42
.describe("Detailed event data."),
43
})
44
.describe("A list of compute server events."),
45
),
46
]);
47
48
export type GetComputeServerLogInput = z.infer<
49
typeof GetComputeServerLogInputSchema
50
>;
51
export type GetComputeServerLogOutput = z.infer<
52
typeof GetComputeServerLogOutputSchema
53
>;
54
55