latitudesh-typescript-sdk 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/mcp-server.js +234 -104
- package/bin/mcp-server.js.map +17 -17
- package/dist/commonjs/funcs/virtualMachinesList.d.ts +4 -2
- package/dist/commonjs/funcs/virtualMachinesList.d.ts.map +1 -1
- package/dist/commonjs/funcs/virtualMachinesList.js +40 -7
- package/dist/commonjs/funcs/virtualMachinesList.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.js +1 -1
- package/dist/commonjs/mcp-server/tools/virtualMachinesList.js +1 -1
- package/dist/commonjs/mcp-server/tools/virtualMachinesList.js.map +1 -1
- package/dist/commonjs/models/billingusage.d.ts +74 -8
- package/dist/commonjs/models/billingusage.d.ts.map +1 -1
- package/dist/commonjs/models/billingusage.js +83 -9
- package/dist/commonjs/models/billingusage.js.map +1 -1
- package/dist/commonjs/models/eventdata.d.ts +16 -16
- package/dist/commonjs/models/eventdata.d.ts.map +1 -1
- package/dist/commonjs/models/eventdata.js +16 -16
- package/dist/commonjs/models/eventdata.js.map +1 -1
- package/dist/commonjs/models/operations/indexvirtualmachine.d.ts +29 -0
- package/dist/commonjs/models/operations/indexvirtualmachine.d.ts.map +1 -1
- package/dist/commonjs/models/operations/indexvirtualmachine.js +38 -1
- package/dist/commonjs/models/operations/indexvirtualmachine.js.map +1 -1
- package/dist/commonjs/models/project.d.ts +57 -13
- package/dist/commonjs/models/project.d.ts.map +1 -1
- package/dist/commonjs/models/project.js +48 -11
- package/dist/commonjs/models/project.js.map +1 -1
- package/dist/commonjs/models/projectinclude.d.ts +6 -0
- package/dist/commonjs/models/projectinclude.d.ts.map +1 -1
- package/dist/commonjs/models/projectinclude.js +8 -0
- package/dist/commonjs/models/projectinclude.js.map +1 -1
- package/dist/commonjs/models/virtualmachineattributes.d.ts +14 -14
- package/dist/commonjs/models/virtualmachineattributes.d.ts.map +1 -1
- package/dist/commonjs/models/virtualmachineattributes.js +7 -15
- package/dist/commonjs/models/virtualmachineattributes.js.map +1 -1
- package/dist/commonjs/models/virtualmachines.d.ts +3 -11
- package/dist/commonjs/models/virtualmachines.d.ts.map +1 -1
- package/dist/commonjs/models/virtualmachines.js +4 -15
- package/dist/commonjs/models/virtualmachines.js.map +1 -1
- package/dist/commonjs/sdk/virtualmachines.d.ts +4 -1
- package/dist/commonjs/sdk/virtualmachines.d.ts.map +1 -1
- package/dist/commonjs/sdk/virtualmachines.js +2 -1
- package/dist/commonjs/sdk/virtualmachines.js.map +1 -1
- package/dist/esm/funcs/virtualMachinesList.d.ts +4 -2
- package/dist/esm/funcs/virtualMachinesList.d.ts.map +1 -1
- package/dist/esm/funcs/virtualMachinesList.js +40 -7
- package/dist/esm/funcs/virtualMachinesList.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.js +1 -1
- package/dist/esm/mcp-server/tools/virtualMachinesList.js +1 -1
- package/dist/esm/mcp-server/tools/virtualMachinesList.js.map +1 -1
- package/dist/esm/models/billingusage.d.ts +74 -8
- package/dist/esm/models/billingusage.d.ts.map +1 -1
- package/dist/esm/models/billingusage.js +76 -8
- package/dist/esm/models/billingusage.js.map +1 -1
- package/dist/esm/models/eventdata.d.ts +16 -16
- package/dist/esm/models/eventdata.d.ts.map +1 -1
- package/dist/esm/models/eventdata.js +16 -16
- package/dist/esm/models/eventdata.js.map +1 -1
- package/dist/esm/models/operations/indexvirtualmachine.d.ts +29 -0
- package/dist/esm/models/operations/indexvirtualmachine.d.ts.map +1 -1
- package/dist/esm/models/operations/indexvirtualmachine.js +35 -0
- package/dist/esm/models/operations/indexvirtualmachine.js.map +1 -1
- package/dist/esm/models/project.d.ts +57 -13
- package/dist/esm/models/project.d.ts.map +1 -1
- package/dist/esm/models/project.js +45 -10
- package/dist/esm/models/project.js.map +1 -1
- package/dist/esm/models/projectinclude.d.ts +6 -0
- package/dist/esm/models/projectinclude.d.ts.map +1 -1
- package/dist/esm/models/projectinclude.js +8 -0
- package/dist/esm/models/projectinclude.js.map +1 -1
- package/dist/esm/models/virtualmachineattributes.d.ts +14 -14
- package/dist/esm/models/virtualmachineattributes.d.ts.map +1 -1
- package/dist/esm/models/virtualmachineattributes.js +6 -14
- package/dist/esm/models/virtualmachineattributes.js.map +1 -1
- package/dist/esm/models/virtualmachines.d.ts +3 -11
- package/dist/esm/models/virtualmachines.d.ts.map +1 -1
- package/dist/esm/models/virtualmachines.js +3 -12
- package/dist/esm/models/virtualmachines.js.map +1 -1
- package/dist/esm/sdk/virtualmachines.d.ts +4 -1
- package/dist/esm/sdk/virtualmachines.d.ts.map +1 -1
- package/dist/esm/sdk/virtualmachines.js +2 -1
- package/dist/esm/sdk/virtualmachines.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +3 -3
- package/src/funcs/virtualMachinesList.ts +102 -31
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/mcp-server/tools/virtualMachinesList.ts +1 -1
- package/src/models/billingusage.ts +189 -16
- package/src/models/eventdata.ts +32 -32
- package/src/models/operations/indexvirtualmachine.ts +81 -0
- package/src/models/project.ts +128 -23
- package/src/models/projectinclude.ts +14 -0
- package/src/models/virtualmachineattributes.ts +20 -24
- package/src/models/virtualmachines.ts +10 -39
- package/src/sdk/virtualmachines.ts +5 -2
- package/tests/integration/helpers/mock-data.ts +6 -2
- package/tests/integration/projects.test.ts +3 -1
package/src/models/project.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
|
-
import
|
|
8
|
+
import * as openEnums from "../types/enums.js";
|
|
9
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
9
10
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
10
11
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
11
12
|
import {
|
|
@@ -15,6 +16,13 @@ import {
|
|
|
15
16
|
TeamInclude$outboundSchema,
|
|
16
17
|
} from "./teaminclude.js";
|
|
17
18
|
|
|
19
|
+
export const ProjectType = {
|
|
20
|
+
Projects: "projects",
|
|
21
|
+
} as const;
|
|
22
|
+
export type ProjectType = ClosedEnum<typeof ProjectType>;
|
|
23
|
+
|
|
24
|
+
export type ProjectTag = {};
|
|
25
|
+
|
|
18
26
|
export const BillingType = {
|
|
19
27
|
Yearly: "Yearly",
|
|
20
28
|
Monthly: "Monthly",
|
|
@@ -22,22 +30,26 @@ export const BillingType = {
|
|
|
22
30
|
Normal: "Normal",
|
|
23
31
|
Custom: "Custom",
|
|
24
32
|
} as const;
|
|
25
|
-
export type BillingType =
|
|
33
|
+
export type BillingType = OpenEnum<typeof BillingType>;
|
|
26
34
|
|
|
27
35
|
export const BillingMethod = {
|
|
28
36
|
Normal: "Normal",
|
|
29
37
|
NinetyFivethPercentile: "95th percentile",
|
|
30
38
|
} as const;
|
|
31
|
-
export type BillingMethod =
|
|
39
|
+
export type BillingMethod = OpenEnum<typeof BillingMethod>;
|
|
32
40
|
|
|
33
41
|
export const Environment = {
|
|
34
42
|
Development: "Development",
|
|
35
43
|
Staging: "Staging",
|
|
36
44
|
Production: "Production",
|
|
37
45
|
} as const;
|
|
38
|
-
export type Environment =
|
|
46
|
+
export type Environment = OpenEnum<typeof Environment>;
|
|
39
47
|
|
|
40
48
|
export type ProjectStats = {
|
|
49
|
+
/**
|
|
50
|
+
* The number of database servers assigned to the project
|
|
51
|
+
*/
|
|
52
|
+
databases?: number | undefined;
|
|
41
53
|
/**
|
|
42
54
|
* The number of IP addresses assigned to the project
|
|
43
55
|
*/
|
|
@@ -51,9 +63,13 @@ export type ProjectStats = {
|
|
|
51
63
|
*/
|
|
52
64
|
servers?: number | undefined;
|
|
53
65
|
/**
|
|
54
|
-
* The number of
|
|
66
|
+
* The number of storages assigned to the project
|
|
55
67
|
*/
|
|
56
|
-
|
|
68
|
+
storages?: number | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* The number of active virtual machines assigned to the project
|
|
71
|
+
*/
|
|
72
|
+
virtualMachines?: number | undefined;
|
|
57
73
|
/**
|
|
58
74
|
* The number of VLANs assigned to the project
|
|
59
75
|
*/
|
|
@@ -67,6 +83,10 @@ export type ProjectBilling = {
|
|
|
67
83
|
};
|
|
68
84
|
|
|
69
85
|
export type ProjectAttributes = {
|
|
86
|
+
/**
|
|
87
|
+
* The tags assigned to the project
|
|
88
|
+
*/
|
|
89
|
+
tags?: Array<ProjectTag> | undefined;
|
|
70
90
|
/**
|
|
71
91
|
* The project name
|
|
72
92
|
*/
|
|
@@ -82,7 +102,15 @@ export type ProjectAttributes = {
|
|
|
82
102
|
billingType?: BillingType | null | undefined;
|
|
83
103
|
billingMethod?: BillingMethod | null | undefined;
|
|
84
104
|
cost?: string | null | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Whether bandwidth quota alerts are enabled for the project
|
|
107
|
+
*/
|
|
108
|
+
bandwidthAlert?: boolean | null | undefined;
|
|
85
109
|
environment?: Environment | null | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* The project provisioning model, either on_demand (pay-as-you-go, hourly or monthly billing) or reserved (annual contract with yearly billing). Defaults to on_demand.
|
|
112
|
+
*/
|
|
113
|
+
provisioningType?: string | null | undefined;
|
|
86
114
|
stats?: ProjectStats | undefined;
|
|
87
115
|
billing?: ProjectBilling | undefined;
|
|
88
116
|
team?: TeamInclude | undefined;
|
|
@@ -95,31 +123,84 @@ export type Project = {
|
|
|
95
123
|
* The project ID
|
|
96
124
|
*/
|
|
97
125
|
id?: string | undefined;
|
|
126
|
+
type?: ProjectType | undefined;
|
|
98
127
|
attributes?: ProjectAttributes | undefined;
|
|
99
128
|
};
|
|
100
129
|
|
|
101
130
|
/** @internal */
|
|
102
|
-
export const
|
|
103
|
-
.nativeEnum(
|
|
131
|
+
export const ProjectType$inboundSchema: z.ZodNativeEnum<typeof ProjectType> = z
|
|
132
|
+
.nativeEnum(ProjectType);
|
|
104
133
|
/** @internal */
|
|
105
|
-
export const
|
|
106
|
-
|
|
134
|
+
export const ProjectType$outboundSchema: z.ZodNativeEnum<typeof ProjectType> =
|
|
135
|
+
ProjectType$inboundSchema;
|
|
107
136
|
|
|
108
137
|
/** @internal */
|
|
109
|
-
export const
|
|
110
|
-
|
|
111
|
-
|
|
138
|
+
export const ProjectTag$inboundSchema: z.ZodType<
|
|
139
|
+
ProjectTag,
|
|
140
|
+
z.ZodTypeDef,
|
|
141
|
+
unknown
|
|
142
|
+
> = z.object({});
|
|
112
143
|
/** @internal */
|
|
113
|
-
export
|
|
114
|
-
typeof BillingMethod
|
|
115
|
-
> = BillingMethod$inboundSchema;
|
|
144
|
+
export type ProjectTag$Outbound = {};
|
|
116
145
|
|
|
117
146
|
/** @internal */
|
|
118
|
-
export const
|
|
119
|
-
|
|
147
|
+
export const ProjectTag$outboundSchema: z.ZodType<
|
|
148
|
+
ProjectTag$Outbound,
|
|
149
|
+
z.ZodTypeDef,
|
|
150
|
+
ProjectTag
|
|
151
|
+
> = z.object({});
|
|
152
|
+
|
|
153
|
+
export function projectTagToJSON(projectTag: ProjectTag): string {
|
|
154
|
+
return JSON.stringify(ProjectTag$outboundSchema.parse(projectTag));
|
|
155
|
+
}
|
|
156
|
+
export function projectTagFromJSON(
|
|
157
|
+
jsonString: string,
|
|
158
|
+
): SafeParseResult<ProjectTag, SDKValidationError> {
|
|
159
|
+
return safeParse(
|
|
160
|
+
jsonString,
|
|
161
|
+
(x) => ProjectTag$inboundSchema.parse(JSON.parse(x)),
|
|
162
|
+
`Failed to parse 'ProjectTag' from JSON`,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** @internal */
|
|
167
|
+
export const BillingType$inboundSchema: z.ZodType<
|
|
168
|
+
BillingType,
|
|
169
|
+
z.ZodTypeDef,
|
|
170
|
+
unknown
|
|
171
|
+
> = openEnums.inboundSchema(BillingType);
|
|
172
|
+
/** @internal */
|
|
173
|
+
export const BillingType$outboundSchema: z.ZodType<
|
|
174
|
+
string,
|
|
175
|
+
z.ZodTypeDef,
|
|
176
|
+
BillingType
|
|
177
|
+
> = openEnums.outboundSchema(BillingType);
|
|
178
|
+
|
|
179
|
+
/** @internal */
|
|
180
|
+
export const BillingMethod$inboundSchema: z.ZodType<
|
|
181
|
+
BillingMethod,
|
|
182
|
+
z.ZodTypeDef,
|
|
183
|
+
unknown
|
|
184
|
+
> = openEnums.inboundSchema(BillingMethod);
|
|
185
|
+
/** @internal */
|
|
186
|
+
export const BillingMethod$outboundSchema: z.ZodType<
|
|
187
|
+
string,
|
|
188
|
+
z.ZodTypeDef,
|
|
189
|
+
BillingMethod
|
|
190
|
+
> = openEnums.outboundSchema(BillingMethod);
|
|
191
|
+
|
|
120
192
|
/** @internal */
|
|
121
|
-
export const Environment$
|
|
122
|
-
Environment
|
|
193
|
+
export const Environment$inboundSchema: z.ZodType<
|
|
194
|
+
Environment,
|
|
195
|
+
z.ZodTypeDef,
|
|
196
|
+
unknown
|
|
197
|
+
> = openEnums.inboundSchema(Environment);
|
|
198
|
+
/** @internal */
|
|
199
|
+
export const Environment$outboundSchema: z.ZodType<
|
|
200
|
+
string,
|
|
201
|
+
z.ZodTypeDef,
|
|
202
|
+
Environment
|
|
203
|
+
> = openEnums.outboundSchema(Environment);
|
|
123
204
|
|
|
124
205
|
/** @internal */
|
|
125
206
|
export const ProjectStats$inboundSchema: z.ZodType<
|
|
@@ -127,22 +208,27 @@ export const ProjectStats$inboundSchema: z.ZodType<
|
|
|
127
208
|
z.ZodTypeDef,
|
|
128
209
|
unknown
|
|
129
210
|
> = z.object({
|
|
211
|
+
databases: z.number().optional(),
|
|
130
212
|
ip_addresses: z.number().optional(),
|
|
131
213
|
prefixes: z.number().optional(),
|
|
132
214
|
servers: z.number().optional(),
|
|
133
|
-
|
|
215
|
+
storages: z.number().optional(),
|
|
216
|
+
virtual_machines: z.number().optional(),
|
|
134
217
|
vlans: z.number().optional(),
|
|
135
218
|
}).transform((v) => {
|
|
136
219
|
return remap$(v, {
|
|
137
220
|
"ip_addresses": "ipAddresses",
|
|
221
|
+
"virtual_machines": "virtualMachines",
|
|
138
222
|
});
|
|
139
223
|
});
|
|
140
224
|
/** @internal */
|
|
141
225
|
export type ProjectStats$Outbound = {
|
|
226
|
+
databases?: number | undefined;
|
|
142
227
|
ip_addresses?: number | undefined;
|
|
143
228
|
prefixes?: number | undefined;
|
|
144
229
|
servers?: number | undefined;
|
|
145
|
-
|
|
230
|
+
storages?: number | undefined;
|
|
231
|
+
virtual_machines?: number | undefined;
|
|
146
232
|
vlans?: number | undefined;
|
|
147
233
|
};
|
|
148
234
|
|
|
@@ -152,14 +238,17 @@ export const ProjectStats$outboundSchema: z.ZodType<
|
|
|
152
238
|
z.ZodTypeDef,
|
|
153
239
|
ProjectStats
|
|
154
240
|
> = z.object({
|
|
241
|
+
databases: z.number().optional(),
|
|
155
242
|
ipAddresses: z.number().optional(),
|
|
156
243
|
prefixes: z.number().optional(),
|
|
157
244
|
servers: z.number().optional(),
|
|
158
|
-
|
|
245
|
+
storages: z.number().optional(),
|
|
246
|
+
virtualMachines: z.number().optional(),
|
|
159
247
|
vlans: z.number().optional(),
|
|
160
248
|
}).transform((v) => {
|
|
161
249
|
return remap$(v, {
|
|
162
250
|
ipAddresses: "ip_addresses",
|
|
251
|
+
virtualMachines: "virtual_machines",
|
|
163
252
|
});
|
|
164
253
|
});
|
|
165
254
|
|
|
@@ -231,13 +320,16 @@ export const ProjectAttributes$inboundSchema: z.ZodType<
|
|
|
231
320
|
z.ZodTypeDef,
|
|
232
321
|
unknown
|
|
233
322
|
> = z.object({
|
|
323
|
+
tags: z.array(z.lazy(() => ProjectTag$inboundSchema)).optional(),
|
|
234
324
|
name: z.string().optional(),
|
|
235
325
|
slug: z.string().optional(),
|
|
236
326
|
description: z.nullable(z.string()).optional(),
|
|
237
327
|
billing_type: z.nullable(BillingType$inboundSchema).optional(),
|
|
238
328
|
billing_method: z.nullable(BillingMethod$inboundSchema).optional(),
|
|
239
329
|
cost: z.nullable(z.string()).optional(),
|
|
330
|
+
bandwidth_alert: z.nullable(z.boolean()).optional(),
|
|
240
331
|
environment: z.nullable(Environment$inboundSchema).optional(),
|
|
332
|
+
provisioning_type: z.nullable(z.string()).optional(),
|
|
241
333
|
stats: z.lazy(() => ProjectStats$inboundSchema).optional(),
|
|
242
334
|
billing: z.lazy(() => ProjectBilling$inboundSchema).optional(),
|
|
243
335
|
team: TeamInclude$inboundSchema.optional(),
|
|
@@ -247,19 +339,24 @@ export const ProjectAttributes$inboundSchema: z.ZodType<
|
|
|
247
339
|
return remap$(v, {
|
|
248
340
|
"billing_type": "billingType",
|
|
249
341
|
"billing_method": "billingMethod",
|
|
342
|
+
"bandwidth_alert": "bandwidthAlert",
|
|
343
|
+
"provisioning_type": "provisioningType",
|
|
250
344
|
"created_at": "createdAt",
|
|
251
345
|
"updated_at": "updatedAt",
|
|
252
346
|
});
|
|
253
347
|
});
|
|
254
348
|
/** @internal */
|
|
255
349
|
export type ProjectAttributes$Outbound = {
|
|
350
|
+
tags?: Array<ProjectTag$Outbound> | undefined;
|
|
256
351
|
name?: string | undefined;
|
|
257
352
|
slug?: string | undefined;
|
|
258
353
|
description?: string | null | undefined;
|
|
259
354
|
billing_type?: string | null | undefined;
|
|
260
355
|
billing_method?: string | null | undefined;
|
|
261
356
|
cost?: string | null | undefined;
|
|
357
|
+
bandwidth_alert?: boolean | null | undefined;
|
|
262
358
|
environment?: string | null | undefined;
|
|
359
|
+
provisioning_type?: string | null | undefined;
|
|
263
360
|
stats?: ProjectStats$Outbound | undefined;
|
|
264
361
|
billing?: ProjectBilling$Outbound | undefined;
|
|
265
362
|
team?: TeamInclude$Outbound | undefined;
|
|
@@ -273,13 +370,16 @@ export const ProjectAttributes$outboundSchema: z.ZodType<
|
|
|
273
370
|
z.ZodTypeDef,
|
|
274
371
|
ProjectAttributes
|
|
275
372
|
> = z.object({
|
|
373
|
+
tags: z.array(z.lazy(() => ProjectTag$outboundSchema)).optional(),
|
|
276
374
|
name: z.string().optional(),
|
|
277
375
|
slug: z.string().optional(),
|
|
278
376
|
description: z.nullable(z.string()).optional(),
|
|
279
377
|
billingType: z.nullable(BillingType$outboundSchema).optional(),
|
|
280
378
|
billingMethod: z.nullable(BillingMethod$outboundSchema).optional(),
|
|
281
379
|
cost: z.nullable(z.string()).optional(),
|
|
380
|
+
bandwidthAlert: z.nullable(z.boolean()).optional(),
|
|
282
381
|
environment: z.nullable(Environment$outboundSchema).optional(),
|
|
382
|
+
provisioningType: z.nullable(z.string()).optional(),
|
|
283
383
|
stats: z.lazy(() => ProjectStats$outboundSchema).optional(),
|
|
284
384
|
billing: z.lazy(() => ProjectBilling$outboundSchema).optional(),
|
|
285
385
|
team: TeamInclude$outboundSchema.optional(),
|
|
@@ -289,6 +389,8 @@ export const ProjectAttributes$outboundSchema: z.ZodType<
|
|
|
289
389
|
return remap$(v, {
|
|
290
390
|
billingType: "billing_type",
|
|
291
391
|
billingMethod: "billing_method",
|
|
392
|
+
bandwidthAlert: "bandwidth_alert",
|
|
393
|
+
provisioningType: "provisioning_type",
|
|
292
394
|
createdAt: "created_at",
|
|
293
395
|
updatedAt: "updated_at",
|
|
294
396
|
});
|
|
@@ -315,11 +417,13 @@ export function projectAttributesFromJSON(
|
|
|
315
417
|
export const Project$inboundSchema: z.ZodType<Project, z.ZodTypeDef, unknown> =
|
|
316
418
|
z.object({
|
|
317
419
|
id: z.string().optional(),
|
|
420
|
+
type: ProjectType$inboundSchema.optional(),
|
|
318
421
|
attributes: z.lazy(() => ProjectAttributes$inboundSchema).optional(),
|
|
319
422
|
});
|
|
320
423
|
/** @internal */
|
|
321
424
|
export type Project$Outbound = {
|
|
322
425
|
id?: string | undefined;
|
|
426
|
+
type?: string | undefined;
|
|
323
427
|
attributes?: ProjectAttributes$Outbound | undefined;
|
|
324
428
|
};
|
|
325
429
|
|
|
@@ -330,6 +434,7 @@ export const Project$outboundSchema: z.ZodType<
|
|
|
330
434
|
Project
|
|
331
435
|
> = z.object({
|
|
332
436
|
id: z.string().optional(),
|
|
437
|
+
type: ProjectType$outboundSchema.optional(),
|
|
333
438
|
attributes: z.lazy(() => ProjectAttributes$outboundSchema).optional(),
|
|
334
439
|
});
|
|
335
440
|
|
|
@@ -15,9 +15,12 @@ export type ProjectIncludeBilling = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export type ProjectIncludeStats = {
|
|
18
|
+
databases?: number | undefined;
|
|
18
19
|
ipAddresses?: number | undefined;
|
|
19
20
|
prefixes?: number | undefined;
|
|
20
21
|
servers?: number | undefined;
|
|
22
|
+
storages?: number | undefined;
|
|
23
|
+
virtualMachines?: number | undefined;
|
|
21
24
|
vlans?: number | undefined;
|
|
22
25
|
};
|
|
23
26
|
|
|
@@ -94,20 +97,27 @@ export const ProjectIncludeStats$inboundSchema: z.ZodType<
|
|
|
94
97
|
z.ZodTypeDef,
|
|
95
98
|
unknown
|
|
96
99
|
> = z.object({
|
|
100
|
+
databases: z.number().int().optional(),
|
|
97
101
|
ip_addresses: z.number().int().optional(),
|
|
98
102
|
prefixes: z.number().int().optional(),
|
|
99
103
|
servers: z.number().int().optional(),
|
|
104
|
+
storages: z.number().int().optional(),
|
|
105
|
+
virtual_machines: z.number().int().optional(),
|
|
100
106
|
vlans: z.number().int().optional(),
|
|
101
107
|
}).transform((v) => {
|
|
102
108
|
return remap$(v, {
|
|
103
109
|
"ip_addresses": "ipAddresses",
|
|
110
|
+
"virtual_machines": "virtualMachines",
|
|
104
111
|
});
|
|
105
112
|
});
|
|
106
113
|
/** @internal */
|
|
107
114
|
export type ProjectIncludeStats$Outbound = {
|
|
115
|
+
databases?: number | undefined;
|
|
108
116
|
ip_addresses?: number | undefined;
|
|
109
117
|
prefixes?: number | undefined;
|
|
110
118
|
servers?: number | undefined;
|
|
119
|
+
storages?: number | undefined;
|
|
120
|
+
virtual_machines?: number | undefined;
|
|
111
121
|
vlans?: number | undefined;
|
|
112
122
|
};
|
|
113
123
|
|
|
@@ -117,13 +127,17 @@ export const ProjectIncludeStats$outboundSchema: z.ZodType<
|
|
|
117
127
|
z.ZodTypeDef,
|
|
118
128
|
ProjectIncludeStats
|
|
119
129
|
> = z.object({
|
|
130
|
+
databases: z.number().int().optional(),
|
|
120
131
|
ipAddresses: z.number().int().optional(),
|
|
121
132
|
prefixes: z.number().int().optional(),
|
|
122
133
|
servers: z.number().int().optional(),
|
|
134
|
+
storages: z.number().int().optional(),
|
|
135
|
+
virtualMachines: z.number().int().optional(),
|
|
123
136
|
vlans: z.number().int().optional(),
|
|
124
137
|
}).transform((v) => {
|
|
125
138
|
return remap$(v, {
|
|
126
139
|
ipAddresses: "ip_addresses",
|
|
140
|
+
virtualMachines: "virtual_machines",
|
|
127
141
|
});
|
|
128
142
|
});
|
|
129
143
|
|
|
@@ -28,18 +28,6 @@ export type VirtualMachineAttributesType = ClosedEnum<
|
|
|
28
28
|
typeof VirtualMachineAttributesType
|
|
29
29
|
>;
|
|
30
30
|
|
|
31
|
-
export const VirtualMachineAttributesStatus = {
|
|
32
|
-
Running: "Running",
|
|
33
|
-
ConfiguringNetwork: "Configuring network",
|
|
34
|
-
Starting: "Starting",
|
|
35
|
-
Scheduling: "Scheduling",
|
|
36
|
-
Scheduled: "Scheduled",
|
|
37
|
-
Destroying: "Destroying",
|
|
38
|
-
} as const;
|
|
39
|
-
export type VirtualMachineAttributesStatus = ClosedEnum<
|
|
40
|
-
typeof VirtualMachineAttributesStatus
|
|
41
|
-
>;
|
|
42
|
-
|
|
43
31
|
/**
|
|
44
32
|
* Features supported by this operating system
|
|
45
33
|
*/
|
|
@@ -56,6 +44,14 @@ export type VirtualMachineAttributesFeatures = {
|
|
|
56
44
|
* Whether user data is supported
|
|
57
45
|
*/
|
|
58
46
|
userData?: boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Whether rescue mode is supported
|
|
49
|
+
*/
|
|
50
|
+
rescue?: boolean | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Whether workflow is supported
|
|
53
|
+
*/
|
|
54
|
+
workflow?: boolean | undefined;
|
|
59
55
|
};
|
|
60
56
|
|
|
61
57
|
/**
|
|
@@ -138,7 +134,10 @@ export type VirtualMachineAttributesTag = {
|
|
|
138
134
|
export type VirtualMachineAttributesAttributes = {
|
|
139
135
|
name?: string | undefined;
|
|
140
136
|
createdAt?: string | undefined;
|
|
141
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Current lifecycle status of the VM, derived from the underlying KubeVirt phase/printable status and capitalized. This is an open set that may grow over time — do not treat it as a closed enum. Known values include: Running, Starting, Stopped, Stopping, Failed, Off, Error, Rebooting, Deleting, Destroying, Configuring network, Scheduling, Scheduled, Provisioning.
|
|
139
|
+
*/
|
|
140
|
+
status?: string | undefined;
|
|
142
141
|
primaryIpv4?: string | null | undefined;
|
|
143
142
|
/**
|
|
144
143
|
* The operating system installed on the virtual machine
|
|
@@ -180,15 +179,6 @@ export const VirtualMachineAttributesType$outboundSchema: z.ZodNativeEnum<
|
|
|
180
179
|
typeof VirtualMachineAttributesType
|
|
181
180
|
> = VirtualMachineAttributesType$inboundSchema;
|
|
182
181
|
|
|
183
|
-
/** @internal */
|
|
184
|
-
export const VirtualMachineAttributesStatus$inboundSchema: z.ZodNativeEnum<
|
|
185
|
-
typeof VirtualMachineAttributesStatus
|
|
186
|
-
> = z.nativeEnum(VirtualMachineAttributesStatus);
|
|
187
|
-
/** @internal */
|
|
188
|
-
export const VirtualMachineAttributesStatus$outboundSchema: z.ZodNativeEnum<
|
|
189
|
-
typeof VirtualMachineAttributesStatus
|
|
190
|
-
> = VirtualMachineAttributesStatus$inboundSchema;
|
|
191
|
-
|
|
192
182
|
/** @internal */
|
|
193
183
|
export const VirtualMachineAttributesFeatures$inboundSchema: z.ZodType<
|
|
194
184
|
VirtualMachineAttributesFeatures,
|
|
@@ -198,6 +188,8 @@ export const VirtualMachineAttributesFeatures$inboundSchema: z.ZodType<
|
|
|
198
188
|
raid: z.boolean().optional(),
|
|
199
189
|
ssh_keys: z.boolean().optional(),
|
|
200
190
|
user_data: z.boolean().optional(),
|
|
191
|
+
rescue: z.boolean().optional(),
|
|
192
|
+
workflow: z.boolean().optional(),
|
|
201
193
|
}).transform((v) => {
|
|
202
194
|
return remap$(v, {
|
|
203
195
|
"ssh_keys": "sshKeys",
|
|
@@ -209,6 +201,8 @@ export type VirtualMachineAttributesFeatures$Outbound = {
|
|
|
209
201
|
raid?: boolean | undefined;
|
|
210
202
|
ssh_keys?: boolean | undefined;
|
|
211
203
|
user_data?: boolean | undefined;
|
|
204
|
+
rescue?: boolean | undefined;
|
|
205
|
+
workflow?: boolean | undefined;
|
|
212
206
|
};
|
|
213
207
|
|
|
214
208
|
/** @internal */
|
|
@@ -220,6 +214,8 @@ export const VirtualMachineAttributesFeatures$outboundSchema: z.ZodType<
|
|
|
220
214
|
raid: z.boolean().optional(),
|
|
221
215
|
sshKeys: z.boolean().optional(),
|
|
222
216
|
userData: z.boolean().optional(),
|
|
217
|
+
rescue: z.boolean().optional(),
|
|
218
|
+
workflow: z.boolean().optional(),
|
|
223
219
|
}).transform((v) => {
|
|
224
220
|
return remap$(v, {
|
|
225
221
|
sshKeys: "ssh_keys",
|
|
@@ -570,7 +566,7 @@ export const VirtualMachineAttributesAttributes$inboundSchema: z.ZodType<
|
|
|
570
566
|
> = z.object({
|
|
571
567
|
name: z.string().optional(),
|
|
572
568
|
created_at: z.string().optional(),
|
|
573
|
-
status:
|
|
569
|
+
status: z.string().optional(),
|
|
574
570
|
primary_ipv4: z.nullable(z.string()).optional(),
|
|
575
571
|
operating_system: z.nullable(
|
|
576
572
|
z.lazy(() => VirtualMachineAttributesOperatingSystem$inboundSchema),
|
|
@@ -627,7 +623,7 @@ export const VirtualMachineAttributesAttributes$outboundSchema: z.ZodType<
|
|
|
627
623
|
> = z.object({
|
|
628
624
|
name: z.string().optional(),
|
|
629
625
|
createdAt: z.string().optional(),
|
|
630
|
-
status:
|
|
626
|
+
status: z.string().optional(),
|
|
631
627
|
primaryIpv4: z.nullable(z.string()).optional(),
|
|
632
628
|
operatingSystem: z.nullable(
|
|
633
629
|
z.lazy(() => VirtualMachineAttributesOperatingSystem$outboundSchema),
|
|
@@ -6,6 +6,12 @@ import * as z from "zod/v3";
|
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
7
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
8
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
PaginationMeta,
|
|
11
|
+
PaginationMeta$inboundSchema,
|
|
12
|
+
PaginationMeta$Outbound,
|
|
13
|
+
PaginationMeta$outboundSchema,
|
|
14
|
+
} from "./paginationmeta.js";
|
|
9
15
|
import {
|
|
10
16
|
VirtualMachineAttributes,
|
|
11
17
|
VirtualMachineAttributes$inboundSchema,
|
|
@@ -13,46 +19,11 @@ import {
|
|
|
13
19
|
VirtualMachineAttributes$outboundSchema,
|
|
14
20
|
} from "./virtualmachineattributes.js";
|
|
15
21
|
|
|
16
|
-
export type VirtualMachinesMeta = {};
|
|
17
|
-
|
|
18
22
|
export type VirtualMachines = {
|
|
19
23
|
data?: Array<VirtualMachineAttributes> | undefined;
|
|
20
|
-
meta?:
|
|
24
|
+
meta?: PaginationMeta | undefined;
|
|
21
25
|
};
|
|
22
26
|
|
|
23
|
-
/** @internal */
|
|
24
|
-
export const VirtualMachinesMeta$inboundSchema: z.ZodType<
|
|
25
|
-
VirtualMachinesMeta,
|
|
26
|
-
z.ZodTypeDef,
|
|
27
|
-
unknown
|
|
28
|
-
> = z.object({});
|
|
29
|
-
/** @internal */
|
|
30
|
-
export type VirtualMachinesMeta$Outbound = {};
|
|
31
|
-
|
|
32
|
-
/** @internal */
|
|
33
|
-
export const VirtualMachinesMeta$outboundSchema: z.ZodType<
|
|
34
|
-
VirtualMachinesMeta$Outbound,
|
|
35
|
-
z.ZodTypeDef,
|
|
36
|
-
VirtualMachinesMeta
|
|
37
|
-
> = z.object({});
|
|
38
|
-
|
|
39
|
-
export function virtualMachinesMetaToJSON(
|
|
40
|
-
virtualMachinesMeta: VirtualMachinesMeta,
|
|
41
|
-
): string {
|
|
42
|
-
return JSON.stringify(
|
|
43
|
-
VirtualMachinesMeta$outboundSchema.parse(virtualMachinesMeta),
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
export function virtualMachinesMetaFromJSON(
|
|
47
|
-
jsonString: string,
|
|
48
|
-
): SafeParseResult<VirtualMachinesMeta, SDKValidationError> {
|
|
49
|
-
return safeParse(
|
|
50
|
-
jsonString,
|
|
51
|
-
(x) => VirtualMachinesMeta$inboundSchema.parse(JSON.parse(x)),
|
|
52
|
-
`Failed to parse 'VirtualMachinesMeta' from JSON`,
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
27
|
/** @internal */
|
|
57
28
|
export const VirtualMachines$inboundSchema: z.ZodType<
|
|
58
29
|
VirtualMachines,
|
|
@@ -60,12 +31,12 @@ export const VirtualMachines$inboundSchema: z.ZodType<
|
|
|
60
31
|
unknown
|
|
61
32
|
> = z.object({
|
|
62
33
|
data: z.array(VirtualMachineAttributes$inboundSchema).optional(),
|
|
63
|
-
meta:
|
|
34
|
+
meta: PaginationMeta$inboundSchema.optional(),
|
|
64
35
|
});
|
|
65
36
|
/** @internal */
|
|
66
37
|
export type VirtualMachines$Outbound = {
|
|
67
38
|
data?: Array<VirtualMachineAttributes$Outbound> | undefined;
|
|
68
|
-
meta?:
|
|
39
|
+
meta?: PaginationMeta$Outbound | undefined;
|
|
69
40
|
};
|
|
70
41
|
|
|
71
42
|
/** @internal */
|
|
@@ -75,7 +46,7 @@ export const VirtualMachines$outboundSchema: z.ZodType<
|
|
|
75
46
|
VirtualMachines
|
|
76
47
|
> = z.object({
|
|
77
48
|
data: z.array(VirtualMachineAttributes$outboundSchema).optional(),
|
|
78
|
-
meta:
|
|
49
|
+
meta: PaginationMeta$outboundSchema.optional(),
|
|
79
50
|
});
|
|
80
51
|
|
|
81
52
|
export function virtualMachinesToJSON(
|
|
@@ -16,6 +16,7 @@ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
|
16
16
|
import * as models from "../models/index.js";
|
|
17
17
|
import * as operations from "../models/operations/index.js";
|
|
18
18
|
import { unwrapAsync } from "../types/fp.js";
|
|
19
|
+
import { PageIterator, unwrapResultIterator } from "../types/operations.js";
|
|
19
20
|
|
|
20
21
|
export class VirtualMachines extends ClientSDK {
|
|
21
22
|
/**
|
|
@@ -44,8 +45,10 @@ export class VirtualMachines extends ClientSDK {
|
|
|
44
45
|
async list(
|
|
45
46
|
request?: operations.IndexVirtualMachineRequest | undefined,
|
|
46
47
|
options?: RequestOptions,
|
|
47
|
-
): Promise<
|
|
48
|
-
|
|
48
|
+
): Promise<
|
|
49
|
+
PageIterator<operations.IndexVirtualMachineResponse, { page: number }>
|
|
50
|
+
> {
|
|
51
|
+
return unwrapResultIterator(virtualMachinesList(
|
|
49
52
|
this,
|
|
50
53
|
request,
|
|
51
54
|
options,
|
|
@@ -137,10 +137,12 @@ export const mockProject = {
|
|
|
137
137
|
cost: '0.00',
|
|
138
138
|
environment: 'Development',
|
|
139
139
|
stats: {
|
|
140
|
+
databases: 0,
|
|
140
141
|
ip_addresses: 2,
|
|
141
142
|
prefixes: 0,
|
|
142
143
|
servers: 1,
|
|
143
|
-
|
|
144
|
+
storages: 0,
|
|
145
|
+
virtual_machines: 0,
|
|
144
146
|
vlans: 1,
|
|
145
147
|
},
|
|
146
148
|
billing: {
|
|
@@ -168,10 +170,12 @@ export const mockProjectList = {
|
|
|
168
170
|
cost: '150.00',
|
|
169
171
|
environment: 'Production',
|
|
170
172
|
stats: {
|
|
173
|
+
databases: 0,
|
|
171
174
|
ip_addresses: 10,
|
|
172
175
|
prefixes: 1,
|
|
173
176
|
servers: 5,
|
|
174
|
-
|
|
177
|
+
storages: 2,
|
|
178
|
+
virtual_machines: 1,
|
|
175
179
|
vlans: 3,
|
|
176
180
|
},
|
|
177
181
|
billing: {
|
|
@@ -471,7 +471,9 @@ describe('Projects - Core CRUD Operations', () => {
|
|
|
471
471
|
expect(project.attributes.stats.ipAddresses).toBe(2);
|
|
472
472
|
expect(project.attributes.stats.servers).toBe(1);
|
|
473
473
|
expect(project.attributes.stats.vlans).toBe(1);
|
|
474
|
-
expect(project.attributes.stats.
|
|
474
|
+
expect(project.attributes.stats.storages).toBe(0);
|
|
475
|
+
expect(project.attributes.stats.virtualMachines).toBe(0);
|
|
476
|
+
expect(project.attributes.stats.databases).toBe(0);
|
|
475
477
|
expect(project.attributes.stats.prefixes).toBe(0);
|
|
476
478
|
});
|
|
477
479
|
});
|