Debian Codegraph @

envoy/service/status/v3/csds.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/service/status/v3/csds.proto
4
5 package statusv3
6
7 import (
8 "bytes"
9 "errors"
10 "fmt"
11 "net"
12 "net/mail"
13 "net/url"
14 "regexp"
15 "sort"
16 "strings"
17 "time"
18 "unicode/utf8"
19
20 "google.golang.org/protobuf/types/known/anypb"
21
22 v3 "github.com/envoyproxy/go-control-plane/envoy/admin/v3"
23 )
24
25 // ensure the imports are used
26 var (
27 _ = bytes.MinRead
28 _ = errors.New("")
29 _ = fmt.Print
30 _ = utf8.UTFMax
31 _ = (*regexp.Regexp)(nil)
32 _ = (*strings.Reader)(nil)
33 _ = net.IPv4len
34 _ = time.Duration(0)
35 _ = (*url.URL)(nil)
36 _ = (*mail.Address)(nil)
37 _ = anypb.Any{}
38 _ = sort.Sort
39
40 _ = v3.ClientResourceStatus(0)
41 )
42
43 // Validate checks the field values on ClientStatusRequest with the rules
44 // defined in the proto definition for this message. If any rules are
45 // violated, the first error encountered is returned, or nil if there are no violations.
46 func (m *ClientStatusRequest) Validate() error {
47 return m.validate(false)
48 }
49
50 // ValidateAll checks the field values on ClientStatusRequest with the rules
51 // defined in the proto definition for this message. If any rules are
52 // violated, the result is a list of violation errors wrapped in
53 // ClientStatusRequestMultiError, or nil if none found.
54 func (m *ClientStatusRequest) ValidateAll() error {
55 return m.validate(true)
56 }
57
58 func (m *ClientStatusRequest) validate(all bool) error {
59 if m == nil {
60 return nil
61 }
62
63 var errors []error
64
65 for idx, item := range m.GetNodeMatchers() {
66 _, _ = idx, item
67
68 if all {
69 switch v := interface{}(item).(type) {
70 case interface{ ValidateAll() error }:
71 if err := v.ValidateAll(); err != nil {
72 errors = append(errors, ClientStatusRequestValidationError{
73 field: fmt.Sprintf("NodeMatchers[%v]", idx),
74 reason: "embedded message failed validation",
75 cause: err,
76 })
77 }
78 case interface{ Validate() error }:
79 if err := v.Validate(); err != nil {
80 errors = append(errors, ClientStatusRequestValidationError{
81 field: fmt.Sprintf("NodeMatchers[%v]", idx),
82 reason: "embedded message failed validation",
83 cause: err,
84 })
85 }
86 }
87 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
88 if err := v.Validate(); err != nil {
89 return ClientStatusRequestValidationError{
90 field: fmt.Sprintf("NodeMatchers[%v]", idx),
91 reason: "embedded message failed validation",
92 cause: err,
93 }
94 }
95 }
96
97 }
98
99 if all {
100 switch v := interface{}(m.GetNode()).(type) {
101 case interface{ ValidateAll() error }:
102 if err := v.ValidateAll(); err != nil {
103 errors = append(errors, ClientStatusRequestValidationError{
104 field: "Node",
105 reason: "embedded message failed validation",
106 cause: err,
107 })
108 }
109 case interface{ Validate() error }:
110 if err := v.Validate(); err != nil {
111 errors = append(errors, ClientStatusRequestValidationError{
112 field: "Node",
113 reason: "embedded message failed validation",
114 cause: err,
115 })
116 }
117 }
118 } else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
119 if err := v.Validate(); err != nil {
120 return ClientStatusRequestValidationError{
121 field: "Node",
122 reason: "embedded message failed validation",
123 cause: err,
124 }
125 }
126 }
127
128 // no validation rules for ExcludeResourceContents
129
130 if len(errors) > 0 {
131 return ClientStatusRequestMultiError(errors)
132 }
133
134 return nil
135 }
136
137 // ClientStatusRequestMultiError is an error wrapping multiple validation
138 // errors returned by ClientStatusRequest.ValidateAll() if the designated
139 // constraints aren't met.
140 type ClientStatusRequestMultiError []error
141
142 // Error returns a concatenation of all the error messages it wraps.
143 func (m ClientStatusRequestMultiError) Error() string {
144 var msgs []string
145 for _, err := range m {
146 msgs = append(msgs, err.Error())
147 }
148 return strings.Join(msgs, "; ")
149 }
150
151 // AllErrors returns a list of validation violation errors.
152 func (m ClientStatusRequestMultiError) AllErrors() []error { return m }
153
154 // ClientStatusRequestValidationError is the validation error returned by
155 // ClientStatusRequest.Validate if the designated constraints aren't met.
156 type ClientStatusRequestValidationError struct {
157 field string
158 reason string
159 cause error
160 key bool
161 }
162
163 // Field function returns field value.
164 func (e ClientStatusRequestValidationError) Field() string { return e.field }
165
166 // Reason function returns reason value.
167 func (e ClientStatusRequestValidationError) Reason() string { return e.reason }
168
169 // Cause function returns cause value.
170 func (e ClientStatusRequestValidationError) Cause() error { return e.cause }
171
172 // Key function returns key value.
173 func (e ClientStatusRequestValidationError) Key() bool { return e.key }
174
175 // ErrorName returns error name.
176 func (e ClientStatusRequestValidationError) ErrorName() string {
177 return "ClientStatusRequestValidationError"
178 }
179
180 // Error satisfies the builtin error interface
181 func (e ClientStatusRequestValidationError) Error() string {
182 cause := ""
183 if e.cause != nil {
184 cause = fmt.Sprintf(" | caused by: %v", e.cause)
185 }
186
187 key := ""
188 if e.key {
189 key = "key for "
190 }
191
192 return fmt.Sprintf(
193 "invalid %sClientStatusRequest.%s: %s%s",
194 key,
195 e.field,
196 e.reason,
197 cause)
198 }
199
200 var _ error = ClientStatusRequestValidationError{}
201
202 var _ interface {
203 Field() string
204 Reason() string
205 Key() bool
206 Cause() error
207 ErrorName() string
208 } = ClientStatusRequestValidationError{}
209
210 // Validate checks the field values on PerXdsConfig with the rules defined in
211 // the proto definition for this message. If any rules are violated, the first
212 // error encountered is returned, or nil if there are no violations.
213 func (m *PerXdsConfig) Validate() error {
214 return m.validate(false)
215 }
216
217 // ValidateAll checks the field values on PerXdsConfig with the rules defined
218 // in the proto definition for this message. If any rules are violated, the
219 // result is a list of violation errors wrapped in PerXdsConfigMultiError, or
220 // nil if none found.
221 func (m *PerXdsConfig) ValidateAll() error {
222 return m.validate(true)
223 }
224
225 func (m *PerXdsConfig) validate(all bool) error {
226 if m == nil {
227 return nil
228 }
229
230 var errors []error
231
232 // no validation rules for Status
233
234 // no validation rules for ClientStatus
235
236 switch v := m.PerXdsConfig.(type) {
237 case *PerXdsConfig_ListenerConfig:
238 if v == nil {
239 err := PerXdsConfigValidationError{
240 field: "PerXdsConfig",
241 reason: "oneof value cannot be a typed-nil",
242 }
243 if !all {
244 return err
245 }
246 errors = append(errors, err)
247 }
248
249 if all {
250 switch v := interface{}(m.GetListenerConfig()).(type) {
251 case interface{ ValidateAll() error }:
252 if err := v.ValidateAll(); err != nil {
253 errors = append(errors, PerXdsConfigValidationError{
254 field: "ListenerConfig",
255 reason: "embedded message failed validation",
256 cause: err,
257 })
258 }
259 case interface{ Validate() error }:
260 if err := v.Validate(); err != nil {
261 errors = append(errors, PerXdsConfigValidationError{
262 field: "ListenerConfig",
263 reason: "embedded message failed validation",
264 cause: err,
265 })
266 }
267 }
268 } else if v, ok := interface{}(m.GetListenerConfig()).(interface{ Validate() error }); ok {
269 if err := v.Validate(); err != nil {
270 return PerXdsConfigValidationError{
271 field: "ListenerConfig",
272 reason: "embedded message failed validation",
273 cause: err,
274 }
275 }
276 }
277
278 case *PerXdsConfig_ClusterConfig:
279 if v == nil {
280 err := PerXdsConfigValidationError{
281 field: "PerXdsConfig",
282 reason: "oneof value cannot be a typed-nil",
283 }
284 if !all {
285 return err
286 }
287 errors = append(errors, err)
288 }
289
290 if all {
291 switch v := interface{}(m.GetClusterConfig()).(type) {
292 case interface{ ValidateAll() error }:
293 if err := v.ValidateAll(); err != nil {
294 errors = append(errors, PerXdsConfigValidationError{
295 field: "ClusterConfig",
296 reason: "embedded message failed validation",
297 cause: err,
298 })
299 }
300 case interface{ Validate() error }:
301 if err := v.Validate(); err != nil {
302 errors = append(errors, PerXdsConfigValidationError{
303 field: "ClusterConfig",
304 reason: "embedded message failed validation",
305 cause: err,
306 })
307 }
308 }
309 } else if v, ok := interface{}(m.GetClusterConfig()).(interface{ Validate() error }); ok {
310 if err := v.Validate(); err != nil {
311 return PerXdsConfigValidationError{
312 field: "ClusterConfig",
313 reason: "embedded message failed validation",
314 cause: err,
315 }
316 }
317 }
318
319 case *PerXdsConfig_RouteConfig:
320 if v == nil {
321 err := PerXdsConfigValidationError{
322 field: "PerXdsConfig",
323 reason: "oneof value cannot be a typed-nil",
324 }
325 if !all {
326 return err
327 }
328 errors = append(errors, err)
329 }
330
331 if all {
332 switch v := interface{}(m.GetRouteConfig()).(type) {
333 case interface{ ValidateAll() error }:
334 if err := v.ValidateAll(); err != nil {
335 errors = append(errors, PerXdsConfigValidationError{
336 field: "RouteConfig",
337 reason: "embedded message failed validation",
338 cause: err,
339 })
340 }
341 case interface{ Validate() error }:
342 if err := v.Validate(); err != nil {
343 errors = append(errors, PerXdsConfigValidationError{
344 field: "RouteConfig",
345 reason: "embedded message failed validation",
346 cause: err,
347 })
348 }
349 }
350 } else if v, ok := interface{}(m.GetRouteConfig()).(interface{ Validate() error }); ok {
351 if err := v.Validate(); err != nil {
352 return PerXdsConfigValidationError{
353 field: "RouteConfig",
354 reason: "embedded message failed validation",
355 cause: err,
356 }
357 }
358 }
359
360 case *PerXdsConfig_ScopedRouteConfig:
361 if v == nil {
362 err := PerXdsConfigValidationError{
363 field: "PerXdsConfig",
364 reason: "oneof value cannot be a typed-nil",
365 }
366 if !all {
367 return err
368 }
369 errors = append(errors, err)
370 }
371
372 if all {
373 switch v := interface{}(m.GetScopedRouteConfig()).(type) {
374 case interface{ ValidateAll() error }:
375 if err := v.ValidateAll(); err != nil {
376 errors = append(errors, PerXdsConfigValidationError{
377 field: "ScopedRouteConfig",
378 reason: "embedded message failed validation",
379 cause: err,
380 })
381 }
382 case interface{ Validate() error }:
383 if err := v.Validate(); err != nil {
384 errors = append(errors, PerXdsConfigValidationError{
385 field: "ScopedRouteConfig",
386 reason: "embedded message failed validation",
387 cause: err,
388 })
389 }
390 }
391 } else if v, ok := interface{}(m.GetScopedRouteConfig()).(interface{ Validate() error }); ok {
392 if err := v.Validate(); err != nil {
393 return PerXdsConfigValidationError{
394 field: "ScopedRouteConfig",
395 reason: "embedded message failed validation",
396 cause: err,
397 }
398 }
399 }
400
401 case *PerXdsConfig_EndpointConfig:
402 if v == nil {
403 err := PerXdsConfigValidationError{
404 field: "PerXdsConfig",
405 reason: "oneof value cannot be a typed-nil",
406 }
407 if !all {
408 return err
409 }
410 errors = append(errors, err)
411 }
412
413 if all {
414 switch v := interface{}(m.GetEndpointConfig()).(type) {
415 case interface{ ValidateAll() error }:
416 if err := v.ValidateAll(); err != nil {
417 errors = append(errors, PerXdsConfigValidationError{
418 field: "EndpointConfig",
419 reason: "embedded message failed validation",
420 cause: err,
421 })
422 }
423 case interface{ Validate() error }:
424 if err := v.Validate(); err != nil {
425 errors = append(errors, PerXdsConfigValidationError{
426 field: "EndpointConfig",
427 reason: "embedded message failed validation",
428 cause: err,
429 })
430 }
431 }
432 } else if v, ok := interface{}(m.GetEndpointConfig()).(interface{ Validate() error }); ok {
433 if err := v.Validate(); err != nil {
434 return PerXdsConfigValidationError{
435 field: "EndpointConfig",
436 reason: "embedded message failed validation",
437 cause: err,
438 }
439 }
440 }
441
442 default:
443 _ = v // ensures v is used
444 }
445
446 if len(errors) > 0 {
447 return PerXdsConfigMultiError(errors)
448 }
449
450 return nil
451 }
452
453 // PerXdsConfigMultiError is an error wrapping multiple validation errors
454 // returned by PerXdsConfig.ValidateAll() if the designated constraints aren't met.
455 type PerXdsConfigMultiError []error
456
457 // Error returns a concatenation of all the error messages it wraps.
458 func (m PerXdsConfigMultiError) Error() string {
459 var msgs []string
460 for _, err := range m {
461 msgs = append(msgs, err.Error())
462 }
463 return strings.Join(msgs, "; ")
464 }
465
466 // AllErrors returns a list of validation violation errors.
467 func (m PerXdsConfigMultiError) AllErrors() []error { return m }
468
469 // PerXdsConfigValidationError is the validation error returned by
470 // PerXdsConfig.Validate if the designated constraints aren't met.
471 type PerXdsConfigValidationError struct {
472 field string
473 reason string
474 cause error
475 key bool
476 }
477
478 // Field function returns field value.
479 func (e PerXdsConfigValidationError) Field() string { return e.field }
480
481 // Reason function returns reason value.
482 func (e PerXdsConfigValidationError) Reason() string { return e.reason }
483
484 // Cause function returns cause value.
485 func (e PerXdsConfigValidationError) Cause() error { return e.cause }
486
487 // Key function returns key value.
488 func (e PerXdsConfigValidationError) Key() bool { return e.key }
489
490 // ErrorName returns error name.
491 func (e PerXdsConfigValidationError) ErrorName() string { return "PerXdsConfigValidationError" }
492
493 // Error satisfies the builtin error interface
494 func (e PerXdsConfigValidationError) Error() string {
495 cause := ""
496 if e.cause != nil {
497 cause = fmt.Sprintf(" | caused by: %v", e.cause)
498 }
499
500 key := ""
501 if e.key {
502 key = "key for "
503 }
504
505 return fmt.Sprintf(
506 "invalid %sPerXdsConfig.%s: %s%s",
507 key,
508 e.field,
509 e.reason,
510 cause)
511 }
512
513 var _ error = PerXdsConfigValidationError{}
514
515 var _ interface {
516 Field() string
517 Reason() string
518 Key() bool
519 Cause() error
520 ErrorName() string
521 } = PerXdsConfigValidationError{}
522
523 // Validate checks the field values on ClientConfig with the rules defined in
524 // the proto definition for this message. If any rules are violated, the first
525 // error encountered is returned, or nil if there are no violations.
526 func (m *ClientConfig) Validate() error {
527 return m.validate(false)
528 }
529
530 // ValidateAll checks the field values on ClientConfig with the rules defined
531 // in the proto definition for this message. If any rules are violated, the
532 // result is a list of violation errors wrapped in ClientConfigMultiError, or
533 // nil if none found.
534 func (m *ClientConfig) ValidateAll() error {
535 return m.validate(true)
536 }
537
538 func (m *ClientConfig) validate(all bool) error {
539 if m == nil {
540 return nil
541 }
542
543 var errors []error
544
545 if all {
546 switch v := interface{}(m.GetNode()).(type) {
547 case interface{ ValidateAll() error }:
548 if err := v.ValidateAll(); err != nil {
549 errors = append(errors, ClientConfigValidationError{
550 field: "Node",
551 reason: "embedded message failed validation",
552 cause: err,
553 })
554 }
555 case interface{ Validate() error }:
556 if err := v.Validate(); err != nil {
557 errors = append(errors, ClientConfigValidationError{
558 field: "Node",
559 reason: "embedded message failed validation",
560 cause: err,
561 })
562 }
563 }
564 } else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
565 if err := v.Validate(); err != nil {
566 return ClientConfigValidationError{
567 field: "Node",
568 reason: "embedded message failed validation",
569 cause: err,
570 }
571 }
572 }
573
574 for idx, item := range m.GetXdsConfig() {
575 _, _ = idx, item
576
577 if all {
578 switch v := interface{}(item).(type) {
579 case interface{ ValidateAll() error }:
580 if err := v.ValidateAll(); err != nil {
581 errors = append(errors, ClientConfigValidationError{
582 field: fmt.Sprintf("XdsConfig[%v]", idx),
583 reason: "embedded message failed validation",
584 cause: err,
585 })
586 }
587 case interface{ Validate() error }:
588 if err := v.Validate(); err != nil {
589 errors = append(errors, ClientConfigValidationError{
590 field: fmt.Sprintf("XdsConfig[%v]", idx),
591 reason: "embedded message failed validation",
592 cause: err,
593 })
594 }
595 }
596 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
597 if err := v.Validate(); err != nil {
598 return ClientConfigValidationError{
599 field: fmt.Sprintf("XdsConfig[%v]", idx),
600 reason: "embedded message failed validation",
601 cause: err,
602 }
603 }
604 }
605
606 }
607
608 for idx, item := range m.GetGenericXdsConfigs() {
609 _, _ = idx, item
610
611 if all {
612 switch v := interface{}(item).(type) {
613 case interface{ ValidateAll() error }:
614 if err := v.ValidateAll(); err != nil {
615 errors = append(errors, ClientConfigValidationError{
616 field: fmt.Sprintf("GenericXdsConfigs[%v]", idx),
617 reason: "embedded message failed validation",
618 cause: err,
619 })
620 }
621 case interface{ Validate() error }:
622 if err := v.Validate(); err != nil {
623 errors = append(errors, ClientConfigValidationError{
624 field: fmt.Sprintf("GenericXdsConfigs[%v]", idx),
625 reason: "embedded message failed validation",
626 cause: err,
627 })
628 }
629 }
630 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
631 if err := v.Validate(); err != nil {
632 return ClientConfigValidationError{
633 field: fmt.Sprintf("GenericXdsConfigs[%v]", idx),
634 reason: "embedded message failed validation",
635 cause: err,
636 }
637 }
638 }
639
640 }
641
642 // no validation rules for ClientScope
643
644 if len(errors) > 0 {
645 return ClientConfigMultiError(errors)
646 }
647
648 return nil
649 }
650
651 // ClientConfigMultiError is an error wrapping multiple validation errors
652 // returned by ClientConfig.ValidateAll() if the designated constraints aren't met.
653 type ClientConfigMultiError []error
654
655 // Error returns a concatenation of all the error messages it wraps.
656 func (m ClientConfigMultiError) Error() string {
657 var msgs []string
658 for _, err := range m {
659 msgs = append(msgs, err.Error())
660 }
661 return strings.Join(msgs, "; ")
662 }
663
664 // AllErrors returns a list of validation violation errors.
665 func (m ClientConfigMultiError) AllErrors() []error { return m }
666
667 // ClientConfigValidationError is the validation error returned by
668 // ClientConfig.Validate if the designated constraints aren't met.
669 type ClientConfigValidationError struct {
670 field string
671 reason string
672 cause error
673 key bool
674 }
675
676 // Field function returns field value.
677 func (e ClientConfigValidationError) Field() string { return e.field }
678
679 // Reason function returns reason value.
680 func (e ClientConfigValidationError) Reason() string { return e.reason }
681
682 // Cause function returns cause value.
683 func (e ClientConfigValidationError) Cause() error { return e.cause }
684
685 // Key function returns key value.
686 func (e ClientConfigValidationError) Key() bool { return e.key }
687
688 // ErrorName returns error name.
689 func (e ClientConfigValidationError) ErrorName() string { return "ClientConfigValidationError" }
690
691 // Error satisfies the builtin error interface
692 func (e ClientConfigValidationError) Error() string {
693 cause := ""
694 if e.cause != nil {
695 cause = fmt.Sprintf(" | caused by: %v", e.cause)
696 }
697
698 key := ""
699 if e.key {
700 key = "key for "
701 }
702
703 return fmt.Sprintf(
704 "invalid %sClientConfig.%s: %s%s",
705 key,
706 e.field,
707 e.reason,
708 cause)
709 }
710
711 var _ error = ClientConfigValidationError{}
712
713 var _ interface {
714 Field() string
715 Reason() string
716 Key() bool
717 Cause() error
718 ErrorName() string
719 } = ClientConfigValidationError{}
720
721 // Validate checks the field values on ClientStatusResponse with the rules
722 // defined in the proto definition for this message. If any rules are
723 // violated, the first error encountered is returned, or nil if there are no violations.
724 func (m *ClientStatusResponse) Validate() error {
725 return m.validate(false)
726 }
727
728 // ValidateAll checks the field values on ClientStatusResponse with the rules
729 // defined in the proto definition for this message. If any rules are
730 // violated, the result is a list of violation errors wrapped in
731 // ClientStatusResponseMultiError, or nil if none found.
732 func (m *ClientStatusResponse) ValidateAll() error {
733 return m.validate(true)
734 }
735
736 func (m *ClientStatusResponse) validate(all bool) error {
737 if m == nil {
738 return nil
739 }
740
741 var errors []error
742
743 for idx, item := range m.GetConfig() {
744 _, _ = idx, item
745
746 if all {
747 switch v := interface{}(item).(type) {
748 case interface{ ValidateAll() error }:
749 if err := v.ValidateAll(); err != nil {
750 errors = append(errors, ClientStatusResponseValidationError{
751 field: fmt.Sprintf("Config[%v]", idx),
752 reason: "embedded message failed validation",
753 cause: err,
754 })
755 }
756 case interface{ Validate() error }:
757 if err := v.Validate(); err != nil {
758 errors = append(errors, ClientStatusResponseValidationError{
759 field: fmt.Sprintf("Config[%v]", idx),
760 reason: "embedded message failed validation",
761 cause: err,
762 })
763 }
764 }
765 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
766 if err := v.Validate(); err != nil {
767 return ClientStatusResponseValidationError{
768 field: fmt.Sprintf("Config[%v]", idx),
769 reason: "embedded message failed validation",
770 cause: err,
771 }
772 }
773 }
774
775 }
776
777 if len(errors) > 0 {
778 return ClientStatusResponseMultiError(errors)
779 }
780
781 return nil
782 }
783
784 // ClientStatusResponseMultiError is an error wrapping multiple validation
785 // errors returned by ClientStatusResponse.ValidateAll() if the designated
786 // constraints aren't met.
787 type ClientStatusResponseMultiError []error
788
789 // Error returns a concatenation of all the error messages it wraps.
790 func (m ClientStatusResponseMultiError) Error() string {
791 var msgs []string
792 for _, err := range m {
793 msgs = append(msgs, err.Error())
794 }
795 return strings.Join(msgs, "; ")
796 }
797
798 // AllErrors returns a list of validation violation errors.
799 func (m ClientStatusResponseMultiError) AllErrors() []error { return m }
800
801 // ClientStatusResponseValidationError is the validation error returned by
802 // ClientStatusResponse.Validate if the designated constraints aren't met.
803 type ClientStatusResponseValidationError struct {
804 field string
805 reason string
806 cause error
807 key bool
808 }
809
810 // Field function returns field value.
811 func (e ClientStatusResponseValidationError) Field() string { return e.field }
812
813 // Reason function returns reason value.
814 func (e ClientStatusResponseValidationError) Reason() string { return e.reason }
815
816 // Cause function returns cause value.
817 func (e ClientStatusResponseValidationError) Cause() error { return e.cause }
818
819 // Key function returns key value.
820 func (e ClientStatusResponseValidationError) Key() bool { return e.key }
821
822 // ErrorName returns error name.
823 func (e ClientStatusResponseValidationError) ErrorName() string {
824 return "ClientStatusResponseValidationError"
825 }
826
827 // Error satisfies the builtin error interface
828 func (e ClientStatusResponseValidationError) Error() string {
829 cause := ""
830 if e.cause != nil {
831 cause = fmt.Sprintf(" | caused by: %v", e.cause)
832 }
833
834 key := ""
835 if e.key {
836 key = "key for "
837 }
838
839 return fmt.Sprintf(
840 "invalid %sClientStatusResponse.%s: %s%s",
841 key,
842 e.field,
843 e.reason,
844 cause)
845 }
846
847 var _ error = ClientStatusResponseValidationError{}
848
849 var _ interface {
850 Field() string
851 Reason() string
852 Key() bool
853 Cause() error
854 ErrorName() string
855 } = ClientStatusResponseValidationError{}
856
857 // Validate checks the field values on ClientConfig_GenericXdsConfig with the
858 // rules defined in the proto definition for this message. If any rules are
859 // violated, the first error encountered is returned, or nil if there are no violations.
860 func (m *ClientConfig_GenericXdsConfig) Validate() error {
861 return m.validate(false)
862 }
863
864 // ValidateAll checks the field values on ClientConfig_GenericXdsConfig with
865 // the rules defined in the proto definition for this message. If any rules
866 // are violated, the result is a list of violation errors wrapped in
867 // ClientConfig_GenericXdsConfigMultiError, or nil if none found.
868 func (m *ClientConfig_GenericXdsConfig) ValidateAll() error {
869 return m.validate(true)
870 }
871
872 func (m *ClientConfig_GenericXdsConfig) validate(all bool) error {
873 if m == nil {
874 return nil
875 }
876
877 var errors []error
878
879 // no validation rules for TypeUrl
880
881 // no validation rules for Name
882
883 // no validation rules for VersionInfo
884
885 if all {
886 switch v := interface{}(m.GetXdsConfig()).(type) {
887 case interface{ ValidateAll() error }:
888 if err := v.ValidateAll(); err != nil {
889 errors = append(errors, ClientConfig_GenericXdsConfigValidationError{
890 field: "XdsConfig",
891 reason: "embedded message failed validation",
892 cause: err,
893 })
894 }
895 case interface{ Validate() error }:
896 if err := v.Validate(); err != nil {
897 errors = append(errors, ClientConfig_GenericXdsConfigValidationError{
898 field: "XdsConfig",
899 reason: "embedded message failed validation",
900 cause: err,
901 })
902 }
903 }
904 } else if v, ok := interface{}(m.GetXdsConfig()).(interface{ Validate() error }); ok {
905 if err := v.Validate(); err != nil {
906 return ClientConfig_GenericXdsConfigValidationError{
907 field: "XdsConfig",
908 reason: "embedded message failed validation",
909 cause: err,
910 }
911 }
912 }
913
914 if all {
915 switch v := interface{}(m.GetLastUpdated()).(type) {
916 case interface{ ValidateAll() error }:
917 if err := v.ValidateAll(); err != nil {
918 errors = append(errors, ClientConfig_GenericXdsConfigValidationError{
919 field: "LastUpdated",
920 reason: "embedded message failed validation",
921 cause: err,
922 })
923 }
924 case interface{ Validate() error }:
925 if err := v.Validate(); err != nil {
926 errors = append(errors, ClientConfig_GenericXdsConfigValidationError{
927 field: "LastUpdated",
928 reason: "embedded message failed validation",
929 cause: err,
930 })
931 }
932 }
933 } else if v, ok := interface{}(m.GetLastUpdated()).(interface{ Validate() error }); ok {
934 if err := v.Validate(); err != nil {
935 return ClientConfig_GenericXdsConfigValidationError{
936 field: "LastUpdated",
937 reason: "embedded message failed validation",
938 cause: err,
939 }
940 }
941 }
942
943 // no validation rules for ConfigStatus
944
945 // no validation rules for ClientStatus
946
947 if all {
948 switch v := interface{}(m.GetErrorState()).(type) {
949 case interface{ ValidateAll() error }:
950 if err := v.ValidateAll(); err != nil {
951 errors = append(errors, ClientConfig_GenericXdsConfigValidationError{
952 field: "ErrorState",
953 reason: "embedded message failed validation",
954 cause: err,
955 })
956 }
957 case interface{ Validate() error }:
958 if err := v.Validate(); err != nil {
959 errors = append(errors, ClientConfig_GenericXdsConfigValidationError{
960 field: "ErrorState",
961 reason: "embedded message failed validation",
962 cause: err,
963 })
964 }
965 }
966 } else if v, ok := interface{}(m.GetErrorState()).(interface{ Validate() error }); ok {
967 if err := v.Validate(); err != nil {
968 return ClientConfig_GenericXdsConfigValidationError{
969 field: "ErrorState",
970 reason: "embedded message failed validation",
971 cause: err,
972 }
973 }
974 }
975
976 // no validation rules for IsStaticResource
977
978 if len(errors) > 0 {
979 return ClientConfig_GenericXdsConfigMultiError(errors)
980 }
981
982 return nil
983 }
984
985 // ClientConfig_GenericXdsConfigMultiError is an error wrapping multiple
986 // validation errors returned by ClientConfig_GenericXdsConfig.ValidateAll()
987 // if the designated constraints aren't met.
988 type ClientConfig_GenericXdsConfigMultiError []error
989
990 // Error returns a concatenation of all the error messages it wraps.
991 func (m ClientConfig_GenericXdsConfigMultiError) Error() string {
992 var msgs []string
993 for _, err := range m {
994 msgs = append(msgs, err.Error())
995 }
996 return strings.Join(msgs, "; ")
997 }
998
999 // AllErrors returns a list of validation violation errors.
1000 func (m ClientConfig_GenericXdsConfigMultiError) AllErrors() []error { return m }
1001
1002 // ClientConfig_GenericXdsConfigValidationError is the validation error
1003 // returned by ClientConfig_GenericXdsConfig.Validate if the designated
1004 // constraints aren't met.
1005 type ClientConfig_GenericXdsConfigValidationError struct {
1006 field string
1007 reason string
1008 cause error
1009 key bool
1010 }
1011
1012 // Field function returns field value.
1013 func (e ClientConfig_GenericXdsConfigValidationError) Field() string { return e.field }
1014
1015 // Reason function returns reason value.
1016 func (e ClientConfig_GenericXdsConfigValidationError) Reason() string { return e.reason }
1017
1018 // Cause function returns cause value.
1019 func (e ClientConfig_GenericXdsConfigValidationError) Cause() error { return e.cause }
1020
1021 // Key function returns key value.
1022 func (e ClientConfig_GenericXdsConfigValidationError) Key() bool { return e.key }
1023
1024 // ErrorName returns error name.
1025 func (e ClientConfig_GenericXdsConfigValidationError) ErrorName() string {
1026 return "ClientConfig_GenericXdsConfigValidationError"
1027 }
1028
1029 // Error satisfies the builtin error interface
1030 func (e ClientConfig_GenericXdsConfigValidationError) Error() string {
1031 cause := ""
1032 if e.cause != nil {
1033 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1034 }
1035
1036 key := ""
1037 if e.key {
1038 key = "key for "
1039 }
1040
1041 return fmt.Sprintf(
1042 "invalid %sClientConfig_GenericXdsConfig.%s: %s%s",
1043 key,
1044 e.field,
1045 e.reason,
1046 cause)
1047 }
1048
1049 var _ error = ClientConfig_GenericXdsConfigValidationError{}
1050
1051 var _ interface {
1052 Field() string
1053 Reason() string
1054 Key() bool
1055 Cause() error
1056 ErrorName() string
1057 } = ClientConfig_GenericXdsConfigValidationError{}