Debian Codegraph @

go/xds/type/matcher/v3/matcher.pb.validate.go

raw symbols SCIP
1 // Code generated by protoc-gen-validate. DO NOT EDIT.
2 // source: xds/type/matcher/v3/matcher.proto
3
4 package v3
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 // ensure the imports are used
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 // Validate checks the field values on Matcher with the rules defined in the
39 // proto definition for this message. If any rules are violated, the first
40 // error encountered is returned, or nil if there are no violations.
41 func (m *Matcher) Validate() error {
42 return m.validate(false)
43 }
44
45 // ValidateAll checks the field values on Matcher with the rules defined in the
46 // proto definition for this message. If any rules are violated, the result is
47 // a list of violation errors wrapped in MatcherMultiError, or nil if none found.
48 func (m *Matcher) ValidateAll() error {
49 return m.validate(true)
50 }
51
52 func (m *Matcher) validate(all bool) error {
53 if m == nil {
54 return nil
55 }
56
57 var errors []error
58
59 if all {
60 switch v := interface{}(m.GetOnNoMatch()).(type) {
61 case interface{ ValidateAll() error }:
62 if err := v.ValidateAll(); err != nil {
63 errors = append(errors, MatcherValidationError{
64 field: "OnNoMatch",
65 reason: "embedded message failed validation",
66 cause: err,
67 })
68 }
69 case interface{ Validate() error }:
70 if err := v.Validate(); err != nil {
71 errors = append(errors, MatcherValidationError{
72 field: "OnNoMatch",
73 reason: "embedded message failed validation",
74 cause: err,
75 })
76 }
77 }
78 } else if v, ok := interface{}(m.GetOnNoMatch()).(interface{ Validate() error }); ok {
79 if err := v.Validate(); err != nil {
80 return MatcherValidationError{
81 field: "OnNoMatch",
82 reason: "embedded message failed validation",
83 cause: err,
84 }
85 }
86 }
87
88 switch v := m.MatcherType.(type) {
89 case *Matcher_MatcherList_:
90 if v == nil {
91 err := MatcherValidationError{
92 field: "MatcherType",
93 reason: "oneof value cannot be a typed-nil",
94 }
95 if !all {
96 return err
97 }
98 errors = append(errors, err)
99 }
100
101 if all {
102 switch v := interface{}(m.GetMatcherList()).(type) {
103 case interface{ ValidateAll() error }:
104 if err := v.ValidateAll(); err != nil {
105 errors = append(errors, MatcherValidationError{
106 field: "MatcherList",
107 reason: "embedded message failed validation",
108 cause: err,
109 })
110 }
111 case interface{ Validate() error }:
112 if err := v.Validate(); err != nil {
113 errors = append(errors, MatcherValidationError{
114 field: "MatcherList",
115 reason: "embedded message failed validation",
116 cause: err,
117 })
118 }
119 }
120 } else if v, ok := interface{}(m.GetMatcherList()).(interface{ Validate() error }); ok {
121 if err := v.Validate(); err != nil {
122 return MatcherValidationError{
123 field: "MatcherList",
124 reason: "embedded message failed validation",
125 cause: err,
126 }
127 }
128 }
129
130 case *Matcher_MatcherTree_:
131 if v == nil {
132 err := MatcherValidationError{
133 field: "MatcherType",
134 reason: "oneof value cannot be a typed-nil",
135 }
136 if !all {
137 return err
138 }
139 errors = append(errors, err)
140 }
141
142 if all {
143 switch v := interface{}(m.GetMatcherTree()).(type) {
144 case interface{ ValidateAll() error }:
145 if err := v.ValidateAll(); err != nil {
146 errors = append(errors, MatcherValidationError{
147 field: "MatcherTree",
148 reason: "embedded message failed validation",
149 cause: err,
150 })
151 }
152 case interface{ Validate() error }:
153 if err := v.Validate(); err != nil {
154 errors = append(errors, MatcherValidationError{
155 field: "MatcherTree",
156 reason: "embedded message failed validation",
157 cause: err,
158 })
159 }
160 }
161 } else if v, ok := interface{}(m.GetMatcherTree()).(interface{ Validate() error }); ok {
162 if err := v.Validate(); err != nil {
163 return MatcherValidationError{
164 field: "MatcherTree",
165 reason: "embedded message failed validation",
166 cause: err,
167 }
168 }
169 }
170
171 default:
172 _ = v // ensures v is used
173 }
174
175 if len(errors) > 0 {
176 return MatcherMultiError(errors)
177 }
178
179 return nil
180 }
181
182 // MatcherMultiError is an error wrapping multiple validation errors returned
183 // by Matcher.ValidateAll() if the designated constraints aren't met.
184 type MatcherMultiError []error
185
186 // Error returns a concatenation of all the error messages it wraps.
187 func (m MatcherMultiError) Error() string {
188 msgs := make([]string, 0, len(m))
189 for _, err := range m {
190 msgs = append(msgs, err.Error())
191 }
192 return strings.Join(msgs, "; ")
193 }
194
195 // AllErrors returns a list of validation violation errors.
196 func (m MatcherMultiError) AllErrors() []error { return m }
197
198 // MatcherValidationError is the validation error returned by Matcher.Validate
199 // if the designated constraints aren't met.
200 type MatcherValidationError struct {
201 field string
202 reason string
203 cause error
204 key bool
205 }
206
207 // Field function returns field value.
208 func (e MatcherValidationError) Field() string { return e.field }
209
210 // Reason function returns reason value.
211 func (e MatcherValidationError) Reason() string { return e.reason }
212
213 // Cause function returns cause value.
214 func (e MatcherValidationError) Cause() error { return e.cause }
215
216 // Key function returns key value.
217 func (e MatcherValidationError) Key() bool { return e.key }
218
219 // ErrorName returns error name.
220 func (e MatcherValidationError) ErrorName() string { return "MatcherValidationError" }
221
222 // Error satisfies the builtin error interface
223 func (e MatcherValidationError) Error() string {
224 cause := ""
225 if e.cause != nil {
226 cause = fmt.Sprintf(" | caused by: %v", e.cause)
227 }
228
229 key := ""
230 if e.key {
231 key = "key for "
232 }
233
234 return fmt.Sprintf(
235 "invalid %sMatcher.%s: %s%s",
236 key,
237 e.field,
238 e.reason,
239 cause)
240 }
241
242 var _ error = MatcherValidationError{}
243
244 var _ interface {
245 Field() string
246 Reason() string
247 Key() bool
248 Cause() error
249 ErrorName() string
250 } = MatcherValidationError{}
251
252 // Validate checks the field values on Matcher_OnMatch with the rules defined
253 // in the proto definition for this message. If any rules are violated, the
254 // first error encountered is returned, or nil if there are no violations.
255 func (m *Matcher_OnMatch) Validate() error {
256 return m.validate(false)
257 }
258
259 // ValidateAll checks the field values on Matcher_OnMatch with the rules
260 // defined in the proto definition for this message. If any rules are
261 // violated, the result is a list of violation errors wrapped in
262 // Matcher_OnMatchMultiError, or nil if none found.
263 func (m *Matcher_OnMatch) ValidateAll() error {
264 return m.validate(true)
265 }
266
267 func (m *Matcher_OnMatch) validate(all bool) error {
268 if m == nil {
269 return nil
270 }
271
272 var errors []error
273
274 // no validation rules for KeepMatching
275
276 oneofOnMatchPresent := false
277 switch v := m.OnMatch.(type) {
278 case *Matcher_OnMatch_Matcher:
279 if v == nil {
280 err := Matcher_OnMatchValidationError{
281 field: "OnMatch",
282 reason: "oneof value cannot be a typed-nil",
283 }
284 if !all {
285 return err
286 }
287 errors = append(errors, err)
288 }
289 oneofOnMatchPresent = true
290
291 if all {
292 switch v := interface{}(m.GetMatcher()).(type) {
293 case interface{ ValidateAll() error }:
294 if err := v.ValidateAll(); err != nil {
295 errors = append(errors, Matcher_OnMatchValidationError{
296 field: "Matcher",
297 reason: "embedded message failed validation",
298 cause: err,
299 })
300 }
301 case interface{ Validate() error }:
302 if err := v.Validate(); err != nil {
303 errors = append(errors, Matcher_OnMatchValidationError{
304 field: "Matcher",
305 reason: "embedded message failed validation",
306 cause: err,
307 })
308 }
309 }
310 } else if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok {
311 if err := v.Validate(); err != nil {
312 return Matcher_OnMatchValidationError{
313 field: "Matcher",
314 reason: "embedded message failed validation",
315 cause: err,
316 }
317 }
318 }
319
320 case *Matcher_OnMatch_Action:
321 if v == nil {
322 err := Matcher_OnMatchValidationError{
323 field: "OnMatch",
324 reason: "oneof value cannot be a typed-nil",
325 }
326 if !all {
327 return err
328 }
329 errors = append(errors, err)
330 }
331 oneofOnMatchPresent = true
332
333 if all {
334 switch v := interface{}(m.GetAction()).(type) {
335 case interface{ ValidateAll() error }:
336 if err := v.ValidateAll(); err != nil {
337 errors = append(errors, Matcher_OnMatchValidationError{
338 field: "Action",
339 reason: "embedded message failed validation",
340 cause: err,
341 })
342 }
343 case interface{ Validate() error }:
344 if err := v.Validate(); err != nil {
345 errors = append(errors, Matcher_OnMatchValidationError{
346 field: "Action",
347 reason: "embedded message failed validation",
348 cause: err,
349 })
350 }
351 }
352 } else if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok {
353 if err := v.Validate(); err != nil {
354 return Matcher_OnMatchValidationError{
355 field: "Action",
356 reason: "embedded message failed validation",
357 cause: err,
358 }
359 }
360 }
361
362 default:
363 _ = v // ensures v is used
364 }
365 if !oneofOnMatchPresent {
366 err := Matcher_OnMatchValidationError{
367 field: "OnMatch",
368 reason: "value is required",
369 }
370 if !all {
371 return err
372 }
373 errors = append(errors, err)
374 }
375
376 if len(errors) > 0 {
377 return Matcher_OnMatchMultiError(errors)
378 }
379
380 return nil
381 }
382
383 // Matcher_OnMatchMultiError is an error wrapping multiple validation errors
384 // returned by Matcher_OnMatch.ValidateAll() if the designated constraints
385 // aren't met.
386 type Matcher_OnMatchMultiError []error
387
388 // Error returns a concatenation of all the error messages it wraps.
389 func (m Matcher_OnMatchMultiError) Error() string {
390 msgs := make([]string, 0, len(m))
391 for _, err := range m {
392 msgs = append(msgs, err.Error())
393 }
394 return strings.Join(msgs, "; ")
395 }
396
397 // AllErrors returns a list of validation violation errors.
398 func (m Matcher_OnMatchMultiError) AllErrors() []error { return m }
399
400 // Matcher_OnMatchValidationError is the validation error returned by
401 // Matcher_OnMatch.Validate if the designated constraints aren't met.
402 type Matcher_OnMatchValidationError struct {
403 field string
404 reason string
405 cause error
406 key bool
407 }
408
409 // Field function returns field value.
410 func (e Matcher_OnMatchValidationError) Field() string { return e.field }
411
412 // Reason function returns reason value.
413 func (e Matcher_OnMatchValidationError) Reason() string { return e.reason }
414
415 // Cause function returns cause value.
416 func (e Matcher_OnMatchValidationError) Cause() error { return e.cause }
417
418 // Key function returns key value.
419 func (e Matcher_OnMatchValidationError) Key() bool { return e.key }
420
421 // ErrorName returns error name.
422 func (e Matcher_OnMatchValidationError) ErrorName() string { return "Matcher_OnMatchValidationError" }
423
424 // Error satisfies the builtin error interface
425 func (e Matcher_OnMatchValidationError) Error() string {
426 cause := ""
427 if e.cause != nil {
428 cause = fmt.Sprintf(" | caused by: %v", e.cause)
429 }
430
431 key := ""
432 if e.key {
433 key = "key for "
434 }
435
436 return fmt.Sprintf(
437 "invalid %sMatcher_OnMatch.%s: %s%s",
438 key,
439 e.field,
440 e.reason,
441 cause)
442 }
443
444 var _ error = Matcher_OnMatchValidationError{}
445
446 var _ interface {
447 Field() string
448 Reason() string
449 Key() bool
450 Cause() error
451 ErrorName() string
452 } = Matcher_OnMatchValidationError{}
453
454 // Validate checks the field values on Matcher_MatcherList with the rules
455 // defined in the proto definition for this message. If any rules are
456 // violated, the first error encountered is returned, or nil if there are no violations.
457 func (m *Matcher_MatcherList) Validate() error {
458 return m.validate(false)
459 }
460
461 // ValidateAll checks the field values on Matcher_MatcherList with the rules
462 // defined in the proto definition for this message. If any rules are
463 // violated, the result is a list of violation errors wrapped in
464 // Matcher_MatcherListMultiError, or nil if none found.
465 func (m *Matcher_MatcherList) ValidateAll() error {
466 return m.validate(true)
467 }
468
469 func (m *Matcher_MatcherList) validate(all bool) error {
470 if m == nil {
471 return nil
472 }
473
474 var errors []error
475
476 if len(m.GetMatchers()) < 1 {
477 err := Matcher_MatcherListValidationError{
478 field: "Matchers",
479 reason: "value must contain at least 1 item(s)",
480 }
481 if !all {
482 return err
483 }
484 errors = append(errors, err)
485 }
486
487 for idx, item := range m.GetMatchers() {
488 _, _ = idx, item
489
490 if all {
491 switch v := interface{}(item).(type) {
492 case interface{ ValidateAll() error }:
493 if err := v.ValidateAll(); err != nil {
494 errors = append(errors, Matcher_MatcherListValidationError{
495 field: fmt.Sprintf("Matchers[%v]", idx),
496 reason: "embedded message failed validation",
497 cause: err,
498 })
499 }
500 case interface{ Validate() error }:
501 if err := v.Validate(); err != nil {
502 errors = append(errors, Matcher_MatcherListValidationError{
503 field: fmt.Sprintf("Matchers[%v]", idx),
504 reason: "embedded message failed validation",
505 cause: err,
506 })
507 }
508 }
509 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
510 if err := v.Validate(); err != nil {
511 return Matcher_MatcherListValidationError{
512 field: fmt.Sprintf("Matchers[%v]", idx),
513 reason: "embedded message failed validation",
514 cause: err,
515 }
516 }
517 }
518
519 }
520
521 if len(errors) > 0 {
522 return Matcher_MatcherListMultiError(errors)
523 }
524
525 return nil
526 }
527
528 // Matcher_MatcherListMultiError is an error wrapping multiple validation
529 // errors returned by Matcher_MatcherList.ValidateAll() if the designated
530 // constraints aren't met.
531 type Matcher_MatcherListMultiError []error
532
533 // Error returns a concatenation of all the error messages it wraps.
534 func (m Matcher_MatcherListMultiError) Error() string {
535 msgs := make([]string, 0, len(m))
536 for _, err := range m {
537 msgs = append(msgs, err.Error())
538 }
539 return strings.Join(msgs, "; ")
540 }
541
542 // AllErrors returns a list of validation violation errors.
543 func (m Matcher_MatcherListMultiError) AllErrors() []error { return m }
544
545 // Matcher_MatcherListValidationError is the validation error returned by
546 // Matcher_MatcherList.Validate if the designated constraints aren't met.
547 type Matcher_MatcherListValidationError struct {
548 field string
549 reason string
550 cause error
551 key bool
552 }
553
554 // Field function returns field value.
555 func (e Matcher_MatcherListValidationError) Field() string { return e.field }
556
557 // Reason function returns reason value.
558 func (e Matcher_MatcherListValidationError) Reason() string { return e.reason }
559
560 // Cause function returns cause value.
561 func (e Matcher_MatcherListValidationError) Cause() error { return e.cause }
562
563 // Key function returns key value.
564 func (e Matcher_MatcherListValidationError) Key() bool { return e.key }
565
566 // ErrorName returns error name.
567 func (e Matcher_MatcherListValidationError) ErrorName() string {
568 return "Matcher_MatcherListValidationError"
569 }
570
571 // Error satisfies the builtin error interface
572 func (e Matcher_MatcherListValidationError) Error() string {
573 cause := ""
574 if e.cause != nil {
575 cause = fmt.Sprintf(" | caused by: %v", e.cause)
576 }
577
578 key := ""
579 if e.key {
580 key = "key for "
581 }
582
583 return fmt.Sprintf(
584 "invalid %sMatcher_MatcherList.%s: %s%s",
585 key,
586 e.field,
587 e.reason,
588 cause)
589 }
590
591 var _ error = Matcher_MatcherListValidationError{}
592
593 var _ interface {
594 Field() string
595 Reason() string
596 Key() bool
597 Cause() error
598 ErrorName() string
599 } = Matcher_MatcherListValidationError{}
600
601 // Validate checks the field values on Matcher_MatcherTree with the rules
602 // defined in the proto definition for this message. If any rules are
603 // violated, the first error encountered is returned, or nil if there are no violations.
604 func (m *Matcher_MatcherTree) Validate() error {
605 return m.validate(false)
606 }
607
608 // ValidateAll checks the field values on Matcher_MatcherTree with the rules
609 // defined in the proto definition for this message. If any rules are
610 // violated, the result is a list of violation errors wrapped in
611 // Matcher_MatcherTreeMultiError, or nil if none found.
612 func (m *Matcher_MatcherTree) ValidateAll() error {
613 return m.validate(true)
614 }
615
616 func (m *Matcher_MatcherTree) validate(all bool) error {
617 if m == nil {
618 return nil
619 }
620
621 var errors []error
622
623 if m.GetInput() == nil {
624 err := Matcher_MatcherTreeValidationError{
625 field: "Input",
626 reason: "value is required",
627 }
628 if !all {
629 return err
630 }
631 errors = append(errors, err)
632 }
633
634 if all {
635 switch v := interface{}(m.GetInput()).(type) {
636 case interface{ ValidateAll() error }:
637 if err := v.ValidateAll(); err != nil {
638 errors = append(errors, Matcher_MatcherTreeValidationError{
639 field: "Input",
640 reason: "embedded message failed validation",
641 cause: err,
642 })
643 }
644 case interface{ Validate() error }:
645 if err := v.Validate(); err != nil {
646 errors = append(errors, Matcher_MatcherTreeValidationError{
647 field: "Input",
648 reason: "embedded message failed validation",
649 cause: err,
650 })
651 }
652 }
653 } else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
654 if err := v.Validate(); err != nil {
655 return Matcher_MatcherTreeValidationError{
656 field: "Input",
657 reason: "embedded message failed validation",
658 cause: err,
659 }
660 }
661 }
662
663 oneofTreeTypePresent := false
664 switch v := m.TreeType.(type) {
665 case *Matcher_MatcherTree_ExactMatchMap:
666 if v == nil {
667 err := Matcher_MatcherTreeValidationError{
668 field: "TreeType",
669 reason: "oneof value cannot be a typed-nil",
670 }
671 if !all {
672 return err
673 }
674 errors = append(errors, err)
675 }
676 oneofTreeTypePresent = true
677
678 if all {
679 switch v := interface{}(m.GetExactMatchMap()).(type) {
680 case interface{ ValidateAll() error }:
681 if err := v.ValidateAll(); err != nil {
682 errors = append(errors, Matcher_MatcherTreeValidationError{
683 field: "ExactMatchMap",
684 reason: "embedded message failed validation",
685 cause: err,
686 })
687 }
688 case interface{ Validate() error }:
689 if err := v.Validate(); err != nil {
690 errors = append(errors, Matcher_MatcherTreeValidationError{
691 field: "ExactMatchMap",
692 reason: "embedded message failed validation",
693 cause: err,
694 })
695 }
696 }
697 } else if v, ok := interface{}(m.GetExactMatchMap()).(interface{ Validate() error }); ok {
698 if err := v.Validate(); err != nil {
699 return Matcher_MatcherTreeValidationError{
700 field: "ExactMatchMap",
701 reason: "embedded message failed validation",
702 cause: err,
703 }
704 }
705 }
706
707 case *Matcher_MatcherTree_PrefixMatchMap:
708 if v == nil {
709 err := Matcher_MatcherTreeValidationError{
710 field: "TreeType",
711 reason: "oneof value cannot be a typed-nil",
712 }
713 if !all {
714 return err
715 }
716 errors = append(errors, err)
717 }
718 oneofTreeTypePresent = true
719
720 if all {
721 switch v := interface{}(m.GetPrefixMatchMap()).(type) {
722 case interface{ ValidateAll() error }:
723 if err := v.ValidateAll(); err != nil {
724 errors = append(errors, Matcher_MatcherTreeValidationError{
725 field: "PrefixMatchMap",
726 reason: "embedded message failed validation",
727 cause: err,
728 })
729 }
730 case interface{ Validate() error }:
731 if err := v.Validate(); err != nil {
732 errors = append(errors, Matcher_MatcherTreeValidationError{
733 field: "PrefixMatchMap",
734 reason: "embedded message failed validation",
735 cause: err,
736 })
737 }
738 }
739 } else if v, ok := interface{}(m.GetPrefixMatchMap()).(interface{ Validate() error }); ok {
740 if err := v.Validate(); err != nil {
741 return Matcher_MatcherTreeValidationError{
742 field: "PrefixMatchMap",
743 reason: "embedded message failed validation",
744 cause: err,
745 }
746 }
747 }
748
749 case *Matcher_MatcherTree_CustomMatch:
750 if v == nil {
751 err := Matcher_MatcherTreeValidationError{
752 field: "TreeType",
753 reason: "oneof value cannot be a typed-nil",
754 }
755 if !all {
756 return err
757 }
758 errors = append(errors, err)
759 }
760 oneofTreeTypePresent = true
761
762 if all {
763 switch v := interface{}(m.GetCustomMatch()).(type) {
764 case interface{ ValidateAll() error }:
765 if err := v.ValidateAll(); err != nil {
766 errors = append(errors, Matcher_MatcherTreeValidationError{
767 field: "CustomMatch",
768 reason: "embedded message failed validation",
769 cause: err,
770 })
771 }
772 case interface{ Validate() error }:
773 if err := v.Validate(); err != nil {
774 errors = append(errors, Matcher_MatcherTreeValidationError{
775 field: "CustomMatch",
776 reason: "embedded message failed validation",
777 cause: err,
778 })
779 }
780 }
781 } else if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok {
782 if err := v.Validate(); err != nil {
783 return Matcher_MatcherTreeValidationError{
784 field: "CustomMatch",
785 reason: "embedded message failed validation",
786 cause: err,
787 }
788 }
789 }
790
791 default:
792 _ = v // ensures v is used
793 }
794 if !oneofTreeTypePresent {
795 err := Matcher_MatcherTreeValidationError{
796 field: "TreeType",
797 reason: "value is required",
798 }
799 if !all {
800 return err
801 }
802 errors = append(errors, err)
803 }
804
805 if len(errors) > 0 {
806 return Matcher_MatcherTreeMultiError(errors)
807 }
808
809 return nil
810 }
811
812 // Matcher_MatcherTreeMultiError is an error wrapping multiple validation
813 // errors returned by Matcher_MatcherTree.ValidateAll() if the designated
814 // constraints aren't met.
815 type Matcher_MatcherTreeMultiError []error
816
817 // Error returns a concatenation of all the error messages it wraps.
818 func (m Matcher_MatcherTreeMultiError) Error() string {
819 msgs := make([]string, 0, len(m))
820 for _, err := range m {
821 msgs = append(msgs, err.Error())
822 }
823 return strings.Join(msgs, "; ")
824 }
825
826 // AllErrors returns a list of validation violation errors.
827 func (m Matcher_MatcherTreeMultiError) AllErrors() []error { return m }
828
829 // Matcher_MatcherTreeValidationError is the validation error returned by
830 // Matcher_MatcherTree.Validate if the designated constraints aren't met.
831 type Matcher_MatcherTreeValidationError struct {
832 field string
833 reason string
834 cause error
835 key bool
836 }
837
838 // Field function returns field value.
839 func (e Matcher_MatcherTreeValidationError) Field() string { return e.field }
840
841 // Reason function returns reason value.
842 func (e Matcher_MatcherTreeValidationError) Reason() string { return e.reason }
843
844 // Cause function returns cause value.
845 func (e Matcher_MatcherTreeValidationError) Cause() error { return e.cause }
846
847 // Key function returns key value.
848 func (e Matcher_MatcherTreeValidationError) Key() bool { return e.key }
849
850 // ErrorName returns error name.
851 func (e Matcher_MatcherTreeValidationError) ErrorName() string {
852 return "Matcher_MatcherTreeValidationError"
853 }
854
855 // Error satisfies the builtin error interface
856 func (e Matcher_MatcherTreeValidationError) Error() string {
857 cause := ""
858 if e.cause != nil {
859 cause = fmt.Sprintf(" | caused by: %v", e.cause)
860 }
861
862 key := ""
863 if e.key {
864 key = "key for "
865 }
866
867 return fmt.Sprintf(
868 "invalid %sMatcher_MatcherTree.%s: %s%s",
869 key,
870 e.field,
871 e.reason,
872 cause)
873 }
874
875 var _ error = Matcher_MatcherTreeValidationError{}
876
877 var _ interface {
878 Field() string
879 Reason() string
880 Key() bool
881 Cause() error
882 ErrorName() string
883 } = Matcher_MatcherTreeValidationError{}
884
885 // Validate checks the field values on Matcher_MatcherList_Predicate with the
886 // rules defined in the proto definition for this message. If any rules are
887 // violated, the first error encountered is returned, or nil if there are no violations.
888 func (m *Matcher_MatcherList_Predicate) Validate() error {
889 return m.validate(false)
890 }
891
892 // ValidateAll checks the field values on Matcher_MatcherList_Predicate with
893 // the rules defined in the proto definition for this message. If any rules
894 // are violated, the result is a list of violation errors wrapped in
895 // Matcher_MatcherList_PredicateMultiError, or nil if none found.
896 func (m *Matcher_MatcherList_Predicate) ValidateAll() error {
897 return m.validate(true)
898 }
899
900 func (m *Matcher_MatcherList_Predicate) validate(all bool) error {
901 if m == nil {
902 return nil
903 }
904
905 var errors []error
906
907 oneofMatchTypePresent := false
908 switch v := m.MatchType.(type) {
909 case *Matcher_MatcherList_Predicate_SinglePredicate_:
910 if v == nil {
911 err := Matcher_MatcherList_PredicateValidationError{
912 field: "MatchType",
913 reason: "oneof value cannot be a typed-nil",
914 }
915 if !all {
916 return err
917 }
918 errors = append(errors, err)
919 }
920 oneofMatchTypePresent = true
921
922 if all {
923 switch v := interface{}(m.GetSinglePredicate()).(type) {
924 case interface{ ValidateAll() error }:
925 if err := v.ValidateAll(); err != nil {
926 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
927 field: "SinglePredicate",
928 reason: "embedded message failed validation",
929 cause: err,
930 })
931 }
932 case interface{ Validate() error }:
933 if err := v.Validate(); err != nil {
934 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
935 field: "SinglePredicate",
936 reason: "embedded message failed validation",
937 cause: err,
938 })
939 }
940 }
941 } else if v, ok := interface{}(m.GetSinglePredicate()).(interface{ Validate() error }); ok {
942 if err := v.Validate(); err != nil {
943 return Matcher_MatcherList_PredicateValidationError{
944 field: "SinglePredicate",
945 reason: "embedded message failed validation",
946 cause: err,
947 }
948 }
949 }
950
951 case *Matcher_MatcherList_Predicate_OrMatcher:
952 if v == nil {
953 err := Matcher_MatcherList_PredicateValidationError{
954 field: "MatchType",
955 reason: "oneof value cannot be a typed-nil",
956 }
957 if !all {
958 return err
959 }
960 errors = append(errors, err)
961 }
962 oneofMatchTypePresent = true
963
964 if all {
965 switch v := interface{}(m.GetOrMatcher()).(type) {
966 case interface{ ValidateAll() error }:
967 if err := v.ValidateAll(); err != nil {
968 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
969 field: "OrMatcher",
970 reason: "embedded message failed validation",
971 cause: err,
972 })
973 }
974 case interface{ Validate() error }:
975 if err := v.Validate(); err != nil {
976 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
977 field: "OrMatcher",
978 reason: "embedded message failed validation",
979 cause: err,
980 })
981 }
982 }
983 } else if v, ok := interface{}(m.GetOrMatcher()).(interface{ Validate() error }); ok {
984 if err := v.Validate(); err != nil {
985 return Matcher_MatcherList_PredicateValidationError{
986 field: "OrMatcher",
987 reason: "embedded message failed validation",
988 cause: err,
989 }
990 }
991 }
992
993 case *Matcher_MatcherList_Predicate_AndMatcher:
994 if v == nil {
995 err := Matcher_MatcherList_PredicateValidationError{
996 field: "MatchType",
997 reason: "oneof value cannot be a typed-nil",
998 }
999 if !all {
1000 return err
1001 }
1002 errors = append(errors, err)
1003 }
1004 oneofMatchTypePresent = true
1005
1006 if all {
1007 switch v := interface{}(m.GetAndMatcher()).(type) {
1008 case interface{ ValidateAll() error }:
1009 if err := v.ValidateAll(); err != nil {
1010 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1011 field: "AndMatcher",
1012 reason: "embedded message failed validation",
1013 cause: err,
1014 })
1015 }
1016 case interface{ Validate() error }:
1017 if err := v.Validate(); err != nil {
1018 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1019 field: "AndMatcher",
1020 reason: "embedded message failed validation",
1021 cause: err,
1022 })
1023 }
1024 }
1025 } else if v, ok := interface{}(m.GetAndMatcher()).(interface{ Validate() error }); ok {
1026 if err := v.Validate(); err != nil {
1027 return Matcher_MatcherList_PredicateValidationError{
1028 field: "AndMatcher",
1029 reason: "embedded message failed validation",
1030 cause: err,
1031 }
1032 }
1033 }
1034
1035 case *Matcher_MatcherList_Predicate_NotMatcher:
1036 if v == nil {
1037 err := Matcher_MatcherList_PredicateValidationError{
1038 field: "MatchType",
1039 reason: "oneof value cannot be a typed-nil",
1040 }
1041 if !all {
1042 return err
1043 }
1044 errors = append(errors, err)
1045 }
1046 oneofMatchTypePresent = true
1047
1048 if all {
1049 switch v := interface{}(m.GetNotMatcher()).(type) {
1050 case interface{ ValidateAll() error }:
1051 if err := v.ValidateAll(); err != nil {
1052 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1053 field: "NotMatcher",
1054 reason: "embedded message failed validation",
1055 cause: err,
1056 })
1057 }
1058 case interface{ Validate() error }:
1059 if err := v.Validate(); err != nil {
1060 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1061 field: "NotMatcher",
1062 reason: "embedded message failed validation",
1063 cause: err,
1064 })
1065 }
1066 }
1067 } else if v, ok := interface{}(m.GetNotMatcher()).(interface{ Validate() error }); ok {
1068 if err := v.Validate(); err != nil {
1069 return Matcher_MatcherList_PredicateValidationError{
1070 field: "NotMatcher",
1071 reason: "embedded message failed validation",
1072 cause: err,
1073 }
1074 }
1075 }
1076
1077 default:
1078 _ = v // ensures v is used
1079 }
1080 if !oneofMatchTypePresent {
1081 err := Matcher_MatcherList_PredicateValidationError{
1082 field: "MatchType",
1083 reason: "value is required",
1084 }
1085 if !all {
1086 return err
1087 }
1088 errors = append(errors, err)
1089 }
1090
1091 if len(errors) > 0 {
1092 return Matcher_MatcherList_PredicateMultiError(errors)
1093 }
1094
1095 return nil
1096 }
1097
1098 // Matcher_MatcherList_PredicateMultiError is an error wrapping multiple
1099 // validation errors returned by Matcher_MatcherList_Predicate.ValidateAll()
1100 // if the designated constraints aren't met.
1101 type Matcher_MatcherList_PredicateMultiError []error
1102
1103 // Error returns a concatenation of all the error messages it wraps.
1104 func (m Matcher_MatcherList_PredicateMultiError) Error() string {
1105 msgs := make([]string, 0, len(m))
1106 for _, err := range m {
1107 msgs = append(msgs, err.Error())
1108 }
1109 return strings.Join(msgs, "; ")
1110 }
1111
1112 // AllErrors returns a list of validation violation errors.
1113 func (m Matcher_MatcherList_PredicateMultiError) AllErrors() []error { return m }
1114
1115 // Matcher_MatcherList_PredicateValidationError is the validation error
1116 // returned by Matcher_MatcherList_Predicate.Validate if the designated
1117 // constraints aren't met.
1118 type Matcher_MatcherList_PredicateValidationError struct {
1119 field string
1120 reason string
1121 cause error
1122 key bool
1123 }
1124
1125 // Field function returns field value.
1126 func (e Matcher_MatcherList_PredicateValidationError) Field() string { return e.field }
1127
1128 // Reason function returns reason value.
1129 func (e Matcher_MatcherList_PredicateValidationError) Reason() string { return e.reason }
1130
1131 // Cause function returns cause value.
1132 func (e Matcher_MatcherList_PredicateValidationError) Cause() error { return e.cause }
1133
1134 // Key function returns key value.
1135 func (e Matcher_MatcherList_PredicateValidationError) Key() bool { return e.key }
1136
1137 // ErrorName returns error name.
1138 func (e Matcher_MatcherList_PredicateValidationError) ErrorName() string {
1139 return "Matcher_MatcherList_PredicateValidationError"
1140 }
1141
1142 // Error satisfies the builtin error interface
1143 func (e Matcher_MatcherList_PredicateValidationError) Error() string {
1144 cause := ""
1145 if e.cause != nil {
1146 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1147 }
1148
1149 key := ""
1150 if e.key {
1151 key = "key for "
1152 }
1153
1154 return fmt.Sprintf(
1155 "invalid %sMatcher_MatcherList_Predicate.%s: %s%s",
1156 key,
1157 e.field,
1158 e.reason,
1159 cause)
1160 }
1161
1162 var _ error = Matcher_MatcherList_PredicateValidationError{}
1163
1164 var _ interface {
1165 Field() string
1166 Reason() string
1167 Key() bool
1168 Cause() error
1169 ErrorName() string
1170 } = Matcher_MatcherList_PredicateValidationError{}
1171
1172 // Validate checks the field values on Matcher_MatcherList_FieldMatcher with
1173 // the rules defined in the proto definition for this message. If any rules
1174 // are violated, the first error encountered is returned, or nil if there are
1175 // no violations.
1176 func (m *Matcher_MatcherList_FieldMatcher) Validate() error {
1177 return m.validate(false)
1178 }
1179
1180 // ValidateAll checks the field values on Matcher_MatcherList_FieldMatcher with
1181 // the rules defined in the proto definition for this message. If any rules
1182 // are violated, the result is a list of violation errors wrapped in
1183 // Matcher_MatcherList_FieldMatcherMultiError, or nil if none found.
1184 func (m *Matcher_MatcherList_FieldMatcher) ValidateAll() error {
1185 return m.validate(true)
1186 }
1187
1188 func (m *Matcher_MatcherList_FieldMatcher) validate(all bool) error {
1189 if m == nil {
1190 return nil
1191 }
1192
1193 var errors []error
1194
1195 if m.GetPredicate() == nil {
1196 err := Matcher_MatcherList_FieldMatcherValidationError{
1197 field: "Predicate",
1198 reason: "value is required",
1199 }
1200 if !all {
1201 return err
1202 }
1203 errors = append(errors, err)
1204 }
1205
1206 if all {
1207 switch v := interface{}(m.GetPredicate()).(type) {
1208 case interface{ ValidateAll() error }:
1209 if err := v.ValidateAll(); err != nil {
1210 errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
1211 field: "Predicate",
1212 reason: "embedded message failed validation",
1213 cause: err,
1214 })
1215 }
1216 case interface{ Validate() error }:
1217 if err := v.Validate(); err != nil {
1218 errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
1219 field: "Predicate",
1220 reason: "embedded message failed validation",
1221 cause: err,
1222 })
1223 }
1224 }
1225 } else if v, ok := interface{}(m.GetPredicate()).(interface{ Validate() error }); ok {
1226 if err := v.Validate(); err != nil {
1227 return Matcher_MatcherList_FieldMatcherValidationError{
1228 field: "Predicate",
1229 reason: "embedded message failed validation",
1230 cause: err,
1231 }
1232 }
1233 }
1234
1235 if m.GetOnMatch() == nil {
1236 err := Matcher_MatcherList_FieldMatcherValidationError{
1237 field: "OnMatch",
1238 reason: "value is required",
1239 }
1240 if !all {
1241 return err
1242 }
1243 errors = append(errors, err)
1244 }
1245
1246 if all {
1247 switch v := interface{}(m.GetOnMatch()).(type) {
1248 case interface{ ValidateAll() error }:
1249 if err := v.ValidateAll(); err != nil {
1250 errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
1251 field: "OnMatch",
1252 reason: "embedded message failed validation",
1253 cause: err,
1254 })
1255 }
1256 case interface{ Validate() error }:
1257 if err := v.Validate(); err != nil {
1258 errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
1259 field: "OnMatch",
1260 reason: "embedded message failed validation",
1261 cause: err,
1262 })
1263 }
1264 }
1265 } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok {
1266 if err := v.Validate(); err != nil {
1267 return Matcher_MatcherList_FieldMatcherValidationError{
1268 field: "OnMatch",
1269 reason: "embedded message failed validation",
1270 cause: err,
1271 }
1272 }
1273 }
1274
1275 if len(errors) > 0 {
1276 return Matcher_MatcherList_FieldMatcherMultiError(errors)
1277 }
1278
1279 return nil
1280 }
1281
1282 // Matcher_MatcherList_FieldMatcherMultiError is an error wrapping multiple
1283 // validation errors returned by
1284 // Matcher_MatcherList_FieldMatcher.ValidateAll() if the designated
1285 // constraints aren't met.
1286 type Matcher_MatcherList_FieldMatcherMultiError []error
1287
1288 // Error returns a concatenation of all the error messages it wraps.
1289 func (m Matcher_MatcherList_FieldMatcherMultiError) Error() string {
1290 msgs := make([]string, 0, len(m))
1291 for _, err := range m {
1292 msgs = append(msgs, err.Error())
1293 }
1294 return strings.Join(msgs, "; ")
1295 }
1296
1297 // AllErrors returns a list of validation violation errors.
1298 func (m Matcher_MatcherList_FieldMatcherMultiError) AllErrors() []error { return m }
1299
1300 // Matcher_MatcherList_FieldMatcherValidationError is the validation error
1301 // returned by Matcher_MatcherList_FieldMatcher.Validate if the designated
1302 // constraints aren't met.
1303 type Matcher_MatcherList_FieldMatcherValidationError struct {
1304 field string
1305 reason string
1306 cause error
1307 key bool
1308 }
1309
1310 // Field function returns field value.
1311 func (e Matcher_MatcherList_FieldMatcherValidationError) Field() string { return e.field }
1312
1313 // Reason function returns reason value.
1314 func (e Matcher_MatcherList_FieldMatcherValidationError) Reason() string { return e.reason }
1315
1316 // Cause function returns cause value.
1317 func (e Matcher_MatcherList_FieldMatcherValidationError) Cause() error { return e.cause }
1318
1319 // Key function returns key value.
1320 func (e Matcher_MatcherList_FieldMatcherValidationError) Key() bool { return e.key }
1321
1322 // ErrorName returns error name.
1323 func (e Matcher_MatcherList_FieldMatcherValidationError) ErrorName() string {
1324 return "Matcher_MatcherList_FieldMatcherValidationError"
1325 }
1326
1327 // Error satisfies the builtin error interface
1328 func (e Matcher_MatcherList_FieldMatcherValidationError) Error() string {
1329 cause := ""
1330 if e.cause != nil {
1331 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1332 }
1333
1334 key := ""
1335 if e.key {
1336 key = "key for "
1337 }
1338
1339 return fmt.Sprintf(
1340 "invalid %sMatcher_MatcherList_FieldMatcher.%s: %s%s",
1341 key,
1342 e.field,
1343 e.reason,
1344 cause)
1345 }
1346
1347 var _ error = Matcher_MatcherList_FieldMatcherValidationError{}
1348
1349 var _ interface {
1350 Field() string
1351 Reason() string
1352 Key() bool
1353 Cause() error
1354 ErrorName() string
1355 } = Matcher_MatcherList_FieldMatcherValidationError{}
1356
1357 // Validate checks the field values on
1358 // Matcher_MatcherList_Predicate_SinglePredicate with the rules defined in the
1359 // proto definition for this message. If any rules are violated, the first
1360 // error encountered is returned, or nil if there are no violations.
1361 func (m *Matcher_MatcherList_Predicate_SinglePredicate) Validate() error {
1362 return m.validate(false)
1363 }
1364
1365 // ValidateAll checks the field values on
1366 // Matcher_MatcherList_Predicate_SinglePredicate with the rules defined in the
1367 // proto definition for this message. If any rules are violated, the result is
1368 // a list of violation errors wrapped in
1369 // Matcher_MatcherList_Predicate_SinglePredicateMultiError, or nil if none found.
1370 func (m *Matcher_MatcherList_Predicate_SinglePredicate) ValidateAll() error {
1371 return m.validate(true)
1372 }
1373
1374 func (m *Matcher_MatcherList_Predicate_SinglePredicate) validate(all bool) error {
1375 if m == nil {
1376 return nil
1377 }
1378
1379 var errors []error
1380
1381 if m.GetInput() == nil {
1382 err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1383 field: "Input",
1384 reason: "value is required",
1385 }
1386 if !all {
1387 return err
1388 }
1389 errors = append(errors, err)
1390 }
1391
1392 if all {
1393 switch v := interface{}(m.GetInput()).(type) {
1394 case interface{ ValidateAll() error }:
1395 if err := v.ValidateAll(); err != nil {
1396 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1397 field: "Input",
1398 reason: "embedded message failed validation",
1399 cause: err,
1400 })
1401 }
1402 case interface{ Validate() error }:
1403 if err := v.Validate(); err != nil {
1404 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1405 field: "Input",
1406 reason: "embedded message failed validation",
1407 cause: err,
1408 })
1409 }
1410 }
1411 } else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
1412 if err := v.Validate(); err != nil {
1413 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1414 field: "Input",
1415 reason: "embedded message failed validation",
1416 cause: err,
1417 }
1418 }
1419 }
1420
1421 oneofMatcherPresent := false
1422 switch v := m.Matcher.(type) {
1423 case *Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch:
1424 if v == nil {
1425 err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1426 field: "Matcher",
1427 reason: "oneof value cannot be a typed-nil",
1428 }
1429 if !all {
1430 return err
1431 }
1432 errors = append(errors, err)
1433 }
1434 oneofMatcherPresent = true
1435
1436 if all {
1437 switch v := interface{}(m.GetValueMatch()).(type) {
1438 case interface{ ValidateAll() error }:
1439 if err := v.ValidateAll(); err != nil {
1440 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1441 field: "ValueMatch",
1442 reason: "embedded message failed validation",
1443 cause: err,
1444 })
1445 }
1446 case interface{ Validate() error }:
1447 if err := v.Validate(); err != nil {
1448 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1449 field: "ValueMatch",
1450 reason: "embedded message failed validation",
1451 cause: err,
1452 })
1453 }
1454 }
1455 } else if v, ok := interface{}(m.GetValueMatch()).(interface{ Validate() error }); ok {
1456 if err := v.Validate(); err != nil {
1457 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1458 field: "ValueMatch",
1459 reason: "embedded message failed validation",
1460 cause: err,
1461 }
1462 }
1463 }
1464
1465 case *Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch:
1466 if v == nil {
1467 err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1468 field: "Matcher",
1469 reason: "oneof value cannot be a typed-nil",
1470 }
1471 if !all {
1472 return err
1473 }
1474 errors = append(errors, err)
1475 }
1476 oneofMatcherPresent = true
1477
1478 if all {
1479 switch v := interface{}(m.GetCustomMatch()).(type) {
1480 case interface{ ValidateAll() error }:
1481 if err := v.ValidateAll(); err != nil {
1482 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1483 field: "CustomMatch",
1484 reason: "embedded message failed validation",
1485 cause: err,
1486 })
1487 }
1488 case interface{ Validate() error }:
1489 if err := v.Validate(); err != nil {
1490 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1491 field: "CustomMatch",
1492 reason: "embedded message failed validation",
1493 cause: err,
1494 })
1495 }
1496 }
1497 } else if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok {
1498 if err := v.Validate(); err != nil {
1499 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1500 field: "CustomMatch",
1501 reason: "embedded message failed validation",
1502 cause: err,
1503 }
1504 }
1505 }
1506
1507 default:
1508 _ = v // ensures v is used
1509 }
1510 if !oneofMatcherPresent {
1511 err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1512 field: "Matcher",
1513 reason: "value is required",
1514 }
1515 if !all {
1516 return err
1517 }
1518 errors = append(errors, err)
1519 }
1520
1521 if len(errors) > 0 {
1522 return Matcher_MatcherList_Predicate_SinglePredicateMultiError(errors)
1523 }
1524
1525 return nil
1526 }
1527
1528 // Matcher_MatcherList_Predicate_SinglePredicateMultiError is an error wrapping
1529 // multiple validation errors returned by
1530 // Matcher_MatcherList_Predicate_SinglePredicate.ValidateAll() if the
1531 // designated constraints aren't met.
1532 type Matcher_MatcherList_Predicate_SinglePredicateMultiError []error
1533
1534 // Error returns a concatenation of all the error messages it wraps.
1535 func (m Matcher_MatcherList_Predicate_SinglePredicateMultiError) Error() string {
1536 msgs := make([]string, 0, len(m))
1537 for _, err := range m {
1538 msgs = append(msgs, err.Error())
1539 }
1540 return strings.Join(msgs, "; ")
1541 }
1542
1543 // AllErrors returns a list of validation violation errors.
1544 func (m Matcher_MatcherList_Predicate_SinglePredicateMultiError) AllErrors() []error { return m }
1545
1546 // Matcher_MatcherList_Predicate_SinglePredicateValidationError is the
1547 // validation error returned by
1548 // Matcher_MatcherList_Predicate_SinglePredicate.Validate if the designated
1549 // constraints aren't met.
1550 type Matcher_MatcherList_Predicate_SinglePredicateValidationError struct {
1551 field string
1552 reason string
1553 cause error
1554 key bool
1555 }
1556
1557 // Field function returns field value.
1558 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Field() string { return e.field }
1559
1560 // Reason function returns reason value.
1561 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Reason() string {
1562 return e.reason
1563 }
1564
1565 // Cause function returns cause value.
1566 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Cause() error { return e.cause }
1567
1568 // Key function returns key value.
1569 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Key() bool { return e.key }
1570
1571 // ErrorName returns error name.
1572 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) ErrorName() string {
1573 return "Matcher_MatcherList_Predicate_SinglePredicateValidationError"
1574 }
1575
1576 // Error satisfies the builtin error interface
1577 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Error() string {
1578 cause := ""
1579 if e.cause != nil {
1580 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1581 }
1582
1583 key := ""
1584 if e.key {
1585 key = "key for "
1586 }
1587
1588 return fmt.Sprintf(
1589 "invalid %sMatcher_MatcherList_Predicate_SinglePredicate.%s: %s%s",
1590 key,
1591 e.field,
1592 e.reason,
1593 cause)
1594 }
1595
1596 var _ error = Matcher_MatcherList_Predicate_SinglePredicateValidationError{}
1597
1598 var _ interface {
1599 Field() string
1600 Reason() string
1601 Key() bool
1602 Cause() error
1603 ErrorName() string
1604 } = Matcher_MatcherList_Predicate_SinglePredicateValidationError{}
1605
1606 // Validate checks the field values on
1607 // Matcher_MatcherList_Predicate_PredicateList with the rules defined in the
1608 // proto definition for this message. If any rules are violated, the first
1609 // error encountered is returned, or nil if there are no violations.
1610 func (m *Matcher_MatcherList_Predicate_PredicateList) Validate() error {
1611 return m.validate(false)
1612 }
1613
1614 // ValidateAll checks the field values on
1615 // Matcher_MatcherList_Predicate_PredicateList with the rules defined in the
1616 // proto definition for this message. If any rules are violated, the result is
1617 // a list of violation errors wrapped in
1618 // Matcher_MatcherList_Predicate_PredicateListMultiError, or nil if none found.
1619 func (m *Matcher_MatcherList_Predicate_PredicateList) ValidateAll() error {
1620 return m.validate(true)
1621 }
1622
1623 func (m *Matcher_MatcherList_Predicate_PredicateList) validate(all bool) error {
1624 if m == nil {
1625 return nil
1626 }
1627
1628 var errors []error
1629
1630 if len(m.GetPredicate()) < 2 {
1631 err := Matcher_MatcherList_Predicate_PredicateListValidationError{
1632 field: "Predicate",
1633 reason: "value must contain at least 2 item(s)",
1634 }
1635 if !all {
1636 return err
1637 }
1638 errors = append(errors, err)
1639 }
1640
1641 for idx, item := range m.GetPredicate() {
1642 _, _ = idx, item
1643
1644 if all {
1645 switch v := interface{}(item).(type) {
1646 case interface{ ValidateAll() error }:
1647 if err := v.ValidateAll(); err != nil {
1648 errors = append(errors, Matcher_MatcherList_Predicate_PredicateListValidationError{
1649 field: fmt.Sprintf("Predicate[%v]", idx),
1650 reason: "embedded message failed validation",
1651 cause: err,
1652 })
1653 }
1654 case interface{ Validate() error }:
1655 if err := v.Validate(); err != nil {
1656 errors = append(errors, Matcher_MatcherList_Predicate_PredicateListValidationError{
1657 field: fmt.Sprintf("Predicate[%v]", idx),
1658 reason: "embedded message failed validation",
1659 cause: err,
1660 })
1661 }
1662 }
1663 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1664 if err := v.Validate(); err != nil {
1665 return Matcher_MatcherList_Predicate_PredicateListValidationError{
1666 field: fmt.Sprintf("Predicate[%v]", idx),
1667 reason: "embedded message failed validation",
1668 cause: err,
1669 }
1670 }
1671 }
1672
1673 }
1674
1675 if len(errors) > 0 {
1676 return Matcher_MatcherList_Predicate_PredicateListMultiError(errors)
1677 }
1678
1679 return nil
1680 }
1681
1682 // Matcher_MatcherList_Predicate_PredicateListMultiError is an error wrapping
1683 // multiple validation errors returned by
1684 // Matcher_MatcherList_Predicate_PredicateList.ValidateAll() if the designated
1685 // constraints aren't met.
1686 type Matcher_MatcherList_Predicate_PredicateListMultiError []error
1687
1688 // Error returns a concatenation of all the error messages it wraps.
1689 func (m Matcher_MatcherList_Predicate_PredicateListMultiError) Error() string {
1690 msgs := make([]string, 0, len(m))
1691 for _, err := range m {
1692 msgs = append(msgs, err.Error())
1693 }
1694 return strings.Join(msgs, "; ")
1695 }
1696
1697 // AllErrors returns a list of validation violation errors.
1698 func (m Matcher_MatcherList_Predicate_PredicateListMultiError) AllErrors() []error { return m }
1699
1700 // Matcher_MatcherList_Predicate_PredicateListValidationError is the validation
1701 // error returned by Matcher_MatcherList_Predicate_PredicateList.Validate if
1702 // the designated constraints aren't met.
1703 type Matcher_MatcherList_Predicate_PredicateListValidationError struct {
1704 field string
1705 reason string
1706 cause error
1707 key bool
1708 }
1709
1710 // Field function returns field value.
1711 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Field() string { return e.field }
1712
1713 // Reason function returns reason value.
1714 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Reason() string { return e.reason }
1715
1716 // Cause function returns cause value.
1717 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Cause() error { return e.cause }
1718
1719 // Key function returns key value.
1720 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Key() bool { return e.key }
1721
1722 // ErrorName returns error name.
1723 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) ErrorName() string {
1724 return "Matcher_MatcherList_Predicate_PredicateListValidationError"
1725 }
1726
1727 // Error satisfies the builtin error interface
1728 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Error() string {
1729 cause := ""
1730 if e.cause != nil {
1731 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1732 }
1733
1734 key := ""
1735 if e.key {
1736 key = "key for "
1737 }
1738
1739 return fmt.Sprintf(
1740 "invalid %sMatcher_MatcherList_Predicate_PredicateList.%s: %s%s",
1741 key,
1742 e.field,
1743 e.reason,
1744 cause)
1745 }
1746
1747 var _ error = Matcher_MatcherList_Predicate_PredicateListValidationError{}
1748
1749 var _ interface {
1750 Field() string
1751 Reason() string
1752 Key() bool
1753 Cause() error
1754 ErrorName() string
1755 } = Matcher_MatcherList_Predicate_PredicateListValidationError{}
1756
1757 // Validate checks the field values on Matcher_MatcherTree_MatchMap with the
1758 // rules defined in the proto definition for this message. If any rules are
1759 // violated, the first error encountered is returned, or nil if there are no violations.
1760 func (m *Matcher_MatcherTree_MatchMap) Validate() error {
1761 return m.validate(false)
1762 }
1763
1764 // ValidateAll checks the field values on Matcher_MatcherTree_MatchMap with the
1765 // rules defined in the proto definition for this message. If any rules are
1766 // violated, the result is a list of violation errors wrapped in
1767 // Matcher_MatcherTree_MatchMapMultiError, or nil if none found.
1768 func (m *Matcher_MatcherTree_MatchMap) ValidateAll() error {
1769 return m.validate(true)
1770 }
1771
1772 func (m *Matcher_MatcherTree_MatchMap) validate(all bool) error {
1773 if m == nil {
1774 return nil
1775 }
1776
1777 var errors []error
1778
1779 if len(m.GetMap()) < 1 {
1780 err := Matcher_MatcherTree_MatchMapValidationError{
1781 field: "Map",
1782 reason: "value must contain at least 1 pair(s)",
1783 }
1784 if !all {
1785 return err
1786 }
1787 errors = append(errors, err)
1788 }
1789
1790 {
1791 sorted_keys := make([]string, len(m.GetMap()))
1792 i := 0
1793 for key := range m.GetMap() {
1794 sorted_keys[i] = key
1795 i++
1796 }
1797 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
1798 for _, key := range sorted_keys {
1799 val := m.GetMap()[key]
1800 _ = val
1801
1802 // no validation rules for Map[key]
1803
1804 if all {
1805 switch v := interface{}(val).(type) {
1806 case interface{ ValidateAll() error }:
1807 if err := v.ValidateAll(); err != nil {
1808 errors = append(errors, Matcher_MatcherTree_MatchMapValidationError{
1809 field: fmt.Sprintf("Map[%v]", key),
1810 reason: "embedded message failed validation",
1811 cause: err,
1812 })
1813 }
1814 case interface{ Validate() error }:
1815 if err := v.Validate(); err != nil {
1816 errors = append(errors, Matcher_MatcherTree_MatchMapValidationError{
1817 field: fmt.Sprintf("Map[%v]", key),
1818 reason: "embedded message failed validation",
1819 cause: err,
1820 })
1821 }
1822 }
1823 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
1824 if err := v.Validate(); err != nil {
1825 return Matcher_MatcherTree_MatchMapValidationError{
1826 field: fmt.Sprintf("Map[%v]", key),
1827 reason: "embedded message failed validation",
1828 cause: err,
1829 }
1830 }
1831 }
1832
1833 }
1834 }
1835
1836 if len(errors) > 0 {
1837 return Matcher_MatcherTree_MatchMapMultiError(errors)
1838 }
1839
1840 return nil
1841 }
1842
1843 // Matcher_MatcherTree_MatchMapMultiError is an error wrapping multiple
1844 // validation errors returned by Matcher_MatcherTree_MatchMap.ValidateAll() if
1845 // the designated constraints aren't met.
1846 type Matcher_MatcherTree_MatchMapMultiError []error
1847
1848 // Error returns a concatenation of all the error messages it wraps.
1849 func (m Matcher_MatcherTree_MatchMapMultiError) Error() string {
1850 msgs := make([]string, 0, len(m))
1851 for _, err := range m {
1852 msgs = append(msgs, err.Error())
1853 }
1854 return strings.Join(msgs, "; ")
1855 }
1856
1857 // AllErrors returns a list of validation violation errors.
1858 func (m Matcher_MatcherTree_MatchMapMultiError) AllErrors() []error { return m }
1859
1860 // Matcher_MatcherTree_MatchMapValidationError is the validation error returned
1861 // by Matcher_MatcherTree_MatchMap.Validate if the designated constraints
1862 // aren't met.
1863 type Matcher_MatcherTree_MatchMapValidationError struct {
1864 field string
1865 reason string
1866 cause error
1867 key bool
1868 }
1869
1870 // Field function returns field value.
1871 func (e Matcher_MatcherTree_MatchMapValidationError) Field() string { return e.field }
1872
1873 // Reason function returns reason value.
1874 func (e Matcher_MatcherTree_MatchMapValidationError) Reason() string { return e.reason }
1875
1876 // Cause function returns cause value.
1877 func (e Matcher_MatcherTree_MatchMapValidationError) Cause() error { return e.cause }
1878
1879 // Key function returns key value.
1880 func (e Matcher_MatcherTree_MatchMapValidationError) Key() bool { return e.key }
1881
1882 // ErrorName returns error name.
1883 func (e Matcher_MatcherTree_MatchMapValidationError) ErrorName() string {
1884 return "Matcher_MatcherTree_MatchMapValidationError"
1885 }
1886
1887 // Error satisfies the builtin error interface
1888 func (e Matcher_MatcherTree_MatchMapValidationError) Error() string {
1889 cause := ""
1890 if e.cause != nil {
1891 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1892 }
1893
1894 key := ""
1895 if e.key {
1896 key = "key for "
1897 }
1898
1899 return fmt.Sprintf(
1900 "invalid %sMatcher_MatcherTree_MatchMap.%s: %s%s",
1901 key,
1902 e.field,
1903 e.reason,
1904 cause)
1905 }
1906
1907 var _ error = Matcher_MatcherTree_MatchMapValidationError{}
1908
1909 var _ interface {
1910 Field() string
1911 Reason() string
1912 Key() bool
1913 Cause() error
1914 ErrorName() string
1915 } = Matcher_MatcherTree_MatchMapValidationError{}