mirror of
https://github.com/khairul169/vaulterm.git
synced 2025-04-28 16:49:39 +07:00
33 lines
986 B
Go
33 lines
986 B
Go
package models
|
|
|
|
import "gorm.io/datatypes"
|
|
|
|
const (
|
|
HostTypeSSH = "ssh"
|
|
HostTypePVE = "pve"
|
|
HostTypePVENode = "pve_node"
|
|
HostTypePVEHost = "pve_host"
|
|
HostTypeIncus = "incus"
|
|
HostTypeIncusHost = "incus_host"
|
|
)
|
|
|
|
type Host struct {
|
|
BaseModel
|
|
|
|
Type string `json:"type" gorm:"not null;index:hosts_type_idx;type:varchar(16)"`
|
|
Label string `json:"label"`
|
|
Host string `json:"host" gorm:"type:varchar(64)"`
|
|
Port int `json:"port" gorm:"type:smallint"`
|
|
Metadata datatypes.JSONMap `json:"metadata"`
|
|
|
|
ParentID *string `json:"parentId" gorm:"index:hosts_parent_id_idx;type:varchar(26)"`
|
|
Parent *Host `json:"parent" gorm:"foreignKey:ParentID"`
|
|
KeyID *string `json:"keyId" gorm:"index:hosts_key_id_idx"`
|
|
Key Keychain `gorm:"foreignKey:KeyID"`
|
|
AltKeyID *string `json:"altKeyId" gorm:"index:hosts_altkey_id_idx"`
|
|
AltKey Keychain `gorm:"foreignKey:AltKeyID"`
|
|
|
|
Timestamps
|
|
SoftDeletes
|
|
}
|