Debian Codegraph @

envoy/config/filter/accesslog/v2/accesslog.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/config/filter/accesslog/v2/accesslog.proto
4
5 package accesslogv2
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 AccessLog 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 *AccessLog) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on AccessLog 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 AccessLogMultiError, or nil
49 // if none found.
50 func (m *AccessLog) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *AccessLog) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 // no validation rules for Name
62
63 if all {
64 switch v := interface{}(m.GetFilter()).(type) {
65 case interface{ ValidateAll() error }:
66 if err := v.ValidateAll(); err != nil {
67 errors = append(errors, AccessLogValidationError{
68 field: "Filter",
69 reason: "embedded message failed validation",
70 cause: err,
71 })
72 }
73 case interface{ Validate() error }:
74 if err := v.Validate(); err != nil {
75 errors = append(errors, AccessLogValidationError{
76 field: "Filter",
77 reason: "embedded message failed validation",
78 cause: err,
79 })
80 }
81 }
82 } else if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok {
83 if err := v.Validate(); err != nil {
84 return AccessLogValidationError{
85 field: "Filter",
86 reason: "embedded message failed validation",
87 cause: err,
88 }
89 }
90 }
91
92 switch v := m.ConfigType.(type) {
93 case *AccessLog_Config:
94 if v == nil {
95 err := AccessLogValidationError{
96 field: "ConfigType",
97 reason: "oneof value cannot be a typed-nil",
98 }
99 if !all {
100 return err
101 }
102 errors = append(errors, err)
103 }
104
105 if all {
106 switch v := interface{}(m.GetConfig()).(type) {
107 case interface{ ValidateAll() error }:
108 if err := v.ValidateAll(); err != nil {
109 errors = append(errors, AccessLogValidationError{
110 field: "Config",
111 reason: "embedded message failed validation",
112 cause: err,
113 })
114 }
115 case interface{ Validate() error }:
116 if err := v.Validate(); err != nil {
117 errors = append(errors, AccessLogValidationError{
118 field: "Config",
119 reason: "embedded message failed validation",
120 cause: err,
121 })
122 }
123 }
124 } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
125 if err := v.Validate(); err != nil {
126 return AccessLogValidationError{
127 field: "Config",
128 reason: "embedded message failed validation",
129 cause: err,
130 }
131 }
132 }
133
134 case *AccessLog_TypedConfig:
135 if v == nil {
136 err := AccessLogValidationError{
137 field: "ConfigType",
138 reason: "oneof value cannot be a typed-nil",
139 }
140 if !all {
141 return err
142 }
143 errors = append(errors, err)
144 }
145
146 if all {
147 switch v := interface{}(m.GetTypedConfig()).(type) {
148 case interface{ ValidateAll() error }:
149 if err := v.ValidateAll(); err != nil {
150 errors = append(errors, AccessLogValidationError{
151 field: "TypedConfig",
152 reason: "embedded message failed validation",
153 cause: err,
154 })
155 }
156 case interface{ Validate() error }:
157 if err := v.Validate(); err != nil {
158 errors = append(errors, AccessLogValidationError{
159 field: "TypedConfig",
160 reason: "embedded message failed validation",
161 cause: err,
162 })
163 }
164 }
165 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
166 if err := v.Validate(); err != nil {
167 return AccessLogValidationError{
168 field: "TypedConfig",
169 reason: "embedded message failed validation",
170 cause: err,
171 }
172 }
173 }
174
175 default:
176 _ = v // ensures v is used
177 }
178
179 if len(errors) > 0 {
180 return AccessLogMultiError(errors)
181 }
182
183 return nil
184 }
185
186 // AccessLogMultiError is an error wrapping multiple validation errors returned
187 // by AccessLog.ValidateAll() if the designated constraints aren't met.
188 type AccessLogMultiError []error
189
190 // Error returns a concatenation of all the error messages it wraps.
191 func (m AccessLogMultiError) Error() string {
192 var msgs []string
193 for _, err := range m {
194 msgs = append(msgs, err.Error())
195 }
196 return strings.Join(msgs, "; ")
197 }
198
199 // AllErrors returns a list of validation violation errors.
200 func (m AccessLogMultiError) AllErrors() []error { return m }
201
202 // AccessLogValidationError is the validation error returned by
203 // AccessLog.Validate if the designated constraints aren't met.
204 type AccessLogValidationError struct {
205 field string
206 reason string
207 cause error
208 key bool
209 }
210
211 // Field function returns field value.
212 func (e AccessLogValidationError) Field() string { return e.field }
213
214 // Reason function returns reason value.
215 func (e AccessLogValidationError) Reason() string { return e.reason }
216
217 // Cause function returns cause value.
218 func (e AccessLogValidationError) Cause() error { return e.cause }
219
220 // Key function returns key value.
221 func (e AccessLogValidationError) Key() bool { return e.key }
222
223 // ErrorName returns error name.
224 func (e AccessLogValidationError) ErrorName() string { return "AccessLogValidationError" }
225
226 // Error satisfies the builtin error interface
227 func (e AccessLogValidationError) Error() string {
228 cause := ""
229 if e.cause != nil {
230 cause = fmt.Sprintf(" | caused by: %v", e.cause)
231 }
232
233 key := ""
234 if e.key {
235 key = "key for "
236 }
237
238 return fmt.Sprintf(
239 "invalid %sAccessLog.%s: %s%s",
240 key,
241 e.field,
242 e.reason,
243 cause)
244 }
245
246 var _ error = AccessLogValidationError{}
247
248 var _ interface {
249 Field() string
250 Reason() string
251 Key() bool
252 Cause() error
253 ErrorName() string
254 } = AccessLogValidationError{}
255
256 // Validate checks the field values on AccessLogFilter with the rules defined
257 // in the proto definition for this message. If any rules are violated, the
258 // first error encountered is returned, or nil if there are no violations.
259 func (m *AccessLogFilter) Validate() error {
260 return m.validate(false)
261 }
262
263 // ValidateAll checks the field values on AccessLogFilter with the rules
264 // defined in the proto definition for this message. If any rules are
265 // violated, the result is a list of violation errors wrapped in
266 // AccessLogFilterMultiError, or nil if none found.
267 func (m *AccessLogFilter) ValidateAll() error {
268 return m.validate(true)
269 }
270
271 func (m *AccessLogFilter) validate(all bool) error {
272 if m == nil {
273 return nil
274 }
275
276 var errors []error
277
278 oneofFilterSpecifierPresent := false
279 switch v := m.FilterSpecifier.(type) {
280 case *AccessLogFilter_StatusCodeFilter:
281 if v == nil {
282 err := AccessLogFilterValidationError{
283 field: "FilterSpecifier",
284 reason: "oneof value cannot be a typed-nil",
285 }
286 if !all {
287 return err
288 }
289 errors = append(errors, err)
290 }
291 oneofFilterSpecifierPresent = true
292
293 if all {
294 switch v := interface{}(m.GetStatusCodeFilter()).(type) {
295 case interface{ ValidateAll() error }:
296 if err := v.ValidateAll(); err != nil {
297 errors = append(errors, AccessLogFilterValidationError{
298 field: "StatusCodeFilter",
299 reason: "embedded message failed validation",
300 cause: err,
301 })
302 }
303 case interface{ Validate() error }:
304 if err := v.Validate(); err != nil {
305 errors = append(errors, AccessLogFilterValidationError{
306 field: "StatusCodeFilter",
307 reason: "embedded message failed validation",
308 cause: err,
309 })
310 }
311 }
312 } else if v, ok := interface{}(m.GetStatusCodeFilter()).(interface{ Validate() error }); ok {
313 if err := v.Validate(); err != nil {
314 return AccessLogFilterValidationError{
315 field: "StatusCodeFilter",
316 reason: "embedded message failed validation",
317 cause: err,
318 }
319 }
320 }
321
322 case *AccessLogFilter_DurationFilter:
323 if v == nil {
324 err := AccessLogFilterValidationError{
325 field: "FilterSpecifier",
326 reason: "oneof value cannot be a typed-nil",
327 }
328 if !all {
329 return err
330 }
331 errors = append(errors, err)
332 }
333 oneofFilterSpecifierPresent = true
334
335 if all {
336 switch v := interface{}(m.GetDurationFilter()).(type) {
337 case interface{ ValidateAll() error }:
338 if err := v.ValidateAll(); err != nil {
339 errors = append(errors, AccessLogFilterValidationError{
340 field: "DurationFilter",
341 reason: "embedded message failed validation",
342 cause: err,
343 })
344 }
345 case interface{ Validate() error }:
346 if err := v.Validate(); err != nil {
347 errors = append(errors, AccessLogFilterValidationError{
348 field: "DurationFilter",
349 reason: "embedded message failed validation",
350 cause: err,
351 })
352 }
353 }
354 } else if v, ok := interface{}(m.GetDurationFilter()).(interface{ Validate() error }); ok {
355 if err := v.Validate(); err != nil {
356 return AccessLogFilterValidationError{
357 field: "DurationFilter",
358 reason: "embedded message failed validation",
359 cause: err,
360 }
361 }
362 }
363
364 case *AccessLogFilter_NotHealthCheckFilter:
365 if v == nil {
366 err := AccessLogFilterValidationError{
367 field: "FilterSpecifier",
368 reason: "oneof value cannot be a typed-nil",
369 }
370 if !all {
371 return err
372 }
373 errors = append(errors, err)
374 }
375 oneofFilterSpecifierPresent = true
376
377 if all {
378 switch v := interface{}(m.GetNotHealthCheckFilter()).(type) {
379 case interface{ ValidateAll() error }:
380 if err := v.ValidateAll(); err != nil {
381 errors = append(errors, AccessLogFilterValidationError{
382 field: "NotHealthCheckFilter",
383 reason: "embedded message failed validation",
384 cause: err,
385 })
386 }
387 case interface{ Validate() error }:
388 if err := v.Validate(); err != nil {
389 errors = append(errors, AccessLogFilterValidationError{
390 field: "NotHealthCheckFilter",
391 reason: "embedded message failed validation",
392 cause: err,
393 })
394 }
395 }
396 } else if v, ok := interface{}(m.GetNotHealthCheckFilter()).(interface{ Validate() error }); ok {
397 if err := v.Validate(); err != nil {
398 return AccessLogFilterValidationError{
399 field: "NotHealthCheckFilter",
400 reason: "embedded message failed validation",
401 cause: err,
402 }
403 }
404 }
405
406 case *AccessLogFilter_TraceableFilter:
407 if v == nil {
408 err := AccessLogFilterValidationError{
409 field: "FilterSpecifier",
410 reason: "oneof value cannot be a typed-nil",
411 }
412 if !all {
413 return err
414 }
415 errors = append(errors, err)
416 }
417 oneofFilterSpecifierPresent = true
418
419 if all {
420 switch v := interface{}(m.GetTraceableFilter()).(type) {
421 case interface{ ValidateAll() error }:
422 if err := v.ValidateAll(); err != nil {
423 errors = append(errors, AccessLogFilterValidationError{
424 field: "TraceableFilter",
425 reason: "embedded message failed validation",
426 cause: err,
427 })
428 }
429 case interface{ Validate() error }:
430 if err := v.Validate(); err != nil {
431 errors = append(errors, AccessLogFilterValidationError{
432 field: "TraceableFilter",
433 reason: "embedded message failed validation",
434 cause: err,
435 })
436 }
437 }
438 } else if v, ok := interface{}(m.GetTraceableFilter()).(interface{ Validate() error }); ok {
439 if err := v.Validate(); err != nil {
440 return AccessLogFilterValidationError{
441 field: "TraceableFilter",
442 reason: "embedded message failed validation",
443 cause: err,
444 }
445 }
446 }
447
448 case *AccessLogFilter_RuntimeFilter:
449 if v == nil {
450 err := AccessLogFilterValidationError{
451 field: "FilterSpecifier",
452 reason: "oneof value cannot be a typed-nil",
453 }
454 if !all {
455 return err
456 }
457 errors = append(errors, err)
458 }
459 oneofFilterSpecifierPresent = true
460
461 if all {
462 switch v := interface{}(m.GetRuntimeFilter()).(type) {
463 case interface{ ValidateAll() error }:
464 if err := v.ValidateAll(); err != nil {
465 errors = append(errors, AccessLogFilterValidationError{
466 field: "RuntimeFilter",
467 reason: "embedded message failed validation",
468 cause: err,
469 })
470 }
471 case interface{ Validate() error }:
472 if err := v.Validate(); err != nil {
473 errors = append(errors, AccessLogFilterValidationError{
474 field: "RuntimeFilter",
475 reason: "embedded message failed validation",
476 cause: err,
477 })
478 }
479 }
480 } else if v, ok := interface{}(m.GetRuntimeFilter()).(interface{ Validate() error }); ok {
481 if err := v.Validate(); err != nil {
482 return AccessLogFilterValidationError{
483 field: "RuntimeFilter",
484 reason: "embedded message failed validation",
485 cause: err,
486 }
487 }
488 }
489
490 case *AccessLogFilter_AndFilter:
491 if v == nil {
492 err := AccessLogFilterValidationError{
493 field: "FilterSpecifier",
494 reason: "oneof value cannot be a typed-nil",
495 }
496 if !all {
497 return err
498 }
499 errors = append(errors, err)
500 }
501 oneofFilterSpecifierPresent = true
502
503 if all {
504 switch v := interface{}(m.GetAndFilter()).(type) {
505 case interface{ ValidateAll() error }:
506 if err := v.ValidateAll(); err != nil {
507 errors = append(errors, AccessLogFilterValidationError{
508 field: "AndFilter",
509 reason: "embedded message failed validation",
510 cause: err,
511 })
512 }
513 case interface{ Validate() error }:
514 if err := v.Validate(); err != nil {
515 errors = append(errors, AccessLogFilterValidationError{
516 field: "AndFilter",
517 reason: "embedded message failed validation",
518 cause: err,
519 })
520 }
521 }
522 } else if v, ok := interface{}(m.GetAndFilter()).(interface{ Validate() error }); ok {
523 if err := v.Validate(); err != nil {
524 return AccessLogFilterValidationError{
525 field: "AndFilter",
526 reason: "embedded message failed validation",
527 cause: err,
528 }
529 }
530 }
531
532 case *AccessLogFilter_OrFilter:
533 if v == nil {
534 err := AccessLogFilterValidationError{
535 field: "FilterSpecifier",
536 reason: "oneof value cannot be a typed-nil",
537 }
538 if !all {
539 return err
540 }
541 errors = append(errors, err)
542 }
543 oneofFilterSpecifierPresent = true
544
545 if all {
546 switch v := interface{}(m.GetOrFilter()).(type) {
547 case interface{ ValidateAll() error }:
548 if err := v.ValidateAll(); err != nil {
549 errors = append(errors, AccessLogFilterValidationError{
550 field: "OrFilter",
551 reason: "embedded message failed validation",
552 cause: err,
553 })
554 }
555 case interface{ Validate() error }:
556 if err := v.Validate(); err != nil {
557 errors = append(errors, AccessLogFilterValidationError{
558 field: "OrFilter",
559 reason: "embedded message failed validation",
560 cause: err,
561 })
562 }
563 }
564 } else if v, ok := interface{}(m.GetOrFilter()).(interface{ Validate() error }); ok {
565 if err := v.Validate(); err != nil {
566 return AccessLogFilterValidationError{
567 field: "OrFilter",
568 reason: "embedded message failed validation",
569 cause: err,
570 }
571 }
572 }
573
574 case *AccessLogFilter_HeaderFilter:
575 if v == nil {
576 err := AccessLogFilterValidationError{
577 field: "FilterSpecifier",
578 reason: "oneof value cannot be a typed-nil",
579 }
580 if !all {
581 return err
582 }
583 errors = append(errors, err)
584 }
585 oneofFilterSpecifierPresent = true
586
587 if all {
588 switch v := interface{}(m.GetHeaderFilter()).(type) {
589 case interface{ ValidateAll() error }:
590 if err := v.ValidateAll(); err != nil {
591 errors = append(errors, AccessLogFilterValidationError{
592 field: "HeaderFilter",
593 reason: "embedded message failed validation",
594 cause: err,
595 })
596 }
597 case interface{ Validate() error }:
598 if err := v.Validate(); err != nil {
599 errors = append(errors, AccessLogFilterValidationError{
600 field: "HeaderFilter",
601 reason: "embedded message failed validation",
602 cause: err,
603 })
604 }
605 }
606 } else if v, ok := interface{}(m.GetHeaderFilter()).(interface{ Validate() error }); ok {
607 if err := v.Validate(); err != nil {
608 return AccessLogFilterValidationError{
609 field: "HeaderFilter",
610 reason: "embedded message failed validation",
611 cause: err,
612 }
613 }
614 }
615
616 case *AccessLogFilter_ResponseFlagFilter:
617 if v == nil {
618 err := AccessLogFilterValidationError{
619 field: "FilterSpecifier",
620 reason: "oneof value cannot be a typed-nil",
621 }
622 if !all {
623 return err
624 }
625 errors = append(errors, err)
626 }
627 oneofFilterSpecifierPresent = true
628
629 if all {
630 switch v := interface{}(m.GetResponseFlagFilter()).(type) {
631 case interface{ ValidateAll() error }:
632 if err := v.ValidateAll(); err != nil {
633 errors = append(errors, AccessLogFilterValidationError{
634 field: "ResponseFlagFilter",
635 reason: "embedded message failed validation",
636 cause: err,
637 })
638 }
639 case interface{ Validate() error }:
640 if err := v.Validate(); err != nil {
641 errors = append(errors, AccessLogFilterValidationError{
642 field: "ResponseFlagFilter",
643 reason: "embedded message failed validation",
644 cause: err,
645 })
646 }
647 }
648 } else if v, ok := interface{}(m.GetResponseFlagFilter()).(interface{ Validate() error }); ok {
649 if err := v.Validate(); err != nil {
650 return AccessLogFilterValidationError{
651 field: "ResponseFlagFilter",
652 reason: "embedded message failed validation",
653 cause: err,
654 }
655 }
656 }
657
658 case *AccessLogFilter_GrpcStatusFilter:
659 if v == nil {
660 err := AccessLogFilterValidationError{
661 field: "FilterSpecifier",
662 reason: "oneof value cannot be a typed-nil",
663 }
664 if !all {
665 return err
666 }
667 errors = append(errors, err)
668 }
669 oneofFilterSpecifierPresent = true
670
671 if all {
672 switch v := interface{}(m.GetGrpcStatusFilter()).(type) {
673 case interface{ ValidateAll() error }:
674 if err := v.ValidateAll(); err != nil {
675 errors = append(errors, AccessLogFilterValidationError{
676 field: "GrpcStatusFilter",
677 reason: "embedded message failed validation",
678 cause: err,
679 })
680 }
681 case interface{ Validate() error }:
682 if err := v.Validate(); err != nil {
683 errors = append(errors, AccessLogFilterValidationError{
684 field: "GrpcStatusFilter",
685 reason: "embedded message failed validation",
686 cause: err,
687 })
688 }
689 }
690 } else if v, ok := interface{}(m.GetGrpcStatusFilter()).(interface{ Validate() error }); ok {
691 if err := v.Validate(); err != nil {
692 return AccessLogFilterValidationError{
693 field: "GrpcStatusFilter",
694 reason: "embedded message failed validation",
695 cause: err,
696 }
697 }
698 }
699
700 case *AccessLogFilter_ExtensionFilter:
701 if v == nil {
702 err := AccessLogFilterValidationError{
703 field: "FilterSpecifier",
704 reason: "oneof value cannot be a typed-nil",
705 }
706 if !all {
707 return err
708 }
709 errors = append(errors, err)
710 }
711 oneofFilterSpecifierPresent = true
712
713 if all {
714 switch v := interface{}(m.GetExtensionFilter()).(type) {
715 case interface{ ValidateAll() error }:
716 if err := v.ValidateAll(); err != nil {
717 errors = append(errors, AccessLogFilterValidationError{
718 field: "ExtensionFilter",
719 reason: "embedded message failed validation",
720 cause: err,
721 })
722 }
723 case interface{ Validate() error }:
724 if err := v.Validate(); err != nil {
725 errors = append(errors, AccessLogFilterValidationError{
726 field: "ExtensionFilter",
727 reason: "embedded message failed validation",
728 cause: err,
729 })
730 }
731 }
732 } else if v, ok := interface{}(m.GetExtensionFilter()).(interface{ Validate() error }); ok {
733 if err := v.Validate(); err != nil {
734 return AccessLogFilterValidationError{
735 field: "ExtensionFilter",
736 reason: "embedded message failed validation",
737 cause: err,
738 }
739 }
740 }
741
742 default:
743 _ = v // ensures v is used
744 }
745 if !oneofFilterSpecifierPresent {
746 err := AccessLogFilterValidationError{
747 field: "FilterSpecifier",
748 reason: "value is required",
749 }
750 if !all {
751 return err
752 }
753 errors = append(errors, err)
754 }
755
756 if len(errors) > 0 {
757 return AccessLogFilterMultiError(errors)
758 }
759
760 return nil
761 }
762
763 // AccessLogFilterMultiError is an error wrapping multiple validation errors
764 // returned by AccessLogFilter.ValidateAll() if the designated constraints
765 // aren't met.
766 type AccessLogFilterMultiError []error
767
768 // Error returns a concatenation of all the error messages it wraps.
769 func (m AccessLogFilterMultiError) Error() string {
770 var msgs []string
771 for _, err := range m {
772 msgs = append(msgs, err.Error())
773 }
774 return strings.Join(msgs, "; ")
775 }
776
777 // AllErrors returns a list of validation violation errors.
778 func (m AccessLogFilterMultiError) AllErrors() []error { return m }
779
780 // AccessLogFilterValidationError is the validation error returned by
781 // AccessLogFilter.Validate if the designated constraints aren't met.
782 type AccessLogFilterValidationError struct {
783 field string
784 reason string
785 cause error
786 key bool
787 }
788
789 // Field function returns field value.
790 func (e AccessLogFilterValidationError) Field() string { return e.field }
791
792 // Reason function returns reason value.
793 func (e AccessLogFilterValidationError) Reason() string { return e.reason }
794
795 // Cause function returns cause value.
796 func (e AccessLogFilterValidationError) Cause() error { return e.cause }
797
798 // Key function returns key value.
799 func (e AccessLogFilterValidationError) Key() bool { return e.key }
800
801 // ErrorName returns error name.
802 func (e AccessLogFilterValidationError) ErrorName() string { return "AccessLogFilterValidationError" }
803
804 // Error satisfies the builtin error interface
805 func (e AccessLogFilterValidationError) Error() string {
806 cause := ""
807 if e.cause != nil {
808 cause = fmt.Sprintf(" | caused by: %v", e.cause)
809 }
810
811 key := ""
812 if e.key {
813 key = "key for "
814 }
815
816 return fmt.Sprintf(
817 "invalid %sAccessLogFilter.%s: %s%s",
818 key,
819 e.field,
820 e.reason,
821 cause)
822 }
823
824 var _ error = AccessLogFilterValidationError{}
825
826 var _ interface {
827 Field() string
828 Reason() string
829 Key() bool
830 Cause() error
831 ErrorName() string
832 } = AccessLogFilterValidationError{}
833
834 // Validate checks the field values on ComparisonFilter with the rules defined
835 // in the proto definition for this message. If any rules are violated, the
836 // first error encountered is returned, or nil if there are no violations.
837 func (m *ComparisonFilter) Validate() error {
838 return m.validate(false)
839 }
840
841 // ValidateAll checks the field values on ComparisonFilter with the rules
842 // defined in the proto definition for this message. If any rules are
843 // violated, the result is a list of violation errors wrapped in
844 // ComparisonFilterMultiError, or nil if none found.
845 func (m *ComparisonFilter) ValidateAll() error {
846 return m.validate(true)
847 }
848
849 func (m *ComparisonFilter) validate(all bool) error {
850 if m == nil {
851 return nil
852 }
853
854 var errors []error
855
856 if _, ok := ComparisonFilter_Op_name[int32(m.GetOp())]; !ok {
857 err := ComparisonFilterValidationError{
858 field: "Op",
859 reason: "value must be one of the defined enum values",
860 }
861 if !all {
862 return err
863 }
864 errors = append(errors, err)
865 }
866
867 if all {
868 switch v := interface{}(m.GetValue()).(type) {
869 case interface{ ValidateAll() error }:
870 if err := v.ValidateAll(); err != nil {
871 errors = append(errors, ComparisonFilterValidationError{
872 field: "Value",
873 reason: "embedded message failed validation",
874 cause: err,
875 })
876 }
877 case interface{ Validate() error }:
878 if err := v.Validate(); err != nil {
879 errors = append(errors, ComparisonFilterValidationError{
880 field: "Value",
881 reason: "embedded message failed validation",
882 cause: err,
883 })
884 }
885 }
886 } else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok {
887 if err := v.Validate(); err != nil {
888 return ComparisonFilterValidationError{
889 field: "Value",
890 reason: "embedded message failed validation",
891 cause: err,
892 }
893 }
894 }
895
896 if len(errors) > 0 {
897 return ComparisonFilterMultiError(errors)
898 }
899
900 return nil
901 }
902
903 // ComparisonFilterMultiError is an error wrapping multiple validation errors
904 // returned by ComparisonFilter.ValidateAll() if the designated constraints
905 // aren't met.
906 type ComparisonFilterMultiError []error
907
908 // Error returns a concatenation of all the error messages it wraps.
909 func (m ComparisonFilterMultiError) Error() string {
910 var msgs []string
911 for _, err := range m {
912 msgs = append(msgs, err.Error())
913 }
914 return strings.Join(msgs, "; ")
915 }
916
917 // AllErrors returns a list of validation violation errors.
918 func (m ComparisonFilterMultiError) AllErrors() []error { return m }
919
920 // ComparisonFilterValidationError is the validation error returned by
921 // ComparisonFilter.Validate if the designated constraints aren't met.
922 type ComparisonFilterValidationError struct {
923 field string
924 reason string
925 cause error
926 key bool
927 }
928
929 // Field function returns field value.
930 func (e ComparisonFilterValidationError) Field() string { return e.field }
931
932 // Reason function returns reason value.
933 func (e ComparisonFilterValidationError) Reason() string { return e.reason }
934
935 // Cause function returns cause value.
936 func (e ComparisonFilterValidationError) Cause() error { return e.cause }
937
938 // Key function returns key value.
939 func (e ComparisonFilterValidationError) Key() bool { return e.key }
940
941 // ErrorName returns error name.
942 func (e ComparisonFilterValidationError) ErrorName() string { return "ComparisonFilterValidationError" }
943
944 // Error satisfies the builtin error interface
945 func (e ComparisonFilterValidationError) Error() string {
946 cause := ""
947 if e.cause != nil {
948 cause = fmt.Sprintf(" | caused by: %v", e.cause)
949 }
950
951 key := ""
952 if e.key {
953 key = "key for "
954 }
955
956 return fmt.Sprintf(
957 "invalid %sComparisonFilter.%s: %s%s",
958 key,
959 e.field,
960 e.reason,
961 cause)
962 }
963
964 var _ error = ComparisonFilterValidationError{}
965
966 var _ interface {
967 Field() string
968 Reason() string
969 Key() bool
970 Cause() error
971 ErrorName() string
972 } = ComparisonFilterValidationError{}
973
974 // Validate checks the field values on StatusCodeFilter with the rules defined
975 // in the proto definition for this message. If any rules are violated, the
976 // first error encountered is returned, or nil if there are no violations.
977 func (m *StatusCodeFilter) Validate() error {
978 return m.validate(false)
979 }
980
981 // ValidateAll checks the field values on StatusCodeFilter with the rules
982 // defined in the proto definition for this message. If any rules are
983 // violated, the result is a list of violation errors wrapped in
984 // StatusCodeFilterMultiError, or nil if none found.
985 func (m *StatusCodeFilter) ValidateAll() error {
986 return m.validate(true)
987 }
988
989 func (m *StatusCodeFilter) validate(all bool) error {
990 if m == nil {
991 return nil
992 }
993
994 var errors []error
995
996 if m.GetComparison() == nil {
997 err := StatusCodeFilterValidationError{
998 field: "Comparison",
999 reason: "value is required",
1000 }
1001 if !all {
1002 return err
1003 }
1004 errors = append(errors, err)
1005 }
1006
1007 if all {
1008 switch v := interface{}(m.GetComparison()).(type) {
1009 case interface{ ValidateAll() error }:
1010 if err := v.ValidateAll(); err != nil {
1011 errors = append(errors, StatusCodeFilterValidationError{
1012 field: "Comparison",
1013 reason: "embedded message failed validation",
1014 cause: err,
1015 })
1016 }
1017 case interface{ Validate() error }:
1018 if err := v.Validate(); err != nil {
1019 errors = append(errors, StatusCodeFilterValidationError{
1020 field: "Comparison",
1021 reason: "embedded message failed validation",
1022 cause: err,
1023 })
1024 }
1025 }
1026 } else if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok {
1027 if err := v.Validate(); err != nil {
1028 return StatusCodeFilterValidationError{
1029 field: "Comparison",
1030 reason: "embedded message failed validation",
1031 cause: err,
1032 }
1033 }
1034 }
1035
1036 if len(errors) > 0 {
1037 return StatusCodeFilterMultiError(errors)
1038 }
1039
1040 return nil
1041 }
1042
1043 // StatusCodeFilterMultiError is an error wrapping multiple validation errors
1044 // returned by StatusCodeFilter.ValidateAll() if the designated constraints
1045 // aren't met.
1046 type StatusCodeFilterMultiError []error
1047
1048 // Error returns a concatenation of all the error messages it wraps.
1049 func (m StatusCodeFilterMultiError) Error() string {
1050 var msgs []string
1051 for _, err := range m {
1052 msgs = append(msgs, err.Error())
1053 }
1054 return strings.Join(msgs, "; ")
1055 }
1056
1057 // AllErrors returns a list of validation violation errors.
1058 func (m StatusCodeFilterMultiError) AllErrors() []error { return m }
1059
1060 // StatusCodeFilterValidationError is the validation error returned by
1061 // StatusCodeFilter.Validate if the designated constraints aren't met.
1062 type StatusCodeFilterValidationError struct {
1063 field string
1064 reason string
1065 cause error
1066 key bool
1067 }
1068
1069 // Field function returns field value.
1070 func (e StatusCodeFilterValidationError) Field() string { return e.field }
1071
1072 // Reason function returns reason value.
1073 func (e StatusCodeFilterValidationError) Reason() string { return e.reason }
1074
1075 // Cause function returns cause value.
1076 func (e StatusCodeFilterValidationError) Cause() error { return e.cause }
1077
1078 // Key function returns key value.
1079 func (e StatusCodeFilterValidationError) Key() bool { return e.key }
1080
1081 // ErrorName returns error name.
1082 func (e StatusCodeFilterValidationError) ErrorName() string { return "StatusCodeFilterValidationError" }
1083
1084 // Error satisfies the builtin error interface
1085 func (e StatusCodeFilterValidationError) Error() string {
1086 cause := ""
1087 if e.cause != nil {
1088 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1089 }
1090
1091 key := ""
1092 if e.key {
1093 key = "key for "
1094 }
1095
1096 return fmt.Sprintf(
1097 "invalid %sStatusCodeFilter.%s: %s%s",
1098 key,
1099 e.field,
1100 e.reason,
1101 cause)
1102 }
1103
1104 var _ error = StatusCodeFilterValidationError{}
1105
1106 var _ interface {
1107 Field() string
1108 Reason() string
1109 Key() bool
1110 Cause() error
1111 ErrorName() string
1112 } = StatusCodeFilterValidationError{}
1113
1114 // Validate checks the field values on DurationFilter with the rules defined in
1115 // the proto definition for this message. If any rules are violated, the first
1116 // error encountered is returned, or nil if there are no violations.
1117 func (m *DurationFilter) Validate() error {
1118 return m.validate(false)
1119 }
1120
1121 // ValidateAll checks the field values on DurationFilter with the rules defined
1122 // in the proto definition for this message. If any rules are violated, the
1123 // result is a list of violation errors wrapped in DurationFilterMultiError,
1124 // or nil if none found.
1125 func (m *DurationFilter) ValidateAll() error {
1126 return m.validate(true)
1127 }
1128
1129 func (m *DurationFilter) validate(all bool) error {
1130 if m == nil {
1131 return nil
1132 }
1133
1134 var errors []error
1135
1136 if m.GetComparison() == nil {
1137 err := DurationFilterValidationError{
1138 field: "Comparison",
1139 reason: "value is required",
1140 }
1141 if !all {
1142 return err
1143 }
1144 errors = append(errors, err)
1145 }
1146
1147 if all {
1148 switch v := interface{}(m.GetComparison()).(type) {
1149 case interface{ ValidateAll() error }:
1150 if err := v.ValidateAll(); err != nil {
1151 errors = append(errors, DurationFilterValidationError{
1152 field: "Comparison",
1153 reason: "embedded message failed validation",
1154 cause: err,
1155 })
1156 }
1157 case interface{ Validate() error }:
1158 if err := v.Validate(); err != nil {
1159 errors = append(errors, DurationFilterValidationError{
1160 field: "Comparison",
1161 reason: "embedded message failed validation",
1162 cause: err,
1163 })
1164 }
1165 }
1166 } else if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok {
1167 if err := v.Validate(); err != nil {
1168 return DurationFilterValidationError{
1169 field: "Comparison",
1170 reason: "embedded message failed validation",
1171 cause: err,
1172 }
1173 }
1174 }
1175
1176 if len(errors) > 0 {
1177 return DurationFilterMultiError(errors)
1178 }
1179
1180 return nil
1181 }
1182
1183 // DurationFilterMultiError is an error wrapping multiple validation errors
1184 // returned by DurationFilter.ValidateAll() if the designated constraints
1185 // aren't met.
1186 type DurationFilterMultiError []error
1187
1188 // Error returns a concatenation of all the error messages it wraps.
1189 func (m DurationFilterMultiError) Error() string {
1190 var msgs []string
1191 for _, err := range m {
1192 msgs = append(msgs, err.Error())
1193 }
1194 return strings.Join(msgs, "; ")
1195 }
1196
1197 // AllErrors returns a list of validation violation errors.
1198 func (m DurationFilterMultiError) AllErrors() []error { return m }
1199
1200 // DurationFilterValidationError is the validation error returned by
1201 // DurationFilter.Validate if the designated constraints aren't met.
1202 type DurationFilterValidationError struct {
1203 field string
1204 reason string
1205 cause error
1206 key bool
1207 }
1208
1209 // Field function returns field value.
1210 func (e DurationFilterValidationError) Field() string { return e.field }
1211
1212 // Reason function returns reason value.
1213 func (e DurationFilterValidationError) Reason() string { return e.reason }
1214
1215 // Cause function returns cause value.
1216 func (e DurationFilterValidationError) Cause() error { return e.cause }
1217
1218 // Key function returns key value.
1219 func (e DurationFilterValidationError) Key() bool { return e.key }
1220
1221 // ErrorName returns error name.
1222 func (e DurationFilterValidationError) ErrorName() string { return "DurationFilterValidationError" }
1223
1224 // Error satisfies the builtin error interface
1225 func (e DurationFilterValidationError) Error() string {
1226 cause := ""
1227 if e.cause != nil {
1228 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1229 }
1230
1231 key := ""
1232 if e.key {
1233 key = "key for "
1234 }
1235
1236 return fmt.Sprintf(
1237 "invalid %sDurationFilter.%s: %s%s",
1238 key,
1239 e.field,
1240 e.reason,
1241 cause)
1242 }
1243
1244 var _ error = DurationFilterValidationError{}
1245
1246 var _ interface {
1247 Field() string
1248 Reason() string
1249 Key() bool
1250 Cause() error
1251 ErrorName() string
1252 } = DurationFilterValidationError{}
1253
1254 // Validate checks the field values on NotHealthCheckFilter with the rules
1255 // defined in the proto definition for this message. If any rules are
1256 // violated, the first error encountered is returned, or nil if there are no violations.
1257 func (m *NotHealthCheckFilter) Validate() error {
1258 return m.validate(false)
1259 }
1260
1261 // ValidateAll checks the field values on NotHealthCheckFilter with the rules
1262 // defined in the proto definition for this message. If any rules are
1263 // violated, the result is a list of violation errors wrapped in
1264 // NotHealthCheckFilterMultiError, or nil if none found.
1265 func (m *NotHealthCheckFilter) ValidateAll() error {
1266 return m.validate(true)
1267 }
1268
1269 func (m *NotHealthCheckFilter) validate(all bool) error {
1270 if m == nil {
1271 return nil
1272 }
1273
1274 var errors []error
1275
1276 if len(errors) > 0 {
1277 return NotHealthCheckFilterMultiError(errors)
1278 }
1279
1280 return nil
1281 }
1282
1283 // NotHealthCheckFilterMultiError is an error wrapping multiple validation
1284 // errors returned by NotHealthCheckFilter.ValidateAll() if the designated
1285 // constraints aren't met.
1286 type NotHealthCheckFilterMultiError []error
1287
1288 // Error returns a concatenation of all the error messages it wraps.
1289 func (m NotHealthCheckFilterMultiError) Error() string {
1290 var msgs []string
1291 for _, err := range m {
1292 msgs = append(msgs, err.Error())
1293 }
1294 return strings.Join(msgs, "; ")
1295 }
1296
1297 // AllErrors returns a list of validation violation errors.
1298 func (m NotHealthCheckFilterMultiError) AllErrors() []error { return m }
1299
1300 // NotHealthCheckFilterValidationError is the validation error returned by
1301 // NotHealthCheckFilter.Validate if the designated constraints aren't met.
1302 type NotHealthCheckFilterValidationError struct {
1303 field string
1304 reason string
1305 cause error
1306 key bool
1307 }
1308
1309 // Field function returns field value.
1310 func (e NotHealthCheckFilterValidationError) Field() string { return e.field }
1311
1312 // Reason function returns reason value.
1313 func (e NotHealthCheckFilterValidationError) Reason() string { return e.reason }
1314
1315 // Cause function returns cause value.
1316 func (e NotHealthCheckFilterValidationError) Cause() error { return e.cause }
1317
1318 // Key function returns key value.
1319 func (e NotHealthCheckFilterValidationError) Key() bool { return e.key }
1320
1321 // ErrorName returns error name.
1322 func (e NotHealthCheckFilterValidationError) ErrorName() string {
1323 return "NotHealthCheckFilterValidationError"
1324 }
1325
1326 // Error satisfies the builtin error interface
1327 func (e NotHealthCheckFilterValidationError) Error() string {
1328 cause := ""
1329 if e.cause != nil {
1330 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1331 }
1332
1333 key := ""
1334 if e.key {
1335 key = "key for "
1336 }
1337
1338 return fmt.Sprintf(
1339 "invalid %sNotHealthCheckFilter.%s: %s%s",
1340 key,
1341 e.field,
1342 e.reason,
1343 cause)
1344 }
1345
1346 var _ error = NotHealthCheckFilterValidationError{}
1347
1348 var _ interface {
1349 Field() string
1350 Reason() string
1351 Key() bool
1352 Cause() error
1353 ErrorName() string
1354 } = NotHealthCheckFilterValidationError{}
1355
1356 // Validate checks the field values on TraceableFilter with the rules defined
1357 // in the proto definition for this message. If any rules are violated, the
1358 // first error encountered is returned, or nil if there are no violations.
1359 func (m *TraceableFilter) Validate() error {
1360 return m.validate(false)
1361 }
1362
1363 // ValidateAll checks the field values on TraceableFilter with the rules
1364 // defined in the proto definition for this message. If any rules are
1365 // violated, the result is a list of violation errors wrapped in
1366 // TraceableFilterMultiError, or nil if none found.
1367 func (m *TraceableFilter) ValidateAll() error {
1368 return m.validate(true)
1369 }
1370
1371 func (m *TraceableFilter) validate(all bool) error {
1372 if m == nil {
1373 return nil
1374 }
1375
1376 var errors []error
1377
1378 if len(errors) > 0 {
1379 return TraceableFilterMultiError(errors)
1380 }
1381
1382 return nil
1383 }
1384
1385 // TraceableFilterMultiError is an error wrapping multiple validation errors
1386 // returned by TraceableFilter.ValidateAll() if the designated constraints
1387 // aren't met.
1388 type TraceableFilterMultiError []error
1389
1390 // Error returns a concatenation of all the error messages it wraps.
1391 func (m TraceableFilterMultiError) Error() string {
1392 var msgs []string
1393 for _, err := range m {
1394 msgs = append(msgs, err.Error())
1395 }
1396 return strings.Join(msgs, "; ")
1397 }
1398
1399 // AllErrors returns a list of validation violation errors.
1400 func (m TraceableFilterMultiError) AllErrors() []error { return m }
1401
1402 // TraceableFilterValidationError is the validation error returned by
1403 // TraceableFilter.Validate if the designated constraints aren't met.
1404 type TraceableFilterValidationError struct {
1405 field string
1406 reason string
1407 cause error
1408 key bool
1409 }
1410
1411 // Field function returns field value.
1412 func (e TraceableFilterValidationError) Field() string { return e.field }
1413
1414 // Reason function returns reason value.
1415 func (e TraceableFilterValidationError) Reason() string { return e.reason }
1416
1417 // Cause function returns cause value.
1418 func (e TraceableFilterValidationError) Cause() error { return e.cause }
1419
1420 // Key function returns key value.
1421 func (e TraceableFilterValidationError) Key() bool { return e.key }
1422
1423 // ErrorName returns error name.
1424 func (e TraceableFilterValidationError) ErrorName() string { return "TraceableFilterValidationError" }
1425
1426 // Error satisfies the builtin error interface
1427 func (e TraceableFilterValidationError) Error() string {
1428 cause := ""
1429 if e.cause != nil {
1430 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1431 }
1432
1433 key := ""
1434 if e.key {
1435 key = "key for "
1436 }
1437
1438 return fmt.Sprintf(
1439 "invalid %sTraceableFilter.%s: %s%s",
1440 key,
1441 e.field,
1442 e.reason,
1443 cause)
1444 }
1445
1446 var _ error = TraceableFilterValidationError{}
1447
1448 var _ interface {
1449 Field() string
1450 Reason() string
1451 Key() bool
1452 Cause() error
1453 ErrorName() string
1454 } = TraceableFilterValidationError{}
1455
1456 // Validate checks the field values on RuntimeFilter with the rules defined in
1457 // the proto definition for this message. If any rules are violated, the first
1458 // error encountered is returned, or nil if there are no violations.
1459 func (m *RuntimeFilter) Validate() error {
1460 return m.validate(false)
1461 }
1462
1463 // ValidateAll checks the field values on RuntimeFilter with the rules defined
1464 // in the proto definition for this message. If any rules are violated, the
1465 // result is a list of violation errors wrapped in RuntimeFilterMultiError, or
1466 // nil if none found.
1467 func (m *RuntimeFilter) ValidateAll() error {
1468 return m.validate(true)
1469 }
1470
1471 func (m *RuntimeFilter) validate(all bool) error {
1472 if m == nil {
1473 return nil
1474 }
1475
1476 var errors []error
1477
1478 if len(m.GetRuntimeKey()) < 1 {
1479 err := RuntimeFilterValidationError{
1480 field: "RuntimeKey",
1481 reason: "value length must be at least 1 bytes",
1482 }
1483 if !all {
1484 return err
1485 }
1486 errors = append(errors, err)
1487 }
1488
1489 if all {
1490 switch v := interface{}(m.GetPercentSampled()).(type) {
1491 case interface{ ValidateAll() error }:
1492 if err := v.ValidateAll(); err != nil {
1493 errors = append(errors, RuntimeFilterValidationError{
1494 field: "PercentSampled",
1495 reason: "embedded message failed validation",
1496 cause: err,
1497 })
1498 }
1499 case interface{ Validate() error }:
1500 if err := v.Validate(); err != nil {
1501 errors = append(errors, RuntimeFilterValidationError{
1502 field: "PercentSampled",
1503 reason: "embedded message failed validation",
1504 cause: err,
1505 })
1506 }
1507 }
1508 } else if v, ok := interface{}(m.GetPercentSampled()).(interface{ Validate() error }); ok {
1509 if err := v.Validate(); err != nil {
1510 return RuntimeFilterValidationError{
1511 field: "PercentSampled",
1512 reason: "embedded message failed validation",
1513 cause: err,
1514 }
1515 }
1516 }
1517
1518 // no validation rules for UseIndependentRandomness
1519
1520 if len(errors) > 0 {
1521 return RuntimeFilterMultiError(errors)
1522 }
1523
1524 return nil
1525 }
1526
1527 // RuntimeFilterMultiError is an error wrapping multiple validation errors
1528 // returned by RuntimeFilter.ValidateAll() if the designated constraints
1529 // aren't met.
1530 type RuntimeFilterMultiError []error
1531
1532 // Error returns a concatenation of all the error messages it wraps.
1533 func (m RuntimeFilterMultiError) Error() string {
1534 var msgs []string
1535 for _, err := range m {
1536 msgs = append(msgs, err.Error())
1537 }
1538 return strings.Join(msgs, "; ")
1539 }
1540
1541 // AllErrors returns a list of validation violation errors.
1542 func (m RuntimeFilterMultiError) AllErrors() []error { return m }
1543
1544 // RuntimeFilterValidationError is the validation error returned by
1545 // RuntimeFilter.Validate if the designated constraints aren't met.
1546 type RuntimeFilterValidationError struct {
1547 field string
1548 reason string
1549 cause error
1550 key bool
1551 }
1552
1553 // Field function returns field value.
1554 func (e RuntimeFilterValidationError) Field() string { return e.field }
1555
1556 // Reason function returns reason value.
1557 func (e RuntimeFilterValidationError) Reason() string { return e.reason }
1558
1559 // Cause function returns cause value.
1560 func (e RuntimeFilterValidationError) Cause() error { return e.cause }
1561
1562 // Key function returns key value.
1563 func (e RuntimeFilterValidationError) Key() bool { return e.key }
1564
1565 // ErrorName returns error name.
1566 func (e RuntimeFilterValidationError) ErrorName() string { return "RuntimeFilterValidationError" }
1567
1568 // Error satisfies the builtin error interface
1569 func (e RuntimeFilterValidationError) Error() string {
1570 cause := ""
1571 if e.cause != nil {
1572 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1573 }
1574
1575 key := ""
1576 if e.key {
1577 key = "key for "
1578 }
1579
1580 return fmt.Sprintf(
1581 "invalid %sRuntimeFilter.%s: %s%s",
1582 key,
1583 e.field,
1584 e.reason,
1585 cause)
1586 }
1587
1588 var _ error = RuntimeFilterValidationError{}
1589
1590 var _ interface {
1591 Field() string
1592 Reason() string
1593 Key() bool
1594 Cause() error
1595 ErrorName() string
1596 } = RuntimeFilterValidationError{}
1597
1598 // Validate checks the field values on AndFilter with the rules defined in the
1599 // proto definition for this message. If any rules are violated, the first
1600 // error encountered is returned, or nil if there are no violations.
1601 func (m *AndFilter) Validate() error {
1602 return m.validate(false)
1603 }
1604
1605 // ValidateAll checks the field values on AndFilter with the rules defined in
1606 // the proto definition for this message. If any rules are violated, the
1607 // result is a list of violation errors wrapped in AndFilterMultiError, or nil
1608 // if none found.
1609 func (m *AndFilter) ValidateAll() error {
1610 return m.validate(true)
1611 }
1612
1613 func (m *AndFilter) validate(all bool) error {
1614 if m == nil {
1615 return nil
1616 }
1617
1618 var errors []error
1619
1620 if len(m.GetFilters()) < 2 {
1621 err := AndFilterValidationError{
1622 field: "Filters",
1623 reason: "value must contain at least 2 item(s)",
1624 }
1625 if !all {
1626 return err
1627 }
1628 errors = append(errors, err)
1629 }
1630
1631 for idx, item := range m.GetFilters() {
1632 _, _ = idx, item
1633
1634 if all {
1635 switch v := interface{}(item).(type) {
1636 case interface{ ValidateAll() error }:
1637 if err := v.ValidateAll(); err != nil {
1638 errors = append(errors, AndFilterValidationError{
1639 field: fmt.Sprintf("Filters[%v]", idx),
1640 reason: "embedded message failed validation",
1641 cause: err,
1642 })
1643 }
1644 case interface{ Validate() error }:
1645 if err := v.Validate(); err != nil {
1646 errors = append(errors, AndFilterValidationError{
1647 field: fmt.Sprintf("Filters[%v]", idx),
1648 reason: "embedded message failed validation",
1649 cause: err,
1650 })
1651 }
1652 }
1653 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1654 if err := v.Validate(); err != nil {
1655 return AndFilterValidationError{
1656 field: fmt.Sprintf("Filters[%v]", idx),
1657 reason: "embedded message failed validation",
1658 cause: err,
1659 }
1660 }
1661 }
1662
1663 }
1664
1665 if len(errors) > 0 {
1666 return AndFilterMultiError(errors)
1667 }
1668
1669 return nil
1670 }
1671
1672 // AndFilterMultiError is an error wrapping multiple validation errors returned
1673 // by AndFilter.ValidateAll() if the designated constraints aren't met.
1674 type AndFilterMultiError []error
1675
1676 // Error returns a concatenation of all the error messages it wraps.
1677 func (m AndFilterMultiError) Error() string {
1678 var msgs []string
1679 for _, err := range m {
1680 msgs = append(msgs, err.Error())
1681 }
1682 return strings.Join(msgs, "; ")
1683 }
1684
1685 // AllErrors returns a list of validation violation errors.
1686 func (m AndFilterMultiError) AllErrors() []error { return m }
1687
1688 // AndFilterValidationError is the validation error returned by
1689 // AndFilter.Validate if the designated constraints aren't met.
1690 type AndFilterValidationError struct {
1691 field string
1692 reason string
1693 cause error
1694 key bool
1695 }
1696
1697 // Field function returns field value.
1698 func (e AndFilterValidationError) Field() string { return e.field }
1699
1700 // Reason function returns reason value.
1701 func (e AndFilterValidationError) Reason() string { return e.reason }
1702
1703 // Cause function returns cause value.
1704 func (e AndFilterValidationError) Cause() error { return e.cause }
1705
1706 // Key function returns key value.
1707 func (e AndFilterValidationError) Key() bool { return e.key }
1708
1709 // ErrorName returns error name.
1710 func (e AndFilterValidationError) ErrorName() string { return "AndFilterValidationError" }
1711
1712 // Error satisfies the builtin error interface
1713 func (e AndFilterValidationError) Error() string {
1714 cause := ""
1715 if e.cause != nil {
1716 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1717 }
1718
1719 key := ""
1720 if e.key {
1721 key = "key for "
1722 }
1723
1724 return fmt.Sprintf(
1725 "invalid %sAndFilter.%s: %s%s",
1726 key,
1727 e.field,
1728 e.reason,
1729 cause)
1730 }
1731
1732 var _ error = AndFilterValidationError{}
1733
1734 var _ interface {
1735 Field() string
1736 Reason() string
1737 Key() bool
1738 Cause() error
1739 ErrorName() string
1740 } = AndFilterValidationError{}
1741
1742 // Validate checks the field values on OrFilter with the rules defined in the
1743 // proto definition for this message. If any rules are violated, the first
1744 // error encountered is returned, or nil if there are no violations.
1745 func (m *OrFilter) Validate() error {
1746 return m.validate(false)
1747 }
1748
1749 // ValidateAll checks the field values on OrFilter with the rules defined in
1750 // the proto definition for this message. If any rules are violated, the
1751 // result is a list of violation errors wrapped in OrFilterMultiError, or nil
1752 // if none found.
1753 func (m *OrFilter) ValidateAll() error {
1754 return m.validate(true)
1755 }
1756
1757 func (m *OrFilter) validate(all bool) error {
1758 if m == nil {
1759 return nil
1760 }
1761
1762 var errors []error
1763
1764 if len(m.GetFilters()) < 2 {
1765 err := OrFilterValidationError{
1766 field: "Filters",
1767 reason: "value must contain at least 2 item(s)",
1768 }
1769 if !all {
1770 return err
1771 }
1772 errors = append(errors, err)
1773 }
1774
1775 for idx, item := range m.GetFilters() {
1776 _, _ = idx, item
1777
1778 if all {
1779 switch v := interface{}(item).(type) {
1780 case interface{ ValidateAll() error }:
1781 if err := v.ValidateAll(); err != nil {
1782 errors = append(errors, OrFilterValidationError{
1783 field: fmt.Sprintf("Filters[%v]", idx),
1784 reason: "embedded message failed validation",
1785 cause: err,
1786 })
1787 }
1788 case interface{ Validate() error }:
1789 if err := v.Validate(); err != nil {
1790 errors = append(errors, OrFilterValidationError{
1791 field: fmt.Sprintf("Filters[%v]", idx),
1792 reason: "embedded message failed validation",
1793 cause: err,
1794 })
1795 }
1796 }
1797 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1798 if err := v.Validate(); err != nil {
1799 return OrFilterValidationError{
1800 field: fmt.Sprintf("Filters[%v]", idx),
1801 reason: "embedded message failed validation",
1802 cause: err,
1803 }
1804 }
1805 }
1806
1807 }
1808
1809 if len(errors) > 0 {
1810 return OrFilterMultiError(errors)
1811 }
1812
1813 return nil
1814 }
1815
1816 // OrFilterMultiError is an error wrapping multiple validation errors returned
1817 // by OrFilter.ValidateAll() if the designated constraints aren't met.
1818 type OrFilterMultiError []error
1819
1820 // Error returns a concatenation of all the error messages it wraps.
1821 func (m OrFilterMultiError) Error() string {
1822 var msgs []string
1823 for _, err := range m {
1824 msgs = append(msgs, err.Error())
1825 }
1826 return strings.Join(msgs, "; ")
1827 }
1828
1829 // AllErrors returns a list of validation violation errors.
1830 func (m OrFilterMultiError) AllErrors() []error { return m }
1831
1832 // OrFilterValidationError is the validation error returned by
1833 // OrFilter.Validate if the designated constraints aren't met.
1834 type OrFilterValidationError struct {
1835 field string
1836 reason string
1837 cause error
1838 key bool
1839 }
1840
1841 // Field function returns field value.
1842 func (e OrFilterValidationError) Field() string { return e.field }
1843
1844 // Reason function returns reason value.
1845 func (e OrFilterValidationError) Reason() string { return e.reason }
1846
1847 // Cause function returns cause value.
1848 func (e OrFilterValidationError) Cause() error { return e.cause }
1849
1850 // Key function returns key value.
1851 func (e OrFilterValidationError) Key() bool { return e.key }
1852
1853 // ErrorName returns error name.
1854 func (e OrFilterValidationError) ErrorName() string { return "OrFilterValidationError" }
1855
1856 // Error satisfies the builtin error interface
1857 func (e OrFilterValidationError) Error() string {
1858 cause := ""
1859 if e.cause != nil {
1860 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1861 }
1862
1863 key := ""
1864 if e.key {
1865 key = "key for "
1866 }
1867
1868 return fmt.Sprintf(
1869 "invalid %sOrFilter.%s: %s%s",
1870 key,
1871 e.field,
1872 e.reason,
1873 cause)
1874 }
1875
1876 var _ error = OrFilterValidationError{}
1877
1878 var _ interface {
1879 Field() string
1880 Reason() string
1881 Key() bool
1882 Cause() error
1883 ErrorName() string
1884 } = OrFilterValidationError{}
1885
1886 // Validate checks the field values on HeaderFilter with the rules defined in
1887 // the proto definition for this message. If any rules are violated, the first
1888 // error encountered is returned, or nil if there are no violations.
1889 func (m *HeaderFilter) Validate() error {
1890 return m.validate(false)
1891 }
1892
1893 // ValidateAll checks the field values on HeaderFilter with the rules defined
1894 // in the proto definition for this message. If any rules are violated, the
1895 // result is a list of violation errors wrapped in HeaderFilterMultiError, or
1896 // nil if none found.
1897 func (m *HeaderFilter) ValidateAll() error {
1898 return m.validate(true)
1899 }
1900
1901 func (m *HeaderFilter) validate(all bool) error {
1902 if m == nil {
1903 return nil
1904 }
1905
1906 var errors []error
1907
1908 if m.GetHeader() == nil {
1909 err := HeaderFilterValidationError{
1910 field: "Header",
1911 reason: "value is required",
1912 }
1913 if !all {
1914 return err
1915 }
1916 errors = append(errors, err)
1917 }
1918
1919 if all {
1920 switch v := interface{}(m.GetHeader()).(type) {
1921 case interface{ ValidateAll() error }:
1922 if err := v.ValidateAll(); err != nil {
1923 errors = append(errors, HeaderFilterValidationError{
1924 field: "Header",
1925 reason: "embedded message failed validation",
1926 cause: err,
1927 })
1928 }
1929 case interface{ Validate() error }:
1930 if err := v.Validate(); err != nil {
1931 errors = append(errors, HeaderFilterValidationError{
1932 field: "Header",
1933 reason: "embedded message failed validation",
1934 cause: err,
1935 })
1936 }
1937 }
1938 } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
1939 if err := v.Validate(); err != nil {
1940 return HeaderFilterValidationError{
1941 field: "Header",
1942 reason: "embedded message failed validation",
1943 cause: err,
1944 }
1945 }
1946 }
1947
1948 if len(errors) > 0 {
1949 return HeaderFilterMultiError(errors)
1950 }
1951
1952 return nil
1953 }
1954
1955 // HeaderFilterMultiError is an error wrapping multiple validation errors
1956 // returned by HeaderFilter.ValidateAll() if the designated constraints aren't met.
1957 type HeaderFilterMultiError []error
1958
1959 // Error returns a concatenation of all the error messages it wraps.
1960 func (m HeaderFilterMultiError) Error() string {
1961 var msgs []string
1962 for _, err := range m {
1963 msgs = append(msgs, err.Error())
1964 }
1965 return strings.Join(msgs, "; ")
1966 }
1967
1968 // AllErrors returns a list of validation violation errors.
1969 func (m HeaderFilterMultiError) AllErrors() []error { return m }
1970
1971 // HeaderFilterValidationError is the validation error returned by
1972 // HeaderFilter.Validate if the designated constraints aren't met.
1973 type HeaderFilterValidationError struct {
1974 field string
1975 reason string
1976 cause error
1977 key bool
1978 }
1979
1980 // Field function returns field value.
1981 func (e HeaderFilterValidationError) Field() string { return e.field }
1982
1983 // Reason function returns reason value.
1984 func (e HeaderFilterValidationError) Reason() string { return e.reason }
1985
1986 // Cause function returns cause value.
1987 func (e HeaderFilterValidationError) Cause() error { return e.cause }
1988
1989 // Key function returns key value.
1990 func (e HeaderFilterValidationError) Key() bool { return e.key }
1991
1992 // ErrorName returns error name.
1993 func (e HeaderFilterValidationError) ErrorName() string { return "HeaderFilterValidationError" }
1994
1995 // Error satisfies the builtin error interface
1996 func (e HeaderFilterValidationError) Error() string {
1997 cause := ""
1998 if e.cause != nil {
1999 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2000 }
2001
2002 key := ""
2003 if e.key {
2004 key = "key for "
2005 }
2006
2007 return fmt.Sprintf(
2008 "invalid %sHeaderFilter.%s: %s%s",
2009 key,
2010 e.field,
2011 e.reason,
2012 cause)
2013 }
2014
2015 var _ error = HeaderFilterValidationError{}
2016
2017 var _ interface {
2018 Field() string
2019 Reason() string
2020 Key() bool
2021 Cause() error
2022 ErrorName() string
2023 } = HeaderFilterValidationError{}
2024
2025 // Validate checks the field values on ResponseFlagFilter with the rules
2026 // defined in the proto definition for this message. If any rules are
2027 // violated, the first error encountered is returned, or nil if there are no violations.
2028 func (m *ResponseFlagFilter) Validate() error {
2029 return m.validate(false)
2030 }
2031
2032 // ValidateAll checks the field values on ResponseFlagFilter with the rules
2033 // defined in the proto definition for this message. If any rules are
2034 // violated, the result is a list of violation errors wrapped in
2035 // ResponseFlagFilterMultiError, or nil if none found.
2036 func (m *ResponseFlagFilter) ValidateAll() error {
2037 return m.validate(true)
2038 }
2039
2040 func (m *ResponseFlagFilter) validate(all bool) error {
2041 if m == nil {
2042 return nil
2043 }
2044
2045 var errors []error
2046
2047 for idx, item := range m.GetFlags() {
2048 _, _ = idx, item
2049
2050 if _, ok := _ResponseFlagFilter_Flags_InLookup[item]; !ok {
2051 err := ResponseFlagFilterValidationError{
2052 field: fmt.Sprintf("Flags[%v]", idx),
2053 reason: "value must be in list [LH UH UT LR UR UF UC UO NR DI FI RL UAEX RLSE DC URX SI IH DPE]",
2054 }
2055 if !all {
2056 return err
2057 }
2058 errors = append(errors, err)
2059 }
2060
2061 }
2062
2063 if len(errors) > 0 {
2064 return ResponseFlagFilterMultiError(errors)
2065 }
2066
2067 return nil
2068 }
2069
2070 // ResponseFlagFilterMultiError is an error wrapping multiple validation errors
2071 // returned by ResponseFlagFilter.ValidateAll() if the designated constraints
2072 // aren't met.
2073 type ResponseFlagFilterMultiError []error
2074
2075 // Error returns a concatenation of all the error messages it wraps.
2076 func (m ResponseFlagFilterMultiError) Error() string {
2077 var msgs []string
2078 for _, err := range m {
2079 msgs = append(msgs, err.Error())
2080 }
2081 return strings.Join(msgs, "; ")
2082 }
2083
2084 // AllErrors returns a list of validation violation errors.
2085 func (m ResponseFlagFilterMultiError) AllErrors() []error { return m }
2086
2087 // ResponseFlagFilterValidationError is the validation error returned by
2088 // ResponseFlagFilter.Validate if the designated constraints aren't met.
2089 type ResponseFlagFilterValidationError struct {
2090 field string
2091 reason string
2092 cause error
2093 key bool
2094 }
2095
2096 // Field function returns field value.
2097 func (e ResponseFlagFilterValidationError) Field() string { return e.field }
2098
2099 // Reason function returns reason value.
2100 func (e ResponseFlagFilterValidationError) Reason() string { return e.reason }
2101
2102 // Cause function returns cause value.
2103 func (e ResponseFlagFilterValidationError) Cause() error { return e.cause }
2104
2105 // Key function returns key value.
2106 func (e ResponseFlagFilterValidationError) Key() bool { return e.key }
2107
2108 // ErrorName returns error name.
2109 func (e ResponseFlagFilterValidationError) ErrorName() string {
2110 return "ResponseFlagFilterValidationError"
2111 }
2112
2113 // Error satisfies the builtin error interface
2114 func (e ResponseFlagFilterValidationError) Error() string {
2115 cause := ""
2116 if e.cause != nil {
2117 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2118 }
2119
2120 key := ""
2121 if e.key {
2122 key = "key for "
2123 }
2124
2125 return fmt.Sprintf(
2126 "invalid %sResponseFlagFilter.%s: %s%s",
2127 key,
2128 e.field,
2129 e.reason,
2130 cause)
2131 }
2132
2133 var _ error = ResponseFlagFilterValidationError{}
2134
2135 var _ interface {
2136 Field() string
2137 Reason() string
2138 Key() bool
2139 Cause() error
2140 ErrorName() string
2141 } = ResponseFlagFilterValidationError{}
2142
2143 var _ResponseFlagFilter_Flags_InLookup = map[string]struct{}{
2144 "LH": {},
2145 "UH": {},
2146 "UT": {},
2147 "LR": {},
2148 "UR": {},
2149 "UF": {},
2150 "UC": {},
2151 "UO": {},
2152 "NR": {},
2153 "DI": {},
2154 "FI": {},
2155 "RL": {},
2156 "UAEX": {},
2157 "RLSE": {},
2158 "DC": {},
2159 "URX": {},
2160 "SI": {},
2161 "IH": {},
2162 "DPE": {},
2163 }
2164
2165 // Validate checks the field values on GrpcStatusFilter with the rules defined
2166 // in the proto definition for this message. If any rules are violated, the
2167 // first error encountered is returned, or nil if there are no violations.
2168 func (m *GrpcStatusFilter) Validate() error {
2169 return m.validate(false)
2170 }
2171
2172 // ValidateAll checks the field values on GrpcStatusFilter with the rules
2173 // defined in the proto definition for this message. If any rules are
2174 // violated, the result is a list of violation errors wrapped in
2175 // GrpcStatusFilterMultiError, or nil if none found.
2176 func (m *GrpcStatusFilter) ValidateAll() error {
2177 return m.validate(true)
2178 }
2179
2180 func (m *GrpcStatusFilter) validate(all bool) error {
2181 if m == nil {
2182 return nil
2183 }
2184
2185 var errors []error
2186
2187 for idx, item := range m.GetStatuses() {
2188 _, _ = idx, item
2189
2190 if _, ok := GrpcStatusFilter_Status_name[int32(item)]; !ok {
2191 err := GrpcStatusFilterValidationError{
2192 field: fmt.Sprintf("Statuses[%v]", idx),
2193 reason: "value must be one of the defined enum values",
2194 }
2195 if !all {
2196 return err
2197 }
2198 errors = append(errors, err)
2199 }
2200
2201 }
2202
2203 // no validation rules for Exclude
2204
2205 if len(errors) > 0 {
2206 return GrpcStatusFilterMultiError(errors)
2207 }
2208
2209 return nil
2210 }
2211
2212 // GrpcStatusFilterMultiError is an error wrapping multiple validation errors
2213 // returned by GrpcStatusFilter.ValidateAll() if the designated constraints
2214 // aren't met.
2215 type GrpcStatusFilterMultiError []error
2216
2217 // Error returns a concatenation of all the error messages it wraps.
2218 func (m GrpcStatusFilterMultiError) Error() string {
2219 var msgs []string
2220 for _, err := range m {
2221 msgs = append(msgs, err.Error())
2222 }
2223 return strings.Join(msgs, "; ")
2224 }
2225
2226 // AllErrors returns a list of validation violation errors.
2227 func (m GrpcStatusFilterMultiError) AllErrors() []error { return m }
2228
2229 // GrpcStatusFilterValidationError is the validation error returned by
2230 // GrpcStatusFilter.Validate if the designated constraints aren't met.
2231 type GrpcStatusFilterValidationError struct {
2232 field string
2233 reason string
2234 cause error
2235 key bool
2236 }
2237
2238 // Field function returns field value.
2239 func (e GrpcStatusFilterValidationError) Field() string { return e.field }
2240
2241 // Reason function returns reason value.
2242 func (e GrpcStatusFilterValidationError) Reason() string { return e.reason }
2243
2244 // Cause function returns cause value.
2245 func (e GrpcStatusFilterValidationError) Cause() error { return e.cause }
2246
2247 // Key function returns key value.
2248 func (e GrpcStatusFilterValidationError) Key() bool { return e.key }
2249
2250 // ErrorName returns error name.
2251 func (e GrpcStatusFilterValidationError) ErrorName() string { return "GrpcStatusFilterValidationError" }
2252
2253 // Error satisfies the builtin error interface
2254 func (e GrpcStatusFilterValidationError) Error() string {
2255 cause := ""
2256 if e.cause != nil {
2257 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2258 }
2259
2260 key := ""
2261 if e.key {
2262 key = "key for "
2263 }
2264
2265 return fmt.Sprintf(
2266 "invalid %sGrpcStatusFilter.%s: %s%s",
2267 key,
2268 e.field,
2269 e.reason,
2270 cause)
2271 }
2272
2273 var _ error = GrpcStatusFilterValidationError{}
2274
2275 var _ interface {
2276 Field() string
2277 Reason() string
2278 Key() bool
2279 Cause() error
2280 ErrorName() string
2281 } = GrpcStatusFilterValidationError{}
2282
2283 // Validate checks the field values on ExtensionFilter with the rules defined
2284 // in the proto definition for this message. If any rules are violated, the
2285 // first error encountered is returned, or nil if there are no violations.
2286 func (m *ExtensionFilter) Validate() error {
2287 return m.validate(false)
2288 }
2289
2290 // ValidateAll checks the field values on ExtensionFilter with the rules
2291 // defined in the proto definition for this message. If any rules are
2292 // violated, the result is a list of violation errors wrapped in
2293 // ExtensionFilterMultiError, or nil if none found.
2294 func (m *ExtensionFilter) ValidateAll() error {
2295 return m.validate(true)
2296 }
2297
2298 func (m *ExtensionFilter) validate(all bool) error {
2299 if m == nil {
2300 return nil
2301 }
2302
2303 var errors []error
2304
2305 // no validation rules for Name
2306
2307 switch v := m.ConfigType.(type) {
2308 case *ExtensionFilter_Config:
2309 if v == nil {
2310 err := ExtensionFilterValidationError{
2311 field: "ConfigType",
2312 reason: "oneof value cannot be a typed-nil",
2313 }
2314 if !all {
2315 return err
2316 }
2317 errors = append(errors, err)
2318 }
2319
2320 if all {
2321 switch v := interface{}(m.GetConfig()).(type) {
2322 case interface{ ValidateAll() error }:
2323 if err := v.ValidateAll(); err != nil {
2324 errors = append(errors, ExtensionFilterValidationError{
2325 field: "Config",
2326 reason: "embedded message failed validation",
2327 cause: err,
2328 })
2329 }
2330 case interface{ Validate() error }:
2331 if err := v.Validate(); err != nil {
2332 errors = append(errors, ExtensionFilterValidationError{
2333 field: "Config",
2334 reason: "embedded message failed validation",
2335 cause: err,
2336 })
2337 }
2338 }
2339 } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
2340 if err := v.Validate(); err != nil {
2341 return ExtensionFilterValidationError{
2342 field: "Config",
2343 reason: "embedded message failed validation",
2344 cause: err,
2345 }
2346 }
2347 }
2348
2349 case *ExtensionFilter_TypedConfig:
2350 if v == nil {
2351 err := ExtensionFilterValidationError{
2352 field: "ConfigType",
2353 reason: "oneof value cannot be a typed-nil",
2354 }
2355 if !all {
2356 return err
2357 }
2358 errors = append(errors, err)
2359 }
2360
2361 if all {
2362 switch v := interface{}(m.GetTypedConfig()).(type) {
2363 case interface{ ValidateAll() error }:
2364 if err := v.ValidateAll(); err != nil {
2365 errors = append(errors, ExtensionFilterValidationError{
2366 field: "TypedConfig",
2367 reason: "embedded message failed validation",
2368 cause: err,
2369 })
2370 }
2371 case interface{ Validate() error }:
2372 if err := v.Validate(); err != nil {
2373 errors = append(errors, ExtensionFilterValidationError{
2374 field: "TypedConfig",
2375 reason: "embedded message failed validation",
2376 cause: err,
2377 })
2378 }
2379 }
2380 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
2381 if err := v.Validate(); err != nil {
2382 return ExtensionFilterValidationError{
2383 field: "TypedConfig",
2384 reason: "embedded message failed validation",
2385 cause: err,
2386 }
2387 }
2388 }
2389
2390 default:
2391 _ = v // ensures v is used
2392 }
2393
2394 if len(errors) > 0 {
2395 return ExtensionFilterMultiError(errors)
2396 }
2397
2398 return nil
2399 }
2400
2401 // ExtensionFilterMultiError is an error wrapping multiple validation errors
2402 // returned by ExtensionFilter.ValidateAll() if the designated constraints
2403 // aren't met.
2404 type ExtensionFilterMultiError []error
2405
2406 // Error returns a concatenation of all the error messages it wraps.
2407 func (m ExtensionFilterMultiError) Error() string {
2408 var msgs []string
2409 for _, err := range m {
2410 msgs = append(msgs, err.Error())
2411 }
2412 return strings.Join(msgs, "; ")
2413 }
2414
2415 // AllErrors returns a list of validation violation errors.
2416 func (m ExtensionFilterMultiError) AllErrors() []error { return m }
2417
2418 // ExtensionFilterValidationError is the validation error returned by
2419 // ExtensionFilter.Validate if the designated constraints aren't met.
2420 type ExtensionFilterValidationError struct {
2421 field string
2422 reason string
2423 cause error
2424 key bool
2425 }
2426
2427 // Field function returns field value.
2428 func (e ExtensionFilterValidationError) Field() string { return e.field }
2429
2430 // Reason function returns reason value.
2431 func (e ExtensionFilterValidationError) Reason() string { return e.reason }
2432
2433 // Cause function returns cause value.
2434 func (e ExtensionFilterValidationError) Cause() error { return e.cause }
2435
2436 // Key function returns key value.
2437 func (e ExtensionFilterValidationError) Key() bool { return e.key }
2438
2439 // ErrorName returns error name.
2440 func (e ExtensionFilterValidationError) ErrorName() string { return "ExtensionFilterValidationError" }
2441
2442 // Error satisfies the builtin error interface
2443 func (e ExtensionFilterValidationError) Error() string {
2444 cause := ""
2445 if e.cause != nil {
2446 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2447 }
2448
2449 key := ""
2450 if e.key {
2451 key = "key for "
2452 }
2453
2454 return fmt.Sprintf(
2455 "invalid %sExtensionFilter.%s: %s%s",
2456 key,
2457 e.field,
2458 e.reason,
2459 cause)
2460 }
2461
2462 var _ error = ExtensionFilterValidationError{}
2463
2464 var _ interface {
2465 Field() string
2466 Reason() string
2467 Key() bool
2468 Cause() error
2469 ErrorName() string
2470 } = ExtensionFilterValidationError{}