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/compute-server-action.ts
Views: 688
1
import { z } from "../../framework";
2
3
import { FailedAPIOperationSchema } from "../common";
4
5
import { ComputeServerIdSchema } from "./common";
6
7
// OpenAPI spec
8
//
9
export const ComputeServerActionInputSchema = z
10
.object({
11
id: ComputeServerIdSchema,
12
action: z
13
.enum(["start", "stop", "reboot", "suspend", "resume", "deprovision"])
14
.describe("Action to be performed on the compute server."),
15
})
16
.describe(
17
`Perform various actions on a specific compute server (e.g., power off, deprovision,
18
etc.).`,
19
);
20
21
export const ComputeServerActionOutputSchema = z.union([
22
FailedAPIOperationSchema,
23
z.object({
24
result: z
25
.array(z.string())
26
.describe(
27
"List of likely guesses for the type of code, from most likely to less likely.",
28
),
29
}),
30
]);
31
32
export type ComputeServerActionInput = z.infer<
33
typeof ComputeServerActionInputSchema
34
>;
35
export type ComputeServerActionOutput = z.infer<
36
typeof ComputeServerActionOutputSchema
37
>;
38
39