forked from esurdam/go-sophos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitfparams.go
464 lines (390 loc) · 19 KB
/
itfparams.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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
package objects
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Itfparams is a generated struct representing the Sophos Itfparams Endpoint
// GET /api/nodes/itfparams
type Itfparams struct {
ItfparamsBridgePort ItfparamsBridgePort `json:"itfparams_bridge_port"`
ItfparamsGroup ItfparamsGroup `json:"itfparams_group"`
ItfparamsLinkAggregationGroup ItfparamsLinkAggregationGroup `json:"itfparams_link_aggregation_group"`
ItfparamsPrimary ItfparamsPrimary `json:"itfparams_primary"`
ItfparamsSecondary ItfparamsSecondary `json:"itfparams_secondary"`
}
var _ sophos.Endpoint = &Itfparams{}
var defsItfparams = map[string]sophos.RestObject{
"ItfparamsBridgePort": &ItfparamsBridgePort{},
"ItfparamsGroup": &ItfparamsGroup{},
"ItfparamsLinkAggregationGroup": &ItfparamsLinkAggregationGroup{},
"ItfparamsPrimary": &ItfparamsPrimary{},
"ItfparamsSecondary": &ItfparamsSecondary{},
}
// RestObjects implements the sophos.Node interface and returns a map of Itfparams's Objects
func (Itfparams) RestObjects() map[string]sophos.RestObject { return defsItfparams }
// GetPath implements sophos.RestGetter
func (*Itfparams) GetPath() string { return "/api/nodes/itfparams" }
// RefRequired implements sophos.RestGetter
func (*Itfparams) RefRequired() (string, bool) { return "", false }
var defItfparams = &sophos.Definition{Description: "itfparams", Name: "itfparams", Link: "/api/definitions/itfparams"}
// Definition returns the /api/definitions struct of Itfparams
func (Itfparams) Definition() sophos.Definition { return *defItfparams }
// ApiRoutes returns all known Itfparams Paths
func (Itfparams) ApiRoutes() []string {
return []string{
"/api/objects/itfparams/bridge_port/",
"/api/objects/itfparams/bridge_port/{ref}",
"/api/objects/itfparams/bridge_port/{ref}/usedby",
"/api/objects/itfparams/group/",
"/api/objects/itfparams/group/{ref}",
"/api/objects/itfparams/group/{ref}/usedby",
"/api/objects/itfparams/link_aggregation_group/",
"/api/objects/itfparams/link_aggregation_group/{ref}",
"/api/objects/itfparams/link_aggregation_group/{ref}/usedby",
"/api/objects/itfparams/primary/",
"/api/objects/itfparams/primary/{ref}",
"/api/objects/itfparams/primary/{ref}/usedby",
"/api/objects/itfparams/secondary/",
"/api/objects/itfparams/secondary/{ref}",
"/api/objects/itfparams/secondary/{ref}/usedby",
}
}
// References returns the Itfparams's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Itfparams) References() []string {
return []string{
"REF_ItfparamsBridgePort",
"REF_ItfparamsGroup",
"REF_ItfparamsLinkAggregationGroup",
"REF_ItfparamsPrimary",
"REF_ItfparamsSecondary",
}
}
// ItfparamsBridgePorts is an Sophos Endpoint subType and implements sophos.RestObject
type ItfparamsBridgePorts []ItfparamsBridgePort
// ItfparamsBridgePort represents a UTM bridge port
type ItfparamsBridgePort struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
// Itfhw description: REF(itfhw/ethernet), REF(itfhw/red_server), REF(itfhw/red_client), REF(itfhw/awe_network), REF(itfhw/lag)
Itfhw string `json:"itfhw"`
Name string `json:"name"`
// Status default value is true
Status bool `json:"status"`
StpPathcost int `json:"stp_pathcost"`
StpPortprio int `json:"stp_portprio"`
}
var _ sophos.RestGetter = &ItfparamsBridgePort{}
// GetPath implements sophos.RestObject and returns the ItfparamsBridgePorts GET path
// Returns all available itfparams/bridge_port objects
func (*ItfparamsBridgePorts) GetPath() string { return "/api/objects/itfparams/bridge_port/" }
// RefRequired implements sophos.RestObject
func (*ItfparamsBridgePorts) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ItfparamsBridgePorts GET path
// Returns all available bridge_port types
func (i *ItfparamsBridgePort) GetPath() string {
return fmt.Sprintf("/api/objects/itfparams/bridge_port/%s", i.Reference)
}
// RefRequired implements sophos.RestObject
func (i *ItfparamsBridgePort) RefRequired() (string, bool) { return i.Reference, true }
// DeletePath implements sophos.RestObject and returns the ItfparamsBridgePort DELETE path
// Creates or updates the complete object bridge_port
func (*ItfparamsBridgePort) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/bridge_port/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ItfparamsBridgePort PATCH path
// Changes to parts of the object bridge_port types
func (*ItfparamsBridgePort) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/bridge_port/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ItfparamsBridgePort POST path
// Create a new itfparams/bridge_port object
func (*ItfparamsBridgePort) PostPath() string {
return "/api/objects/itfparams/bridge_port/"
}
// PutPath implements sophos.RestObject and returns the ItfparamsBridgePort PUT path
// Creates or updates the complete object bridge_port
func (*ItfparamsBridgePort) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/bridge_port/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ItfparamsBridgePort) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/bridge_port/%s/usedby", ref)
}
// ItfparamsGroups is an Sophos Endpoint subType and implements sophos.RestObject
type ItfparamsGroups []ItfparamsGroup
// ItfparamsGroup represents a UTM group
type ItfparamsGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &ItfparamsGroup{}
// GetPath implements sophos.RestObject and returns the ItfparamsGroups GET path
// Returns all available itfparams/group objects
func (*ItfparamsGroups) GetPath() string { return "/api/objects/itfparams/group/" }
// RefRequired implements sophos.RestObject
func (*ItfparamsGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ItfparamsGroups GET path
// Returns all available group types
func (i *ItfparamsGroup) GetPath() string {
return fmt.Sprintf("/api/objects/itfparams/group/%s", i.Reference)
}
// RefRequired implements sophos.RestObject
func (i *ItfparamsGroup) RefRequired() (string, bool) { return i.Reference, true }
// DeletePath implements sophos.RestObject and returns the ItfparamsGroup DELETE path
// Creates or updates the complete object group
func (*ItfparamsGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ItfparamsGroup PATCH path
// Changes to parts of the object group types
func (*ItfparamsGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ItfparamsGroup POST path
// Create a new itfparams/group object
func (*ItfparamsGroup) PostPath() string {
return "/api/objects/itfparams/group/"
}
// PutPath implements sophos.RestObject and returns the ItfparamsGroup PUT path
// Creates or updates the complete object group
func (*ItfparamsGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ItfparamsGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/group/%s/usedby", ref)
}
// ItfparamsLinkAggregationGroups is an Sophos Endpoint subType and implements sophos.RestObject
type ItfparamsLinkAggregationGroups []ItfparamsLinkAggregationGroup
// ItfparamsLinkAggregationGroup is a generated Sophos object
type ItfparamsLinkAggregationGroup struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
AdSelect int64 `json:"ad_select"`
ArpInterval int64 `json:"arp_interval"`
ArpIPTarget string `json:"arp_ip_target"`
Comment string `json:"comment"`
Downdelay int64 `json:"downdelay"`
EnforceMac bool `json:"enforce_mac"`
ID int64 `json:"id"`
Itfhw []string `json:"itfhw"`
LacpRate int64 `json:"lacp_rate"`
Mac string `json:"mac"`
Miimon int64 `json:"miimon"`
Mode int64 `json:"mode"`
Name string `json:"name"`
Primary string `json:"primary"`
Status bool `json:"status"`
Updelay int64 `json:"updelay"`
UseCarrier bool `json:"use_carrier"`
VirtualMac string `json:"virtual_mac"`
XmitHashPolicy string `json:"xmit_hash_policy"`
}
var _ sophos.RestGetter = &ItfparamsLinkAggregationGroup{}
// GetPath implements sophos.RestObject and returns the ItfparamsLinkAggregationGroups GET path
// Returns all available itfparams/link_aggregation_group objects
func (*ItfparamsLinkAggregationGroups) GetPath() string {
return "/api/objects/itfparams/link_aggregation_group/"
}
// RefRequired implements sophos.RestObject
func (*ItfparamsLinkAggregationGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ItfparamsLinkAggregationGroups GET path
// Returns all available link_aggregation_group types
func (i *ItfparamsLinkAggregationGroup) GetPath() string {
return fmt.Sprintf("/api/objects/itfparams/link_aggregation_group/%s", i.Reference)
}
// RefRequired implements sophos.RestObject
func (i *ItfparamsLinkAggregationGroup) RefRequired() (string, bool) { return i.Reference, true }
// DeletePath implements sophos.RestObject and returns the ItfparamsLinkAggregationGroup DELETE path
// Creates or updates the complete object link_aggregation_group
func (*ItfparamsLinkAggregationGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/link_aggregation_group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ItfparamsLinkAggregationGroup PATCH path
// Changes to parts of the object link_aggregation_group types
func (*ItfparamsLinkAggregationGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/link_aggregation_group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ItfparamsLinkAggregationGroup POST path
// Create a new itfparams/link_aggregation_group object
func (*ItfparamsLinkAggregationGroup) PostPath() string {
return "/api/objects/itfparams/link_aggregation_group/"
}
// PutPath implements sophos.RestObject and returns the ItfparamsLinkAggregationGroup PUT path
// Creates or updates the complete object link_aggregation_group
func (*ItfparamsLinkAggregationGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/link_aggregation_group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ItfparamsLinkAggregationGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/link_aggregation_group/%s/usedby", ref)
}
// GetType implements sophos.Object
func (i *ItfparamsLinkAggregationGroup) GetType() string { return i.ObjectType }
// ItfparamsPrimarys is an Sophos Endpoint subType and implements sophos.RestObject
type ItfparamsPrimarys []ItfparamsPrimary
// ItfparamsPrimary is a generated Sophos object
type ItfparamsPrimary struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
Address string `json:"address"`
Address6 string `json:"address6"`
Comment string `json:"comment"`
DefaultGatewayAddress string `json:"default_gateway_address"`
DefaultGatewayAddress6 string `json:"default_gateway_address6"`
DefaultGatewayStatus bool `json:"default_gateway_status"`
DefaultGatewayStatus6 bool `json:"default_gateway_status6"`
Dhcpv6RapidCommit bool `json:"dhcpv6_rapid_commit"`
DNSServer1 string `json:"dns_server_1"`
DNSServer2 string `json:"dns_server_2"`
DNSServer3 string `json:"dns_server_3"`
DNSServer4 string `json:"dns_server_4"`
GatewayType string `json:"gateway_type"`
GatewayType6 string `json:"gateway_type6"`
Hostname string `json:"hostname"`
InterfaceAddress string `json:"interface_address"`
InterfaceBroadcast string `json:"interface_broadcast"`
InterfaceNetwork string `json:"interface_network"`
Name string `json:"name"`
Netmask int64 `json:"netmask"`
Netmask6 int64 `json:"netmask6"`
PdAddress6 string `json:"pd_address6"`
PdNetmask6 int64 `json:"pd_netmask6"`
PdResolved6 bool `json:"pd_resolved6"`
Resolved bool `json:"resolved"`
Resolved6 bool `json:"resolved6"`
Six2four bool `json:"six2four"`
Type string `json:"type"`
Type6 string `json:"type6"`
}
var _ sophos.RestGetter = &ItfparamsPrimary{}
// GetPath implements sophos.RestObject and returns the ItfparamsPrimarys GET path
// Returns all available itfparams/primary objects
func (*ItfparamsPrimarys) GetPath() string { return "/api/objects/itfparams/primary/" }
// RefRequired implements sophos.RestObject
func (*ItfparamsPrimarys) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ItfparamsPrimarys GET path
// Returns all available primary types
func (i *ItfparamsPrimary) GetPath() string {
return fmt.Sprintf("/api/objects/itfparams/primary/%s", i.Reference)
}
// RefRequired implements sophos.RestObject
func (i *ItfparamsPrimary) RefRequired() (string, bool) { return i.Reference, true }
// DeletePath implements sophos.RestObject and returns the ItfparamsPrimary DELETE path
// Creates or updates the complete object primary
func (*ItfparamsPrimary) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/primary/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ItfparamsPrimary PATCH path
// Changes to parts of the object primary types
func (*ItfparamsPrimary) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/primary/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ItfparamsPrimary POST path
// Create a new itfparams/primary object
func (*ItfparamsPrimary) PostPath() string {
return "/api/objects/itfparams/primary/"
}
// PutPath implements sophos.RestObject and returns the ItfparamsPrimary PUT path
// Creates or updates the complete object primary
func (*ItfparamsPrimary) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/primary/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ItfparamsPrimary) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/primary/%s/usedby", ref)
}
// GetType implements sophos.Object
func (i *ItfparamsPrimary) GetType() string { return i.ObjectType }
// ItfparamsSecondarys is an Sophos Endpoint subType and implements sophos.RestObject
type ItfparamsSecondarys []ItfparamsSecondary
// ItfparamsSecondary represents a UTM additional interface address
type ItfparamsSecondary struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
// Address6 description: (IP6ADDR)
// Address6 default value is ""
Address6 string `json:"address6"`
Comment string `json:"comment"`
// Id default value is ""
Id string `json:"id"`
Netmask int `json:"netmask"`
Netmask6 int `json:"netmask6"`
// Resolved6 default value is false
Resolved6 bool `json:"resolved6"`
// Type6 can be one of: []string{"static"}
// Type6 default value is "static"
Type6 string `json:"type6"`
// InterfaceAddress description: REF(network/interface_address)
// InterfaceAddress default value is ""
InterfaceAddress string `json:"interface_address"`
Name string `json:"name"`
HaNode int `json:"ha_node"`
// Resolved default value is false
Resolved bool `json:"resolved"`
// Address description: (IPADDR)
// Address default value is "0.0.0.0"
Address string `json:"address"`
// InterfaceBroadcast description: REF(network/interface_broadcast)
// InterfaceBroadcast default value is ""
InterfaceBroadcast string `json:"interface_broadcast"`
// InterfaceNetwork description: REF(network/interface_network)
// InterfaceNetwork default value is ""
InterfaceNetwork string `json:"interface_network"`
// Status default value is false
Status bool `json:"status"`
// Type can be one of: []string{"static"}
// Type default value is "static"
Type string `json:"type"`
}
var _ sophos.RestGetter = &ItfparamsSecondary{}
// GetPath implements sophos.RestObject and returns the ItfparamsSecondarys GET path
// Returns all available itfparams/secondary objects
func (*ItfparamsSecondarys) GetPath() string { return "/api/objects/itfparams/secondary/" }
// RefRequired implements sophos.RestObject
func (*ItfparamsSecondarys) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ItfparamsSecondarys GET path
// Returns all available secondary types
func (i *ItfparamsSecondary) GetPath() string {
return fmt.Sprintf("/api/objects/itfparams/secondary/%s", i.Reference)
}
// RefRequired implements sophos.RestObject
func (i *ItfparamsSecondary) RefRequired() (string, bool) { return i.Reference, true }
// DeletePath implements sophos.RestObject and returns the ItfparamsSecondary DELETE path
// Creates or updates the complete object secondary
func (*ItfparamsSecondary) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/secondary/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ItfparamsSecondary PATCH path
// Changes to parts of the object secondary types
func (*ItfparamsSecondary) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/secondary/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ItfparamsSecondary POST path
// Create a new itfparams/secondary object
func (*ItfparamsSecondary) PostPath() string {
return "/api/objects/itfparams/secondary/"
}
// PutPath implements sophos.RestObject and returns the ItfparamsSecondary PUT path
// Creates or updates the complete object secondary
func (*ItfparamsSecondary) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/secondary/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ItfparamsSecondary) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/itfparams/secondary/%s/usedby", ref)
}