@rollupdate/hctl 0.0.0-stage → 3.1.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.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1071 -2
  3. package/dist/auction/cache.d.ts +6 -0
  4. package/dist/auction/cache.js +55 -0
  5. package/dist/auction/client.d.ts +24 -0
  6. package/dist/auction/client.js +236 -0
  7. package/dist/auction/commands.d.ts +2 -0
  8. package/dist/auction/commands.js +440 -0
  9. package/dist/auction/diff-formatter.d.ts +3 -0
  10. package/dist/auction/diff-formatter.js +61 -0
  11. package/dist/auction/diff.d.ts +11 -0
  12. package/dist/auction/diff.js +28 -0
  13. package/dist/auction/formatter.d.ts +21 -0
  14. package/dist/auction/formatter.js +182 -0
  15. package/dist/auction/store.d.ts +24 -0
  16. package/dist/auction/store.js +177 -0
  17. package/dist/auction/types.d.ts +74 -0
  18. package/dist/auction/types.js +5 -0
  19. package/dist/cli.d.ts +2 -0
  20. package/dist/cli.js +74 -0
  21. package/dist/client.d.ts +2 -0
  22. package/dist/client.js +4 -0
  23. package/dist/cloud/browser-bootstrap.d.ts +28 -0
  24. package/dist/cloud/browser-bootstrap.js +480 -0
  25. package/dist/cloud/client.d.ts +520 -0
  26. package/dist/cloud/client.js +755 -0
  27. package/dist/cloud/commands/certificate.d.ts +2 -0
  28. package/dist/cloud/commands/certificate.js +108 -0
  29. package/dist/cloud/commands/context.d.ts +2 -0
  30. package/dist/cloud/commands/context.js +133 -0
  31. package/dist/cloud/commands/datacenter.d.ts +2 -0
  32. package/dist/cloud/commands/datacenter.js +24 -0
  33. package/dist/cloud/commands/firewall.d.ts +2 -0
  34. package/dist/cloud/commands/firewall.js +142 -0
  35. package/dist/cloud/commands/floating-ip.d.ts +2 -0
  36. package/dist/cloud/commands/floating-ip.js +138 -0
  37. package/dist/cloud/commands/image.d.ts +2 -0
  38. package/dist/cloud/commands/image.js +98 -0
  39. package/dist/cloud/commands/index.d.ts +2 -0
  40. package/dist/cloud/commands/index.js +47 -0
  41. package/dist/cloud/commands/inventory.d.ts +2 -0
  42. package/dist/cloud/commands/inventory.js +13 -0
  43. package/dist/cloud/commands/iso.d.ts +2 -0
  44. package/dist/cloud/commands/iso.js +27 -0
  45. package/dist/cloud/commands/load-balancer-type.d.ts +2 -0
  46. package/dist/cloud/commands/load-balancer-type.js +24 -0
  47. package/dist/cloud/commands/load-balancer.d.ts +2 -0
  48. package/dist/cloud/commands/load-balancer.js +269 -0
  49. package/dist/cloud/commands/location.d.ts +2 -0
  50. package/dist/cloud/commands/location.js +24 -0
  51. package/dist/cloud/commands/network.d.ts +2 -0
  52. package/dist/cloud/commands/network.js +157 -0
  53. package/dist/cloud/commands/placement-group.d.ts +2 -0
  54. package/dist/cloud/commands/placement-group.js +79 -0
  55. package/dist/cloud/commands/pricing.d.ts +2 -0
  56. package/dist/cloud/commands/pricing.js +15 -0
  57. package/dist/cloud/commands/primary-ip.d.ts +2 -0
  58. package/dist/cloud/commands/primary-ip.js +139 -0
  59. package/dist/cloud/commands/server-type.d.ts +2 -0
  60. package/dist/cloud/commands/server-type.js +24 -0
  61. package/dist/cloud/commands/server.d.ts +2 -0
  62. package/dist/cloud/commands/server.js +346 -0
  63. package/dist/cloud/commands/ssh-key.d.ts +2 -0
  64. package/dist/cloud/commands/ssh-key.js +94 -0
  65. package/dist/cloud/commands/volume.d.ts +2 -0
  66. package/dist/cloud/commands/volume.js +138 -0
  67. package/dist/cloud/context.d.ts +34 -0
  68. package/dist/cloud/context.js +215 -0
  69. package/dist/cloud/formatter.d.ts +40 -0
  70. package/dist/cloud/formatter.js +824 -0
  71. package/dist/cloud/helpers.d.ts +27 -0
  72. package/dist/cloud/helpers.js +67 -0
  73. package/dist/cloud/inventory.d.ts +100 -0
  74. package/dist/cloud/inventory.js +229 -0
  75. package/dist/cloud/pricing.d.ts +27 -0
  76. package/dist/cloud/pricing.js +103 -0
  77. package/dist/cloud/token-instructions.d.ts +2 -0
  78. package/dist/cloud/token-instructions.js +21 -0
  79. package/dist/cloud/types.d.ts +437 -0
  80. package/dist/cloud/types.js +5 -0
  81. package/dist/config.d.ts +1 -0
  82. package/dist/config.js +2 -0
  83. package/dist/formatter.d.ts +3 -0
  84. package/dist/formatter.js +6 -0
  85. package/dist/index.d.ts +12 -0
  86. package/dist/index.js +21 -0
  87. package/dist/robot/client.d.ts +256 -0
  88. package/dist/robot/client.js +745 -0
  89. package/dist/robot/commands/auth.d.ts +2 -0
  90. package/dist/robot/commands/auth.js +54 -0
  91. package/dist/robot/commands/boot.d.ts +2 -0
  92. package/dist/robot/commands/boot.js +76 -0
  93. package/dist/robot/commands/cancel.d.ts +2 -0
  94. package/dist/robot/commands/cancel.js +37 -0
  95. package/dist/robot/commands/failover.d.ts +2 -0
  96. package/dist/robot/commands/failover.js +46 -0
  97. package/dist/robot/commands/firewall.d.ts +2 -0
  98. package/dist/robot/commands/firewall.js +72 -0
  99. package/dist/robot/commands/index.d.ts +2 -0
  100. package/dist/robot/commands/index.js +36 -0
  101. package/dist/robot/commands/interactive.d.ts +2 -0
  102. package/dist/robot/commands/interactive.js +152 -0
  103. package/dist/robot/commands/ip.d.ts +2 -0
  104. package/dist/robot/commands/ip.js +55 -0
  105. package/dist/robot/commands/key.d.ts +2 -0
  106. package/dist/robot/commands/key.js +68 -0
  107. package/dist/robot/commands/order.d.ts +2 -0
  108. package/dist/robot/commands/order.js +33 -0
  109. package/dist/robot/commands/rdns.d.ts +2 -0
  110. package/dist/robot/commands/rdns.js +41 -0
  111. package/dist/robot/commands/reset.d.ts +2 -0
  112. package/dist/robot/commands/reset.js +77 -0
  113. package/dist/robot/commands/server.d.ts +2 -0
  114. package/dist/robot/commands/server.js +32 -0
  115. package/dist/robot/commands/storagebox.d.ts +2 -0
  116. package/dist/robot/commands/storagebox.js +126 -0
  117. package/dist/robot/commands/subnet.d.ts +2 -0
  118. package/dist/robot/commands/subnet.js +24 -0
  119. package/dist/robot/commands/traffic.d.ts +2 -0
  120. package/dist/robot/commands/traffic.js +23 -0
  121. package/dist/robot/commands/vswitch.d.ts +2 -0
  122. package/dist/robot/commands/vswitch.js +81 -0
  123. package/dist/robot/commands/wol.d.ts +2 -0
  124. package/dist/robot/commands/wol.js +20 -0
  125. package/dist/robot/formatter.d.ts +57 -0
  126. package/dist/robot/formatter.js +582 -0
  127. package/dist/robot/types.d.ts +359 -0
  128. package/dist/robot/types.js +5 -0
  129. package/dist/shared/config.d.ts +86 -0
  130. package/dist/shared/config.js +289 -0
  131. package/dist/shared/formatter.d.ts +29 -0
  132. package/dist/shared/formatter.js +121 -0
  133. package/dist/shared/helpers.d.ts +39 -0
  134. package/dist/shared/helpers.js +86 -0
  135. package/dist/shared/init.d.ts +2 -0
  136. package/dist/shared/init.js +107 -0
  137. package/dist/shared/reference.d.ts +5 -0
  138. package/dist/shared/reference.js +689 -0
  139. package/dist/shared/schemas.d.ts +1 -0
  140. package/dist/shared/schemas.js +1031 -0
  141. package/dist/types.d.ts +2 -0
  142. package/dist/types.js +2 -0
  143. package/package.json +127 -4
