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/licenses/common.ts
Views: 688
1
/* See src/packages/util/db-schema/site-licenses.ts for the database schema corresponding
2
to this type.
3
*/
4
5
import { z } from "../../framework";
6
7
export const SiteLicenseIdSchema = z
8
.string()
9
.uuid()
10
.describe("Site license id.");
11
12
export const SiteLicenseIdleTimeoutSchema = z
13
.enum(["short", "medium", "day"])
14
.describe("Available options for finite project idle run times.");
15
16
export const SiteLicenseUptimeSchema = z
17
.union([SiteLicenseIdleTimeoutSchema, z.literal("always_running")])
18
.describe(
19
`Determines how long a project runs while not being used before being automatically
20
stopped. A \`short\` value corresponds to a 30-minute timeout, and a \`medium\` value
21
to a 2-hour timeout.`,
22
);
23
24
export const SiteLicenseRunLimitSchema = z
25
.number()
26
.min(0)
27
.describe("Number of projects which may simultaneously use this license");
28
29
export const SiteLicenseQuotaSchema = z.object({
30
always_running: z
31
.boolean()
32
.nullish()
33
.describe(
34
`Indicates whether the project(s) this license is applied to should be
35
allowed to always be running.`,
36
),
37
boost: z
38
.boolean()
39
.nullish()
40
.describe(
41
`If \`true\`, this license is a boost license and allows for a project to
42
temporarily boost the amount of resources available to a project by the amount
43
specified in the \`cpu\`, \`memory\`, and \`disk\` fields.`,
44
),
45
cpu: z
46
.number()
47
.min(1)
48
.describe("Limits the total number of vCPUs allocated to a project."),
49
dedicated_cpu: z.number().min(1).nullish(),
50
dedicated_ram: z.number().min(1).nullish(),
51
disk: z
52
.number()
53
.min(1)
54
.describe(
55
`Disk size in GB to be allocated to the project to which this license is
56
applied.`,
57
),
58
idle_timeout: SiteLicenseIdleTimeoutSchema.nullish(),
59
member: z.boolean().describe(
60
`Member hosting significantly reduces competition for resources, and we
61
prioritize support requests much higher. _Please be aware: licenses of
62
different member hosting service levels cannot be combined!_`,
63
),
64
ram: z
65
.number()
66
.min(1)
67
.describe(
68
"Limits the total memory a project can use. At least 2GB is recommended.",
69
),
70
user: z.enum(["academic", "business"]).describe("User type."),
71
});
72
73