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/get-managed.ts
Views: 688
1
import { z } from "../../framework";
2
3
import { FailedAPIOperationSchema } from "../common";
4
import { AccountIdSchema } from "../accounts/common";
5
6
import {
7
SiteLicenseIdSchema,
8
SiteLicenseQuotaSchema,
9
SiteLicenseRunLimitSchema,
10
} from "./common";
11
12
// OpenAPI spec
13
//
14
export const GetManagedLicensesInputSchema = z
15
.object({
16
limit: z
17
.number()
18
.min(1)
19
.optional()
20
.describe("Limits number of results to the provided value."),
21
skip: z.number().min(1).optional().describe("Skips the first `n` results."),
22
})
23
.describe(
24
`Fetch all licenses which are managed by a particular \`account_id\`. Results are
25
returned in descending order of license creation time.`,
26
);
27
28
export const GetManagedLicensesOutputSchema = z.union([
29
FailedAPIOperationSchema,
30
z
31
.object({
32
id: SiteLicenseIdSchema,
33
title: z.string().optional().describe("User-defined license title."),
34
description: z
35
.string()
36
.optional()
37
.describe("User-defined license description."),
38
expires: z
39
.number()
40
.optional()
41
.describe(
42
"UNIX timestamp (in milliseconds) which indicates when the license is to expire.",
43
),
44
activates: z.number().describe(
45
`UNIX timestamp (in milliseconds) which indicates when the license takes effect.
46
Licenses may be applied prior to this time, but will not take effect before it.`,
47
),
48
last_used: z
49
.number()
50
.optional()
51
.describe(
52
`UNIX timestamp (in milliseconds) which indicates when the license was last used
53
to upgrade a project while it started.`,
54
),
55
created: z
56
.number()
57
.optional()
58
.describe(
59
"UNIX timestamp (in milliseconds) which indicates when the license was created.",
60
),
61
managers: z
62
.array(AccountIdSchema)
63
.describe(
64
"A list of account ids which are permitted to manage this license.",
65
),
66
upgrades: z
67
.object({
68
cores: z.number().min(0),
69
cpu_shares: z.number().min(0),
70
disk_quota: z.number().min(0),
71
memory: z.number().min(0),
72
mintime: z.number().min(0),
73
network: z.number().min(0),
74
})
75
.optional()
76
.describe(
77
`**Deprecated:** A map of upgrades that are applied to a project when it has
78
this site license. This is been deprecated in favor of the \`quota\` field.`,
79
),
80
quota: SiteLicenseQuotaSchema.optional().describe(
81
"The exact resource quota allotted to this license.",
82
),
83
run_limit: SiteLicenseRunLimitSchema,
84
info: z
85
.record(z.string(), z.any())
86
.optional()
87
.describe(
88
`Structured object in which admins may store additional license information.
89
This field generally contains purchase information for the license (e.g.,
90
purchasing account, etc.)`,
91
),
92
})
93
.describe(
94
`Defines a site license object, which is used to determine resource limits (e.g.,
95
CPU, memory, disk space, etc.) to be applied to a running project.`,
96
),
97
]);
98
99
export type GetManagedLicensesInput = z.infer<
100
typeof GetManagedLicensesInputSchema
101
>;
102
export type GetManagedLicensesOutput = z.infer<
103
typeof GetManagedLicensesOutputSchema
104
>;
105
106