Debian Codegraph @

go/xds/type/matcher/v3/range.pb.validate.go

raw symbols SCIP
1 // Code generated by protoc-gen-validate. DO NOT EDIT.
2 // source: xds/type/matcher/v3/range.proto
3
4 package v3
5
6 import (
7 "bytes"
8 "errors"
9 "fmt"
10 "net"
11 "net/mail"
12 "net/url"
13 "regexp"
14 "sort"
15 "strings"
16 "time"
17 "unicode/utf8"
18
19 "google.golang.org/protobuf/types/known/anypb"
20 )
21
22 // ensure the imports are used
23 var (
24 _ = bytes.MinRead
25 _ = errors.New("")
26 _ = fmt.Print
27 _ = utf8.UTFMax
28 _ = (*regexp.Regexp)(nil)
29 _ = (*strings.Reader)(nil)
30 _ = net.IPv4len
31 _ = time.Duration(0)
32 _ = (*url.URL)(nil)
33 _ = (*mail.Address)(nil)
34 _ = anypb.Any{}
35 _ = sort.Sort
36 )
37
38 // Validate checks the field values on Int64RangeMatcher with the rules defined
39 // in the proto definition for this message. If any rules are violated, the
40 // first error encountered is returned, or nil if there are no violations.
41 func (m *Int64RangeMatcher) Validate() error {
42 return m.validate(false)
43 }
44
45 // ValidateAll checks the field values on Int64RangeMatcher with the rules
46 // defined in the proto definition for this message. If any rules are
47 // violated, the result is a list of violation errors wrapped in
48 // Int64RangeMatcherMultiError, or nil if none found.
49 func (m *Int64RangeMatcher) ValidateAll() error {
50 return m.validate(true)
51 }
52
53 func (m *Int64RangeMatcher) validate(all bool) error {
54 if m == nil {
55 return nil
56 }
57
58 var errors []error
59
60 for idx, item := range m.GetRangeMatchers() {
61 _, _ = idx, item
62
63 if all {
64 switch v := interface{}(item).(type) {
65 case interface{ ValidateAll() error }:
66 if err := v.ValidateAll(); err != nil {
67 errors = append(errors, Int64RangeMatcherValidationError{
68 field: fmt.Sprintf("RangeMatchers[%v]", idx),
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, Int64RangeMatcherValidationError{
76 field: fmt.Sprintf("RangeMatchers[%v]", idx),
77 reason: "embedded message failed validation",
78 cause: err,
79 })
80 }
81 }
82 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
83 if err := v.Validate(); err != nil {
84 return Int64RangeMatcherValidationError{
85 field: fmt.Sprintf("RangeMatchers[%v]", idx),
86 reason: "embedded message failed validation",
87 cause: err,
88 }
89 }
90 }
91
92 }
93
94 if len(errors) > 0 {
95 return Int64RangeMatcherMultiError(errors)
96 }
97
98 return nil
99 }
100
101 // Int64RangeMatcherMultiError is an error wrapping multiple validation errors
102 // returned by Int64RangeMatcher.ValidateAll() if the designated constraints
103 // aren't met.
104 type Int64RangeMatcherMultiError []error
105
106 // Error returns a concatenation of all the error messages it wraps.
107 func (m Int64RangeMatcherMultiError) Error() string {
108 msgs := make([]string, 0, len(m))
109 for _, err := range m {
110 msgs = append(msgs, err.Error())
111 }
112 return strings.Join(msgs, "; ")
113 }
114
115 // AllErrors returns a list of validation violation errors.
116 func (m Int64RangeMatcherMultiError) AllErrors() []error { return m }
117
118 // Int64RangeMatcherValidationError is the validation error returned by
119 // Int64RangeMatcher.Validate if the designated constraints aren't met.
120 type Int64RangeMatcherValidationError struct {
121 field string
122 reason string
123 cause error
124 key bool
125 }
126
127 // Field function returns field value.
128 func (e Int64RangeMatcherValidationError) Field() string { return e.field }
129
130 // Reason function returns reason value.
131 func (e Int64RangeMatcherValidationError) Reason() string { return e.reason }
132
133 // Cause function returns cause value.
134 func (e Int64RangeMatcherValidationError) Cause() error { return e.cause }
135
136 // Key function returns key value.
137 func (e Int64RangeMatcherValidationError) Key() bool { return e.key }
138
139 // ErrorName returns error name.
140 func (e Int64RangeMatcherValidationError) ErrorName() string {
141 return "Int64RangeMatcherValidationError"
142 }
143
144 // Error satisfies the builtin error interface
145 func (e Int64RangeMatcherValidationError) Error() string {
146 cause := ""
147 if e.cause != nil {
148 cause = fmt.Sprintf(" | caused by: %v", e.cause)
149 }
150
151 key := ""
152 if e.key {
153 key = "key for "
154 }
155
156 return fmt.Sprintf(
157 "invalid %sInt64RangeMatcher.%s: %s%s",
158 key,
159 e.field,
160 e.reason,
161 cause)
162 }
163
164 var _ error = Int64RangeMatcherValidationError{}
165
166 var _ interface {
167 Field() string
168 Reason() string
169 Key() bool
170 Cause() error
171 ErrorName() string
172 } = Int64RangeMatcherValidationError{}
173
174 // Validate checks the field values on Int32RangeMatcher with the rules defined
175 // in the proto definition for this message. If any rules are violated, the
176 // first error encountered is returned, or nil if there are no violations.
177 func (m *Int32RangeMatcher) Validate() error {
178 return m.validate(false)
179 }
180
181 // ValidateAll checks the field values on Int32RangeMatcher with the rules
182 // defined in the proto definition for this message. If any rules are
183 // violated, the result is a list of violation errors wrapped in
184 // Int32RangeMatcherMultiError, or nil if none found.
185 func (m *Int32RangeMatcher) ValidateAll() error {
186 return m.validate(true)
187 }
188
189 func (m *Int32RangeMatcher) validate(all bool) error {
190 if m == nil {
191 return nil
192 }
193
194 var errors []error
195
196 for idx, item := range m.GetRangeMatchers() {
197 _, _ = idx, item
198
199 if all {
200 switch v := interface{}(item).(type) {
201 case interface{ ValidateAll() error }:
202 if err := v.ValidateAll(); err != nil {
203 errors = append(errors, Int32RangeMatcherValidationError{
204 field: fmt.Sprintf("RangeMatchers[%v]", idx),
205 reason: "embedded message failed validation",
206 cause: err,
207 })
208 }
209 case interface{ Validate() error }:
210 if err := v.Validate(); err != nil {
211 errors = append(errors, Int32RangeMatcherValidationError{
212 field: fmt.Sprintf("RangeMatchers[%v]", idx),
213 reason: "embedded message failed validation",
214 cause: err,
215 })
216 }
217 }
218 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
219 if err := v.Validate(); err != nil {
220 return Int32RangeMatcherValidationError{
221 field: fmt.Sprintf("RangeMatchers[%v]", idx),
222 reason: "embedded message failed validation",
223 cause: err,
224 }
225 }
226 }
227
228 }
229
230 if len(errors) > 0 {
231 return Int32RangeMatcherMultiError(errors)
232 }
233
234 return nil
235 }
236
237 // Int32RangeMatcherMultiError is an error wrapping multiple validation errors
238 // returned by Int32RangeMatcher.ValidateAll() if the designated constraints
239 // aren't met.
240 type Int32RangeMatcherMultiError []error
241
242 // Error returns a concatenation of all the error messages it wraps.
243 func (m Int32RangeMatcherMultiError) Error() string {
244 msgs := make([]string, 0, len(m))
245 for _, err := range m {
246 msgs = append(msgs, err.Error())
247 }
248 return strings.Join(msgs, "; ")
249 }
250
251 // AllErrors returns a list of validation violation errors.
252 func (m Int32RangeMatcherMultiError) AllErrors() []error { return m }
253
254 // Int32RangeMatcherValidationError is the validation error returned by
255 // Int32RangeMatcher.Validate if the designated constraints aren't met.
256 type Int32RangeMatcherValidationError struct {
257 field string
258 reason string
259 cause error
260 key bool
261 }
262
263 // Field function returns field value.
264 func (e Int32RangeMatcherValidationError) Field() string { return e.field }
265
266 // Reason function returns reason value.
267 func (e Int32RangeMatcherValidationError) Reason() string { return e.reason }
268
269 // Cause function returns cause value.
270 func (e Int32RangeMatcherValidationError) Cause() error { return e.cause }
271
272 // Key function returns key value.
273 func (e Int32RangeMatcherValidationError) Key() bool { return e.key }
274
275 // ErrorName returns error name.
276 func (e Int32RangeMatcherValidationError) ErrorName() string {
277 return "Int32RangeMatcherValidationError"
278 }
279
280 // Error satisfies the builtin error interface
281 func (e Int32RangeMatcherValidationError) Error() string {
282 cause := ""
283 if e.cause != nil {
284 cause = fmt.Sprintf(" | caused by: %v", e.cause)
285 }
286
287 key := ""
288 if e.key {
289 key = "key for "
290 }
291
292 return fmt.Sprintf(
293 "invalid %sInt32RangeMatcher.%s: %s%s",
294 key,
295 e.field,
296 e.reason,
297 cause)
298 }
299
300 var _ error = Int32RangeMatcherValidationError{}
301
302 var _ interface {
303 Field() string
304 Reason() string
305 Key() bool
306 Cause() error
307 ErrorName() string
308 } = Int32RangeMatcherValidationError{}
309
310 // Validate checks the field values on DoubleRangeMatcher with the rules
311 // defined in the proto definition for this message. If any rules are
312 // violated, the first error encountered is returned, or nil if there are no violations.
313 func (m *DoubleRangeMatcher) Validate() error {
314 return m.validate(false)
315 }
316
317 // ValidateAll checks the field values on DoubleRangeMatcher with the rules
318 // defined in the proto definition for this message. If any rules are
319 // violated, the result is a list of violation errors wrapped in
320 // DoubleRangeMatcherMultiError, or nil if none found.
321 func (m *DoubleRangeMatcher) ValidateAll() error {
322 return m.validate(true)
323 }
324
325 func (m *DoubleRangeMatcher) validate(all bool) error {
326 if m == nil {
327 return nil
328 }
329
330 var errors []error
331
332 for idx, item := range m.GetRangeMatchers() {
333 _, _ = idx, item
334
335 if all {
336 switch v := interface{}(item).(type) {
337 case interface{ ValidateAll() error }:
338 if err := v.ValidateAll(); err != nil {
339 errors = append(errors, DoubleRangeMatcherValidationError{
340 field: fmt.Sprintf("RangeMatchers[%v]", idx),
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, DoubleRangeMatcherValidationError{
348 field: fmt.Sprintf("RangeMatchers[%v]", idx),
349 reason: "embedded message failed validation",
350 cause: err,
351 })
352 }
353 }
354 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
355 if err := v.Validate(); err != nil {
356 return DoubleRangeMatcherValidationError{
357 field: fmt.Sprintf("RangeMatchers[%v]", idx),
358 reason: "embedded message failed validation",
359 cause: err,
360 }
361 }
362 }
363
364 }
365
366 if len(errors) > 0 {
367 return DoubleRangeMatcherMultiError(errors)
368 }
369
370 return nil
371 }
372
373 // DoubleRangeMatcherMultiError is an error wrapping multiple validation errors
374 // returned by DoubleRangeMatcher.ValidateAll() if the designated constraints
375 // aren't met.
376 type DoubleRangeMatcherMultiError []error
377
378 // Error returns a concatenation of all the error messages it wraps.
379 func (m DoubleRangeMatcherMultiError) Error() string {
380 msgs := make([]string, 0, len(m))
381 for _, err := range m {
382 msgs = append(msgs, err.Error())
383 }
384 return strings.Join(msgs, "; ")
385 }
386
387 // AllErrors returns a list of validation violation errors.
388 func (m DoubleRangeMatcherMultiError) AllErrors() []error { return m }
389
390 // DoubleRangeMatcherValidationError is the validation error returned by
391 // DoubleRangeMatcher.Validate if the designated constraints aren't met.
392 type DoubleRangeMatcherValidationError struct {
393 field string
394 reason string
395 cause error
396 key bool
397 }
398
399 // Field function returns field value.
400 func (e DoubleRangeMatcherValidationError) Field() string { return e.field }
401
402 // Reason function returns reason value.
403 func (e DoubleRangeMatcherValidationError) Reason() string { return e.reason }
404
405 // Cause function returns cause value.
406 func (e DoubleRangeMatcherValidationError) Cause() error { return e.cause }
407
408 // Key function returns key value.
409 func (e DoubleRangeMatcherValidationError) Key() bool { return e.key }
410
411 // ErrorName returns error name.
412 func (e DoubleRangeMatcherValidationError) ErrorName() string {
413 return "DoubleRangeMatcherValidationError"
414 }
415
416 // Error satisfies the builtin error interface
417 func (e DoubleRangeMatcherValidationError) Error() string {
418 cause := ""
419 if e.cause != nil {
420 cause = fmt.Sprintf(" | caused by: %v", e.cause)
421 }
422
423 key := ""
424 if e.key {
425 key = "key for "
426 }
427
428 return fmt.Sprintf(
429 "invalid %sDoubleRangeMatcher.%s: %s%s",
430 key,
431 e.field,
432 e.reason,
433 cause)
434 }
435
436 var _ error = DoubleRangeMatcherValidationError{}
437
438 var _ interface {
439 Field() string
440 Reason() string
441 Key() bool
442 Cause() error
443 ErrorName() string
444 } = DoubleRangeMatcherValidationError{}
445
446 // Validate checks the field values on Int64RangeMatcher_RangeMatcher with the
447 // rules defined in the proto definition for this message. If any rules are
448 // violated, the first error encountered is returned, or nil if there are no violations.
449 func (m *Int64RangeMatcher_RangeMatcher) Validate() error {
450 return m.validate(false)
451 }
452
453 // ValidateAll checks the field values on Int64RangeMatcher_RangeMatcher with
454 // the rules defined in the proto definition for this message. If any rules
455 // are violated, the result is a list of violation errors wrapped in
456 // Int64RangeMatcher_RangeMatcherMultiError, or nil if none found.
457 func (m *Int64RangeMatcher_RangeMatcher) ValidateAll() error {
458 return m.validate(true)
459 }
460
461 func (m *Int64RangeMatcher_RangeMatcher) validate(all bool) error {
462 if m == nil {
463 return nil
464 }
465
466 var errors []error
467
468 if len(m.GetRanges()) < 1 {
469 err := Int64RangeMatcher_RangeMatcherValidationError{
470 field: "Ranges",
471 reason: "value must contain at least 1 item(s)",
472 }
473 if !all {
474 return err
475 }
476 errors = append(errors, err)
477 }
478
479 for idx, item := range m.GetRanges() {
480 _, _ = idx, item
481
482 if all {
483 switch v := interface{}(item).(type) {
484 case interface{ ValidateAll() error }:
485 if err := v.ValidateAll(); err != nil {
486 errors = append(errors, Int64RangeMatcher_RangeMatcherValidationError{
487 field: fmt.Sprintf("Ranges[%v]", idx),
488 reason: "embedded message failed validation",
489 cause: err,
490 })
491 }
492 case interface{ Validate() error }:
493 if err := v.Validate(); err != nil {
494 errors = append(errors, Int64RangeMatcher_RangeMatcherValidationError{
495 field: fmt.Sprintf("Ranges[%v]", idx),
496 reason: "embedded message failed validation",
497 cause: err,
498 })
499 }
500 }
501 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
502 if err := v.Validate(); err != nil {
503 return Int64RangeMatcher_RangeMatcherValidationError{
504 field: fmt.Sprintf("Ranges[%v]", idx),
505 reason: "embedded message failed validation",
506 cause: err,
507 }
508 }
509 }
510
511 }
512
513 if all {
514 switch v := interface{}(m.GetOnMatch()).(type) {
515 case interface{ ValidateAll() error }:
516 if err := v.ValidateAll(); err != nil {
517 errors = append(errors, Int64RangeMatcher_RangeMatcherValidationError{
518 field: "OnMatch",
519 reason: "embedded message failed validation",
520 cause: err,
521 })
522 }
523 case interface{ Validate() error }:
524 if err := v.Validate(); err != nil {
525 errors = append(errors, Int64RangeMatcher_RangeMatcherValidationError{
526 field: "OnMatch",
527 reason: "embedded message failed validation",
528 cause: err,
529 })
530 }
531 }
532 } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok {
533 if err := v.Validate(); err != nil {
534 return Int64RangeMatcher_RangeMatcherValidationError{
535 field: "OnMatch",
536 reason: "embedded message failed validation",
537 cause: err,
538 }
539 }
540 }
541
542 if len(errors) > 0 {
543 return Int64RangeMatcher_RangeMatcherMultiError(errors)
544 }
545
546 return nil
547 }
548
549 // Int64RangeMatcher_RangeMatcherMultiError is an error wrapping multiple
550 // validation errors returned by Int64RangeMatcher_RangeMatcher.ValidateAll()
551 // if the designated constraints aren't met.
552 type Int64RangeMatcher_RangeMatcherMultiError []error
553
554 // Error returns a concatenation of all the error messages it wraps.
555 func (m Int64RangeMatcher_RangeMatcherMultiError) Error() string {
556 msgs := make([]string, 0, len(m))
557 for _, err := range m {
558 msgs = append(msgs, err.Error())
559 }
560 return strings.Join(msgs, "; ")
561 }
562
563 // AllErrors returns a list of validation violation errors.
564 func (m Int64RangeMatcher_RangeMatcherMultiError) AllErrors() []error { return m }
565
566 // Int64RangeMatcher_RangeMatcherValidationError is the validation error
567 // returned by Int64RangeMatcher_RangeMatcher.Validate if the designated
568 // constraints aren't met.
569 type Int64RangeMatcher_RangeMatcherValidationError struct {
570 field string
571 reason string
572 cause error
573 key bool
574 }
575
576 // Field function returns field value.
577 func (e Int64RangeMatcher_RangeMatcherValidationError) Field() string { return e.field }
578
579 // Reason function returns reason value.
580 func (e Int64RangeMatcher_RangeMatcherValidationError) Reason() string { return e.reason }
581
582 // Cause function returns cause value.
583 func (e Int64RangeMatcher_RangeMatcherValidationError) Cause() error { return e.cause }
584
585 // Key function returns key value.
586 func (e Int64RangeMatcher_RangeMatcherValidationError) Key() bool { return e.key }
587
588 // ErrorName returns error name.
589 func (e Int64RangeMatcher_RangeMatcherValidationError) ErrorName() string {
590 return "Int64RangeMatcher_RangeMatcherValidationError"
591 }
592
593 // Error satisfies the builtin error interface
594 func (e Int64RangeMatcher_RangeMatcherValidationError) Error() string {
595 cause := ""
596 if e.cause != nil {
597 cause = fmt.Sprintf(" | caused by: %v", e.cause)
598 }
599
600 key := ""
601 if e.key {
602 key = "key for "
603 }
604
605 return fmt.Sprintf(
606 "invalid %sInt64RangeMatcher_RangeMatcher.%s: %s%s",
607 key,
608 e.field,
609 e.reason,
610 cause)
611 }
612
613 var _ error = Int64RangeMatcher_RangeMatcherValidationError{}
614
615 var _ interface {
616 Field() string
617 Reason() string
618 Key() bool
619 Cause() error
620 ErrorName() string
621 } = Int64RangeMatcher_RangeMatcherValidationError{}
622
623 // Validate checks the field values on Int32RangeMatcher_RangeMatcher with the
624 // rules defined in the proto definition for this message. If any rules are
625 // violated, the first error encountered is returned, or nil if there are no violations.
626 func (m *Int32RangeMatcher_RangeMatcher) Validate() error {
627 return m.validate(false)
628 }
629
630 // ValidateAll checks the field values on Int32RangeMatcher_RangeMatcher with
631 // the rules defined in the proto definition for this message. If any rules
632 // are violated, the result is a list of violation errors wrapped in
633 // Int32RangeMatcher_RangeMatcherMultiError, or nil if none found.
634 func (m *Int32RangeMatcher_RangeMatcher) ValidateAll() error {
635 return m.validate(true)
636 }
637
638 func (m *Int32RangeMatcher_RangeMatcher) validate(all bool) error {
639 if m == nil {
640 return nil
641 }
642
643 var errors []error
644
645 if len(m.GetRanges()) < 1 {
646 err := Int32RangeMatcher_RangeMatcherValidationError{
647 field: "Ranges",
648 reason: "value must contain at least 1 item(s)",
649 }
650 if !all {
651 return err
652 }
653 errors = append(errors, err)
654 }
655
656 for idx, item := range m.GetRanges() {
657 _, _ = idx, item
658
659 if all {
660 switch v := interface{}(item).(type) {
661 case interface{ ValidateAll() error }:
662 if err := v.ValidateAll(); err != nil {
663 errors = append(errors, Int32RangeMatcher_RangeMatcherValidationError{
664 field: fmt.Sprintf("Ranges[%v]", idx),
665 reason: "embedded message failed validation",
666 cause: err,
667 })
668 }
669 case interface{ Validate() error }:
670 if err := v.Validate(); err != nil {
671 errors = append(errors, Int32RangeMatcher_RangeMatcherValidationError{
672 field: fmt.Sprintf("Ranges[%v]", idx),
673 reason: "embedded message failed validation",
674 cause: err,
675 })
676 }
677 }
678 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
679 if err := v.Validate(); err != nil {
680 return Int32RangeMatcher_RangeMatcherValidationError{
681 field: fmt.Sprintf("Ranges[%v]", idx),
682 reason: "embedded message failed validation",
683 cause: err,
684 }
685 }
686 }
687
688 }
689
690 if all {
691 switch v := interface{}(m.GetOnMatch()).(type) {
692 case interface{ ValidateAll() error }:
693 if err := v.ValidateAll(); err != nil {
694 errors = append(errors, Int32RangeMatcher_RangeMatcherValidationError{
695 field: "OnMatch",
696 reason: "embedded message failed validation",
697 cause: err,
698 })
699 }
700 case interface{ Validate() error }:
701 if err := v.Validate(); err != nil {
702 errors = append(errors, Int32RangeMatcher_RangeMatcherValidationError{
703 field: "OnMatch",
704 reason: "embedded message failed validation",
705 cause: err,
706 })
707 }
708 }
709 } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok {
710 if err := v.Validate(); err != nil {
711 return Int32RangeMatcher_RangeMatcherValidationError{
712 field: "OnMatch",
713 reason: "embedded message failed validation",
714 cause: err,
715 }
716 }
717 }
718
719 if len(errors) > 0 {
720 return Int32RangeMatcher_RangeMatcherMultiError(errors)
721 }
722
723 return nil
724 }
725
726 // Int32RangeMatcher_RangeMatcherMultiError is an error wrapping multiple
727 // validation errors returned by Int32RangeMatcher_RangeMatcher.ValidateAll()
728 // if the designated constraints aren't met.
729 type Int32RangeMatcher_RangeMatcherMultiError []error
730
731 // Error returns a concatenation of all the error messages it wraps.
732 func (m Int32RangeMatcher_RangeMatcherMultiError) Error() string {
733 msgs := make([]string, 0, len(m))
734 for _, err := range m {
735 msgs = append(msgs, err.Error())
736 }
737 return strings.Join(msgs, "; ")
738 }
739
740 // AllErrors returns a list of validation violation errors.
741 func (m Int32RangeMatcher_RangeMatcherMultiError) AllErrors() []error { return m }
742
743 // Int32RangeMatcher_RangeMatcherValidationError is the validation error
744 // returned by Int32RangeMatcher_RangeMatcher.Validate if the designated
745 // constraints aren't met.
746 type Int32RangeMatcher_RangeMatcherValidationError struct {
747 field string
748 reason string
749 cause error
750 key bool
751 }
752
753 // Field function returns field value.
754 func (e Int32RangeMatcher_RangeMatcherValidationError) Field() string { return e.field }
755
756 // Reason function returns reason value.
757 func (e Int32RangeMatcher_RangeMatcherValidationError) Reason() string { return e.reason }
758
759 // Cause function returns cause value.
760 func (e Int32RangeMatcher_RangeMatcherValidationError) Cause() error { return e.cause }
761
762 // Key function returns key value.
763 func (e Int32RangeMatcher_RangeMatcherValidationError) Key() bool { return e.key }
764
765 // ErrorName returns error name.
766 func (e Int32RangeMatcher_RangeMatcherValidationError) ErrorName() string {
767 return "Int32RangeMatcher_RangeMatcherValidationError"
768 }
769
770 // Error satisfies the builtin error interface
771 func (e Int32RangeMatcher_RangeMatcherValidationError) Error() string {
772 cause := ""
773 if e.cause != nil {
774 cause = fmt.Sprintf(" | caused by: %v", e.cause)
775 }
776
777 key := ""
778 if e.key {
779 key = "key for "
780 }
781
782 return fmt.Sprintf(
783 "invalid %sInt32RangeMatcher_RangeMatcher.%s: %s%s",
784 key,
785 e.field,
786 e.reason,
787 cause)
788 }
789
790 var _ error = Int32RangeMatcher_RangeMatcherValidationError{}
791
792 var _ interface {
793 Field() string
794 Reason() string
795 Key() bool
796 Cause() error
797 ErrorName() string
798 } = Int32RangeMatcher_RangeMatcherValidationError{}
799
800 // Validate checks the field values on DoubleRangeMatcher_RangeMatcher with the
801 // rules defined in the proto definition for this message. If any rules are
802 // violated, the first error encountered is returned, or nil if there are no violations.
803 func (m *DoubleRangeMatcher_RangeMatcher) Validate() error {
804 return m.validate(false)
805 }
806
807 // ValidateAll checks the field values on DoubleRangeMatcher_RangeMatcher with
808 // the rules defined in the proto definition for this message. If any rules
809 // are violated, the result is a list of violation errors wrapped in
810 // DoubleRangeMatcher_RangeMatcherMultiError, or nil if none found.
811 func (m *DoubleRangeMatcher_RangeMatcher) ValidateAll() error {
812 return m.validate(true)
813 }
814
815 func (m *DoubleRangeMatcher_RangeMatcher) validate(all bool) error {
816 if m == nil {
817 return nil
818 }
819
820 var errors []error
821
822 if len(m.GetRanges()) < 1 {
823 err := DoubleRangeMatcher_RangeMatcherValidationError{
824 field: "Ranges",
825 reason: "value must contain at least 1 item(s)",
826 }
827 if !all {
828 return err
829 }
830 errors = append(errors, err)
831 }
832
833 for idx, item := range m.GetRanges() {
834 _, _ = idx, item
835
836 if all {
837 switch v := interface{}(item).(type) {
838 case interface{ ValidateAll() error }:
839 if err := v.ValidateAll(); err != nil {
840 errors = append(errors, DoubleRangeMatcher_RangeMatcherValidationError{
841 field: fmt.Sprintf("Ranges[%v]", idx),
842 reason: "embedded message failed validation",
843 cause: err,
844 })
845 }
846 case interface{ Validate() error }:
847 if err := v.Validate(); err != nil {
848 errors = append(errors, DoubleRangeMatcher_RangeMatcherValidationError{
849 field: fmt.Sprintf("Ranges[%v]", idx),
850 reason: "embedded message failed validation",
851 cause: err,
852 })
853 }
854 }
855 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
856 if err := v.Validate(); err != nil {
857 return DoubleRangeMatcher_RangeMatcherValidationError{
858 field: fmt.Sprintf("Ranges[%v]", idx),
859 reason: "embedded message failed validation",
860 cause: err,
861 }
862 }
863 }
864
865 }
866
867 if all {
868 switch v := interface{}(m.GetOnMatch()).(type) {
869 case interface{ ValidateAll() error }:
870 if err := v.ValidateAll(); err != nil {
871 errors = append(errors, DoubleRangeMatcher_RangeMatcherValidationError{
872 field: "OnMatch",
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, DoubleRangeMatcher_RangeMatcherValidationError{
880 field: "OnMatch",
881 reason: "embedded message failed validation",
882 cause: err,
883 })
884 }
885 }
886 } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok {
887 if err := v.Validate(); err != nil {
888 return DoubleRangeMatcher_RangeMatcherValidationError{
889 field: "OnMatch",
890 reason: "embedded message failed validation",
891 cause: err,
892 }
893 }
894 }
895
896 if len(errors) > 0 {
897 return DoubleRangeMatcher_RangeMatcherMultiError(errors)
898 }
899
900 return nil
901 }
902
903 // DoubleRangeMatcher_RangeMatcherMultiError is an error wrapping multiple
904 // validation errors returned by DoubleRangeMatcher_RangeMatcher.ValidateAll()
905 // if the designated constraints aren't met.
906 type DoubleRangeMatcher_RangeMatcherMultiError []error
907
908 // Error returns a concatenation of all the error messages it wraps.
909 func (m DoubleRangeMatcher_RangeMatcherMultiError) Error() string {
910 msgs := make([]string, 0, len(m))
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 DoubleRangeMatcher_RangeMatcherMultiError) AllErrors() []error { return m }
919
920 // DoubleRangeMatcher_RangeMatcherValidationError is the validation error
921 // returned by DoubleRangeMatcher_RangeMatcher.Validate if the designated
922 // constraints aren't met.
923 type DoubleRangeMatcher_RangeMatcherValidationError struct {
924 field string
925 reason string
926 cause error
927 key bool
928 }
929
930 // Field function returns field value.
931 func (e DoubleRangeMatcher_RangeMatcherValidationError) Field() string { return e.field }
932
933 // Reason function returns reason value.
934 func (e DoubleRangeMatcher_RangeMatcherValidationError) Reason() string { return e.reason }
935
936 // Cause function returns cause value.
937 func (e DoubleRangeMatcher_RangeMatcherValidationError) Cause() error { return e.cause }
938
939 // Key function returns key value.
940 func (e DoubleRangeMatcher_RangeMatcherValidationError) Key() bool { return e.key }
941
942 // ErrorName returns error name.
943 func (e DoubleRangeMatcher_RangeMatcherValidationError) ErrorName() string {
944 return "DoubleRangeMatcher_RangeMatcherValidationError"
945 }
946
947 // Error satisfies the builtin error interface
948 func (e DoubleRangeMatcher_RangeMatcherValidationError) Error() string {
949 cause := ""
950 if e.cause != nil {
951 cause = fmt.Sprintf(" | caused by: %v", e.cause)
952 }
953
954 key := ""
955 if e.key {
956 key = "key for "
957 }
958
959 return fmt.Sprintf(
960 "invalid %sDoubleRangeMatcher_RangeMatcher.%s: %s%s",
961 key,
962 e.field,
963 e.reason,
964 cause)
965 }
966
967 var _ error = DoubleRangeMatcher_RangeMatcherValidationError{}
968
969 var _ interface {
970 Field() string
971 Reason() string
972 Key() bool
973 Cause() error
974 ErrorName() string
975 } = DoubleRangeMatcher_RangeMatcherValidationError{}