mercy/internal/common/types.go

46 lines
1.0 KiB
Go

package common
import "time"
type Result int
//go:generate stringer -type=Result
const (
Unknown Result = iota
OK
Degraded
Failed
)
type Preamble struct {
CustomerID string `json:"customer_id"`
CheckID string `json:"check_id"`
RunID string `json:"run_id"`
}
// HTTPCheckRequest
type HTTPCheckRequest struct {
Preamble Preamble `json:"preamble"`
URL string `json:"url"`
DegradedThreshold time.Duration `json:"degraded_threshold"`
FailThreshold time.Duration `json:"fail_threshold"`
}
type CheckResult struct {
Preamble Preamble `json:"preamble"`
Timestamp time.Time `json:"timestamp"`
Result Result `json:"result"`
ErrData string `json:"errdata,omitempty"`
}
type Check struct {
ID int64 `json:"id"`
Timestamp time.Time `json:"timestamp"`
CustomerID string `json:"string"`
Active bool `json:"active"`
URI string `json:"uri"`
ReportWebhook string `json:"report_webhook"`
LastResult Result `json:"last_result"`
}