feat: wire delivery result and infra data backends
This commit is contained in:
@@ -87,23 +87,44 @@ type ResourceUsage struct {
|
||||
ReleasedAt *time.Time `json:"released_at,omitempty"`
|
||||
}
|
||||
|
||||
type MySQLInstance struct {
|
||||
type DeploymentResult struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TaskID string `gorm:"size:36;not null;uniqueIndex" json:"task_id"`
|
||||
BusinessLineID uint64 `gorm:"not null;index" json:"business_line_id"`
|
||||
TargetID uint64 `gorm:"not null;index;uniqueIndex:idx_mysql_target_name,priority:1" json:"target_id"`
|
||||
Namespace string `gorm:"size:63;not null" json:"namespace"`
|
||||
Name string `gorm:"size:63;not null;uniqueIndex:idx_mysql_target_name,priority:2" json:"name"`
|
||||
NodeName string `gorm:"size:128" json:"node_name"`
|
||||
Host string `gorm:"size:255;not null" json:"host"`
|
||||
Port int `gorm:"not null;default:3306" json:"port"`
|
||||
Version string `gorm:"size:32;not null" json:"version"`
|
||||
Component string `gorm:"size:32;not null;index" json:"component"`
|
||||
ServiceType string `gorm:"size:32;not null;index" json:"service_type"`
|
||||
InstanceName string `gorm:"size:128;not null;index" json:"instance_name"`
|
||||
Namespace string `gorm:"size:128;not null;default:'';index" json:"namespace"`
|
||||
TargetID uint64 `gorm:"not null;index" json:"target_id"`
|
||||
NodeName string `gorm:"size:128;not null;default:''" json:"node_name"`
|
||||
Host string `gorm:"size:255;not null;default:''" json:"host"`
|
||||
Port int `gorm:"not null;default:0" json:"port"`
|
||||
Version string `gorm:"size:64;not null;default:''" json:"version"`
|
||||
Status string `gorm:"size:32;not null;index" json:"status"`
|
||||
CloudDMID string `gorm:"size:128" json:"clouddm_id,omitempty"`
|
||||
Metadata string `gorm:"type:json" json:"metadata"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type DeploymentCredential struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TaskID string `gorm:"size:36;not null;index" json:"task_id"`
|
||||
DeploymentResultID uint64 `gorm:"not null;default:0;index" json:"deployment_result_id"`
|
||||
BusinessLineID uint64 `gorm:"not null;index" json:"business_line_id"`
|
||||
Component string `gorm:"size:32;not null;index" json:"component"`
|
||||
InstanceName string `gorm:"size:128;not null;index" json:"instance_name"`
|
||||
Username string `gorm:"size:128;not null" json:"username"`
|
||||
AccountHost string `gorm:"size:128;not null;default:''" json:"account_host"`
|
||||
Ciphertext string `gorm:"type:text;not null" json:"-"`
|
||||
Nonce string `gorm:"size:64;not null" json:"-"`
|
||||
Status string `gorm:"size:32;not null;index" json:"status"`
|
||||
Source string `gorm:"size:64;not null;default:'user_input'" json:"source"`
|
||||
ViewedBy uint64 `gorm:"not null;default:0" json:"viewed_by"`
|
||||
ViewedAt *time.Time `json:"viewed_at,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type ExecutionJob struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TaskID string `gorm:"size:36;not null;uniqueIndex" json:"task_id"`
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user