Files

55 lines
3.3 KiB
Go

package model
import "time"
type MachineResource struct {
ID uint64 `gorm:"primaryKey" json:"id"`
SinaID int64 `gorm:"not null;uniqueIndex" json:"sina_id"`
CIID string `gorm:"size:64;not null;default:'';index" json:"ci_id"`
Hostname string `gorm:"size:255;not null;default:'';index" json:"hostname"`
Name string `gorm:"size:255;not null;default:''" json:"name"`
AssetNumber string `gorm:"size:128;not null;default:'';index" json:"asset_number"`
IDCNumber string `gorm:"size:128;not null;default:''" json:"idc_number"`
ResourceType string `gorm:"size:64;not null;default:'';index" json:"resource_type"`
LocationName string `gorm:"size:255;not null;default:'';index" json:"location_name"`
LocationAlias string `gorm:"size:255;not null;default:''" json:"location_alias"`
IntranetIP string `gorm:"size:128;not null;default:'';index" json:"intranet_ip"`
Spec string `gorm:"size:255;not null;default:''" json:"spec"`
BusinessLine string `gorm:"size:128;not null;default:'';index" json:"business_line"`
Source string `gorm:"size:64;not null;default:'';index" json:"source"`
Status string `gorm:"size:64;not null;default:'';index" json:"status"`
Brand string `gorm:"size:128;not null;default:''" json:"brand"`
Model string `gorm:"size:128;not null;default:''" json:"model"`
SerialNumber string `gorm:"size:128;not null;default:'';index" json:"serial_number"`
PowerStatus string `gorm:"size:64;not null;default:''" json:"power_status"`
CPUCores int64 `gorm:"not null;default:0" json:"cpu_cores"`
CPUName string `gorm:"size:255;not null;default:''" json:"cpu_name"`
Memory string `gorm:"size:255;not null;default:''" json:"memory"`
HardCapacity string `gorm:"size:255;not null;default:''" json:"hard_capacity"`
SSDCapacity string `gorm:"size:255;not null;default:''" json:"ssd_capacity"`
OOBIP string `gorm:"size:128;not null;default:''" json:"oob_ip"`
OSFamily string `gorm:"size:128;not null;default:''" json:"os_family"`
OSVersion string `gorm:"size:128;not null;default:''" json:"os_version"`
CollectTime *time.Time `gorm:"index" json:"collect_time"`
SinaUpdatedAt *time.Time `gorm:"index" json:"sina_updated_at"`
RawJSON string `gorm:"type:longtext" json:"-"`
LastSyncedAt time.Time `gorm:"not null;index" json:"last_synced_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type MachineSyncState struct {
ID uint64 `gorm:"primaryKey" json:"id"`
Source string `gorm:"size:64;not null;uniqueIndex" json:"source"`
Status string `gorm:"size:32;not null;default:'idle';index" json:"status"`
LastStartedAt *time.Time `json:"last_started_at"`
LastFinishedAt *time.Time `json:"last_finished_at"`
LastError string `gorm:"type:text" json:"last_error"`
Total int64 `gorm:"not null;default:0" json:"total"`
Fetched int64 `gorm:"not null;default:0" json:"fetched"`
CreatedCount int64 `gorm:"not null;default:0" json:"created_count"`
UpdatedCount int64 `gorm:"not null;default:0" json:"updated_count"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}