forked from oogway/goptrail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.go
86 lines (74 loc) · 2.35 KB
/
header.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
package goptrail
import "net"
type Client interface {
ListUsers() ([]User, error)
InviteUser(User) error
UpdateUser(User) error
DeleteUser(User) error
ListLogDestinations() ([]LogDestination, error)
RegisterSystem(s InputSystem) (OutputSystem, error)
GetSystem(id string) (*OutputSystem, error)
ListSystems() ([]OutputSystem, error)
UpdateSystem(s InputSystem) error
UnregisterSystem(id string) error
AddSystemToGroup(sID, gID string) error
RemoveSystemFromGroup(sID, gID string) error
CreateGroup(g Group) (Group, error)
GetGroup(id string) (Group, error)
ListGroups() ([]Group, error)
UpdateGroup(g Group) error
DeleteGroup(id string) error
CreateSearch(s Search) (Search, error)
GetSearch(id string) (Search, error)
ListSearch() ([]Search, error)
UpdateSearch(s Search) error
DeleteSearch(id string) error
}
type Search struct {
ID int `json:"id"`
Name string `json:"name"`
Query string `json:"query"`
Group Group `json:"group"`
}
type Group struct {
ID int `json:"id"`
Name string `json:"name"`
SystemWildcard string `json:"system_wildcard"`
Systems []OutputSystem `json:"systems"`
}
type SysLog struct {
Hostname string `json:"hostname"`
Port int `json:"port"`
Description string `json:"description"`
}
type LogDestination struct {
ID int `json:"id"`
Syslog SysLog `json:"syslog"`
}
type User struct {
Email string `json:"email"`
ID int `json:"id"`
ReadOnly int `json:"read_only"`
ManageMembers int `json:"manage_members"`
ManageBilling int `json:"manage_billing"`
PurgeLogs int `json:"purge_logs"`
CanAccessAllGroups int `json:"can_access_all_groups"`
GroupIDs []int `json:"group_ids"`
}
type InputSystem struct {
ID int `json:"id"`
Name string `json:"name"`
IpAddress string `json:"ip_address"`
Hostname string `json:"hostname"`
DestinationID int `json:"destination_id"`
DestinationPort int `json:"destination_port"`
Description string `json:"description"`
}
type OutputSystem struct {
ID int `json:"id"`
Name string `json:"name"`
IpAddress net.IP `json:"ip_address"`
Hostname string `json:"hostname"`
LastEventAt string `json:"last_event_at"`
Syslog SysLog `json:"syslog"`
}