-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstas.go
181 lines (144 loc) · 6.17 KB
/
stas.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
package objects
// THIS FILE IS AUTO GENERATED BY bin/gen.go! DO NOT EDIT!
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Stas is a generated struct representing the Sophos Stas Endpoint
// GET /api/nodes/stas
type Stas struct {
StasCollector StasCollector `json:"stas_collector"`
StasGroup StasGroup `json:"stas_group"`
}
var _ sophos.Endpoint = &Stas{}
var defsStas = map[string]sophos.RestObject{
"StasCollector": &StasCollector{},
"StasGroup": &StasGroup{},
}
// RestObjects implements the sophos.Node interface and returns a map of Stas's Objects
func (Stas) RestObjects() map[string]sophos.RestObject { return defsStas }
// GetPath implements sophos.RestGetter
func (*Stas) GetPath() string { return "/api/nodes/stas" }
// RefRequired implements sophos.RestGetter
func (*Stas) RefRequired() (string, bool) { return "", false }
var defStas = &sophos.Definition{Description: "stas", Name: "stas", Link: "/api/definitions/stas"}
// Definition returns the /api/definitions struct of Stas
func (Stas) Definition() sophos.Definition { return *defStas }
// ApiRoutes returns all known Stas Paths
func (Stas) ApiRoutes() []string {
return []string{
"/api/objects/stas/collector/",
"/api/objects/stas/collector/{ref}",
"/api/objects/stas/collector/{ref}/usedby",
"/api/objects/stas/group/",
"/api/objects/stas/group/{ref}",
"/api/objects/stas/group/{ref}/usedby",
}
}
// References returns the Stas's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Stas) References() []string {
return []string{
"REF_StasCollector",
"REF_StasGroup",
}
}
// StasCollectors is an Sophos Endpoint subType and implements sophos.RestObject
type StasCollectors []StasCollector
// StasCollector represents a UTM STAS Collector
type StasCollector struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
// Host description: REF(network/host), REF(network/dns_host)
Host string `json:"host"`
Name string `json:"name"`
// Port description: REF(service/udp)
// Port default value is "REF_ServiceSTASCollector"
Port string `json:"port"`
}
var _ sophos.RestGetter = &StasCollector{}
// GetPath implements sophos.RestObject and returns the StasCollectors GET path
// Returns all available stas/collector objects
func (*StasCollectors) GetPath() string { return "/api/objects/stas/collector/" }
// RefRequired implements sophos.RestObject
func (*StasCollectors) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the StasCollectors GET path
// Returns all available collector types
func (s *StasCollector) GetPath() string {
return fmt.Sprintf("/api/objects/stas/collector/%s", s.Reference)
}
// RefRequired implements sophos.RestObject
func (s *StasCollector) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the StasCollector DELETE path
// Creates or updates the complete object collector
func (*StasCollector) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/stas/collector/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the StasCollector PATCH path
// Changes to parts of the object collector types
func (*StasCollector) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/stas/collector/%s", ref)
}
// PostPath implements sophos.RestObject and returns the StasCollector POST path
// Create a new stas/collector object
func (*StasCollector) PostPath() string {
return "/api/objects/stas/collector/"
}
// PutPath implements sophos.RestObject and returns the StasCollector PUT path
// Creates or updates the complete object collector
func (*StasCollector) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/stas/collector/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*StasCollector) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/stas/collector/%s/usedby", ref)
}
// StasGroups is an Sophos Endpoint subType and implements sophos.RestObject
type StasGroups []StasGroup
// StasGroup represents a UTM stas->group
type StasGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &StasGroup{}
// GetPath implements sophos.RestObject and returns the StasGroups GET path
// Returns all available stas/group objects
func (*StasGroups) GetPath() string { return "/api/objects/stas/group/" }
// RefRequired implements sophos.RestObject
func (*StasGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the StasGroups GET path
// Returns all available group types
func (s *StasGroup) GetPath() string { return fmt.Sprintf("/api/objects/stas/group/%s", s.Reference) }
// RefRequired implements sophos.RestObject
func (s *StasGroup) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the StasGroup DELETE path
// Creates or updates the complete object group
func (*StasGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/stas/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the StasGroup PATCH path
// Changes to parts of the object group types
func (*StasGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/stas/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the StasGroup POST path
// Create a new stas/group object
func (*StasGroup) PostPath() string {
return "/api/objects/stas/group/"
}
// PutPath implements sophos.RestObject and returns the StasGroup PUT path
// Creates or updates the complete object group
func (*StasGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/stas/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*StasGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/stas/group/%s/usedby", ref)
}