1
2
3
4 package bootstrapv2
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 *Bootstrap) Validate() error {
42 return m.validate(false)
43 }
44
45
46
47
48
49 func (m *Bootstrap) ValidateAll() error {
50 return m.validate(true)
51 }
52
53 func (m *Bootstrap) validate(all bool) error {
54 if m == nil {
55 return nil
56 }
57
58 var errors []error
59
60 if all {
61 switch v := interface{}(m.GetNode()).(type) {
62 case interface{ ValidateAll() error }:
63 if err := v.ValidateAll(); err != nil {
64 errors = append(errors, BootstrapValidationError{
65 field: "Node",
66 reason: "embedded message failed validation",
67 cause: err,
68 })
69 }
70 case interface{ Validate() error }:
71 if err := v.Validate(); err != nil {
72 errors = append(errors, BootstrapValidationError{
73 field: "Node",
74 reason: "embedded message failed validation",
75 cause: err,
76 })
77 }
78 }
79 } else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
80 if err := v.Validate(); err != nil {
81 return BootstrapValidationError{
82 field: "Node",
83 reason: "embedded message failed validation",
84 cause: err,
85 }
86 }
87 }
88
89 if all {
90 switch v := interface{}(m.GetStaticResources()).(type) {
91 case interface{ ValidateAll() error }:
92 if err := v.ValidateAll(); err != nil {
93 errors = append(errors, BootstrapValidationError{
94 field: "StaticResources",
95 reason: "embedded message failed validation",
96 cause: err,
97 })
98 }
99 case interface{ Validate() error }:
100 if err := v.Validate(); err != nil {
101 errors = append(errors, BootstrapValidationError{
102 field: "StaticResources",
103 reason: "embedded message failed validation",
104 cause: err,
105 })
106 }
107 }
108 } else if v, ok := interface{}(m.GetStaticResources()).(interface{ Validate() error }); ok {
109 if err := v.Validate(); err != nil {
110 return BootstrapValidationError{
111 field: "StaticResources",
112 reason: "embedded message failed validation",
113 cause: err,
114 }
115 }
116 }
117
118 if all {
119 switch v := interface{}(m.GetDynamicResources()).(type) {
120 case interface{ ValidateAll() error }:
121 if err := v.ValidateAll(); err != nil {
122 errors = append(errors, BootstrapValidationError{
123 field: "DynamicResources",
124 reason: "embedded message failed validation",
125 cause: err,
126 })
127 }
128 case interface{ Validate() error }:
129 if err := v.Validate(); err != nil {
130 errors = append(errors, BootstrapValidationError{
131 field: "DynamicResources",
132 reason: "embedded message failed validation",
133 cause: err,
134 })
135 }
136 }
137 } else if v, ok := interface{}(m.GetDynamicResources()).(interface{ Validate() error }); ok {
138 if err := v.Validate(); err != nil {
139 return BootstrapValidationError{
140 field: "DynamicResources",
141 reason: "embedded message failed validation",
142 cause: err,
143 }
144 }
145 }
146
147 if all {
148 switch v := interface{}(m.GetClusterManager()).(type) {
149 case interface{ ValidateAll() error }:
150 if err := v.ValidateAll(); err != nil {
151 errors = append(errors, BootstrapValidationError{
152 field: "ClusterManager",
153 reason: "embedded message failed validation",
154 cause: err,
155 })
156 }
157 case interface{ Validate() error }:
158 if err := v.Validate(); err != nil {
159 errors = append(errors, BootstrapValidationError{
160 field: "ClusterManager",
161 reason: "embedded message failed validation",
162 cause: err,
163 })
164 }
165 }
166 } else if v, ok := interface{}(m.GetClusterManager()).(interface{ Validate() error }); ok {
167 if err := v.Validate(); err != nil {
168 return BootstrapValidationError{
169 field: "ClusterManager",
170 reason: "embedded message failed validation",
171 cause: err,
172 }
173 }
174 }
175
176 if all {
177 switch v := interface{}(m.GetHdsConfig()).(type) {
178 case interface{ ValidateAll() error }:
179 if err := v.ValidateAll(); err != nil {
180 errors = append(errors, BootstrapValidationError{
181 field: "HdsConfig",
182 reason: "embedded message failed validation",
183 cause: err,
184 })
185 }
186 case interface{ Validate() error }:
187 if err := v.Validate(); err != nil {
188 errors = append(errors, BootstrapValidationError{
189 field: "HdsConfig",
190 reason: "embedded message failed validation",
191 cause: err,
192 })
193 }
194 }
195 } else if v, ok := interface{}(m.GetHdsConfig()).(interface{ Validate() error }); ok {
196 if err := v.Validate(); err != nil {
197 return BootstrapValidationError{
198 field: "HdsConfig",
199 reason: "embedded message failed validation",
200 cause: err,
201 }
202 }
203 }
204
205
206
207 for idx, item := range m.GetStatsSinks() {
208 _, _ = idx, item
209
210 if all {
211 switch v := interface{}(item).(type) {
212 case interface{ ValidateAll() error }:
213 if err := v.ValidateAll(); err != nil {
214 errors = append(errors, BootstrapValidationError{
215 field: fmt.Sprintf("StatsSinks[%v]", idx),
216 reason: "embedded message failed validation",
217 cause: err,
218 })
219 }
220 case interface{ Validate() error }:
221 if err := v.Validate(); err != nil {
222 errors = append(errors, BootstrapValidationError{
223 field: fmt.Sprintf("StatsSinks[%v]", idx),
224 reason: "embedded message failed validation",
225 cause: err,
226 })
227 }
228 }
229 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
230 if err := v.Validate(); err != nil {
231 return BootstrapValidationError{
232 field: fmt.Sprintf("StatsSinks[%v]", idx),
233 reason: "embedded message failed validation",
234 cause: err,
235 }
236 }
237 }
238
239 }
240
241 if all {
242 switch v := interface{}(m.GetStatsConfig()).(type) {
243 case interface{ ValidateAll() error }:
244 if err := v.ValidateAll(); err != nil {
245 errors = append(errors, BootstrapValidationError{
246 field: "StatsConfig",
247 reason: "embedded message failed validation",
248 cause: err,
249 })
250 }
251 case interface{ Validate() error }:
252 if err := v.Validate(); err != nil {
253 errors = append(errors, BootstrapValidationError{
254 field: "StatsConfig",
255 reason: "embedded message failed validation",
256 cause: err,
257 })
258 }
259 }
260 } else if v, ok := interface{}(m.GetStatsConfig()).(interface{ Validate() error }); ok {
261 if err := v.Validate(); err != nil {
262 return BootstrapValidationError{
263 field: "StatsConfig",
264 reason: "embedded message failed validation",
265 cause: err,
266 }
267 }
268 }
269
270 if d := m.GetStatsFlushInterval(); d != nil {
271 dur, err := d.AsDuration(), d.CheckValid()
272 if err != nil {
273 err = BootstrapValidationError{
274 field: "StatsFlushInterval",
275 reason: "value is not a valid duration",
276 cause: err,
277 }
278 if !all {
279 return err
280 }
281 errors = append(errors, err)
282 } else {
283
284 lt := time.Duration(300*time.Second + 0*time.Nanosecond)
285 gte := time.Duration(0*time.Second + 1000000*time.Nanosecond)
286
287 if dur < gte || dur >= lt {
288 err := BootstrapValidationError{
289 field: "StatsFlushInterval",
290 reason: "value must be inside range [1ms, 5m0s)",
291 }
292 if !all {
293 return err
294 }
295 errors = append(errors, err)
296 }
297
298 }
299 }
300
301 if all {
302 switch v := interface{}(m.GetWatchdog()).(type) {
303 case interface{ ValidateAll() error }:
304 if err := v.ValidateAll(); err != nil {
305 errors = append(errors, BootstrapValidationError{
306 field: "Watchdog",
307 reason: "embedded message failed validation",
308 cause: err,
309 })
310 }
311 case interface{ Validate() error }:
312 if err := v.Validate(); err != nil {
313 errors = append(errors, BootstrapValidationError{
314 field: "Watchdog",
315 reason: "embedded message failed validation",
316 cause: err,
317 })
318 }
319 }
320 } else if v, ok := interface{}(m.GetWatchdog()).(interface{ Validate() error }); ok {
321 if err := v.Validate(); err != nil {
322 return BootstrapValidationError{
323 field: "Watchdog",
324 reason: "embedded message failed validation",
325 cause: err,
326 }
327 }
328 }
329
330 if all {
331 switch v := interface{}(m.GetTracing()).(type) {
332 case interface{ ValidateAll() error }:
333 if err := v.ValidateAll(); err != nil {
334 errors = append(errors, BootstrapValidationError{
335 field: "Tracing",
336 reason: "embedded message failed validation",
337 cause: err,
338 })
339 }
340 case interface{ Validate() error }:
341 if err := v.Validate(); err != nil {
342 errors = append(errors, BootstrapValidationError{
343 field: "Tracing",
344 reason: "embedded message failed validation",
345 cause: err,
346 })
347 }
348 }
349 } else if v, ok := interface{}(m.GetTracing()).(interface{ Validate() error }); ok {
350 if err := v.Validate(); err != nil {
351 return BootstrapValidationError{
352 field: "Tracing",
353 reason: "embedded message failed validation",
354 cause: err,
355 }
356 }
357 }
358
359 if all {
360 switch v := interface{}(m.GetRuntime()).(type) {
361 case interface{ ValidateAll() error }:
362 if err := v.ValidateAll(); err != nil {
363 errors = append(errors, BootstrapValidationError{
364 field: "Runtime",
365 reason: "embedded message failed validation",
366 cause: err,
367 })
368 }
369 case interface{ Validate() error }:
370 if err := v.Validate(); err != nil {
371 errors = append(errors, BootstrapValidationError{
372 field: "Runtime",
373 reason: "embedded message failed validation",
374 cause: err,
375 })
376 }
377 }
378 } else if v, ok := interface{}(m.GetRuntime()).(interface{ Validate() error }); ok {
379 if err := v.Validate(); err != nil {
380 return BootstrapValidationError{
381 field: "Runtime",
382 reason: "embedded message failed validation",
383 cause: err,
384 }
385 }
386 }
387
388 if all {
389 switch v := interface{}(m.GetLayeredRuntime()).(type) {
390 case interface{ ValidateAll() error }:
391 if err := v.ValidateAll(); err != nil {
392 errors = append(errors, BootstrapValidationError{
393 field: "LayeredRuntime",
394 reason: "embedded message failed validation",
395 cause: err,
396 })
397 }
398 case interface{ Validate() error }:
399 if err := v.Validate(); err != nil {
400 errors = append(errors, BootstrapValidationError{
401 field: "LayeredRuntime",
402 reason: "embedded message failed validation",
403 cause: err,
404 })
405 }
406 }
407 } else if v, ok := interface{}(m.GetLayeredRuntime()).(interface{ Validate() error }); ok {
408 if err := v.Validate(); err != nil {
409 return BootstrapValidationError{
410 field: "LayeredRuntime",
411 reason: "embedded message failed validation",
412 cause: err,
413 }
414 }
415 }
416
417 if all {
418 switch v := interface{}(m.GetAdmin()).(type) {
419 case interface{ ValidateAll() error }:
420 if err := v.ValidateAll(); err != nil {
421 errors = append(errors, BootstrapValidationError{
422 field: "Admin",
423 reason: "embedded message failed validation",
424 cause: err,
425 })
426 }
427 case interface{ Validate() error }:
428 if err := v.Validate(); err != nil {
429 errors = append(errors, BootstrapValidationError{
430 field: "Admin",
431 reason: "embedded message failed validation",
432 cause: err,
433 })
434 }
435 }
436 } else if v, ok := interface{}(m.GetAdmin()).(interface{ Validate() error }); ok {
437 if err := v.Validate(); err != nil {
438 return BootstrapValidationError{
439 field: "Admin",
440 reason: "embedded message failed validation",
441 cause: err,
442 }
443 }
444 }
445
446 if all {
447 switch v := interface{}(m.GetOverloadManager()).(type) {
448 case interface{ ValidateAll() error }:
449 if err := v.ValidateAll(); err != nil {
450 errors = append(errors, BootstrapValidationError{
451 field: "OverloadManager",
452 reason: "embedded message failed validation",
453 cause: err,
454 })
455 }
456 case interface{ Validate() error }:
457 if err := v.Validate(); err != nil {
458 errors = append(errors, BootstrapValidationError{
459 field: "OverloadManager",
460 reason: "embedded message failed validation",
461 cause: err,
462 })
463 }
464 }
465 } else if v, ok := interface{}(m.GetOverloadManager()).(interface{ Validate() error }); ok {
466 if err := v.Validate(); err != nil {
467 return BootstrapValidationError{
468 field: "OverloadManager",
469 reason: "embedded message failed validation",
470 cause: err,
471 }
472 }
473 }
474
475
476
477
478
479 if all {
480 switch v := interface{}(m.GetStatsServerVersionOverride()).(type) {
481 case interface{ ValidateAll() error }:
482 if err := v.ValidateAll(); err != nil {
483 errors = append(errors, BootstrapValidationError{
484 field: "StatsServerVersionOverride",
485 reason: "embedded message failed validation",
486 cause: err,
487 })
488 }
489 case interface{ Validate() error }:
490 if err := v.Validate(); err != nil {
491 errors = append(errors, BootstrapValidationError{
492 field: "StatsServerVersionOverride",
493 reason: "embedded message failed validation",
494 cause: err,
495 })
496 }
497 }
498 } else if v, ok := interface{}(m.GetStatsServerVersionOverride()).(interface{ Validate() error }); ok {
499 if err := v.Validate(); err != nil {
500 return BootstrapValidationError{
501 field: "StatsServerVersionOverride",
502 reason: "embedded message failed validation",
503 cause: err,
504 }
505 }
506 }
507
508
509
510 if len(errors) > 0 {
511 return BootstrapMultiError(errors)
512 }
513
514 return nil
515 }
516
517
518
519 type BootstrapMultiError []error
520
521
522 func (m BootstrapMultiError) Error() string {
523 var msgs []string
524 for _, err := range m {
525 msgs = append(msgs, err.Error())
526 }
527 return strings.Join(msgs, "; ")
528 }
529
530
531 func (m BootstrapMultiError) AllErrors() []error { return m }
532
533
534
535 type BootstrapValidationError struct {
536 field string
537 reason string
538 cause error
539 key bool
540 }
541
542
543 func (e BootstrapValidationError) Field() string { return e.field }
544
545
546 func (e BootstrapValidationError) Reason() string { return e.reason }
547
548
549 func (e BootstrapValidationError) Cause() error { return e.cause }
550
551
552 func (e BootstrapValidationError) Key() bool { return e.key }
553
554
555 func (e BootstrapValidationError) ErrorName() string { return "BootstrapValidationError" }
556
557
558 func (e BootstrapValidationError) Error() string {
559 cause := ""
560 if e.cause != nil {
561 cause = fmt.Sprintf(" | caused by: %v", e.cause)
562 }
563
564 key := ""
565 if e.key {
566 key = "key for "
567 }
568
569 return fmt.Sprintf(
570 "invalid %sBootstrap.%s: %s%s",
571 key,
572 e.field,
573 e.reason,
574 cause)
575 }
576
577 var _ error = BootstrapValidationError{}
578
579 var _ interface {
580 Field() string
581 Reason() string
582 Key() bool
583 Cause() error
584 ErrorName() string
585 } = BootstrapValidationError{}
586
587
588
589
590 func (m *Admin) Validate() error {
591 return m.validate(false)
592 }
593
594
595
596
597 func (m *Admin) ValidateAll() error {
598 return m.validate(true)
599 }
600
601 func (m *Admin) validate(all bool) error {
602 if m == nil {
603 return nil
604 }
605
606 var errors []error
607
608
609
610
611
612 if all {
613 switch v := interface{}(m.GetAddress()).(type) {
614 case interface{ ValidateAll() error }:
615 if err := v.ValidateAll(); err != nil {
616 errors = append(errors, AdminValidationError{
617 field: "Address",
618 reason: "embedded message failed validation",
619 cause: err,
620 })
621 }
622 case interface{ Validate() error }:
623 if err := v.Validate(); err != nil {
624 errors = append(errors, AdminValidationError{
625 field: "Address",
626 reason: "embedded message failed validation",
627 cause: err,
628 })
629 }
630 }
631 } else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
632 if err := v.Validate(); err != nil {
633 return AdminValidationError{
634 field: "Address",
635 reason: "embedded message failed validation",
636 cause: err,
637 }
638 }
639 }
640
641 for idx, item := range m.GetSocketOptions() {
642 _, _ = idx, item
643
644 if all {
645 switch v := interface{}(item).(type) {
646 case interface{ ValidateAll() error }:
647 if err := v.ValidateAll(); err != nil {
648 errors = append(errors, AdminValidationError{
649 field: fmt.Sprintf("SocketOptions[%v]", idx),
650 reason: "embedded message failed validation",
651 cause: err,
652 })
653 }
654 case interface{ Validate() error }:
655 if err := v.Validate(); err != nil {
656 errors = append(errors, AdminValidationError{
657 field: fmt.Sprintf("SocketOptions[%v]", idx),
658 reason: "embedded message failed validation",
659 cause: err,
660 })
661 }
662 }
663 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
664 if err := v.Validate(); err != nil {
665 return AdminValidationError{
666 field: fmt.Sprintf("SocketOptions[%v]", idx),
667 reason: "embedded message failed validation",
668 cause: err,
669 }
670 }
671 }
672
673 }
674
675 if len(errors) > 0 {
676 return AdminMultiError(errors)
677 }
678
679 return nil
680 }
681
682
683
684 type AdminMultiError []error
685
686
687 func (m AdminMultiError) Error() string {
688 var msgs []string
689 for _, err := range m {
690 msgs = append(msgs, err.Error())
691 }
692 return strings.Join(msgs, "; ")
693 }
694
695
696 func (m AdminMultiError) AllErrors() []error { return m }
697
698
699
700 type AdminValidationError struct {
701 field string
702 reason string
703 cause error
704 key bool
705 }
706
707
708 func (e AdminValidationError) Field() string { return e.field }
709
710
711 func (e AdminValidationError) Reason() string { return e.reason }
712
713
714 func (e AdminValidationError) Cause() error { return e.cause }
715
716
717 func (e AdminValidationError) Key() bool { return e.key }
718
719
720 func (e AdminValidationError) ErrorName() string { return "AdminValidationError" }
721
722
723 func (e AdminValidationError) Error() string {
724 cause := ""
725 if e.cause != nil {
726 cause = fmt.Sprintf(" | caused by: %v", e.cause)
727 }
728
729 key := ""
730 if e.key {
731 key = "key for "
732 }
733
734 return fmt.Sprintf(
735 "invalid %sAdmin.%s: %s%s",
736 key,
737 e.field,
738 e.reason,
739 cause)
740 }
741
742 var _ error = AdminValidationError{}
743
744 var _ interface {
745 Field() string
746 Reason() string
747 Key() bool
748 Cause() error
749 ErrorName() string
750 } = AdminValidationError{}
751
752
753
754
755 func (m *ClusterManager) Validate() error {
756 return m.validate(false)
757 }
758
759
760
761
762
763 func (m *ClusterManager) ValidateAll() error {
764 return m.validate(true)
765 }
766
767 func (m *ClusterManager) validate(all bool) error {
768 if m == nil {
769 return nil
770 }
771
772 var errors []error
773
774
775
776 if all {
777 switch v := interface{}(m.GetOutlierDetection()).(type) {
778 case interface{ ValidateAll() error }:
779 if err := v.ValidateAll(); err != nil {
780 errors = append(errors, ClusterManagerValidationError{
781 field: "OutlierDetection",
782 reason: "embedded message failed validation",
783 cause: err,
784 })
785 }
786 case interface{ Validate() error }:
787 if err := v.Validate(); err != nil {
788 errors = append(errors, ClusterManagerValidationError{
789 field: "OutlierDetection",
790 reason: "embedded message failed validation",
791 cause: err,
792 })
793 }
794 }
795 } else if v, ok := interface{}(m.GetOutlierDetection()).(interface{ Validate() error }); ok {
796 if err := v.Validate(); err != nil {
797 return ClusterManagerValidationError{
798 field: "OutlierDetection",
799 reason: "embedded message failed validation",
800 cause: err,
801 }
802 }
803 }
804
805 if all {
806 switch v := interface{}(m.GetUpstreamBindConfig()).(type) {
807 case interface{ ValidateAll() error }:
808 if err := v.ValidateAll(); err != nil {
809 errors = append(errors, ClusterManagerValidationError{
810 field: "UpstreamBindConfig",
811 reason: "embedded message failed validation",
812 cause: err,
813 })
814 }
815 case interface{ Validate() error }:
816 if err := v.Validate(); err != nil {
817 errors = append(errors, ClusterManagerValidationError{
818 field: "UpstreamBindConfig",
819 reason: "embedded message failed validation",
820 cause: err,
821 })
822 }
823 }
824 } else if v, ok := interface{}(m.GetUpstreamBindConfig()).(interface{ Validate() error }); ok {
825 if err := v.Validate(); err != nil {
826 return ClusterManagerValidationError{
827 field: "UpstreamBindConfig",
828 reason: "embedded message failed validation",
829 cause: err,
830 }
831 }
832 }
833
834 if all {
835 switch v := interface{}(m.GetLoadStatsConfig()).(type) {
836 case interface{ ValidateAll() error }:
837 if err := v.ValidateAll(); err != nil {
838 errors = append(errors, ClusterManagerValidationError{
839 field: "LoadStatsConfig",
840 reason: "embedded message failed validation",
841 cause: err,
842 })
843 }
844 case interface{ Validate() error }:
845 if err := v.Validate(); err != nil {
846 errors = append(errors, ClusterManagerValidationError{
847 field: "LoadStatsConfig",
848 reason: "embedded message failed validation",
849 cause: err,
850 })
851 }
852 }
853 } else if v, ok := interface{}(m.GetLoadStatsConfig()).(interface{ Validate() error }); ok {
854 if err := v.Validate(); err != nil {
855 return ClusterManagerValidationError{
856 field: "LoadStatsConfig",
857 reason: "embedded message failed validation",
858 cause: err,
859 }
860 }
861 }
862
863 if len(errors) > 0 {
864 return ClusterManagerMultiError(errors)
865 }
866
867 return nil
868 }
869
870
871
872
873 type ClusterManagerMultiError []error
874
875
876 func (m ClusterManagerMultiError) Error() string {
877 var msgs []string
878 for _, err := range m {
879 msgs = append(msgs, err.Error())
880 }
881 return strings.Join(msgs, "; ")
882 }
883
884
885 func (m ClusterManagerMultiError) AllErrors() []error { return m }
886
887
888
889 type ClusterManagerValidationError struct {
890 field string
891 reason string
892 cause error
893 key bool
894 }
895
896
897 func (e ClusterManagerValidationError) Field() string { return e.field }
898
899
900 func (e ClusterManagerValidationError) Reason() string { return e.reason }
901
902
903 func (e ClusterManagerValidationError) Cause() error { return e.cause }
904
905
906 func (e ClusterManagerValidationError) Key() bool { return e.key }
907
908
909 func (e ClusterManagerValidationError) ErrorName() string { return "ClusterManagerValidationError" }
910
911
912 func (e ClusterManagerValidationError) Error() string {
913 cause := ""
914 if e.cause != nil {
915 cause = fmt.Sprintf(" | caused by: %v", e.cause)
916 }
917
918 key := ""
919 if e.key {
920 key = "key for "
921 }
922
923 return fmt.Sprintf(
924 "invalid %sClusterManager.%s: %s%s",
925 key,
926 e.field,
927 e.reason,
928 cause)
929 }
930
931 var _ error = ClusterManagerValidationError{}
932
933 var _ interface {
934 Field() string
935 Reason() string
936 Key() bool
937 Cause() error
938 ErrorName() string
939 } = ClusterManagerValidationError{}
940
941
942
943
944 func (m *Watchdog) Validate() error {
945 return m.validate(false)
946 }
947
948
949
950
951
952 func (m *Watchdog) ValidateAll() error {
953 return m.validate(true)
954 }
955
956 func (m *Watchdog) validate(all bool) error {
957 if m == nil {
958 return nil
959 }
960
961 var errors []error
962
963 if all {
964 switch v := interface{}(m.GetMissTimeout()).(type) {
965 case interface{ ValidateAll() error }:
966 if err := v.ValidateAll(); err != nil {
967 errors = append(errors, WatchdogValidationError{
968 field: "MissTimeout",
969 reason: "embedded message failed validation",
970 cause: err,
971 })
972 }
973 case interface{ Validate() error }:
974 if err := v.Validate(); err != nil {
975 errors = append(errors, WatchdogValidationError{
976 field: "MissTimeout",
977 reason: "embedded message failed validation",
978 cause: err,
979 })
980 }
981 }
982 } else if v, ok := interface{}(m.GetMissTimeout()).(interface{ Validate() error }); ok {
983 if err := v.Validate(); err != nil {
984 return WatchdogValidationError{
985 field: "MissTimeout",
986 reason: "embedded message failed validation",
987 cause: err,
988 }
989 }
990 }
991
992 if all {
993 switch v := interface{}(m.GetMegamissTimeout()).(type) {
994 case interface{ ValidateAll() error }:
995 if err := v.ValidateAll(); err != nil {
996 errors = append(errors, WatchdogValidationError{
997 field: "MegamissTimeout",
998 reason: "embedded message failed validation",
999 cause: err,
1000 })
1001 }
1002 case interface{ Validate() error }:
1003 if err := v.Validate(); err != nil {
1004 errors = append(errors, WatchdogValidationError{
1005 field: "MegamissTimeout",
1006 reason: "embedded message failed validation",
1007 cause: err,
1008 })
1009 }
1010 }
1011 } else if v, ok := interface{}(m.GetMegamissTimeout()).(interface{ Validate() error }); ok {
1012 if err := v.Validate(); err != nil {
1013 return WatchdogValidationError{
1014 field: "MegamissTimeout",
1015 reason: "embedded message failed validation",
1016 cause: err,
1017 }
1018 }
1019 }
1020
1021 if all {
1022 switch v := interface{}(m.GetKillTimeout()).(type) {
1023 case interface{ ValidateAll() error }:
1024 if err := v.ValidateAll(); err != nil {
1025 errors = append(errors, WatchdogValidationError{
1026 field: "KillTimeout",
1027 reason: "embedded message failed validation",
1028 cause: err,
1029 })
1030 }
1031 case interface{ Validate() error }:
1032 if err := v.Validate(); err != nil {
1033 errors = append(errors, WatchdogValidationError{
1034 field: "KillTimeout",
1035 reason: "embedded message failed validation",
1036 cause: err,
1037 })
1038 }
1039 }
1040 } else if v, ok := interface{}(m.GetKillTimeout()).(interface{ Validate() error }); ok {
1041 if err := v.Validate(); err != nil {
1042 return WatchdogValidationError{
1043 field: "KillTimeout",
1044 reason: "embedded message failed validation",
1045 cause: err,
1046 }
1047 }
1048 }
1049
1050 if all {
1051 switch v := interface{}(m.GetMultikillTimeout()).(type) {
1052 case interface{ ValidateAll() error }:
1053 if err := v.ValidateAll(); err != nil {
1054 errors = append(errors, WatchdogValidationError{
1055 field: "MultikillTimeout",
1056 reason: "embedded message failed validation",
1057 cause: err,
1058 })
1059 }
1060 case interface{ Validate() error }:
1061 if err := v.Validate(); err != nil {
1062 errors = append(errors, WatchdogValidationError{
1063 field: "MultikillTimeout",
1064 reason: "embedded message failed validation",
1065 cause: err,
1066 })
1067 }
1068 }
1069 } else if v, ok := interface{}(m.GetMultikillTimeout()).(interface{ Validate() error }); ok {
1070 if err := v.Validate(); err != nil {
1071 return WatchdogValidationError{
1072 field: "MultikillTimeout",
1073 reason: "embedded message failed validation",
1074 cause: err,
1075 }
1076 }
1077 }
1078
1079 if len(errors) > 0 {
1080 return WatchdogMultiError(errors)
1081 }
1082
1083 return nil
1084 }
1085
1086
1087
1088 type WatchdogMultiError []error
1089
1090
1091 func (m WatchdogMultiError) Error() string {
1092 var msgs []string
1093 for _, err := range m {
1094 msgs = append(msgs, err.Error())
1095 }
1096 return strings.Join(msgs, "; ")
1097 }
1098
1099
1100 func (m WatchdogMultiError) AllErrors() []error { return m }
1101
1102
1103
1104 type WatchdogValidationError struct {
1105 field string
1106 reason string
1107 cause error
1108 key bool
1109 }
1110
1111
1112 func (e WatchdogValidationError) Field() string { return e.field }
1113
1114
1115 func (e WatchdogValidationError) Reason() string { return e.reason }
1116
1117
1118 func (e WatchdogValidationError) Cause() error { return e.cause }
1119
1120
1121 func (e WatchdogValidationError) Key() bool { return e.key }
1122
1123
1124 func (e WatchdogValidationError) ErrorName() string { return "WatchdogValidationError" }
1125
1126
1127 func (e WatchdogValidationError) Error() string {
1128 cause := ""
1129 if e.cause != nil {
1130 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1131 }
1132
1133 key := ""
1134 if e.key {
1135 key = "key for "
1136 }
1137
1138 return fmt.Sprintf(
1139 "invalid %sWatchdog.%s: %s%s",
1140 key,
1141 e.field,
1142 e.reason,
1143 cause)
1144 }
1145
1146 var _ error = WatchdogValidationError{}
1147
1148 var _ interface {
1149 Field() string
1150 Reason() string
1151 Key() bool
1152 Cause() error
1153 ErrorName() string
1154 } = WatchdogValidationError{}
1155
1156
1157
1158
1159 func (m *Runtime) Validate() error {
1160 return m.validate(false)
1161 }
1162
1163
1164
1165
1166 func (m *Runtime) ValidateAll() error {
1167 return m.validate(true)
1168 }
1169
1170 func (m *Runtime) validate(all bool) error {
1171 if m == nil {
1172 return nil
1173 }
1174
1175 var errors []error
1176
1177
1178
1179
1180
1181
1182
1183 if all {
1184 switch v := interface{}(m.GetBase()).(type) {
1185 case interface{ ValidateAll() error }:
1186 if err := v.ValidateAll(); err != nil {
1187 errors = append(errors, RuntimeValidationError{
1188 field: "Base",
1189 reason: "embedded message failed validation",
1190 cause: err,
1191 })
1192 }
1193 case interface{ Validate() error }:
1194 if err := v.Validate(); err != nil {
1195 errors = append(errors, RuntimeValidationError{
1196 field: "Base",
1197 reason: "embedded message failed validation",
1198 cause: err,
1199 })
1200 }
1201 }
1202 } else if v, ok := interface{}(m.GetBase()).(interface{ Validate() error }); ok {
1203 if err := v.Validate(); err != nil {
1204 return RuntimeValidationError{
1205 field: "Base",
1206 reason: "embedded message failed validation",
1207 cause: err,
1208 }
1209 }
1210 }
1211
1212 if len(errors) > 0 {
1213 return RuntimeMultiError(errors)
1214 }
1215
1216 return nil
1217 }
1218
1219
1220
1221 type RuntimeMultiError []error
1222
1223
1224 func (m RuntimeMultiError) Error() string {
1225 var msgs []string
1226 for _, err := range m {
1227 msgs = append(msgs, err.Error())
1228 }
1229 return strings.Join(msgs, "; ")
1230 }
1231
1232
1233 func (m RuntimeMultiError) AllErrors() []error { return m }
1234
1235
1236
1237 type RuntimeValidationError struct {
1238 field string
1239 reason string
1240 cause error
1241 key bool
1242 }
1243
1244
1245 func (e RuntimeValidationError) Field() string { return e.field }
1246
1247
1248 func (e RuntimeValidationError) Reason() string { return e.reason }
1249
1250
1251 func (e RuntimeValidationError) Cause() error { return e.cause }
1252
1253
1254 func (e RuntimeValidationError) Key() bool { return e.key }
1255
1256
1257 func (e RuntimeValidationError) ErrorName() string { return "RuntimeValidationError" }
1258
1259
1260 func (e RuntimeValidationError) Error() string {
1261 cause := ""
1262 if e.cause != nil {
1263 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1264 }
1265
1266 key := ""
1267 if e.key {
1268 key = "key for "
1269 }
1270
1271 return fmt.Sprintf(
1272 "invalid %sRuntime.%s: %s%s",
1273 key,
1274 e.field,
1275 e.reason,
1276 cause)
1277 }
1278
1279 var _ error = RuntimeValidationError{}
1280
1281 var _ interface {
1282 Field() string
1283 Reason() string
1284 Key() bool
1285 Cause() error
1286 ErrorName() string
1287 } = RuntimeValidationError{}
1288
1289
1290
1291
1292 func (m *RuntimeLayer) Validate() error {
1293 return m.validate(false)
1294 }
1295
1296
1297
1298
1299
1300 func (m *RuntimeLayer) ValidateAll() error {
1301 return m.validate(true)
1302 }
1303
1304 func (m *RuntimeLayer) validate(all bool) error {
1305 if m == nil {
1306 return nil
1307 }
1308
1309 var errors []error
1310
1311 if len(m.GetName()) < 1 {
1312 err := RuntimeLayerValidationError{
1313 field: "Name",
1314 reason: "value length must be at least 1 bytes",
1315 }
1316 if !all {
1317 return err
1318 }
1319 errors = append(errors, err)
1320 }
1321
1322 oneofLayerSpecifierPresent := false
1323 switch v := m.LayerSpecifier.(type) {
1324 case *RuntimeLayer_StaticLayer:
1325 if v == nil {
1326 err := RuntimeLayerValidationError{
1327 field: "LayerSpecifier",
1328 reason: "oneof value cannot be a typed-nil",
1329 }
1330 if !all {
1331 return err
1332 }
1333 errors = append(errors, err)
1334 }
1335 oneofLayerSpecifierPresent = true
1336
1337 if all {
1338 switch v := interface{}(m.GetStaticLayer()).(type) {
1339 case interface{ ValidateAll() error }:
1340 if err := v.ValidateAll(); err != nil {
1341 errors = append(errors, RuntimeLayerValidationError{
1342 field: "StaticLayer",
1343 reason: "embedded message failed validation",
1344 cause: err,
1345 })
1346 }
1347 case interface{ Validate() error }:
1348 if err := v.Validate(); err != nil {
1349 errors = append(errors, RuntimeLayerValidationError{
1350 field: "StaticLayer",
1351 reason: "embedded message failed validation",
1352 cause: err,
1353 })
1354 }
1355 }
1356 } else if v, ok := interface{}(m.GetStaticLayer()).(interface{ Validate() error }); ok {
1357 if err := v.Validate(); err != nil {
1358 return RuntimeLayerValidationError{
1359 field: "StaticLayer",
1360 reason: "embedded message failed validation",
1361 cause: err,
1362 }
1363 }
1364 }
1365
1366 case *RuntimeLayer_DiskLayer_:
1367 if v == nil {
1368 err := RuntimeLayerValidationError{
1369 field: "LayerSpecifier",
1370 reason: "oneof value cannot be a typed-nil",
1371 }
1372 if !all {
1373 return err
1374 }
1375 errors = append(errors, err)
1376 }
1377 oneofLayerSpecifierPresent = true
1378
1379 if all {
1380 switch v := interface{}(m.GetDiskLayer()).(type) {
1381 case interface{ ValidateAll() error }:
1382 if err := v.ValidateAll(); err != nil {
1383 errors = append(errors, RuntimeLayerValidationError{
1384 field: "DiskLayer",
1385 reason: "embedded message failed validation",
1386 cause: err,
1387 })
1388 }
1389 case interface{ Validate() error }:
1390 if err := v.Validate(); err != nil {
1391 errors = append(errors, RuntimeLayerValidationError{
1392 field: "DiskLayer",
1393 reason: "embedded message failed validation",
1394 cause: err,
1395 })
1396 }
1397 }
1398 } else if v, ok := interface{}(m.GetDiskLayer()).(interface{ Validate() error }); ok {
1399 if err := v.Validate(); err != nil {
1400 return RuntimeLayerValidationError{
1401 field: "DiskLayer",
1402 reason: "embedded message failed validation",
1403 cause: err,
1404 }
1405 }
1406 }
1407
1408 case *RuntimeLayer_AdminLayer_:
1409 if v == nil {
1410 err := RuntimeLayerValidationError{
1411 field: "LayerSpecifier",
1412 reason: "oneof value cannot be a typed-nil",
1413 }
1414 if !all {
1415 return err
1416 }
1417 errors = append(errors, err)
1418 }
1419 oneofLayerSpecifierPresent = true
1420
1421 if all {
1422 switch v := interface{}(m.GetAdminLayer()).(type) {
1423 case interface{ ValidateAll() error }:
1424 if err := v.ValidateAll(); err != nil {
1425 errors = append(errors, RuntimeLayerValidationError{
1426 field: "AdminLayer",
1427 reason: "embedded message failed validation",
1428 cause: err,
1429 })
1430 }
1431 case interface{ Validate() error }:
1432 if err := v.Validate(); err != nil {
1433 errors = append(errors, RuntimeLayerValidationError{
1434 field: "AdminLayer",
1435 reason: "embedded message failed validation",
1436 cause: err,
1437 })
1438 }
1439 }
1440 } else if v, ok := interface{}(m.GetAdminLayer()).(interface{ Validate() error }); ok {
1441 if err := v.Validate(); err != nil {
1442 return RuntimeLayerValidationError{
1443 field: "AdminLayer",
1444 reason: "embedded message failed validation",
1445 cause: err,
1446 }
1447 }
1448 }
1449
1450 case *RuntimeLayer_RtdsLayer_:
1451 if v == nil {
1452 err := RuntimeLayerValidationError{
1453 field: "LayerSpecifier",
1454 reason: "oneof value cannot be a typed-nil",
1455 }
1456 if !all {
1457 return err
1458 }
1459 errors = append(errors, err)
1460 }
1461 oneofLayerSpecifierPresent = true
1462
1463 if all {
1464 switch v := interface{}(m.GetRtdsLayer()).(type) {
1465 case interface{ ValidateAll() error }:
1466 if err := v.ValidateAll(); err != nil {
1467 errors = append(errors, RuntimeLayerValidationError{
1468 field: "RtdsLayer",
1469 reason: "embedded message failed validation",
1470 cause: err,
1471 })
1472 }
1473 case interface{ Validate() error }:
1474 if err := v.Validate(); err != nil {
1475 errors = append(errors, RuntimeLayerValidationError{
1476 field: "RtdsLayer",
1477 reason: "embedded message failed validation",
1478 cause: err,
1479 })
1480 }
1481 }
1482 } else if v, ok := interface{}(m.GetRtdsLayer()).(interface{ Validate() error }); ok {
1483 if err := v.Validate(); err != nil {
1484 return RuntimeLayerValidationError{
1485 field: "RtdsLayer",
1486 reason: "embedded message failed validation",
1487 cause: err,
1488 }
1489 }
1490 }
1491
1492 default:
1493 _ = v
1494 }
1495 if !oneofLayerSpecifierPresent {
1496 err := RuntimeLayerValidationError{
1497 field: "LayerSpecifier",
1498 reason: "value is required",
1499 }
1500 if !all {
1501 return err
1502 }
1503 errors = append(errors, err)
1504 }
1505
1506 if len(errors) > 0 {
1507 return RuntimeLayerMultiError(errors)
1508 }
1509
1510 return nil
1511 }
1512
1513
1514
1515 type RuntimeLayerMultiError []error
1516
1517
1518 func (m RuntimeLayerMultiError) Error() string {
1519 var msgs []string
1520 for _, err := range m {
1521 msgs = append(msgs, err.Error())
1522 }
1523 return strings.Join(msgs, "; ")
1524 }
1525
1526
1527 func (m RuntimeLayerMultiError) AllErrors() []error { return m }
1528
1529
1530
1531 type RuntimeLayerValidationError struct {
1532 field string
1533 reason string
1534 cause error
1535 key bool
1536 }
1537
1538
1539 func (e RuntimeLayerValidationError) Field() string { return e.field }
1540
1541
1542 func (e RuntimeLayerValidationError) Reason() string { return e.reason }
1543
1544
1545 func (e RuntimeLayerValidationError) Cause() error { return e.cause }
1546
1547
1548 func (e RuntimeLayerValidationError) Key() bool { return e.key }
1549
1550
1551 func (e RuntimeLayerValidationError) ErrorName() string { return "RuntimeLayerValidationError" }
1552
1553
1554 func (e RuntimeLayerValidationError) Error() string {
1555 cause := ""
1556 if e.cause != nil {
1557 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1558 }
1559
1560 key := ""
1561 if e.key {
1562 key = "key for "
1563 }
1564
1565 return fmt.Sprintf(
1566 "invalid %sRuntimeLayer.%s: %s%s",
1567 key,
1568 e.field,
1569 e.reason,
1570 cause)
1571 }
1572
1573 var _ error = RuntimeLayerValidationError{}
1574
1575 var _ interface {
1576 Field() string
1577 Reason() string
1578 Key() bool
1579 Cause() error
1580 ErrorName() string
1581 } = RuntimeLayerValidationError{}
1582
1583
1584
1585
1586 func (m *LayeredRuntime) Validate() error {
1587 return m.validate(false)
1588 }
1589
1590
1591
1592
1593
1594 func (m *LayeredRuntime) ValidateAll() error {
1595 return m.validate(true)
1596 }
1597
1598 func (m *LayeredRuntime) validate(all bool) error {
1599 if m == nil {
1600 return nil
1601 }
1602
1603 var errors []error
1604
1605 for idx, item := range m.GetLayers() {
1606 _, _ = idx, item
1607
1608 if all {
1609 switch v := interface{}(item).(type) {
1610 case interface{ ValidateAll() error }:
1611 if err := v.ValidateAll(); err != nil {
1612 errors = append(errors, LayeredRuntimeValidationError{
1613 field: fmt.Sprintf("Layers[%v]", idx),
1614 reason: "embedded message failed validation",
1615 cause: err,
1616 })
1617 }
1618 case interface{ Validate() error }:
1619 if err := v.Validate(); err != nil {
1620 errors = append(errors, LayeredRuntimeValidationError{
1621 field: fmt.Sprintf("Layers[%v]", idx),
1622 reason: "embedded message failed validation",
1623 cause: err,
1624 })
1625 }
1626 }
1627 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1628 if err := v.Validate(); err != nil {
1629 return LayeredRuntimeValidationError{
1630 field: fmt.Sprintf("Layers[%v]", idx),
1631 reason: "embedded message failed validation",
1632 cause: err,
1633 }
1634 }
1635 }
1636
1637 }
1638
1639 if len(errors) > 0 {
1640 return LayeredRuntimeMultiError(errors)
1641 }
1642
1643 return nil
1644 }
1645
1646
1647
1648
1649 type LayeredRuntimeMultiError []error
1650
1651
1652 func (m LayeredRuntimeMultiError) Error() string {
1653 var msgs []string
1654 for _, err := range m {
1655 msgs = append(msgs, err.Error())
1656 }
1657 return strings.Join(msgs, "; ")
1658 }
1659
1660
1661 func (m LayeredRuntimeMultiError) AllErrors() []error { return m }
1662
1663
1664
1665 type LayeredRuntimeValidationError struct {
1666 field string
1667 reason string
1668 cause error
1669 key bool
1670 }
1671
1672
1673 func (e LayeredRuntimeValidationError) Field() string { return e.field }
1674
1675
1676 func (e LayeredRuntimeValidationError) Reason() string { return e.reason }
1677
1678
1679 func (e LayeredRuntimeValidationError) Cause() error { return e.cause }
1680
1681
1682 func (e LayeredRuntimeValidationError) Key() bool { return e.key }
1683
1684
1685 func (e LayeredRuntimeValidationError) ErrorName() string { return "LayeredRuntimeValidationError" }
1686
1687
1688 func (e LayeredRuntimeValidationError) Error() string {
1689 cause := ""
1690 if e.cause != nil {
1691 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1692 }
1693
1694 key := ""
1695 if e.key {
1696 key = "key for "
1697 }
1698
1699 return fmt.Sprintf(
1700 "invalid %sLayeredRuntime.%s: %s%s",
1701 key,
1702 e.field,
1703 e.reason,
1704 cause)
1705 }
1706
1707 var _ error = LayeredRuntimeValidationError{}
1708
1709 var _ interface {
1710 Field() string
1711 Reason() string
1712 Key() bool
1713 Cause() error
1714 ErrorName() string
1715 } = LayeredRuntimeValidationError{}
1716
1717
1718
1719
1720 func (m *Bootstrap_StaticResources) Validate() error {
1721 return m.validate(false)
1722 }
1723
1724
1725
1726
1727
1728 func (m *Bootstrap_StaticResources) ValidateAll() error {
1729 return m.validate(true)
1730 }
1731
1732 func (m *Bootstrap_StaticResources) validate(all bool) error {
1733 if m == nil {
1734 return nil
1735 }
1736
1737 var errors []error
1738
1739 for idx, item := range m.GetListeners() {
1740 _, _ = idx, item
1741
1742 if all {
1743 switch v := interface{}(item).(type) {
1744 case interface{ ValidateAll() error }:
1745 if err := v.ValidateAll(); err != nil {
1746 errors = append(errors, Bootstrap_StaticResourcesValidationError{
1747 field: fmt.Sprintf("Listeners[%v]", idx),
1748 reason: "embedded message failed validation",
1749 cause: err,
1750 })
1751 }
1752 case interface{ Validate() error }:
1753 if err := v.Validate(); err != nil {
1754 errors = append(errors, Bootstrap_StaticResourcesValidationError{
1755 field: fmt.Sprintf("Listeners[%v]", idx),
1756 reason: "embedded message failed validation",
1757 cause: err,
1758 })
1759 }
1760 }
1761 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1762 if err := v.Validate(); err != nil {
1763 return Bootstrap_StaticResourcesValidationError{
1764 field: fmt.Sprintf("Listeners[%v]", idx),
1765 reason: "embedded message failed validation",
1766 cause: err,
1767 }
1768 }
1769 }
1770
1771 }
1772
1773 for idx, item := range m.GetClusters() {
1774 _, _ = idx, item
1775
1776 if all {
1777 switch v := interface{}(item).(type) {
1778 case interface{ ValidateAll() error }:
1779 if err := v.ValidateAll(); err != nil {
1780 errors = append(errors, Bootstrap_StaticResourcesValidationError{
1781 field: fmt.Sprintf("Clusters[%v]", idx),
1782 reason: "embedded message failed validation",
1783 cause: err,
1784 })
1785 }
1786 case interface{ Validate() error }:
1787 if err := v.Validate(); err != nil {
1788 errors = append(errors, Bootstrap_StaticResourcesValidationError{
1789 field: fmt.Sprintf("Clusters[%v]", idx),
1790 reason: "embedded message failed validation",
1791 cause: err,
1792 })
1793 }
1794 }
1795 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1796 if err := v.Validate(); err != nil {
1797 return Bootstrap_StaticResourcesValidationError{
1798 field: fmt.Sprintf("Clusters[%v]", idx),
1799 reason: "embedded message failed validation",
1800 cause: err,
1801 }
1802 }
1803 }
1804
1805 }
1806
1807 for idx, item := range m.GetSecrets() {
1808 _, _ = idx, item
1809
1810 if all {
1811 switch v := interface{}(item).(type) {
1812 case interface{ ValidateAll() error }:
1813 if err := v.ValidateAll(); err != nil {
1814 errors = append(errors, Bootstrap_StaticResourcesValidationError{
1815 field: fmt.Sprintf("Secrets[%v]", idx),
1816 reason: "embedded message failed validation",
1817 cause: err,
1818 })
1819 }
1820 case interface{ Validate() error }:
1821 if err := v.Validate(); err != nil {
1822 errors = append(errors, Bootstrap_StaticResourcesValidationError{
1823 field: fmt.Sprintf("Secrets[%v]", idx),
1824 reason: "embedded message failed validation",
1825 cause: err,
1826 })
1827 }
1828 }
1829 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1830 if err := v.Validate(); err != nil {
1831 return Bootstrap_StaticResourcesValidationError{
1832 field: fmt.Sprintf("Secrets[%v]", idx),
1833 reason: "embedded message failed validation",
1834 cause: err,
1835 }
1836 }
1837 }
1838
1839 }
1840
1841 if len(errors) > 0 {
1842 return Bootstrap_StaticResourcesMultiError(errors)
1843 }
1844
1845 return nil
1846 }
1847
1848
1849
1850
1851 type Bootstrap_StaticResourcesMultiError []error
1852
1853
1854 func (m Bootstrap_StaticResourcesMultiError) Error() string {
1855 var msgs []string
1856 for _, err := range m {
1857 msgs = append(msgs, err.Error())
1858 }
1859 return strings.Join(msgs, "; ")
1860 }
1861
1862
1863 func (m Bootstrap_StaticResourcesMultiError) AllErrors() []error { return m }
1864
1865
1866
1867 type Bootstrap_StaticResourcesValidationError struct {
1868 field string
1869 reason string
1870 cause error
1871 key bool
1872 }
1873
1874
1875 func (e Bootstrap_StaticResourcesValidationError) Field() string { return e.field }
1876
1877
1878 func (e Bootstrap_StaticResourcesValidationError) Reason() string { return e.reason }
1879
1880
1881 func (e Bootstrap_StaticResourcesValidationError) Cause() error { return e.cause }
1882
1883
1884 func (e Bootstrap_StaticResourcesValidationError) Key() bool { return e.key }
1885
1886
1887 func (e Bootstrap_StaticResourcesValidationError) ErrorName() string {
1888 return "Bootstrap_StaticResourcesValidationError"
1889 }
1890
1891
1892 func (e Bootstrap_StaticResourcesValidationError) Error() string {
1893 cause := ""
1894 if e.cause != nil {
1895 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1896 }
1897
1898 key := ""
1899 if e.key {
1900 key = "key for "
1901 }
1902
1903 return fmt.Sprintf(
1904 "invalid %sBootstrap_StaticResources.%s: %s%s",
1905 key,
1906 e.field,
1907 e.reason,
1908 cause)
1909 }
1910
1911 var _ error = Bootstrap_StaticResourcesValidationError{}
1912
1913 var _ interface {
1914 Field() string
1915 Reason() string
1916 Key() bool
1917 Cause() error
1918 ErrorName() string
1919 } = Bootstrap_StaticResourcesValidationError{}
1920
1921
1922
1923
1924 func (m *Bootstrap_DynamicResources) Validate() error {
1925 return m.validate(false)
1926 }
1927
1928
1929
1930
1931
1932 func (m *Bootstrap_DynamicResources) ValidateAll() error {
1933 return m.validate(true)
1934 }
1935
1936 func (m *Bootstrap_DynamicResources) validate(all bool) error {
1937 if m == nil {
1938 return nil
1939 }
1940
1941 var errors []error
1942
1943 if all {
1944 switch v := interface{}(m.GetLdsConfig()).(type) {
1945 case interface{ ValidateAll() error }:
1946 if err := v.ValidateAll(); err != nil {
1947 errors = append(errors, Bootstrap_DynamicResourcesValidationError{
1948 field: "LdsConfig",
1949 reason: "embedded message failed validation",
1950 cause: err,
1951 })
1952 }
1953 case interface{ Validate() error }:
1954 if err := v.Validate(); err != nil {
1955 errors = append(errors, Bootstrap_DynamicResourcesValidationError{
1956 field: "LdsConfig",
1957 reason: "embedded message failed validation",
1958 cause: err,
1959 })
1960 }
1961 }
1962 } else if v, ok := interface{}(m.GetLdsConfig()).(interface{ Validate() error }); ok {
1963 if err := v.Validate(); err != nil {
1964 return Bootstrap_DynamicResourcesValidationError{
1965 field: "LdsConfig",
1966 reason: "embedded message failed validation",
1967 cause: err,
1968 }
1969 }
1970 }
1971
1972 if all {
1973 switch v := interface{}(m.GetCdsConfig()).(type) {
1974 case interface{ ValidateAll() error }:
1975 if err := v.ValidateAll(); err != nil {
1976 errors = append(errors, Bootstrap_DynamicResourcesValidationError{
1977 field: "CdsConfig",
1978 reason: "embedded message failed validation",
1979 cause: err,
1980 })
1981 }
1982 case interface{ Validate() error }:
1983 if err := v.Validate(); err != nil {
1984 errors = append(errors, Bootstrap_DynamicResourcesValidationError{
1985 field: "CdsConfig",
1986 reason: "embedded message failed validation",
1987 cause: err,
1988 })
1989 }
1990 }
1991 } else if v, ok := interface{}(m.GetCdsConfig()).(interface{ Validate() error }); ok {
1992 if err := v.Validate(); err != nil {
1993 return Bootstrap_DynamicResourcesValidationError{
1994 field: "CdsConfig",
1995 reason: "embedded message failed validation",
1996 cause: err,
1997 }
1998 }
1999 }
2000
2001 if all {
2002 switch v := interface{}(m.GetAdsConfig()).(type) {
2003 case interface{ ValidateAll() error }:
2004 if err := v.ValidateAll(); err != nil {
2005 errors = append(errors, Bootstrap_DynamicResourcesValidationError{
2006 field: "AdsConfig",
2007 reason: "embedded message failed validation",
2008 cause: err,
2009 })
2010 }
2011 case interface{ Validate() error }:
2012 if err := v.Validate(); err != nil {
2013 errors = append(errors, Bootstrap_DynamicResourcesValidationError{
2014 field: "AdsConfig",
2015 reason: "embedded message failed validation",
2016 cause: err,
2017 })
2018 }
2019 }
2020 } else if v, ok := interface{}(m.GetAdsConfig()).(interface{ Validate() error }); ok {
2021 if err := v.Validate(); err != nil {
2022 return Bootstrap_DynamicResourcesValidationError{
2023 field: "AdsConfig",
2024 reason: "embedded message failed validation",
2025 cause: err,
2026 }
2027 }
2028 }
2029
2030 if len(errors) > 0 {
2031 return Bootstrap_DynamicResourcesMultiError(errors)
2032 }
2033
2034 return nil
2035 }
2036
2037
2038
2039
2040 type Bootstrap_DynamicResourcesMultiError []error
2041
2042
2043 func (m Bootstrap_DynamicResourcesMultiError) Error() string {
2044 var msgs []string
2045 for _, err := range m {
2046 msgs = append(msgs, err.Error())
2047 }
2048 return strings.Join(msgs, "; ")
2049 }
2050
2051
2052 func (m Bootstrap_DynamicResourcesMultiError) AllErrors() []error { return m }
2053
2054
2055
2056 type Bootstrap_DynamicResourcesValidationError struct {
2057 field string
2058 reason string
2059 cause error
2060 key bool
2061 }
2062
2063
2064 func (e Bootstrap_DynamicResourcesValidationError) Field() string { return e.field }
2065
2066
2067 func (e Bootstrap_DynamicResourcesValidationError) Reason() string { return e.reason }
2068
2069
2070 func (e Bootstrap_DynamicResourcesValidationError) Cause() error { return e.cause }
2071
2072
2073 func (e Bootstrap_DynamicResourcesValidationError) Key() bool { return e.key }
2074
2075
2076 func (e Bootstrap_DynamicResourcesValidationError) ErrorName() string {
2077 return "Bootstrap_DynamicResourcesValidationError"
2078 }
2079
2080
2081 func (e Bootstrap_DynamicResourcesValidationError) Error() string {
2082 cause := ""
2083 if e.cause != nil {
2084 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2085 }
2086
2087 key := ""
2088 if e.key {
2089 key = "key for "
2090 }
2091
2092 return fmt.Sprintf(
2093 "invalid %sBootstrap_DynamicResources.%s: %s%s",
2094 key,
2095 e.field,
2096 e.reason,
2097 cause)
2098 }
2099
2100 var _ error = Bootstrap_DynamicResourcesValidationError{}
2101
2102 var _ interface {
2103 Field() string
2104 Reason() string
2105 Key() bool
2106 Cause() error
2107 ErrorName() string
2108 } = Bootstrap_DynamicResourcesValidationError{}
2109
2110
2111
2112
2113 func (m *ClusterManager_OutlierDetection) Validate() error {
2114 return m.validate(false)
2115 }
2116
2117
2118
2119
2120
2121 func (m *ClusterManager_OutlierDetection) ValidateAll() error {
2122 return m.validate(true)
2123 }
2124
2125 func (m *ClusterManager_OutlierDetection) validate(all bool) error {
2126 if m == nil {
2127 return nil
2128 }
2129
2130 var errors []error
2131
2132
2133
2134 if all {
2135 switch v := interface{}(m.GetEventService()).(type) {
2136 case interface{ ValidateAll() error }:
2137 if err := v.ValidateAll(); err != nil {
2138 errors = append(errors, ClusterManager_OutlierDetectionValidationError{
2139 field: "EventService",
2140 reason: "embedded message failed validation",
2141 cause: err,
2142 })
2143 }
2144 case interface{ Validate() error }:
2145 if err := v.Validate(); err != nil {
2146 errors = append(errors, ClusterManager_OutlierDetectionValidationError{
2147 field: "EventService",
2148 reason: "embedded message failed validation",
2149 cause: err,
2150 })
2151 }
2152 }
2153 } else if v, ok := interface{}(m.GetEventService()).(interface{ Validate() error }); ok {
2154 if err := v.Validate(); err != nil {
2155 return ClusterManager_OutlierDetectionValidationError{
2156 field: "EventService",
2157 reason: "embedded message failed validation",
2158 cause: err,
2159 }
2160 }
2161 }
2162
2163 if len(errors) > 0 {
2164 return ClusterManager_OutlierDetectionMultiError(errors)
2165 }
2166
2167 return nil
2168 }
2169
2170
2171
2172
2173 type ClusterManager_OutlierDetectionMultiError []error
2174
2175
2176 func (m ClusterManager_OutlierDetectionMultiError) Error() string {
2177 var msgs []string
2178 for _, err := range m {
2179 msgs = append(msgs, err.Error())
2180 }
2181 return strings.Join(msgs, "; ")
2182 }
2183
2184
2185 func (m ClusterManager_OutlierDetectionMultiError) AllErrors() []error { return m }
2186
2187
2188
2189
2190 type ClusterManager_OutlierDetectionValidationError struct {
2191 field string
2192 reason string
2193 cause error
2194 key bool
2195 }
2196
2197
2198 func (e ClusterManager_OutlierDetectionValidationError) Field() string { return e.field }
2199
2200
2201 func (e ClusterManager_OutlierDetectionValidationError) Reason() string { return e.reason }
2202
2203
2204 func (e ClusterManager_OutlierDetectionValidationError) Cause() error { return e.cause }
2205
2206
2207 func (e ClusterManager_OutlierDetectionValidationError) Key() bool { return e.key }
2208
2209
2210 func (e ClusterManager_OutlierDetectionValidationError) ErrorName() string {
2211 return "ClusterManager_OutlierDetectionValidationError"
2212 }
2213
2214
2215 func (e ClusterManager_OutlierDetectionValidationError) Error() string {
2216 cause := ""
2217 if e.cause != nil {
2218 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2219 }
2220
2221 key := ""
2222 if e.key {
2223 key = "key for "
2224 }
2225
2226 return fmt.Sprintf(
2227 "invalid %sClusterManager_OutlierDetection.%s: %s%s",
2228 key,
2229 e.field,
2230 e.reason,
2231 cause)
2232 }
2233
2234 var _ error = ClusterManager_OutlierDetectionValidationError{}
2235
2236 var _ interface {
2237 Field() string
2238 Reason() string
2239 Key() bool
2240 Cause() error
2241 ErrorName() string
2242 } = ClusterManager_OutlierDetectionValidationError{}
2243
2244
2245
2246
2247 func (m *RuntimeLayer_DiskLayer) Validate() error {
2248 return m.validate(false)
2249 }
2250
2251
2252
2253
2254
2255 func (m *RuntimeLayer_DiskLayer) ValidateAll() error {
2256 return m.validate(true)
2257 }
2258
2259 func (m *RuntimeLayer_DiskLayer) validate(all bool) error {
2260 if m == nil {
2261 return nil
2262 }
2263
2264 var errors []error
2265
2266
2267
2268
2269
2270
2271
2272 if len(errors) > 0 {
2273 return RuntimeLayer_DiskLayerMultiError(errors)
2274 }
2275
2276 return nil
2277 }
2278
2279
2280
2281
2282 type RuntimeLayer_DiskLayerMultiError []error
2283
2284
2285 func (m RuntimeLayer_DiskLayerMultiError) Error() string {
2286 var msgs []string
2287 for _, err := range m {
2288 msgs = append(msgs, err.Error())
2289 }
2290 return strings.Join(msgs, "; ")
2291 }
2292
2293
2294 func (m RuntimeLayer_DiskLayerMultiError) AllErrors() []error { return m }
2295
2296
2297
2298 type RuntimeLayer_DiskLayerValidationError struct {
2299 field string
2300 reason string
2301 cause error
2302 key bool
2303 }
2304
2305
2306 func (e RuntimeLayer_DiskLayerValidationError) Field() string { return e.field }
2307
2308
2309 func (e RuntimeLayer_DiskLayerValidationError) Reason() string { return e.reason }
2310
2311
2312 func (e RuntimeLayer_DiskLayerValidationError) Cause() error { return e.cause }
2313
2314
2315 func (e RuntimeLayer_DiskLayerValidationError) Key() bool { return e.key }
2316
2317
2318 func (e RuntimeLayer_DiskLayerValidationError) ErrorName() string {
2319 return "RuntimeLayer_DiskLayerValidationError"
2320 }
2321
2322
2323 func (e RuntimeLayer_DiskLayerValidationError) Error() string {
2324 cause := ""
2325 if e.cause != nil {
2326 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2327 }
2328
2329 key := ""
2330 if e.key {
2331 key = "key for "
2332 }
2333
2334 return fmt.Sprintf(
2335 "invalid %sRuntimeLayer_DiskLayer.%s: %s%s",
2336 key,
2337 e.field,
2338 e.reason,
2339 cause)
2340 }
2341
2342 var _ error = RuntimeLayer_DiskLayerValidationError{}
2343
2344 var _ interface {
2345 Field() string
2346 Reason() string
2347 Key() bool
2348 Cause() error
2349 ErrorName() string
2350 } = RuntimeLayer_DiskLayerValidationError{}
2351
2352
2353
2354
2355 func (m *RuntimeLayer_AdminLayer) Validate() error {
2356 return m.validate(false)
2357 }
2358
2359
2360
2361
2362
2363 func (m *RuntimeLayer_AdminLayer) ValidateAll() error {
2364 return m.validate(true)
2365 }
2366
2367 func (m *RuntimeLayer_AdminLayer) validate(all bool) error {
2368 if m == nil {
2369 return nil
2370 }
2371
2372 var errors []error
2373
2374 if len(errors) > 0 {
2375 return RuntimeLayer_AdminLayerMultiError(errors)
2376 }
2377
2378 return nil
2379 }
2380
2381
2382
2383
2384 type RuntimeLayer_AdminLayerMultiError []error
2385
2386
2387 func (m RuntimeLayer_AdminLayerMultiError) Error() string {
2388 var msgs []string
2389 for _, err := range m {
2390 msgs = append(msgs, err.Error())
2391 }
2392 return strings.Join(msgs, "; ")
2393 }
2394
2395
2396 func (m RuntimeLayer_AdminLayerMultiError) AllErrors() []error { return m }
2397
2398
2399
2400 type RuntimeLayer_AdminLayerValidationError struct {
2401 field string
2402 reason string
2403 cause error
2404 key bool
2405 }
2406
2407
2408 func (e RuntimeLayer_AdminLayerValidationError) Field() string { return e.field }
2409
2410
2411 func (e RuntimeLayer_AdminLayerValidationError) Reason() string { return e.reason }
2412
2413
2414 func (e RuntimeLayer_AdminLayerValidationError) Cause() error { return e.cause }
2415
2416
2417 func (e RuntimeLayer_AdminLayerValidationError) Key() bool { return e.key }
2418
2419
2420 func (e RuntimeLayer_AdminLayerValidationError) ErrorName() string {
2421 return "RuntimeLayer_AdminLayerValidationError"
2422 }
2423
2424
2425 func (e RuntimeLayer_AdminLayerValidationError) Error() string {
2426 cause := ""
2427 if e.cause != nil {
2428 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2429 }
2430
2431 key := ""
2432 if e.key {
2433 key = "key for "
2434 }
2435
2436 return fmt.Sprintf(
2437 "invalid %sRuntimeLayer_AdminLayer.%s: %s%s",
2438 key,
2439 e.field,
2440 e.reason,
2441 cause)
2442 }
2443
2444 var _ error = RuntimeLayer_AdminLayerValidationError{}
2445
2446 var _ interface {
2447 Field() string
2448 Reason() string
2449 Key() bool
2450 Cause() error
2451 ErrorName() string
2452 } = RuntimeLayer_AdminLayerValidationError{}
2453
2454
2455
2456
2457 func (m *RuntimeLayer_RtdsLayer) Validate() error {
2458 return m.validate(false)
2459 }
2460
2461
2462
2463
2464
2465 func (m *RuntimeLayer_RtdsLayer) ValidateAll() error {
2466 return m.validate(true)
2467 }
2468
2469 func (m *RuntimeLayer_RtdsLayer) validate(all bool) error {
2470 if m == nil {
2471 return nil
2472 }
2473
2474 var errors []error
2475
2476
2477
2478 if all {
2479 switch v := interface{}(m.GetRtdsConfig()).(type) {
2480 case interface{ ValidateAll() error }:
2481 if err := v.ValidateAll(); err != nil {
2482 errors = append(errors, RuntimeLayer_RtdsLayerValidationError{
2483 field: "RtdsConfig",
2484 reason: "embedded message failed validation",
2485 cause: err,
2486 })
2487 }
2488 case interface{ Validate() error }:
2489 if err := v.Validate(); err != nil {
2490 errors = append(errors, RuntimeLayer_RtdsLayerValidationError{
2491 field: "RtdsConfig",
2492 reason: "embedded message failed validation",
2493 cause: err,
2494 })
2495 }
2496 }
2497 } else if v, ok := interface{}(m.GetRtdsConfig()).(interface{ Validate() error }); ok {
2498 if err := v.Validate(); err != nil {
2499 return RuntimeLayer_RtdsLayerValidationError{
2500 field: "RtdsConfig",
2501 reason: "embedded message failed validation",
2502 cause: err,
2503 }
2504 }
2505 }
2506
2507 if len(errors) > 0 {
2508 return RuntimeLayer_RtdsLayerMultiError(errors)
2509 }
2510
2511 return nil
2512 }
2513
2514
2515
2516
2517 type RuntimeLayer_RtdsLayerMultiError []error
2518
2519
2520 func (m RuntimeLayer_RtdsLayerMultiError) Error() string {
2521 var msgs []string
2522 for _, err := range m {
2523 msgs = append(msgs, err.Error())
2524 }
2525 return strings.Join(msgs, "; ")
2526 }
2527
2528
2529 func (m RuntimeLayer_RtdsLayerMultiError) AllErrors() []error { return m }
2530
2531
2532
2533 type RuntimeLayer_RtdsLayerValidationError struct {
2534 field string
2535 reason string
2536 cause error
2537 key bool
2538 }
2539
2540
2541 func (e RuntimeLayer_RtdsLayerValidationError) Field() string { return e.field }
2542
2543
2544 func (e RuntimeLayer_RtdsLayerValidationError) Reason() string { return e.reason }
2545
2546
2547 func (e RuntimeLayer_RtdsLayerValidationError) Cause() error { return e.cause }
2548
2549
2550 func (e RuntimeLayer_RtdsLayerValidationError) Key() bool { return e.key }
2551
2552
2553 func (e RuntimeLayer_RtdsLayerValidationError) ErrorName() string {
2554 return "RuntimeLayer_RtdsLayerValidationError"
2555 }
2556
2557
2558 func (e RuntimeLayer_RtdsLayerValidationError) Error() string {
2559 cause := ""
2560 if e.cause != nil {
2561 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2562 }
2563
2564 key := ""
2565 if e.key {
2566 key = "key for "
2567 }
2568
2569 return fmt.Sprintf(
2570 "invalid %sRuntimeLayer_RtdsLayer.%s: %s%s",
2571 key,
2572 e.field,
2573 e.reason,
2574 cause)
2575 }
2576
2577 var _ error = RuntimeLayer_RtdsLayerValidationError{}
2578
2579 var _ interface {
2580 Field() string
2581 Reason() string
2582 Key() bool
2583 Cause() error
2584 ErrorName() string
2585 } = RuntimeLayer_RtdsLayerValidationError{}
2586
View as plain text