1
2
3
4 package envoy_config_tap_v4alpha
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 *TapConfig) Validate() error {
39 if m == nil {
40 return nil
41 }
42
43 if v, ok := interface{}(m.GetHiddenEnvoyDeprecatedMatchConfig()).(interface{ Validate() error }); ok {
44 if err := v.Validate(); err != nil {
45 return TapConfigValidationError{
46 field: "HiddenEnvoyDeprecatedMatchConfig",
47 reason: "embedded message failed validation",
48 cause: err,
49 }
50 }
51 }
52
53 if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok {
54 if err := v.Validate(); err != nil {
55 return TapConfigValidationError{
56 field: "Match",
57 reason: "embedded message failed validation",
58 cause: err,
59 }
60 }
61 }
62
63 if m.GetOutputConfig() == nil {
64 return TapConfigValidationError{
65 field: "OutputConfig",
66 reason: "value is required",
67 }
68 }
69
70 if v, ok := interface{}(m.GetOutputConfig()).(interface{ Validate() error }); ok {
71 if err := v.Validate(); err != nil {
72 return TapConfigValidationError{
73 field: "OutputConfig",
74 reason: "embedded message failed validation",
75 cause: err,
76 }
77 }
78 }
79
80 if v, ok := interface{}(m.GetTapEnabled()).(interface{ Validate() error }); ok {
81 if err := v.Validate(); err != nil {
82 return TapConfigValidationError{
83 field: "TapEnabled",
84 reason: "embedded message failed validation",
85 cause: err,
86 }
87 }
88 }
89
90 return nil
91 }
92
93
94
95 type TapConfigValidationError struct {
96 field string
97 reason string
98 cause error
99 key bool
100 }
101
102
103 func (e TapConfigValidationError) Field() string { return e.field }
104
105
106 func (e TapConfigValidationError) Reason() string { return e.reason }
107
108
109 func (e TapConfigValidationError) Cause() error { return e.cause }
110
111
112 func (e TapConfigValidationError) Key() bool { return e.key }
113
114
115 func (e TapConfigValidationError) ErrorName() string { return "TapConfigValidationError" }
116
117
118 func (e TapConfigValidationError) Error() string {
119 cause := ""
120 if e.cause != nil {
121 cause = fmt.Sprintf(" | caused by: %v", e.cause)
122 }
123
124 key := ""
125 if e.key {
126 key = "key for "
127 }
128
129 return fmt.Sprintf(
130 "invalid %sTapConfig.%s: %s%s",
131 key,
132 e.field,
133 e.reason,
134 cause)
135 }
136
137 var _ error = TapConfigValidationError{}
138
139 var _ interface {
140 Field() string
141 Reason() string
142 Key() bool
143 Cause() error
144 ErrorName() string
145 } = TapConfigValidationError{}
146
147
148
149
150 func (m *MatchPredicate) Validate() error {
151 if m == nil {
152 return nil
153 }
154
155 switch m.Rule.(type) {
156
157 case *MatchPredicate_OrMatch:
158
159 if v, ok := interface{}(m.GetOrMatch()).(interface{ Validate() error }); ok {
160 if err := v.Validate(); err != nil {
161 return MatchPredicateValidationError{
162 field: "OrMatch",
163 reason: "embedded message failed validation",
164 cause: err,
165 }
166 }
167 }
168
169 case *MatchPredicate_AndMatch:
170
171 if v, ok := interface{}(m.GetAndMatch()).(interface{ Validate() error }); ok {
172 if err := v.Validate(); err != nil {
173 return MatchPredicateValidationError{
174 field: "AndMatch",
175 reason: "embedded message failed validation",
176 cause: err,
177 }
178 }
179 }
180
181 case *MatchPredicate_NotMatch:
182
183 if v, ok := interface{}(m.GetNotMatch()).(interface{ Validate() error }); ok {
184 if err := v.Validate(); err != nil {
185 return MatchPredicateValidationError{
186 field: "NotMatch",
187 reason: "embedded message failed validation",
188 cause: err,
189 }
190 }
191 }
192
193 case *MatchPredicate_AnyMatch:
194
195 if m.GetAnyMatch() != true {
196 return MatchPredicateValidationError{
197 field: "AnyMatch",
198 reason: "value must equal true",
199 }
200 }
201
202 case *MatchPredicate_HttpRequestHeadersMatch:
203
204 if v, ok := interface{}(m.GetHttpRequestHeadersMatch()).(interface{ Validate() error }); ok {
205 if err := v.Validate(); err != nil {
206 return MatchPredicateValidationError{
207 field: "HttpRequestHeadersMatch",
208 reason: "embedded message failed validation",
209 cause: err,
210 }
211 }
212 }
213
214 case *MatchPredicate_HttpRequestTrailersMatch:
215
216 if v, ok := interface{}(m.GetHttpRequestTrailersMatch()).(interface{ Validate() error }); ok {
217 if err := v.Validate(); err != nil {
218 return MatchPredicateValidationError{
219 field: "HttpRequestTrailersMatch",
220 reason: "embedded message failed validation",
221 cause: err,
222 }
223 }
224 }
225
226 case *MatchPredicate_HttpResponseHeadersMatch:
227
228 if v, ok := interface{}(m.GetHttpResponseHeadersMatch()).(interface{ Validate() error }); ok {
229 if err := v.Validate(); err != nil {
230 return MatchPredicateValidationError{
231 field: "HttpResponseHeadersMatch",
232 reason: "embedded message failed validation",
233 cause: err,
234 }
235 }
236 }
237
238 case *MatchPredicate_HttpResponseTrailersMatch:
239
240 if v, ok := interface{}(m.GetHttpResponseTrailersMatch()).(interface{ Validate() error }); ok {
241 if err := v.Validate(); err != nil {
242 return MatchPredicateValidationError{
243 field: "HttpResponseTrailersMatch",
244 reason: "embedded message failed validation",
245 cause: err,
246 }
247 }
248 }
249
250 case *MatchPredicate_HttpRequestGenericBodyMatch:
251
252 if v, ok := interface{}(m.GetHttpRequestGenericBodyMatch()).(interface{ Validate() error }); ok {
253 if err := v.Validate(); err != nil {
254 return MatchPredicateValidationError{
255 field: "HttpRequestGenericBodyMatch",
256 reason: "embedded message failed validation",
257 cause: err,
258 }
259 }
260 }
261
262 case *MatchPredicate_HttpResponseGenericBodyMatch:
263
264 if v, ok := interface{}(m.GetHttpResponseGenericBodyMatch()).(interface{ Validate() error }); ok {
265 if err := v.Validate(); err != nil {
266 return MatchPredicateValidationError{
267 field: "HttpResponseGenericBodyMatch",
268 reason: "embedded message failed validation",
269 cause: err,
270 }
271 }
272 }
273
274 default:
275 return MatchPredicateValidationError{
276 field: "Rule",
277 reason: "value is required",
278 }
279
280 }
281
282 return nil
283 }
284
285
286
287 type MatchPredicateValidationError struct {
288 field string
289 reason string
290 cause error
291 key bool
292 }
293
294
295 func (e MatchPredicateValidationError) Field() string { return e.field }
296
297
298 func (e MatchPredicateValidationError) Reason() string { return e.reason }
299
300
301 func (e MatchPredicateValidationError) Cause() error { return e.cause }
302
303
304 func (e MatchPredicateValidationError) Key() bool { return e.key }
305
306
307 func (e MatchPredicateValidationError) ErrorName() string { return "MatchPredicateValidationError" }
308
309
310 func (e MatchPredicateValidationError) Error() string {
311 cause := ""
312 if e.cause != nil {
313 cause = fmt.Sprintf(" | caused by: %v", e.cause)
314 }
315
316 key := ""
317 if e.key {
318 key = "key for "
319 }
320
321 return fmt.Sprintf(
322 "invalid %sMatchPredicate.%s: %s%s",
323 key,
324 e.field,
325 e.reason,
326 cause)
327 }
328
329 var _ error = MatchPredicateValidationError{}
330
331 var _ interface {
332 Field() string
333 Reason() string
334 Key() bool
335 Cause() error
336 ErrorName() string
337 } = MatchPredicateValidationError{}
338
339
340
341
342 func (m *HttpHeadersMatch) Validate() error {
343 if m == nil {
344 return nil
345 }
346
347 for idx, item := range m.GetHeaders() {
348 _, _ = idx, item
349
350 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
351 if err := v.Validate(); err != nil {
352 return HttpHeadersMatchValidationError{
353 field: fmt.Sprintf("Headers[%v]", idx),
354 reason: "embedded message failed validation",
355 cause: err,
356 }
357 }
358 }
359
360 }
361
362 return nil
363 }
364
365
366
367 type HttpHeadersMatchValidationError struct {
368 field string
369 reason string
370 cause error
371 key bool
372 }
373
374
375 func (e HttpHeadersMatchValidationError) Field() string { return e.field }
376
377
378 func (e HttpHeadersMatchValidationError) Reason() string { return e.reason }
379
380
381 func (e HttpHeadersMatchValidationError) Cause() error { return e.cause }
382
383
384 func (e HttpHeadersMatchValidationError) Key() bool { return e.key }
385
386
387 func (e HttpHeadersMatchValidationError) ErrorName() string { return "HttpHeadersMatchValidationError" }
388
389
390 func (e HttpHeadersMatchValidationError) Error() string {
391 cause := ""
392 if e.cause != nil {
393 cause = fmt.Sprintf(" | caused by: %v", e.cause)
394 }
395
396 key := ""
397 if e.key {
398 key = "key for "
399 }
400
401 return fmt.Sprintf(
402 "invalid %sHttpHeadersMatch.%s: %s%s",
403 key,
404 e.field,
405 e.reason,
406 cause)
407 }
408
409 var _ error = HttpHeadersMatchValidationError{}
410
411 var _ interface {
412 Field() string
413 Reason() string
414 Key() bool
415 Cause() error
416 ErrorName() string
417 } = HttpHeadersMatchValidationError{}
418
419
420
421
422 func (m *HttpGenericBodyMatch) Validate() error {
423 if m == nil {
424 return nil
425 }
426
427
428
429 if len(m.GetPatterns()) < 1 {
430 return HttpGenericBodyMatchValidationError{
431 field: "Patterns",
432 reason: "value must contain at least 1 item(s)",
433 }
434 }
435
436 for idx, item := range m.GetPatterns() {
437 _, _ = idx, item
438
439 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
440 if err := v.Validate(); err != nil {
441 return HttpGenericBodyMatchValidationError{
442 field: fmt.Sprintf("Patterns[%v]", idx),
443 reason: "embedded message failed validation",
444 cause: err,
445 }
446 }
447 }
448
449 }
450
451 return nil
452 }
453
454
455
456 type HttpGenericBodyMatchValidationError struct {
457 field string
458 reason string
459 cause error
460 key bool
461 }
462
463
464 func (e HttpGenericBodyMatchValidationError) Field() string { return e.field }
465
466
467 func (e HttpGenericBodyMatchValidationError) Reason() string { return e.reason }
468
469
470 func (e HttpGenericBodyMatchValidationError) Cause() error { return e.cause }
471
472
473 func (e HttpGenericBodyMatchValidationError) Key() bool { return e.key }
474
475
476 func (e HttpGenericBodyMatchValidationError) ErrorName() string {
477 return "HttpGenericBodyMatchValidationError"
478 }
479
480
481 func (e HttpGenericBodyMatchValidationError) Error() string {
482 cause := ""
483 if e.cause != nil {
484 cause = fmt.Sprintf(" | caused by: %v", e.cause)
485 }
486
487 key := ""
488 if e.key {
489 key = "key for "
490 }
491
492 return fmt.Sprintf(
493 "invalid %sHttpGenericBodyMatch.%s: %s%s",
494 key,
495 e.field,
496 e.reason,
497 cause)
498 }
499
500 var _ error = HttpGenericBodyMatchValidationError{}
501
502 var _ interface {
503 Field() string
504 Reason() string
505 Key() bool
506 Cause() error
507 ErrorName() string
508 } = HttpGenericBodyMatchValidationError{}
509
510
511
512
513 func (m *OutputConfig) Validate() error {
514 if m == nil {
515 return nil
516 }
517
518 if len(m.GetSinks()) != 1 {
519 return OutputConfigValidationError{
520 field: "Sinks",
521 reason: "value must contain exactly 1 item(s)",
522 }
523 }
524
525 for idx, item := range m.GetSinks() {
526 _, _ = idx, item
527
528 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
529 if err := v.Validate(); err != nil {
530 return OutputConfigValidationError{
531 field: fmt.Sprintf("Sinks[%v]", idx),
532 reason: "embedded message failed validation",
533 cause: err,
534 }
535 }
536 }
537
538 }
539
540 if v, ok := interface{}(m.GetMaxBufferedRxBytes()).(interface{ Validate() error }); ok {
541 if err := v.Validate(); err != nil {
542 return OutputConfigValidationError{
543 field: "MaxBufferedRxBytes",
544 reason: "embedded message failed validation",
545 cause: err,
546 }
547 }
548 }
549
550 if v, ok := interface{}(m.GetMaxBufferedTxBytes()).(interface{ Validate() error }); ok {
551 if err := v.Validate(); err != nil {
552 return OutputConfigValidationError{
553 field: "MaxBufferedTxBytes",
554 reason: "embedded message failed validation",
555 cause: err,
556 }
557 }
558 }
559
560
561
562 return nil
563 }
564
565
566
567 type OutputConfigValidationError struct {
568 field string
569 reason string
570 cause error
571 key bool
572 }
573
574
575 func (e OutputConfigValidationError) Field() string { return e.field }
576
577
578 func (e OutputConfigValidationError) Reason() string { return e.reason }
579
580
581 func (e OutputConfigValidationError) Cause() error { return e.cause }
582
583
584 func (e OutputConfigValidationError) Key() bool { return e.key }
585
586
587 func (e OutputConfigValidationError) ErrorName() string { return "OutputConfigValidationError" }
588
589
590 func (e OutputConfigValidationError) Error() string {
591 cause := ""
592 if e.cause != nil {
593 cause = fmt.Sprintf(" | caused by: %v", e.cause)
594 }
595
596 key := ""
597 if e.key {
598 key = "key for "
599 }
600
601 return fmt.Sprintf(
602 "invalid %sOutputConfig.%s: %s%s",
603 key,
604 e.field,
605 e.reason,
606 cause)
607 }
608
609 var _ error = OutputConfigValidationError{}
610
611 var _ interface {
612 Field() string
613 Reason() string
614 Key() bool
615 Cause() error
616 ErrorName() string
617 } = OutputConfigValidationError{}
618
619
620
621 func (m *OutputSink) Validate() error {
622 if m == nil {
623 return nil
624 }
625
626 if _, ok := OutputSink_Format_name[int32(m.GetFormat())]; !ok {
627 return OutputSinkValidationError{
628 field: "Format",
629 reason: "value must be one of the defined enum values",
630 }
631 }
632
633 switch m.OutputSinkType.(type) {
634
635 case *OutputSink_StreamingAdmin:
636
637 if v, ok := interface{}(m.GetStreamingAdmin()).(interface{ Validate() error }); ok {
638 if err := v.Validate(); err != nil {
639 return OutputSinkValidationError{
640 field: "StreamingAdmin",
641 reason: "embedded message failed validation",
642 cause: err,
643 }
644 }
645 }
646
647 case *OutputSink_FilePerTap:
648
649 if v, ok := interface{}(m.GetFilePerTap()).(interface{ Validate() error }); ok {
650 if err := v.Validate(); err != nil {
651 return OutputSinkValidationError{
652 field: "FilePerTap",
653 reason: "embedded message failed validation",
654 cause: err,
655 }
656 }
657 }
658
659 case *OutputSink_StreamingGrpc:
660
661 if v, ok := interface{}(m.GetStreamingGrpc()).(interface{ Validate() error }); ok {
662 if err := v.Validate(); err != nil {
663 return OutputSinkValidationError{
664 field: "StreamingGrpc",
665 reason: "embedded message failed validation",
666 cause: err,
667 }
668 }
669 }
670
671 default:
672 return OutputSinkValidationError{
673 field: "OutputSinkType",
674 reason: "value is required",
675 }
676
677 }
678
679 return nil
680 }
681
682
683
684 type OutputSinkValidationError struct {
685 field string
686 reason string
687 cause error
688 key bool
689 }
690
691
692 func (e OutputSinkValidationError) Field() string { return e.field }
693
694
695 func (e OutputSinkValidationError) Reason() string { return e.reason }
696
697
698 func (e OutputSinkValidationError) Cause() error { return e.cause }
699
700
701 func (e OutputSinkValidationError) Key() bool { return e.key }
702
703
704 func (e OutputSinkValidationError) ErrorName() string { return "OutputSinkValidationError" }
705
706
707 func (e OutputSinkValidationError) Error() string {
708 cause := ""
709 if e.cause != nil {
710 cause = fmt.Sprintf(" | caused by: %v", e.cause)
711 }
712
713 key := ""
714 if e.key {
715 key = "key for "
716 }
717
718 return fmt.Sprintf(
719 "invalid %sOutputSink.%s: %s%s",
720 key,
721 e.field,
722 e.reason,
723 cause)
724 }
725
726 var _ error = OutputSinkValidationError{}
727
728 var _ interface {
729 Field() string
730 Reason() string
731 Key() bool
732 Cause() error
733 ErrorName() string
734 } = OutputSinkValidationError{}
735
736
737
738
739 func (m *StreamingAdminSink) Validate() error {
740 if m == nil {
741 return nil
742 }
743
744 return nil
745 }
746
747
748
749 type StreamingAdminSinkValidationError struct {
750 field string
751 reason string
752 cause error
753 key bool
754 }
755
756
757 func (e StreamingAdminSinkValidationError) Field() string { return e.field }
758
759
760 func (e StreamingAdminSinkValidationError) Reason() string { return e.reason }
761
762
763 func (e StreamingAdminSinkValidationError) Cause() error { return e.cause }
764
765
766 func (e StreamingAdminSinkValidationError) Key() bool { return e.key }
767
768
769 func (e StreamingAdminSinkValidationError) ErrorName() string {
770 return "StreamingAdminSinkValidationError"
771 }
772
773
774 func (e StreamingAdminSinkValidationError) Error() string {
775 cause := ""
776 if e.cause != nil {
777 cause = fmt.Sprintf(" | caused by: %v", e.cause)
778 }
779
780 key := ""
781 if e.key {
782 key = "key for "
783 }
784
785 return fmt.Sprintf(
786 "invalid %sStreamingAdminSink.%s: %s%s",
787 key,
788 e.field,
789 e.reason,
790 cause)
791 }
792
793 var _ error = StreamingAdminSinkValidationError{}
794
795 var _ interface {
796 Field() string
797 Reason() string
798 Key() bool
799 Cause() error
800 ErrorName() string
801 } = StreamingAdminSinkValidationError{}
802
803
804
805
806 func (m *FilePerTapSink) Validate() error {
807 if m == nil {
808 return nil
809 }
810
811 if utf8.RuneCountInString(m.GetPathPrefix()) < 1 {
812 return FilePerTapSinkValidationError{
813 field: "PathPrefix",
814 reason: "value length must be at least 1 runes",
815 }
816 }
817
818 return nil
819 }
820
821
822
823 type FilePerTapSinkValidationError struct {
824 field string
825 reason string
826 cause error
827 key bool
828 }
829
830
831 func (e FilePerTapSinkValidationError) Field() string { return e.field }
832
833
834 func (e FilePerTapSinkValidationError) Reason() string { return e.reason }
835
836
837 func (e FilePerTapSinkValidationError) Cause() error { return e.cause }
838
839
840 func (e FilePerTapSinkValidationError) Key() bool { return e.key }
841
842
843 func (e FilePerTapSinkValidationError) ErrorName() string { return "FilePerTapSinkValidationError" }
844
845
846 func (e FilePerTapSinkValidationError) Error() string {
847 cause := ""
848 if e.cause != nil {
849 cause = fmt.Sprintf(" | caused by: %v", e.cause)
850 }
851
852 key := ""
853 if e.key {
854 key = "key for "
855 }
856
857 return fmt.Sprintf(
858 "invalid %sFilePerTapSink.%s: %s%s",
859 key,
860 e.field,
861 e.reason,
862 cause)
863 }
864
865 var _ error = FilePerTapSinkValidationError{}
866
867 var _ interface {
868 Field() string
869 Reason() string
870 Key() bool
871 Cause() error
872 ErrorName() string
873 } = FilePerTapSinkValidationError{}
874
875
876
877
878 func (m *StreamingGrpcSink) Validate() error {
879 if m == nil {
880 return nil
881 }
882
883
884
885 if m.GetGrpcService() == nil {
886 return StreamingGrpcSinkValidationError{
887 field: "GrpcService",
888 reason: "value is required",
889 }
890 }
891
892 if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok {
893 if err := v.Validate(); err != nil {
894 return StreamingGrpcSinkValidationError{
895 field: "GrpcService",
896 reason: "embedded message failed validation",
897 cause: err,
898 }
899 }
900 }
901
902 return nil
903 }
904
905
906
907 type StreamingGrpcSinkValidationError struct {
908 field string
909 reason string
910 cause error
911 key bool
912 }
913
914
915 func (e StreamingGrpcSinkValidationError) Field() string { return e.field }
916
917
918 func (e StreamingGrpcSinkValidationError) Reason() string { return e.reason }
919
920
921 func (e StreamingGrpcSinkValidationError) Cause() error { return e.cause }
922
923
924 func (e StreamingGrpcSinkValidationError) Key() bool { return e.key }
925
926
927 func (e StreamingGrpcSinkValidationError) ErrorName() string {
928 return "StreamingGrpcSinkValidationError"
929 }
930
931
932 func (e StreamingGrpcSinkValidationError) Error() string {
933 cause := ""
934 if e.cause != nil {
935 cause = fmt.Sprintf(" | caused by: %v", e.cause)
936 }
937
938 key := ""
939 if e.key {
940 key = "key for "
941 }
942
943 return fmt.Sprintf(
944 "invalid %sStreamingGrpcSink.%s: %s%s",
945 key,
946 e.field,
947 e.reason,
948 cause)
949 }
950
951 var _ error = StreamingGrpcSinkValidationError{}
952
953 var _ interface {
954 Field() string
955 Reason() string
956 Key() bool
957 Cause() error
958 ErrorName() string
959 } = StreamingGrpcSinkValidationError{}
960
961
962
963
964 func (m *MatchPredicate_MatchSet) Validate() error {
965 if m == nil {
966 return nil
967 }
968
969 if len(m.GetRules()) < 2 {
970 return MatchPredicate_MatchSetValidationError{
971 field: "Rules",
972 reason: "value must contain at least 2 item(s)",
973 }
974 }
975
976 for idx, item := range m.GetRules() {
977 _, _ = idx, item
978
979 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
980 if err := v.Validate(); err != nil {
981 return MatchPredicate_MatchSetValidationError{
982 field: fmt.Sprintf("Rules[%v]", idx),
983 reason: "embedded message failed validation",
984 cause: err,
985 }
986 }
987 }
988
989 }
990
991 return nil
992 }
993
994
995
996 type MatchPredicate_MatchSetValidationError struct {
997 field string
998 reason string
999 cause error
1000 key bool
1001 }
1002
1003
1004 func (e MatchPredicate_MatchSetValidationError) Field() string { return e.field }
1005
1006
1007 func (e MatchPredicate_MatchSetValidationError) Reason() string { return e.reason }
1008
1009
1010 func (e MatchPredicate_MatchSetValidationError) Cause() error { return e.cause }
1011
1012
1013 func (e MatchPredicate_MatchSetValidationError) Key() bool { return e.key }
1014
1015
1016 func (e MatchPredicate_MatchSetValidationError) ErrorName() string {
1017 return "MatchPredicate_MatchSetValidationError"
1018 }
1019
1020
1021 func (e MatchPredicate_MatchSetValidationError) Error() string {
1022 cause := ""
1023 if e.cause != nil {
1024 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1025 }
1026
1027 key := ""
1028 if e.key {
1029 key = "key for "
1030 }
1031
1032 return fmt.Sprintf(
1033 "invalid %sMatchPredicate_MatchSet.%s: %s%s",
1034 key,
1035 e.field,
1036 e.reason,
1037 cause)
1038 }
1039
1040 var _ error = MatchPredicate_MatchSetValidationError{}
1041
1042 var _ interface {
1043 Field() string
1044 Reason() string
1045 Key() bool
1046 Cause() error
1047 ErrorName() string
1048 } = MatchPredicate_MatchSetValidationError{}
1049
1050
1051
1052
1053 func (m *HttpGenericBodyMatch_GenericTextMatch) Validate() error {
1054 if m == nil {
1055 return nil
1056 }
1057
1058 switch m.Rule.(type) {
1059
1060 case *HttpGenericBodyMatch_GenericTextMatch_StringMatch:
1061
1062 if utf8.RuneCountInString(m.GetStringMatch()) < 1 {
1063 return HttpGenericBodyMatch_GenericTextMatchValidationError{
1064 field: "StringMatch",
1065 reason: "value length must be at least 1 runes",
1066 }
1067 }
1068
1069 case *HttpGenericBodyMatch_GenericTextMatch_BinaryMatch:
1070
1071 if len(m.GetBinaryMatch()) < 1 {
1072 return HttpGenericBodyMatch_GenericTextMatchValidationError{
1073 field: "BinaryMatch",
1074 reason: "value length must be at least 1 bytes",
1075 }
1076 }
1077
1078 default:
1079 return HttpGenericBodyMatch_GenericTextMatchValidationError{
1080 field: "Rule",
1081 reason: "value is required",
1082 }
1083
1084 }
1085
1086 return nil
1087 }
1088
1089
1090
1091
1092 type HttpGenericBodyMatch_GenericTextMatchValidationError struct {
1093 field string
1094 reason string
1095 cause error
1096 key bool
1097 }
1098
1099
1100 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Field() string { return e.field }
1101
1102
1103 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Reason() string { return e.reason }
1104
1105
1106 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Cause() error { return e.cause }
1107
1108
1109 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Key() bool { return e.key }
1110
1111
1112 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) ErrorName() string {
1113 return "HttpGenericBodyMatch_GenericTextMatchValidationError"
1114 }
1115
1116
1117 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Error() string {
1118 cause := ""
1119 if e.cause != nil {
1120 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1121 }
1122
1123 key := ""
1124 if e.key {
1125 key = "key for "
1126 }
1127
1128 return fmt.Sprintf(
1129 "invalid %sHttpGenericBodyMatch_GenericTextMatch.%s: %s%s",
1130 key,
1131 e.field,
1132 e.reason,
1133 cause)
1134 }
1135
1136 var _ error = HttpGenericBodyMatch_GenericTextMatchValidationError{}
1137
1138 var _ interface {
1139 Field() string
1140 Reason() string
1141 Key() bool
1142 Cause() error
1143 ErrorName() string
1144 } = HttpGenericBodyMatch_GenericTextMatchValidationError{}
1145
View as plain text