The Go control plane already exposed banger vm kill and daemon-side kill handling, but the API package was missing the VMKillParams request type. That left the worktree depending on an unstaged type addition even though the rest of the feature was already wired. Add the missing request struct so the CLI, RPC layer, and daemon share an explicit payload for signal-based VM termination. This commit is intentionally narrow because the rest of the kill-path work was already present.
86 lines
2.1 KiB
Go
86 lines
2.1 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 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 ImageRefParams struct {
|
|
IDOrName string `json:"id_or_name"`
|
|
}
|
|
|
|
type ImageListResult struct {
|
|
Images []model.Image `json:"images"`
|
|
}
|
|
|
|
type ImageShowResult struct {
|
|
Image model.Image `json:"image"`
|
|
}
|