-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathoapi.go
More file actions
16010 lines (12698 loc) · 499 KB
/
oapi.go
File metadata and controls
16010 lines (12698 loc) · 499 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
// Package oapi provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
package oapi
import (
"bytes"
"compress/gzip"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"mime/multipart"
"net/http"
"net/url"
"path"
"strings"
"time"
"github.com/getkin/kin-openapi/openapi3"
"github.com/go-chi/chi/v5"
"github.com/oapi-codegen/runtime"
strictnethttp "github.com/oapi-codegen/runtime/strictmiddleware/nethttp"
openapi_types "github.com/oapi-codegen/runtime/types"
)
const (
BearerAuthScopes = "bearerAuth.Scopes"
)
// Defines values for AccessMode.
const (
ReadOnlyMany AccessMode = "ReadOnlyMany"
ReadWriteMany AccessMode = "ReadWriteMany"
ReadWriteOnce AccessMode = "ReadWriteOnce"
)
// Defines values for AutoStandbyStatusReason.
const (
AutoStandbyStatusReasonActiveInboundConnections AutoStandbyStatusReason = "active_inbound_connections"
AutoStandbyStatusReasonHasVgpu AutoStandbyStatusReason = "has_vgpu"
AutoStandbyStatusReasonIdleTimeoutNotElapsed AutoStandbyStatusReason = "idle_timeout_not_elapsed"
AutoStandbyStatusReasonInstanceNotRunning AutoStandbyStatusReason = "instance_not_running"
AutoStandbyStatusReasonMissingIp AutoStandbyStatusReason = "missing_ip"
AutoStandbyStatusReasonNetworkDisabled AutoStandbyStatusReason = "network_disabled"
AutoStandbyStatusReasonObserverError AutoStandbyStatusReason = "observer_error"
AutoStandbyStatusReasonPolicyDisabled AutoStandbyStatusReason = "policy_disabled"
AutoStandbyStatusReasonPolicyMissing AutoStandbyStatusReason = "policy_missing"
AutoStandbyStatusReasonReadyForStandby AutoStandbyStatusReason = "ready_for_standby"
AutoStandbyStatusReasonUnsupportedPlatform AutoStandbyStatusReason = "unsupported_platform"
)
// Defines values for AutoStandbyStatusStatus.
const (
AutoStandbyStatusStatusActive AutoStandbyStatusStatus = "active"
AutoStandbyStatusStatusDisabled AutoStandbyStatusStatus = "disabled"
AutoStandbyStatusStatusError AutoStandbyStatusStatus = "error"
AutoStandbyStatusStatusIdleCountdown AutoStandbyStatusStatus = "idle_countdown"
AutoStandbyStatusStatusIneligible AutoStandbyStatusStatus = "ineligible"
AutoStandbyStatusStatusReadyForStandby AutoStandbyStatusStatus = "ready_for_standby"
AutoStandbyStatusStatusStandbyRequested AutoStandbyStatusStatus = "standby_requested"
AutoStandbyStatusStatusUnsupported AutoStandbyStatusStatus = "unsupported"
)
// Defines values for BuildEventType.
const (
Heartbeat BuildEventType = "heartbeat"
Log BuildEventType = "log"
Status BuildEventType = "status"
)
// Defines values for BuildStatus.
const (
BuildStatusBuilding BuildStatus = "building"
BuildStatusCancelled BuildStatus = "cancelled"
BuildStatusFailed BuildStatus = "failed"
BuildStatusPushing BuildStatus = "pushing"
BuildStatusQueued BuildStatus = "queued"
BuildStatusReady BuildStatus = "ready"
)
// Defines values for CreateInstanceRequestHypervisor.
const (
CreateInstanceRequestHypervisorCloudHypervisor CreateInstanceRequestHypervisor = "cloud-hypervisor"
CreateInstanceRequestHypervisorFirecracker CreateInstanceRequestHypervisor = "firecracker"
CreateInstanceRequestHypervisorQemu CreateInstanceRequestHypervisor = "qemu"
CreateInstanceRequestHypervisorVz CreateInstanceRequestHypervisor = "vz"
)
// Defines values for CreateInstanceRequestNetworkEgressEnforcementMode.
const (
All CreateInstanceRequestNetworkEgressEnforcementMode = "all"
HttpHttpsOnly CreateInstanceRequestNetworkEgressEnforcementMode = "http_https_only"
)
// Defines values for DeviceType.
const (
Gpu DeviceType = "gpu"
Pci DeviceType = "pci"
)
// Defines values for ForkSnapshotRequestTargetHypervisor.
const (
ForkSnapshotRequestTargetHypervisorCloudHypervisor ForkSnapshotRequestTargetHypervisor = "cloud-hypervisor"
ForkSnapshotRequestTargetHypervisorFirecracker ForkSnapshotRequestTargetHypervisor = "firecracker"
ForkSnapshotRequestTargetHypervisorQemu ForkSnapshotRequestTargetHypervisor = "qemu"
ForkSnapshotRequestTargetHypervisorVz ForkSnapshotRequestTargetHypervisor = "vz"
)
// Defines values for ForkTargetState.
const (
ForkTargetStateRunning ForkTargetState = "Running"
ForkTargetStateStandby ForkTargetState = "Standby"
ForkTargetStateStopped ForkTargetState = "Stopped"
)
// Defines values for GPUResourceStatusMode.
const (
Passthrough GPUResourceStatusMode = "passthrough"
Vgpu GPUResourceStatusMode = "vgpu"
)
// Defines values for HealthStatus.
const (
Ok HealthStatus = "ok"
)
// Defines values for ImageStatus.
const (
ImageStatusConverting ImageStatus = "converting"
ImageStatusFailed ImageStatus = "failed"
ImageStatusPending ImageStatus = "pending"
ImageStatusPulling ImageStatus = "pulling"
ImageStatusReady ImageStatus = "ready"
)
// Defines values for InstanceHypervisor.
const (
InstanceHypervisorCloudHypervisor InstanceHypervisor = "cloud-hypervisor"
InstanceHypervisorFirecracker InstanceHypervisor = "firecracker"
InstanceHypervisorQemu InstanceHypervisor = "qemu"
InstanceHypervisorVz InstanceHypervisor = "vz"
)
// Defines values for InstanceState.
const (
InstanceStateCreated InstanceState = "Created"
InstanceStateInitializing InstanceState = "Initializing"
InstanceStatePaused InstanceState = "Paused"
InstanceStateRunning InstanceState = "Running"
InstanceStateShutdown InstanceState = "Shutdown"
InstanceStateStandby InstanceState = "Standby"
InstanceStateStopped InstanceState = "Stopped"
InstanceStateUnknown InstanceState = "Unknown"
)
// Defines values for MemoryReclaimActionHypervisor.
const (
MemoryReclaimActionHypervisorCloudHypervisor MemoryReclaimActionHypervisor = "cloud-hypervisor"
MemoryReclaimActionHypervisorFirecracker MemoryReclaimActionHypervisor = "firecracker"
MemoryReclaimActionHypervisorQemu MemoryReclaimActionHypervisor = "qemu"
MemoryReclaimActionHypervisorVz MemoryReclaimActionHypervisor = "vz"
)
// Defines values for MemoryReclaimResponseHostPressureState.
const (
Healthy MemoryReclaimResponseHostPressureState = "healthy"
Pressure MemoryReclaimResponseHostPressureState = "pressure"
)
// Defines values for RestoreSnapshotRequestTargetHypervisor.
const (
RestoreSnapshotRequestTargetHypervisorCloudHypervisor RestoreSnapshotRequestTargetHypervisor = "cloud-hypervisor"
RestoreSnapshotRequestTargetHypervisorFirecracker RestoreSnapshotRequestTargetHypervisor = "firecracker"
RestoreSnapshotRequestTargetHypervisorQemu RestoreSnapshotRequestTargetHypervisor = "qemu"
RestoreSnapshotRequestTargetHypervisorVz RestoreSnapshotRequestTargetHypervisor = "vz"
)
// Defines values for SnapshotCompressionState.
const (
SnapshotCompressionStateCompressed SnapshotCompressionState = "compressed"
SnapshotCompressionStateCompressing SnapshotCompressionState = "compressing"
SnapshotCompressionStateError SnapshotCompressionState = "error"
SnapshotCompressionStateNone SnapshotCompressionState = "none"
)
// Defines values for SnapshotSourceHypervisor.
const (
SnapshotSourceHypervisorCloudHypervisor SnapshotSourceHypervisor = "cloud-hypervisor"
SnapshotSourceHypervisorFirecracker SnapshotSourceHypervisor = "firecracker"
SnapshotSourceHypervisorQemu SnapshotSourceHypervisor = "qemu"
SnapshotSourceHypervisorVz SnapshotSourceHypervisor = "vz"
)
// Defines values for SnapshotCompressionConfigAlgorithm.
const (
Lz4 SnapshotCompressionConfigAlgorithm = "lz4"
Zstd SnapshotCompressionConfigAlgorithm = "zstd"
)
// Defines values for SnapshotKind.
const (
SnapshotKindStandby SnapshotKind = "Standby"
SnapshotKindStopped SnapshotKind = "Stopped"
)
// Defines values for SnapshotTargetState.
const (
SnapshotTargetStateRunning SnapshotTargetState = "Running"
SnapshotTargetStateStandby SnapshotTargetState = "Standby"
SnapshotTargetStateStopped SnapshotTargetState = "Stopped"
)
// Defines values for GetInstanceLogsParamsSource.
const (
App GetInstanceLogsParamsSource = "app"
Hypeman GetInstanceLogsParamsSource = "hypeman"
Vmm GetInstanceLogsParamsSource = "vmm"
)
// AccessMode Volume access mode for attachment.
// - ReadWriteOnce: exclusive read-write (only one instance at a time)
// - ReadOnlyMany: read-only, multiple instances can share
// - ReadWriteMany: shared read-write via NFS, multiple instances simultaneously
type AccessMode string
// AttachVolumeRequest defines model for AttachVolumeRequest.
type AttachVolumeRequest struct {
// AccessMode Volume access mode for attachment.
// - ReadWriteOnce: exclusive read-write (only one instance at a time)
// - ReadOnlyMany: read-only, multiple instances can share
// - ReadWriteMany: shared read-write via NFS, multiple instances simultaneously
AccessMode *AccessMode `json:"access_mode,omitempty"`
// MountPath Path where volume should be mounted
MountPath string `json:"mount_path"`
// Readonly Deprecated: use access_mode instead. Mount as read-only.
Readonly *bool `json:"readonly,omitempty"`
}
// AutoStandbyPolicy Linux-only automatic standby policy based on active inbound TCP connections
// observed from the host conntrack table.
type AutoStandbyPolicy struct {
// Enabled Whether automatic standby is enabled for this instance.
Enabled *bool `json:"enabled,omitempty"`
// IdleTimeout How long the instance must have zero qualifying inbound TCP connections
// before Hypeman places it into standby.
IdleTimeout *string `json:"idle_timeout,omitempty"`
// IgnoreDestinationPorts Optional destination TCP ports that should not keep the instance awake.
IgnoreDestinationPorts *[]int `json:"ignore_destination_ports,omitempty"`
// IgnoreSourceCidrs Optional client CIDRs that should not keep the instance awake.
IgnoreSourceCidrs *[]string `json:"ignore_source_cidrs,omitempty"`
}
// AutoStandbyStatus defines model for AutoStandbyStatus.
type AutoStandbyStatus struct {
// ActiveInboundConnections Number of currently tracked qualifying inbound TCP connections.
ActiveInboundConnections int `json:"active_inbound_connections"`
// Configured Whether the instance has any auto-standby policy configured.
Configured bool `json:"configured"`
// CountdownRemaining Remaining time before the controller attempts standby, when applicable.
CountdownRemaining *string `json:"countdown_remaining"`
// Eligible Whether the instance is currently eligible to enter standby.
Eligible bool `json:"eligible"`
// Enabled Whether the configured auto-standby policy is enabled.
Enabled bool `json:"enabled"`
// IdleSince When the controller most recently observed the instance become idle.
IdleSince *time.Time `json:"idle_since"`
// IdleTimeout Configured idle timeout from the auto-standby policy.
IdleTimeout *string `json:"idle_timeout"`
// LastInboundActivityAt Timestamp of the most recent qualifying inbound TCP activity the controller observed.
LastInboundActivityAt *time.Time `json:"last_inbound_activity_at"`
// NextStandbyAt When the controller expects to attempt standby next, if a countdown is active.
NextStandbyAt *time.Time `json:"next_standby_at"`
Reason AutoStandbyStatusReason `json:"reason"`
Status AutoStandbyStatusStatus `json:"status"`
// Supported Whether the current host platform supports auto-standby diagnostics.
Supported bool `json:"supported"`
// TrackingMode Diagnostic identifier for the runtime tracking mode in use.
TrackingMode string `json:"tracking_mode"`
}
// AutoStandbyStatusReason defines model for AutoStandbyStatus.Reason.
type AutoStandbyStatusReason string
// AutoStandbyStatusStatus defines model for AutoStandbyStatus.Status.
type AutoStandbyStatusStatus string
// AvailableDevice defines model for AvailableDevice.
type AvailableDevice struct {
// CurrentDriver Currently bound driver (null if none)
CurrentDriver *string `json:"current_driver"`
// DeviceId PCI device ID (hex)
DeviceId string `json:"device_id"`
// DeviceName Human-readable device name
DeviceName *string `json:"device_name,omitempty"`
// IommuGroup IOMMU group number
IommuGroup int `json:"iommu_group"`
// PciAddress PCI address
PciAddress string `json:"pci_address"`
// VendorId PCI vendor ID (hex)
VendorId string `json:"vendor_id"`
// VendorName Human-readable vendor name
VendorName *string `json:"vendor_name,omitempty"`
}
// Build defines model for Build.
type Build struct {
// BuilderInstanceId Instance ID of the builder VM (for debugging)
BuilderInstanceId *string `json:"builder_instance_id"`
// CompletedAt Build completion timestamp
CompletedAt *time.Time `json:"completed_at"`
// CreatedAt Build creation timestamp
CreatedAt time.Time `json:"created_at"`
// DurationMs Build duration in milliseconds
DurationMs *int64 `json:"duration_ms"`
// Error Error message (only when status is failed)
Error *string `json:"error"`
// Id Build job identifier
Id string `json:"id"`
// ImageDigest Digest of built image (only when status is ready)
ImageDigest *string `json:"image_digest"`
// ImageRef Full image reference (only when status is ready)
ImageRef *string `json:"image_ref"`
Provenance *BuildProvenance `json:"provenance,omitempty"`
// QueuePosition Position in build queue (only when status is queued)
QueuePosition *int `json:"queue_position"`
// StartedAt Build start timestamp
StartedAt *time.Time `json:"started_at"`
// Status Build job status
Status BuildStatus `json:"status"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
}
// BuildEvent defines model for BuildEvent.
type BuildEvent struct {
// Content Log line content (only for type=log)
Content *string `json:"content,omitempty"`
// Status Build job status
Status *BuildStatus `json:"status,omitempty"`
// Timestamp Event timestamp
Timestamp time.Time `json:"timestamp"`
// Type Event type
Type BuildEventType `json:"type"`
}
// BuildEventType Event type
type BuildEventType string
// BuildProvenance defines model for BuildProvenance.
type BuildProvenance struct {
// BaseImageDigest Pinned base image digest used
BaseImageDigest *string `json:"base_image_digest,omitempty"`
// BuildkitVersion BuildKit version used
BuildkitVersion *string `json:"buildkit_version,omitempty"`
// LockfileHashes Map of lockfile names to SHA256 hashes
LockfileHashes *map[string]string `json:"lockfile_hashes,omitempty"`
// SourceHash SHA256 hash of source tarball
SourceHash *string `json:"source_hash,omitempty"`
// Timestamp Build completion timestamp
Timestamp *time.Time `json:"timestamp,omitempty"`
}
// BuildStatus Build job status
type BuildStatus string
// CreateDeviceRequest defines model for CreateDeviceRequest.
type CreateDeviceRequest struct {
// Name Optional globally unique device name. If not provided, a name is auto-generated from the PCI address (e.g., "pci-0000-a2-00-0")
Name *string `json:"name,omitempty"`
// PciAddress PCI address of the device (required, e.g., "0000:a2:00.0")
PciAddress string `json:"pci_address"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
}
// CreateImageRequest defines model for CreateImageRequest.
type CreateImageRequest struct {
// Name OCI image reference (e.g., docker.io/library/nginx:latest)
Name string `json:"name"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
}
// CreateIngressRequest defines model for CreateIngressRequest.
type CreateIngressRequest struct {
// Name Human-readable name (lowercase letters, digits, and dashes only; cannot start or end with a dash)
Name string `json:"name"`
// Rules Routing rules for this ingress
Rules []IngressRule `json:"rules"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
}
// CreateInstanceRequest defines model for CreateInstanceRequest.
type CreateInstanceRequest struct {
// AutoStandby Linux-only automatic standby policy based on active inbound TCP connections
// observed from the host conntrack table.
AutoStandby *AutoStandbyPolicy `json:"auto_standby,omitempty"`
// Cmd Override image CMD (like docker run <image> <command>). Omit to use image default.
Cmd *[]string `json:"cmd,omitempty"`
// Credentials 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 *map[string]CreateInstanceRequestCredential `json:"credentials,omitempty"`
// Devices Device IDs or names to attach for GPU/PCI passthrough
Devices *[]string `json:"devices,omitempty"`
// DiskIoBps Disk I/O rate limit (e.g., "100MB/s", "500MB/s"). Defaults to proportional share based on CPU allocation if configured.
DiskIoBps *string `json:"disk_io_bps,omitempty"`
// Entrypoint Override image entrypoint (like docker run --entrypoint). Omit to use image default.
Entrypoint *[]string `json:"entrypoint,omitempty"`
// Env Environment variables
Env *map[string]string `json:"env,omitempty"`
// Gpu GPU configuration for the instance
Gpu *GPUConfig `json:"gpu,omitempty"`
// HotplugSize Additional memory for hotplug (human-readable format like "3GB", "1G"). Omit to disable hotplug memory.
HotplugSize *string `json:"hotplug_size,omitempty"`
// Hypervisor Hypervisor to use for this instance. Defaults to server configuration.
Hypervisor *CreateInstanceRequestHypervisor `json:"hypervisor,omitempty"`
// Image OCI image reference
Image string `json:"image"`
// Name Human-readable name (lowercase letters, digits, and dashes only; cannot start or end with a dash)
Name string `json:"name"`
// Network Network configuration for the instance
Network *struct {
// BandwidthDownload Download bandwidth limit (external→VM, e.g., "1Gbps", "125MB/s"). Defaults to proportional share based on CPU allocation.
BandwidthDownload *string `json:"bandwidth_download,omitempty"`
// BandwidthUpload Upload bandwidth limit (VM→external, e.g., "1Gbps", "125MB/s"). Defaults to proportional share based on CPU allocation.
BandwidthUpload *string `json:"bandwidth_upload,omitempty"`
// Egress Host-mediated outbound network policy.
// Omit this object, or set `enabled: false`, to preserve normal direct outbound networking
// when `network.enabled` is true.
Egress *CreateInstanceRequestNetworkEgress `json:"egress,omitempty"`
// Enabled Whether to attach instance to the default network
Enabled *bool `json:"enabled,omitempty"`
} `json:"network,omitempty"`
// OverlaySize Writable overlay disk size (human-readable format like "10GB", "50G")
OverlaySize *string `json:"overlay_size,omitempty"`
// Size Base memory size (human-readable format like "1GB", "512MB", "2G")
Size *string `json:"size,omitempty"`
// SkipGuestAgent 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.
SkipGuestAgent *bool `json:"skip_guest_agent,omitempty"`
// SkipKernelHeaders 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.
SkipKernelHeaders *bool `json:"skip_kernel_headers,omitempty"`
SnapshotPolicy *SnapshotPolicy `json:"snapshot_policy,omitempty"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
// Vcpus Number of virtual CPUs
Vcpus *int `json:"vcpus,omitempty"`
// Volumes Volumes to attach to the instance at creation time
Volumes *[]VolumeMount `json:"volumes,omitempty"`
}
// CreateInstanceRequestHypervisor Hypervisor to use for this instance. Defaults to server configuration.
type CreateInstanceRequestHypervisor string
// CreateInstanceRequestCredential defines model for CreateInstanceRequestCredential.
type CreateInstanceRequestCredential struct {
Inject []CreateInstanceRequestCredentialInject `json:"inject"`
Source CreateInstanceRequestCredentialSource `json:"source"`
}
// CreateInstanceRequestCredentialInject defines model for CreateInstanceRequestCredentialInject.
type CreateInstanceRequestCredentialInject struct {
// As Current v1 transform shape. Header templating is supported now; other transform
// types (for example request signing) can be added in future revisions.
As CreateInstanceRequestCredentialInjectAs `json:"as"`
// Hosts Optional destination host patterns (`api.example.com`, `*.example.com`).
// Omit to allow injection on all destinations.
Hosts *[]string `json:"hosts,omitempty"`
}
// CreateInstanceRequestCredentialInjectAs Current v1 transform shape. Header templating is supported now; other transform
// types (for example request signing) can be added in future revisions.
type CreateInstanceRequestCredentialInjectAs struct {
// Format Template that must include `${value}`.
Format string `json:"format"`
// Header Header name to set/mutate for matching outbound requests.
Header string `json:"header"`
}
// CreateInstanceRequestCredentialSource defines model for CreateInstanceRequestCredentialSource.
type CreateInstanceRequestCredentialSource struct {
// Env 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 `json:"env"`
}
// CreateInstanceRequestNetworkEgress Host-mediated outbound network policy.
// Omit this object, or set `enabled: false`, to preserve normal direct outbound networking
// when `network.enabled` is true.
type CreateInstanceRequestNetworkEgress struct {
// Enabled Whether to enable the mediated egress path.
// When false or omitted, the instance keeps normal direct outbound networking and
// host-managed credential rewriting is disabled.
Enabled *bool `json:"enabled,omitempty"`
// Enforcement Egress enforcement policy applied when mediation is enabled.
Enforcement *CreateInstanceRequestNetworkEgressEnforcement `json:"enforcement,omitempty"`
}
// CreateInstanceRequestNetworkEgressEnforcement Egress enforcement policy applied when mediation is enabled.
type CreateInstanceRequestNetworkEgressEnforcement struct {
// Mode `all` (default) rejects direct non-mediated TCP egress from the VM,
// while `http_https_only` rejects direct egress only on TCP ports 80 and 443.
Mode *CreateInstanceRequestNetworkEgressEnforcementMode `json:"mode,omitempty"`
}
// CreateInstanceRequestNetworkEgressEnforcementMode `all` (default) rejects direct non-mediated TCP egress from the VM,
// while `http_https_only` rejects direct egress only on TCP ports 80 and 443.
type CreateInstanceRequestNetworkEgressEnforcementMode string
// CreateSnapshotRequest defines model for CreateSnapshotRequest.
type CreateSnapshotRequest struct {
Compression *SnapshotCompressionConfig `json:"compression,omitempty"`
// Kind Snapshot capture kind
Kind SnapshotKind `json:"kind"`
// Name Optional snapshot name (lowercase letters, digits, and dashes only; cannot start or end with a dash)
Name *string `json:"name,omitempty"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
}
// CreateVolumeRequest defines model for CreateVolumeRequest.
type CreateVolumeRequest struct {
// Id Optional custom identifier (auto-generated if not provided)
Id *string `json:"id,omitempty"`
// Name Volume name
Name string `json:"name"`
// SizeGb Size in gigabytes
SizeGb int `json:"size_gb"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
}
// Device defines model for Device.
type Device struct {
// AttachedTo Instance ID if attached
AttachedTo *string `json:"attached_to"`
// BoundToVfio Whether the device is currently bound to the vfio-pci driver, which is required for VM passthrough.
// - true: Device is bound to vfio-pci and ready for (or currently in use by) a VM. The device's native driver has been unloaded.
// - false: Device is using its native driver (e.g., nvidia) or no driver. Hypeman will automatically bind to vfio-pci when attaching to an instance.
BoundToVfio bool `json:"bound_to_vfio"`
// CreatedAt Registration timestamp (RFC3339)
CreatedAt time.Time `json:"created_at"`
// DeviceId PCI device ID (hex)
DeviceId string `json:"device_id"`
// Id Auto-generated unique identifier (CUID2 format)
Id string `json:"id"`
// IommuGroup IOMMU group number
IommuGroup int `json:"iommu_group"`
// Name Device name (user-provided or auto-generated from PCI address)
Name *string `json:"name,omitempty"`
// PciAddress PCI address
PciAddress string `json:"pci_address"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
// Type Type of PCI device
Type DeviceType `json:"type"`
// VendorId PCI vendor ID (hex)
VendorId string `json:"vendor_id"`
}
// DeviceType Type of PCI device
type DeviceType string
// DiskBreakdown defines model for DiskBreakdown.
type DiskBreakdown struct {
// ImagesBytes Disk used by exported rootfs images
ImagesBytes *int64 `json:"images_bytes,omitempty"`
// OciCacheBytes Disk used by OCI layer cache (shared blobs)
OciCacheBytes *int64 `json:"oci_cache_bytes,omitempty"`
// OverlaysBytes Disk used by instance overlays (rootfs + volume overlays)
OverlaysBytes *int64 `json:"overlays_bytes,omitempty"`
// VolumesBytes Disk used by volumes
VolumesBytes *int64 `json:"volumes_bytes,omitempty"`
}
// Error defines model for Error.
type Error struct {
// Code Application-specific error code (machine-readable)
Code string `json:"code"`
// Details Additional error details (for multiple errors)
Details *[]ErrorDetail `json:"details,omitempty"`
InnerError *ErrorDetail `json:"inner_error,omitempty"`
// Message Human-readable error description for debugging
Message string `json:"message"`
}
// ErrorDetail defines model for ErrorDetail.
type ErrorDetail struct {
// Code Lower-level error code providing more specific detail
Code *string `json:"code,omitempty"`
// Message Further detail about the error
Message *string `json:"message,omitempty"`
}
// ForkInstanceRequest defines model for ForkInstanceRequest.
type ForkInstanceRequest struct {
// FromRunning Allow forking from a running source instance.
// When true and source is Running, the source is put into standby, forked, then restored back to Running.
FromRunning *bool `json:"from_running,omitempty"`
// Name Name for the forked instance (lowercase letters, digits, and dashes only; cannot start or end with a dash)
Name string `json:"name"`
// TargetState Target state for the forked instance after fork completes
TargetState *ForkTargetState `json:"target_state,omitempty"`
}
// ForkSnapshotRequest defines model for ForkSnapshotRequest.
type ForkSnapshotRequest struct {
// Name Name for the new instance (lowercase letters, digits, and dashes only; cannot start or end with a dash)
Name string `json:"name"`
// TargetHypervisor Optional hypervisor override. Allowed only when forking from a Stopped snapshot.
// Standby snapshots must fork with their original hypervisor.
TargetHypervisor *ForkSnapshotRequestTargetHypervisor `json:"target_hypervisor,omitempty"`
// TargetState Target state when restoring or forking from a snapshot
TargetState *SnapshotTargetState `json:"target_state,omitempty"`
}
// ForkSnapshotRequestTargetHypervisor Optional hypervisor override. Allowed only when forking from a Stopped snapshot.
// Standby snapshots must fork with their original hypervisor.
type ForkSnapshotRequestTargetHypervisor string
// ForkTargetState Target state for the forked instance after fork completes
type ForkTargetState string
// GPUConfig GPU configuration for the instance
type GPUConfig struct {
// Profile vGPU profile name (e.g., "L40S-1Q"). Only used in vGPU mode.
Profile *string `json:"profile,omitempty"`
}
// GPUProfile Available vGPU profile
type GPUProfile struct {
// Available Number of instances that can be created with this profile
Available int `json:"available"`
// FramebufferMb Frame buffer size in MB
FramebufferMb int `json:"framebuffer_mb"`
// Name Profile name (user-facing)
Name string `json:"name"`
}
// GPUResourceStatus GPU resource status. Null if no GPUs available.
type GPUResourceStatus struct {
// Devices Physical GPUs (only in passthrough mode)
Devices *[]PassthroughDevice `json:"devices,omitempty"`
// Mode GPU mode (vgpu for SR-IOV/mdev, passthrough for whole GPU)
Mode GPUResourceStatusMode `json:"mode"`
// Profiles Available vGPU profiles (only in vGPU mode)
Profiles *[]GPUProfile `json:"profiles,omitempty"`
// TotalSlots Total slots (VFs for vGPU, physical GPUs for passthrough)
TotalSlots int `json:"total_slots"`
// UsedSlots Slots currently in use
UsedSlots int `json:"used_slots"`
}
// GPUResourceStatusMode GPU mode (vgpu for SR-IOV/mdev, passthrough for whole GPU)
type GPUResourceStatusMode string
// Health defines model for Health.
type Health struct {
Status HealthStatus `json:"status"`
}
// HealthStatus defines model for Health.Status.
type HealthStatus string
// Image defines model for Image.
type Image struct {
// Cmd CMD from container metadata
Cmd *[]string `json:"cmd"`
// CreatedAt Creation timestamp (RFC3339)
CreatedAt time.Time `json:"created_at"`
// Digest Resolved manifest digest
Digest string `json:"digest"`
// Entrypoint Entrypoint from container metadata
Entrypoint *[]string `json:"entrypoint"`
// Env Environment variables from container metadata
Env *map[string]string `json:"env,omitempty"`
// Error Error message if status is failed
Error *string `json:"error"`
// Name Normalized OCI image reference (tag or digest)
Name string `json:"name"`
// QueuePosition Position in build queue (null if not queued)
QueuePosition *int `json:"queue_position"`
// SizeBytes Disk size in bytes (null until ready)
SizeBytes *int64 `json:"size_bytes"`
// Status Build status
Status ImageStatus `json:"status"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
// WorkingDir Working directory from container metadata
WorkingDir *string `json:"working_dir"`
}
// ImageStatus Build status
type ImageStatus string
// Ingress defines model for Ingress.
type Ingress struct {
// CreatedAt Creation timestamp (RFC3339)
CreatedAt time.Time `json:"created_at"`
// Id Auto-generated unique identifier
Id string `json:"id"`
// Name Human-readable name
Name string `json:"name"`
// Rules Routing rules for this ingress
Rules []IngressRule `json:"rules"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
}
// IngressMatch defines model for IngressMatch.
type IngressMatch struct {
// Hostname Hostname to match. Can be:
// - Literal: "api.example.com" (exact match on Host header)
// - Pattern: "{instance}.example.com" (dynamic routing based on subdomain)
//
// Pattern hostnames use named captures in curly braces (e.g., {instance}, {app})
// that extract parts of the hostname for routing. The extracted values can be
// referenced in the target.instance field.
Hostname string `json:"hostname"`
// Port Host port to listen on for this rule (default 80)
Port *int `json:"port,omitempty"`
}
// IngressRule defines model for IngressRule.
type IngressRule struct {
Match IngressMatch `json:"match"`
// RedirectHttp Auto-create HTTP to HTTPS redirect for this hostname (only applies when tls is enabled)
RedirectHttp *bool `json:"redirect_http,omitempty"`
Target IngressTarget `json:"target"`
// Tls Enable TLS termination (certificate auto-issued via ACME).
Tls *bool `json:"tls,omitempty"`
}
// IngressTarget defines model for IngressTarget.
type IngressTarget struct {
// Instance Target instance name, ID, or capture reference.
// - For literal hostnames: Use the instance name or ID directly (e.g., "my-api")
// - For pattern hostnames: Reference a capture from the hostname (e.g., "{instance}")
//
// When using pattern hostnames, the instance is resolved dynamically at request time.
Instance string `json:"instance"`
// Port Target port on the instance
Port int `json:"port"`
}
// Instance defines model for Instance.
type Instance struct {
// AutoStandby Linux-only automatic standby policy based on active inbound TCP connections
// observed from the host conntrack table.
AutoStandby *AutoStandbyPolicy `json:"auto_standby,omitempty"`
// CreatedAt Creation timestamp (RFC3339)
CreatedAt time.Time `json:"created_at"`
// DiskIoBps Disk I/O rate limit (human-readable, e.g., "100MB/s")
DiskIoBps *string `json:"disk_io_bps,omitempty"`
// Env Environment variables
Env *map[string]string `json:"env,omitempty"`
// ExitCode App exit code (null if VM hasn't exited)
ExitCode *int `json:"exit_code"`
// ExitMessage Human-readable description of exit (e.g., "command not found", "killed by signal 9 (SIGKILL) - OOM")
ExitMessage *string `json:"exit_message,omitempty"`
// Gpu GPU information attached to the instance
Gpu *InstanceGPU `json:"gpu,omitempty"`
// HasSnapshot Whether a snapshot exists for this instance
HasSnapshot *bool `json:"has_snapshot,omitempty"`
// HotplugSize Hotplug memory size (human-readable)
HotplugSize *string `json:"hotplug_size,omitempty"`
// Hypervisor Hypervisor running this instance
Hypervisor *InstanceHypervisor `json:"hypervisor,omitempty"`
// Id Auto-generated unique identifier (CUID2 format)
Id string `json:"id"`
// Image OCI image reference
Image string `json:"image"`
// Name Human-readable name
Name string `json:"name"`
// Network Network configuration of the instance
Network *struct {
// BandwidthDownload Download bandwidth limit (human-readable, e.g., "1Gbps", "125MB/s")
BandwidthDownload *string `json:"bandwidth_download,omitempty"`
// BandwidthUpload Upload bandwidth limit (human-readable, e.g., "1Gbps", "125MB/s")
BandwidthUpload *string `json:"bandwidth_upload,omitempty"`
// Enabled Whether instance is attached to the default network
Enabled *bool `json:"enabled,omitempty"`
// Ip Assigned IP address (null if no network)
Ip *string `json:"ip"`
// Mac Assigned MAC address (null if no network)
Mac *string `json:"mac"`
// Name Network name (always "default" when enabled)
Name *string `json:"name,omitempty"`
} `json:"network,omitempty"`
// OverlaySize Writable overlay disk size (human-readable)
OverlaySize *string `json:"overlay_size,omitempty"`
// Size Base memory size (human-readable)
Size *string `json:"size,omitempty"`
SnapshotPolicy *SnapshotPolicy `json:"snapshot_policy,omitempty"`
// StartedAt Start timestamp (RFC3339)
StartedAt *time.Time `json:"started_at"`
// State 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 InstanceState `json:"state"`
// StateError Error message if state couldn't be determined (only set when state is Unknown)
StateError *string `json:"state_error"`
// StoppedAt Stop timestamp (RFC3339)
StoppedAt *time.Time `json:"stopped_at"`
// Tags User-defined key-value tags.
Tags *Tags `json:"tags,omitempty"`
// Vcpus Number of virtual CPUs
Vcpus *int `json:"vcpus,omitempty"`
// Volumes Volumes attached to the instance
Volumes *[]VolumeMount `json:"volumes,omitempty"`
}
// InstanceHypervisor Hypervisor running this instance
type InstanceHypervisor string
// InstanceGPU GPU information attached to the instance
type InstanceGPU struct {
// MdevUuid mdev device UUID
MdevUuid *string `json:"mdev_uuid,omitempty"`
// Profile vGPU profile name
Profile *string `json:"profile,omitempty"`
}
// InstanceState 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)
type InstanceState string
// InstanceStats Real-time resource utilization statistics for a VM instance
type InstanceStats struct {