36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
package model
|
|
|
|
type HTTPConfig struct {
|
|
Method string `json:"method"`
|
|
Headers map[string]string `json:"headers"`
|
|
}
|
|
|
|
type ServiceTypeCheckConfig struct {
|
|
Version string `json:"version"`
|
|
HTTPConfig *HTTPConfig `json:"http_config"`
|
|
}
|
|
|
|
type Service struct {
|
|
// Unique ID for entity
|
|
ID int `gorm:"primary_key;auto_increment" json:"id"`
|
|
// Human-readable service name
|
|
Name string `gorm:"size:255;not null" json:"name"`
|
|
// Human-readable service description
|
|
Description string `gorm:"size:255" json:"description"`
|
|
PublicDescription string `gorm:"size:255" json:"public_description"`
|
|
Public *bool `gorm:"default:false" json:"public"`
|
|
// Host to check, for example 192.168.1.44
|
|
Host string `gorm:"size:255;not null" json:"host"`
|
|
// Port to check, for example 5432 (postgresql)
|
|
Port *int `gorm:"default:null" json:"port"`
|
|
// Type for check, for now is TCP or HTTP
|
|
Type string `gorm:"size:255;not null" json:"type"`
|
|
TypeConfig *ServiceTypeCheckConfig `gorm:"serializer:json" json:"type_config"`
|
|
|
|
Statuses []Status `gorm:"foreignkey:ServiceID" json:"statuses"`
|
|
}
|
|
|
|
func (Service) TableName() string {
|
|
return "service"
|
|
}
|