Debian Codegraph @

envoy/service/tap/v2alpha/common.pb.validate.go

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