@nilovonjs/hcloud-js 1.0.0
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/README.md +90 -0
- package/package.json +70 -0
- package/src/apis/actions/index.ts +113 -0
- package/src/apis/actions/schemas.ts +59 -0
- package/src/apis/actions/types.ts +77 -0
- package/src/apis/certificates/index.ts +326 -0
- package/src/apis/certificates/schemas.ts +140 -0
- package/src/apis/certificates/types.ts +176 -0
- package/src/apis/common/schemas.ts +19 -0
- package/src/apis/dns/index.ts +961 -0
- package/src/apis/dns/schemas.ts +437 -0
- package/src/apis/dns/types.ts +397 -0
- package/src/apis/firewalls/index.ts +469 -0
- package/src/apis/firewalls/schemas.ts +274 -0
- package/src/apis/firewalls/types.ts +205 -0
- package/src/apis/floating-ips/index.ts +466 -0
- package/src/apis/floating-ips/schemas.ts +203 -0
- package/src/apis/floating-ips/types.ts +207 -0
- package/src/apis/images/index.ts +195 -0
- package/src/apis/images/schemas.ts +113 -0
- package/src/apis/images/types.ts +124 -0
- package/src/apis/isos/index.ts +91 -0
- package/src/apis/isos/schemas.ts +43 -0
- package/src/apis/isos/types.ts +60 -0
- package/src/apis/load-balancers/index.ts +892 -0
- package/src/apis/load-balancers/schemas.ts +561 -0
- package/src/apis/load-balancers/types.ts +361 -0
- package/src/apis/locations/index.ts +176 -0
- package/src/apis/locations/schemas.ts +83 -0
- package/src/apis/locations/types.ts +113 -0
- package/src/apis/networks/index.ts +544 -0
- package/src/apis/networks/schemas.ts +279 -0
- package/src/apis/networks/types.ts +243 -0
- package/src/apis/placement-groups/index.ts +212 -0
- package/src/apis/placement-groups/schemas.ts +90 -0
- package/src/apis/placement-groups/types.ts +99 -0
- package/src/apis/pricing/index.ts +42 -0
- package/src/apis/pricing/schemas.ts +93 -0
- package/src/apis/pricing/types.ts +71 -0
- package/src/apis/primary-ips/index.ts +467 -0
- package/src/apis/primary-ips/schemas.ts +221 -0
- package/src/apis/primary-ips/types.ts +221 -0
- package/src/apis/server-types/index.ts +93 -0
- package/src/apis/server-types/schemas.ts +29 -0
- package/src/apis/server-types/types.ts +43 -0
- package/src/apis/servers/index.ts +378 -0
- package/src/apis/servers/schemas.ts +771 -0
- package/src/apis/servers/types.ts +538 -0
- package/src/apis/ssh-keys/index.ts +204 -0
- package/src/apis/ssh-keys/schemas.ts +84 -0
- package/src/apis/ssh-keys/types.ts +106 -0
- package/src/apis/volumes/index.ts +452 -0
- package/src/apis/volumes/schemas.ts +195 -0
- package/src/apis/volumes/types.ts +197 -0
- package/src/auth/index.ts +26 -0
- package/src/base/index.ts +10 -0
- package/src/client/index.ts +388 -0
- package/src/config/index.ts +34 -0
- package/src/errors/index.ts +38 -0
- package/src/index.ts +799 -0
- package/src/types/index.ts +37 -0
- package/src/validation/index.ts +109 -0
|
@@ -0,0 +1,771 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for Hetzner Cloud Servers API
|
|
3
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-list-servers
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { actionSchema } from "../../apis/actions/schemas";
|
|
8
|
+
import { paginationMetaSchema } from "../../apis/common/schemas";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Server status schema
|
|
12
|
+
*/
|
|
13
|
+
export const serverStatusSchema = z.enum([
|
|
14
|
+
"running",
|
|
15
|
+
"initializing",
|
|
16
|
+
"starting",
|
|
17
|
+
"stopping",
|
|
18
|
+
"off",
|
|
19
|
+
"deleting",
|
|
20
|
+
"migrating",
|
|
21
|
+
"rebuilding",
|
|
22
|
+
"unknown",
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Server type price schema
|
|
27
|
+
*/
|
|
28
|
+
export const serverTypePriceSchema = z.object({
|
|
29
|
+
location: z.string(),
|
|
30
|
+
price_hourly: z.object({
|
|
31
|
+
net: z.string(),
|
|
32
|
+
gross: z.string(),
|
|
33
|
+
}),
|
|
34
|
+
price_monthly: z.object({
|
|
35
|
+
net: z.string(),
|
|
36
|
+
gross: z.string(),
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Server type deprecation schema
|
|
42
|
+
*/
|
|
43
|
+
export const serverTypeDeprecationSchema = z.object({
|
|
44
|
+
announced: z.string(),
|
|
45
|
+
unavailable_after: z.string(),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Server type schema
|
|
50
|
+
*/
|
|
51
|
+
export const serverTypeSchema = z
|
|
52
|
+
.object({
|
|
53
|
+
id: z.number(),
|
|
54
|
+
name: z.string(),
|
|
55
|
+
description: z.string(),
|
|
56
|
+
cores: z.number(),
|
|
57
|
+
memory: z.number(),
|
|
58
|
+
disk: z.number(),
|
|
59
|
+
prices: z.array(serverTypePriceSchema),
|
|
60
|
+
storage_type: z.enum(["local", "network"]),
|
|
61
|
+
cpu_type: z.enum(["shared", "dedicated"]),
|
|
62
|
+
architecture: z.enum(["x86", "arm"]),
|
|
63
|
+
incompatibilities: z.array(z.unknown()).optional(),
|
|
64
|
+
deprecation: serverTypeDeprecationSchema.nullable().optional(),
|
|
65
|
+
})
|
|
66
|
+
.passthrough();
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Server Image created from schema
|
|
70
|
+
*/
|
|
71
|
+
export const serverImageCreatedFromSchema = z.object({
|
|
72
|
+
id: z.number(),
|
|
73
|
+
name: z.string(),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Server Image protection schema
|
|
78
|
+
*/
|
|
79
|
+
export const serverImageProtectionSchema = z.object({
|
|
80
|
+
delete: z.boolean(),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Server Image deprecation schema
|
|
85
|
+
*/
|
|
86
|
+
export const serverImageDeprecationSchema = z.object({
|
|
87
|
+
announced: z.string(),
|
|
88
|
+
unavailable_after: z.string(),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Server Image schema
|
|
93
|
+
*/
|
|
94
|
+
export const serverImageSchema = z
|
|
95
|
+
.object({
|
|
96
|
+
id: z.number(),
|
|
97
|
+
type: z.enum(["system", "app", "snapshot", "backup"]),
|
|
98
|
+
status: z.enum(["available", "creating", "unavailable"]),
|
|
99
|
+
name: z.string(),
|
|
100
|
+
description: z.string(),
|
|
101
|
+
image_size: z.number().nullable(),
|
|
102
|
+
disk_size: z.number(),
|
|
103
|
+
created: z.string(),
|
|
104
|
+
created_from: serverImageCreatedFromSchema.nullable(),
|
|
105
|
+
bound_to: z.number().nullable(),
|
|
106
|
+
os_flavor: z.string(),
|
|
107
|
+
os_version: z.string().nullable(),
|
|
108
|
+
rapid_deploy: z.boolean(),
|
|
109
|
+
protection: serverImageProtectionSchema,
|
|
110
|
+
deprecation: serverImageDeprecationSchema.nullable().optional(),
|
|
111
|
+
labels: z.record(z.string(), z.string()),
|
|
112
|
+
deleted: z.string().nullable(),
|
|
113
|
+
})
|
|
114
|
+
.passthrough();
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Location schema
|
|
118
|
+
*/
|
|
119
|
+
export const locationSchema = z.object({
|
|
120
|
+
id: z.number(),
|
|
121
|
+
name: z.string(),
|
|
122
|
+
description: z.string(),
|
|
123
|
+
country: z.string(),
|
|
124
|
+
city: z.string(),
|
|
125
|
+
latitude: z.number(),
|
|
126
|
+
longitude: z.number(),
|
|
127
|
+
network_zone: z.string(),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Datacenter server types schema
|
|
132
|
+
*/
|
|
133
|
+
export const datacenterServerTypesSchema = z.object({
|
|
134
|
+
supported: z.array(z.number()),
|
|
135
|
+
available: z.array(z.number()),
|
|
136
|
+
available_for_migration: z.array(z.number()),
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Datacenter schema
|
|
141
|
+
*/
|
|
142
|
+
export const datacenterSchema = z.object({
|
|
143
|
+
id: z.number(),
|
|
144
|
+
name: z.string(),
|
|
145
|
+
description: z.string(),
|
|
146
|
+
location: locationSchema,
|
|
147
|
+
server_types: datacenterServerTypesSchema,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Network subnetwork schema
|
|
152
|
+
*/
|
|
153
|
+
export const networkSubnetworkSchema = z.object({
|
|
154
|
+
type: z.string(),
|
|
155
|
+
ip_range: z.string(),
|
|
156
|
+
network_zone: z.string(),
|
|
157
|
+
gateway: z.string(),
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Network route schema
|
|
162
|
+
*/
|
|
163
|
+
export const networkRouteSchema = z.object({
|
|
164
|
+
destination: z.string(),
|
|
165
|
+
gateway: z.string(),
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Network protection schema
|
|
170
|
+
*/
|
|
171
|
+
export const networkProtectionSchema = z.object({
|
|
172
|
+
delete: z.boolean(),
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Network schema
|
|
177
|
+
*/
|
|
178
|
+
export const networkSchema = z.object({
|
|
179
|
+
id: z.number(),
|
|
180
|
+
name: z.string(),
|
|
181
|
+
ip_range: z.string(),
|
|
182
|
+
subnetworks: z.array(networkSubnetworkSchema),
|
|
183
|
+
routes: z.array(networkRouteSchema),
|
|
184
|
+
servers: z.array(z.number()),
|
|
185
|
+
load_balancers: z.array(z.number()),
|
|
186
|
+
protection: networkProtectionSchema,
|
|
187
|
+
labels: z.record(z.string(), z.string()),
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Public Net IPv4 schema
|
|
192
|
+
*/
|
|
193
|
+
export const publicNetIPv4Schema = z.object({
|
|
194
|
+
ip: z.string(),
|
|
195
|
+
blocked: z.boolean(),
|
|
196
|
+
dns_ptr: z.string().nullable(),
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Public Net IPv6 DNS PTR schema
|
|
201
|
+
*/
|
|
202
|
+
export const publicNetIPv6DNSPtrSchema = z.object({
|
|
203
|
+
ip: z.string(),
|
|
204
|
+
dns_ptr: z.string(),
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Public Net IPv6 schema
|
|
209
|
+
*/
|
|
210
|
+
export const publicNetIPv6Schema = z.object({
|
|
211
|
+
ip: z.string(),
|
|
212
|
+
blocked: z.boolean(),
|
|
213
|
+
dns_ptr: z.array(publicNetIPv6DNSPtrSchema).nullable(),
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Public Net firewall schema
|
|
218
|
+
*/
|
|
219
|
+
export const publicNetFirewallSchema = z.object({
|
|
220
|
+
id: z.number(),
|
|
221
|
+
status: z.string(),
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Public Net schema
|
|
226
|
+
*/
|
|
227
|
+
export const publicNetSchema = z.object({
|
|
228
|
+
ipv4: publicNetIPv4Schema.nullable(),
|
|
229
|
+
ipv6: publicNetIPv6Schema.nullable(),
|
|
230
|
+
firewalls: z.array(publicNetFirewallSchema).nullable(),
|
|
231
|
+
floating_ips: z.array(z.number()),
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Private Net schema
|
|
236
|
+
*/
|
|
237
|
+
export const privateNetSchema = z.object({
|
|
238
|
+
network: z.number(),
|
|
239
|
+
ip: z.string(),
|
|
240
|
+
alias_ips: z.array(z.string()),
|
|
241
|
+
mac_address: z.string(),
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* ISO schema
|
|
246
|
+
*/
|
|
247
|
+
export const isoSchema = z.object({
|
|
248
|
+
id: z.number(),
|
|
249
|
+
name: z.string(),
|
|
250
|
+
description: z.string(),
|
|
251
|
+
type: z.enum(["public", "private"]),
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Backup window schema
|
|
256
|
+
*/
|
|
257
|
+
export const backupWindowSchema = z.object({
|
|
258
|
+
start: z.string(),
|
|
259
|
+
end: z.string(),
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Server protection schema
|
|
264
|
+
*/
|
|
265
|
+
export const serverProtectionSchema = z.object({
|
|
266
|
+
delete: z.boolean(),
|
|
267
|
+
rebuild: z.boolean(),
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Server schema
|
|
272
|
+
* Using passthrough to allow additional fields from API that we don't validate
|
|
273
|
+
*/
|
|
274
|
+
export const serverSchema = z
|
|
275
|
+
.object({
|
|
276
|
+
id: z.number(),
|
|
277
|
+
name: z.string(),
|
|
278
|
+
status: serverStatusSchema,
|
|
279
|
+
created: z.string(),
|
|
280
|
+
public_net: publicNetSchema,
|
|
281
|
+
private_net: z.array(privateNetSchema),
|
|
282
|
+
server_type: serverTypeSchema,
|
|
283
|
+
datacenter: datacenterSchema,
|
|
284
|
+
image: serverImageSchema,
|
|
285
|
+
iso: isoSchema.nullable(),
|
|
286
|
+
rescue_enabled: z.boolean(),
|
|
287
|
+
locked: z.boolean(),
|
|
288
|
+
backup_window: backupWindowSchema.nullable(),
|
|
289
|
+
outgoing_traffic: z.number().nullable(),
|
|
290
|
+
ingoing_traffic: z.number().nullable(),
|
|
291
|
+
included_traffic: z.number(),
|
|
292
|
+
primary_disk_size: z.number(),
|
|
293
|
+
protection: serverProtectionSchema,
|
|
294
|
+
labels: z.record(z.string(), z.string()),
|
|
295
|
+
volumes: z.array(z.number()),
|
|
296
|
+
load_balancers: z.array(z.number()),
|
|
297
|
+
enable_backup: z.boolean().optional(),
|
|
298
|
+
enable_ipv4: z.boolean().optional(),
|
|
299
|
+
enable_ipv6: z.boolean().optional(),
|
|
300
|
+
})
|
|
301
|
+
.passthrough();
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* List Servers response schema
|
|
305
|
+
*/
|
|
306
|
+
export const listServersResponseSchema = z.object({
|
|
307
|
+
servers: z.array(serverSchema),
|
|
308
|
+
meta: z
|
|
309
|
+
.object({
|
|
310
|
+
pagination: paginationMetaSchema,
|
|
311
|
+
})
|
|
312
|
+
.optional(),
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Public Net configuration schema for creating servers
|
|
317
|
+
*/
|
|
318
|
+
export const createServerPublicNetSchema = z.object({
|
|
319
|
+
enable_ipv4: z.boolean().optional(),
|
|
320
|
+
enable_ipv6: z.boolean().optional(),
|
|
321
|
+
ipv4: z.number().nullable().optional(),
|
|
322
|
+
ipv6: z.number().nullable().optional(),
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Create Server request schema
|
|
327
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-create-a-server
|
|
328
|
+
*/
|
|
329
|
+
export const createServerRequestSchema = z.object({
|
|
330
|
+
name: z.string().min(1),
|
|
331
|
+
server_type: z.string().min(1),
|
|
332
|
+
image: z.string().min(1),
|
|
333
|
+
location: z.string().optional(),
|
|
334
|
+
datacenter: z.string().optional(), // deprecated, but still supported
|
|
335
|
+
ssh_keys: z.array(z.union([z.string(), z.number()])).optional(),
|
|
336
|
+
volumes: z.array(z.number()).optional(),
|
|
337
|
+
networks: z.array(z.number()).optional(),
|
|
338
|
+
user_data: z.string().optional(),
|
|
339
|
+
labels: z.record(z.string(), z.string()).optional(),
|
|
340
|
+
start_after_create: z.boolean().optional(),
|
|
341
|
+
automount: z.boolean().optional(),
|
|
342
|
+
public_net: createServerPublicNetSchema.optional(),
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Action resource schema
|
|
347
|
+
* Re-exported from actions module for consistency
|
|
348
|
+
* @deprecated Use actionResourceSchema from '../actions/schemas' instead
|
|
349
|
+
*/
|
|
350
|
+
export { actionResourceSchema } from "../../apis/actions/schemas";
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Action schema (common)
|
|
354
|
+
* Re-exported from actions module for consistency
|
|
355
|
+
*/
|
|
356
|
+
export { actionSchema } from "../../apis/actions/schemas";
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Server Action schema (alias for actionSchema)
|
|
360
|
+
* Re-exported from actions module for consistency
|
|
361
|
+
* @deprecated Use actionSchema from '../actions/schemas' instead
|
|
362
|
+
*/
|
|
363
|
+
export { actionSchema as serverActionSchema } from "../../apis/actions/schemas";
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Create Server response schema
|
|
367
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-create-a-server
|
|
368
|
+
*/
|
|
369
|
+
export const createServerResponseSchema = z.object({
|
|
370
|
+
server: serverSchema,
|
|
371
|
+
action: actionSchema,
|
|
372
|
+
next_actions: z.array(actionSchema),
|
|
373
|
+
root_password: z.string().nullable(),
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Get Server response schema
|
|
378
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-get-a-server
|
|
379
|
+
*/
|
|
380
|
+
export const getServerResponseSchema = z.object({
|
|
381
|
+
server: serverSchema,
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Update Server request schema
|
|
386
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-update-a-server
|
|
387
|
+
*/
|
|
388
|
+
export const updateServerRequestSchema = z.object({
|
|
389
|
+
name: z.string().min(1).optional(),
|
|
390
|
+
labels: z.record(z.string(), z.string()).optional(),
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Update Server response schema
|
|
395
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-update-a-server
|
|
396
|
+
*/
|
|
397
|
+
export const updateServerResponseSchema = z.object({
|
|
398
|
+
server: serverSchema,
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Delete Server response schema
|
|
403
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-delete-a-server
|
|
404
|
+
*/
|
|
405
|
+
export const deleteServerResponseSchema = z.object({
|
|
406
|
+
action: actionSchema,
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Server metrics time series value schema
|
|
411
|
+
*/
|
|
412
|
+
export const serverMetricsTimeSeriesValueSchema = z.tuple([z.number(), z.string()]);
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Server metrics time series schema
|
|
416
|
+
*/
|
|
417
|
+
export const serverMetricsTimeSeriesSchema = z.record(
|
|
418
|
+
z.string(),
|
|
419
|
+
z.object({
|
|
420
|
+
values: z.array(serverMetricsTimeSeriesValueSchema),
|
|
421
|
+
}),
|
|
422
|
+
);
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Server metrics schema
|
|
426
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-get-metrics-for-a-server
|
|
427
|
+
*/
|
|
428
|
+
export const serverMetricsSchema = z.object({
|
|
429
|
+
start: z.string(),
|
|
430
|
+
end: z.string(),
|
|
431
|
+
step: z.number(),
|
|
432
|
+
time_series: serverMetricsTimeSeriesSchema,
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Get Server Metrics response schema
|
|
437
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-get-metrics-for-a-server
|
|
438
|
+
*/
|
|
439
|
+
export const getServerMetricsResponseSchema = z.object({
|
|
440
|
+
metrics: serverMetricsSchema,
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* List Server Actions response schema
|
|
446
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-list-actions-for-a-server
|
|
447
|
+
*/
|
|
448
|
+
export const listServerActionsResponseSchema = z.object({
|
|
449
|
+
actions: z.array(actionSchema),
|
|
450
|
+
meta: z
|
|
451
|
+
.object({
|
|
452
|
+
pagination: paginationMetaSchema,
|
|
453
|
+
})
|
|
454
|
+
.optional(),
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Get Server Action response schema
|
|
459
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-get-an-action-for-a-server
|
|
460
|
+
*/
|
|
461
|
+
export const getServerActionResponseSchema = z.object({
|
|
462
|
+
action: actionSchema,
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Power On Server response schema
|
|
467
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-power-on-a-server
|
|
468
|
+
*/
|
|
469
|
+
export const powerOnServerResponseSchema = z.object({
|
|
470
|
+
action: actionSchema,
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Power Off Server response schema
|
|
475
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-power-off-a-server
|
|
476
|
+
*/
|
|
477
|
+
export const powerOffServerResponseSchema = z.object({
|
|
478
|
+
action: actionSchema,
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Reboot Server response schema
|
|
483
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-soft-reboot-a-server
|
|
484
|
+
*/
|
|
485
|
+
export const rebootServerResponseSchema = z.object({
|
|
486
|
+
action: actionSchema,
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Reset Server response schema
|
|
491
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-reset-a-server
|
|
492
|
+
*/
|
|
493
|
+
export const resetServerResponseSchema = z.object({
|
|
494
|
+
action: actionSchema,
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Shutdown Server response schema
|
|
499
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-shutdown-a-server
|
|
500
|
+
*/
|
|
501
|
+
export const shutdownServerResponseSchema = z.object({
|
|
502
|
+
action: actionSchema,
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Attach ISO to Server request schema
|
|
507
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-attach-an-iso-to-a-server
|
|
508
|
+
*/
|
|
509
|
+
export const attachISOToServerRequestSchema = z.object({
|
|
510
|
+
iso: z.union([z.string(), z.number()]),
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Attach ISO to Server response schema
|
|
515
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-attach-an-iso-to-a-server
|
|
516
|
+
*/
|
|
517
|
+
export const attachISOToServerResponseSchema = z.object({
|
|
518
|
+
action: actionSchema,
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Detach ISO from Server response schema
|
|
523
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-detach-an-iso-from-a-server
|
|
524
|
+
*/
|
|
525
|
+
export const detachISOFromServerResponseSchema = z.object({
|
|
526
|
+
action: actionSchema,
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Enable Rescue Mode request schema
|
|
531
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-enable-rescue-mode-for-a-server
|
|
532
|
+
*/
|
|
533
|
+
export const enableRescueModeRequestSchema = z.object({
|
|
534
|
+
type: z.string().optional(),
|
|
535
|
+
ssh_keys: z.array(z.union([z.string(), z.number()])).optional(),
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Enable Rescue Mode response schema
|
|
540
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-enable-rescue-mode-for-a-server
|
|
541
|
+
*/
|
|
542
|
+
export const enableRescueModeResponseSchema = z.object({
|
|
543
|
+
action: actionSchema,
|
|
544
|
+
root_password: z.string().nullable().optional(),
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Disable Rescue Mode response schema
|
|
549
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-disable-rescue-mode-for-a-server
|
|
550
|
+
*/
|
|
551
|
+
export const disableRescueModeResponseSchema = z.object({
|
|
552
|
+
action: actionSchema,
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Create Image from Server request schema
|
|
557
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-create-image-from-a-server
|
|
558
|
+
*/
|
|
559
|
+
export const createImageFromServerRequestSchema = z.object({
|
|
560
|
+
type: z.enum(["snapshot", "backup"]).optional(),
|
|
561
|
+
description: z.string().optional(),
|
|
562
|
+
labels: z.record(z.string(), z.string()).optional(),
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Create Image from Server response schema
|
|
567
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-create-image-from-a-server
|
|
568
|
+
*/
|
|
569
|
+
export const createImageFromServerResponseSchema = z.object({
|
|
570
|
+
action: actionSchema,
|
|
571
|
+
image: serverImageSchema,
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Rebuild Server from Image request schema
|
|
576
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-rebuild-a-server-from-an-image
|
|
577
|
+
*/
|
|
578
|
+
export const rebuildServerFromImageRequestSchema = z.object({
|
|
579
|
+
image: z.union([z.string(), z.number()]),
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Rebuild Server from Image response schema
|
|
584
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-rebuild-a-server-from-an-image
|
|
585
|
+
*/
|
|
586
|
+
export const rebuildServerFromImageResponseSchema = z.object({
|
|
587
|
+
action: actionSchema,
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Change Server Protection request schema
|
|
592
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-change-server-protection
|
|
593
|
+
*/
|
|
594
|
+
export const changeServerProtectionRequestSchema = z.object({
|
|
595
|
+
delete: z.boolean().optional(),
|
|
596
|
+
rebuild: z.boolean().optional(),
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Change Server Protection response schema
|
|
601
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-change-server-protection
|
|
602
|
+
*/
|
|
603
|
+
export const changeServerProtectionResponseSchema = z.object({
|
|
604
|
+
action: actionSchema,
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Change Server Type request schema
|
|
609
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-change-the-type-of-a-server
|
|
610
|
+
*/
|
|
611
|
+
export const changeServerTypeRequestSchema = z.object({
|
|
612
|
+
server_type: z.union([z.string(), z.number()]),
|
|
613
|
+
upgrade_disk: z.boolean().optional(),
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Change Server Type response schema
|
|
618
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-change-the-type-of-a-server
|
|
619
|
+
*/
|
|
620
|
+
export const changeServerTypeResponseSchema = z.object({
|
|
621
|
+
action: actionSchema,
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Enable Backups request schema
|
|
626
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-enable-and-configure-backups-for-a-server
|
|
627
|
+
*/
|
|
628
|
+
export const enableBackupsRequestSchema = z.object({
|
|
629
|
+
backup_window: z.string().optional(),
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Enable Backups response schema
|
|
634
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-enable-and-configure-backups-for-a-server
|
|
635
|
+
*/
|
|
636
|
+
export const enableBackupsResponseSchema = z.object({
|
|
637
|
+
action: actionSchema,
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Disable Backups response schema
|
|
642
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-disable-backups-for-a-server
|
|
643
|
+
*/
|
|
644
|
+
export const disableBackupsResponseSchema = z.object({
|
|
645
|
+
action: actionSchema,
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Attach Server to Network request schema
|
|
650
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-attach-a-server-to-a-network
|
|
651
|
+
*/
|
|
652
|
+
export const attachServerToNetworkRequestSchema = z.object({
|
|
653
|
+
network: z.number(),
|
|
654
|
+
ip: z.string().optional(),
|
|
655
|
+
alias_ips: z.array(z.string()).optional(),
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Attach Server to Network response schema
|
|
660
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-attach-a-server-to-a-network
|
|
661
|
+
*/
|
|
662
|
+
export const attachServerToNetworkResponseSchema = z.object({
|
|
663
|
+
action: actionSchema,
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Detach Server from Network request schema
|
|
668
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-detach-a-server-from-a-network
|
|
669
|
+
*/
|
|
670
|
+
export const detachServerFromNetworkRequestSchema = z.object({
|
|
671
|
+
network: z.number(),
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Detach Server from Network response schema
|
|
676
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-detach-a-server-from-a-network
|
|
677
|
+
*/
|
|
678
|
+
export const detachServerFromNetworkResponseSchema = z.object({
|
|
679
|
+
action: actionSchema,
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Change alias IPs of Network request schema
|
|
684
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-change-alias-ips-of-a-network
|
|
685
|
+
*/
|
|
686
|
+
export const changeAliasIPsOfNetworkRequestSchema = z.object({
|
|
687
|
+
network: z.number(),
|
|
688
|
+
alias_ips: z.array(z.string()),
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Change alias IPs of Network response schema
|
|
693
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-change-alias-ips-of-a-network
|
|
694
|
+
*/
|
|
695
|
+
export const changeAliasIPsOfNetworkResponseSchema = z.object({
|
|
696
|
+
action: actionSchema,
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Change reverse DNS entry for Server request schema
|
|
701
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-change-reverse-dns-entry-for-this-server
|
|
702
|
+
*/
|
|
703
|
+
export const changeServerReverseDNSRequestSchema = z.object({
|
|
704
|
+
ip: z.string(),
|
|
705
|
+
dns_ptr: z.string().nullable(),
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Change reverse DNS entry for Server response schema
|
|
710
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-change-reverse-dns-entry-for-this-server
|
|
711
|
+
*/
|
|
712
|
+
export const changeServerReverseDNSResponseSchema = z.object({
|
|
713
|
+
action: actionSchema,
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Request Console for Server request schema
|
|
718
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-request-console-for-a-server
|
|
719
|
+
*/
|
|
720
|
+
export const requestConsoleForServerRequestSchema = z.object({
|
|
721
|
+
type: z.enum(["vnc", "spice"]).optional(),
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Request Console for Server response schema
|
|
726
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-request-console-for-a-server
|
|
727
|
+
*/
|
|
728
|
+
export const requestConsoleForServerResponseSchema = z.object({
|
|
729
|
+
action: actionSchema,
|
|
730
|
+
password: z.string(),
|
|
731
|
+
wss_url: z.string(),
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Reset root Password response schema
|
|
736
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-reset-root-password-of-a-server
|
|
737
|
+
*/
|
|
738
|
+
export const resetRootPasswordResponseSchema = z.object({
|
|
739
|
+
action: actionSchema,
|
|
740
|
+
root_password: z.string().nullable().optional(),
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Add Server to Placement Group request schema
|
|
745
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-add-a-server-to-a-placement-group
|
|
746
|
+
*/
|
|
747
|
+
export const addServerToPlacementGroupRequestSchema = z.object({
|
|
748
|
+
placement_group: z.number(),
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Add Server to Placement Group response schema
|
|
753
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-add-a-server-to-a-placement-group
|
|
754
|
+
*/
|
|
755
|
+
export const addServerToPlacementGroupResponseSchema = z.object({
|
|
756
|
+
action: actionSchema,
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Remove Server from Placement Group request schema
|
|
761
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-remove-from-placement-group
|
|
762
|
+
*/
|
|
763
|
+
export const removeServerFromPlacementGroupRequestSchema = z.object({});
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Remove Server from Placement Group response schema
|
|
767
|
+
* @see https://docs.hetzner.cloud/reference/cloud#servers-remove-from-placement-group
|
|
768
|
+
*/
|
|
769
|
+
export const removeServerFromPlacementGroupResponseSchema = z.object({
|
|
770
|
+
action: actionSchema,
|
|
771
|
+
});
|