rename volume volid to file to better represent the meaning,
add raw value string to devices, fix JSON to go naming for device_name vendor_name ... in devices, bump API version to 0.03
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/luthermonson/go-proxmox"
|
||||
)
|
||||
|
||||
const APIVersion string = "0.0.2"
|
||||
const APIVersion string = "0.0.3"
|
||||
|
||||
var client ProxmoxClient
|
||||
|
||||
|
@@ -238,5 +238,7 @@ func (instance *Instance) RebuildDevice(host *Node, deviceid string) error {
|
||||
// sub function assignment not supported yet
|
||||
}
|
||||
|
||||
instance.Devices[InstanceDeviceID(instanceDeviceBusID)].Value = instanceDevice
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@@ -82,17 +82,17 @@ func (pve ProxmoxClient) Node(nodeName string) (*Node, error) {
|
||||
functionid := FunctionID(x[1])
|
||||
if _, ok := host.Devices[deviceid]; !ok {
|
||||
host.Devices[deviceid] = &Device{
|
||||
DeviceID: deviceid,
|
||||
DeviceName: device.DeviceName,
|
||||
VendorName: device.VendorName,
|
||||
Functions: make(map[FunctionID]*Function),
|
||||
Device_ID: deviceid,
|
||||
Device_Name: device.Device_Name,
|
||||
Vendor_Name: device.Vendor_Name,
|
||||
Functions: make(map[FunctionID]*Function),
|
||||
}
|
||||
}
|
||||
host.Devices[deviceid].Functions[functionid] = &Function{
|
||||
FunctionID: functionid,
|
||||
FunctionName: device.SubsystemDeviceName,
|
||||
VendorName: device.SubsystemVendorName,
|
||||
Reserved: false,
|
||||
Function_ID: functionid,
|
||||
Function_Name: device.Subsystem_Device_Name,
|
||||
Vendor_Name: device.Subsystem_Vendor_Name,
|
||||
Reserved: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ func GetVolumeInfo(host *Node, volume string) (*Volume, error) {
|
||||
volumeData.Storage = storageID
|
||||
volumeData.Format = c.Format
|
||||
volumeData.Size = uint64(c.Size)
|
||||
volumeData.Volid = VolumeID(volumeID)
|
||||
volumeData.File = volumeID
|
||||
}
|
||||
}
|
||||
|
||||
|
39
app/types.go
39
app/types.go
@@ -59,11 +59,11 @@ var VolumeTypes = []string{
|
||||
|
||||
type VolumeID string
|
||||
type Volume struct {
|
||||
Type string `json:"type"`
|
||||
Storage string `json:"storage"`
|
||||
Format string `json:"format"`
|
||||
Size uint64 `json:"size"`
|
||||
Volid VolumeID `json:"volid"`
|
||||
Type string `json:"type"`
|
||||
Storage string `json:"storage"`
|
||||
Format string `json:"format"`
|
||||
Size uint64 `json:"size"`
|
||||
File string `json:"file"`
|
||||
}
|
||||
|
||||
type NetID uint64
|
||||
@@ -74,27 +74,28 @@ type Net struct {
|
||||
}
|
||||
|
||||
type PVEDevice struct {
|
||||
ID string `json:"id"`
|
||||
DeviceName string `json:"device_name"`
|
||||
VendorName string `json:"vendor_name"`
|
||||
SubsystemDeviceName string `json:"subsystem_device_name"`
|
||||
SubsystemVendorName string `json:"subsystem_vendor_name"`
|
||||
ID string `json:"id"`
|
||||
Device_Name string `json:"device_name"`
|
||||
Vendor_Name string `json:"vendor_name"`
|
||||
Subsystem_Device_Name string `json:"subsystem_device_name"`
|
||||
Subsystem_Vendor_Name string `json:"subsystem_vendor_name"`
|
||||
}
|
||||
|
||||
type DeviceID string
|
||||
type InstanceDeviceID uint64
|
||||
type Device struct {
|
||||
DeviceID DeviceID `json:"device_id"`
|
||||
DeviceName string `json:"device_name"`
|
||||
VendorName string `json:"vendor_name"`
|
||||
Functions map[FunctionID]*Function `json:"functions"`
|
||||
Reserved bool `json:"reserved"`
|
||||
Device_ID DeviceID `json:"device_id"`
|
||||
Device_Name string `json:"device_name"`
|
||||
Vendor_Name string `json:"vendor_name"`
|
||||
Functions map[FunctionID]*Function `json:"functions"`
|
||||
Reserved bool `json:"reserved"`
|
||||
Value string
|
||||
}
|
||||
|
||||
type FunctionID string
|
||||
type Function struct {
|
||||
FunctionID FunctionID `json:"function_id"`
|
||||
FunctionName string `json:"subsystem_device_name"`
|
||||
VendorName string `json:"subsystem_vendor_name"`
|
||||
Reserved bool `json:"reserved"`
|
||||
Function_ID FunctionID `json:"function_id"`
|
||||
Function_Name string `json:"subsystem_device_name"`
|
||||
Vendor_Name string `json:"subsystem_vendor_name"`
|
||||
Reserved bool `json:"reserved"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user