-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathresponses.go
94 lines (75 loc) · 1.52 KB
/
responses.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
86
87
88
89
90
91
92
93
94
package main
import "github.com/reconquest/karma-go"
type Response interface {
Error() error
}
type ResponseRaw struct {
Err struct {
Data string `json:"data"`
Message string `json:"message"`
} `json:"error"`
Result interface{} `json:"result"`
}
func (response *ResponseRaw) Error() error {
if response.Err.Data != "" && response.Err.Message != "" {
return karma.Push(
response.Err.Message,
response.Err.Data,
)
}
return nil
}
type ResponseLogin struct {
ResponseRaw
Token string `json:"result"`
}
type ResponseAPIVersion struct {
ResponseRaw
Version string `json:"result"`
}
type ResponseTriggers struct {
ResponseRaw
Data map[string]Trigger `json:"result"`
}
type ResponseMaintenances struct {
ResponseRaw
Data []Maintenance `json:"result"`
}
// Response Create/Delete maintenance
type ResponseMaintenancesArray struct {
ResponseRaw
Data Maintenances `json:"result"`
}
type ResponseItems struct {
ResponseRaw
Data []Item `json:"result"`
}
type ResponseHTTPTests struct {
ResponseRaw
Data []HTTPTest `json:"result"`
}
type ResponseHosts struct {
ResponseRaw
Data []Host `json:"result"`
}
// Response Create/Delete host
type ResponseHostsArray struct {
ResponseRaw
Data Hosts `json:"result"`
}
type ResponseGroups struct {
ResponseRaw
Data []Group `json:"result"`
}
type ResponseUserGroup struct {
ResponseRaw
Data []UserGroup `json:"result"`
}
type ResponseUsers struct {
ResponseRaw
Data []User `json:"result"`
}
type ResponseHistory struct {
ResponseRaw
Data []History `json:"result"`
}