1
2
3
4 package statusv2
5
6 import (
7 "bytes"
8 "errors"
9 "fmt"
10 "net"
11 "net/mail"
12 "net/url"
13 "regexp"
14 "sort"
15 "strings"
16 "time"
17 "unicode/utf8"
18
19 "google.golang.org/protobuf/types/known/anypb"
20 )
21
22
23 var (
24 _ = bytes.MinRead
25 _ = errors.New("")
26 _ = fmt.Print
27 _ = utf8.UTFMax
28 _ = (*regexp.Regexp)(nil)
29 _ = (*strings.Reader)(nil)
30 _ = net.IPv4len
31 _ = time.Duration(0)
32 _ = (*url.URL)(nil)
33 _ = (*mail.Address)(nil)
34 _ = anypb.Any{}
35 _ = sort.Sort
36 )
37
38
39
40
41 func (m *ClientStatusRequest) Validate() error {
42 return m.validate(false)
43 }
44
45
46
47
48
49 func (m *ClientStatusRequest) ValidateAll() error {
50 return m.validate(true)
51 }
52
53 func (m *ClientStatusRequest) validate(all bool) error {
54 if m == nil {
55 return nil
56 }
57
58 var errors []error
59
60 for idx, item := range m.GetNodeMatchers() {
61 _, _ = idx, item
62
63 if all {
64 switch v := interface{}(item).(type) {
65 case interface{ ValidateAll() error }:
66 if err := v.ValidateAll(); err != nil {
67 errors = append(errors, ClientStatusRequestValidationError{
68 field: fmt.Sprintf("NodeMatchers[%v]", idx),
69 reason: "embedded message failed validation",
70 cause: err,
71 })
72 }
73 case interface{ Validate() error }:
74 if err := v.Validate(); err != nil {
75 errors = append(errors, ClientStatusRequestValidationError{
76 field: fmt.Sprintf("NodeMatchers[%v]", idx),
77 reason: "embedded message failed validation",
78 cause: err,
79 })
80 }
81 }
82 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
83 if err := v.Validate(); err != nil {
84 return ClientStatusRequestValidationError{
85 field: fmt.Sprintf("NodeMatchers[%v]", idx),
86 reason: "embedded message failed validation",
87 cause: err,
88 }
89 }
90 }
91
92 }
93
94 if len(errors) > 0 {
95 return ClientStatusRequestMultiError(errors)
96 }
97
98 return nil
99 }
100
101
102
103
104 type ClientStatusRequestMultiError []error
105
106
107 func (m ClientStatusRequestMultiError) Error() string {
108 var msgs []string
109 for _, err := range m {
110 msgs = append(msgs, err.Error())
111 }
112 return strings.Join(msgs, "; ")
113 }
114
115
116 func (m ClientStatusRequestMultiError) AllErrors() []error { return m }
117
118
119
120 type ClientStatusRequestValidationError struct {
121 field string
122 reason string
123 cause error
124 key bool
125 }
126
127
128 func (e ClientStatusRequestValidationError) Field() string { return e.field }
129
130
131 func (e ClientStatusRequestValidationError) Reason() string { return e.reason }
132
133
134 func (e ClientStatusRequestValidationError) Cause() error { return e.cause }
135
136
137 func (e ClientStatusRequestValidationError) Key() bool { return e.key }
138
139
140 func (e ClientStatusRequestValidationError) ErrorName() string {
141 return "ClientStatusRequestValidationError"
142 }
143
144
145 func (e ClientStatusRequestValidationError) Error() string {
146 cause := ""
147 if e.cause != nil {
148 cause = fmt.Sprintf(" | caused by: %v", e.cause)
149 }
150
151 key := ""
152 if e.key {
153 key = "key for "
154 }
155
156 return fmt.Sprintf(
157 "invalid %sClientStatusRequest.%s: %s%s",
158 key,
159 e.field,
160 e.reason,
161 cause)
162 }
163
164 var _ error = ClientStatusRequestValidationError{}
165
166 var _ interface {
167 Field() string
168 Reason() string
169 Key() bool
170 Cause() error
171 ErrorName() string
172 } = ClientStatusRequestValidationError{}
173
174
175
176
177 func (m *PerXdsConfig) Validate() error {
178 return m.validate(false)
179 }
180
181
182
183
184
185 func (m *PerXdsConfig) ValidateAll() error {
186 return m.validate(true)
187 }
188
189 func (m *PerXdsConfig) validate(all bool) error {
190 if m == nil {
191 return nil
192 }
193
194 var errors []error
195
196
197
198 switch v := m.PerXdsConfig.(type) {
199 case *PerXdsConfig_ListenerConfig:
200 if v == nil {
201 err := PerXdsConfigValidationError{
202 field: "PerXdsConfig",
203 reason: "oneof value cannot be a typed-nil",
204 }
205 if !all {
206 return err
207 }
208 errors = append(errors, err)
209 }
210
211 if all {
212 switch v := interface{}(m.GetListenerConfig()).(type) {
213 case interface{ ValidateAll() error }:
214 if err := v.ValidateAll(); err != nil {
215 errors = append(errors, PerXdsConfigValidationError{
216 field: "ListenerConfig",
217 reason: "embedded message failed validation",
218 cause: err,
219 })
220 }
221 case interface{ Validate() error }:
222 if err := v.Validate(); err != nil {
223 errors = append(errors, PerXdsConfigValidationError{
224 field: "ListenerConfig",
225 reason: "embedded message failed validation",
226 cause: err,
227 })
228 }
229 }
230 } else if v, ok := interface{}(m.GetListenerConfig()).(interface{ Validate() error }); ok {
231 if err := v.Validate(); err != nil {
232 return PerXdsConfigValidationError{
233 field: "ListenerConfig",
234 reason: "embedded message failed validation",
235 cause: err,
236 }
237 }
238 }
239
240 case *PerXdsConfig_ClusterConfig:
241 if v == nil {
242 err := PerXdsConfigValidationError{
243 field: "PerXdsConfig",
244 reason: "oneof value cannot be a typed-nil",
245 }
246 if !all {
247 return err
248 }
249 errors = append(errors, err)
250 }
251
252 if all {
253 switch v := interface{}(m.GetClusterConfig()).(type) {
254 case interface{ ValidateAll() error }:
255 if err := v.ValidateAll(); err != nil {
256 errors = append(errors, PerXdsConfigValidationError{
257 field: "ClusterConfig",
258 reason: "embedded message failed validation",
259 cause: err,
260 })
261 }
262 case interface{ Validate() error }:
263 if err := v.Validate(); err != nil {
264 errors = append(errors, PerXdsConfigValidationError{
265 field: "ClusterConfig",
266 reason: "embedded message failed validation",
267 cause: err,
268 })
269 }
270 }
271 } else if v, ok := interface{}(m.GetClusterConfig()).(interface{ Validate() error }); ok {
272 if err := v.Validate(); err != nil {
273 return PerXdsConfigValidationError{
274 field: "ClusterConfig",
275 reason: "embedded message failed validation",
276 cause: err,
277 }
278 }
279 }
280
281 case *PerXdsConfig_RouteConfig:
282 if v == nil {
283 err := PerXdsConfigValidationError{
284 field: "PerXdsConfig",
285 reason: "oneof value cannot be a typed-nil",
286 }
287 if !all {
288 return err
289 }
290 errors = append(errors, err)
291 }
292
293 if all {
294 switch v := interface{}(m.GetRouteConfig()).(type) {
295 case interface{ ValidateAll() error }:
296 if err := v.ValidateAll(); err != nil {
297 errors = append(errors, PerXdsConfigValidationError{
298 field: "RouteConfig",
299 reason: "embedded message failed validation",
300 cause: err,
301 })
302 }
303 case interface{ Validate() error }:
304 if err := v.Validate(); err != nil {
305 errors = append(errors, PerXdsConfigValidationError{
306 field: "RouteConfig",
307 reason: "embedded message failed validation",
308 cause: err,
309 })
310 }
311 }
312 } else if v, ok := interface{}(m.GetRouteConfig()).(interface{ Validate() error }); ok {
313 if err := v.Validate(); err != nil {
314 return PerXdsConfigValidationError{
315 field: "RouteConfig",
316 reason: "embedded message failed validation",
317 cause: err,
318 }
319 }
320 }
321
322 case *PerXdsConfig_ScopedRouteConfig:
323 if v == nil {
324 err := PerXdsConfigValidationError{
325 field: "PerXdsConfig",
326 reason: "oneof value cannot be a typed-nil",
327 }
328 if !all {
329 return err
330 }
331 errors = append(errors, err)
332 }
333
334 if all {
335 switch v := interface{}(m.GetScopedRouteConfig()).(type) {
336 case interface{ ValidateAll() error }:
337 if err := v.ValidateAll(); err != nil {
338 errors = append(errors, PerXdsConfigValidationError{
339 field: "ScopedRouteConfig",
340 reason: "embedded message failed validation",
341 cause: err,
342 })
343 }
344 case interface{ Validate() error }:
345 if err := v.Validate(); err != nil {
346 errors = append(errors, PerXdsConfigValidationError{
347 field: "ScopedRouteConfig",
348 reason: "embedded message failed validation",
349 cause: err,
350 })
351 }
352 }
353 } else if v, ok := interface{}(m.GetScopedRouteConfig()).(interface{ Validate() error }); ok {
354 if err := v.Validate(); err != nil {
355 return PerXdsConfigValidationError{
356 field: "ScopedRouteConfig",
357 reason: "embedded message failed validation",
358 cause: err,
359 }
360 }
361 }
362
363 default:
364 _ = v
365 }
366
367 if len(errors) > 0 {
368 return PerXdsConfigMultiError(errors)
369 }
370
371 return nil
372 }
373
374
375
376 type PerXdsConfigMultiError []error
377
378
379 func (m PerXdsConfigMultiError) Error() string {
380 var msgs []string
381 for _, err := range m {
382 msgs = append(msgs, err.Error())
383 }
384 return strings.Join(msgs, "; ")
385 }
386
387
388 func (m PerXdsConfigMultiError) AllErrors() []error { return m }
389
390
391
392 type PerXdsConfigValidationError struct {
393 field string
394 reason string
395 cause error
396 key bool
397 }
398
399
400 func (e PerXdsConfigValidationError) Field() string { return e.field }
401
402
403 func (e PerXdsConfigValidationError) Reason() string { return e.reason }
404
405
406 func (e PerXdsConfigValidationError) Cause() error { return e.cause }
407
408
409 func (e PerXdsConfigValidationError) Key() bool { return e.key }
410
411
412 func (e PerXdsConfigValidationError) ErrorName() string { return "PerXdsConfigValidationError" }
413
414
415 func (e PerXdsConfigValidationError) Error() string {
416 cause := ""
417 if e.cause != nil {
418 cause = fmt.Sprintf(" | caused by: %v", e.cause)
419 }
420
421 key := ""
422 if e.key {
423 key = "key for "
424 }
425
426 return fmt.Sprintf(
427 "invalid %sPerXdsConfig.%s: %s%s",
428 key,
429 e.field,
430 e.reason,
431 cause)
432 }
433
434 var _ error = PerXdsConfigValidationError{}
435
436 var _ interface {
437 Field() string
438 Reason() string
439 Key() bool
440 Cause() error
441 ErrorName() string
442 } = PerXdsConfigValidationError{}
443
444
445
446
447 func (m *ClientConfig) Validate() error {
448 return m.validate(false)
449 }
450
451
452
453
454
455 func (m *ClientConfig) ValidateAll() error {
456 return m.validate(true)
457 }
458
459 func (m *ClientConfig) validate(all bool) error {
460 if m == nil {
461 return nil
462 }
463
464 var errors []error
465
466 if all {
467 switch v := interface{}(m.GetNode()).(type) {
468 case interface{ ValidateAll() error }:
469 if err := v.ValidateAll(); err != nil {
470 errors = append(errors, ClientConfigValidationError{
471 field: "Node",
472 reason: "embedded message failed validation",
473 cause: err,
474 })
475 }
476 case interface{ Validate() error }:
477 if err := v.Validate(); err != nil {
478 errors = append(errors, ClientConfigValidationError{
479 field: "Node",
480 reason: "embedded message failed validation",
481 cause: err,
482 })
483 }
484 }
485 } else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
486 if err := v.Validate(); err != nil {
487 return ClientConfigValidationError{
488 field: "Node",
489 reason: "embedded message failed validation",
490 cause: err,
491 }
492 }
493 }
494
495 for idx, item := range m.GetXdsConfig() {
496 _, _ = idx, item
497
498 if all {
499 switch v := interface{}(item).(type) {
500 case interface{ ValidateAll() error }:
501 if err := v.ValidateAll(); err != nil {
502 errors = append(errors, ClientConfigValidationError{
503 field: fmt.Sprintf("XdsConfig[%v]", idx),
504 reason: "embedded message failed validation",
505 cause: err,
506 })
507 }
508 case interface{ Validate() error }:
509 if err := v.Validate(); err != nil {
510 errors = append(errors, ClientConfigValidationError{
511 field: fmt.Sprintf("XdsConfig[%v]", idx),
512 reason: "embedded message failed validation",
513 cause: err,
514 })
515 }
516 }
517 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
518 if err := v.Validate(); err != nil {
519 return ClientConfigValidationError{
520 field: fmt.Sprintf("XdsConfig[%v]", idx),
521 reason: "embedded message failed validation",
522 cause: err,
523 }
524 }
525 }
526
527 }
528
529 if len(errors) > 0 {
530 return ClientConfigMultiError(errors)
531 }
532
533 return nil
534 }
535
536
537
538 type ClientConfigMultiError []error
539
540
541 func (m ClientConfigMultiError) Error() string {
542 var msgs []string
543 for _, err := range m {
544 msgs = append(msgs, err.Error())
545 }
546 return strings.Join(msgs, "; ")
547 }
548
549
550 func (m ClientConfigMultiError) AllErrors() []error { return m }
551
552
553
554 type ClientConfigValidationError struct {
555 field string
556 reason string
557 cause error
558 key bool
559 }
560
561
562 func (e ClientConfigValidationError) Field() string { return e.field }
563
564
565 func (e ClientConfigValidationError) Reason() string { return e.reason }
566
567
568 func (e ClientConfigValidationError) Cause() error { return e.cause }
569
570
571 func (e ClientConfigValidationError) Key() bool { return e.key }
572
573
574 func (e ClientConfigValidationError) ErrorName() string { return "ClientConfigValidationError" }
575
576
577 func (e ClientConfigValidationError) Error() string {
578 cause := ""
579 if e.cause != nil {
580 cause = fmt.Sprintf(" | caused by: %v", e.cause)
581 }
582
583 key := ""
584 if e.key {
585 key = "key for "
586 }
587
588 return fmt.Sprintf(
589 "invalid %sClientConfig.%s: %s%s",
590 key,
591 e.field,
592 e.reason,
593 cause)
594 }
595
596 var _ error = ClientConfigValidationError{}
597
598 var _ interface {
599 Field() string
600 Reason() string
601 Key() bool
602 Cause() error
603 ErrorName() string
604 } = ClientConfigValidationError{}
605
606
607
608
609 func (m *ClientStatusResponse) Validate() error {
610 return m.validate(false)
611 }
612
613
614
615
616
617 func (m *ClientStatusResponse) ValidateAll() error {
618 return m.validate(true)
619 }
620
621 func (m *ClientStatusResponse) validate(all bool) error {
622 if m == nil {
623 return nil
624 }
625
626 var errors []error
627
628 for idx, item := range m.GetConfig() {
629 _, _ = idx, item
630
631 if all {
632 switch v := interface{}(item).(type) {
633 case interface{ ValidateAll() error }:
634 if err := v.ValidateAll(); err != nil {
635 errors = append(errors, ClientStatusResponseValidationError{
636 field: fmt.Sprintf("Config[%v]", idx),
637 reason: "embedded message failed validation",
638 cause: err,
639 })
640 }
641 case interface{ Validate() error }:
642 if err := v.Validate(); err != nil {
643 errors = append(errors, ClientStatusResponseValidationError{
644 field: fmt.Sprintf("Config[%v]", idx),
645 reason: "embedded message failed validation",
646 cause: err,
647 })
648 }
649 }
650 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
651 if err := v.Validate(); err != nil {
652 return ClientStatusResponseValidationError{
653 field: fmt.Sprintf("Config[%v]", idx),
654 reason: "embedded message failed validation",
655 cause: err,
656 }
657 }
658 }
659
660 }
661
662 if len(errors) > 0 {
663 return ClientStatusResponseMultiError(errors)
664 }
665
666 return nil
667 }
668
669
670
671
672 type ClientStatusResponseMultiError []error
673
674
675 func (m ClientStatusResponseMultiError) Error() string {
676 var msgs []string
677 for _, err := range m {
678 msgs = append(msgs, err.Error())
679 }
680 return strings.Join(msgs, "; ")
681 }
682
683
684 func (m ClientStatusResponseMultiError) AllErrors() []error { return m }
685
686
687
688 type ClientStatusResponseValidationError struct {
689 field string
690 reason string
691 cause error
692 key bool
693 }
694
695
696 func (e ClientStatusResponseValidationError) Field() string { return e.field }
697
698
699 func (e ClientStatusResponseValidationError) Reason() string { return e.reason }
700
701
702 func (e ClientStatusResponseValidationError) Cause() error { return e.cause }
703
704
705 func (e ClientStatusResponseValidationError) Key() bool { return e.key }
706
707
708 func (e ClientStatusResponseValidationError) ErrorName() string {
709 return "ClientStatusResponseValidationError"
710 }
711
712
713 func (e ClientStatusResponseValidationError) Error() string {
714 cause := ""
715 if e.cause != nil {
716 cause = fmt.Sprintf(" | caused by: %v", e.cause)
717 }
718
719 key := ""
720 if e.key {
721 key = "key for "
722 }
723
724 return fmt.Sprintf(
725 "invalid %sClientStatusResponse.%s: %s%s",
726 key,
727 e.field,
728 e.reason,
729 cause)
730 }
731
732 var _ error = ClientStatusResponseValidationError{}
733
734 var _ interface {
735 Field() string
736 Reason() string
737 Key() bool
738 Cause() error
739 ErrorName() string
740 } = ClientStatusResponseValidationError{}
741
View as plain text