1
2
3
4 package envoy_config_common_matcher_v3
5
6 import (
7 "bytes"
8 "errors"
9 "fmt"
10 "net"
11 "net/mail"
12 "net/url"
13 "regexp"
14 "strings"
15 "time"
16 "unicode/utf8"
17
18 "github.com/golang/protobuf/ptypes"
19 )
20
21
22 var (
23 _ = bytes.MinRead
24 _ = errors.New("")
25 _ = fmt.Print
26 _ = utf8.UTFMax
27 _ = (*regexp.Regexp)(nil)
28 _ = (*strings.Reader)(nil)
29 _ = net.IPv4len
30 _ = time.Duration(0)
31 _ = (*url.URL)(nil)
32 _ = (*mail.Address)(nil)
33 _ = ptypes.DynamicAny{}
34 )
35
36
37
38 func (m *Matcher) Validate() error {
39 if m == nil {
40 return nil
41 }
42
43 if v, ok := interface{}(m.GetOnNoMatch()).(interface{ Validate() error }); ok {
44 if err := v.Validate(); err != nil {
45 return MatcherValidationError{
46 field: "OnNoMatch",
47 reason: "embedded message failed validation",
48 cause: err,
49 }
50 }
51 }
52
53 switch m.MatcherType.(type) {
54
55 case *Matcher_MatcherList_:
56
57 if v, ok := interface{}(m.GetMatcherList()).(interface{ Validate() error }); ok {
58 if err := v.Validate(); err != nil {
59 return MatcherValidationError{
60 field: "MatcherList",
61 reason: "embedded message failed validation",
62 cause: err,
63 }
64 }
65 }
66
67 case *Matcher_MatcherTree_:
68
69 if v, ok := interface{}(m.GetMatcherTree()).(interface{ Validate() error }); ok {
70 if err := v.Validate(); err != nil {
71 return MatcherValidationError{
72 field: "MatcherTree",
73 reason: "embedded message failed validation",
74 cause: err,
75 }
76 }
77 }
78
79 default:
80 return MatcherValidationError{
81 field: "MatcherType",
82 reason: "value is required",
83 }
84
85 }
86
87 return nil
88 }
89
90
91
92 type MatcherValidationError struct {
93 field string
94 reason string
95 cause error
96 key bool
97 }
98
99
100 func (e MatcherValidationError) Field() string { return e.field }
101
102
103 func (e MatcherValidationError) Reason() string { return e.reason }
104
105
106 func (e MatcherValidationError) Cause() error { return e.cause }
107
108
109 func (e MatcherValidationError) Key() bool { return e.key }
110
111
112 func (e MatcherValidationError) ErrorName() string { return "MatcherValidationError" }
113
114
115 func (e MatcherValidationError) Error() string {
116 cause := ""
117 if e.cause != nil {
118 cause = fmt.Sprintf(" | caused by: %v", e.cause)
119 }
120
121 key := ""
122 if e.key {
123 key = "key for "
124 }
125
126 return fmt.Sprintf(
127 "invalid %sMatcher.%s: %s%s",
128 key,
129 e.field,
130 e.reason,
131 cause)
132 }
133
134 var _ error = MatcherValidationError{}
135
136 var _ interface {
137 Field() string
138 Reason() string
139 Key() bool
140 Cause() error
141 ErrorName() string
142 } = MatcherValidationError{}
143
144
145
146
147 func (m *MatchPredicate) Validate() error {
148 if m == nil {
149 return nil
150 }
151
152 switch m.Rule.(type) {
153
154 case *MatchPredicate_OrMatch:
155
156 if v, ok := interface{}(m.GetOrMatch()).(interface{ Validate() error }); ok {
157 if err := v.Validate(); err != nil {
158 return MatchPredicateValidationError{
159 field: "OrMatch",
160 reason: "embedded message failed validation",
161 cause: err,
162 }
163 }
164 }
165
166 case *MatchPredicate_AndMatch:
167
168 if v, ok := interface{}(m.GetAndMatch()).(interface{ Validate() error }); ok {
169 if err := v.Validate(); err != nil {
170 return MatchPredicateValidationError{
171 field: "AndMatch",
172 reason: "embedded message failed validation",
173 cause: err,
174 }
175 }
176 }
177
178 case *MatchPredicate_NotMatch:
179
180 if v, ok := interface{}(m.GetNotMatch()).(interface{ Validate() error }); ok {
181 if err := v.Validate(); err != nil {
182 return MatchPredicateValidationError{
183 field: "NotMatch",
184 reason: "embedded message failed validation",
185 cause: err,
186 }
187 }
188 }
189
190 case *MatchPredicate_AnyMatch:
191
192 if m.GetAnyMatch() != true {
193 return MatchPredicateValidationError{
194 field: "AnyMatch",
195 reason: "value must equal true",
196 }
197 }
198
199 case *MatchPredicate_HttpRequestHeadersMatch:
200
201 if v, ok := interface{}(m.GetHttpRequestHeadersMatch()).(interface{ Validate() error }); ok {
202 if err := v.Validate(); err != nil {
203 return MatchPredicateValidationError{
204 field: "HttpRequestHeadersMatch",
205 reason: "embedded message failed validation",
206 cause: err,
207 }
208 }
209 }
210
211 case *MatchPredicate_HttpRequestTrailersMatch:
212
213 if v, ok := interface{}(m.GetHttpRequestTrailersMatch()).(interface{ Validate() error }); ok {
214 if err := v.Validate(); err != nil {
215 return MatchPredicateValidationError{
216 field: "HttpRequestTrailersMatch",
217 reason: "embedded message failed validation",
218 cause: err,
219 }
220 }
221 }
222
223 case *MatchPredicate_HttpResponseHeadersMatch:
224
225 if v, ok := interface{}(m.GetHttpResponseHeadersMatch()).(interface{ Validate() error }); ok {
226 if err := v.Validate(); err != nil {
227 return MatchPredicateValidationError{
228 field: "HttpResponseHeadersMatch",
229 reason: "embedded message failed validation",
230 cause: err,
231 }
232 }
233 }
234
235 case *MatchPredicate_HttpResponseTrailersMatch:
236
237 if v, ok := interface{}(m.GetHttpResponseTrailersMatch()).(interface{ Validate() error }); ok {
238 if err := v.Validate(); err != nil {
239 return MatchPredicateValidationError{
240 field: "HttpResponseTrailersMatch",
241 reason: "embedded message failed validation",
242 cause: err,
243 }
244 }
245 }
246
247 case *MatchPredicate_HttpRequestGenericBodyMatch:
248
249 if v, ok := interface{}(m.GetHttpRequestGenericBodyMatch()).(interface{ Validate() error }); ok {
250 if err := v.Validate(); err != nil {
251 return MatchPredicateValidationError{
252 field: "HttpRequestGenericBodyMatch",
253 reason: "embedded message failed validation",
254 cause: err,
255 }
256 }
257 }
258
259 case *MatchPredicate_HttpResponseGenericBodyMatch:
260
261 if v, ok := interface{}(m.GetHttpResponseGenericBodyMatch()).(interface{ Validate() error }); ok {
262 if err := v.Validate(); err != nil {
263 return MatchPredicateValidationError{
264 field: "HttpResponseGenericBodyMatch",
265 reason: "embedded message failed validation",
266 cause: err,
267 }
268 }
269 }
270
271 default:
272 return MatchPredicateValidationError{
273 field: "Rule",
274 reason: "value is required",
275 }
276
277 }
278
279 return nil
280 }
281
282
283
284 type MatchPredicateValidationError struct {
285 field string
286 reason string
287 cause error
288 key bool
289 }
290
291
292 func (e MatchPredicateValidationError) Field() string { return e.field }
293
294
295 func (e MatchPredicateValidationError) Reason() string { return e.reason }
296
297
298 func (e MatchPredicateValidationError) Cause() error { return e.cause }
299
300
301 func (e MatchPredicateValidationError) Key() bool { return e.key }
302
303
304 func (e MatchPredicateValidationError) ErrorName() string { return "MatchPredicateValidationError" }
305
306
307 func (e MatchPredicateValidationError) Error() string {
308 cause := ""
309 if e.cause != nil {
310 cause = fmt.Sprintf(" | caused by: %v", e.cause)
311 }
312
313 key := ""
314 if e.key {
315 key = "key for "
316 }
317
318 return fmt.Sprintf(
319 "invalid %sMatchPredicate.%s: %s%s",
320 key,
321 e.field,
322 e.reason,
323 cause)
324 }
325
326 var _ error = MatchPredicateValidationError{}
327
328 var _ interface {
329 Field() string
330 Reason() string
331 Key() bool
332 Cause() error
333 ErrorName() string
334 } = MatchPredicateValidationError{}
335
336
337
338
339 func (m *HttpHeadersMatch) Validate() error {
340 if m == nil {
341 return nil
342 }
343
344 for idx, item := range m.GetHeaders() {
345 _, _ = idx, item
346
347 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
348 if err := v.Validate(); err != nil {
349 return HttpHeadersMatchValidationError{
350 field: fmt.Sprintf("Headers[%v]", idx),
351 reason: "embedded message failed validation",
352 cause: err,
353 }
354 }
355 }
356
357 }
358
359 return nil
360 }
361
362
363
364 type HttpHeadersMatchValidationError struct {
365 field string
366 reason string
367 cause error
368 key bool
369 }
370
371
372 func (e HttpHeadersMatchValidationError) Field() string { return e.field }
373
374
375 func (e HttpHeadersMatchValidationError) Reason() string { return e.reason }
376
377
378 func (e HttpHeadersMatchValidationError) Cause() error { return e.cause }
379
380
381 func (e HttpHeadersMatchValidationError) Key() bool { return e.key }
382
383
384 func (e HttpHeadersMatchValidationError) ErrorName() string { return "HttpHeadersMatchValidationError" }
385
386
387 func (e HttpHeadersMatchValidationError) Error() string {
388 cause := ""
389 if e.cause != nil {
390 cause = fmt.Sprintf(" | caused by: %v", e.cause)
391 }
392
393 key := ""
394 if e.key {
395 key = "key for "
396 }
397
398 return fmt.Sprintf(
399 "invalid %sHttpHeadersMatch.%s: %s%s",
400 key,
401 e.field,
402 e.reason,
403 cause)
404 }
405
406 var _ error = HttpHeadersMatchValidationError{}
407
408 var _ interface {
409 Field() string
410 Reason() string
411 Key() bool
412 Cause() error
413 ErrorName() string
414 } = HttpHeadersMatchValidationError{}
415
416
417
418
419 func (m *HttpGenericBodyMatch) Validate() error {
420 if m == nil {
421 return nil
422 }
423
424
425
426 if len(m.GetPatterns()) < 1 {
427 return HttpGenericBodyMatchValidationError{
428 field: "Patterns",
429 reason: "value must contain at least 1 item(s)",
430 }
431 }
432
433 for idx, item := range m.GetPatterns() {
434 _, _ = idx, item
435
436 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
437 if err := v.Validate(); err != nil {
438 return HttpGenericBodyMatchValidationError{
439 field: fmt.Sprintf("Patterns[%v]", idx),
440 reason: "embedded message failed validation",
441 cause: err,
442 }
443 }
444 }
445
446 }
447
448 return nil
449 }
450
451
452
453 type HttpGenericBodyMatchValidationError struct {
454 field string
455 reason string
456 cause error
457 key bool
458 }
459
460
461 func (e HttpGenericBodyMatchValidationError) Field() string { return e.field }
462
463
464 func (e HttpGenericBodyMatchValidationError) Reason() string { return e.reason }
465
466
467 func (e HttpGenericBodyMatchValidationError) Cause() error { return e.cause }
468
469
470 func (e HttpGenericBodyMatchValidationError) Key() bool { return e.key }
471
472
473 func (e HttpGenericBodyMatchValidationError) ErrorName() string {
474 return "HttpGenericBodyMatchValidationError"
475 }
476
477
478 func (e HttpGenericBodyMatchValidationError) Error() string {
479 cause := ""
480 if e.cause != nil {
481 cause = fmt.Sprintf(" | caused by: %v", e.cause)
482 }
483
484 key := ""
485 if e.key {
486 key = "key for "
487 }
488
489 return fmt.Sprintf(
490 "invalid %sHttpGenericBodyMatch.%s: %s%s",
491 key,
492 e.field,
493 e.reason,
494 cause)
495 }
496
497 var _ error = HttpGenericBodyMatchValidationError{}
498
499 var _ interface {
500 Field() string
501 Reason() string
502 Key() bool
503 Cause() error
504 ErrorName() string
505 } = HttpGenericBodyMatchValidationError{}
506
507
508
509
510 func (m *Matcher_OnMatch) Validate() error {
511 if m == nil {
512 return nil
513 }
514
515 switch m.OnMatch.(type) {
516
517 case *Matcher_OnMatch_Matcher:
518
519 if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok {
520 if err := v.Validate(); err != nil {
521 return Matcher_OnMatchValidationError{
522 field: "Matcher",
523 reason: "embedded message failed validation",
524 cause: err,
525 }
526 }
527 }
528
529 case *Matcher_OnMatch_Action:
530
531 if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok {
532 if err := v.Validate(); err != nil {
533 return Matcher_OnMatchValidationError{
534 field: "Action",
535 reason: "embedded message failed validation",
536 cause: err,
537 }
538 }
539 }
540
541 default:
542 return Matcher_OnMatchValidationError{
543 field: "OnMatch",
544 reason: "value is required",
545 }
546
547 }
548
549 return nil
550 }
551
552
553
554 type Matcher_OnMatchValidationError struct {
555 field string
556 reason string
557 cause error
558 key bool
559 }
560
561
562 func (e Matcher_OnMatchValidationError) Field() string { return e.field }
563
564
565 func (e Matcher_OnMatchValidationError) Reason() string { return e.reason }
566
567
568 func (e Matcher_OnMatchValidationError) Cause() error { return e.cause }
569
570
571 func (e Matcher_OnMatchValidationError) Key() bool { return e.key }
572
573
574 func (e Matcher_OnMatchValidationError) ErrorName() string { return "Matcher_OnMatchValidationError" }
575
576
577 func (e Matcher_OnMatchValidationError) Error() string {
578 cause := ""
579 if e.cause != nil {
580 cause = fmt.Sprintf(" | caused by: %v", e.cause)
581 }
582
583 key := ""
584 if e.key {
585 key = "key for "
586 }
587
588 return fmt.Sprintf(
589 "invalid %sMatcher_OnMatch.%s: %s%s",
590 key,
591 e.field,
592 e.reason,
593 cause)
594 }
595
596 var _ error = Matcher_OnMatchValidationError{}
597
598 var _ interface {
599 Field() string
600 Reason() string
601 Key() bool
602 Cause() error
603 ErrorName() string
604 } = Matcher_OnMatchValidationError{}
605
606
607
608
609 func (m *Matcher_MatcherList) Validate() error {
610 if m == nil {
611 return nil
612 }
613
614 if len(m.GetMatchers()) < 1 {
615 return Matcher_MatcherListValidationError{
616 field: "Matchers",
617 reason: "value must contain at least 1 item(s)",
618 }
619 }
620
621 for idx, item := range m.GetMatchers() {
622 _, _ = idx, item
623
624 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
625 if err := v.Validate(); err != nil {
626 return Matcher_MatcherListValidationError{
627 field: fmt.Sprintf("Matchers[%v]", idx),
628 reason: "embedded message failed validation",
629 cause: err,
630 }
631 }
632 }
633
634 }
635
636 return nil
637 }
638
639
640
641 type Matcher_MatcherListValidationError struct {
642 field string
643 reason string
644 cause error
645 key bool
646 }
647
648
649 func (e Matcher_MatcherListValidationError) Field() string { return e.field }
650
651
652 func (e Matcher_MatcherListValidationError) Reason() string { return e.reason }
653
654
655 func (e Matcher_MatcherListValidationError) Cause() error { return e.cause }
656
657
658 func (e Matcher_MatcherListValidationError) Key() bool { return e.key }
659
660
661 func (e Matcher_MatcherListValidationError) ErrorName() string {
662 return "Matcher_MatcherListValidationError"
663 }
664
665
666 func (e Matcher_MatcherListValidationError) Error() string {
667 cause := ""
668 if e.cause != nil {
669 cause = fmt.Sprintf(" | caused by: %v", e.cause)
670 }
671
672 key := ""
673 if e.key {
674 key = "key for "
675 }
676
677 return fmt.Sprintf(
678 "invalid %sMatcher_MatcherList.%s: %s%s",
679 key,
680 e.field,
681 e.reason,
682 cause)
683 }
684
685 var _ error = Matcher_MatcherListValidationError{}
686
687 var _ interface {
688 Field() string
689 Reason() string
690 Key() bool
691 Cause() error
692 ErrorName() string
693 } = Matcher_MatcherListValidationError{}
694
695
696
697
698 func (m *Matcher_MatcherTree) Validate() error {
699 if m == nil {
700 return nil
701 }
702
703 if m.GetInput() == nil {
704 return Matcher_MatcherTreeValidationError{
705 field: "Input",
706 reason: "value is required",
707 }
708 }
709
710 if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
711 if err := v.Validate(); err != nil {
712 return Matcher_MatcherTreeValidationError{
713 field: "Input",
714 reason: "embedded message failed validation",
715 cause: err,
716 }
717 }
718 }
719
720 switch m.TreeType.(type) {
721
722 case *Matcher_MatcherTree_ExactMatchMap:
723
724 if v, ok := interface{}(m.GetExactMatchMap()).(interface{ Validate() error }); ok {
725 if err := v.Validate(); err != nil {
726 return Matcher_MatcherTreeValidationError{
727 field: "ExactMatchMap",
728 reason: "embedded message failed validation",
729 cause: err,
730 }
731 }
732 }
733
734 case *Matcher_MatcherTree_PrefixMatchMap:
735
736 if v, ok := interface{}(m.GetPrefixMatchMap()).(interface{ Validate() error }); ok {
737 if err := v.Validate(); err != nil {
738 return Matcher_MatcherTreeValidationError{
739 field: "PrefixMatchMap",
740 reason: "embedded message failed validation",
741 cause: err,
742 }
743 }
744 }
745
746 case *Matcher_MatcherTree_CustomMatch:
747
748 if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok {
749 if err := v.Validate(); err != nil {
750 return Matcher_MatcherTreeValidationError{
751 field: "CustomMatch",
752 reason: "embedded message failed validation",
753 cause: err,
754 }
755 }
756 }
757
758 default:
759 return Matcher_MatcherTreeValidationError{
760 field: "TreeType",
761 reason: "value is required",
762 }
763
764 }
765
766 return nil
767 }
768
769
770
771 type Matcher_MatcherTreeValidationError struct {
772 field string
773 reason string
774 cause error
775 key bool
776 }
777
778
779 func (e Matcher_MatcherTreeValidationError) Field() string { return e.field }
780
781
782 func (e Matcher_MatcherTreeValidationError) Reason() string { return e.reason }
783
784
785 func (e Matcher_MatcherTreeValidationError) Cause() error { return e.cause }
786
787
788 func (e Matcher_MatcherTreeValidationError) Key() bool { return e.key }
789
790
791 func (e Matcher_MatcherTreeValidationError) ErrorName() string {
792 return "Matcher_MatcherTreeValidationError"
793 }
794
795
796 func (e Matcher_MatcherTreeValidationError) Error() string {
797 cause := ""
798 if e.cause != nil {
799 cause = fmt.Sprintf(" | caused by: %v", e.cause)
800 }
801
802 key := ""
803 if e.key {
804 key = "key for "
805 }
806
807 return fmt.Sprintf(
808 "invalid %sMatcher_MatcherTree.%s: %s%s",
809 key,
810 e.field,
811 e.reason,
812 cause)
813 }
814
815 var _ error = Matcher_MatcherTreeValidationError{}
816
817 var _ interface {
818 Field() string
819 Reason() string
820 Key() bool
821 Cause() error
822 ErrorName() string
823 } = Matcher_MatcherTreeValidationError{}
824
825
826
827
828 func (m *Matcher_MatcherList_Predicate) Validate() error {
829 if m == nil {
830 return nil
831 }
832
833 switch m.MatchType.(type) {
834
835 case *Matcher_MatcherList_Predicate_SinglePredicate_:
836
837 if v, ok := interface{}(m.GetSinglePredicate()).(interface{ Validate() error }); ok {
838 if err := v.Validate(); err != nil {
839 return Matcher_MatcherList_PredicateValidationError{
840 field: "SinglePredicate",
841 reason: "embedded message failed validation",
842 cause: err,
843 }
844 }
845 }
846
847 case *Matcher_MatcherList_Predicate_OrMatcher:
848
849 if v, ok := interface{}(m.GetOrMatcher()).(interface{ Validate() error }); ok {
850 if err := v.Validate(); err != nil {
851 return Matcher_MatcherList_PredicateValidationError{
852 field: "OrMatcher",
853 reason: "embedded message failed validation",
854 cause: err,
855 }
856 }
857 }
858
859 case *Matcher_MatcherList_Predicate_AndMatcher:
860
861 if v, ok := interface{}(m.GetAndMatcher()).(interface{ Validate() error }); ok {
862 if err := v.Validate(); err != nil {
863 return Matcher_MatcherList_PredicateValidationError{
864 field: "AndMatcher",
865 reason: "embedded message failed validation",
866 cause: err,
867 }
868 }
869 }
870
871 default:
872 return Matcher_MatcherList_PredicateValidationError{
873 field: "MatchType",
874 reason: "value is required",
875 }
876
877 }
878
879 return nil
880 }
881
882
883
884
885 type Matcher_MatcherList_PredicateValidationError struct {
886 field string
887 reason string
888 cause error
889 key bool
890 }
891
892
893 func (e Matcher_MatcherList_PredicateValidationError) Field() string { return e.field }
894
895
896 func (e Matcher_MatcherList_PredicateValidationError) Reason() string { return e.reason }
897
898
899 func (e Matcher_MatcherList_PredicateValidationError) Cause() error { return e.cause }
900
901
902 func (e Matcher_MatcherList_PredicateValidationError) Key() bool { return e.key }
903
904
905 func (e Matcher_MatcherList_PredicateValidationError) ErrorName() string {
906 return "Matcher_MatcherList_PredicateValidationError"
907 }
908
909
910 func (e Matcher_MatcherList_PredicateValidationError) Error() string {
911 cause := ""
912 if e.cause != nil {
913 cause = fmt.Sprintf(" | caused by: %v", e.cause)
914 }
915
916 key := ""
917 if e.key {
918 key = "key for "
919 }
920
921 return fmt.Sprintf(
922 "invalid %sMatcher_MatcherList_Predicate.%s: %s%s",
923 key,
924 e.field,
925 e.reason,
926 cause)
927 }
928
929 var _ error = Matcher_MatcherList_PredicateValidationError{}
930
931 var _ interface {
932 Field() string
933 Reason() string
934 Key() bool
935 Cause() error
936 ErrorName() string
937 } = Matcher_MatcherList_PredicateValidationError{}
938
939
940
941
942 func (m *Matcher_MatcherList_FieldMatcher) Validate() error {
943 if m == nil {
944 return nil
945 }
946
947 if m.GetPredicate() == nil {
948 return Matcher_MatcherList_FieldMatcherValidationError{
949 field: "Predicate",
950 reason: "value is required",
951 }
952 }
953
954 if v, ok := interface{}(m.GetPredicate()).(interface{ Validate() error }); ok {
955 if err := v.Validate(); err != nil {
956 return Matcher_MatcherList_FieldMatcherValidationError{
957 field: "Predicate",
958 reason: "embedded message failed validation",
959 cause: err,
960 }
961 }
962 }
963
964 if m.GetOnMatch() == nil {
965 return Matcher_MatcherList_FieldMatcherValidationError{
966 field: "OnMatch",
967 reason: "value is required",
968 }
969 }
970
971 if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok {
972 if err := v.Validate(); err != nil {
973 return Matcher_MatcherList_FieldMatcherValidationError{
974 field: "OnMatch",
975 reason: "embedded message failed validation",
976 cause: err,
977 }
978 }
979 }
980
981 return nil
982 }
983
984
985
986
987 type Matcher_MatcherList_FieldMatcherValidationError struct {
988 field string
989 reason string
990 cause error
991 key bool
992 }
993
994
995 func (e Matcher_MatcherList_FieldMatcherValidationError) Field() string { return e.field }
996
997
998 func (e Matcher_MatcherList_FieldMatcherValidationError) Reason() string { return e.reason }
999
1000
1001 func (e Matcher_MatcherList_FieldMatcherValidationError) Cause() error { return e.cause }
1002
1003
1004 func (e Matcher_MatcherList_FieldMatcherValidationError) Key() bool { return e.key }
1005
1006
1007 func (e Matcher_MatcherList_FieldMatcherValidationError) ErrorName() string {
1008 return "Matcher_MatcherList_FieldMatcherValidationError"
1009 }
1010
1011
1012 func (e Matcher_MatcherList_FieldMatcherValidationError) Error() string {
1013 cause := ""
1014 if e.cause != nil {
1015 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1016 }
1017
1018 key := ""
1019 if e.key {
1020 key = "key for "
1021 }
1022
1023 return fmt.Sprintf(
1024 "invalid %sMatcher_MatcherList_FieldMatcher.%s: %s%s",
1025 key,
1026 e.field,
1027 e.reason,
1028 cause)
1029 }
1030
1031 var _ error = Matcher_MatcherList_FieldMatcherValidationError{}
1032
1033 var _ interface {
1034 Field() string
1035 Reason() string
1036 Key() bool
1037 Cause() error
1038 ErrorName() string
1039 } = Matcher_MatcherList_FieldMatcherValidationError{}
1040
1041
1042
1043
1044 func (m *Matcher_MatcherList_Predicate_SinglePredicate) Validate() error {
1045 if m == nil {
1046 return nil
1047 }
1048
1049 if m.GetInput() == nil {
1050 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1051 field: "Input",
1052 reason: "value is required",
1053 }
1054 }
1055
1056 if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
1057 if err := v.Validate(); err != nil {
1058 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1059 field: "Input",
1060 reason: "embedded message failed validation",
1061 cause: err,
1062 }
1063 }
1064 }
1065
1066 switch m.Matcher.(type) {
1067
1068 case *Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch:
1069
1070 if v, ok := interface{}(m.GetValueMatch()).(interface{ Validate() error }); ok {
1071 if err := v.Validate(); err != nil {
1072 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1073 field: "ValueMatch",
1074 reason: "embedded message failed validation",
1075 cause: err,
1076 }
1077 }
1078 }
1079
1080 case *Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch:
1081
1082 if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok {
1083 if err := v.Validate(); err != nil {
1084 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1085 field: "CustomMatch",
1086 reason: "embedded message failed validation",
1087 cause: err,
1088 }
1089 }
1090 }
1091
1092 default:
1093 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
1094 field: "Matcher",
1095 reason: "value is required",
1096 }
1097
1098 }
1099
1100 return nil
1101 }
1102
1103
1104
1105
1106
1107 type Matcher_MatcherList_Predicate_SinglePredicateValidationError struct {
1108 field string
1109 reason string
1110 cause error
1111 key bool
1112 }
1113
1114
1115 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Field() string { return e.field }
1116
1117
1118 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Reason() string {
1119 return e.reason
1120 }
1121
1122
1123 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Cause() error { return e.cause }
1124
1125
1126 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Key() bool { return e.key }
1127
1128
1129 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) ErrorName() string {
1130 return "Matcher_MatcherList_Predicate_SinglePredicateValidationError"
1131 }
1132
1133
1134 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Error() string {
1135 cause := ""
1136 if e.cause != nil {
1137 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1138 }
1139
1140 key := ""
1141 if e.key {
1142 key = "key for "
1143 }
1144
1145 return fmt.Sprintf(
1146 "invalid %sMatcher_MatcherList_Predicate_SinglePredicate.%s: %s%s",
1147 key,
1148 e.field,
1149 e.reason,
1150 cause)
1151 }
1152
1153 var _ error = Matcher_MatcherList_Predicate_SinglePredicateValidationError{}
1154
1155 var _ interface {
1156 Field() string
1157 Reason() string
1158 Key() bool
1159 Cause() error
1160 ErrorName() string
1161 } = Matcher_MatcherList_Predicate_SinglePredicateValidationError{}
1162
1163
1164
1165
1166 func (m *Matcher_MatcherList_Predicate_PredicateList) Validate() error {
1167 if m == nil {
1168 return nil
1169 }
1170
1171 if len(m.GetPredicate()) < 2 {
1172 return Matcher_MatcherList_Predicate_PredicateListValidationError{
1173 field: "Predicate",
1174 reason: "value must contain at least 2 item(s)",
1175 }
1176 }
1177
1178 for idx, item := range m.GetPredicate() {
1179 _, _ = idx, item
1180
1181 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1182 if err := v.Validate(); err != nil {
1183 return Matcher_MatcherList_Predicate_PredicateListValidationError{
1184 field: fmt.Sprintf("Predicate[%v]", idx),
1185 reason: "embedded message failed validation",
1186 cause: err,
1187 }
1188 }
1189 }
1190
1191 }
1192
1193 return nil
1194 }
1195
1196
1197
1198
1199 type Matcher_MatcherList_Predicate_PredicateListValidationError struct {
1200 field string
1201 reason string
1202 cause error
1203 key bool
1204 }
1205
1206
1207 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Field() string { return e.field }
1208
1209
1210 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Reason() string { return e.reason }
1211
1212
1213 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Cause() error { return e.cause }
1214
1215
1216 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Key() bool { return e.key }
1217
1218
1219 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) ErrorName() string {
1220 return "Matcher_MatcherList_Predicate_PredicateListValidationError"
1221 }
1222
1223
1224 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Error() string {
1225 cause := ""
1226 if e.cause != nil {
1227 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1228 }
1229
1230 key := ""
1231 if e.key {
1232 key = "key for "
1233 }
1234
1235 return fmt.Sprintf(
1236 "invalid %sMatcher_MatcherList_Predicate_PredicateList.%s: %s%s",
1237 key,
1238 e.field,
1239 e.reason,
1240 cause)
1241 }
1242
1243 var _ error = Matcher_MatcherList_Predicate_PredicateListValidationError{}
1244
1245 var _ interface {
1246 Field() string
1247 Reason() string
1248 Key() bool
1249 Cause() error
1250 ErrorName() string
1251 } = Matcher_MatcherList_Predicate_PredicateListValidationError{}
1252
1253
1254
1255
1256 func (m *Matcher_MatcherTree_MatchMap) Validate() error {
1257 if m == nil {
1258 return nil
1259 }
1260
1261 if len(m.GetMap()) < 1 {
1262 return Matcher_MatcherTree_MatchMapValidationError{
1263 field: "Map",
1264 reason: "value must contain at least 1 pair(s)",
1265 }
1266 }
1267
1268 for key, val := range m.GetMap() {
1269 _ = val
1270
1271
1272
1273 if v, ok := interface{}(val).(interface{ Validate() error }); ok {
1274 if err := v.Validate(); err != nil {
1275 return Matcher_MatcherTree_MatchMapValidationError{
1276 field: fmt.Sprintf("Map[%v]", key),
1277 reason: "embedded message failed validation",
1278 cause: err,
1279 }
1280 }
1281 }
1282
1283 }
1284
1285 return nil
1286 }
1287
1288
1289
1290
1291 type Matcher_MatcherTree_MatchMapValidationError struct {
1292 field string
1293 reason string
1294 cause error
1295 key bool
1296 }
1297
1298
1299 func (e Matcher_MatcherTree_MatchMapValidationError) Field() string { return e.field }
1300
1301
1302 func (e Matcher_MatcherTree_MatchMapValidationError) Reason() string { return e.reason }
1303
1304
1305 func (e Matcher_MatcherTree_MatchMapValidationError) Cause() error { return e.cause }
1306
1307
1308 func (e Matcher_MatcherTree_MatchMapValidationError) Key() bool { return e.key }
1309
1310
1311 func (e Matcher_MatcherTree_MatchMapValidationError) ErrorName() string {
1312 return "Matcher_MatcherTree_MatchMapValidationError"
1313 }
1314
1315
1316 func (e Matcher_MatcherTree_MatchMapValidationError) Error() string {
1317 cause := ""
1318 if e.cause != nil {
1319 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1320 }
1321
1322 key := ""
1323 if e.key {
1324 key = "key for "
1325 }
1326
1327 return fmt.Sprintf(
1328 "invalid %sMatcher_MatcherTree_MatchMap.%s: %s%s",
1329 key,
1330 e.field,
1331 e.reason,
1332 cause)
1333 }
1334
1335 var _ error = Matcher_MatcherTree_MatchMapValidationError{}
1336
1337 var _ interface {
1338 Field() string
1339 Reason() string
1340 Key() bool
1341 Cause() error
1342 ErrorName() string
1343 } = Matcher_MatcherTree_MatchMapValidationError{}
1344
1345
1346
1347
1348 func (m *MatchPredicate_MatchSet) Validate() error {
1349 if m == nil {
1350 return nil
1351 }
1352
1353 if len(m.GetRules()) < 2 {
1354 return MatchPredicate_MatchSetValidationError{
1355 field: "Rules",
1356 reason: "value must contain at least 2 item(s)",
1357 }
1358 }
1359
1360 for idx, item := range m.GetRules() {
1361 _, _ = idx, item
1362
1363 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1364 if err := v.Validate(); err != nil {
1365 return MatchPredicate_MatchSetValidationError{
1366 field: fmt.Sprintf("Rules[%v]", idx),
1367 reason: "embedded message failed validation",
1368 cause: err,
1369 }
1370 }
1371 }
1372
1373 }
1374
1375 return nil
1376 }
1377
1378
1379
1380 type MatchPredicate_MatchSetValidationError struct {
1381 field string
1382 reason string
1383 cause error
1384 key bool
1385 }
1386
1387
1388 func (e MatchPredicate_MatchSetValidationError) Field() string { return e.field }
1389
1390
1391 func (e MatchPredicate_MatchSetValidationError) Reason() string { return e.reason }
1392
1393
1394 func (e MatchPredicate_MatchSetValidationError) Cause() error { return e.cause }
1395
1396
1397 func (e MatchPredicate_MatchSetValidationError) Key() bool { return e.key }
1398
1399
1400 func (e MatchPredicate_MatchSetValidationError) ErrorName() string {
1401 return "MatchPredicate_MatchSetValidationError"
1402 }
1403
1404
1405 func (e MatchPredicate_MatchSetValidationError) Error() string {
1406 cause := ""
1407 if e.cause != nil {
1408 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1409 }
1410
1411 key := ""
1412 if e.key {
1413 key = "key for "
1414 }
1415
1416 return fmt.Sprintf(
1417 "invalid %sMatchPredicate_MatchSet.%s: %s%s",
1418 key,
1419 e.field,
1420 e.reason,
1421 cause)
1422 }
1423
1424 var _ error = MatchPredicate_MatchSetValidationError{}
1425
1426 var _ interface {
1427 Field() string
1428 Reason() string
1429 Key() bool
1430 Cause() error
1431 ErrorName() string
1432 } = MatchPredicate_MatchSetValidationError{}
1433
1434
1435
1436
1437 func (m *HttpGenericBodyMatch_GenericTextMatch) Validate() error {
1438 if m == nil {
1439 return nil
1440 }
1441
1442 switch m.Rule.(type) {
1443
1444 case *HttpGenericBodyMatch_GenericTextMatch_StringMatch:
1445
1446 if utf8.RuneCountInString(m.GetStringMatch()) < 1 {
1447 return HttpGenericBodyMatch_GenericTextMatchValidationError{
1448 field: "StringMatch",
1449 reason: "value length must be at least 1 runes",
1450 }
1451 }
1452
1453 case *HttpGenericBodyMatch_GenericTextMatch_BinaryMatch:
1454
1455 if len(m.GetBinaryMatch()) < 1 {
1456 return HttpGenericBodyMatch_GenericTextMatchValidationError{
1457 field: "BinaryMatch",
1458 reason: "value length must be at least 1 bytes",
1459 }
1460 }
1461
1462 default:
1463 return HttpGenericBodyMatch_GenericTextMatchValidationError{
1464 field: "Rule",
1465 reason: "value is required",
1466 }
1467
1468 }
1469
1470 return nil
1471 }
1472
1473
1474
1475
1476 type HttpGenericBodyMatch_GenericTextMatchValidationError struct {
1477 field string
1478 reason string
1479 cause error
1480 key bool
1481 }
1482
1483
1484 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Field() string { return e.field }
1485
1486
1487 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Reason() string { return e.reason }
1488
1489
1490 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Cause() error { return e.cause }
1491
1492
1493 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Key() bool { return e.key }
1494
1495
1496 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) ErrorName() string {
1497 return "HttpGenericBodyMatch_GenericTextMatchValidationError"
1498 }
1499
1500
1501 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Error() string {
1502 cause := ""
1503 if e.cause != nil {
1504 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1505 }
1506
1507 key := ""
1508 if e.key {
1509 key = "key for "
1510 }
1511
1512 return fmt.Sprintf(
1513 "invalid %sHttpGenericBodyMatch_GenericTextMatch.%s: %s%s",
1514 key,
1515 e.field,
1516 e.reason,
1517 cause)
1518 }
1519
1520 var _ error = HttpGenericBodyMatch_GenericTextMatchValidationError{}
1521
1522 var _ interface {
1523 Field() string
1524 Reason() string
1525 Key() bool
1526 Cause() error
1527 ErrorName() string
1528 } = HttpGenericBodyMatch_GenericTextMatchValidationError{}
1529
View as plain text