1
2
3
4 package envoy_service_tap_v2alpha
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 m.GetMatchConfig() == nil {
44 return TapConfigValidationError{
45 field: "MatchConfig",
46 reason: "value is required",
47 }
48 }
49
50 if v, ok := interface{}(m.GetMatchConfig()).(interface{ Validate() error }); ok {
51 if err := v.Validate(); err != nil {
52 return TapConfigValidationError{
53 field: "MatchConfig",
54 reason: "embedded message failed validation",
55 cause: err,
56 }
57 }
58 }
59
60 if m.GetOutputConfig() == nil {
61 return TapConfigValidationError{
62 field: "OutputConfig",
63 reason: "value is required",
64 }
65 }
66
67 if v, ok := interface{}(m.GetOutputConfig()).(interface{ Validate() error }); ok {
68 if err := v.Validate(); err != nil {
69 return TapConfigValidationError{
70 field: "OutputConfig",
71 reason: "embedded message failed validation",
72 cause: err,
73 }
74 }
75 }
76
77 if v, ok := interface{}(m.GetTapEnabled()).(interface{ Validate() error }); ok {
78 if err := v.Validate(); err != nil {
79 return TapConfigValidationError{
80 field: "TapEnabled",
81 reason: "embedded message failed validation",
82 cause: err,
83 }
84 }
85 }
86
87 return nil
88 }
89
90
91
92 type TapConfigValidationError struct {
93 field string
94 reason string
95 cause error
96 key bool
97 }
98
99
100 func (e TapConfigValidationError) Field() string { return e.field }
101
102
103 func (e TapConfigValidationError) Reason() string { return e.reason }
104
105
106 func (e TapConfigValidationError) Cause() error { return e.cause }
107
108
109 func (e TapConfigValidationError) Key() bool { return e.key }
110
111
112 func (e TapConfigValidationError) ErrorName() string { return "TapConfigValidationError" }
113
114
115 func (e TapConfigValidationError) 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 %sTapConfig.%s: %s%s",
128 key,
129 e.field,
130 e.reason,
131 cause)
132 }
133
134 var _ error = TapConfigValidationError{}
135
136 var _ interface {
137 Field() string
138 Reason() string
139 Key() bool
140 Cause() error
141 ErrorName() string
142 } = TapConfigValidationError{}
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 default:
248 return MatchPredicateValidationError{
249 field: "Rule",
250 reason: "value is required",
251 }
252
253 }
254
255 return nil
256 }
257
258
259
260 type MatchPredicateValidationError struct {
261 field string
262 reason string
263 cause error
264 key bool
265 }
266
267
268 func (e MatchPredicateValidationError) Field() string { return e.field }
269
270
271 func (e MatchPredicateValidationError) Reason() string { return e.reason }
272
273
274 func (e MatchPredicateValidationError) Cause() error { return e.cause }
275
276
277 func (e MatchPredicateValidationError) Key() bool { return e.key }
278
279
280 func (e MatchPredicateValidationError) ErrorName() string { return "MatchPredicateValidationError" }
281
282
283 func (e MatchPredicateValidationError) Error() string {
284 cause := ""
285 if e.cause != nil {
286 cause = fmt.Sprintf(" | caused by: %v", e.cause)
287 }
288
289 key := ""
290 if e.key {
291 key = "key for "
292 }
293
294 return fmt.Sprintf(
295 "invalid %sMatchPredicate.%s: %s%s",
296 key,
297 e.field,
298 e.reason,
299 cause)
300 }
301
302 var _ error = MatchPredicateValidationError{}
303
304 var _ interface {
305 Field() string
306 Reason() string
307 Key() bool
308 Cause() error
309 ErrorName() string
310 } = MatchPredicateValidationError{}
311
312
313
314
315 func (m *HttpHeadersMatch) Validate() error {
316 if m == nil {
317 return nil
318 }
319
320 for idx, item := range m.GetHeaders() {
321 _, _ = idx, item
322
323 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
324 if err := v.Validate(); err != nil {
325 return HttpHeadersMatchValidationError{
326 field: fmt.Sprintf("Headers[%v]", idx),
327 reason: "embedded message failed validation",
328 cause: err,
329 }
330 }
331 }
332
333 }
334
335 return nil
336 }
337
338
339
340 type HttpHeadersMatchValidationError struct {
341 field string
342 reason string
343 cause error
344 key bool
345 }
346
347
348 func (e HttpHeadersMatchValidationError) Field() string { return e.field }
349
350
351 func (e HttpHeadersMatchValidationError) Reason() string { return e.reason }
352
353
354 func (e HttpHeadersMatchValidationError) Cause() error { return e.cause }
355
356
357 func (e HttpHeadersMatchValidationError) Key() bool { return e.key }
358
359
360 func (e HttpHeadersMatchValidationError) ErrorName() string { return "HttpHeadersMatchValidationError" }
361
362
363 func (e HttpHeadersMatchValidationError) Error() string {
364 cause := ""
365 if e.cause != nil {
366 cause = fmt.Sprintf(" | caused by: %v", e.cause)
367 }
368
369 key := ""
370 if e.key {
371 key = "key for "
372 }
373
374 return fmt.Sprintf(
375 "invalid %sHttpHeadersMatch.%s: %s%s",
376 key,
377 e.field,
378 e.reason,
379 cause)
380 }
381
382 var _ error = HttpHeadersMatchValidationError{}
383
384 var _ interface {
385 Field() string
386 Reason() string
387 Key() bool
388 Cause() error
389 ErrorName() string
390 } = HttpHeadersMatchValidationError{}
391
392
393
394
395 func (m *OutputConfig) Validate() error {
396 if m == nil {
397 return nil
398 }
399
400 if len(m.GetSinks()) != 1 {
401 return OutputConfigValidationError{
402 field: "Sinks",
403 reason: "value must contain exactly 1 item(s)",
404 }
405 }
406
407 for idx, item := range m.GetSinks() {
408 _, _ = idx, item
409
410 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
411 if err := v.Validate(); err != nil {
412 return OutputConfigValidationError{
413 field: fmt.Sprintf("Sinks[%v]", idx),
414 reason: "embedded message failed validation",
415 cause: err,
416 }
417 }
418 }
419
420 }
421
422 if v, ok := interface{}(m.GetMaxBufferedRxBytes()).(interface{ Validate() error }); ok {
423 if err := v.Validate(); err != nil {
424 return OutputConfigValidationError{
425 field: "MaxBufferedRxBytes",
426 reason: "embedded message failed validation",
427 cause: err,
428 }
429 }
430 }
431
432 if v, ok := interface{}(m.GetMaxBufferedTxBytes()).(interface{ Validate() error }); ok {
433 if err := v.Validate(); err != nil {
434 return OutputConfigValidationError{
435 field: "MaxBufferedTxBytes",
436 reason: "embedded message failed validation",
437 cause: err,
438 }
439 }
440 }
441
442
443
444 return nil
445 }
446
447
448
449 type OutputConfigValidationError struct {
450 field string
451 reason string
452 cause error
453 key bool
454 }
455
456
457 func (e OutputConfigValidationError) Field() string { return e.field }
458
459
460 func (e OutputConfigValidationError) Reason() string { return e.reason }
461
462
463 func (e OutputConfigValidationError) Cause() error { return e.cause }
464
465
466 func (e OutputConfigValidationError) Key() bool { return e.key }
467
468
469 func (e OutputConfigValidationError) ErrorName() string { return "OutputConfigValidationError" }
470
471
472 func (e OutputConfigValidationError) Error() string {
473 cause := ""
474 if e.cause != nil {
475 cause = fmt.Sprintf(" | caused by: %v", e.cause)
476 }
477
478 key := ""
479 if e.key {
480 key = "key for "
481 }
482
483 return fmt.Sprintf(
484 "invalid %sOutputConfig.%s: %s%s",
485 key,
486 e.field,
487 e.reason,
488 cause)
489 }
490
491 var _ error = OutputConfigValidationError{}
492
493 var _ interface {
494 Field() string
495 Reason() string
496 Key() bool
497 Cause() error
498 ErrorName() string
499 } = OutputConfigValidationError{}
500
501
502
503 func (m *OutputSink) Validate() error {
504 if m == nil {
505 return nil
506 }
507
508 if _, ok := OutputSink_Format_name[int32(m.GetFormat())]; !ok {
509 return OutputSinkValidationError{
510 field: "Format",
511 reason: "value must be one of the defined enum values",
512 }
513 }
514
515 switch m.OutputSinkType.(type) {
516
517 case *OutputSink_StreamingAdmin:
518
519 if v, ok := interface{}(m.GetStreamingAdmin()).(interface{ Validate() error }); ok {
520 if err := v.Validate(); err != nil {
521 return OutputSinkValidationError{
522 field: "StreamingAdmin",
523 reason: "embedded message failed validation",
524 cause: err,
525 }
526 }
527 }
528
529 case *OutputSink_FilePerTap:
530
531 if v, ok := interface{}(m.GetFilePerTap()).(interface{ Validate() error }); ok {
532 if err := v.Validate(); err != nil {
533 return OutputSinkValidationError{
534 field: "FilePerTap",
535 reason: "embedded message failed validation",
536 cause: err,
537 }
538 }
539 }
540
541 case *OutputSink_StreamingGrpc:
542
543 if v, ok := interface{}(m.GetStreamingGrpc()).(interface{ Validate() error }); ok {
544 if err := v.Validate(); err != nil {
545 return OutputSinkValidationError{
546 field: "StreamingGrpc",
547 reason: "embedded message failed validation",
548 cause: err,
549 }
550 }
551 }
552
553 default:
554 return OutputSinkValidationError{
555 field: "OutputSinkType",
556 reason: "value is required",
557 }
558
559 }
560
561 return nil
562 }
563
564
565
566 type OutputSinkValidationError struct {
567 field string
568 reason string
569 cause error
570 key bool
571 }
572
573
574 func (e OutputSinkValidationError) Field() string { return e.field }
575
576
577 func (e OutputSinkValidationError) Reason() string { return e.reason }
578
579
580 func (e OutputSinkValidationError) Cause() error { return e.cause }
581
582
583 func (e OutputSinkValidationError) Key() bool { return e.key }
584
585
586 func (e OutputSinkValidationError) ErrorName() string { return "OutputSinkValidationError" }
587
588
589 func (e OutputSinkValidationError) Error() string {
590 cause := ""
591 if e.cause != nil {
592 cause = fmt.Sprintf(" | caused by: %v", e.cause)
593 }
594
595 key := ""
596 if e.key {
597 key = "key for "
598 }
599
600 return fmt.Sprintf(
601 "invalid %sOutputSink.%s: %s%s",
602 key,
603 e.field,
604 e.reason,
605 cause)
606 }
607
608 var _ error = OutputSinkValidationError{}
609
610 var _ interface {
611 Field() string
612 Reason() string
613 Key() bool
614 Cause() error
615 ErrorName() string
616 } = OutputSinkValidationError{}
617
618
619
620
621 func (m *StreamingAdminSink) Validate() error {
622 if m == nil {
623 return nil
624 }
625
626 return nil
627 }
628
629
630
631 type StreamingAdminSinkValidationError struct {
632 field string
633 reason string
634 cause error
635 key bool
636 }
637
638
639 func (e StreamingAdminSinkValidationError) Field() string { return e.field }
640
641
642 func (e StreamingAdminSinkValidationError) Reason() string { return e.reason }
643
644
645 func (e StreamingAdminSinkValidationError) Cause() error { return e.cause }
646
647
648 func (e StreamingAdminSinkValidationError) Key() bool { return e.key }
649
650
651 func (e StreamingAdminSinkValidationError) ErrorName() string {
652 return "StreamingAdminSinkValidationError"
653 }
654
655
656 func (e StreamingAdminSinkValidationError) Error() string {
657 cause := ""
658 if e.cause != nil {
659 cause = fmt.Sprintf(" | caused by: %v", e.cause)
660 }
661
662 key := ""
663 if e.key {
664 key = "key for "
665 }
666
667 return fmt.Sprintf(
668 "invalid %sStreamingAdminSink.%s: %s%s",
669 key,
670 e.field,
671 e.reason,
672 cause)
673 }
674
675 var _ error = StreamingAdminSinkValidationError{}
676
677 var _ interface {
678 Field() string
679 Reason() string
680 Key() bool
681 Cause() error
682 ErrorName() string
683 } = StreamingAdminSinkValidationError{}
684
685
686
687
688 func (m *FilePerTapSink) Validate() error {
689 if m == nil {
690 return nil
691 }
692
693 if len(m.GetPathPrefix()) < 1 {
694 return FilePerTapSinkValidationError{
695 field: "PathPrefix",
696 reason: "value length must be at least 1 bytes",
697 }
698 }
699
700 return nil
701 }
702
703
704
705 type FilePerTapSinkValidationError struct {
706 field string
707 reason string
708 cause error
709 key bool
710 }
711
712
713 func (e FilePerTapSinkValidationError) Field() string { return e.field }
714
715
716 func (e FilePerTapSinkValidationError) Reason() string { return e.reason }
717
718
719 func (e FilePerTapSinkValidationError) Cause() error { return e.cause }
720
721
722 func (e FilePerTapSinkValidationError) Key() bool { return e.key }
723
724
725 func (e FilePerTapSinkValidationError) ErrorName() string { return "FilePerTapSinkValidationError" }
726
727
728 func (e FilePerTapSinkValidationError) Error() string {
729 cause := ""
730 if e.cause != nil {
731 cause = fmt.Sprintf(" | caused by: %v", e.cause)
732 }
733
734 key := ""
735 if e.key {
736 key = "key for "
737 }
738
739 return fmt.Sprintf(
740 "invalid %sFilePerTapSink.%s: %s%s",
741 key,
742 e.field,
743 e.reason,
744 cause)
745 }
746
747 var _ error = FilePerTapSinkValidationError{}
748
749 var _ interface {
750 Field() string
751 Reason() string
752 Key() bool
753 Cause() error
754 ErrorName() string
755 } = FilePerTapSinkValidationError{}
756
757
758
759
760 func (m *StreamingGrpcSink) Validate() error {
761 if m == nil {
762 return nil
763 }
764
765
766
767 if m.GetGrpcService() == nil {
768 return StreamingGrpcSinkValidationError{
769 field: "GrpcService",
770 reason: "value is required",
771 }
772 }
773
774 if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok {
775 if err := v.Validate(); err != nil {
776 return StreamingGrpcSinkValidationError{
777 field: "GrpcService",
778 reason: "embedded message failed validation",
779 cause: err,
780 }
781 }
782 }
783
784 return nil
785 }
786
787
788
789 type StreamingGrpcSinkValidationError struct {
790 field string
791 reason string
792 cause error
793 key bool
794 }
795
796
797 func (e StreamingGrpcSinkValidationError) Field() string { return e.field }
798
799
800 func (e StreamingGrpcSinkValidationError) Reason() string { return e.reason }
801
802
803 func (e StreamingGrpcSinkValidationError) Cause() error { return e.cause }
804
805
806 func (e StreamingGrpcSinkValidationError) Key() bool { return e.key }
807
808
809 func (e StreamingGrpcSinkValidationError) ErrorName() string {
810 return "StreamingGrpcSinkValidationError"
811 }
812
813
814 func (e StreamingGrpcSinkValidationError) Error() string {
815 cause := ""
816 if e.cause != nil {
817 cause = fmt.Sprintf(" | caused by: %v", e.cause)
818 }
819
820 key := ""
821 if e.key {
822 key = "key for "
823 }
824
825 return fmt.Sprintf(
826 "invalid %sStreamingGrpcSink.%s: %s%s",
827 key,
828 e.field,
829 e.reason,
830 cause)
831 }
832
833 var _ error = StreamingGrpcSinkValidationError{}
834
835 var _ interface {
836 Field() string
837 Reason() string
838 Key() bool
839 Cause() error
840 ErrorName() string
841 } = StreamingGrpcSinkValidationError{}
842
843
844
845
846 func (m *MatchPredicate_MatchSet) Validate() error {
847 if m == nil {
848 return nil
849 }
850
851 if len(m.GetRules()) < 2 {
852 return MatchPredicate_MatchSetValidationError{
853 field: "Rules",
854 reason: "value must contain at least 2 item(s)",
855 }
856 }
857
858 for idx, item := range m.GetRules() {
859 _, _ = idx, item
860
861 if v, ok := interface{}(item).(interface{ Validate() error }); ok {
862 if err := v.Validate(); err != nil {
863 return MatchPredicate_MatchSetValidationError{
864 field: fmt.Sprintf("Rules[%v]", idx),
865 reason: "embedded message failed validation",
866 cause: err,
867 }
868 }
869 }
870
871 }
872
873 return nil
874 }
875
876
877
878 type MatchPredicate_MatchSetValidationError struct {
879 field string
880 reason string
881 cause error
882 key bool
883 }
884
885
886 func (e MatchPredicate_MatchSetValidationError) Field() string { return e.field }
887
888
889 func (e MatchPredicate_MatchSetValidationError) Reason() string { return e.reason }
890
891
892 func (e MatchPredicate_MatchSetValidationError) Cause() error { return e.cause }
893
894
895 func (e MatchPredicate_MatchSetValidationError) Key() bool { return e.key }
896
897
898 func (e MatchPredicate_MatchSetValidationError) ErrorName() string {
899 return "MatchPredicate_MatchSetValidationError"
900 }
901
902
903 func (e MatchPredicate_MatchSetValidationError) Error() string {
904 cause := ""
905 if e.cause != nil {
906 cause = fmt.Sprintf(" | caused by: %v", e.cause)
907 }
908
909 key := ""
910 if e.key {
911 key = "key for "
912 }
913
914 return fmt.Sprintf(
915 "invalid %sMatchPredicate_MatchSet.%s: %s%s",
916 key,
917 e.field,
918 e.reason,
919 cause)
920 }
921
922 var _ error = MatchPredicate_MatchSetValidationError{}
923
924 var _ interface {
925 Field() string
926 Reason() string
927 Key() bool
928 Cause() error
929 ErrorName() string
930 } = MatchPredicate_MatchSetValidationError{}
931
View as plain text