1
2
3
4 package envoy_config_cluster_v4alpha
5
6 import (
7 "bytes"
8 "errors"
9 "fmt"
10 "net"
11 "net/mail"
12 "net/url"
13 "regexp"
14 "strings"
15 "time"
16 "unicode/utf8"
17
18 "github.com/golang/protobuf/ptypes"
19
20 v4alpha "github.com/datawire/ambassador/v2/pkg/api/envoy/config/core/v4alpha"
21 )
22
23
24 var (
25 _ = bytes.MinRead
26 _ = errors.New("")
27 _ = fmt.Print
28 _ = utf8.UTFMax
29 _ = (*regexp.Regexp)(nil)
30 _ = (*strings.Reader)(nil)
31 _ = net.IPv4len
32 _ = time.Duration(0)
33 _ = (*url.URL)(nil)
34 _ = (*mail.Address)(nil)
35 _ = ptypes.DynamicAny{}
36
37 _ = v4alpha.RoutingPriority(0)
38 )
39
40
41
42
43 func (m *CircuitBreakers) Validate() error {
44 if m == nil {
45 return nil
46 }
47
48 for idx, item := range m.GetThresholds() {
49 _, _ = idx, item
50
51 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
52 if err := v.Validate(); err != nil {
53 return CircuitBreakersValidationError{
54 field: fmt.Sprintf("Thresholds[%v]", idx),
55 reason: "embedded message failed validation",
56 cause: err,
57 }
58 }
59 }
60
61 }
62
63 return nil
64 }
65
66
67
68 type CircuitBreakersValidationError struct {
69 field string
70 reason string
71 cause error
72 key bool
73 }
74
75
76 func (e CircuitBreakersValidationError) Field() string { return e.field }
77
78
79 func (e CircuitBreakersValidationError) Reason() string { return e.reason }
80
81
82 func (e CircuitBreakersValidationError) Cause() error { return e.cause }
83
84
85 func (e CircuitBreakersValidationError) Key() bool { return e.key }
86
87
88 func (e CircuitBreakersValidationError) ErrorName() string { return "CircuitBreakersValidationError" }
89
90
91 func (e CircuitBreakersValidationError) Error() string {
92 cause := ""
93 if e.cause != nil {
94 cause = fmt.Sprintf(" | caused by: %v", e.cause)
95 }
96
97 key := ""
98 if e.key {
99 key = "key for "
100 }
101
102 return fmt.Sprintf(
103 "invalid %sCircuitBreakers.%s: %s%s",
104 key,
105 e.field,
106 e.reason,
107 cause)
108 }
109
110 var _ error = CircuitBreakersValidationError{}
111
112 var _ interface {
113 Field() string
114 Reason() string
115 Key() bool
116 Cause() error
117 ErrorName() string
118 } = CircuitBreakersValidationError{}
119
120
121
122
123 func (m *CircuitBreakers_Thresholds) Validate() error {
124 if m == nil {
125 return nil
126 }
127
128 if _, ok := v4alpha.RoutingPriority_name[int32(m.GetPriority())]; !ok {
129 return CircuitBreakers_ThresholdsValidationError{
130 field: "Priority",
131 reason: "value must be one of the defined enum values",
132 }
133 }
134
135 if v, ok := interface{}(m.GetMaxConnections()).(interface{ Validate() error }); ok {
136 if err := v.Validate(); err != nil {
137 return CircuitBreakers_ThresholdsValidationError{
138 field: "MaxConnections",
139 reason: "embedded message failed validation",
140 cause: err,
141 }
142 }
143 }
144
145 if v, ok := interface{}(m.GetMaxPendingRequests()).(interface{ Validate() error }); ok {
146 if err := v.Validate(); err != nil {
147 return CircuitBreakers_ThresholdsValidationError{
148 field: "MaxPendingRequests",
149 reason: "embedded message failed validation",
150 cause: err,
151 }
152 }
153 }
154
155 if v, ok := interface{}(m.GetMaxRequests()).(interface{ Validate() error }); ok {
156 if err := v.Validate(); err != nil {
157 return CircuitBreakers_ThresholdsValidationError{
158 field: "MaxRequests",
159 reason: "embedded message failed validation",
160 cause: err,
161 }
162 }
163 }
164
165 if v, ok := interface{}(m.GetMaxRetries()).(interface{ Validate() error }); ok {
166 if err := v.Validate(); err != nil {
167 return CircuitBreakers_ThresholdsValidationError{
168 field: "MaxRetries",
169 reason: "embedded message failed validation",
170 cause: err,
171 }
172 }
173 }
174
175 if v, ok := interface{}(m.GetRetryBudget()).(interface{ Validate() error }); ok {
176 if err := v.Validate(); err != nil {
177 return CircuitBreakers_ThresholdsValidationError{
178 field: "RetryBudget",
179 reason: "embedded message failed validation",
180 cause: err,
181 }
182 }
183 }
184
185
186
187 if v, ok := interface{}(m.GetMaxConnectionPools()).(interface{ Validate() error }); ok {
188 if err := v.Validate(); err != nil {
189 return CircuitBreakers_ThresholdsValidationError{
190 field: "MaxConnectionPools",
191 reason: "embedded message failed validation",
192 cause: err,
193 }
194 }
195 }
196
197 return nil
198 }
199
200
201
202 type CircuitBreakers_ThresholdsValidationError struct {
203 field string
204 reason string
205 cause error
206 key bool
207 }
208
209
210 func (e CircuitBreakers_ThresholdsValidationError) Field() string { return e.field }
211
212
213 func (e CircuitBreakers_ThresholdsValidationError) Reason() string { return e.reason }
214
215
216 func (e CircuitBreakers_ThresholdsValidationError) Cause() error { return e.cause }
217
218
219 func (e CircuitBreakers_ThresholdsValidationError) Key() bool { return e.key }
220
221
222 func (e CircuitBreakers_ThresholdsValidationError) ErrorName() string {
223 return "CircuitBreakers_ThresholdsValidationError"
224 }
225
226
227 func (e CircuitBreakers_ThresholdsValidationError) Error() string {
228 cause := ""
229 if e.cause != nil {
230 cause = fmt.Sprintf(" | caused by: %v", e.cause)
231 }
232
233 key := ""
234 if e.key {
235 key = "key for "
236 }
237
238 return fmt.Sprintf(
239 "invalid %sCircuitBreakers_Thresholds.%s: %s%s",
240 key,
241 e.field,
242 e.reason,
243 cause)
244 }
245
246 var _ error = CircuitBreakers_ThresholdsValidationError{}
247
248 var _ interface {
249 Field() string
250 Reason() string
251 Key() bool
252 Cause() error
253 ErrorName() string
254 } = CircuitBreakers_ThresholdsValidationError{}
255
256
257
258
259 func (m *CircuitBreakers_Thresholds_RetryBudget) Validate() error {
260 if m == nil {
261 return nil
262 }
263
264 if v, ok := interface{}(m.GetBudgetPercent()).(interface{ Validate() error }); ok {
265 if err := v.Validate(); err != nil {
266 return CircuitBreakers_Thresholds_RetryBudgetValidationError{
267 field: "BudgetPercent",
268 reason: "embedded message failed validation",
269 cause: err,
270 }
271 }
272 }
273
274 if v, ok := interface{}(m.GetMinRetryConcurrency()).(interface{ Validate() error }); ok {
275 if err := v.Validate(); err != nil {
276 return CircuitBreakers_Thresholds_RetryBudgetValidationError{
277 field: "MinRetryConcurrency",
278 reason: "embedded message failed validation",
279 cause: err,
280 }
281 }
282 }
283
284 return nil
285 }
286
287
288
289
290 type CircuitBreakers_Thresholds_RetryBudgetValidationError struct {
291 field string
292 reason string
293 cause error
294 key bool
295 }
296
297
298 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) Field() string { return e.field }
299
300
301 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) Reason() string { return e.reason }
302
303
304 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) Cause() error { return e.cause }
305
306
307 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) Key() bool { return e.key }
308
309
310 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) ErrorName() string {
311 return "CircuitBreakers_Thresholds_RetryBudgetValidationError"
312 }
313
314
315 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) Error() string {
316 cause := ""
317 if e.cause != nil {
318 cause = fmt.Sprintf(" | caused by: %v", e.cause)
319 }
320
321 key := ""
322 if e.key {
323 key = "key for "
324 }
325
326 return fmt.Sprintf(
327 "invalid %sCircuitBreakers_Thresholds_RetryBudget.%s: %s%s",
328 key,
329 e.field,
330 e.reason,
331 cause)
332 }
333
334 var _ error = CircuitBreakers_Thresholds_RetryBudgetValidationError{}
335
336 var _ interface {
337 Field() string
338 Reason() string
339 Key() bool
340 Cause() error
341 ErrorName() string
342 } = CircuitBreakers_Thresholds_RetryBudgetValidationError{}
343
View as plain text