Debian Codegraph @

envoy/config/common/matcher/v3/matcher.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/config/common/matcher/v3/matcher.proto
4
5 package matcherv3
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
23 // ensure the imports are used
24 var (
25 _ = bytes.MinRead
26 _ = errors.New("")
27 _ = fmt.Print
28 _ = utf8.UTFMax
29 _ = (*regexp.Regexp)(nil)
30 _ = (*strings.Reader)(nil)
31 _ = net.IPv4len
32 _ = time.Duration(0)
33 _ = (*url.URL)(nil)
34 _ = (*mail.Address)(nil)
35 _ = anypb.Any{}
36 _ = sort.Sort
37 )
38
39 // Validate checks the field values on Matcher with the rules defined in the
40 // proto definition for this message. If any rules are violated, the first
41 // error encountered is returned, or nil if there are no violations.
42 func (m *Matcher) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on Matcher with the rules defined in the
47 // proto definition for this message. If any rules are violated, the result is
48 // a list of violation errors wrapped in MatcherMultiError, or nil if none found.
49 func (m *Matcher) ValidateAll() error {
50 return m.validate(true)
51 }
52
53 func (m *Matcher) 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.GetOnNoMatch()).(type) {
62 case interface{ ValidateAll() error }:
63 if err := v.ValidateAll(); err != nil {
64 errors = append(errors, MatcherValidationError{
65 field: "OnNoMatch",
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, MatcherValidationError{
73 field: "OnNoMatch",
74 reason: "embedded message failed validation",
75 cause: err,
76 })
77 }
78 }
79 } else if v, ok := interface{}(m.GetOnNoMatch()).(interface{ Validate() error }); ok {
80 if err := v.Validate(); err != nil {
81 return MatcherValidationError{
82 field: "OnNoMatch",
83 reason: "embedded message failed validation",
84 cause: err,
85 }
86 }
87 }
88
89 oneofMatcherTypePresent := false
90 switch v := m.MatcherType.(type) {
91 case *Matcher_MatcherList_:
92 if v == nil {
93 err := MatcherValidationError{
94 field: "MatcherType",
95 reason: "oneof value cannot be a typed-nil",
96 }
97 if !all {
98 return err
99 }
100 errors = append(errors, err)
101 }
102 oneofMatcherTypePresent = true
103
104 if all {
105 switch v := interface{}(m.GetMatcherList()).(type) {
106 case interface{ ValidateAll() error }:
107 if err := v.ValidateAll(); err != nil {
108 errors = append(errors, MatcherValidationError{
109 field: "MatcherList",
110 reason: "embedded message failed validation",
111 cause: err,
112 })
113 }
114 case interface{ Validate() error }:
115 if err := v.Validate(); err != nil {
116 errors = append(errors, MatcherValidationError{
117 field: "MatcherList",
118 reason: "embedded message failed validation",
119 cause: err,
120 })
121 }
122 }
123 } else if v, ok := interface{}(m.GetMatcherList()).(interface{ Validate() error }); ok {
124 if err := v.Validate(); err != nil {
125 return MatcherValidationError{
126 field: "MatcherList",
127 reason: "embedded message failed validation",
128 cause: err,
129 }
130 }
131 }
132
133 case *Matcher_MatcherTree_:
134 if v == nil {
135 err := MatcherValidationError{
136 field: "MatcherType",
137 reason: "oneof value cannot be a typed-nil",
138 }
139 if !all {
140 return err
141 }
142 errors = append(errors, err)
143 }
144 oneofMatcherTypePresent = true
145
146 if all {
147 switch v := interface{}(m.GetMatcherTree()).(type) {
148 case interface{ ValidateAll() error }:
149 if err := v.ValidateAll(); err != nil {
150 errors = append(errors, MatcherValidationError{
151 field: "MatcherTree",
152 reason: "embedded message failed validation",
153 cause: err,
154 })
155 }
156 case interface{ Validate() error }:
157 if err := v.Validate(); err != nil {
158 errors = append(errors, MatcherValidationError{
159 field: "MatcherTree",
160 reason: "embedded message failed validation",
161 cause: err,
162 })
163 }
164 }
165 } else if v, ok := interface{}(m.GetMatcherTree()).(interface{ Validate() error }); ok {
166 if err := v.Validate(); err != nil {
167 return MatcherValidationError{
168 field: "MatcherTree",
169 reason: "embedded message failed validation",
170 cause: err,
171 }
172 }
173 }
174
175 default:
176 _ = v // ensures v is used
177 }
178 if !oneofMatcherTypePresent {
179 err := MatcherValidationError{
180 field: "MatcherType",
181 reason: "value is required",
182 }
183 if !all {
184 return err
185 }
186 errors = append(errors, err)
187 }
188
189 if len(errors) > 0 {
190 return MatcherMultiError(errors)
191 }
192
193 return nil
194 }
195
196 // MatcherMultiError is an error wrapping multiple validation errors returned
197 // by Matcher.ValidateAll() if the designated constraints aren't met.
198 type MatcherMultiError []error
199
200 // Error returns a concatenation of all the error messages it wraps.
201 func (m MatcherMultiError) Error() string {
202 var msgs []string
203 for _, err := range m {
204 msgs = append(msgs, err.Error())
205 }
206 return strings.Join(msgs, "; ")
207 }
208
209 // AllErrors returns a list of validation violation errors.
210 func (m MatcherMultiError) AllErrors() []error { return m }
211
212 // MatcherValidationError is the validation error returned by Matcher.Validate
213 // if the designated constraints aren't met.
214 type MatcherValidationError struct {
215 field string
216 reason string
217 cause error
218 key bool
219 }
220
221 // Field function returns field value.
222 func (e MatcherValidationError) Field() string { return e.field }
223
224 // Reason function returns reason value.
225 func (e MatcherValidationError) Reason() string { return e.reason }
226
227 // Cause function returns cause value.
228 func (e MatcherValidationError) Cause() error { return e.cause }
229
230 // Key function returns key value.
231 func (e MatcherValidationError) Key() bool { return e.key }
232
233 // ErrorName returns error name.
234 func (e MatcherValidationError) ErrorName() string { return "MatcherValidationError" }
235
236 // Error satisfies the builtin error interface
237 func (e MatcherValidationError) Error() string {
238 cause := ""
239 if e.cause != nil {
240 cause = fmt.Sprintf(" | caused by: %v", e.cause)
241 }
242
243 key := ""
244 if e.key {
245 key = "key for "
246 }
247
248 return fmt.Sprintf(
249 "invalid %sMatcher.%s: %s%s",
250 key,
251 e.field,
252 e.reason,
253 cause)
254 }
255
256 var _ error = MatcherValidationError{}
257
258 var _ interface {
259 Field() string
260 Reason() string
261 Key() bool
262 Cause() error
263 ErrorName() string
264 } = MatcherValidationError{}
265
266 // Validate checks the field values on MatchPredicate with the rules defined in
267 // the proto definition for this message. If any rules are violated, the first
268 // error encountered is returned, or nil if there are no violations.
269 func (m *MatchPredicate) Validate() error {
270 return m.validate(false)
271 }
272
273 // ValidateAll checks the field values on MatchPredicate with the rules defined
274 // in the proto definition for this message. If any rules are violated, the
275 // result is a list of violation errors wrapped in MatchPredicateMultiError,
276 // or nil if none found.
277 func (m *MatchPredicate) ValidateAll() error {
278 return m.validate(true)
279 }
280
281 func (m *MatchPredicate) validate(all bool) error {
282 if m == nil {
283 return nil
284 }
285
286 var errors []error
287
288 oneofRulePresent := false
289 switch v := m.Rule.(type) {
290 case *MatchPredicate_OrMatch:
291 if v == nil {
292 err := MatchPredicateValidationError{
293 field: "Rule",
294 reason: "oneof value cannot be a typed-nil",
295 }
296 if !all {
297 return err
298 }
299 errors = append(errors, err)
300 }
301 oneofRulePresent = true
302
303 if all {
304 switch v := interface{}(m.GetOrMatch()).(type) {
305 case interface{ ValidateAll() error }:
306 if err := v.ValidateAll(); err != nil {
307 errors = append(errors, MatchPredicateValidationError{
308 field: "OrMatch",
309 reason: "embedded message failed validation",
310 cause: err,
311 })
312 }
313 case interface{ Validate() error }:
314 if err := v.Validate(); err != nil {
315 errors = append(errors, MatchPredicateValidationError{
316 field: "OrMatch",
317 reason: "embedded message failed validation",
318 cause: err,
319 })
320 }
321 }
322 } else if v, ok := interface{}(m.GetOrMatch()).(interface{ Validate() error }); ok {
323 if err := v.Validate(); err != nil {
324 return MatchPredicateValidationError{
325 field: "OrMatch",
326 reason: "embedded message failed validation",
327 cause: err,
328 }
329 }
330 }
331
332 case *MatchPredicate_AndMatch:
333 if v == nil {
334 err := MatchPredicateValidationError{
335 field: "Rule",
336 reason: "oneof value cannot be a typed-nil",
337 }
338 if !all {
339 return err
340 }
341 errors = append(errors, err)
342 }
343 oneofRulePresent = true
344
345 if all {
346 switch v := interface{}(m.GetAndMatch()).(type) {
347 case interface{ ValidateAll() error }:
348 if err := v.ValidateAll(); err != nil {
349 errors = append(errors, MatchPredicateValidationError{
350 field: "AndMatch",
351 reason: "embedded message failed validation",
352 cause: err,
353 })
354 }
355 case interface{ Validate() error }:
356 if err := v.Validate(); err != nil {
357 errors = append(errors, MatchPredicateValidationError{
358 field: "AndMatch",
359 reason: "embedded message failed validation",
360 cause: err,
361 })
362 }
363 }
364 } else if v, ok := interface{}(m.GetAndMatch()).(interface{ Validate() error }); ok {
365 if err := v.Validate(); err != nil {
366 return MatchPredicateValidationError{
367 field: "AndMatch",
368 reason: "embedded message failed validation",
369 cause: err,
370 }
371 }
372 }
373
374 case *MatchPredicate_NotMatch:
375 if v == nil {
376 err := MatchPredicateValidationError{
377 field: "Rule",
378 reason: "oneof value cannot be a typed-nil",
379 }
380 if !all {
381 return err
382 }
383 errors = append(errors, err)
384 }
385 oneofRulePresent = true
386
387 if all {
388 switch v := interface{}(m.GetNotMatch()).(type) {
389 case interface{ ValidateAll() error }:
390 if err := v.ValidateAll(); err != nil {
391 errors = append(errors, MatchPredicateValidationError{
392 field: "NotMatch",
393 reason: "embedded message failed validation",
394 cause: err,
395 })
396 }
397 case interface{ Validate() error }:
398 if err := v.Validate(); err != nil {
399 errors = append(errors, MatchPredicateValidationError{
400 field: "NotMatch",
401 reason: "embedded message failed validation",
402 cause: err,
403 })
404 }
405 }
406 } else if v, ok := interface{}(m.GetNotMatch()).(interface{ Validate() error }); ok {
407 if err := v.Validate(); err != nil {
408 return MatchPredicateValidationError{
409 field: "NotMatch",
410 reason: "embedded message failed validation",
411 cause: err,
412 }
413 }
414 }
415
416 case *MatchPredicate_AnyMatch:
417 if v == nil {
418 err := MatchPredicateValidationError{
419 field: "Rule",
420 reason: "oneof value cannot be a typed-nil",
421 }
422 if !all {
423 return err
424 }
425 errors = append(errors, err)
426 }
427 oneofRulePresent = true
428
429 if m.GetAnyMatch() != true {
430 err := MatchPredicateValidationError{
431 field: "AnyMatch",
432 reason: "value must equal true",
433 }
434 if !all {
435 return err
436 }
437 errors = append(errors, err)
438 }
439
440 case *MatchPredicate_HttpRequestHeadersMatch:
441 if v == nil {
442 err := MatchPredicateValidationError{
443 field: "Rule",
444 reason: "oneof value cannot be a typed-nil",
445 }
446 if !all {
447 return err
448 }
449 errors = append(errors, err)
450 }
451 oneofRulePresent = true
452
453 if all {
454 switch v := interface{}(m.GetHttpRequestHeadersMatch()).(type) {
455 case interface{ ValidateAll() error }:
456 if err := v.ValidateAll(); err != nil {
457 errors = append(errors, MatchPredicateValidationError{
458 field: "HttpRequestHeadersMatch",
459 reason: "embedded message failed validation",
460 cause: err,
461 })
462 }
463 case interface{ Validate() error }:
464 if err := v.Validate(); err != nil {
465 errors = append(errors, MatchPredicateValidationError{
466 field: "HttpRequestHeadersMatch",
467 reason: "embedded message failed validation",
468 cause: err,
469 })
470 }
471 }
472 } else if v, ok := interface{}(m.GetHttpRequestHeadersMatch()).(interface{ Validate() error }); ok {
473 if err := v.Validate(); err != nil {
474 return MatchPredicateValidationError{
475 field: "HttpRequestHeadersMatch",
476 reason: "embedded message failed validation",
477 cause: err,
478 }
479 }
480 }
481
482 case *MatchPredicate_HttpRequestTrailersMatch:
483 if v == nil {
484 err := MatchPredicateValidationError{
485 field: "Rule",
486 reason: "oneof value cannot be a typed-nil",
487 }
488 if !all {
489 return err
490 }
491 errors = append(errors, err)
492 }
493 oneofRulePresent = true
494
495 if all {
496 switch v := interface{}(m.GetHttpRequestTrailersMatch()).(type) {
497 case interface{ ValidateAll() error }:
498 if err := v.ValidateAll(); err != nil {
499 errors = append(errors, MatchPredicateValidationError{
500 field: "HttpRequestTrailersMatch",
501 reason: "embedded message failed validation",
502 cause: err,
503 })
504 }
505 case interface{ Validate() error }:
506 if err := v.Validate(); err != nil {
507 errors = append(errors, MatchPredicateValidationError{
508 field: "HttpRequestTrailersMatch",
509 reason: "embedded message failed validation",
510 cause: err,
511 })
512 }
513 }
514 } else if v, ok := interface{}(m.GetHttpRequestTrailersMatch()).(interface{ Validate() error }); ok {
515 if err := v.Validate(); err != nil {
516 return MatchPredicateValidationError{
517 field: "HttpRequestTrailersMatch",
518 reason: "embedded message failed validation",
519 cause: err,
520 }
521 }
522 }
523
524 case *MatchPredicate_HttpResponseHeadersMatch:
525 if v == nil {
526 err := MatchPredicateValidationError{
527 field: "Rule",
528 reason: "oneof value cannot be a typed-nil",
529 }
530 if !all {
531 return err
532 }
533 errors = append(errors, err)
534 }
535 oneofRulePresent = true
536
537 if all {
538 switch v := interface{}(m.GetHttpResponseHeadersMatch()).(type) {
539 case interface{ ValidateAll() error }:
540 if err := v.ValidateAll(); err != nil {
541 errors = append(errors, MatchPredicateValidationError{
542 field: "HttpResponseHeadersMatch",
543 reason: "embedded message failed validation",
544 cause: err,
545 })
546 }
547 case interface{ Validate() error }:
548 if err := v.Validate(); err != nil {
549 errors = append(errors, MatchPredicateValidationError{
550 field: "HttpResponseHeadersMatch",
551 reason: "embedded message failed validation",
552 cause: err,
553 })
554 }
555 }
556 } else if v, ok := interface{}(m.GetHttpResponseHeadersMatch()).(interface{ Validate() error }); ok {
557 if err := v.Validate(); err != nil {
558 return MatchPredicateValidationError{
559 field: "HttpResponseHeadersMatch",
560 reason: "embedded message failed validation",
561 cause: err,
562 }
563 }
564 }
565
566 case *MatchPredicate_HttpResponseTrailersMatch:
567 if v == nil {
568 err := MatchPredicateValidationError{
569 field: "Rule",
570 reason: "oneof value cannot be a typed-nil",
571 }
572 if !all {
573 return err
574 }
575 errors = append(errors, err)
576 }
577 oneofRulePresent = true
578
579 if all {
580 switch v := interface{}(m.GetHttpResponseTrailersMatch()).(type) {
581 case interface{ ValidateAll() error }:
582 if err := v.ValidateAll(); err != nil {
583 errors = append(errors, MatchPredicateValidationError{
584 field: "HttpResponseTrailersMatch",
585 reason: "embedded message failed validation",
586 cause: err,
587 })
588 }
589 case interface{ Validate() error }:
590 if err := v.Validate(); err != nil {
591 errors = append(errors, MatchPredicateValidationError{
592 field: "HttpResponseTrailersMatch",
593 reason: "embedded message failed validation",
594 cause: err,
595 })
596 }
597 }
598 } else if v, ok := interface{}(m.GetHttpResponseTrailersMatch()).(interface{ Validate() error }); ok {
599 if err := v.Validate(); err != nil {
600 return MatchPredicateValidationError{
601 field: "HttpResponseTrailersMatch",
602 reason: "embedded message failed validation",
603 cause: err,
604 }
605 }
606 }
607
608 case *MatchPredicate_HttpRequestGenericBodyMatch:
609 if v == nil {
610 err := MatchPredicateValidationError{
611 field: "Rule",
612 reason: "oneof value cannot be a typed-nil",
613 }
614 if !all {
615 return err
616 }
617 errors = append(errors, err)
618 }
619 oneofRulePresent = true
620
621 if all {
622 switch v := interface{}(m.GetHttpRequestGenericBodyMatch()).(type) {
623 case interface{ ValidateAll() error }:
624 if err := v.ValidateAll(); err != nil {
625 errors = append(errors, MatchPredicateValidationError{
626 field: "HttpRequestGenericBodyMatch",
627 reason: "embedded message failed validation",
628 cause: err,
629 })
630 }
631 case interface{ Validate() error }:
632 if err := v.Validate(); err != nil {
633 errors = append(errors, MatchPredicateValidationError{
634 field: "HttpRequestGenericBodyMatch",
635 reason: "embedded message failed validation",
636 cause: err,
637 })
638 }
639 }
640 } else if v, ok := interface{}(m.GetHttpRequestGenericBodyMatch()).(interface{ Validate() error }); ok {
641 if err := v.Validate(); err != nil {
642 return MatchPredicateValidationError{
643 field: "HttpRequestGenericBodyMatch",
644 reason: "embedded message failed validation",
645 cause: err,
646 }
647 }
648 }
649
650 case *MatchPredicate_HttpResponseGenericBodyMatch:
651 if v == nil {
652 err := MatchPredicateValidationError{
653 field: "Rule",
654 reason: "oneof value cannot be a typed-nil",
655 }
656 if !all {
657 return err
658 }
659 errors = append(errors, err)
660 }
661 oneofRulePresent = true
662
663 if all {
664 switch v := interface{}(m.GetHttpResponseGenericBodyMatch()).(type) {
665 case interface{ ValidateAll() error }:
666 if err := v.ValidateAll(); err != nil {
667 errors = append(errors, MatchPredicateValidationError{
668 field: "HttpResponseGenericBodyMatch",
669 reason: "embedded message failed validation",
670 cause: err,
671 })
672 }
673 case interface{ Validate() error }:
674 if err := v.Validate(); err != nil {
675 errors = append(errors, MatchPredicateValidationError{
676 field: "HttpResponseGenericBodyMatch",
677 reason: "embedded message failed validation",
678 cause: err,
679 })
680 }
681 }
682 } else if v, ok := interface{}(m.GetHttpResponseGenericBodyMatch()).(interface{ Validate() error }); ok {
683 if err := v.Validate(); err != nil {
684 return MatchPredicateValidationError{
685 field: "HttpResponseGenericBodyMatch",
686 reason: "embedded message failed validation",
687 cause: err,
688 }
689 }
690 }
691
692 default:
693 _ = v // ensures v is used
694 }
695 if !oneofRulePresent {
696 err := MatchPredicateValidationError{
697 field: "Rule",
698 reason: "value is required",
699 }
700 if !all {
701 return err
702 }
703 errors = append(errors, err)
704 }
705
706 if len(errors) > 0 {
707 return MatchPredicateMultiError(errors)
708 }
709
710 return nil
711 }
712
713 // MatchPredicateMultiError is an error wrapping multiple validation errors
714 // returned by MatchPredicate.ValidateAll() if the designated constraints
715 // aren't met.
716 type MatchPredicateMultiError []error
717
718 // Error returns a concatenation of all the error messages it wraps.
719 func (m MatchPredicateMultiError) Error() string {
720 var msgs []string
721 for _, err := range m {
722 msgs = append(msgs, err.Error())
723 }
724 return strings.Join(msgs, "; ")
725 }
726
727 // AllErrors returns a list of validation violation errors.
728 func (m MatchPredicateMultiError) AllErrors() []error { return m }
729
730 // MatchPredicateValidationError is the validation error returned by
731 // MatchPredicate.Validate if the designated constraints aren't met.
732 type MatchPredicateValidationError struct {
733 field string
734 reason string
735 cause error
736 key bool
737 }
738
739 // Field function returns field value.
740 func (e MatchPredicateValidationError) Field() string { return e.field }
741
742 // Reason function returns reason value.
743 func (e MatchPredicateValidationError) Reason() string { return e.reason }
744
745 // Cause function returns cause value.
746 func (e MatchPredicateValidationError) Cause() error { return e.cause }
747
748 // Key function returns key value.
749 func (e MatchPredicateValidationError) Key() bool { return e.key }
750
751 // ErrorName returns error name.
752 func (e MatchPredicateValidationError) ErrorName() string { return "MatchPredicateValidationError" }
753
754 // Error satisfies the builtin error interface
755 func (e MatchPredicateValidationError) Error() string {
756 cause := ""
757 if e.cause != nil {
758 cause = fmt.Sprintf(" | caused by: %v", e.cause)
759 }
760
761 key := ""
762 if e.key {
763 key = "key for "
764 }
765
766 return fmt.Sprintf(
767 "invalid %sMatchPredicate.%s: %s%s",
768 key,
769 e.field,
770 e.reason,
771 cause)
772 }
773
774 var _ error = MatchPredicateValidationError{}
775
776 var _ interface {
777 Field() string
778 Reason() string
779 Key() bool
780 Cause() error
781 ErrorName() string
782 } = MatchPredicateValidationError{}
783
784 // Validate checks the field values on HttpHeadersMatch with the rules defined
785 // in the proto definition for this message. If any rules are violated, the
786 // first error encountered is returned, or nil if there are no violations.
787 func (m *HttpHeadersMatch) Validate() error {
788 return m.validate(false)
789 }
790
791 // ValidateAll checks the field values on HttpHeadersMatch with the rules
792 // defined in the proto definition for this message. If any rules are
793 // violated, the result is a list of violation errors wrapped in
794 // HttpHeadersMatchMultiError, or nil if none found.
795 func (m *HttpHeadersMatch) ValidateAll() error {
796 return m.validate(true)
797 }
798
799 func (m *HttpHeadersMatch) validate(all bool) error {
800 if m == nil {
801 return nil
802 }
803
804 var errors []error
805
806 for idx, item := range m.GetHeaders() {
807 _, _ = idx, item
808
809 if all {
810 switch v := interface{}(item).(type) {
811 case interface{ ValidateAll() error }:
812 if err := v.ValidateAll(); err != nil {
813 errors = append(errors, HttpHeadersMatchValidationError{
814 field: fmt.Sprintf("Headers[%v]", idx),
815 reason: "embedded message failed validation",
816 cause: err,
817 })
818 }
819 case interface{ Validate() error }:
820 if err := v.Validate(); err != nil {
821 errors = append(errors, HttpHeadersMatchValidationError{
822 field: fmt.Sprintf("Headers[%v]", idx),
823 reason: "embedded message failed validation",
824 cause: err,
825 })
826 }
827 }
828 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
829 if err := v.Validate(); err != nil {
830 return HttpHeadersMatchValidationError{
831 field: fmt.Sprintf("Headers[%v]", idx),
832 reason: "embedded message failed validation",
833 cause: err,
834 }
835 }
836 }
837
838 }
839
840 if len(errors) > 0 {
841 return HttpHeadersMatchMultiError(errors)
842 }
843
844 return nil
845 }
846
847 // HttpHeadersMatchMultiError is an error wrapping multiple validation errors
848 // returned by HttpHeadersMatch.ValidateAll() if the designated constraints
849 // aren't met.
850 type HttpHeadersMatchMultiError []error
851
852 // Error returns a concatenation of all the error messages it wraps.
853 func (m HttpHeadersMatchMultiError) Error() string {
854 var msgs []string
855 for _, err := range m {
856 msgs = append(msgs, err.Error())
857 }
858 return strings.Join(msgs, "; ")
859 }
860
861 // AllErrors returns a list of validation violation errors.
862 func (m HttpHeadersMatchMultiError) AllErrors() []error { return m }
863
864 // HttpHeadersMatchValidationError is the validation error returned by
865 // HttpHeadersMatch.Validate if the designated constraints aren't met.
866 type HttpHeadersMatchValidationError struct {
867 field string
868 reason string
869 cause error
870 key bool
871 }
872
873 // Field function returns field value.
874 func (e HttpHeadersMatchValidationError) Field() string { return e.field }
875
876 // Reason function returns reason value.
877 func (e HttpHeadersMatchValidationError) Reason() string { return e.reason }
878
879 // Cause function returns cause value.
880 func (e HttpHeadersMatchValidationError) Cause() error { return e.cause }
881
882 // Key function returns key value.
883 func (e HttpHeadersMatchValidationError) Key() bool { return e.key }
884
885 // ErrorName returns error name.
886 func (e HttpHeadersMatchValidationError) ErrorName() string { return "HttpHeadersMatchValidationError" }
887
888 // Error satisfies the builtin error interface
889 func (e HttpHeadersMatchValidationError) Error() string {
890 cause := ""
891 if e.cause != nil {
892 cause = fmt.Sprintf(" | caused by: %v", e.cause)
893 }
894
895 key := ""
896 if e.key {
897 key = "key for "
898 }
899
900 return fmt.Sprintf(
901 "invalid %sHttpHeadersMatch.%s: %s%s",
902 key,
903 e.field,
904 e.reason,
905 cause)
906 }
907
908 var _ error = HttpHeadersMatchValidationError{}
909
910 var _ interface {
911 Field() string
912 Reason() string
913 Key() bool
914 Cause() error
915 ErrorName() string
916 } = HttpHeadersMatchValidationError{}
917
918 // Validate checks the field values on HttpGenericBodyMatch with the rules
919 // defined in the proto definition for this message. If any rules are
920 // violated, the first error encountered is returned, or nil if there are no violations.
921 func (m *HttpGenericBodyMatch) Validate() error {
922 return m.validate(false)
923 }
924
925 // ValidateAll checks the field values on HttpGenericBodyMatch with the rules
926 // defined in the proto definition for this message. If any rules are
927 // violated, the result is a list of violation errors wrapped in
928 // HttpGenericBodyMatchMultiError, or nil if none found.
929 func (m *HttpGenericBodyMatch) ValidateAll() error {
930 return m.validate(true)
931 }
932
933 func (m *HttpGenericBodyMatch) validate(all bool) error {
934 if m == nil {
935 return nil
936 }
937
938 var errors []error
939
940 // no validation rules for BytesLimit
941
942 if len(m.GetPatterns()) < 1 {
943 err := HttpGenericBodyMatchValidationError{
944 field: "Patterns",
945 reason: "value must contain at least 1 item(s)",
946 }
947 if !all {
948 return err
949 }
950 errors = append(errors, err)
951 }
952
953 for idx, item := range m.GetPatterns() {
954 _, _ = idx, item
955
956 if all {
957 switch v := interface{}(item).(type) {
958 case interface{ ValidateAll() error }:
959 if err := v.ValidateAll(); err != nil {
960 errors = append(errors, HttpGenericBodyMatchValidationError{
961 field: fmt.Sprintf("Patterns[%v]", idx),
962 reason: "embedded message failed validation",
963 cause: err,
964 })
965 }
966 case interface{ Validate() error }:
967 if err := v.Validate(); err != nil {
968 errors = append(errors, HttpGenericBodyMatchValidationError{
969 field: fmt.Sprintf("Patterns[%v]", idx),
970 reason: "embedded message failed validation",
971 cause: err,
972 })
973 }
974 }
975 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
976 if err := v.Validate(); err != nil {
977 return HttpGenericBodyMatchValidationError{
978 field: fmt.Sprintf("Patterns[%v]", idx),
979 reason: "embedded message failed validation",
980 cause: err,
981 }
982 }
983 }
984
985 }
986
987 if len(errors) > 0 {
988 return HttpGenericBodyMatchMultiError(errors)
989 }
990
991 return nil
992 }
993
994 // HttpGenericBodyMatchMultiError is an error wrapping multiple validation
995 // errors returned by HttpGenericBodyMatch.ValidateAll() if the designated
996 // constraints aren't met.
997 type HttpGenericBodyMatchMultiError []error
998
999 // Error returns a concatenation of all the error messages it wraps.
1000 func (m HttpGenericBodyMatchMultiError) Error() string {
1001 var msgs []string
1002 for _, err := range m {
1003 msgs = append(msgs, err.Error())
1004 }
1005 return strings.Join(msgs, "; ")
1006 }
1007
1008 // AllErrors returns a list of validation violation errors.
1009 func (m HttpGenericBodyMatchMultiError) AllErrors() []error { return m }
1010
1011 // HttpGenericBodyMatchValidationError is the validation error returned by
1012 // HttpGenericBodyMatch.Validate if the designated constraints aren't met.
1013 type HttpGenericBodyMatchValidationError struct {
1014 field string
1015 reason string
1016 cause error
1017 key bool
1018 }
1019
1020 // Field function returns field value.
1021 func (e HttpGenericBodyMatchValidationError) Field() string { return e.field }
1022
1023 // Reason function returns reason value.
1024 func (e HttpGenericBodyMatchValidationError) Reason() string { return e.reason }
1025
1026 // Cause function returns cause value.
1027 func (e HttpGenericBodyMatchValidationError) Cause() error { return e.cause }
1028
1029 // Key function returns key value.
1030 func (e HttpGenericBodyMatchValidationError) Key() bool { return e.key }
1031
1032 // ErrorName returns error name.
1033 func (e HttpGenericBodyMatchValidationError) ErrorName() string {
1034 return "HttpGenericBodyMatchValidationError"
1035 }
1036
1037 // Error satisfies the builtin error interface
1038 func (e HttpGenericBodyMatchValidationError) Error() string {
1039 cause := ""
1040 if e.cause != nil {
1041 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1042 }
1043
1044 key := ""
1045 if e.key {
1046 key = "key for "
1047 }
1048
1049 return fmt.Sprintf(
1050 "invalid %sHttpGenericBodyMatch.%s: %s%s",
1051 key,
1052 e.field,
1053 e.reason,
1054 cause)
1055 }
1056
1057 var _ error = HttpGenericBodyMatchValidationError{}
1058
1059 var _ interface {
1060 Field() string
1061 Reason() string
1062 Key() bool
1063 Cause() error
1064 ErrorName() string
1065 } = HttpGenericBodyMatchValidationError{}
1066
1067 // Validate checks the field values on Matcher_OnMatch with the rules defined
1068 // in the proto definition for this message. If any rules are violated, the
1069 // first error encountered is returned, or nil if there are no violations.
1070 func (m *Matcher_OnMatch) Validate() error {
1071 return m.validate(false)
1072 }
1073
1074 // ValidateAll checks the field values on Matcher_OnMatch with the rules
1075 // defined in the proto definition for this message. If any rules are
1076 // violated, the result is a list of violation errors wrapped in
1077 // Matcher_OnMatchMultiError, or nil if none found.
1078 func (m *Matcher_OnMatch) ValidateAll() error {
1079 return m.validate(true)
1080 }
1081
1082 func (m *Matcher_OnMatch) validate(all bool) error {
1083 if m == nil {
1084 return nil
1085 }
1086
1087 var errors []error
1088
1089 oneofOnMatchPresent := false
1090 switch v := m.OnMatch.(type) {
1091 case *Matcher_OnMatch_Matcher:
1092 if v == nil {
1093 err := Matcher_OnMatchValidationError{
1094 field: "OnMatch",
1095 reason: "oneof value cannot be a typed-nil",
1096 }
1097 if !all {
1098 return err
1099 }
1100 errors = append(errors, err)
1101 }
1102 oneofOnMatchPresent = true
1103
1104 if all {
1105 switch v := interface{}(m.GetMatcher()).(type) {
1106 case interface{ ValidateAll() error }:
1107 if err := v.ValidateAll(); err != nil {
1108 errors = append(errors, Matcher_OnMatchValidationError{
1109 field: "Matcher",
1110 reason: "embedded message failed validation",
1111 cause: err,
1112 })
1113 }
1114 case interface{ Validate() error }:
1115 if err := v.Validate(); err != nil {
1116 errors = append(errors, Matcher_OnMatchValidationError{
1117 field: "Matcher",
1118 reason: "embedded message failed validation",
1119 cause: err,
1120 })
1121 }
1122 }
1123 } else if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok {
1124 if err := v.Validate(); err != nil {
1125 return Matcher_OnMatchValidationError{
1126 field: "Matcher",
1127 reason: "embedded message failed validation",
1128 cause: err,
1129 }
1130 }
1131 }
1132
1133 case *Matcher_OnMatch_Action:
1134 if v == nil {
1135 err := Matcher_OnMatchValidationError{
1136 field: "OnMatch",
1137 reason: "oneof value cannot be a typed-nil",
1138 }
1139 if !all {
1140 return err
1141 }
1142 errors = append(errors, err)
1143 }
1144 oneofOnMatchPresent = true
1145
1146 if all {
1147 switch v := interface{}(m.GetAction()).(type) {
1148 case interface{ ValidateAll() error }:
1149 if err := v.ValidateAll(); err != nil {
1150 errors = append(errors, Matcher_OnMatchValidationError{
1151 field: "Action",
1152 reason: "embedded message failed validation",
1153 cause: err,
1154 })
1155 }
1156 case interface{ Validate() error }:
1157 if err := v.Validate(); err != nil {
1158 errors = append(errors, Matcher_OnMatchValidationError{
1159 field: "Action",
1160 reason: "embedded message failed validation",
1161 cause: err,
1162 })
1163 }
1164 }
1165 } else if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok {
1166 if err := v.Validate(); err != nil {
1167 return Matcher_OnMatchValidationError{
1168 field: "Action",
1169 reason: "embedded message failed validation",
1170 cause: err,
1171 }
1172 }
1173 }
1174
1175 default:
1176 _ = v // ensures v is used
1177 }
1178 if !oneofOnMatchPresent {
1179 err := Matcher_OnMatchValidationError{
1180 field: "OnMatch",
1181 reason: "value is required",
1182 }
1183 if !all {
1184 return err
1185 }
1186 errors = append(errors, err)
1187 }
1188
1189 if len(errors) > 0 {
1190 return Matcher_OnMatchMultiError(errors)
1191 }
1192
1193 return nil
1194 }
1195
1196 // Matcher_OnMatchMultiError is an error wrapping multiple validation errors
1197 // returned by Matcher_OnMatch.ValidateAll() if the designated constraints
1198 // aren't met.
1199 type Matcher_OnMatchMultiError []error
1200
1201 // Error returns a concatenation of all the error messages it wraps.
1202 func (m Matcher_OnMatchMultiError) Error() string {
1203 var msgs []string
1204 for _, err := range m {
1205 msgs = append(msgs, err.Error())
1206 }
1207 return strings.Join(msgs, "; ")
1208 }
1209
1210 // AllErrors returns a list of validation violation errors.
1211 func (m Matcher_OnMatchMultiError) AllErrors() []error { return m }
1212
1213 // Matcher_OnMatchValidationError is the validation error returned by
1214 // Matcher_OnMatch.Validate if the designated constraints aren't met.
1215 type Matcher_OnMatchValidationError struct {
1216 field string
1217 reason string
1218 cause error
1219 key bool
1220 }
1221
1222 // Field function returns field value.
1223 func (e Matcher_OnMatchValidationError) Field() string { return e.field }
1224
1225 // Reason function returns reason value.
1226 func (e Matcher_OnMatchValidationError) Reason() string { return e.reason }
1227
1228 // Cause function returns cause value.
1229 func (e Matcher_OnMatchValidationError) Cause() error { return e.cause }
1230
1231 // Key function returns key value.
1232 func (e Matcher_OnMatchValidationError) Key() bool { return e.key }
1233
1234 // ErrorName returns error name.
1235 func (e Matcher_OnMatchValidationError) ErrorName() string { return "Matcher_OnMatchValidationError" }
1236
1237 // Error satisfies the builtin error interface
1238 func (e Matcher_OnMatchValidationError) Error() string {
1239 cause := ""
1240 if e.cause != nil {
1241 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1242 }
1243
1244 key := ""
1245 if e.key {
1246 key = "key for "
1247 }
1248
1249 return fmt.Sprintf(
1250 "invalid %sMatcher_OnMatch.%s: %s%s",
1251 key,
1252 e.field,
1253 e.reason,
1254 cause)
1255 }
1256
1257 var _ error = Matcher_OnMatchValidationError{}
1258
1259 var _ interface {
1260 Field() string
1261 Reason() string
1262 Key() bool
1263 Cause() error
1264 ErrorName() string
1265 } = Matcher_OnMatchValidationError{}
1266
1267 // Validate checks the field values on Matcher_MatcherList with the rules
1268 // defined in the proto definition for this message. If any rules are
1269 // violated, the first error encountered is returned, or nil if there are no violations.
1270 func (m *Matcher_MatcherList) Validate() error {
1271 return m.validate(false)
1272 }
1273
1274 // ValidateAll checks the field values on Matcher_MatcherList with the rules
1275 // defined in the proto definition for this message. If any rules are
1276 // violated, the result is a list of violation errors wrapped in
1277 // Matcher_MatcherListMultiError, or nil if none found.
1278 func (m *Matcher_MatcherList) ValidateAll() error {
1279 return m.validate(true)
1280 }
1281
1282 func (m *Matcher_MatcherList) validate(all bool) error {
1283 if m == nil {
1284 return nil
1285 }
1286
1287 var errors []error
1288
1289 if len(m.GetMatchers()) < 1 {
1290 err := Matcher_MatcherListValidationError{
1291 field: "Matchers",
1292 reason: "value must contain at least 1 item(s)",
1293 }
1294 if !all {
1295 return err
1296 }
1297 errors = append(errors, err)
1298 }
1299
1300 for idx, item := range m.GetMatchers() {
1301 _, _ = idx, item
1302
1303 if all {
1304 switch v := interface{}(item).(type) {
1305 case interface{ ValidateAll() error }:
1306 if err := v.ValidateAll(); err != nil {
1307 errors = append(errors, Matcher_MatcherListValidationError{
1308 field: fmt.Sprintf("Matchers[%v]", idx),
1309 reason: "embedded message failed validation",
1310 cause: err,
1311 })
1312 }
1313 case interface{ Validate() error }:
1314 if err := v.Validate(); err != nil {
1315 errors = append(errors, Matcher_MatcherListValidationError{
1316 field: fmt.Sprintf("Matchers[%v]", idx),
1317 reason: "embedded message failed validation",
1318 cause: err,
1319 })
1320 }
1321 }
1322 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1323 if err := v.Validate(); err != nil {
1324 return Matcher_MatcherListValidationError{
1325 field: fmt.Sprintf("Matchers[%v]", idx),
1326 reason: "embedded message failed validation",
1327 cause: err,
1328 }
1329 }
1330 }
1331
1332 }
1333
1334 if len(errors) > 0 {
1335 return Matcher_MatcherListMultiError(errors)
1336 }
1337
1338 return nil
1339 }
1340
1341 // Matcher_MatcherListMultiError is an error wrapping multiple validation
1342 // errors returned by Matcher_MatcherList.ValidateAll() if the designated
1343 // constraints aren't met.
1344 type Matcher_MatcherListMultiError []error
1345
1346 // Error returns a concatenation of all the error messages it wraps.
1347 func (m Matcher_MatcherListMultiError) Error() string {
1348 var msgs []string
1349 for _, err := range m {
1350 msgs = append(msgs, err.Error())
1351 }
1352 return strings.Join(msgs, "; ")
1353 }
1354
1355 // AllErrors returns a list of validation violation errors.
1356 func (m Matcher_MatcherListMultiError) AllErrors() []error { return m }
1357
1358 // Matcher_MatcherListValidationError is the validation error returned by
1359 // Matcher_MatcherList.Validate if the designated constraints aren't met.
1360 type Matcher_MatcherListValidationError struct {
1361 field string
1362 reason string
1363 cause error
1364 key bool
1365 }
1366
1367 // Field function returns field value.
1368 func (e Matcher_MatcherListValidationError) Field() string { return e.field }
1369
1370 // Reason function returns reason value.
1371 func (e Matcher_MatcherListValidationError) Reason() string { return e.reason }
1372
1373 // Cause function returns cause value.
1374 func (e Matcher_MatcherListValidationError) Cause() error { return e.cause }
1375
1376 // Key function returns key value.
1377 func (e Matcher_MatcherListValidationError) Key() bool { return e.key }
1378
1379 // ErrorName returns error name.
1380 func (e Matcher_MatcherListValidationError) ErrorName() string {
1381 return "Matcher_MatcherListValidationError"
1382 }
1383
1384 // Error satisfies the builtin error interface
1385 func (e Matcher_MatcherListValidationError) Error() string {
1386 cause := ""
1387 if e.cause != nil {
1388 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1389 }
1390
1391 key := ""
1392 if e.key {
1393 key = "key for "
1394 }
1395
1396 return fmt.Sprintf(
1397 "invalid %sMatcher_MatcherList.%s: %s%s",
1398 key,
1399 e.field,
1400 e.reason,
1401 cause)
1402 }
1403
1404 var _ error = Matcher_MatcherListValidationError{}
1405
1406 var _ interface {
1407 Field() string
1408 Reason() string
1409 Key() bool
1410 Cause() error
1411 ErrorName() string
1412 } = Matcher_MatcherListValidationError{}
1413
1414 // Validate checks the field values on Matcher_MatcherTree with the rules
1415 // defined in the proto definition for this message. If any rules are
1416 // violated, the first error encountered is returned, or nil if there are no violations.
1417 func (m *Matcher_MatcherTree) Validate() error {
1418 return m.validate(false)
1419 }
1420
1421 // ValidateAll checks the field values on Matcher_MatcherTree with the rules
1422 // defined in the proto definition for this message. If any rules are
1423 // violated, the result is a list of violation errors wrapped in
1424 // Matcher_MatcherTreeMultiError, or nil if none found.
1425 func (m *Matcher_MatcherTree) ValidateAll() error {
1426 return m.validate(true)
1427 }
1428
1429 func (m *Matcher_MatcherTree) validate(all bool) error {
1430 if m == nil {
1431 return nil
1432 }
1433
1434 var errors []error
1435
1436 if m.GetInput() == nil {
1437 err := Matcher_MatcherTreeValidationError{
1438 field: "Input",
1439 reason: "value is required",
1440 }
1441 if !all {
1442 return err
1443 }
1444 errors = append(errors, err)
1445 }
1446
1447 if all {
1448 switch v := interface{}(m.GetInput()).(type) {
1449 case interface{ ValidateAll() error }:
1450 if err := v.ValidateAll(); err != nil {
1451 errors = append(errors, Matcher_MatcherTreeValidationError{
1452 field: "Input",
1453 reason: "embedded message failed validation",
1454 cause: err,
1455 })
1456 }
1457 case interface{ Validate() error }:
1458 if err := v.Validate(); err != nil {
1459 errors = append(errors, Matcher_MatcherTreeValidationError{
1460 field: "Input",
1461 reason: "embedded message failed validation",
1462 cause: err,
1463 })
1464 }
1465 }
1466 } else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
1467 if err := v.Validate(); err != nil {
1468 return Matcher_MatcherTreeValidationError{
1469 field: "Input",
1470 reason: "embedded message failed validation",
1471 cause: err,
1472 }
1473 }
1474 }
1475
1476 oneofTreeTypePresent := false
1477 switch v := m.TreeType.(type) {
1478 case *Matcher_MatcherTree_ExactMatchMap:
1479 if v == nil {
1480 err := Matcher_MatcherTreeValidationError{
1481 field: "TreeType",
1482 reason: "oneof value cannot be a typed-nil",
1483 }
1484 if !all {
1485 return err
1486 }
1487 errors = append(errors, err)
1488 }
1489 oneofTreeTypePresent = true
1490
1491 if all {
1492 switch v := interface{}(m.GetExactMatchMap()).(type) {
1493 case interface{ ValidateAll() error }:
1494 if err := v.ValidateAll(); err != nil {
1495 errors = append(errors, Matcher_MatcherTreeValidationError{
1496 field: "ExactMatchMap",
1497 reason: "embedded message failed validation",
1498 cause: err,
1499 })
1500 }
1501 case interface{ Validate() error }:
1502 if err := v.Validate(); err != nil {
1503 errors = append(errors, Matcher_MatcherTreeValidationError{
1504 field: "ExactMatchMap",
1505 reason: "embedded message failed validation",
1506 cause: err,
1507 })
1508 }
1509 }
1510 } else if v, ok := interface{}(m.GetExactMatchMap()).(interface{ Validate() error }); ok {
1511 if err := v.Validate(); err != nil {
1512 return Matcher_MatcherTreeValidationError{
1513 field: "ExactMatchMap",
1514 reason: "embedded message failed validation",
1515 cause: err,
1516 }
1517 }
1518 }
1519
1520 case *Matcher_MatcherTree_PrefixMatchMap:
1521 if v == nil {
1522 err := Matcher_MatcherTreeValidationError{
1523 field: "TreeType",
1524 reason: "oneof value cannot be a typed-nil",
1525 }
1526 if !all {
1527 return err
1528 }
1529 errors = append(errors, err)
1530 }
1531 oneofTreeTypePresent = true
1532
1533 if all {
1534 switch v := interface{}(m.GetPrefixMatchMap()).(type) {
1535 case interface{ ValidateAll() error }:
1536 if err := v.ValidateAll(); err != nil {
1537 errors = append(errors, Matcher_MatcherTreeValidationError{
1538 field: "PrefixMatchMap",
1539 reason: "embedded message failed validation",
1540 cause: err,
1541 })
1542 }
1543 case interface{ Validate() error }:
1544 if err := v.Validate(); err != nil {
1545 errors = append(errors, Matcher_MatcherTreeValidationError{
1546 field: "PrefixMatchMap",
1547 reason: "embedded message failed validation",
1548 cause: err,
1549 })
1550 }
1551 }
1552 } else if v, ok := interface{}(m.GetPrefixMatchMap()).(interface{ Validate() error }); ok {
1553 if err := v.Validate(); err != nil {
1554 return Matcher_MatcherTreeValidationError{
1555 field: "PrefixMatchMap",
1556 reason: "embedded message failed validation",
1557 cause: err,
1558 }
1559 }
1560 }
1561
1562 case *Matcher_MatcherTree_CustomMatch:
1563 if v == nil {
1564 err := Matcher_MatcherTreeValidationError{
1565 field: "TreeType",
1566 reason: "oneof value cannot be a typed-nil",
1567 }
1568 if !all {
1569 return err
1570 }
1571 errors = append(errors, err)
1572 }
1573 oneofTreeTypePresent = true
1574
1575 if all {
1576 switch v := interface{}(m.GetCustomMatch()).(type) {
1577 case interface{ ValidateAll() error }:
1578 if err := v.ValidateAll(); err != nil {
1579 errors = append(errors, Matcher_MatcherTreeValidationError{
1580 field: "CustomMatch",
1581 reason: "embedded message failed validation",
1582 cause: err,
1583 })
1584 }
1585 case interface{ Validate() error }:
1586 if err := v.Validate(); err != nil {
1587 errors = append(errors, Matcher_MatcherTreeValidationError{
1588 field: "CustomMatch",
1589 reason: "embedded message failed validation",
1590 cause: err,
1591 })
1592 }
1593 }
1594 } else if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok {
1595 if err := v.Validate(); err != nil {
1596 return Matcher_MatcherTreeValidationError{
1597 field: "CustomMatch",
1598 reason: "embedded message failed validation",
1599 cause: err,
1600 }
1601 }
1602 }
1603
1604 default:
1605 _ = v // ensures v is used
1606 }
1607 if !oneofTreeTypePresent {
1608 err := Matcher_MatcherTreeValidationError{
1609 field: "TreeType",
1610 reason: "value is required",
1611 }
1612 if !all {
1613 return err
1614 }
1615 errors = append(errors, err)
1616 }
1617
1618 if len(errors) > 0 {
1619 return Matcher_MatcherTreeMultiError(errors)
1620 }
1621
1622 return nil
1623 }
1624
1625 // Matcher_MatcherTreeMultiError is an error wrapping multiple validation
1626 // errors returned by Matcher_MatcherTree.ValidateAll() if the designated
1627 // constraints aren't met.
1628 type Matcher_MatcherTreeMultiError []error
1629
1630 // Error returns a concatenation of all the error messages it wraps.
1631 func (m Matcher_MatcherTreeMultiError) Error() string {
1632 var msgs []string
1633 for _, err := range m {
1634 msgs = append(msgs, err.Error())
1635 }
1636 return strings.Join(msgs, "; ")
1637 }
1638
1639 // AllErrors returns a list of validation violation errors.
1640 func (m Matcher_MatcherTreeMultiError) AllErrors() []error { return m }
1641
1642 // Matcher_MatcherTreeValidationError is the validation error returned by
1643 // Matcher_MatcherTree.Validate if the designated constraints aren't met.
1644 type Matcher_MatcherTreeValidationError struct {
1645 field string
1646 reason string
1647 cause error
1648 key bool
1649 }
1650
1651 // Field function returns field value.
1652 func (e Matcher_MatcherTreeValidationError) Field() string { return e.field }
1653
1654 // Reason function returns reason value.
1655 func (e Matcher_MatcherTreeValidationError) Reason() string { return e.reason }
1656
1657 // Cause function returns cause value.
1658 func (e Matcher_MatcherTreeValidationError) Cause() error { return e.cause }
1659
1660 // Key function returns key value.
1661 func (e Matcher_MatcherTreeValidationError) Key() bool { return e.key }
1662
1663 // ErrorName returns error name.
1664 func (e Matcher_MatcherTreeValidationError) ErrorName() string {
1665 return "Matcher_MatcherTreeValidationError"
1666 }
1667
1668 // Error satisfies the builtin error interface
1669 func (e Matcher_MatcherTreeValidationError) Error() string {
1670 cause := ""
1671 if e.cause != nil {
1672 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1673 }
1674
1675 key := ""
1676 if e.key {
1677 key = "key for "
1678 }
1679
1680 return fmt.Sprintf(
1681 "invalid %sMatcher_MatcherTree.%s: %s%s",
1682 key,
1683 e.field,
1684 e.reason,
1685 cause)
1686 }
1687
1688 var _ error = Matcher_MatcherTreeValidationError{}
1689
1690 var _ interface {
1691 Field() string
1692 Reason() string
1693 Key() bool
1694 Cause() error
1695 ErrorName() string
1696 } = Matcher_MatcherTreeValidationError{}
1697
1698 // Validate checks the field values on Matcher_MatcherList_Predicate with the
1699 // rules defined in the proto definition for this message. If any rules are
1700 // violated, the first error encountered is returned, or nil if there are no violations.
1701 func (m *Matcher_MatcherList_Predicate) Validate() error {
1702 return m.validate(false)
1703 }
1704
1705 // ValidateAll checks the field values on Matcher_MatcherList_Predicate with
1706 // the rules defined in the proto definition for this message. If any rules
1707 // are violated, the result is a list of violation errors wrapped in
1708 // Matcher_MatcherList_PredicateMultiError, or nil if none found.
1709 func (m *Matcher_MatcherList_Predicate) ValidateAll() error {
1710 return m.validate(true)
1711 }
1712
1713 func (m *Matcher_MatcherList_Predicate) validate(all bool) error {
1714 if m == nil {
1715 return nil
1716 }
1717
1718 var errors []error
1719
1720 oneofMatchTypePresent := false
1721 switch v := m.MatchType.(type) {
1722 case *Matcher_MatcherList_Predicate_SinglePredicate_:
1723 if v == nil {
1724 err := Matcher_MatcherList_PredicateValidationError{
1725 field: "MatchType",
1726 reason: "oneof value cannot be a typed-nil",
1727 }
1728 if !all {
1729 return err
1730 }
1731 errors = append(errors, err)
1732 }
1733 oneofMatchTypePresent = true
1734
1735 if all {
1736 switch v := interface{}(m.GetSinglePredicate()).(type) {
1737 case interface{ ValidateAll() error }:
1738 if err := v.ValidateAll(); err != nil {
1739 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1740 field: "SinglePredicate",
1741 reason: "embedded message failed validation",
1742 cause: err,
1743 })
1744 }
1745 case interface{ Validate() error }:
1746 if err := v.Validate(); err != nil {
1747 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1748 field: "SinglePredicate",
1749 reason: "embedded message failed validation",
1750 cause: err,
1751 })
1752 }
1753 }
1754 } else if v, ok := interface{}(m.GetSinglePredicate()).(interface{ Validate() error }); ok {
1755 if err := v.Validate(); err != nil {
1756 return Matcher_MatcherList_PredicateValidationError{
1757 field: "SinglePredicate",
1758 reason: "embedded message failed validation",
1759 cause: err,
1760 }
1761 }
1762 }
1763
1764 case *Matcher_MatcherList_Predicate_OrMatcher:
1765 if v == nil {
1766 err := Matcher_MatcherList_PredicateValidationError{
1767 field: "MatchType",
1768 reason: "oneof value cannot be a typed-nil",
1769 }
1770 if !all {
1771 return err
1772 }
1773 errors = append(errors, err)
1774 }
1775 oneofMatchTypePresent = true
1776
1777 if all {
1778 switch v := interface{}(m.GetOrMatcher()).(type) {
1779 case interface{ ValidateAll() error }:
1780 if err := v.ValidateAll(); err != nil {
1781 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1782 field: "OrMatcher",
1783 reason: "embedded message failed validation",
1784 cause: err,
1785 })
1786 }
1787 case interface{ Validate() error }:
1788 if err := v.Validate(); err != nil {
1789 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1790 field: "OrMatcher",
1791 reason: "embedded message failed validation",
1792 cause: err,
1793 })
1794 }
1795 }
1796 } else if v, ok := interface{}(m.GetOrMatcher()).(interface{ Validate() error }); ok {
1797 if err := v.Validate(); err != nil {
1798 return Matcher_MatcherList_PredicateValidationError{
1799 field: "OrMatcher",
1800 reason: "embedded message failed validation",
1801 cause: err,
1802 }
1803 }
1804 }
1805
1806 case *Matcher_MatcherList_Predicate_AndMatcher:
1807 if v == nil {
1808 err := Matcher_MatcherList_PredicateValidationError{
1809 field: "MatchType",
1810 reason: "oneof value cannot be a typed-nil",
1811 }
1812 if !all {
1813 return err
1814 }
1815 errors = append(errors, err)
1816 }
1817 oneofMatchTypePresent = true
1818
1819 if all {
1820 switch v := interface{}(m.GetAndMatcher()).(type) {
1821 case interface{ ValidateAll() error }:
1822 if err := v.ValidateAll(); err != nil {
1823 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1824 field: "AndMatcher",
1825 reason: "embedded message failed validation",
1826 cause: err,
1827 })
1828 }
1829 case interface{ Validate() error }:
1830 if err := v.Validate(); err != nil {
1831 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1832 field: "AndMatcher",
1833 reason: "embedded message failed validation",
1834 cause: err,
1835 })
1836 }
1837 }
1838 } else if v, ok := interface{}(m.GetAndMatcher()).(interface{ Validate() error }); ok {
1839 if err := v.Validate(); err != nil {
1840 return Matcher_MatcherList_PredicateValidationError{
1841 field: "AndMatcher",
1842 reason: "embedded message failed validation",
1843 cause: err,
1844 }
1845 }
1846 }
1847
1848 case *Matcher_MatcherList_Predicate_NotMatcher:
1849 if v == nil {
1850 err := Matcher_MatcherList_PredicateValidationError{
1851 field: "MatchType",
1852 reason: "oneof value cannot be a typed-nil",
1853 }
1854 if !all {
1855 return err
1856 }
1857 errors = append(errors, err)
1858 }
1859 oneofMatchTypePresent = true
1860
1861 if all {
1862 switch v := interface{}(m.GetNotMatcher()).(type) {
1863 case interface{ ValidateAll() error }:
1864 if err := v.ValidateAll(); err != nil {
1865 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1866 field: "NotMatcher",
1867 reason: "embedded message failed validation",
1868 cause: err,
1869 })
1870 }
1871 case interface{ Validate() error }:
1872 if err := v.Validate(); err != nil {
1873 errors = append(errors, Matcher_MatcherList_PredicateValidationError{
1874 field: "NotMatcher",
1875 reason: "embedded message failed validation",
1876 cause: err,
1877 })
1878 }
1879 }
1880 } else if v, ok := interface{}(m.GetNotMatcher()).(interface{ Validate() error }); ok {
1881 if err := v.Validate(); err != nil {
1882 return Matcher_MatcherList_PredicateValidationError{
1883 field: "NotMatcher",
1884 reason: "embedded message failed validation",
1885 cause: err,
1886 }
1887 }
1888 }
1889
1890 default:
1891 _ = v // ensures v is used
1892 }
1893 if !oneofMatchTypePresent {
1894 err := Matcher_MatcherList_PredicateValidationError{
1895 field: "MatchType",
1896 reason: "value is required",
1897 }
1898 if !all {
1899 return err
1900 }
1901 errors = append(errors, err)
1902 }
1903
1904 if len(errors) > 0 {
1905 return Matcher_MatcherList_PredicateMultiError(errors)
1906 }
1907
1908 return nil
1909 }
1910
1911 // Matcher_MatcherList_PredicateMultiError is an error wrapping multiple
1912 // validation errors returned by Matcher_MatcherList_Predicate.ValidateAll()
1913 // if the designated constraints aren't met.
1914 type Matcher_MatcherList_PredicateMultiError []error
1915
1916 // Error returns a concatenation of all the error messages it wraps.
1917 func (m Matcher_MatcherList_PredicateMultiError) Error() string {
1918 var msgs []string
1919 for _, err := range m {
1920 msgs = append(msgs, err.Error())
1921 }
1922 return strings.Join(msgs, "; ")
1923 }
1924
1925 // AllErrors returns a list of validation violation errors.
1926 func (m Matcher_MatcherList_PredicateMultiError) AllErrors() []error { return m }
1927
1928 // Matcher_MatcherList_PredicateValidationError is the validation error
1929 // returned by Matcher_MatcherList_Predicate.Validate if the designated
1930 // constraints aren't met.
1931 type Matcher_MatcherList_PredicateValidationError struct {
1932 field string
1933 reason string
1934 cause error
1935 key bool
1936 }
1937
1938 // Field function returns field value.
1939 func (e Matcher_MatcherList_PredicateValidationError) Field() string { return e.field }
1940
1941 // Reason function returns reason value.
1942 func (e Matcher_MatcherList_PredicateValidationError) Reason() string { return e.reason }
1943
1944 // Cause function returns cause value.
1945 func (e Matcher_MatcherList_PredicateValidationError) Cause() error { return e.cause }
1946
1947 // Key function returns key value.
1948 func (e Matcher_MatcherList_PredicateValidationError) Key() bool { return e.key }
1949
1950 // ErrorName returns error name.
1951 func (e Matcher_MatcherList_PredicateValidationError) ErrorName() string {
1952 return "Matcher_MatcherList_PredicateValidationError"
1953 }
1954
1955 // Error satisfies the builtin error interface
1956 func (e Matcher_MatcherList_PredicateValidationError) Error() string {
1957 cause := ""
1958 if e.cause != nil {
1959 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1960 }
1961
1962 key := ""
1963 if e.key {
1964 key = "key for "
1965 }
1966
1967 return fmt.Sprintf(
1968 "invalid %sMatcher_MatcherList_Predicate.%s: %s%s",
1969 key,
1970 e.field,
1971 e.reason,
1972 cause)
1973 }
1974
1975 var _ error = Matcher_MatcherList_PredicateValidationError{}
1976
1977 var _ interface {
1978 Field() string
1979 Reason() string
1980 Key() bool
1981 Cause() error
1982 ErrorName() string
1983 } = Matcher_MatcherList_PredicateValidationError{}
1984
1985 // Validate checks the field values on Matcher_MatcherList_FieldMatcher with
1986 // the rules defined in the proto definition for this message. If any rules
1987 // are violated, the first error encountered is returned, or nil if there are
1988 // no violations.
1989 func (m *Matcher_MatcherList_FieldMatcher) Validate() error {
1990 return m.validate(false)
1991 }
1992
1993 // ValidateAll checks the field values on Matcher_MatcherList_FieldMatcher with
1994 // the rules defined in the proto definition for this message. If any rules
1995 // are violated, the result is a list of violation errors wrapped in
1996 // Matcher_MatcherList_FieldMatcherMultiError, or nil if none found.
1997 func (m *Matcher_MatcherList_FieldMatcher) ValidateAll() error {
1998 return m.validate(true)
1999 }
2000
2001 func (m *Matcher_MatcherList_FieldMatcher) validate(all bool) error {
2002 if m == nil {
2003 return nil
2004 }
2005
2006 var errors []error
2007
2008 if m.GetPredicate() == nil {
2009 err := Matcher_MatcherList_FieldMatcherValidationError{
2010 field: "Predicate",
2011 reason: "value is required",
2012 }
2013 if !all {
2014 return err
2015 }
2016 errors = append(errors, err)
2017 }
2018
2019 if all {
2020 switch v := interface{}(m.GetPredicate()).(type) {
2021 case interface{ ValidateAll() error }:
2022 if err := v.ValidateAll(); err != nil {
2023 errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
2024 field: "Predicate",
2025 reason: "embedded message failed validation",
2026 cause: err,
2027 })
2028 }
2029 case interface{ Validate() error }:
2030 if err := v.Validate(); err != nil {
2031 errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
2032 field: "Predicate",
2033 reason: "embedded message failed validation",
2034 cause: err,
2035 })
2036 }
2037 }
2038 } else if v, ok := interface{}(m.GetPredicate()).(interface{ Validate() error }); ok {
2039 if err := v.Validate(); err != nil {
2040 return Matcher_MatcherList_FieldMatcherValidationError{
2041 field: "Predicate",
2042 reason: "embedded message failed validation",
2043 cause: err,
2044 }
2045 }
2046 }
2047
2048 if m.GetOnMatch() == nil {
2049 err := Matcher_MatcherList_FieldMatcherValidationError{
2050 field: "OnMatch",
2051 reason: "value is required",
2052 }
2053 if !all {
2054 return err
2055 }
2056 errors = append(errors, err)
2057 }
2058
2059 if all {
2060 switch v := interface{}(m.GetOnMatch()).(type) {
2061 case interface{ ValidateAll() error }:
2062 if err := v.ValidateAll(); err != nil {
2063 errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
2064 field: "OnMatch",
2065 reason: "embedded message failed validation",
2066 cause: err,
2067 })
2068 }
2069 case interface{ Validate() error }:
2070 if err := v.Validate(); err != nil {
2071 errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
2072 field: "OnMatch",
2073 reason: "embedded message failed validation",
2074 cause: err,
2075 })
2076 }
2077 }
2078 } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok {
2079 if err := v.Validate(); err != nil {
2080 return Matcher_MatcherList_FieldMatcherValidationError{
2081 field: "OnMatch",
2082 reason: "embedded message failed validation",
2083 cause: err,
2084 }
2085 }
2086 }
2087
2088 if len(errors) > 0 {
2089 return Matcher_MatcherList_FieldMatcherMultiError(errors)
2090 }
2091
2092 return nil
2093 }
2094
2095 // Matcher_MatcherList_FieldMatcherMultiError is an error wrapping multiple
2096 // validation errors returned by
2097 // Matcher_MatcherList_FieldMatcher.ValidateAll() if the designated
2098 // constraints aren't met.
2099 type Matcher_MatcherList_FieldMatcherMultiError []error
2100
2101 // Error returns a concatenation of all the error messages it wraps.
2102 func (m Matcher_MatcherList_FieldMatcherMultiError) Error() string {
2103 var msgs []string
2104 for _, err := range m {
2105 msgs = append(msgs, err.Error())
2106 }
2107 return strings.Join(msgs, "; ")
2108 }
2109
2110 // AllErrors returns a list of validation violation errors.
2111 func (m Matcher_MatcherList_FieldMatcherMultiError) AllErrors() []error { return m }
2112
2113 // Matcher_MatcherList_FieldMatcherValidationError is the validation error
2114 // returned by Matcher_MatcherList_FieldMatcher.Validate if the designated
2115 // constraints aren't met.
2116 type Matcher_MatcherList_FieldMatcherValidationError struct {
2117 field string
2118 reason string
2119 cause error
2120 key bool
2121 }
2122
2123 // Field function returns field value.
2124 func (e Matcher_MatcherList_FieldMatcherValidationError) Field() string { return e.field }
2125
2126 // Reason function returns reason value.
2127 func (e Matcher_MatcherList_FieldMatcherValidationError) Reason() string { return e.reason }
2128
2129 // Cause function returns cause value.
2130 func (e Matcher_MatcherList_FieldMatcherValidationError) Cause() error { return e.cause }
2131
2132 // Key function returns key value.
2133 func (e Matcher_MatcherList_FieldMatcherValidationError) Key() bool { return e.key }
2134
2135 // ErrorName returns error name.
2136 func (e Matcher_MatcherList_FieldMatcherValidationError) ErrorName() string {
2137 return "Matcher_MatcherList_FieldMatcherValidationError"
2138 }
2139
2140 // Error satisfies the builtin error interface
2141 func (e Matcher_MatcherList_FieldMatcherValidationError) Error() string {
2142 cause := ""
2143 if e.cause != nil {
2144 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2145 }
2146
2147 key := ""
2148 if e.key {
2149 key = "key for "
2150 }
2151
2152 return fmt.Sprintf(
2153 "invalid %sMatcher_MatcherList_FieldMatcher.%s: %s%s",
2154 key,
2155 e.field,
2156 e.reason,
2157 cause)
2158 }
2159
2160 var _ error = Matcher_MatcherList_FieldMatcherValidationError{}
2161
2162 var _ interface {
2163 Field() string
2164 Reason() string
2165 Key() bool
2166 Cause() error
2167 ErrorName() string
2168 } = Matcher_MatcherList_FieldMatcherValidationError{}
2169
2170 // Validate checks the field values on
2171 // Matcher_MatcherList_Predicate_SinglePredicate with the rules defined in the
2172 // proto definition for this message. If any rules are violated, the first
2173 // error encountered is returned, or nil if there are no violations.
2174 func (m *Matcher_MatcherList_Predicate_SinglePredicate) Validate() error {
2175 return m.validate(false)
2176 }
2177
2178 // ValidateAll checks the field values on
2179 // Matcher_MatcherList_Predicate_SinglePredicate with the rules defined in the
2180 // proto definition for this message. If any rules are violated, the result is
2181 // a list of violation errors wrapped in
2182 // Matcher_MatcherList_Predicate_SinglePredicateMultiError, or nil if none found.
2183 func (m *Matcher_MatcherList_Predicate_SinglePredicate) ValidateAll() error {
2184 return m.validate(true)
2185 }
2186
2187 func (m *Matcher_MatcherList_Predicate_SinglePredicate) validate(all bool) error {
2188 if m == nil {
2189 return nil
2190 }
2191
2192 var errors []error
2193
2194 if m.GetInput() == nil {
2195 err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2196 field: "Input",
2197 reason: "value is required",
2198 }
2199 if !all {
2200 return err
2201 }
2202 errors = append(errors, err)
2203 }
2204
2205 if all {
2206 switch v := interface{}(m.GetInput()).(type) {
2207 case interface{ ValidateAll() error }:
2208 if err := v.ValidateAll(); err != nil {
2209 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2210 field: "Input",
2211 reason: "embedded message failed validation",
2212 cause: err,
2213 })
2214 }
2215 case interface{ Validate() error }:
2216 if err := v.Validate(); err != nil {
2217 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2218 field: "Input",
2219 reason: "embedded message failed validation",
2220 cause: err,
2221 })
2222 }
2223 }
2224 } else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
2225 if err := v.Validate(); err != nil {
2226 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2227 field: "Input",
2228 reason: "embedded message failed validation",
2229 cause: err,
2230 }
2231 }
2232 }
2233
2234 oneofMatcherPresent := false
2235 switch v := m.Matcher.(type) {
2236 case *Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch:
2237 if v == nil {
2238 err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2239 field: "Matcher",
2240 reason: "oneof value cannot be a typed-nil",
2241 }
2242 if !all {
2243 return err
2244 }
2245 errors = append(errors, err)
2246 }
2247 oneofMatcherPresent = true
2248
2249 if all {
2250 switch v := interface{}(m.GetValueMatch()).(type) {
2251 case interface{ ValidateAll() error }:
2252 if err := v.ValidateAll(); err != nil {
2253 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2254 field: "ValueMatch",
2255 reason: "embedded message failed validation",
2256 cause: err,
2257 })
2258 }
2259 case interface{ Validate() error }:
2260 if err := v.Validate(); err != nil {
2261 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2262 field: "ValueMatch",
2263 reason: "embedded message failed validation",
2264 cause: err,
2265 })
2266 }
2267 }
2268 } else if v, ok := interface{}(m.GetValueMatch()).(interface{ Validate() error }); ok {
2269 if err := v.Validate(); err != nil {
2270 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2271 field: "ValueMatch",
2272 reason: "embedded message failed validation",
2273 cause: err,
2274 }
2275 }
2276 }
2277
2278 case *Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch:
2279 if v == nil {
2280 err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2281 field: "Matcher",
2282 reason: "oneof value cannot be a typed-nil",
2283 }
2284 if !all {
2285 return err
2286 }
2287 errors = append(errors, err)
2288 }
2289 oneofMatcherPresent = true
2290
2291 if all {
2292 switch v := interface{}(m.GetCustomMatch()).(type) {
2293 case interface{ ValidateAll() error }:
2294 if err := v.ValidateAll(); err != nil {
2295 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2296 field: "CustomMatch",
2297 reason: "embedded message failed validation",
2298 cause: err,
2299 })
2300 }
2301 case interface{ Validate() error }:
2302 if err := v.Validate(); err != nil {
2303 errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2304 field: "CustomMatch",
2305 reason: "embedded message failed validation",
2306 cause: err,
2307 })
2308 }
2309 }
2310 } else if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok {
2311 if err := v.Validate(); err != nil {
2312 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2313 field: "CustomMatch",
2314 reason: "embedded message failed validation",
2315 cause: err,
2316 }
2317 }
2318 }
2319
2320 default:
2321 _ = v // ensures v is used
2322 }
2323 if !oneofMatcherPresent {
2324 err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
2325 field: "Matcher",
2326 reason: "value is required",
2327 }
2328 if !all {
2329 return err
2330 }
2331 errors = append(errors, err)
2332 }
2333
2334 if len(errors) > 0 {
2335 return Matcher_MatcherList_Predicate_SinglePredicateMultiError(errors)
2336 }
2337
2338 return nil
2339 }
2340
2341 // Matcher_MatcherList_Predicate_SinglePredicateMultiError is an error wrapping
2342 // multiple validation errors returned by
2343 // Matcher_MatcherList_Predicate_SinglePredicate.ValidateAll() if the
2344 // designated constraints aren't met.
2345 type Matcher_MatcherList_Predicate_SinglePredicateMultiError []error
2346
2347 // Error returns a concatenation of all the error messages it wraps.
2348 func (m Matcher_MatcherList_Predicate_SinglePredicateMultiError) Error() string {
2349 var msgs []string
2350 for _, err := range m {
2351 msgs = append(msgs, err.Error())
2352 }
2353 return strings.Join(msgs, "; ")
2354 }
2355
2356 // AllErrors returns a list of validation violation errors.
2357 func (m Matcher_MatcherList_Predicate_SinglePredicateMultiError) AllErrors() []error { return m }
2358
2359 // Matcher_MatcherList_Predicate_SinglePredicateValidationError is the
2360 // validation error returned by
2361 // Matcher_MatcherList_Predicate_SinglePredicate.Validate if the designated
2362 // constraints aren't met.
2363 type Matcher_MatcherList_Predicate_SinglePredicateValidationError struct {
2364 field string
2365 reason string
2366 cause error
2367 key bool
2368 }
2369
2370 // Field function returns field value.
2371 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Field() string { return e.field }
2372
2373 // Reason function returns reason value.
2374 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Reason() string {
2375 return e.reason
2376 }
2377
2378 // Cause function returns cause value.
2379 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Cause() error { return e.cause }
2380
2381 // Key function returns key value.
2382 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Key() bool { return e.key }
2383
2384 // ErrorName returns error name.
2385 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) ErrorName() string {
2386 return "Matcher_MatcherList_Predicate_SinglePredicateValidationError"
2387 }
2388
2389 // Error satisfies the builtin error interface
2390 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Error() string {
2391 cause := ""
2392 if e.cause != nil {
2393 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2394 }
2395
2396 key := ""
2397 if e.key {
2398 key = "key for "
2399 }
2400
2401 return fmt.Sprintf(
2402 "invalid %sMatcher_MatcherList_Predicate_SinglePredicate.%s: %s%s",
2403 key,
2404 e.field,
2405 e.reason,
2406 cause)
2407 }
2408
2409 var _ error = Matcher_MatcherList_Predicate_SinglePredicateValidationError{}
2410
2411 var _ interface {
2412 Field() string
2413 Reason() string
2414 Key() bool
2415 Cause() error
2416 ErrorName() string
2417 } = Matcher_MatcherList_Predicate_SinglePredicateValidationError{}
2418
2419 // Validate checks the field values on
2420 // Matcher_MatcherList_Predicate_PredicateList with the rules defined in the
2421 // proto definition for this message. If any rules are violated, the first
2422 // error encountered is returned, or nil if there are no violations.
2423 func (m *Matcher_MatcherList_Predicate_PredicateList) Validate() error {
2424 return m.validate(false)
2425 }
2426
2427 // ValidateAll checks the field values on
2428 // Matcher_MatcherList_Predicate_PredicateList with the rules defined in the
2429 // proto definition for this message. If any rules are violated, the result is
2430 // a list of violation errors wrapped in
2431 // Matcher_MatcherList_Predicate_PredicateListMultiError, or nil if none found.
2432 func (m *Matcher_MatcherList_Predicate_PredicateList) ValidateAll() error {
2433 return m.validate(true)
2434 }
2435
2436 func (m *Matcher_MatcherList_Predicate_PredicateList) validate(all bool) error {
2437 if m == nil {
2438 return nil
2439 }
2440
2441 var errors []error
2442
2443 if len(m.GetPredicate()) < 2 {
2444 err := Matcher_MatcherList_Predicate_PredicateListValidationError{
2445 field: "Predicate",
2446 reason: "value must contain at least 2 item(s)",
2447 }
2448 if !all {
2449 return err
2450 }
2451 errors = append(errors, err)
2452 }
2453
2454 for idx, item := range m.GetPredicate() {
2455 _, _ = idx, item
2456
2457 if all {
2458 switch v := interface{}(item).(type) {
2459 case interface{ ValidateAll() error }:
2460 if err := v.ValidateAll(); err != nil {
2461 errors = append(errors, Matcher_MatcherList_Predicate_PredicateListValidationError{
2462 field: fmt.Sprintf("Predicate[%v]", idx),
2463 reason: "embedded message failed validation",
2464 cause: err,
2465 })
2466 }
2467 case interface{ Validate() error }:
2468 if err := v.Validate(); err != nil {
2469 errors = append(errors, Matcher_MatcherList_Predicate_PredicateListValidationError{
2470 field: fmt.Sprintf("Predicate[%v]", idx),
2471 reason: "embedded message failed validation",
2472 cause: err,
2473 })
2474 }
2475 }
2476 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2477 if err := v.Validate(); err != nil {
2478 return Matcher_MatcherList_Predicate_PredicateListValidationError{
2479 field: fmt.Sprintf("Predicate[%v]", idx),
2480 reason: "embedded message failed validation",
2481 cause: err,
2482 }
2483 }
2484 }
2485
2486 }
2487
2488 if len(errors) > 0 {
2489 return Matcher_MatcherList_Predicate_PredicateListMultiError(errors)
2490 }
2491
2492 return nil
2493 }
2494
2495 // Matcher_MatcherList_Predicate_PredicateListMultiError is an error wrapping
2496 // multiple validation errors returned by
2497 // Matcher_MatcherList_Predicate_PredicateList.ValidateAll() if the designated
2498 // constraints aren't met.
2499 type Matcher_MatcherList_Predicate_PredicateListMultiError []error
2500
2501 // Error returns a concatenation of all the error messages it wraps.
2502 func (m Matcher_MatcherList_Predicate_PredicateListMultiError) Error() string {
2503 var msgs []string
2504 for _, err := range m {
2505 msgs = append(msgs, err.Error())
2506 }
2507 return strings.Join(msgs, "; ")
2508 }
2509
2510 // AllErrors returns a list of validation violation errors.
2511 func (m Matcher_MatcherList_Predicate_PredicateListMultiError) AllErrors() []error { return m }
2512
2513 // Matcher_MatcherList_Predicate_PredicateListValidationError is the validation
2514 // error returned by Matcher_MatcherList_Predicate_PredicateList.Validate if
2515 // the designated constraints aren't met.
2516 type Matcher_MatcherList_Predicate_PredicateListValidationError struct {
2517 field string
2518 reason string
2519 cause error
2520 key bool
2521 }
2522
2523 // Field function returns field value.
2524 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Field() string { return e.field }
2525
2526 // Reason function returns reason value.
2527 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Reason() string { return e.reason }
2528
2529 // Cause function returns cause value.
2530 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Cause() error { return e.cause }
2531
2532 // Key function returns key value.
2533 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Key() bool { return e.key }
2534
2535 // ErrorName returns error name.
2536 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) ErrorName() string {
2537 return "Matcher_MatcherList_Predicate_PredicateListValidationError"
2538 }
2539
2540 // Error satisfies the builtin error interface
2541 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Error() string {
2542 cause := ""
2543 if e.cause != nil {
2544 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2545 }
2546
2547 key := ""
2548 if e.key {
2549 key = "key for "
2550 }
2551
2552 return fmt.Sprintf(
2553 "invalid %sMatcher_MatcherList_Predicate_PredicateList.%s: %s%s",
2554 key,
2555 e.field,
2556 e.reason,
2557 cause)
2558 }
2559
2560 var _ error = Matcher_MatcherList_Predicate_PredicateListValidationError{}
2561
2562 var _ interface {
2563 Field() string
2564 Reason() string
2565 Key() bool
2566 Cause() error
2567 ErrorName() string
2568 } = Matcher_MatcherList_Predicate_PredicateListValidationError{}
2569
2570 // Validate checks the field values on Matcher_MatcherTree_MatchMap with the
2571 // rules defined in the proto definition for this message. If any rules are
2572 // violated, the first error encountered is returned, or nil if there are no violations.
2573 func (m *Matcher_MatcherTree_MatchMap) Validate() error {
2574 return m.validate(false)
2575 }
2576
2577 // ValidateAll checks the field values on Matcher_MatcherTree_MatchMap with the
2578 // rules defined in the proto definition for this message. If any rules are
2579 // violated, the result is a list of violation errors wrapped in
2580 // Matcher_MatcherTree_MatchMapMultiError, or nil if none found.
2581 func (m *Matcher_MatcherTree_MatchMap) ValidateAll() error {
2582 return m.validate(true)
2583 }
2584
2585 func (m *Matcher_MatcherTree_MatchMap) validate(all bool) error {
2586 if m == nil {
2587 return nil
2588 }
2589
2590 var errors []error
2591
2592 if len(m.GetMap()) < 1 {
2593 err := Matcher_MatcherTree_MatchMapValidationError{
2594 field: "Map",
2595 reason: "value must contain at least 1 pair(s)",
2596 }
2597 if !all {
2598 return err
2599 }
2600 errors = append(errors, err)
2601 }
2602
2603 {
2604 sorted_keys := make([]string, len(m.GetMap()))
2605 i := 0
2606 for key := range m.GetMap() {
2607 sorted_keys[i] = key
2608 i++
2609 }
2610 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
2611 for _, key := range sorted_keys {
2612 val := m.GetMap()[key]
2613 _ = val
2614
2615 // no validation rules for Map[key]
2616
2617 if all {
2618 switch v := interface{}(val).(type) {
2619 case interface{ ValidateAll() error }:
2620 if err := v.ValidateAll(); err != nil {
2621 errors = append(errors, Matcher_MatcherTree_MatchMapValidationError{
2622 field: fmt.Sprintf("Map[%v]", key),
2623 reason: "embedded message failed validation",
2624 cause: err,
2625 })
2626 }
2627 case interface{ Validate() error }:
2628 if err := v.Validate(); err != nil {
2629 errors = append(errors, Matcher_MatcherTree_MatchMapValidationError{
2630 field: fmt.Sprintf("Map[%v]", key),
2631 reason: "embedded message failed validation",
2632 cause: err,
2633 })
2634 }
2635 }
2636 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
2637 if err := v.Validate(); err != nil {
2638 return Matcher_MatcherTree_MatchMapValidationError{
2639 field: fmt.Sprintf("Map[%v]", key),
2640 reason: "embedded message failed validation",
2641 cause: err,
2642 }
2643 }
2644 }
2645
2646 }
2647 }
2648
2649 if len(errors) > 0 {
2650 return Matcher_MatcherTree_MatchMapMultiError(errors)
2651 }
2652
2653 return nil
2654 }
2655
2656 // Matcher_MatcherTree_MatchMapMultiError is an error wrapping multiple
2657 // validation errors returned by Matcher_MatcherTree_MatchMap.ValidateAll() if
2658 // the designated constraints aren't met.
2659 type Matcher_MatcherTree_MatchMapMultiError []error
2660
2661 // Error returns a concatenation of all the error messages it wraps.
2662 func (m Matcher_MatcherTree_MatchMapMultiError) Error() string {
2663 var msgs []string
2664 for _, err := range m {
2665 msgs = append(msgs, err.Error())
2666 }
2667 return strings.Join(msgs, "; ")
2668 }
2669
2670 // AllErrors returns a list of validation violation errors.
2671 func (m Matcher_MatcherTree_MatchMapMultiError) AllErrors() []error { return m }
2672
2673 // Matcher_MatcherTree_MatchMapValidationError is the validation error returned
2674 // by Matcher_MatcherTree_MatchMap.Validate if the designated constraints
2675 // aren't met.
2676 type Matcher_MatcherTree_MatchMapValidationError struct {
2677 field string
2678 reason string
2679 cause error
2680 key bool
2681 }
2682
2683 // Field function returns field value.
2684 func (e Matcher_MatcherTree_MatchMapValidationError) Field() string { return e.field }
2685
2686 // Reason function returns reason value.
2687 func (e Matcher_MatcherTree_MatchMapValidationError) Reason() string { return e.reason }
2688
2689 // Cause function returns cause value.
2690 func (e Matcher_MatcherTree_MatchMapValidationError) Cause() error { return e.cause }
2691
2692 // Key function returns key value.
2693 func (e Matcher_MatcherTree_MatchMapValidationError) Key() bool { return e.key }
2694
2695 // ErrorName returns error name.
2696 func (e Matcher_MatcherTree_MatchMapValidationError) ErrorName() string {
2697 return "Matcher_MatcherTree_MatchMapValidationError"
2698 }
2699
2700 // Error satisfies the builtin error interface
2701 func (e Matcher_MatcherTree_MatchMapValidationError) Error() string {
2702 cause := ""
2703 if e.cause != nil {
2704 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2705 }
2706
2707 key := ""
2708 if e.key {
2709 key = "key for "
2710 }
2711
2712 return fmt.Sprintf(
2713 "invalid %sMatcher_MatcherTree_MatchMap.%s: %s%s",
2714 key,
2715 e.field,
2716 e.reason,
2717 cause)
2718 }
2719
2720 var _ error = Matcher_MatcherTree_MatchMapValidationError{}
2721
2722 var _ interface {
2723 Field() string
2724 Reason() string
2725 Key() bool
2726 Cause() error
2727 ErrorName() string
2728 } = Matcher_MatcherTree_MatchMapValidationError{}
2729
2730 // Validate checks the field values on MatchPredicate_MatchSet with the rules
2731 // defined in the proto definition for this message. If any rules are
2732 // violated, the first error encountered is returned, or nil if there are no violations.
2733 func (m *MatchPredicate_MatchSet) Validate() error {
2734 return m.validate(false)
2735 }
2736
2737 // ValidateAll checks the field values on MatchPredicate_MatchSet with the
2738 // rules defined in the proto definition for this message. If any rules are
2739 // violated, the result is a list of violation errors wrapped in
2740 // MatchPredicate_MatchSetMultiError, or nil if none found.
2741 func (m *MatchPredicate_MatchSet) ValidateAll() error {
2742 return m.validate(true)
2743 }
2744
2745 func (m *MatchPredicate_MatchSet) validate(all bool) error {
2746 if m == nil {
2747 return nil
2748 }
2749
2750 var errors []error
2751
2752 if len(m.GetRules()) < 2 {
2753 err := MatchPredicate_MatchSetValidationError{
2754 field: "Rules",
2755 reason: "value must contain at least 2 item(s)",
2756 }
2757 if !all {
2758 return err
2759 }
2760 errors = append(errors, err)
2761 }
2762
2763 for idx, item := range m.GetRules() {
2764 _, _ = idx, item
2765
2766 if all {
2767 switch v := interface{}(item).(type) {
2768 case interface{ ValidateAll() error }:
2769 if err := v.ValidateAll(); err != nil {
2770 errors = append(errors, MatchPredicate_MatchSetValidationError{
2771 field: fmt.Sprintf("Rules[%v]", idx),
2772 reason: "embedded message failed validation",
2773 cause: err,
2774 })
2775 }
2776 case interface{ Validate() error }:
2777 if err := v.Validate(); err != nil {
2778 errors = append(errors, MatchPredicate_MatchSetValidationError{
2779 field: fmt.Sprintf("Rules[%v]", idx),
2780 reason: "embedded message failed validation",
2781 cause: err,
2782 })
2783 }
2784 }
2785 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2786 if err := v.Validate(); err != nil {
2787 return MatchPredicate_MatchSetValidationError{
2788 field: fmt.Sprintf("Rules[%v]", idx),
2789 reason: "embedded message failed validation",
2790 cause: err,
2791 }
2792 }
2793 }
2794
2795 }
2796
2797 if len(errors) > 0 {
2798 return MatchPredicate_MatchSetMultiError(errors)
2799 }
2800
2801 return nil
2802 }
2803
2804 // MatchPredicate_MatchSetMultiError is an error wrapping multiple validation
2805 // errors returned by MatchPredicate_MatchSet.ValidateAll() if the designated
2806 // constraints aren't met.
2807 type MatchPredicate_MatchSetMultiError []error
2808
2809 // Error returns a concatenation of all the error messages it wraps.
2810 func (m MatchPredicate_MatchSetMultiError) Error() string {
2811 var msgs []string
2812 for _, err := range m {
2813 msgs = append(msgs, err.Error())
2814 }
2815 return strings.Join(msgs, "; ")
2816 }
2817
2818 // AllErrors returns a list of validation violation errors.
2819 func (m MatchPredicate_MatchSetMultiError) AllErrors() []error { return m }
2820
2821 // MatchPredicate_MatchSetValidationError is the validation error returned by
2822 // MatchPredicate_MatchSet.Validate if the designated constraints aren't met.
2823 type MatchPredicate_MatchSetValidationError struct {
2824 field string
2825 reason string
2826 cause error
2827 key bool
2828 }
2829
2830 // Field function returns field value.
2831 func (e MatchPredicate_MatchSetValidationError) Field() string { return e.field }
2832
2833 // Reason function returns reason value.
2834 func (e MatchPredicate_MatchSetValidationError) Reason() string { return e.reason }
2835
2836 // Cause function returns cause value.
2837 func (e MatchPredicate_MatchSetValidationError) Cause() error { return e.cause }
2838
2839 // Key function returns key value.
2840 func (e MatchPredicate_MatchSetValidationError) Key() bool { return e.key }
2841
2842 // ErrorName returns error name.
2843 func (e MatchPredicate_MatchSetValidationError) ErrorName() string {
2844 return "MatchPredicate_MatchSetValidationError"
2845 }
2846
2847 // Error satisfies the builtin error interface
2848 func (e MatchPredicate_MatchSetValidationError) Error() string {
2849 cause := ""
2850 if e.cause != nil {
2851 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2852 }
2853
2854 key := ""
2855 if e.key {
2856 key = "key for "
2857 }
2858
2859 return fmt.Sprintf(
2860 "invalid %sMatchPredicate_MatchSet.%s: %s%s",
2861 key,
2862 e.field,
2863 e.reason,
2864 cause)
2865 }
2866
2867 var _ error = MatchPredicate_MatchSetValidationError{}
2868
2869 var _ interface {
2870 Field() string
2871 Reason() string
2872 Key() bool
2873 Cause() error
2874 ErrorName() string
2875 } = MatchPredicate_MatchSetValidationError{}
2876
2877 // Validate checks the field values on HttpGenericBodyMatch_GenericTextMatch
2878 // with the rules defined in the proto definition for this message. If any
2879 // rules are violated, the first error encountered is returned, or nil if
2880 // there are no violations.
2881 func (m *HttpGenericBodyMatch_GenericTextMatch) Validate() error {
2882 return m.validate(false)
2883 }
2884
2885 // ValidateAll checks the field values on HttpGenericBodyMatch_GenericTextMatch
2886 // with the rules defined in the proto definition for this message. If any
2887 // rules are violated, the result is a list of violation errors wrapped in
2888 // HttpGenericBodyMatch_GenericTextMatchMultiError, or nil if none found.
2889 func (m *HttpGenericBodyMatch_GenericTextMatch) ValidateAll() error {
2890 return m.validate(true)
2891 }
2892
2893 func (m *HttpGenericBodyMatch_GenericTextMatch) validate(all bool) error {
2894 if m == nil {
2895 return nil
2896 }
2897
2898 var errors []error
2899
2900 oneofRulePresent := false
2901 switch v := m.Rule.(type) {
2902 case *HttpGenericBodyMatch_GenericTextMatch_StringMatch:
2903 if v == nil {
2904 err := HttpGenericBodyMatch_GenericTextMatchValidationError{
2905 field: "Rule",
2906 reason: "oneof value cannot be a typed-nil",
2907 }
2908 if !all {
2909 return err
2910 }
2911 errors = append(errors, err)
2912 }
2913 oneofRulePresent = true
2914
2915 if utf8.RuneCountInString(m.GetStringMatch()) < 1 {
2916 err := HttpGenericBodyMatch_GenericTextMatchValidationError{
2917 field: "StringMatch",
2918 reason: "value length must be at least 1 runes",
2919 }
2920 if !all {
2921 return err
2922 }
2923 errors = append(errors, err)
2924 }
2925
2926 case *HttpGenericBodyMatch_GenericTextMatch_BinaryMatch:
2927 if v == nil {
2928 err := HttpGenericBodyMatch_GenericTextMatchValidationError{
2929 field: "Rule",
2930 reason: "oneof value cannot be a typed-nil",
2931 }
2932 if !all {
2933 return err
2934 }
2935 errors = append(errors, err)
2936 }
2937 oneofRulePresent = true
2938
2939 if len(m.GetBinaryMatch()) < 1 {
2940 err := HttpGenericBodyMatch_GenericTextMatchValidationError{
2941 field: "BinaryMatch",
2942 reason: "value length must be at least 1 bytes",
2943 }
2944 if !all {
2945 return err
2946 }
2947 errors = append(errors, err)
2948 }
2949
2950 default:
2951 _ = v // ensures v is used
2952 }
2953 if !oneofRulePresent {
2954 err := HttpGenericBodyMatch_GenericTextMatchValidationError{
2955 field: "Rule",
2956 reason: "value is required",
2957 }
2958 if !all {
2959 return err
2960 }
2961 errors = append(errors, err)
2962 }
2963
2964 if len(errors) > 0 {
2965 return HttpGenericBodyMatch_GenericTextMatchMultiError(errors)
2966 }
2967
2968 return nil
2969 }
2970
2971 // HttpGenericBodyMatch_GenericTextMatchMultiError is an error wrapping
2972 // multiple validation errors returned by
2973 // HttpGenericBodyMatch_GenericTextMatch.ValidateAll() if the designated
2974 // constraints aren't met.
2975 type HttpGenericBodyMatch_GenericTextMatchMultiError []error
2976
2977 // Error returns a concatenation of all the error messages it wraps.
2978 func (m HttpGenericBodyMatch_GenericTextMatchMultiError) Error() string {
2979 var msgs []string
2980 for _, err := range m {
2981 msgs = append(msgs, err.Error())
2982 }
2983 return strings.Join(msgs, "; ")
2984 }
2985
2986 // AllErrors returns a list of validation violation errors.
2987 func (m HttpGenericBodyMatch_GenericTextMatchMultiError) AllErrors() []error { return m }
2988
2989 // HttpGenericBodyMatch_GenericTextMatchValidationError is the validation error
2990 // returned by HttpGenericBodyMatch_GenericTextMatch.Validate if the
2991 // designated constraints aren't met.
2992 type HttpGenericBodyMatch_GenericTextMatchValidationError struct {
2993 field string
2994 reason string
2995 cause error
2996 key bool
2997 }
2998
2999 // Field function returns field value.
3000 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Field() string { return e.field }
3001
3002 // Reason function returns reason value.
3003 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Reason() string { return e.reason }
3004
3005 // Cause function returns cause value.
3006 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Cause() error { return e.cause }
3007
3008 // Key function returns key value.
3009 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Key() bool { return e.key }
3010
3011 // ErrorName returns error name.
3012 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) ErrorName() string {
3013 return "HttpGenericBodyMatch_GenericTextMatchValidationError"
3014 }
3015
3016 // Error satisfies the builtin error interface
3017 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Error() string {
3018 cause := ""
3019 if e.cause != nil {
3020 cause = fmt.Sprintf(" | caused by: %v", e.cause)
3021 }
3022
3023 key := ""
3024 if e.key {
3025 key = "key for "
3026 }
3027
3028 return fmt.Sprintf(
3029 "invalid %sHttpGenericBodyMatch_GenericTextMatch.%s: %s%s",
3030 key,
3031 e.field,
3032 e.reason,
3033 cause)
3034 }
3035
3036 var _ error = HttpGenericBodyMatch_GenericTextMatchValidationError{}
3037
3038 var _ interface {
3039 Field() string
3040 Reason() string
3041 Key() bool
3042 Cause() error
3043 ErrorName() string
3044 } = HttpGenericBodyMatch_GenericTextMatchValidationError{}