banger/internal/api/types.go
Thales Maciel 3ed78fdcfc
Add experimental Void guest workflow and vsock agent
Make iterating on a Firecracker-friendly Void guest practical without replacing the Debian default image path.

Add local Void rootfs build/register/verify plumbing, a language-agnostic dev package baseline, and guest SSH/work-disk hardening so new images use the runtime bundle key, keep a normal root bash environment, and repair stale nested /root layouts on restart.

Replace the guest PING/PONG responder with an HTTP /healthz agent over vsock, rename the runtime bundle and config surface from ping helper to agent while still accepting the legacy keys, and route the post-SSH reminder through the new vm.health path.

Validated with GOCACHE=/tmp/banger-gocache go test ./..., make build, bash -n customize.sh make-rootfs-void.sh, and git diff --check.
2026-03-19 14:51:25 -03:00

107 lines
2.7 KiB
Go

package api
import "banger/internal/model"
type Empty struct{}
type PingResult struct {
Status string `json:"status"`
PID int `json:"pid"`
}
type ShutdownResult struct {
Status string `json:"status"`
}
type VMCreateParams struct {
Name string `json:"name,omitempty"`
ImageName string `json:"image_name,omitempty"`
VCPUCount *int `json:"vcpu_count,omitempty"`
MemoryMiB *int `json:"memory_mib,omitempty"`
SystemOverlaySize string `json:"system_overlay_size,omitempty"`
WorkDiskSize string `json:"work_disk_size,omitempty"`
NATEnabled bool `json:"nat_enabled,omitempty"`
NoStart bool `json:"no_start,omitempty"`
}
type VMRefParams struct {
IDOrName string `json:"id_or_name"`
}
type VMKillParams struct {
IDOrName string `json:"id_or_name"`
Signal string `json:"signal,omitempty"`
}
type VMSetParams struct {
IDOrName string `json:"id_or_name"`
VCPUCount *int `json:"vcpu_count,omitempty"`
MemoryMiB *int `json:"memory_mib,omitempty"`
WorkDiskSize string `json:"work_disk_size,omitempty"`
NATEnabled *bool `json:"nat_enabled,omitempty"`
}
type VMListResult struct {
VMs []model.VMRecord `json:"vms"`
}
type VMShowResult struct {
VM model.VMRecord `json:"vm"`
}
type VMStatsResult struct {
VM model.VMRecord `json:"vm"`
Stats model.VMStats `json:"stats"`
}
type VMLogsResult struct {
LogPath string `json:"log_path"`
}
type VMSSHResult struct {
Name string `json:"name"`
GuestIP string `json:"guest_ip"`
}
type VMHealthResult struct {
Name string `json:"name"`
Healthy bool `json:"healthy"`
}
type VMPingResult struct {
Name string `json:"name"`
Alive bool `json:"alive"`
}
type ImageBuildParams struct {
Name string `json:"name,omitempty"`
BaseRootfs string `json:"base_rootfs,omitempty"`
Size string `json:"size,omitempty"`
KernelPath string `json:"kernel_path,omitempty"`
InitrdPath string `json:"initrd_path,omitempty"`
ModulesDir string `json:"modules_dir,omitempty"`
Docker bool `json:"docker,omitempty"`
}
type ImageRegisterParams struct {
Name string `json:"name,omitempty"`
RootfsPath string `json:"rootfs_path,omitempty"`
WorkSeedPath string `json:"work_seed_path,omitempty"`
KernelPath string `json:"kernel_path,omitempty"`
InitrdPath string `json:"initrd_path,omitempty"`
ModulesDir string `json:"modules_dir,omitempty"`
PackagesPath string `json:"packages_path,omitempty"`
Docker bool `json:"docker,omitempty"`
}
type ImageRefParams struct {
IDOrName string `json:"id_or_name"`
}
type ImageListResult struct {
Images []model.Image `json:"images"`
}
type ImageShowResult struct {
Image model.Image `json:"image"`
}