@@ -0,0 +1,1031 @@
1
+ // ============================================================================
2
+ // Output Schema Registry
3
+ // Maps command paths → self-contained TypeScript type definitions describing
4
+ // the JSON output shape. Used by --output-schema to print type info without
5
+ // making any API calls.
6
+ // ============================================================================
7
+ // ---------------------------------------------------------------------------
8
+ // Robot API shared type blocks
9
+ // ---------------------------------------------------------------------------
10
+ const ROBOT_SERVER_SUBNET = `\
11
+ interface ServerSubnet {
12
+ ip: string;
13
+ mask: string;
14
+ }`;
15
+ const ROBOT_SERVER = `\
16
+ ${ROBOT_SERVER_SUBNET}
17
+
18
+ interface Server {
19
+ server_ip: string;
20
+ server_ipv6_net: string;
21
+ server_number: number;
22
+ server_name: string;
23
+ product: string;
24
+ dc: string;
25
+ traffic: string;
26
+ status: 'ready' | 'installing' | 'maintenance';
27
+ cancelled: boolean;
28
+ paid_until: string;
29
+ ip: string[];
30
+ subnet: ServerSubnet[];
31
+ }`;
32
+ const ROBOT_SERVER_DETAILS = `\
33
+ ${ROBOT_SERVER}
34
+
35
+ interface ServerDetails extends Server {
36
+ reset: boolean;
37
+ rescue: boolean;
38
+ vnc: boolean;
39
+ windows: boolean;
40
+ plesk: boolean;
41
+ cpanel: boolean;
42
+ wol: boolean;
43
+ hot_swap: boolean;
44
+ }`;
45
+ const ROBOT_RESET = `\
46
+ interface Reset {
47
+ server_ip: string;
48
+ server_ipv6_net: string;
49
+ server_number: number;
50
+ type: ('sw' | 'hw' | 'man' | 'power' | 'power_long')[];
51
+ operating_status: string;
52
+ }`;
53
+ const ROBOT_BOOT_CONFIG = `\
54
+ interface BaseBootConfig {
55
+ server_ip: string;
56
+ server_ipv6_net: string;
57
+ server_number: number;
58
+ active: boolean;
59
+ password: string | null;
60
+ }
61
+
62
+ interface RescueConfig extends BaseBootConfig {
63
+ os: string[];
64
+ arch: number[];
65
+ authorized_key: string[];
66
+ host_key: string[];
67
+ }
68
+
69
+ interface LinuxConfig extends BaseBootConfig {
70
+ dist: string[];
71
+ arch: number[];
72
+ lang: string[];
73
+ authorized_key: string[];
74
+ host_key: string[];
75
+ }
76
+
77
+ interface VncConfig extends BaseBootConfig {
78
+ dist: string[];
79
+ arch: number[];
80
+ lang: string[];
81
+ }
82
+
83
+ interface WindowsConfig extends BaseBootConfig {
84
+ dist: string[];
85
+ lang: string[];
86
+ }
87
+
88
+ interface PleskConfig extends BaseBootConfig {
89
+ dist: string[];
90
+ arch: number[];
91
+ lang: string[];
92
+ hostname: string | null;
93
+ }
94
+
95
+ interface CpanelConfig extends BaseBootConfig {
96
+ dist: string[];
97
+ arch: number[];
98
+ lang: string[];
99
+ hostname: string | null;
100
+ }
101
+
102
+ interface BootConfig {
103
+ rescue: RescueConfig | null;
104
+ linux: LinuxConfig | null;
105
+ vnc: VncConfig | null;
106
+ windows: WindowsConfig | null;
107
+ plesk: PleskConfig | null;
108
+ cpanel: CpanelConfig | null;
109
+ }`;
110
+ const ROBOT_RESCUE_CONFIG = `\
111
+ interface BaseBootConfig {
112
+ server_ip: string;
113
+ server_ipv6_net: string;
114
+ server_number: number;
115
+ active: boolean;
116
+ password: string | null;
117
+ }
118
+
119
+ interface RescueConfig extends BaseBootConfig {
120
+ os: string[];
121
+ arch: number[];
122
+ authorized_key: string[];
123
+ host_key: string[];
124
+ }`;
125
+ const ROBOT_LINUX_CONFIG = `\
126
+ interface BaseBootConfig {
127
+ server_ip: string;
128
+ server_ipv6_net: string;
129
+ server_number: number;
130
+ active: boolean;
131
+ password: string | null;
132
+ }
133
+
134
+ interface LinuxConfig extends BaseBootConfig {
135
+ dist: string[];
136
+ arch: number[];
137
+ lang: string[];
138
+ authorized_key: string[];
139
+ host_key: string[];
140
+ }`;
141
+ const ROBOT_IP = `\
142
+ interface IP {
143
+ ip: string;
144
+ server_ip: string;
145
+ server_number: number;
146
+ locked: boolean;
147
+ separate_mac: string | null;
148
+ traffic_warnings: boolean;
149
+ traffic_hourly: number;
150
+ traffic_daily: number;
151
+ traffic_monthly: number;
152
+ }`;
153
+ const ROBOT_MAC = `\
154
+ interface Mac {
155
+ ip: string;
156
+ mac: string;
157
+ }`;
158
+ const ROBOT_SUBNET = `\
159
+ interface Subnet {
160
+ ip: string;
161
+ mask: string;
162
+ gateway: string;
163
+ server_ip: string;
164
+ server_number: number;
165
+ failover: boolean;
166
+ locked: boolean;
167
+ traffic_warnings: boolean;
168
+ traffic_hourly: number;
169
+ traffic_daily: number;
170
+ traffic_monthly: number;
171
+ }`;
172
+ const ROBOT_FAILOVER = `\
173
+ interface Failover {
174
+ ip: string;
175
+ netmask: string;
176
+ server_ip: string;
177
+ server_number: number;
178
+ active_server_ip: string;
179
+ }`;
180
+ const ROBOT_RDNS = `\
181
+ interface Rdns {
182
+ ip: string;
183
+ ptr: string;
184
+ }`;
185
+ const ROBOT_SSH_KEY = `\
186
+ interface SshKey {
187
+ name: string;
188
+ fingerprint: string;
189
+ type: string;
190
+ size: number;
191
+ data: string;
192
+ }`;
193
+ const ROBOT_FIREWALL_RULE = `\
194
+ interface FirewallRule {
195
+ ip_version: string;
196
+ name: string;
197
+ dst_ip: string | null;
198
+ dst_port: string | null;
199
+ src_ip: string | null;
200
+ src_port: string | null;
201
+ protocol: string | null;
202
+ tcp_flags: string | null;
203
+ action: 'accept' | 'discard';
204
+ }`;
205
+ const ROBOT_FIREWALL = `\
206
+ ${ROBOT_FIREWALL_RULE}
207
+
208
+ interface Firewall {
209
+ server_ip: string;
210
+ server_number: number;
211
+ status: 'active' | 'disabled' | 'in process';
212
+ filter_ipv6: boolean;
213
+ whitelist_hos: boolean;
214
+ port: 'main' | 'kvm';
215
+ rules: {
216
+ input: FirewallRule[];
217
+ output?: FirewallRule[];
218
+ };
219
+ }`;
220
+ const ROBOT_FIREWALL_TEMPLATE = `\
221
+ ${ROBOT_FIREWALL_RULE}
222
+
223
+ interface FirewallTemplate {
224
+ id: number;
225
+ name: string;
226
+ filter_ipv6: boolean;
227
+ whitelist_hos: boolean;
228
+ is_default: boolean;
229
+ rules: {
230
+ input: FirewallRule[];
231
+ output?: FirewallRule[];
232
+ };
233
+ }`;
234
+ const ROBOT_VSWITCH = `\
235
+ interface VSwitchServer {
236
+ server_ip: string;
237
+ server_ipv6_net: string;
238
+ server_number: number;
239
+ status: 'ready' | 'in process' | 'failed';
240
+ }
241
+
242
+ interface VSwitchSubnet {
243
+ ip: string;
244
+ mask: number;
245
+ gateway: string;
246
+ }
247
+
248
+ interface VSwitchCloudNetwork {
249
+ id: number;
250
+ ip: string;
251
+ mask: number;
252
+ gateway: string;
253
+ }
254
+
255
+ interface VSwitch {
256
+ id: number;
257
+ name: string;
258
+ vlan: number;
259
+ cancelled: boolean;
260
+ server: VSwitchServer[];
261
+ subnet: VSwitchSubnet[];
262
+ cloud_network: VSwitchCloudNetwork[];
263
+ }
264
+
265
+ type VSwitchSummary = Pick<VSwitch, 'id' | 'name' | 'vlan' | 'cancelled'>;
266
+
267
+ interface NamedVSwitchServer extends VSwitchServer {
268
+ server_name: string | null;
269
+ }
270
+
271
+ type VSwitchWithServerNames = Omit<VSwitch, 'server'> & {
272
+ server: NamedVSwitchServer[];
273
+ };`;
274
+ const ROBOT_STORAGEBOX = `\
275
+ interface StorageBox {
276
+ id: number;
277
+ login: string;
278
+ name: string;
279
+ product: string;
280
+ cancelled: boolean;
281
+ locked: boolean;
282
+ location: string;
283
+ linked_server: number | null;
284
+ paid_until: string;
285
+ disk_quota: number;
286
+ disk_usage: number;
287
+ disk_usage_data: number;
288
+ disk_usage_snapshots: number;
289
+ webdav: boolean;
290
+ samba: boolean;
291
+ ssh: boolean;
292
+ external_reachability: boolean;
293
+ zfs: boolean;
294
+ server: string;
295
+ host_system: string;
296
+ }`;
297
+ const ROBOT_STORAGEBOX_SNAPSHOT = `\
298
+ interface StorageBoxSnapshot {
299
+ name: string;
300
+ timestamp: string;
301
+ size: number;
302
+ size_formatted: string;
303
+ }`;
304
+ const ROBOT_STORAGEBOX_SUBACCOUNT = `\
305
+ interface StorageBoxSubaccount {
306
+ username: string;
307
+ accountid: string;
308
+ server: string;
309
+ homedirectory: string;
310
+ samba: boolean;
311
+ ssh: boolean;
312
+ external_reachability: boolean;
313
+ webdav: boolean;
314
+ readonly: boolean;
315
+ createtime: string;
316
+ comment: string;
317
+ }`;
318
+ const ROBOT_TRAFFIC = `\
319
+ interface TrafficData {
320
+ in: number;
321
+ out: number;
322
+ sum: number;
323
+ date?: string;
324
+ }
325
+
326
+ interface Traffic {
327
+ ip: string;
328
+ type: 'day' | 'month' | 'year';
329
+ from: string;
330
+ to: string;
331
+ data: TrafficData[];
332
+ }`;
333
+ const ROBOT_WOL = `\
334
+ interface Wol {
335
+ server_ip: string;
336
+ server_ipv6_net: string;
337
+ server_number: number;
338
+ }`;
339
+ const ROBOT_CANCELLATION = `\
340
+ interface Cancellation {
341
+ server_ip: string;
342
+ server_ipv6_net: string;
343
+ server_number: number;
344
+ server_name: string;
345
+ earliest_cancellation_date: string;
346
+ cancelled: boolean;
347
+ cancellation_date: string | null;
348
+ cancellation_reason: string[] | null;
349
+ }`;
350
+ const ROBOT_PRODUCT_PRICE = `\
351
+ interface ProductPrice {
352
+ location: string;
353
+ price: { net: string; gross: string };
354
+ price_setup: { net: string; gross: string };
355
+ price_vat: { net: string; gross: string };
356
+ price_setup_vat: { net: string; gross: string };
357
+ }`;
358
+ const ROBOT_SERVER_PRODUCT = `\
359
+ ${ROBOT_PRODUCT_PRICE}
360
+
361
+ interface ServerProduct {
362
+ id: string;
363
+ name: string;
364
+ description: string[];
365
+ traffic: string;
366
+ dist: string[];
367
+ arch: number[];
368
+ lang: string[];
369
+ location: string[];
370
+ prices: ProductPrice[];
371
+ orderable_addons: string[];
372
+ }`;
373
+ const ROBOT_SERVER_MARKET_PRODUCT = `\
374
+ interface ServerMarketProduct {
375
+ id: number;
376
+ name: string;
377
+ description: string[];
378
+ traffic: string;
379
+ dist: string[];
380
+ arch: number[];
381
+ lang: string[];
382
+ cpu: string;
383
+ cpu_benchmark: number;
384
+ memory_size: number;
385
+ hdd_size: number;
386
+ hdd_text: string;
387
+ hdd_count: number;
388
+ datacenter: string;
389
+ network_speed: string;
390
+ price: string;
391
+ price_setup: string;
392
+ fixed_price: boolean;
393
+ next_reduce: number;
394
+ next_reduce_date: string;
395
+ orderable_addons: string[];
396
+ }`;
397
+ const ROBOT_SERVER_TRANSACTION = `\
398
+ interface ServerTransactionProduct {
399
+ id: string;
400
+ name: string;
401
+ description: string[];
402
+ traffic: string;
403
+ dist: string;
404
+ arch: number;
405
+ lang: string;
406
+ location: string;
407
+ }
408
+
409
+ interface ServerTransaction {
410
+ id: string;
411
+ date: string;
412
+ status: 'ready' | 'in process' | 'cancelled';
413
+ server_number: number | null;
414
+ server_ip: string | null;
415
+ authorized_key: string[];
416
+ host_key: string[];
417
+ comment: string;
418
+ product: ServerTransactionProduct;
419
+ }`;
420
+ // ---------------------------------------------------------------------------
421
+ // Cloud API shared type blocks
422
+ // ---------------------------------------------------------------------------
423
+ const CLOUD_LOCATION = `\
424
+ interface Location {
425
+ id: number;
426
+ name: string;
427
+ description: string;
428
+ country: string;
429
+ city: string;
430
+ latitude: number;
431
+ longitude: number;
432
+ network_zone: string;
433
+ }`;
434
+ const CLOUD_SERVER_TYPE_PRICE = `\
435
+ interface ServerTypePrice {
436
+ location: string;
437
+ price_hourly: { net: string; gross: string };
438
+ price_monthly: { net: string; gross: string };
439
+ included_traffic: number;
440
+ }`;
441
+ const CLOUD_DATACENTER = `\
442
+ ${CLOUD_LOCATION}
443
+
444
+ interface Datacenter {
445
+ id: number;
446
+ name: string;
447
+ description: string;
448
+ location: Location;
449
+ server_types: {
450
+ supported: number[];
451
+ available: number[];
452
+ available_for_migration: number[];
453
+ };
454
+ }`;
455
+ const CLOUD_SERVER_TYPE = `\
456
+ ${CLOUD_SERVER_TYPE_PRICE}
457
+
458
+ interface ServerType {
459
+ id: number;
460
+ name: string;
461
+ description: string;
462
+ cores: number;
463
+ memory: number;
464
+ disk: number;
465
+ storage_type: 'local' | 'network';
466
+ cpu_type: 'shared' | 'dedicated';
467
+ architecture: 'x86' | 'arm';
468
+ deprecated: boolean;
469
+ deprecation?: { announced: string; unavailable_after: string } | null;
470
+ prices: ServerTypePrice[];
471
+ }`;
472
+ const CLOUD_ISO = `\
473
+ interface ISO {
474
+ id: number;
475
+ name: string;
476
+ description: string;
477
+ type: 'public' | 'private';
478
+ deprecation?: { announced: string; unavailable_after: string } | null;
479
+ architecture: 'x86' | 'arm' | null;
480
+ }`;
481
+ const CLOUD_PROTECTION = `\
482
+ type Labels = Record<string, string>;
483
+
484
+ interface Protection {
485
+ delete: boolean;
486
+ rebuild?: boolean;
487
+ }`;
488
+ const CLOUD_IMAGE = `\
489
+ ${CLOUD_PROTECTION}
490
+
491
+ interface Image {
492
+ id: number;
493
+ type: 'system' | 'snapshot' | 'backup' | 'app';
494
+ status: 'available' | 'creating' | 'unavailable';
495
+ name: string | null;
496
+ description: string;
497
+ image_size: number | null;
498
+ disk_size: number;
499
+ created: string;
500
+ created_from: { id: number; name: string } | null;
501
+ bound_to: number | null;
502
+ os_flavor: string;
503
+ os_version: string | null;
504
+ architecture: 'x86' | 'arm';
505
+ rapid_deploy: boolean;
506
+ protection: Protection;
507
+ deprecated: string | null;
508
+ deleted: string | null;
509
+ labels: Labels;
510
+ }`;
511
+ const CLOUD_SSH_KEY = `\
512
+ type Labels = Record<string, string>;
513
+
514
+ interface CloudSshKey {
515
+ id: number;
516
+ name: string;
517
+ fingerprint: string;
518
+ public_key: string;
519
+ labels: Labels;
520
+ created: string;
521
+ }`;
522
+ const CLOUD_SERVER = `\
523
+ ${CLOUD_PROTECTION}
524
+ ${CLOUD_SERVER_TYPE_PRICE}
525
+
526
+ interface ServerType {
527
+ id: number;
528
+ name: string;
529
+ description: string;
530
+ cores: number;
531
+ memory: number;
532
+ disk: number;
533
+ storage_type: 'local' | 'network';
534
+ cpu_type: 'shared' | 'dedicated';
535
+ architecture: 'x86' | 'arm';
536
+ deprecated: boolean;
537
+ deprecation?: { announced: string; unavailable_after: string } | null;
538
+ prices: ServerTypePrice[];
539
+ }
540
+
541
+ ${CLOUD_LOCATION}
542
+
543
+ interface Image {
544
+ id: number;
545
+ type: 'system' | 'snapshot' | 'backup' | 'app';
546
+ status: 'available' | 'creating' | 'unavailable';
547
+ name: string | null;
548
+ description: string;
549
+ image_size: number | null;
550
+ disk_size: number;
551
+ created: string;
552
+ created_from: { id: number; name: string } | null;
553
+ bound_to: number | null;
554
+ os_flavor: string;
555
+ os_version: string | null;
556
+ architecture: 'x86' | 'arm';
557
+ rapid_deploy: boolean;
558
+ protection: Protection;
559
+ deprecated: string | null;
560
+ deleted: string | null;
561
+ labels: Labels;
562
+ }
563
+
564
+ interface ISO {
565
+ id: number;
566
+ name: string;
567
+ description: string;
568
+ type: 'public' | 'private';
569
+ deprecation?: { announced: string; unavailable_after: string } | null;
570
+ architecture: 'x86' | 'arm' | null;
571
+ }
572
+
573
+ interface CloudServer {
574
+ id: number;
575
+ name: string;
576
+ status: 'running' | 'initializing' | 'starting' | 'stopping' | 'off' | 'deleting' | 'migrating' | 'rebuilding' | 'unknown';
577
+ public_net: {
578
+ ipv4: { ip: string; dns_ptr: string; blocked: boolean } | null;
579
+ ipv6: { ip: string; dns_ptr: { ip: string; dns_ptr: string }[]; blocked: boolean } | null;
580
+ floating_ips: number[];
581
+ firewalls: { id: number; status: 'applied' | 'pending' }[];
582
+ };
583
+ private_net: { network: number; ip: string; alias_ips: string[]; mac_address: string }[];
584
+ server_type: ServerType;
585
+ location: Location;
586
+ image: Image | null;
587
+ iso: ISO | null;
588
+ rescue_enabled: boolean;
589
+ locked: boolean;
590
+ backup_window: string | null;
591
+ outgoing_traffic: number | null;
592
+ ingoing_traffic: number | null;
593
+ included_traffic: number;
594
+ protection: Protection;
595
+ labels: Labels;
596
+ volumes: number[];
597
+ load_balancers: number[];
598
+ primary_disk_size: number;
599
+ created: string;
600
+ placement_group?: { id: number; name: string; type: string } | null;
601
+ }`;
602
+ const CLOUD_NETWORK = `\
603
+ ${CLOUD_PROTECTION}
604
+
605
+ interface NetworkSubnet {
606
+ type: 'cloud' | 'server' | 'vswitch';
607
+ ip_range: string;
608
+ network_zone: string;
609
+ gateway: string;
610
+ vswitch_id?: number | null;
611
+ }
612
+
613
+ interface NetworkRoute {
614
+ destination: string;
615
+ gateway: string;
616
+ }
617
+
618
+ interface Network {
619
+ id: number;
620
+ name: string;
621
+ ip_range: string;
622
+ subnets: NetworkSubnet[];
623
+ routes: NetworkRoute[];
624
+ servers: number[];
625
+ load_balancers: number[];
626
+ protection: Protection;
627
+ labels: Labels;
628
+ created: string;
629
+ expose_routes_to_vswitch: boolean;
630
+ }`;
631
+ const CLOUD_FIREWALL = `\
632
+ type Labels = Record<string, string>;
633
+
634
+ interface CloudFirewallRule {
635
+ direction: 'in' | 'out';
636
+ protocol: 'tcp' | 'udp' | 'icmp' | 'esp' | 'gre';
637
+ port: string | null;
638
+ source_ips: string[];
639
+ destination_ips: string[];
640
+ description: string | null;
641
+ }
642
+
643
+ interface CloudFirewallAppliedTo {
644
+ type: 'server' | 'label_selector';
645
+ server?: { id: number };
646
+ label_selector?: { selector: string };
647
+ }
648
+
649
+ interface CloudFirewall {
650
+ id: number;
651
+ name: string;
652
+ labels: Labels;
653
+ rules: CloudFirewallRule[];
654
+ applied_to: CloudFirewallAppliedTo[];
655
+ created: string;
656
+ }`;
657
+ const CLOUD_FLOATING_IP = `\
658
+ type Labels = Record<string, string>;
659
+
660
+ interface Protection {
661
+ delete: boolean;
662
+ }
663
+
664
+ ${CLOUD_LOCATION}
665
+
666
+ interface FloatingIp {
667
+ id: number;
668
+ name: string;
669
+ description: string;
670
+ ip: string;
671
+ type: 'ipv4' | 'ipv6';
672
+ server: number | null;
673
+ dns_ptr: { ip: string; dns_ptr: string }[];
674
+ home_location: Location;
675
+ blocked: boolean;
676
+ protection: Protection;
677
+ labels: Labels;
678
+ created: string;
679
+ }`;
680
+ const CLOUD_PRIMARY_IP = `\
681
+ type Labels = Record<string, string>;
682
+
683
+ interface Protection {
684
+ delete: boolean;
685
+ }
686
+
687
+ ${CLOUD_LOCATION}
688
+
689
+ interface PrimaryIp {
690
+ id: number;
691
+ name: string;
692
+ ip: string;
693
+ type: 'ipv4' | 'ipv6';
694
+ assignee_id: number | null;
695
+ assignee_type: 'server';
696
+ auto_delete: boolean;
697
+ blocked: boolean;
698
+ location: Location;
699
+ dns_ptr: { ip: string; dns_ptr: string }[];
700
+ labels: Labels;
701
+ protection: Protection;
702
+ created: string;
703
+ }`;
704
+ const CLOUD_VOLUME = `\
705
+ type Labels = Record<string, string>;
706
+
707
+ interface Protection {
708
+ delete: boolean;
709
+ }
710
+
711
+ ${CLOUD_LOCATION}
712
+
713
+ interface Volume {
714
+ id: number;
715
+ name: string;
716
+ server: number | null;
717
+ status: 'creating' | 'available' | 'attached';
718
+ location: Location;
719
+ size: number;
720
+ linux_device: string | null;
721
+ protection: Protection;
722
+ labels: Labels;
723
+ created: string;
724
+ format: string | null;
725
+ }`;
726
+ const CLOUD_LOAD_BALANCER_TYPE = `\
727
+ ${CLOUD_SERVER_TYPE_PRICE}
728
+
729
+ interface LoadBalancerType {
730
+ id: number;
731
+ name: string;
732
+ description: string;
733
+ max_connections: number;
734
+ max_services: number;
735
+ max_targets: number;
736
+ max_assigned_certificates: number;
737
+ deprecated: string | null;
738
+ prices: ServerTypePrice[];
739
+ }`;
740
+ const CLOUD_LOAD_BALANCER = `\
741
+ type Labels = Record<string, string>;
742
+
743
+ interface Protection {
744
+ delete: boolean;
745
+ }
746
+
747
+ ${CLOUD_LOCATION}
748
+ ${CLOUD_SERVER_TYPE_PRICE}
749
+
750
+ interface LoadBalancerType {
751
+ id: number;
752
+ name: string;
753
+ description: string;
754
+ max_connections: number;
755
+ max_services: number;
756
+ max_targets: number;
757
+ max_assigned_certificates: number;
758
+ deprecated: string | null;
759
+ prices: ServerTypePrice[];
760
+ }
761
+
762
+ interface LoadBalancerTarget {
763
+ type: 'server' | 'label_selector' | 'ip';
764
+ server?: { id: number };
765
+ label_selector?: { selector: string };
766
+ ip?: { ip: string };
767
+ health_status: { listen_port: number; status: 'healthy' | 'unhealthy' | 'unknown' }[];
768
+ use_private_ip: boolean;
769
+ }
770
+
771
+ interface LoadBalancerService {
772
+ protocol: 'tcp' | 'http' | 'https';
773
+ listen_port: number;
774
+ destination_port: number;
775
+ proxyprotocol: boolean;
776
+ health_check: {
777
+ protocol: 'tcp' | 'http' | 'https';
778
+ port: number;
779
+ interval: number;
780
+ timeout: number;
781
+ retries: number;
782
+ http?: {
783
+ domain: string | null;
784
+ path: string;
785
+ response: string | null;
786
+ status_codes: string[];
787
+ tls: boolean;
788
+ };
789
+ };
790
+ http?: {
791
+ cookie_name: string;
792
+ cookie_lifetime: number;
793
+ certificates: number[];
794
+ redirect_http: boolean;
795
+ sticky_sessions: boolean;
796
+ };
797
+ }
798
+
799
+ interface LoadBalancer {
800
+ id: number;
801
+ name: string;
802
+ public_net: {
803
+ enabled: boolean;
804
+ ipv4: { ip: string; dns_ptr: string };
805
+ ipv6: { ip: string; dns_ptr: string };
806
+ };
807
+ private_net: { network: number; ip: string }[];
808
+ location: Location;
809
+ load_balancer_type: LoadBalancerType;
810
+ protection: Protection;
811
+ labels: Labels;
812
+ targets: LoadBalancerTarget[];
813
+ services: LoadBalancerService[];
814
+ algorithm: { type: 'round_robin' | 'least_connections' };
815
+ outgoing_traffic: number | null;
816
+ ingoing_traffic: number | null;
817
+ included_traffic: number;
818
+ created: string;
819
+ }`;
820
+ const CLOUD_CERTIFICATE = `\
821
+ type Labels = Record<string, string>;
822
+
823
+ interface Certificate {
824
+ id: number;
825
+ name: string;
826
+ labels: Labels;
827
+ type: 'uploaded' | 'managed';
828
+ certificate: string | null;
829
+ created: string;
830
+ not_valid_before: string;
831
+ not_valid_after: string;
832
+ domain_names: string[];
833
+ fingerprint: string | null;
834
+ status: {
835
+ issuance: 'pending' | 'completed' | 'failed';
836
+ renewal: 'scheduled' | 'pending' | 'failed' | 'unavailable';
837
+ error?: { code: string; message: string } | null;
838
+ } | null;
839
+ used_by: { id: number; type: string }[];
840
+ }`;
841
+ const CLOUD_PLACEMENT_GROUP = `\
842
+ type Labels = Record<string, string>;
843
+
844
+ interface PlacementGroup {
845
+ id: number;
846
+ name: string;
847
+ labels: Labels;
848
+ type: 'spread';
849
+ servers: number[];
850
+ created: string;
851
+ }`;
852
+ // ---------------------------------------------------------------------------
853
+ // Auction API shared type blocks
854
+ // ---------------------------------------------------------------------------
855
+ const AUCTION_SERVER = `\
856
+ interface AuctionDiskData {
857
+ nvme: number[];
858
+ sata: number[];
859
+ hdd: number[];
860
+ general: number[];
861
+ }
862
+
863
+ interface AuctionIpPrice {
864
+ Monthly: number;
865
+ Hourly: number;
866
+ Amount: number;
867
+ }
868
+
869
+ interface AuctionServer {
870
+ id: number;
871
+ key: number;
872
+ name: string;
873
+ description: string[];
874
+ information: string[] | null;
875
+ cpu: string;
876
+ cpu_count: number;
877
+ is_highio: boolean;
878
+ is_ecc: boolean;
879
+ traffic: string;
880
+ bandwidth: number;
881
+ ram: string[];
882
+ ram_size: number;
883
+ price: number;
884
+ setup_price: number;
885
+ hourly_price: number;
886
+ hdd_arr: string[];
887
+ hdd_hr: string[];
888
+ hdd_size: number;
889
+ hdd_count: number;
890
+ serverDiskData: AuctionDiskData;
891
+ datacenter: string;
892
+ datacenter_hr: string;
893
+ specials: string[];
894
+ dist: string[];
895
+ fixed_price: boolean;
896
+ next_reduce: number;
897
+ next_reduce_hr: boolean;
898
+ next_reduce_timestamp: number;
899
+ ip_price: AuctionIpPrice;
900
+ category?: string;
901
+ cat_id?: number;
902
+ }`;
903
+ const AUCTION_STATUS = `\
904
+ interface AuctionCacheStatus {
905
+ ageSeconds?: number;
906
+ fetchedAt: string;
907
+ serverCount: number;
908
+ source: string;
909
+ stale: boolean;
910
+ updatedAt?: string;
911
+ url: string;
912
+ }
913
+
914
+ interface AuctionStatus extends AuctionCacheStatus {
915
+ currency: 'EUR' | 'USD';
916
+ endpointUrl: string;
917
+ localCache: AuctionCacheStatus | null;
918
+ usingLocalFallback: boolean;
919
+ }`;
920
+ // ---------------------------------------------------------------------------
921
+ // Schema registry
922
+ // ---------------------------------------------------------------------------
923
+ export const outputSchemas = {
924
+ // ==================== Robot API ====================
925
+ // --- server ---
926
+ "server list": `${ROBOT_SERVER}\n\ntype Output = { server: Server }[];`,
927
+ "server get": `${ROBOT_SERVER_DETAILS}\n\ntype Output = ServerDetails;`,
928
+ // --- reset ---
929
+ "reset options": `${ROBOT_RESET}\n\ntype Output = { reset: Reset }[] | Reset;`,
930
+ // --- boot ---
931
+ "boot status": `${ROBOT_BOOT_CONFIG}\n\ntype Output = BootConfig;`,
932
+ "boot rescue last": `${ROBOT_RESCUE_CONFIG}\n\ntype Output = RescueConfig;`,
933
+ "boot linux options": `${ROBOT_LINUX_CONFIG}\n\ntype Output = LinuxConfig;`,
934
+ // --- ip ---
935
+ "ip list": `${ROBOT_IP}\n\ntype Output = { ip: IP }[];`,
936
+ "ip get": `${ROBOT_IP}\n\ntype Output = IP;`,
937
+ // --- ip mac ---
938
+ "ip mac get": `${ROBOT_MAC}\n\ntype Output = Mac;`,
939
+ // --- subnet ---
940
+ "subnet list": `${ROBOT_SUBNET}\n\ntype Output = { subnet: Subnet }[];`,
941
+ "subnet get": `${ROBOT_SUBNET}\n\ntype Output = { subnet: Subnet }[];`,
942
+ // --- failover ---
943
+ "failover list": `${ROBOT_FAILOVER}\n\ntype Output = { failover: Failover }[];`,
944
+ "failover get": `${ROBOT_FAILOVER}\n\ntype Output = { failover: Failover }[];`,
945
+ // --- rdns ---
946
+ "rdns list": `${ROBOT_RDNS}\n\ntype Output = { rdns: Rdns }[];`,
947
+ "rdns get": `${ROBOT_RDNS}\n\ntype Output = Rdns;`,
948
+ // --- key ---
949
+ "key list": `${ROBOT_SSH_KEY}\n\ntype Output = { key: SshKey }[];`,
950
+ "key get": `${ROBOT_SSH_KEY}\n\ntype Output = SshKey;`,
951
+ // --- firewall ---
952
+ "firewall get": `${ROBOT_FIREWALL}\n\ntype Output = Firewall;`,
953
+ // --- firewall template ---
954
+ "firewall template list": `${ROBOT_FIREWALL_TEMPLATE}\n\ntype Output = { firewall_template: FirewallTemplate }[];`,
955
+ "firewall template get": `${ROBOT_FIREWALL_TEMPLATE}\n\ntype Output = { firewall_template: FirewallTemplate }[];`,
956
+ // --- vswitch ---
957
+ "vswitch list": `${ROBOT_VSWITCH}\n\ntype Output = VSwitchSummary[];`,
958
+ "vswitch get": `${ROBOT_VSWITCH}\n\ntype Output = VSwitch;`,
959
+ "vswitch servers": `${ROBOT_VSWITCH}\n\ntype Output = VSwitchWithServerNames[];`,
960
+ // --- storagebox ---
961
+ "storagebox list": `${ROBOT_STORAGEBOX}\n\ntype Output = { storagebox: StorageBox }[];`,
962
+ "storagebox get": `${ROBOT_STORAGEBOX}\n\ntype Output = StorageBox;`,
963
+ // --- storagebox snapshot ---
964
+ "storagebox snapshot list": `${ROBOT_STORAGEBOX_SNAPSHOT}\n\ntype Output = { snapshot: StorageBoxSnapshot }[];`,
965
+ // --- storagebox subaccount ---
966
+ "storagebox subaccount list": `${ROBOT_STORAGEBOX_SUBACCOUNT}\n\ntype Output = { subaccount: StorageBoxSubaccount }[];`,
967
+ // --- traffic ---
968
+ "traffic query": `${ROBOT_TRAFFIC}\n\ntype Output = Traffic;`,
969
+ // --- wol ---
970
+ "wol status": `${ROBOT_WOL}\n\ntype Output = Wol;`,
971
+ // --- cancel ---
972
+ "cancel status": `${ROBOT_CANCELLATION}\n\ntype Output = Cancellation;`,
973
+ // --- order ---
974
+ "order products": `${ROBOT_SERVER_PRODUCT}\n\ntype Output = { product: ServerProduct }[];`,
975
+ "order market": `${ROBOT_SERVER_MARKET_PRODUCT}\n\ntype Output = { product: ServerMarketProduct }[];`,
976
+ "order transactions": `${ROBOT_SERVER_TRANSACTION}\n\ntype Output = { transaction: ServerTransaction }[];`,
977
+ "order transaction": `${ROBOT_SERVER_TRANSACTION}\n\ntype Output = { transaction: ServerTransaction }[];`,
978
+ // ==================== Cloud API ====================
979
+ // --- cloud server ---
980
+ "cloud server list": `${CLOUD_SERVER}\n\ntype Output = CloudServer[];`,
981
+ "cloud server describe": `${CLOUD_SERVER}\n\ntype Output = CloudServer;`,
982
+ // --- cloud image ---
983
+ "cloud image list": `${CLOUD_IMAGE}\n\ntype Output = Image[];`,
984
+ "cloud image describe": `${CLOUD_IMAGE}\n\ntype Output = Image;`,
985
+ // --- cloud volume ---
986
+ "cloud volume list": `${CLOUD_VOLUME}\n\ntype Output = Volume[];`,
987
+ "cloud volume describe": `${CLOUD_VOLUME}\n\ntype Output = Volume;`,
988
+ // --- cloud network ---
989
+ "cloud network list": `${CLOUD_NETWORK}\n\ntype Output = Network[];`,
990
+ "cloud network describe": `${CLOUD_NETWORK}\n\ntype Output = Network;`,
991
+ // --- cloud firewall ---
992
+ "cloud firewall list": `${CLOUD_FIREWALL}\n\ntype Output = CloudFirewall[];`,
993
+ "cloud firewall describe": `${CLOUD_FIREWALL}\n\ntype Output = CloudFirewall;`,
994
+ // --- cloud floating-ip ---
995
+ "cloud floating-ip list": `${CLOUD_FLOATING_IP}\n\ntype Output = FloatingIp[];`,
996
+ "cloud floating-ip describe": `${CLOUD_FLOATING_IP}\n\ntype Output = FloatingIp;`,
997
+ // --- cloud primary-ip ---
998
+ "cloud primary-ip list": `${CLOUD_PRIMARY_IP}\n\ntype Output = PrimaryIp[];`,
999
+ "cloud primary-ip describe": `${CLOUD_PRIMARY_IP}\n\ntype Output = PrimaryIp;`,
1000
+ // --- cloud ssh-key ---
1001
+ "cloud ssh-key list": `${CLOUD_SSH_KEY}\n\ntype Output = CloudSshKey[];`,
1002
+ "cloud ssh-key describe": `${CLOUD_SSH_KEY}\n\ntype Output = CloudSshKey;`,
1003
+ // --- cloud certificate ---
1004
+ "cloud certificate list": `${CLOUD_CERTIFICATE}\n\ntype Output = Certificate[];`,
1005
+ "cloud certificate describe": `${CLOUD_CERTIFICATE}\n\ntype Output = Certificate;`,
1006
+ // --- cloud load-balancer ---
1007
+ "cloud load-balancer list": `${CLOUD_LOAD_BALANCER}\n\ntype Output = LoadBalancer[];`,
1008
+ "cloud load-balancer describe": `${CLOUD_LOAD_BALANCER}\n\ntype Output = LoadBalancer;`,
1009
+ // --- cloud placement-group ---
1010
+ "cloud placement-group list": `${CLOUD_PLACEMENT_GROUP}\n\ntype Output = PlacementGroup[];`,
1011
+ "cloud placement-group describe": `${CLOUD_PLACEMENT_GROUP}\n\ntype Output = PlacementGroup;`,
1012
+ // --- cloud datacenter ---
1013
+ "cloud datacenter list": `${CLOUD_DATACENTER}\n\ntype Output = Datacenter[];`,
1014
+ "cloud datacenter describe": `${CLOUD_DATACENTER}\n\ntype Output = Datacenter;`,
1015
+ // --- cloud location ---
1016
+ "cloud location list": `${CLOUD_LOCATION}\n\ntype Output = Location[];`,
1017
+ "cloud location describe": `${CLOUD_LOCATION}\n\ntype Output = Location;`,
1018
+ // --- cloud server-type ---
1019
+ "cloud server-type list": `${CLOUD_SERVER_TYPE}\n\ntype Output = ServerType[];`,
1020
+ "cloud server-type describe": `${CLOUD_SERVER_TYPE}\n\ntype Output = ServerType;`,
1021
+ // --- cloud load-balancer-type ---
1022
+ "cloud load-balancer-type list": `${CLOUD_LOAD_BALANCER_TYPE}\n\ntype Output = LoadBalancerType[];`,
1023
+ "cloud load-balancer-type describe": `${CLOUD_LOAD_BALANCER_TYPE}\n\ntype Output = LoadBalancerType;`,
1024
+ // --- cloud iso ---
1025
+ "cloud iso list": `${CLOUD_ISO}\n\ntype Output = ISO[];`,
1026
+ "cloud iso describe": `${CLOUD_ISO}\n\ntype Output = ISO;`,
1027
+ // ==================== Auction API ====================
1028
+ "auction list": `${AUCTION_SERVER}\n\ntype Output = AuctionServer[];`,
1029
+ "auction show": `${AUCTION_SERVER}\n\ntype Output = AuctionServer;`,
1030
+ "auction status": `${AUCTION_STATUS}\n\ntype Output = AuctionStatus;`,
1031
+ };