-
Notifications
You must be signed in to change notification settings - Fork 1
/
report.go
85 lines (72 loc) · 1.76 KB
/
report.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package report
import (
"time"
"github.com/gofrs/uuid"
)
// Report is a structure that represents the state of all checks, services, teams, hosts, at a given round(typically last round).
// The report strips out all of the unnecessary details from the checks, and forwards the generated output to the client. The API can additionally perform
// any sorts of filtering on the report in case it needs to (Ex: Hiding sensitive details of team blue2 from team blue1's users)
type Report struct {
ID uint64 `json:"id,omitempty"`
Cache string `json:"cache,omitempty" gorm:"not null;default:'{}'"`
UpdatedAt time.Time `json:"updated_at"`
}
func (d Report) TableName() string {
return "report"
}
func NewReport() *Report {
c := &Report{}
c.ID = 1
c.Cache = "{}"
return c
}
type SimpleReport struct {
Round uint64
Teams map[uuid.UUID]*SimpleTeam
}
type SimpleTeam struct {
Hosts map[uuid.UUID]*SimpleHost
Name string
Pause bool
Hide bool
TotalPoints uint64
}
type SimpleHostGroup struct {
ID uuid.UUID
Name string
Pause bool
Hide bool
}
type SimpleHost struct {
HostGroup *SimpleHostGroup
Address string
Services map[uuid.UUID]*SimpleService
Pause bool
Hide bool
}
type SimpleServiceGroup struct {
ID uuid.UUID
Name string
Enabled bool
}
type SimpleCheck struct {
Passed bool
Log string
Err string
}
type SimpleService struct {
Check *SimpleCheck
Pause bool
Hide bool
Name string
DisplayName string
Weight uint64
Points uint64
PointsBoost uint64
Properties map[string]*SimpleProperty
SimpleServiceGroup *SimpleServiceGroup
}
type SimpleProperty struct {
Value string
Status string
}