-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathospf.go
336 lines (275 loc) · 12.6 KB
/
ospf.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
package objects
// THIS FILE IS AUTO GENERATED BY bin/gen.go! DO NOT EDIT!
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Ospf is a generated struct representing the Sophos Ospf Endpoint
// GET /api/nodes/ospf
type Ospf struct {
OspfArea OspfArea `json:"ospf_area"`
OspfGroup OspfGroup `json:"ospf_group"`
OspfInterface OspfInterface `json:"ospf_interface"`
OspfMessageDigestKey OspfMessageDigestKey `json:"ospf_message_digest_key"`
}
var _ sophos.Endpoint = &Ospf{}
var defsOspf = map[string]sophos.RestObject{
"OspfArea": &OspfArea{},
"OspfGroup": &OspfGroup{},
"OspfInterface": &OspfInterface{},
"OspfMessageDigestKey": &OspfMessageDigestKey{},
}
// RestObjects implements the sophos.Node interface and returns a map of Ospf's Objects
func (Ospf) RestObjects() map[string]sophos.RestObject { return defsOspf }
// GetPath implements sophos.RestGetter
func (*Ospf) GetPath() string { return "/api/nodes/ospf" }
// RefRequired implements sophos.RestGetter
func (*Ospf) RefRequired() (string, bool) { return "", false }
var defOspf = &sophos.Definition{Description: "ospf", Name: "ospf", Link: "/api/definitions/ospf"}
// Definition returns the /api/definitions struct of Ospf
func (Ospf) Definition() sophos.Definition { return *defOspf }
// ApiRoutes returns all known Ospf Paths
func (Ospf) ApiRoutes() []string {
return []string{
"/api/objects/ospf/area/",
"/api/objects/ospf/area/{ref}",
"/api/objects/ospf/area/{ref}/usedby",
"/api/objects/ospf/group/",
"/api/objects/ospf/group/{ref}",
"/api/objects/ospf/group/{ref}/usedby",
"/api/objects/ospf/interface/",
"/api/objects/ospf/interface/{ref}",
"/api/objects/ospf/interface/{ref}/usedby",
"/api/objects/ospf/message_digest_key/",
"/api/objects/ospf/message_digest_key/{ref}",
"/api/objects/ospf/message_digest_key/{ref}/usedby",
}
}
// References returns the Ospf's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Ospf) References() []string {
return []string{
"REF_OspfArea",
"REF_OspfGroup",
"REF_OspfInterface",
"REF_OspfMessageDigestKey",
}
}
// OspfAreas is an Sophos Endpoint subType and implements sophos.RestObject
type OspfAreas []OspfArea
// OspfArea represents a UTM OSPF area
type OspfArea struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
// Authentication can be one of: []string{"message-digest", "plain-text", "null"}
Authentication string `json:"authentication"`
Comment string `json:"comment"`
DefaultCost int `json:"default_cost"`
// Id description: (IPADDR)
Id string `json:"id"`
Interfaces []string `json:"interfaces"`
Name string `json:"name"`
// Type can be one of: []string{"normal", "stub", "nssa", "stub no-summary", "nssa no-summary"}
// Type default value is "normal"
Type string `json:"type"`
VirtualLinks []string `json:"virtual_links"`
}
var _ sophos.RestGetter = &OspfArea{}
// GetPath implements sophos.RestObject and returns the OspfAreas GET path
// Returns all available ospf/area objects
func (*OspfAreas) GetPath() string { return "/api/objects/ospf/area/" }
// RefRequired implements sophos.RestObject
func (*OspfAreas) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the OspfAreas GET path
// Returns all available area types
func (o *OspfArea) GetPath() string { return fmt.Sprintf("/api/objects/ospf/area/%s", o.Reference) }
// RefRequired implements sophos.RestObject
func (o *OspfArea) RefRequired() (string, bool) { return o.Reference, true }
// DeletePath implements sophos.RestObject and returns the OspfArea DELETE path
// Creates or updates the complete object area
func (*OspfArea) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/area/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the OspfArea PATCH path
// Changes to parts of the object area types
func (*OspfArea) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/area/%s", ref)
}
// PostPath implements sophos.RestObject and returns the OspfArea POST path
// Create a new ospf/area object
func (*OspfArea) PostPath() string {
return "/api/objects/ospf/area/"
}
// PutPath implements sophos.RestObject and returns the OspfArea PUT path
// Creates or updates the complete object area
func (*OspfArea) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/area/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*OspfArea) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/area/%s/usedby", ref)
}
// OspfGroups is an Sophos Endpoint subType and implements sophos.RestObject
type OspfGroups []OspfGroup
// OspfGroup represents a UTM group
type OspfGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &OspfGroup{}
// GetPath implements sophos.RestObject and returns the OspfGroups GET path
// Returns all available ospf/group objects
func (*OspfGroups) GetPath() string { return "/api/objects/ospf/group/" }
// RefRequired implements sophos.RestObject
func (*OspfGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the OspfGroups GET path
// Returns all available group types
func (o *OspfGroup) GetPath() string { return fmt.Sprintf("/api/objects/ospf/group/%s", o.Reference) }
// RefRequired implements sophos.RestObject
func (o *OspfGroup) RefRequired() (string, bool) { return o.Reference, true }
// DeletePath implements sophos.RestObject and returns the OspfGroup DELETE path
// Creates or updates the complete object group
func (*OspfGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the OspfGroup PATCH path
// Changes to parts of the object group types
func (*OspfGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the OspfGroup POST path
// Create a new ospf/group object
func (*OspfGroup) PostPath() string {
return "/api/objects/ospf/group/"
}
// PutPath implements sophos.RestObject and returns the OspfGroup PUT path
// Creates or updates the complete object group
func (*OspfGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*OspfGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/group/%s/usedby", ref)
}
// OspfInterfaces is an Sophos Endpoint subType and implements sophos.RestObject
type OspfInterfaces []OspfInterface
// OspfInterface represents a UTM OSPF interface
type OspfInterface struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
// Authentication can be one of: []string{"message-digest", "plain-text", "null"}
Authentication string `json:"authentication"`
// AuthenticationKey description: (REGEX)
AuthenticationKey string `json:"authentication_key"`
Comment string `json:"comment"`
Cost int `json:"cost"`
// DeadInterval description: Constraints: 0, 1-65535
DeadInterval int `json:"dead_interval"`
// HelloInterval description: Constraints: 0, 1-65535
HelloInterval int `json:"hello_interval"`
// Interface description: REF(interface/*)
Interface string `json:"interface"`
MessageDigestKeys []string `json:"message_digest_keys"`
Name string `json:"name"`
Priority int `json:"priority"`
// RetransmitInterval description: Constraints: 0, 3-65535
RetransmitInterval int `json:"retransmit_interval"`
// TransmitDelay description: Constraints: 0, 1-65535
TransmitDelay int `json:"transmit_delay"`
}
var _ sophos.RestGetter = &OspfInterface{}
// GetPath implements sophos.RestObject and returns the OspfInterfaces GET path
// Returns all available ospf/interface objects
func (*OspfInterfaces) GetPath() string { return "/api/objects/ospf/interface/" }
// RefRequired implements sophos.RestObject
func (*OspfInterfaces) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the OspfInterfaces GET path
// Returns all available interface types
func (o *OspfInterface) GetPath() string {
return fmt.Sprintf("/api/objects/ospf/interface/%s", o.Reference)
}
// RefRequired implements sophos.RestObject
func (o *OspfInterface) RefRequired() (string, bool) { return o.Reference, true }
// DeletePath implements sophos.RestObject and returns the OspfInterface DELETE path
// Creates or updates the complete object interface
func (*OspfInterface) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/interface/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the OspfInterface PATCH path
// Changes to parts of the object interface types
func (*OspfInterface) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/interface/%s", ref)
}
// PostPath implements sophos.RestObject and returns the OspfInterface POST path
// Create a new ospf/interface object
func (*OspfInterface) PostPath() string {
return "/api/objects/ospf/interface/"
}
// PutPath implements sophos.RestObject and returns the OspfInterface PUT path
// Creates or updates the complete object interface
func (*OspfInterface) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/interface/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*OspfInterface) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/interface/%s/usedby", ref)
}
// OspfMessageDigestKeys is an Sophos Endpoint subType and implements sophos.RestObject
type OspfMessageDigestKeys []OspfMessageDigestKey
// OspfMessageDigestKey represents a UTM OSPF message digest key
type OspfMessageDigestKey struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
// MessageDigestKey description: (REGEX)
MessageDigestKey string `json:"message_digest_key"`
MessageDigestKeyId int `json:"message_digest_key_id"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &OspfMessageDigestKey{}
// GetPath implements sophos.RestObject and returns the OspfMessageDigestKeys GET path
// Returns all available ospf/message_digest_key objects
func (*OspfMessageDigestKeys) GetPath() string { return "/api/objects/ospf/message_digest_key/" }
// RefRequired implements sophos.RestObject
func (*OspfMessageDigestKeys) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the OspfMessageDigestKeys GET path
// Returns all available message_digest_key types
func (o *OspfMessageDigestKey) GetPath() string {
return fmt.Sprintf("/api/objects/ospf/message_digest_key/%s", o.Reference)
}
// RefRequired implements sophos.RestObject
func (o *OspfMessageDigestKey) RefRequired() (string, bool) { return o.Reference, true }
// DeletePath implements sophos.RestObject and returns the OspfMessageDigestKey DELETE path
// Creates or updates the complete object message_digest_key
func (*OspfMessageDigestKey) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/message_digest_key/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the OspfMessageDigestKey PATCH path
// Changes to parts of the object message_digest_key types
func (*OspfMessageDigestKey) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/message_digest_key/%s", ref)
}
// PostPath implements sophos.RestObject and returns the OspfMessageDigestKey POST path
// Create a new ospf/message_digest_key object
func (*OspfMessageDigestKey) PostPath() string {
return "/api/objects/ospf/message_digest_key/"
}
// PutPath implements sophos.RestObject and returns the OspfMessageDigestKey PUT path
// Creates or updates the complete object message_digest_key
func (*OspfMessageDigestKey) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/message_digest_key/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*OspfMessageDigestKey) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ospf/message_digest_key/%s/usedby", ref)
}