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-network-usage.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 GetComputeServerNetworkUsageInputSchema = z
10
.object({
11
id: ComputeServerIdSchema,
12
start: z
13
.string()
14
.describe("Time after which network usage is to be queried."),
15
end: z
16
.string()
17
.describe("Time before which network usage is to be queried."),
18
})
19
.describe(
20
"Get network usage by a specific server during a particular period of time.",
21
);
22
23
export const GetComputeServerNetworkUsageOutputSchema = z.union([
24
FailedAPIOperationSchema,
25
z.object({
26
amount: z.number().min(0).describe("Total amount of network usage."),
27
cost: z.number().min(0).describe("Network usage cost."),
28
}),
29
]);
30
31
export type GetComputeServerNetworkUsageInput = z.infer<
32
typeof GetComputeServerNetworkUsageInputSchema
33
>;
34
export type GetComputeServerNetworkUsageOutput = z.infer<
35
typeof GetComputeServerNetworkUsageOutputSchema
36
>;
37
38