-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhotspot.go
304 lines (255 loc) · 11.1 KB
/
hotspot.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
package objects
// THIS FILE IS AUTO GENERATED BY bin/gen.go! DO NOT EDIT!
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Hotspot is a generated struct representing the Sophos Hotspot Endpoint
// GET /api/nodes/hotspot
type Hotspot struct {
Cert string `json:"cert"`
DeleteDays int64 `json:"delete_days"`
SslPortal int64 `json:"ssl_portal"`
Status int64 `json:"status"`
TransparentSkip []interface{} `json:"transparent_skip"`
}
var _ sophos.Endpoint = &Hotspot{}
var defsHotspot = map[string]sophos.RestObject{
"HotspotGroup": &HotspotGroup{},
"HotspotPortal": &HotspotPortal{},
"HotspotVoucher": &HotspotVoucher{},
}
// RestObjects implements the sophos.Node interface and returns a map of Hotspot's Objects
func (Hotspot) RestObjects() map[string]sophos.RestObject { return defsHotspot }
// GetPath implements sophos.RestGetter
func (*Hotspot) GetPath() string { return "/api/nodes/hotspot" }
// RefRequired implements sophos.RestGetter
func (*Hotspot) RefRequired() (string, bool) { return "", false }
var defHotspot = &sophos.Definition{Description: "hotspot", Name: "hotspot", Link: "/api/definitions/hotspot"}
// Definition returns the /api/definitions struct of Hotspot
func (Hotspot) Definition() sophos.Definition { return *defHotspot }
// ApiRoutes returns all known Hotspot Paths
func (Hotspot) ApiRoutes() []string {
return []string{
"/api/objects/hotspot/group/",
"/api/objects/hotspot/group/{ref}",
"/api/objects/hotspot/group/{ref}/usedby",
"/api/objects/hotspot/portal/",
"/api/objects/hotspot/portal/{ref}",
"/api/objects/hotspot/portal/{ref}/usedby",
"/api/objects/hotspot/voucher/",
"/api/objects/hotspot/voucher/{ref}",
"/api/objects/hotspot/voucher/{ref}/usedby",
}
}
// References returns the Hotspot's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Hotspot) References() []string {
return []string{
"REF_HotspotGroup",
"REF_HotspotPortal",
"REF_HotspotVoucher",
}
}
// HotspotGroups is an Sophos Endpoint subType and implements sophos.RestObject
type HotspotGroups []HotspotGroup
// HotspotGroup represents a UTM group
type HotspotGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &HotspotGroup{}
// GetPath implements sophos.RestObject and returns the HotspotGroups GET path
// Returns all available hotspot/group objects
func (*HotspotGroups) GetPath() string { return "/api/objects/hotspot/group/" }
// RefRequired implements sophos.RestObject
func (*HotspotGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the HotspotGroups GET path
// Returns all available group types
func (h *HotspotGroup) GetPath() string {
return fmt.Sprintf("/api/objects/hotspot/group/%s", h.Reference)
}
// RefRequired implements sophos.RestObject
func (h *HotspotGroup) RefRequired() (string, bool) { return h.Reference, true }
// DeletePath implements sophos.RestObject and returns the HotspotGroup DELETE path
// Creates or updates the complete object group
func (*HotspotGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the HotspotGroup PATCH path
// Changes to parts of the object group types
func (*HotspotGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the HotspotGroup POST path
// Create a new hotspot/group object
func (*HotspotGroup) PostPath() string {
return "/api/objects/hotspot/group/"
}
// PutPath implements sophos.RestObject and returns the HotspotGroup PUT path
// Creates or updates the complete object group
func (*HotspotGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*HotspotGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/group/%s/usedby", ref)
}
// HotspotPortals is an Sophos Endpoint subType and implements sophos.RestObject
type HotspotPortals []HotspotPortal
// HotspotPortal represents a UTM hotspot
type HotspotPortal struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
AdminUsers []string `json:"admin_users"`
Comment string `json:"comment"`
// CustomAssets description: (HASH)
CustomAssets interface{} `json:"custom_assets"`
// CustomizationType can be one of: []string{"basic", "full"}
// CustomizationType default value is "basic"
CustomizationType string `json:"customization_type"`
Description string `json:"description"`
Expiry int `json:"expiry"`
// FiasCodeset can be one of: []string{"cp850", "cp1252"}
// FiasCodeset default value is "cp850"
FiasCodeset string `json:"fias_codeset"`
// FiasPort description: REF(service/tcp)
// FiasPort default value is ""
FiasPort string `json:"fias_port"`
// FiasServer description: REF(network/host), REF(network/dns_host)
// FiasServer default value is ""
FiasServer string `json:"fias_server"`
// Hostname description: REF(network/dns_host)
// Hostname default value is ""
Hostname string `json:"hostname"`
// HostnameType can be one of: []string{"none", "custom"}
// HostnameType default value is "none"
HostnameType string `json:"hostname_type"`
HotspotUsers []string `json:"hotspot_users"`
Interfaces []string `json:"interfaces"`
// Logo default value is ""
Logo string `json:"logo"`
// LogoFilename default value is "default_logo.png"
LogoFilename string `json:"logo_filename"`
// LogoResize default value is false
LogoResize bool `json:"logo_resize"`
Maclimit int `json:"maclimit"`
Mail []string `json:"mail"`
Name string `json:"name"`
// Pagesize default value is "a4"
Pagesize string `json:"pagesize"`
// PwTime description: (TIME)
PwTime string `json:"pw_time"`
RedirectUrl string `json:"redirect_url"`
SmsText string `json:"sms_text"`
// SslRedirect default value is false
SslRedirect bool `json:"ssl_redirect"`
// SyncPsk default value is false
SyncPsk bool `json:"sync_psk"`
// Template description: (HASH)
Template interface{} `json:"template"`
Terms string `json:"terms"`
Title string `json:"title"`
// Type can be one of: []string{"terms", "password", "voucher", "backend_auth", "sms", "fias"}
Type string `json:"type"`
// VoucherQrcode default value is false
VoucherQrcode bool `json:"voucher_qrcode"`
// VoucherTemplate description: (HASH)
VoucherTemplate interface{} `json:"voucher_template"`
Vouchers []string `json:"vouchers"`
VouchersPerPage int `json:"vouchers_per_page"`
}
var _ sophos.RestGetter = &HotspotPortal{}
// GetPath implements sophos.RestObject and returns the HotspotPortals GET path
// Returns all available hotspot/portal objects
func (*HotspotPortals) GetPath() string { return "/api/objects/hotspot/portal/" }
// RefRequired implements sophos.RestObject
func (*HotspotPortals) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the HotspotPortals GET path
// Returns all available portal types
func (h *HotspotPortal) GetPath() string {
return fmt.Sprintf("/api/objects/hotspot/portal/%s", h.Reference)
}
// RefRequired implements sophos.RestObject
func (h *HotspotPortal) RefRequired() (string, bool) { return h.Reference, true }
// DeletePath implements sophos.RestObject and returns the HotspotPortal DELETE path
// Creates or updates the complete object portal
func (*HotspotPortal) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/portal/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the HotspotPortal PATCH path
// Changes to parts of the object portal types
func (*HotspotPortal) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/portal/%s", ref)
}
// PostPath implements sophos.RestObject and returns the HotspotPortal POST path
// Create a new hotspot/portal object
func (*HotspotPortal) PostPath() string {
return "/api/objects/hotspot/portal/"
}
// PutPath implements sophos.RestObject and returns the HotspotPortal PUT path
// Creates or updates the complete object portal
func (*HotspotPortal) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/portal/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*HotspotPortal) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/portal/%s/usedby", ref)
}
// HotspotVouchers is an Sophos Endpoint subType and implements sophos.RestObject
type HotspotVouchers []HotspotVoucher
// HotspotVoucher represents a UTM voucher definiton
type HotspotVoucher struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Expiry int `json:"expiry"`
Name string `json:"name"`
Timequota int `json:"timequota"`
Trafficlimit int `json:"trafficlimit"`
}
var _ sophos.RestGetter = &HotspotVoucher{}
// GetPath implements sophos.RestObject and returns the HotspotVouchers GET path
// Returns all available hotspot/voucher objects
func (*HotspotVouchers) GetPath() string { return "/api/objects/hotspot/voucher/" }
// RefRequired implements sophos.RestObject
func (*HotspotVouchers) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the HotspotVouchers GET path
// Returns all available voucher types
func (h *HotspotVoucher) GetPath() string {
return fmt.Sprintf("/api/objects/hotspot/voucher/%s", h.Reference)
}
// RefRequired implements sophos.RestObject
func (h *HotspotVoucher) RefRequired() (string, bool) { return h.Reference, true }
// DeletePath implements sophos.RestObject and returns the HotspotVoucher DELETE path
// Creates or updates the complete object voucher
func (*HotspotVoucher) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/voucher/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the HotspotVoucher PATCH path
// Changes to parts of the object voucher types
func (*HotspotVoucher) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/voucher/%s", ref)
}
// PostPath implements sophos.RestObject and returns the HotspotVoucher POST path
// Create a new hotspot/voucher object
func (*HotspotVoucher) PostPath() string {
return "/api/objects/hotspot/voucher/"
}
// PutPath implements sophos.RestObject and returns the HotspotVoucher PUT path
// Creates or updates the complete object voucher
func (*HotspotVoucher) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/voucher/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*HotspotVoucher) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/hotspot/voucher/%s/usedby", ref)
}