vdi-cloud/platform/internal/model/model.go

121 lines
5.3 KiB
Go

package model
import "time"
type Administrator struct {
ID string `json:"id" db:"id"`
Username string `json:"username" db:"username"`
DisplayName string `json:"displayName" db:"display_name"`
Role string `json:"role" db:"role"`
Enabled bool `json:"enabled" db:"enabled"`
PasswordHash string `json:"-" db:"password_hash"`
}
type Desktop struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
OS string `json:"os" db:"os"`
Node string `json:"node" db:"node"`
VMID int `json:"vmid" db:"vmid"`
Pool string `json:"pool" db:"pool"`
PowerState string `json:"powerState" db:"power_state"`
ServiceState string `json:"serviceState" db:"service_state"`
Provider string `json:"provider" db:"provider"`
Endpoint string `json:"endpoint" db:"endpoint"`
App string `json:"app" db:"app"`
Width int `json:"width" db:"width"`
Height int `json:"height" db:"height"`
FPS int `json:"fps" db:"fps"`
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
PoolID *string `json:"poolId" db:"pool_id"`
SetupRequired bool `json:"setupRequired" db:"setup_required"`
}
type ImageTemplate struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Version string `json:"version" db:"version"`
OS string `json:"os" db:"os"`
Node string `json:"node" db:"node"`
VMID int `json:"vmid" db:"vmid"`
Digest string `json:"-" db:"digest"`
Enabled bool `json:"enabled" db:"enabled"`
ValidatedAt time.Time `json:"validatedAt" db:"validated_at"`
}
type DesktopPool struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Type string `json:"type" db:"type"`
MaxCount int `json:"maxCount" db:"max_count"`
TemplateID *string `json:"templateId" db:"template_id"`
Enabled bool `json:"enabled" db:"enabled"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
DesktopCount int `json:"desktopCount" db:"desktop_count"`
ReservedCount int `json:"reservedCount" db:"reserved_count"`
AssignedCount int `json:"assignedCount" db:"assigned_count"`
ActiveCount int `json:"activeCount" db:"active_count"`
}
type Terminal struct {
Enabled bool `json:"enabled" db:"enabled"`
ID string `json:"id" db:"id"`
SN string `json:"sn" db:"sn"`
Name string `json:"name" db:"name"`
Group string `json:"group" db:"group_name"`
Status string `json:"status" db:"status"`
AgentVersion string `json:"agentVersion" db:"agent_version"`
LastSeen *time.Time `json:"lastSeen" db:"last_seen"`
SessionDesktopID *string `json:"sessionDesktopId" db:"session_desktop_id"`
SessionState string `json:"sessionState" db:"session_state"`
ConfigVersion int `json:"configVersion" db:"config_version"`
FPS *float64 `json:"fps" db:"fps"`
RTT *float64 `json:"rtt" db:"rtt"`
}
type User struct {
ID string `json:"id" db:"id"`
Username string `json:"username" db:"username"`
DisplayName string `json:"displayName" db:"display_name"`
Enabled bool `json:"enabled" db:"enabled"`
TerminalID *string `json:"terminalId" db:"terminal_id"`
DesktopIDs []string `json:"desktopIds"`
}
type Resource struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Status string `json:"status" db:"status"`
CPU float64 `json:"cpu" db:"cpu"`
Memory float64 `json:"memory" db:"memory"`
Storage float64 `json:"storage" db:"storage"`
Provider string `json:"provider" db:"provider"`
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}
type Task struct {
ID string `json:"id" db:"id"`
Kind string `json:"kind" db:"kind"`
Action string `json:"action" db:"action"`
TargetID string `json:"targetId" db:"target_id"`
TargetName string `json:"targetName" db:"target_name"`
Actor string `json:"actor" db:"actor"`
Status string `json:"status" db:"status"`
Message string `json:"message" db:"message"`
ProviderRef string `json:"providerRef" db:"provider_ref"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
IdempotencyKey string `json:"-" db:"idempotency_key"`
}
type Audit struct {
ID string `json:"id" db:"id"`
Actor string `json:"actor" db:"actor"`
Action string `json:"action" db:"action"`
Target string `json:"target" db:"target"`
Result string `json:"result" db:"result"`
RequestID string `json:"requestId" db:"request_id"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
}
type DeviceDiagnostics struct {
AgentVersion string `json:"agentVersion" binding:"required,max=80"`
BootID string `json:"bootId" binding:"required,max=80"`
UptimeSeconds float64 `json:"uptimeSeconds" binding:"min=0"`
KioskState string `json:"kioskState" binding:"required,max=80"`
LogTail string `json:"logTail" binding:"max=16384"`
}