46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
)
|
||
|
|
||
|
type Device struct {
|
||
|
MacAddress string `json:"mac"`
|
||
|
Name string `json:"name"`
|
||
|
Type DeviceType `json:"type"`
|
||
|
Subtype string `json:"subtype"`
|
||
|
DeviceSeriesType int `json:"deviceSeriesType"`
|
||
|
Model string `json:"model"`
|
||
|
IP string `json:"ip"`
|
||
|
IPv6 []string `json:"ipv6"`
|
||
|
Uptime string `json:"uptime"`
|
||
|
Status DeviceStatus `json:"status"`
|
||
|
LastSeen int `json:"lastSeen"`
|
||
|
CpuUtil int `json:"cpuUtil"`
|
||
|
MemUtil int `json:"memUtil"`
|
||
|
SerialNumber string `json:"sn"`
|
||
|
LicenseStatus int `json:"licenseStatus"`
|
||
|
TagName string `json:"tagName"`
|
||
|
}
|
||
|
|
||
|
func (d Device) String() string {
|
||
|
data, _ := json.MarshalIndent(d, "", "\t")
|
||
|
return string(data)
|
||
|
}
|
||
|
|
||
|
type DeviceStatus int
|
||
|
|
||
|
const (
|
||
|
DeviceStatusDisconnected DeviceStatus = iota
|
||
|
DeviceStatusConnected
|
||
|
DeviceStatusPending
|
||
|
DeviceStatusHeartbeatMissed
|
||
|
DeviceStatusIsolated
|
||
|
)
|
||
|
|
||
|
type DeviceType string
|
||
|
|
||
|
const (
|
||
|
DeviceTypeAP DeviceType = "ap"
|
||
|
)
|