/
site_traffic_shaping1.go
353 lines (280 loc) · 8.96 KB
/
site_traffic_shaping1.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
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// SiteTrafficShaping1 site traffic shaping 1
//
// swagger:model SiteTrafficShaping 1
type SiteTrafficShaping1 struct {
//
// Number indicating how many times the guaranteed rate is less than the maximum allowed bandwidth.
// Null for auto calculation by UISP.
//
// Example: 2
// Required: true
// Maximum: 10000
// Minimum: 1
Aggregation *int64 `json:"aggregation"`
// Amount of bytes that can be sent at downloadSpeed in excess of the guaranteed rate.
// Example: 512
// Required: true
// Maximum: 1.024e+11
// Enum: [0]
DownloadBurstSize *int64 `json:"downloadBurstSize"`
// Download speed limit in bps.
// Example: 8388608
// Required: true
// Maximum: 1e+11
// Enum: [0]
DownloadSpeed *int64 `json:"downloadSpeed"`
// Set to TRUE if optional Traffic Shaping queue are activated.
// Example: true
// Required: true
Enabled *bool `json:"enabled"`
//
// Whether or not set Traffic Shaping on Client devices like, CPEs and ONUs.
// Enabling this will lower your traffic in local network.
//
// Enum: [all gateway]
Propagation string `json:"propagation,omitempty"`
// Amount of bytes that can be sent at uploadSpeed in excess of the guaranteed rate.
// Example: 512
// Required: true
// Maximum: 1.024e+11
// Enum: [0]
UploadBurstSize *int64 `json:"uploadBurstSize"`
// Upload speed limit in bps.
// Example: 8388608
// Required: true
// Maximum: 1e+11
// Enum: [0]
UploadSpeed *int64 `json:"uploadSpeed"`
}
// Validate validates this site traffic shaping 1
func (m *SiteTrafficShaping1) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAggregation(formats); err != nil {
res = append(res, err)
}
if err := m.validateDownloadBurstSize(formats); err != nil {
res = append(res, err)
}
if err := m.validateDownloadSpeed(formats); err != nil {
res = append(res, err)
}
if err := m.validateEnabled(formats); err != nil {
res = append(res, err)
}
if err := m.validatePropagation(formats); err != nil {
res = append(res, err)
}
if err := m.validateUploadBurstSize(formats); err != nil {
res = append(res, err)
}
if err := m.validateUploadSpeed(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *SiteTrafficShaping1) validateAggregation(formats strfmt.Registry) error {
if err := validate.Required("aggregation", "body", m.Aggregation); err != nil {
return err
}
if err := validate.MinimumInt("aggregation", "body", *m.Aggregation, 1, false); err != nil {
return err
}
if err := validate.MaximumInt("aggregation", "body", *m.Aggregation, 10000, false); err != nil {
return err
}
return nil
}
var siteTrafficShaping1TypeDownloadBurstSizePropEnum []interface{}
func init() {
var res []int64
if err := json.Unmarshal([]byte(`[0]`), &res); err != nil {
panic(err)
}
for _, v := range res {
siteTrafficShaping1TypeDownloadBurstSizePropEnum = append(siteTrafficShaping1TypeDownloadBurstSizePropEnum, v)
}
}
// prop value enum
func (m *SiteTrafficShaping1) validateDownloadBurstSizeEnum(path, location string, value int64) error {
if err := validate.EnumCase(path, location, value, siteTrafficShaping1TypeDownloadBurstSizePropEnum, true); err != nil {
return err
}
return nil
}
func (m *SiteTrafficShaping1) validateDownloadBurstSize(formats strfmt.Registry) error {
if err := validate.Required("downloadBurstSize", "body", m.DownloadBurstSize); err != nil {
return err
}
if err := validate.MaximumInt("downloadBurstSize", "body", *m.DownloadBurstSize, 1.024e+11, false); err != nil {
return err
}
// value enum
if err := m.validateDownloadBurstSizeEnum("downloadBurstSize", "body", *m.DownloadBurstSize); err != nil {
return err
}
return nil
}
var siteTrafficShaping1TypeDownloadSpeedPropEnum []interface{}
func init() {
var res []int64
if err := json.Unmarshal([]byte(`[0]`), &res); err != nil {
panic(err)
}
for _, v := range res {
siteTrafficShaping1TypeDownloadSpeedPropEnum = append(siteTrafficShaping1TypeDownloadSpeedPropEnum, v)
}
}
// prop value enum
func (m *SiteTrafficShaping1) validateDownloadSpeedEnum(path, location string, value int64) error {
if err := validate.EnumCase(path, location, value, siteTrafficShaping1TypeDownloadSpeedPropEnum, true); err != nil {
return err
}
return nil
}
func (m *SiteTrafficShaping1) validateDownloadSpeed(formats strfmt.Registry) error {
if err := validate.Required("downloadSpeed", "body", m.DownloadSpeed); err != nil {
return err
}
if err := validate.MaximumInt("downloadSpeed", "body", *m.DownloadSpeed, 1e+11, false); err != nil {
return err
}
// value enum
if err := m.validateDownloadSpeedEnum("downloadSpeed", "body", *m.DownloadSpeed); err != nil {
return err
}
return nil
}
func (m *SiteTrafficShaping1) validateEnabled(formats strfmt.Registry) error {
if err := validate.Required("enabled", "body", m.Enabled); err != nil {
return err
}
return nil
}
var siteTrafficShaping1TypePropagationPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["all","gateway"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
siteTrafficShaping1TypePropagationPropEnum = append(siteTrafficShaping1TypePropagationPropEnum, v)
}
}
const (
// SiteTrafficShaping1PropagationAll captures enum value "all"
SiteTrafficShaping1PropagationAll string = "all"
// SiteTrafficShaping1PropagationGateway captures enum value "gateway"
SiteTrafficShaping1PropagationGateway string = "gateway"
)
// prop value enum
func (m *SiteTrafficShaping1) validatePropagationEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, siteTrafficShaping1TypePropagationPropEnum, true); err != nil {
return err
}
return nil
}
func (m *SiteTrafficShaping1) validatePropagation(formats strfmt.Registry) error {
if swag.IsZero(m.Propagation) { // not required
return nil
}
// value enum
if err := m.validatePropagationEnum("propagation", "body", m.Propagation); err != nil {
return err
}
return nil
}
var siteTrafficShaping1TypeUploadBurstSizePropEnum []interface{}
func init() {
var res []int64
if err := json.Unmarshal([]byte(`[0]`), &res); err != nil {
panic(err)
}
for _, v := range res {
siteTrafficShaping1TypeUploadBurstSizePropEnum = append(siteTrafficShaping1TypeUploadBurstSizePropEnum, v)
}
}
// prop value enum
func (m *SiteTrafficShaping1) validateUploadBurstSizeEnum(path, location string, value int64) error {
if err := validate.EnumCase(path, location, value, siteTrafficShaping1TypeUploadBurstSizePropEnum, true); err != nil {
return err
}
return nil
}
func (m *SiteTrafficShaping1) validateUploadBurstSize(formats strfmt.Registry) error {
if err := validate.Required("uploadBurstSize", "body", m.UploadBurstSize); err != nil {
return err
}
if err := validate.MaximumInt("uploadBurstSize", "body", *m.UploadBurstSize, 1.024e+11, false); err != nil {
return err
}
// value enum
if err := m.validateUploadBurstSizeEnum("uploadBurstSize", "body", *m.UploadBurstSize); err != nil {
return err
}
return nil
}
var siteTrafficShaping1TypeUploadSpeedPropEnum []interface{}
func init() {
var res []int64
if err := json.Unmarshal([]byte(`[0]`), &res); err != nil {
panic(err)
}
for _, v := range res {
siteTrafficShaping1TypeUploadSpeedPropEnum = append(siteTrafficShaping1TypeUploadSpeedPropEnum, v)
}
}
// prop value enum
func (m *SiteTrafficShaping1) validateUploadSpeedEnum(path, location string, value int64) error {
if err := validate.EnumCase(path, location, value, siteTrafficShaping1TypeUploadSpeedPropEnum, true); err != nil {
return err
}
return nil
}
func (m *SiteTrafficShaping1) validateUploadSpeed(formats strfmt.Registry) error {
if err := validate.Required("uploadSpeed", "body", m.UploadSpeed); err != nil {
return err
}
if err := validate.MaximumInt("uploadSpeed", "body", *m.UploadSpeed, 1e+11, false); err != nil {
return err
}
// value enum
if err := m.validateUploadSpeedEnum("uploadSpeed", "body", *m.UploadSpeed); err != nil {
return err
}
return nil
}
// ContextValidate validates this site traffic shaping 1 based on context it is used
func (m *SiteTrafficShaping1) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *SiteTrafficShaping1) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SiteTrafficShaping1) UnmarshalBinary(b []byte) error {
var res SiteTrafficShaping1
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}