This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
db_interface.go
170 lines (141 loc) · 6.2 KB
/
db_interface.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
package libwimark
import (
"encoding/json"
)
type DBResponseBase struct {
Errors []ModelError `json:"errors,omitempty"`
}
type DBDataObj struct {
WLANs map[UUID]WLAN `json:"wlan,omitempty"`
CPEs map[UUID]CPE `json:"cpe,omitempty"`
Stats map[UUID]Stat `json:"stat,omitempty"`
ClientStats map[UUID]ClientStat `json:"client-stat,omitempty"`
Events map[UUID]SystemEvent `json:"event,omitempty"`
StatEventRules map[UUID]StatEventRule `json:"stat-event-rule,omitempty"`
PollCPE map[UUID]CPEPollSettings `json:"poll-cpe,omitempty"`
Radius map[UUID]Radius `json:"radius,omitempty"`
LBSCPEInfo map[UUID]LBSCPEInfo `json:"lbs-cpe-info,omitempty"`
LBSClientData map[UUID]LBSClientData `json:"lbs-client-data,omitempty"`
LBSClientCoords map[UUID]LBSClientCoords `json:"lbs-client-coords,omitempty"`
VPNHosts map[UUID]VPNHost `json:"vpn-host,omitempty"`
CPEScanData map[UUID]CPEScanData `json:"cpe-scan-data,omitempty"`
CPEModel map[UUID]CPEModel `json:"cpe-model,omitempty"`
ConfigRule map[UUID]ConfigRule `json:"config-rule,omitempty"`
L2Chain map[UUID]L2Chain `json:"l2-chain,omitempty"`
CaptiveRedirect map[UUID]CaptiveRedirect `json:"captive-redirect,omitempty"`
HotspotProfile map[UUID]Hotspot20Profile `json:"hotspot-profile,omitempty"`
Controller map[UUID]Controller `json:"controller,omitempty"`
LBSZones map[UUID]LBSZone `json:"lbs_zones,omitempty"`
ExtAccessPoint map[UUID]ExtAccessPoint `json:"ext_access_point,omitempty"`
RRMGroup map[UUID]RRMGroup `json:"rrm_group,omitempty"`
}
func (dbd *DBDataObj) Reset() {
*dbd = DBDataObj{}
}
type DBDataUUID struct {
WLANs []UUID `json:"wlan,omitempty"`
CPEs []UUID `json:"cpe,omitempty"`
Stats []UUID `json:"stat,omitempty"`
ClientStats []UUID `json:"client-stat,omitempty"`
Events []UUID `json:"event,omitempty"`
StatEventRules []UUID `json:"stat-event-rule,omitempty"`
PollCPE []UUID `json:"poll-cpe,omitempty"`
Radius []UUID `json:"radius,omitempty"`
LBSCPEInfo []UUID `json:"lbs-cpe-info,omitempty"`
LBSClientData []UUID `json:"lbs-client-data,omitempty"`
LBSClientCoords []UUID `json:"lbs-client-coords,omitempty"`
VPNHosts []UUID `json:"vpn-host,omitempty"`
CPEScanData []UUID `json:"cpe-scan-data,omitempty"`
CPEModel []UUID `json:"cpe-model,omitempty"`
ConfigRule []UUID `json:"config-rule,omitempty"`
L2Chain []UUID `json:"l2-chain,omitempty"`
CaptiveRedirect []UUID `json:"captive-redirect,omitempty"`
HotspotProfile []UUID `json:"hotspot-profile,omitempty"`
Controller []UUID `json:"controller,omitempty"`
LBSZones []UUID `json:"lbs_zones,omitempty"`
ExtAccessPoint []UUID `json:"ext_access_point,omitempty"`
}
func (dbd *DBDataUUID) Reset() {
*dbd = DBDataUUID{}
}
type DBDataMasks struct {
WLANs *WLANMask `json:"wlan,omitempty"`
CPEs *CPEMask `json:"cpe,omitempty"`
Stats *StatsMask `json:"stat,omitempty"`
ClientStats *SimpleMask `json:"client-stat,omitempty"`
Events *EventMask `json:"event,omitempty"`
StatEventRules *SimpleMask `json:"stat-event-rule,omitempty"`
PollCPE *SimpleMask `json:"poll-cpe,omitempty"`
Radius *SimpleMask `json:"radius,omitempty"`
LBSCPEInfo *LBSCPEInfoMask `json:"lbs-cpe-info,omitempty"`
LBSClientData *LBSClientDataMask `json:"lbs-client-data,omitempty"`
LBSClientCoords *LBSClientCoordsMask `json:"lbs-client-coords,omitempty"`
VPNHosts *SimpleMask `json:"vpn-host,omitempty"`
CPEScanData *SimpleMask `json:"cpe-scan-data,omitempty"`
CPEModel *CPEModelMask `json:"cpe-model,omitempty"`
ConfigRule *ConfigRuleMask `json:"config-rule,omitempty"`
L2Chain *SimpleMask `json:"l2-chain,omitempty"`
CaptiveRedirect *SimpleMask `json:"captive-redirect,omitempty"`
HotspotProfile *SimpleMask `json:"hotspot-profile,omitempty"`
Controller *ControllerMask `json:"controller,omitempty"`
LBSZones *SimpleMask `json:"lbs_zones,omitempty"`
BaseLocation *BaseLocationMask `json:"base_locations,omitempty"`
ExtAccessPoint *ExtAccessPointMask `json:"ext_access_point,omitempty"`
RRMGroup *RRMGroupMask `json:"rrm_group,omitempty"`
}
func (dbd *DBDataMasks) Reset() {
*dbd = DBDataMasks{}
}
type DBRequestC DBDataObj
type DBRequestU DBDataObj
type DBRequestR DBDataMasks
type DBRequestD DBDataMasks
func (dbd *DBRequestC) UnmarshalJSON(b []byte) error {
(*DBDataObj)(dbd).Reset()
return json.Unmarshal(b, (*DBDataObj)(dbd))
}
func (dbd *DBRequestR) UnmarshalJSON(b []byte) error {
(*DBDataMasks)(dbd).Reset()
return json.Unmarshal(b, (*DBDataMasks)(dbd))
}
func (dbd *DBRequestU) UnmarshalJSON(b []byte) error {
(*DBDataObj)(dbd).Reset()
return json.Unmarshal(b, (*DBDataObj)(dbd))
}
func (dbd *DBRequestD) UnmarshalJSON(b []byte) error {
(*DBDataMasks)(dbd).Reset()
return json.Unmarshal(b, (*DBDataMasks)(dbd))
}
type DBResponseObj struct {
DBResponseBase `json:",inline"`
DBDataObj `json:"data,inline"`
}
type DBResponseUUID struct {
DBResponseBase `json:",inline"`
DBDataUUID `json:"data,inline"`
}
type DBResponseC DBResponseUUID
type DBResponseR DBResponseObj
type DBResponseU DBResponseUUID
type DBResponseD DBResponseUUID
func (dbd *DBResponseC) UnmarshalJSON(b []byte) error {
dbd.DBDataUUID.Reset()
return json.Unmarshal(b, (*DBResponseUUID)(dbd))
}
func (dbd *DBResponseR) UnmarshalJSON(b []byte) error {
dbd.DBDataObj.Reset()
return json.Unmarshal(b, (*DBResponseObj)(dbd))
}
func (dbd *DBResponseU) UnmarshalJSON(b []byte) error {
dbd.DBDataUUID.Reset()
return json.Unmarshal(b, (*DBResponseUUID)(dbd))
}
func (dbd *DBResponseD) UnmarshalJSON(b []byte) error {
dbd.DBDataUUID.Reset()
return json.Unmarshal(b, (*DBResponseUUID)(dbd))
}
type ConnectorInfo struct {
DbType string `json:"db_type"`
DbServers []string `json:"db_servers"`
Models []string `json:"models"`
}