add mapstructure tags to types,
improve function documentation
This commit is contained in:
+40
-40
@@ -5,13 +5,13 @@ type Cluster struct {
|
||||
}
|
||||
|
||||
type Node struct {
|
||||
Name string `json:"name"`
|
||||
Cores uint64 `json:"cores"`
|
||||
Memory uint64 `json:"memory"`
|
||||
Swap uint64 `json:"swap"`
|
||||
Devices map[DeviceBus]*Device `json:"devices"`
|
||||
Instances map[InstanceID]*Instance `json:"instances"`
|
||||
Proctypes []string `json:"cpus"`
|
||||
Name string `json:"name" mapstructure:"name"`
|
||||
Cores uint64 `json:"cores" mapstructure:"cores"`
|
||||
Memory uint64 `json:"memory" mapstructure:"memory"`
|
||||
Swap uint64 `json:"swap" mapstructure:"swap"`
|
||||
Devices map[DeviceBus]*Device `json:"devices" mapstructure:"devices"`
|
||||
Instances map[InstanceID]*Instance `json:"instances" mapstructure:"instances"`
|
||||
Proctypes []string `json:"cpus" mapstructure:"cpus"`
|
||||
}
|
||||
|
||||
type InstanceID uint64
|
||||
@@ -21,17 +21,17 @@ const VM InstanceType = "VM"
|
||||
const CT InstanceType = "CT"
|
||||
|
||||
type Instance struct {
|
||||
Type InstanceType `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Type InstanceType `json:"type" mapstructure:"type"`
|
||||
Name string `json:"name" mapstructure:"name"`
|
||||
Proctype string `json:"cpu" mapstructure:"cpu"`
|
||||
Cores uint64 `json:"cores"`
|
||||
Memory uint64 `json:"memory"`
|
||||
Swap uint64 `json:"swap"`
|
||||
Volumes map[VolumeID]*Volume `json:"volumes"`
|
||||
Nets map[NetID]*Net `json:"nets"`
|
||||
Devices map[DeviceID]*Device `json:"devices"`
|
||||
Boot BootOrder `json:"boot"`
|
||||
Pool string `json:"pool"` // todo: this should be actual pool
|
||||
Cores uint64 `json:"cores" mapstructure:"cores"`
|
||||
Memory uint64 `json:"memory" mapstructure:"memory"`
|
||||
Swap uint64 `json:"swap" mapstructure:"swap"`
|
||||
Volumes map[VolumeID]*Volume `json:"volumes" mapstructure:"volumes"`
|
||||
Nets map[NetID]*Net `json:"nets" mapstructure:"nets"`
|
||||
Devices map[DeviceID]*Device `json:"devices" mapstructure:"devices"`
|
||||
Boot BootOrder `json:"boot" mapstructure:"boot"`
|
||||
Pool string `json:"pool" mapstructure:"pool"` // todo: this should be actual pool
|
||||
}
|
||||
|
||||
var VolumeTypes = []string{
|
||||
@@ -45,43 +45,43 @@ var VolumeTypes = []string{
|
||||
|
||||
type VolumeID string
|
||||
type Volume struct {
|
||||
Volume_ID VolumeID `json:"volume_id"`
|
||||
Type string `json:"type"`
|
||||
Storage string `json:"storage"`
|
||||
Format string `json:"format"`
|
||||
Size uint64 `json:"size"`
|
||||
File string `json:"file"`
|
||||
MP string `json:"mp"`
|
||||
Volume_ID VolumeID `json:"volume_id" mapstructure:"volume_id"`
|
||||
Type string `json:"type" mapstructure:"type"`
|
||||
Storage string `json:"storage" mapstructure:"storage"`
|
||||
Format string `json:"format" mapstructure:"format"`
|
||||
Size uint64 `json:"size" mapstructure:"size"`
|
||||
File string `json:"file" mapstructure:"file"`
|
||||
MP string `json:"mp" mapstructure:"mp"`
|
||||
}
|
||||
|
||||
type NetID string
|
||||
type Net struct {
|
||||
Net_ID NetID `json:"net_id"`
|
||||
Value string `json:"value"`
|
||||
Rate uint64 `json:"rate"`
|
||||
VLAN uint64 `json:"vlan"`
|
||||
Net_ID NetID `json:"net_id" mapstructure:"net_id"`
|
||||
Value string `json:"value" mapstructure:"value"`
|
||||
Rate uint64 `json:"rate" mapstructure:"rate"`
|
||||
VLAN uint64 `json:"vlan" mapstructure:"vlan"`
|
||||
}
|
||||
|
||||
type DeviceID string
|
||||
type DeviceBus string
|
||||
type Device struct {
|
||||
Device_ID DeviceID `json:"device_id"`
|
||||
Device_Bus DeviceBus `json:"device_bus"`
|
||||
Device_Name string `json:"device_name"`
|
||||
Vendor_Name string `json:"vendor_name"`
|
||||
Functions map[FunctionID]*Function `json:"functions"`
|
||||
Reserved bool `json:"reserved"`
|
||||
Device_ID DeviceID `json:"device_id" mapstructure:"device_id"`
|
||||
Device_Bus DeviceBus `json:"device_bus" mapstructure:"device_bus"`
|
||||
Device_Name string `json:"device_name" mapstructure:"device_name"`
|
||||
Vendor_Name string `json:"vendor_name" mapstructure:"vendor_name"`
|
||||
Functions map[FunctionID]*Function `json:"functions" mapstructure:"functions"`
|
||||
Reserved bool `json:"reserved" mapstructure:"reserved"`
|
||||
}
|
||||
|
||||
type FunctionID string
|
||||
type Function struct {
|
||||
Function_ID FunctionID `json:"function_id"`
|
||||
Function_Name string `json:"subsystem_device_name"`
|
||||
Vendor_Name string `json:"subsystem_vendor_name"`
|
||||
Reserved bool `json:"reserved"`
|
||||
Function_ID FunctionID `json:"function_id" mapstructure:"function_id"`
|
||||
Function_Name string `json:"subsystem_device_name" mapstructure:"subsystem_device_name"`
|
||||
Vendor_Name string `json:"subsystem_vendor_name" mapstructure:"subsystem_vendor_name"`
|
||||
Reserved bool `json:"reserved" mapstructure:"reserved"`
|
||||
}
|
||||
|
||||
type BootOrder struct {
|
||||
Enabled []any `json:"enabled"`
|
||||
Disabled []any `json:"disabled"`
|
||||
Enabled []any `json:"enabled" mapstructure:"enabled"`
|
||||
Disabled []any `json:"disabled" mapstructure:"disabled"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user