-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathawe.go
566 lines (493 loc) · 20.6 KB
/
awe.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
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
package objects
// THIS FILE IS AUTO GENERATED BY bin/gen.go! DO NOT EDIT!
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Awe is a generated struct representing the Sophos Awe Endpoint
// GET /api/nodes/awe
type Awe struct {
AllowedInterfaces []string `json:"allowed_interfaces"`
Clients []interface{} `json:"clients"`
Devices []interface{} `json:"devices"`
Global struct {
ApAutoaccept int64 `json:"ap_autoaccept"`
ApDebuglevel int64 `json:"ap_debuglevel"`
ApSoftlimit int64 `json:"ap_softlimit"`
ApVlantag int64 `json:"ap_vlantag"`
AweStatus int64 `json:"awe_status"`
BridgeUpdateKickout int64 `json:"bridge_update_kickout"`
InitialSetup int64 `json:"initial_setup"`
LogLevel int64 `json:"log_level"`
MagicIP string `json:"magic_ip"`
MultiWifiIfaceBr int64 `json:"multi_wifi_iface_br"`
NotificationTimeout int64 `json:"notification_timeout"`
RadiusConf string `json:"radius_conf"`
Rootpw string `json:"rootpw"`
StayOnline int64 `json:"stay_online"`
StoreBssStats int64 `json:"store_bss_stats"`
TunnelIDOffset int64 `json:"tunnel_id_offset"`
Vlantagging int64 `json:"vlantagging"`
} `json:"global"`
Networks []interface{} `json:"networks"`
}
var _ sophos.Endpoint = &Awe{}
var defsAwe = map[string]sophos.RestObject{
"AweClient": &AweClient{},
"AweDevice": &AweDevice{},
"AweGroup": &AweGroup{},
"AweLocal": &AweLocal{},
"AweRed": &AweRed{},
}
// RestObjects implements the sophos.Node interface and returns a map of Awe's Objects
func (Awe) RestObjects() map[string]sophos.RestObject { return defsAwe }
// GetPath implements sophos.RestGetter
func (*Awe) GetPath() string { return "/api/nodes/awe" }
// RefRequired implements sophos.RestGetter
func (*Awe) RefRequired() (string, bool) { return "", false }
var defAwe = &sophos.Definition{Description: "awe", Name: "awe", Link: "/api/definitions/awe"}
// Definition returns the /api/definitions struct of Awe
func (Awe) Definition() sophos.Definition { return *defAwe }
// ApiRoutes returns all known Awe Paths
func (Awe) ApiRoutes() []string {
return []string{
"/api/objects/awe/client/",
"/api/objects/awe/client/{ref}",
"/api/objects/awe/client/{ref}/usedby",
"/api/objects/awe/device/",
"/api/objects/awe/device/{ref}",
"/api/objects/awe/device/{ref}/usedby",
"/api/objects/awe/group/",
"/api/objects/awe/group/{ref}",
"/api/objects/awe/group/{ref}/usedby",
"/api/objects/awe/local/",
"/api/objects/awe/local/{ref}",
"/api/objects/awe/local/{ref}/usedby",
"/api/objects/awe/red/",
"/api/objects/awe/red/{ref}",
"/api/objects/awe/red/{ref}/usedby",
}
}
// References returns the Awe's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Awe) References() []string {
return []string{
"REF_AweClient",
"REF_AweDevice",
"REF_AweGroup",
"REF_AweLocal",
"REF_AweRed",
}
}
// AweClients is an Sophos Endpoint subType and implements sophos.RestObject
type AweClients []AweClient
// AweClient represents a UTM wireless client
type AweClient struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Lastseen int `json:"lastseen"`
// Mac description: (MACADDR)
// Mac default value is "00:00:00:00:00:00"
Mac string `json:"mac"`
Name string `json:"name"`
// Vendor default value is "unknown"
Vendor string `json:"vendor"`
}
var _ sophos.RestGetter = &AweClient{}
// GetPath implements sophos.RestObject and returns the AweClients GET path
// Returns all available awe/client objects
func (*AweClients) GetPath() string { return "/api/objects/awe/client/" }
// RefRequired implements sophos.RestObject
func (*AweClients) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AweClients GET path
// Returns all available client types
func (a *AweClient) GetPath() string { return fmt.Sprintf("/api/objects/awe/client/%s", a.Reference) }
// RefRequired implements sophos.RestObject
func (a *AweClient) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AweClient DELETE path
// Creates or updates the complete object client
func (*AweClient) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/awe/client/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AweClient PATCH path
// Changes to parts of the object client types
func (*AweClient) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/client/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AweClient POST path
// Create a new awe/client object
func (*AweClient) PostPath() string {
return "/api/objects/awe/client/"
}
// PutPath implements sophos.RestObject and returns the AweClient PUT path
// Creates or updates the complete object client
func (*AweClient) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/client/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AweClient) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/client/%s/usedby", ref)
}
// AweDevices is an Sophos Endpoint subType and implements sophos.RestObject
type AweDevices []AweDevice
// AweDevice represents a UTM wireless access point
type AweDevice struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
// AcAbility default value is false
AcAbility bool `json:"ac_ability"`
AllowedCountries []string `json:"allowed_countries"`
ApLocaldebuglevel int `json:"ap_localdebuglevel"`
ApVlantag int `json:"ap_vlantag"`
AutoChannel int `json:"auto_channel"`
AutoChannel11A int `json:"auto_channel11a"`
// Band can be one of: []string{"g", "a"}
// Band default value is "g"
Band string `json:"band"`
BridgeModes []string `json:"bridge_modes"`
Channel int `json:"channel"`
Channel11A int `json:"channel11a"`
// ChannelWidth can be one of: []string{"HT20", "HT40"}
// ChannelWidth default value is "HT20"
ChannelWidth string `json:"channel_width"`
// ChannelWidth11A can be one of: []string{"HT20", "HT40", "VHT20", "VHT40", "VHT80"}
// ChannelWidth11A default value is "HT20"
ChannelWidth11A string `json:"channel_width11a"`
Comment string `json:"comment"`
// Country description: (REGEX)
// Country default value is ""
Country string `json:"country"`
// DfsAbility default value is false
DfsAbility bool `json:"dfs_ability"`
// Enabled default value is false
Enabled bool `json:"enabled"`
// Id default value is "Remote Wifi Device"
Id string `json:"id"`
// Interface description: REF(interface/*)
// Interface default value is ""
Interface string `json:"interface"`
// Key default value is ""
Key string `json:"key"`
// LanMac description: (MACADDR)
// LanMac default value is "00:00:00:00:00:00"
LanMac string `json:"lan_mac"`
// LastIp description: (IPADDR)
// LastIp default value is ""
LastIp string `json:"last_ip"`
// Location default value is ""
Location string `json:"location"`
MaxSsids int `json:"max_ssids"`
// MeshAbility default value is false
MeshAbility bool `json:"mesh_ability"`
// MeshAbility11A default value is false
MeshAbility11A bool `json:"mesh_ability11a"`
// MeshAbility11G default value is false
MeshAbility11G bool `json:"mesh_ability11g"`
Name string `json:"name"`
Networks []string `json:"networks"`
// R0KhSecret default value is ""
R0KhSecret string `json:"r0kh_secret"`
ScanInterval int `json:"scan_interval"`
ScanInterval11A int `json:"scan_interval11a"`
SchedScanInterval int `json:"sched_scan_interval"`
SchedScanInterval11A int `json:"sched_scan_interval11a"`
// Status default value is false
Status bool `json:"status"`
// Stp default value is false
Stp bool `json:"stp"`
TcpmssClamping int `json:"tcpmss_clamping"`
// TimeScheduling default value is false
TimeScheduling bool `json:"time_scheduling"`
// TimeScheduling11A default value is false
TimeScheduling11A bool `json:"time_scheduling11a"`
TimeSelect []string `json:"time_select"`
TimeSelect11A []string `json:"time_select11a"`
// TunnelId default value is ""
TunnelId string `json:"tunnel_id"`
// TxPowerControl default value is false
TxPowerControl bool `json:"tx_power_control"`
Txpower int `json:"txpower"`
Txpower11A int `json:"txpower11a"`
// Type default value is ""
Type string `json:"type"`
// Vlantagging default value is false
Vlantagging bool `json:"vlantagging"`
// WifiMac description: (MACADDR)
// WifiMac default value is "00:00:00:00:00:00"
WifiMac string `json:"wifi_mac"`
}
var _ sophos.RestGetter = &AweDevice{}
// GetPath implements sophos.RestObject and returns the AweDevices GET path
// Returns all available awe/device objects
func (*AweDevices) GetPath() string { return "/api/objects/awe/device/" }
// RefRequired implements sophos.RestObject
func (*AweDevices) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AweDevices GET path
// Returns all available device types
func (a *AweDevice) GetPath() string { return fmt.Sprintf("/api/objects/awe/device/%s", a.Reference) }
// RefRequired implements sophos.RestObject
func (a *AweDevice) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AweDevice DELETE path
// Creates or updates the complete object device
func (*AweDevice) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/awe/device/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AweDevice PATCH path
// Changes to parts of the object device types
func (*AweDevice) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/device/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AweDevice POST path
// Create a new awe/device object
func (*AweDevice) PostPath() string {
return "/api/objects/awe/device/"
}
// PutPath implements sophos.RestObject and returns the AweDevice PUT path
// Creates or updates the complete object device
func (*AweDevice) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/device/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AweDevice) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/device/%s/usedby", ref)
}
// AweGroups is an Sophos Endpoint subType and implements sophos.RestObject
type AweGroups []AweGroup
// AweGroup represents a UTM group
type AweGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &AweGroup{}
// GetPath implements sophos.RestObject and returns the AweGroups GET path
// Returns all available awe/group objects
func (*AweGroups) GetPath() string { return "/api/objects/awe/group/" }
// RefRequired implements sophos.RestObject
func (*AweGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AweGroups GET path
// Returns all available group types
func (a *AweGroup) GetPath() string { return fmt.Sprintf("/api/objects/awe/group/%s", a.Reference) }
// RefRequired implements sophos.RestObject
func (a *AweGroup) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AweGroup DELETE path
// Creates or updates the complete object group
func (*AweGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/awe/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AweGroup PATCH path
// Changes to parts of the object group types
func (*AweGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AweGroup POST path
// Create a new awe/group object
func (*AweGroup) PostPath() string {
return "/api/objects/awe/group/"
}
// PutPath implements sophos.RestObject and returns the AweGroup PUT path
// Creates or updates the complete object group
func (*AweGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AweGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/group/%s/usedby", ref)
}
// AweLocals is an Sophos Endpoint subType and implements sophos.RestObject
type AweLocals []AweLocal
// AweLocal represents a UTM SG wifi
type AweLocal struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
ApLocaldebuglevel int `json:"ap_localdebuglevel"`
AutoChannel int `json:"auto_channel"`
// Band can be one of: []string{"g", "a"}
// Band default value is "g"
Band string `json:"band"`
BridgeModes []string `json:"bridge_modes"`
Channel int `json:"channel"`
Comment string `json:"comment"`
// DfsAbility default value is false
DfsAbility bool `json:"dfs_ability"`
// Id default value is "Remote Wifi Device"
Id string `json:"id"`
MaxSsids int `json:"max_ssids"`
// MeshAbility default value is false
MeshAbility bool `json:"mesh_ability"`
// MeshAbility11A default value is false
MeshAbility11A bool `json:"mesh_ability11a"`
// MeshAbility11G default value is false
MeshAbility11G bool `json:"mesh_ability11g"`
Name string `json:"name"`
Networks []string `json:"networks"`
ScanInterval int `json:"scan_interval"`
SchedScanInterval int `json:"sched_scan_interval"`
// Status default value is false
Status bool `json:"status"`
// TimeScheduling default value is false
TimeScheduling bool `json:"time_scheduling"`
TimeSelect []string `json:"time_select"`
// TxPowerControl default value is false
TxPowerControl bool `json:"tx_power_control"`
Txpower int `json:"txpower"`
// Type default value is ""
Type string `json:"type"`
// WifiMac description: (MACADDR)
// WifiMac default value is "00:00:00:00:00:00"
WifiMac string `json:"wifi_mac"`
}
var _ sophos.RestGetter = &AweLocal{}
// GetPath implements sophos.RestObject and returns the AweLocals GET path
// Returns all available awe/local objects
func (*AweLocals) GetPath() string { return "/api/objects/awe/local/" }
// RefRequired implements sophos.RestObject
func (*AweLocals) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AweLocals GET path
// Returns all available local types
func (a *AweLocal) GetPath() string { return fmt.Sprintf("/api/objects/awe/local/%s", a.Reference) }
// RefRequired implements sophos.RestObject
func (a *AweLocal) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AweLocal DELETE path
// Creates or updates the complete object local
func (*AweLocal) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/awe/local/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AweLocal PATCH path
// Changes to parts of the object local types
func (*AweLocal) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/local/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AweLocal POST path
// Create a new awe/local object
func (*AweLocal) PostPath() string {
return "/api/objects/awe/local/"
}
// PutPath implements sophos.RestObject and returns the AweLocal PUT path
// Creates or updates the complete object local
func (*AweLocal) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/local/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AweLocal) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/local/%s/usedby", ref)
}
// AweReds is an Sophos Endpoint subType and implements sophos.RestObject
type AweReds []AweRed
// AweRed represents a UTM RED wifi
type AweRed struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
// AcAbility default value is false
AcAbility bool `json:"ac_ability"`
AllowedCountries []string `json:"allowed_countries"`
ApLocaldebuglevel int `json:"ap_localdebuglevel"`
ApVlantag int `json:"ap_vlantag"`
AutoChannel int `json:"auto_channel"`
// Band can be one of: []string{"g", "a"}
// Band default value is "g"
Band string `json:"band"`
BridgeModes []string `json:"bridge_modes"`
Channel int `json:"channel"`
// ChannelWidth can be one of: []string{"HT20", "HT40", "VHT80"}
// ChannelWidth default value is "HT20"
ChannelWidth string `json:"channel_width"`
Comment string `json:"comment"`
// Country description: (REGEX)
// Country default value is ""
Country string `json:"country"`
// DfsAbility default value is false
DfsAbility bool `json:"dfs_ability"`
// Enabled default value is false
Enabled bool `json:"enabled"`
// ForcedCountry default value is ""
ForcedCountry string `json:"forced_country"`
// Id default value is "Remote Wifi Device"
Id string `json:"id"`
// Interface description: REF(interface/*)
// Interface default value is ""
Interface string `json:"interface"`
// Key default value is ""
Key string `json:"key"`
// LanMac description: (MACADDR)
// LanMac default value is "00:00:00:00:00:00"
LanMac string `json:"lan_mac"`
// LastIp description: (IPADDR)
// LastIp default value is ""
LastIp string `json:"last_ip"`
// Location default value is ""
Location string `json:"location"`
MaxSsids int `json:"max_ssids"`
// MeshAbility default value is false
MeshAbility bool `json:"mesh_ability"`
Name string `json:"name"`
Networks []string `json:"networks"`
// R0KhSecret default value is ""
R0KhSecret string `json:"r0kh_secret"`
ScanInterval int `json:"scan_interval"`
SchedScanInterval int `json:"sched_scan_interval"`
// Status default value is false
Status bool `json:"status"`
// TimeScheduling default value is false
TimeScheduling bool `json:"time_scheduling"`
TimeSelect []string `json:"time_select"`
// TunnelId default value is ""
TunnelId string `json:"tunnel_id"`
// TxPowerControl default value is false
TxPowerControl bool `json:"tx_power_control"`
Txpower int `json:"txpower"`
// Type default value is ""
Type string `json:"type"`
// Vlantagging default value is false
Vlantagging bool `json:"vlantagging"`
// WifiMac description: (MACADDR)
// WifiMac default value is "00:00:00:00:00:00"
WifiMac string `json:"wifi_mac"`
}
var _ sophos.RestGetter = &AweRed{}
// GetPath implements sophos.RestObject and returns the AweReds GET path
// Returns all available awe/red objects
func (*AweReds) GetPath() string { return "/api/objects/awe/red/" }
// RefRequired implements sophos.RestObject
func (*AweReds) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AweReds GET path
// Returns all available red types
func (a *AweRed) GetPath() string { return fmt.Sprintf("/api/objects/awe/red/%s", a.Reference) }
// RefRequired implements sophos.RestObject
func (a *AweRed) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AweRed DELETE path
// Creates or updates the complete object red
func (*AweRed) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/awe/red/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AweRed PATCH path
// Changes to parts of the object red types
func (*AweRed) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/red/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AweRed POST path
// Create a new awe/red object
func (*AweRed) PostPath() string {
return "/api/objects/awe/red/"
}
// PutPath implements sophos.RestObject and returns the AweRed PUT path
// Creates or updates the complete object red
func (*AweRed) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/red/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AweRed) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/awe/red/%s/usedby", ref)
}