-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstances.ts
More file actions
1229 lines (1052 loc) · 30 KB
/
instances.ts
File metadata and controls
1229 lines (1052 loc) · 30 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as Shared from '../shared';
import * as AutoStandbyAPI from './auto-standby';
import { AutoStandby } from './auto-standby';
import * as SnapshotScheduleAPI from './snapshot-schedule';
import { SnapshotScheduleUpdateParams } from './snapshot-schedule';
import * as SnapshotsAPI from './snapshots';
import { SnapshotCreateParams, SnapshotRestoreParams, Snapshots } from './snapshots';
import * as VolumesAPI from './volumes';
import { VolumeAttachParams, VolumeDetachParams, Volumes } from './volumes';
import { APIPromise } from '../../core/api-promise';
import { Stream } from '../../core/streaming';
import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class Instances extends APIResource {
autoStandby: AutoStandbyAPI.AutoStandby = new AutoStandbyAPI.AutoStandby(this._client);
volumes: VolumesAPI.Volumes = new VolumesAPI.Volumes(this._client);
snapshots: SnapshotsAPI.Snapshots = new SnapshotsAPI.Snapshots(this._client);
snapshotSchedule: SnapshotScheduleAPI.SnapshotSchedule = new SnapshotScheduleAPI.SnapshotSchedule(
this._client,
);
/**
* Create and start instance
*
* @example
* ```ts
* const instance = await client.instances.create({
* image: 'docker.io/library/alpine:latest',
* name: 'my-workload-1',
* });
* ```
*/
create(body: InstanceCreateParams, options?: RequestOptions): APIPromise<Instance> {
return this._client.post('/instances', { body, ...options });
}
/**
* Update mutable properties of a running instance. Currently supports updating
* only the environment variables referenced by existing credential policies,
* enabling secret/key rotation without instance restart.
*
* @example
* ```ts
* const instance = await client.instances.update('id');
* ```
*/
update(id: string, body: InstanceUpdateParams, options?: RequestOptions): APIPromise<Instance> {
return this._client.patch(path`/instances/${id}`, { body, ...options });
}
/**
* List instances
*
* @example
* ```ts
* const instances = await client.instances.list();
* ```
*/
list(
query: InstanceListParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<InstanceListResponse> {
return this._client.get('/instances', { query, ...options });
}
/**
* Stop and delete instance
*
* @example
* ```ts
* await client.instances.delete('id');
* ```
*/
delete(id: string, options?: RequestOptions): APIPromise<void> {
return this._client.delete(path`/instances/${id}`, {
...options,
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
});
}
/**
* Fork an instance from stopped, standby, or running (with from_running=true)
*
* @example
* ```ts
* const instance = await client.instances.fork('id', {
* name: 'my-workload-1-fork',
* });
* ```
*/
fork(id: string, body: InstanceForkParams, options?: RequestOptions): APIPromise<Instance> {
return this._client.post(path`/instances/${id}/fork`, { body, ...options });
}
/**
* Get instance details
*
* @example
* ```ts
* const instance = await client.instances.get('id');
* ```
*/
get(id: string, options?: RequestOptions): APIPromise<Instance> {
return this._client.get(path`/instances/${id}`, options);
}
/**
* Streams instance logs as Server-Sent Events. Use the `source` parameter to
* select which log to stream:
*
* - `app` (default): Guest application logs (serial console)
* - `vmm`: Cloud Hypervisor VMM logs
* - `hypeman`: Hypeman operations log
*
* Returns the last N lines (controlled by `tail` parameter), then optionally
* continues streaming new lines if `follow=true`.
*
* @example
* ```ts
* const response = await client.instances.logs('id');
* ```
*/
logs(
id: string,
query: InstanceLogsParams | undefined = {},
options?: RequestOptions,
): APIPromise<Stream<InstanceLogsResponse>> {
return this._client.get(path`/instances/${id}/logs`, {
query,
...options,
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
stream: true,
}) as APIPromise<Stream<InstanceLogsResponse>>;
}
/**
* Restore instance from standby
*
* @example
* ```ts
* const instance = await client.instances.restore('id');
* ```
*/
restore(id: string, options?: RequestOptions): APIPromise<Instance> {
return this._client.post(path`/instances/${id}/restore`, options);
}
/**
* Put instance in standby (pause, snapshot, delete VMM)
*
* @example
* ```ts
* const instance = await client.instances.standby('id');
* ```
*/
standby(
id: string,
body: InstanceStandbyParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<Instance> {
return this._client.post(path`/instances/${id}/standby`, { body, ...options });
}
/**
* Start a stopped instance
*
* @example
* ```ts
* const instance = await client.instances.start('id');
* ```
*/
start(id: string, body: InstanceStartParams, options?: RequestOptions): APIPromise<Instance> {
return this._client.post(path`/instances/${id}/start`, { body, ...options });
}
/**
* Returns information about a path in the guest filesystem. Useful for checking if
* a path exists, its type, and permissions before performing file operations.
*
* @example
* ```ts
* const pathInfo = await client.instances.stat('id', {
* path: 'path',
* });
* ```
*/
stat(id: string, query: InstanceStatParams, options?: RequestOptions): APIPromise<PathInfo> {
return this._client.get(path`/instances/${id}/stat`, { query, ...options });
}
/**
* Returns real-time resource utilization statistics for a running VM instance.
* Metrics are collected from /proc/<pid>/stat and /proc/<pid>/statm for CPU and
* memory, and from TAP interface statistics for network I/O.
*
* @example
* ```ts
* const instanceStats = await client.instances.stats('id');
* ```
*/
stats(id: string, options?: RequestOptions): APIPromise<InstanceStats> {
return this._client.get(path`/instances/${id}/stats`, options);
}
/**
* Stop instance (graceful shutdown)
*
* @example
* ```ts
* const instance = await client.instances.stop('id');
* ```
*/
stop(id: string, options?: RequestOptions): APIPromise<Instance> {
return this._client.post(path`/instances/${id}/stop`, options);
}
/**
* Blocks until the instance reaches the specified target state, the timeout
* expires, or the instance enters a terminal/error state. Useful for avoiding
* client-side polling when waiting for state transitions (e.g. waiting for an
* instance to become Running).
*
* @example
* ```ts
* const waitForStateResponse = await client.instances.wait(
* 'id',
* { state: 'Created' },
* );
* ```
*/
wait(id: string, query: InstanceWaitParams, options?: RequestOptions): APIPromise<WaitForStateResponse> {
return this._client.get(path`/instances/${id}/wait`, { query, ...options });
}
}
/**
* Linux-only automatic standby policy based on active inbound TCP connections
* observed from the host conntrack table.
*/
export interface AutoStandbyPolicy {
/**
* Whether automatic standby is enabled for this instance.
*/
enabled?: boolean;
/**
* How long the instance must have zero qualifying inbound TCP connections before
* Hypeman places it into standby.
*/
idle_timeout?: string;
/**
* Optional destination TCP ports that should not keep the instance awake.
*/
ignore_destination_ports?: Array<number>;
/**
* Optional client CIDRs that should not keep the instance awake.
*/
ignore_source_cidrs?: Array<string>;
}
export interface AutoStandbyStatus {
/**
* Number of currently tracked qualifying inbound TCP connections.
*/
active_inbound_connections: number;
/**
* Whether the instance has any auto-standby policy configured.
*/
configured: boolean;
/**
* Whether the instance is currently eligible to enter standby.
*/
eligible: boolean;
/**
* Whether the configured auto-standby policy is enabled.
*/
enabled: boolean;
reason:
| 'unsupported_platform'
| 'policy_missing'
| 'policy_disabled'
| 'instance_not_running'
| 'network_disabled'
| 'missing_ip'
| 'has_vgpu'
| 'active_inbound_connections'
| 'idle_timeout_not_elapsed'
| 'observer_error'
| 'ready_for_standby';
status:
| 'unsupported'
| 'disabled'
| 'ineligible'
| 'active'
| 'idle_countdown'
| 'ready_for_standby'
| 'standby_requested'
| 'error';
/**
* Whether the current host platform supports auto-standby diagnostics.
*/
supported: boolean;
/**
* Diagnostic identifier for the runtime tracking mode in use.
*/
tracking_mode: string;
/**
* Remaining time before the controller attempts standby, when applicable.
*/
countdown_remaining?: string | null;
/**
* When the controller most recently observed the instance become idle.
*/
idle_since?: string | null;
/**
* Configured idle timeout from the auto-standby policy.
*/
idle_timeout?: string | null;
/**
* Timestamp of the most recent qualifying inbound TCP activity the controller
* observed.
*/
last_inbound_activity_at?: string | null;
/**
* When the controller expects to attempt standby next, if a countdown is active.
*/
next_standby_at?: string | null;
}
export interface Instance {
/**
* Auto-generated unique identifier (CUID2 format)
*/
id: string;
/**
* Creation timestamp (RFC3339)
*/
created_at: string;
/**
* OCI image reference
*/
image: string;
/**
* Human-readable name
*/
name: string;
/**
* Instance state:
*
* - Created: VMM created but not started (Cloud Hypervisor native)
* - Initializing: VM is running while guest init is still in progress
* - Running: Guest program has started and instance is ready
* - Paused: VM is paused (Cloud Hypervisor native)
* - Shutdown: VM shut down but VMM exists (Cloud Hypervisor native)
* - Stopped: No VMM running, no snapshot exists
* - Standby: No VMM running, snapshot exists (can be restored)
* - Unknown: Failed to determine state (see state_error for details)
*/
state: 'Created' | 'Initializing' | 'Running' | 'Paused' | 'Shutdown' | 'Stopped' | 'Standby' | 'Unknown';
/**
* Linux-only automatic standby policy based on active inbound TCP connections
* observed from the host conntrack table.
*/
auto_standby?: AutoStandbyPolicy;
/**
* Disk I/O rate limit (human-readable, e.g., "100MB/s")
*/
disk_io_bps?: string;
/**
* Environment variables
*/
env?: { [key: string]: string };
/**
* App exit code (null if VM hasn't exited)
*/
exit_code?: number | null;
/**
* Human-readable description of exit (e.g., "command not found", "killed by signal
* 9 (SIGKILL) - OOM")
*/
exit_message?: string;
/**
* GPU information attached to the instance
*/
gpu?: Instance.GPU;
/**
* Whether a snapshot exists for this instance
*/
has_snapshot?: boolean;
/**
* Hotplug memory size (human-readable)
*/
hotplug_size?: string;
/**
* Hypervisor running this instance
*/
hypervisor?: 'cloud-hypervisor' | 'firecracker' | 'qemu' | 'vz';
/**
* Network configuration of the instance
*/
network?: Instance.Network;
/**
* Writable overlay disk size (human-readable)
*/
overlay_size?: string;
/**
* Base memory size (human-readable)
*/
size?: string;
snapshot_policy?: SnapshotPolicy;
/**
* Start timestamp (RFC3339)
*/
started_at?: string | null;
/**
* Error message if state couldn't be determined (only set when state is Unknown)
*/
state_error?: string | null;
/**
* Stop timestamp (RFC3339)
*/
stopped_at?: string | null;
/**
* User-defined key-value tags.
*/
tags?: { [key: string]: string };
/**
* Number of virtual CPUs
*/
vcpus?: number;
/**
* Volumes attached to the instance
*/
volumes?: Array<VolumeMount>;
}
export namespace Instance {
/**
* GPU information attached to the instance
*/
export interface GPU {
/**
* mdev device UUID
*/
mdev_uuid?: string;
/**
* vGPU profile name
*/
profile?: string;
}
/**
* Network configuration of the instance
*/
export interface Network {
/**
* Download bandwidth limit (human-readable, e.g., "1Gbps", "125MB/s")
*/
bandwidth_download?: string;
/**
* Upload bandwidth limit (human-readable, e.g., "1Gbps", "125MB/s")
*/
bandwidth_upload?: string;
/**
* Whether instance is attached to the default network
*/
enabled?: boolean;
/**
* Assigned IP address (null if no network)
*/
ip?: string | null;
/**
* Assigned MAC address (null if no network)
*/
mac?: string | null;
/**
* Network name (always "default" when enabled)
*/
name?: string;
}
}
/**
* Real-time resource utilization statistics for a VM instance
*/
export interface InstanceStats {
/**
* Total memory allocated to the VM (Size + HotplugSize) in bytes
*/
allocated_memory_bytes: number;
/**
* Number of vCPUs allocated to the VM
*/
allocated_vcpus: number;
/**
* Total CPU time consumed by the VM hypervisor process in seconds
*/
cpu_seconds: number;
/**
* Instance identifier
*/
instance_id: string;
/**
* Instance name
*/
instance_name: string;
/**
* Resident Set Size - actual physical memory used by the VM in bytes
*/
memory_rss_bytes: number;
/**
* Virtual Memory Size - total virtual memory allocated in bytes
*/
memory_vms_bytes: number;
/**
* Total network bytes received by the VM (from TAP interface)
*/
network_rx_bytes: number;
/**
* Total network bytes transmitted by the VM (from TAP interface)
*/
network_tx_bytes: number;
/**
* Memory utilization ratio (RSS / allocated memory). Only present when
* allocated_memory_bytes > 0.
*/
memory_utilization_ratio?: number | null;
}
export interface PathInfo {
/**
* Whether the path exists
*/
exists: boolean;
/**
* Error message if stat failed (e.g., permission denied). Only set when exists is
* false due to an error rather than the path not existing.
*/
error?: string | null;
/**
* True if this is a directory
*/
is_dir?: boolean;
/**
* True if this is a regular file
*/
is_file?: boolean;
/**
* True if this is a symbolic link (only set when follow_links=false)
*/
is_symlink?: boolean;
/**
* Symlink target path (only set when is_symlink=true)
*/
link_target?: string | null;
/**
* File mode (Unix permissions)
*/
mode?: number;
/**
* File size in bytes
*/
size?: number;
}
export interface PortMapping {
/**
* Port in the guest VM
*/
guest_port: number;
/**
* Port on the host
*/
host_port: number;
protocol?: 'tcp' | 'udp';
}
export interface SetSnapshotScheduleRequest {
/**
* Snapshot interval (Go duration format, minimum 1m).
*/
interval: string;
/**
* At least one of max_count or max_age must be provided.
*/
retention: SnapshotScheduleRetention;
/**
* User-defined key-value tags.
*/
metadata?: { [key: string]: string };
/**
* Optional prefix for auto-generated scheduled snapshot names (max 47 chars).
*/
name_prefix?: string | null;
}
export interface SnapshotPolicy {
compression?: Shared.SnapshotCompressionConfig;
/**
* Delay before standby snapshot compression begins, expressed as a Go duration
* like "30s" or "5m". Applies only to standby compression and defaults to
* immediate start when omitted.
*/
standby_compression_delay?: string;
}
export interface SnapshotSchedule {
/**
* Schedule creation timestamp.
*/
created_at: string;
/**
* Source instance ID.
*/
instance_id: string;
/**
* Snapshot interval (Go duration format).
*/
interval: string;
/**
* Next scheduled run time.
*/
next_run_at: string;
/**
* Automatic cleanup policy for scheduled snapshots.
*/
retention: SnapshotScheduleRetention;
/**
* Schedule update timestamp.
*/
updated_at: string;
/**
* Last schedule run error, if any.
*/
last_error?: string | null;
/**
* Last schedule execution time.
*/
last_run_at?: string | null;
/**
* Snapshot ID produced by the last successful run.
*/
last_snapshot_id?: string | null;
/**
* User-defined key-value tags.
*/
metadata?: { [key: string]: string };
/**
* Optional prefix used for generated scheduled snapshot names.
*/
name_prefix?: string | null;
}
/**
* Automatic cleanup policy for scheduled snapshots.
*/
export interface SnapshotScheduleRetention {
/**
* Delete scheduled snapshots older than this duration (Go duration format).
*/
max_age?: string;
/**
* Keep at most this many scheduled snapshots for the instance (0 disables
* count-based cleanup).
*/
max_count?: number;
}
export interface StandbyInstanceRequest {
/**
* Compression settings for standby snapshot memory. Overrides instance defaults.
*/
compression?: Shared.SnapshotCompressionConfig;
/**
* Delay before standby snapshot compression begins, expressed as a Go duration
* like "30s" or "5m". Overrides the instance default for this standby operation
* only.
*/
compression_delay?: string;
}
export interface VolumeMount {
/**
* Path where volume is mounted in the guest
*/
mount_path: string;
/**
* Volume identifier
*/
volume_id: string;
/**
* Create per-instance overlay for writes (requires readonly=true)
*/
overlay?: boolean;
/**
* Max overlay size as human-readable string (e.g., "1GB"). Required if
* overlay=true.
*/
overlay_size?: string;
/**
* Whether volume is mounted read-only
*/
readonly?: boolean;
}
export interface WaitForStateResponse {
/**
* Current instance state when the wait completed
*/
state: 'Created' | 'Initializing' | 'Running' | 'Paused' | 'Shutdown' | 'Stopped' | 'Standby' | 'Unknown';
/**
* Whether the timeout expired before the target state was reached
*/
timed_out: boolean;
/**
* Error message when derived state is Unknown
*/
state_error?: string | null;
}
export type InstanceListResponse = Array<Instance>;
export type InstanceLogsResponse = string;
export interface InstanceCreateParams {
/**
* OCI image reference
*/
image: string;
/**
* Human-readable name (lowercase letters, digits, and dashes only; cannot start or
* end with a dash)
*/
name: string;
/**
* Linux-only automatic standby policy based on active inbound TCP connections
* observed from the host conntrack table.
*/
auto_standby?: AutoStandbyPolicy;
/**
* Override image CMD (like docker run <image> <command>). Omit to use image
* default.
*/
cmd?: Array<string>;
/**
* Host-managed credential brokering policies keyed by guest-visible env var name.
* Those guest env vars receive mock placeholder values, while the real values
* remain host-scoped in the request `env` map and are only materialized on the
* mediated egress path according to each credential's `source` and `inject` rules.
*/
credentials?: { [key: string]: InstanceCreateParams.Credentials };
/**
* Device IDs or names to attach for GPU/PCI passthrough
*/
devices?: Array<string>;
/**
* Disk I/O rate limit (e.g., "100MB/s", "500MB/s"). Defaults to proportional share
* based on CPU allocation if configured.
*/
disk_io_bps?: string;
/**
* Override image entrypoint (like docker run --entrypoint). Omit to use image
* default.
*/
entrypoint?: Array<string>;
/**
* Environment variables
*/
env?: { [key: string]: string };
/**
* GPU configuration for the instance
*/
gpu?: InstanceCreateParams.GPU;
/**
* Additional memory for hotplug (human-readable format like "3GB", "1G"). Omit to
* disable hotplug memory.
*/
hotplug_size?: string;
/**
* Hypervisor to use for this instance. Defaults to server configuration.
*/
hypervisor?: 'cloud-hypervisor' | 'firecracker' | 'qemu' | 'vz';
/**
* Network configuration for the instance
*/
network?: InstanceCreateParams.Network;
/**
* Writable overlay disk size (human-readable format like "10GB", "50G")
*/
overlay_size?: string;
/**
* Base memory size (human-readable format like "1GB", "512MB", "2G")
*/
size?: string;
/**
* Skip guest-agent installation during boot. When true, the exec and stat APIs
* will not work for this instance. The instance will still run, but remote command
* execution will be unavailable.
*/
skip_guest_agent?: boolean;
/**
* Skip kernel headers installation during boot for faster startup. When true, DKMS
* (Dynamic Kernel Module Support) will not work, preventing compilation of
* out-of-tree kernel modules (e.g., NVIDIA vGPU drivers). Recommended for
* workloads that don't need kernel module compilation.
*/
skip_kernel_headers?: boolean;
/**
* Snapshot policy for this instance. Controls compression settings applied when
* creating snapshots or entering standby, plus any default standby-only
* compression delay.
*/
snapshot_policy?: SnapshotPolicy;
/**
* User-defined key-value tags.
*/
tags?: { [key: string]: string };
/**
* Number of virtual CPUs
*/
vcpus?: number;
/**
* Volumes to attach to the instance at creation time
*/
volumes?: Array<VolumeMount>;
}
export namespace InstanceCreateParams {
export interface Credentials {
inject: Array<Credentials.Inject>;
source: Credentials.Source;
}
export namespace Credentials {
export interface Inject {
/**
* Current v1 transform shape. Header templating is supported now; other transform
* types (for example request signing) can be added in future revisions.
*/
as: Inject.As;
/**
* Optional destination host patterns (`api.example.com`, `*.example.com`). Omit to
* allow injection on all destinations.
*/
hosts?: Array<string>;
}
export namespace Inject {
/**
* Current v1 transform shape. Header templating is supported now; other transform
* types (for example request signing) can be added in future revisions.
*/
export interface As {
/**
* Template that must include `${value}`.
*/
format: string;
/**
* Header name to set/mutate for matching outbound requests.
*/
header: string;
}
}
export interface Source {
/**
* Name of the real credential in the request `env` map. The guest-visible env var
* key can receive a mock placeholder, while the mediated egress path resolves that
* placeholder back to this real value only on the host.
*/
env: string;
}
}
/**
* GPU configuration for the instance
*/
export interface GPU {
/**
* vGPU profile name (e.g., "L40S-1Q"). Only used in vGPU mode.
*/
profile?: string;
}
/**
* Network configuration for the instance
*/
export interface Network {
/**