Debian Codegraph @

envoy/config/metrics/v3/stats.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/config/metrics/v3/stats.proto
4
5 package metricsv3
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 StatsSink 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 *StatsSink) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on StatsSink 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 StatsSinkMultiError, or nil
49 // if none found.
50 func (m *StatsSink) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *StatsSink) 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 switch v := m.ConfigType.(type) {
64 case *StatsSink_TypedConfig:
65 if v == nil {
66 err := StatsSinkValidationError{
67 field: "ConfigType",
68 reason: "oneof value cannot be a typed-nil",
69 }
70 if !all {
71 return err
72 }
73 errors = append(errors, err)
74 }
75
76 if all {
77 switch v := interface{}(m.GetTypedConfig()).(type) {
78 case interface{ ValidateAll() error }:
79 if err := v.ValidateAll(); err != nil {
80 errors = append(errors, StatsSinkValidationError{
81 field: "TypedConfig",
82 reason: "embedded message failed validation",
83 cause: err,
84 })
85 }
86 case interface{ Validate() error }:
87 if err := v.Validate(); err != nil {
88 errors = append(errors, StatsSinkValidationError{
89 field: "TypedConfig",
90 reason: "embedded message failed validation",
91 cause: err,
92 })
93 }
94 }
95 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
96 if err := v.Validate(); err != nil {
97 return StatsSinkValidationError{
98 field: "TypedConfig",
99 reason: "embedded message failed validation",
100 cause: err,
101 }
102 }
103 }
104
105 default:
106 _ = v // ensures v is used
107 }
108
109 if len(errors) > 0 {
110 return StatsSinkMultiError(errors)
111 }
112
113 return nil
114 }
115
116 // StatsSinkMultiError is an error wrapping multiple validation errors returned
117 // by StatsSink.ValidateAll() if the designated constraints aren't met.
118 type StatsSinkMultiError []error
119
120 // Error returns a concatenation of all the error messages it wraps.
121 func (m StatsSinkMultiError) Error() string {
122 var msgs []string
123 for _, err := range m {
124 msgs = append(msgs, err.Error())
125 }
126 return strings.Join(msgs, "; ")
127 }
128
129 // AllErrors returns a list of validation violation errors.
130 func (m StatsSinkMultiError) AllErrors() []error { return m }
131
132 // StatsSinkValidationError is the validation error returned by
133 // StatsSink.Validate if the designated constraints aren't met.
134 type StatsSinkValidationError struct {
135 field string
136 reason string
137 cause error
138 key bool
139 }
140
141 // Field function returns field value.
142 func (e StatsSinkValidationError) Field() string { return e.field }
143
144 // Reason function returns reason value.
145 func (e StatsSinkValidationError) Reason() string { return e.reason }
146
147 // Cause function returns cause value.
148 func (e StatsSinkValidationError) Cause() error { return e.cause }
149
150 // Key function returns key value.
151 func (e StatsSinkValidationError) Key() bool { return e.key }
152
153 // ErrorName returns error name.
154 func (e StatsSinkValidationError) ErrorName() string { return "StatsSinkValidationError" }
155
156 // Error satisfies the builtin error interface
157 func (e StatsSinkValidationError) Error() string {
158 cause := ""
159 if e.cause != nil {
160 cause = fmt.Sprintf(" | caused by: %v", e.cause)
161 }
162
163 key := ""
164 if e.key {
165 key = "key for "
166 }
167
168 return fmt.Sprintf(
169 "invalid %sStatsSink.%s: %s%s",
170 key,
171 e.field,
172 e.reason,
173 cause)
174 }
175
176 var _ error = StatsSinkValidationError{}
177
178 var _ interface {
179 Field() string
180 Reason() string
181 Key() bool
182 Cause() error
183 ErrorName() string
184 } = StatsSinkValidationError{}
185
186 // Validate checks the field values on StatsConfig with the rules defined in
187 // the proto definition for this message. If any rules are violated, the first
188 // error encountered is returned, or nil if there are no violations.
189 func (m *StatsConfig) Validate() error {
190 return m.validate(false)
191 }
192
193 // ValidateAll checks the field values on StatsConfig with the rules defined in
194 // the proto definition for this message. If any rules are violated, the
195 // result is a list of violation errors wrapped in StatsConfigMultiError, or
196 // nil if none found.
197 func (m *StatsConfig) ValidateAll() error {
198 return m.validate(true)
199 }
200
201 func (m *StatsConfig) validate(all bool) error {
202 if m == nil {
203 return nil
204 }
205
206 var errors []error
207
208 for idx, item := range m.GetStatsTags() {
209 _, _ = idx, item
210
211 if all {
212 switch v := interface{}(item).(type) {
213 case interface{ ValidateAll() error }:
214 if err := v.ValidateAll(); err != nil {
215 errors = append(errors, StatsConfigValidationError{
216 field: fmt.Sprintf("StatsTags[%v]", idx),
217 reason: "embedded message failed validation",
218 cause: err,
219 })
220 }
221 case interface{ Validate() error }:
222 if err := v.Validate(); err != nil {
223 errors = append(errors, StatsConfigValidationError{
224 field: fmt.Sprintf("StatsTags[%v]", idx),
225 reason: "embedded message failed validation",
226 cause: err,
227 })
228 }
229 }
230 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
231 if err := v.Validate(); err != nil {
232 return StatsConfigValidationError{
233 field: fmt.Sprintf("StatsTags[%v]", idx),
234 reason: "embedded message failed validation",
235 cause: err,
236 }
237 }
238 }
239
240 }
241
242 if all {
243 switch v := interface{}(m.GetUseAllDefaultTags()).(type) {
244 case interface{ ValidateAll() error }:
245 if err := v.ValidateAll(); err != nil {
246 errors = append(errors, StatsConfigValidationError{
247 field: "UseAllDefaultTags",
248 reason: "embedded message failed validation",
249 cause: err,
250 })
251 }
252 case interface{ Validate() error }:
253 if err := v.Validate(); err != nil {
254 errors = append(errors, StatsConfigValidationError{
255 field: "UseAllDefaultTags",
256 reason: "embedded message failed validation",
257 cause: err,
258 })
259 }
260 }
261 } else if v, ok := interface{}(m.GetUseAllDefaultTags()).(interface{ Validate() error }); ok {
262 if err := v.Validate(); err != nil {
263 return StatsConfigValidationError{
264 field: "UseAllDefaultTags",
265 reason: "embedded message failed validation",
266 cause: err,
267 }
268 }
269 }
270
271 if all {
272 switch v := interface{}(m.GetStatsMatcher()).(type) {
273 case interface{ ValidateAll() error }:
274 if err := v.ValidateAll(); err != nil {
275 errors = append(errors, StatsConfigValidationError{
276 field: "StatsMatcher",
277 reason: "embedded message failed validation",
278 cause: err,
279 })
280 }
281 case interface{ Validate() error }:
282 if err := v.Validate(); err != nil {
283 errors = append(errors, StatsConfigValidationError{
284 field: "StatsMatcher",
285 reason: "embedded message failed validation",
286 cause: err,
287 })
288 }
289 }
290 } else if v, ok := interface{}(m.GetStatsMatcher()).(interface{ Validate() error }); ok {
291 if err := v.Validate(); err != nil {
292 return StatsConfigValidationError{
293 field: "StatsMatcher",
294 reason: "embedded message failed validation",
295 cause: err,
296 }
297 }
298 }
299
300 for idx, item := range m.GetHistogramBucketSettings() {
301 _, _ = idx, item
302
303 if all {
304 switch v := interface{}(item).(type) {
305 case interface{ ValidateAll() error }:
306 if err := v.ValidateAll(); err != nil {
307 errors = append(errors, StatsConfigValidationError{
308 field: fmt.Sprintf("HistogramBucketSettings[%v]", idx),
309 reason: "embedded message failed validation",
310 cause: err,
311 })
312 }
313 case interface{ Validate() error }:
314 if err := v.Validate(); err != nil {
315 errors = append(errors, StatsConfigValidationError{
316 field: fmt.Sprintf("HistogramBucketSettings[%v]", idx),
317 reason: "embedded message failed validation",
318 cause: err,
319 })
320 }
321 }
322 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
323 if err := v.Validate(); err != nil {
324 return StatsConfigValidationError{
325 field: fmt.Sprintf("HistogramBucketSettings[%v]", idx),
326 reason: "embedded message failed validation",
327 cause: err,
328 }
329 }
330 }
331
332 }
333
334 if len(errors) > 0 {
335 return StatsConfigMultiError(errors)
336 }
337
338 return nil
339 }
340
341 // StatsConfigMultiError is an error wrapping multiple validation errors
342 // returned by StatsConfig.ValidateAll() if the designated constraints aren't met.
343 type StatsConfigMultiError []error
344
345 // Error returns a concatenation of all the error messages it wraps.
346 func (m StatsConfigMultiError) Error() string {
347 var msgs []string
348 for _, err := range m {
349 msgs = append(msgs, err.Error())
350 }
351 return strings.Join(msgs, "; ")
352 }
353
354 // AllErrors returns a list of validation violation errors.
355 func (m StatsConfigMultiError) AllErrors() []error { return m }
356
357 // StatsConfigValidationError is the validation error returned by
358 // StatsConfig.Validate if the designated constraints aren't met.
359 type StatsConfigValidationError struct {
360 field string
361 reason string
362 cause error
363 key bool
364 }
365
366 // Field function returns field value.
367 func (e StatsConfigValidationError) Field() string { return e.field }
368
369 // Reason function returns reason value.
370 func (e StatsConfigValidationError) Reason() string { return e.reason }
371
372 // Cause function returns cause value.
373 func (e StatsConfigValidationError) Cause() error { return e.cause }
374
375 // Key function returns key value.
376 func (e StatsConfigValidationError) Key() bool { return e.key }
377
378 // ErrorName returns error name.
379 func (e StatsConfigValidationError) ErrorName() string { return "StatsConfigValidationError" }
380
381 // Error satisfies the builtin error interface
382 func (e StatsConfigValidationError) Error() string {
383 cause := ""
384 if e.cause != nil {
385 cause = fmt.Sprintf(" | caused by: %v", e.cause)
386 }
387
388 key := ""
389 if e.key {
390 key = "key for "
391 }
392
393 return fmt.Sprintf(
394 "invalid %sStatsConfig.%s: %s%s",
395 key,
396 e.field,
397 e.reason,
398 cause)
399 }
400
401 var _ error = StatsConfigValidationError{}
402
403 var _ interface {
404 Field() string
405 Reason() string
406 Key() bool
407 Cause() error
408 ErrorName() string
409 } = StatsConfigValidationError{}
410
411 // Validate checks the field values on StatsMatcher with the rules defined in
412 // the proto definition for this message. If any rules are violated, the first
413 // error encountered is returned, or nil if there are no violations.
414 func (m *StatsMatcher) Validate() error {
415 return m.validate(false)
416 }
417
418 // ValidateAll checks the field values on StatsMatcher with the rules defined
419 // in the proto definition for this message. If any rules are violated, the
420 // result is a list of violation errors wrapped in StatsMatcherMultiError, or
421 // nil if none found.
422 func (m *StatsMatcher) ValidateAll() error {
423 return m.validate(true)
424 }
425
426 func (m *StatsMatcher) validate(all bool) error {
427 if m == nil {
428 return nil
429 }
430
431 var errors []error
432
433 oneofStatsMatcherPresent := false
434 switch v := m.StatsMatcher.(type) {
435 case *StatsMatcher_RejectAll:
436 if v == nil {
437 err := StatsMatcherValidationError{
438 field: "StatsMatcher",
439 reason: "oneof value cannot be a typed-nil",
440 }
441 if !all {
442 return err
443 }
444 errors = append(errors, err)
445 }
446 oneofStatsMatcherPresent = true
447 // no validation rules for RejectAll
448 case *StatsMatcher_ExclusionList:
449 if v == nil {
450 err := StatsMatcherValidationError{
451 field: "StatsMatcher",
452 reason: "oneof value cannot be a typed-nil",
453 }
454 if !all {
455 return err
456 }
457 errors = append(errors, err)
458 }
459 oneofStatsMatcherPresent = true
460
461 if all {
462 switch v := interface{}(m.GetExclusionList()).(type) {
463 case interface{ ValidateAll() error }:
464 if err := v.ValidateAll(); err != nil {
465 errors = append(errors, StatsMatcherValidationError{
466 field: "ExclusionList",
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, StatsMatcherValidationError{
474 field: "ExclusionList",
475 reason: "embedded message failed validation",
476 cause: err,
477 })
478 }
479 }
480 } else if v, ok := interface{}(m.GetExclusionList()).(interface{ Validate() error }); ok {
481 if err := v.Validate(); err != nil {
482 return StatsMatcherValidationError{
483 field: "ExclusionList",
484 reason: "embedded message failed validation",
485 cause: err,
486 }
487 }
488 }
489
490 case *StatsMatcher_InclusionList:
491 if v == nil {
492 err := StatsMatcherValidationError{
493 field: "StatsMatcher",
494 reason: "oneof value cannot be a typed-nil",
495 }
496 if !all {
497 return err
498 }
499 errors = append(errors, err)
500 }
501 oneofStatsMatcherPresent = true
502
503 if all {
504 switch v := interface{}(m.GetInclusionList()).(type) {
505 case interface{ ValidateAll() error }:
506 if err := v.ValidateAll(); err != nil {
507 errors = append(errors, StatsMatcherValidationError{
508 field: "InclusionList",
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, StatsMatcherValidationError{
516 field: "InclusionList",
517 reason: "embedded message failed validation",
518 cause: err,
519 })
520 }
521 }
522 } else if v, ok := interface{}(m.GetInclusionList()).(interface{ Validate() error }); ok {
523 if err := v.Validate(); err != nil {
524 return StatsMatcherValidationError{
525 field: "InclusionList",
526 reason: "embedded message failed validation",
527 cause: err,
528 }
529 }
530 }
531
532 default:
533 _ = v // ensures v is used
534 }
535 if !oneofStatsMatcherPresent {
536 err := StatsMatcherValidationError{
537 field: "StatsMatcher",
538 reason: "value is required",
539 }
540 if !all {
541 return err
542 }
543 errors = append(errors, err)
544 }
545
546 if len(errors) > 0 {
547 return StatsMatcherMultiError(errors)
548 }
549
550 return nil
551 }
552
553 // StatsMatcherMultiError is an error wrapping multiple validation errors
554 // returned by StatsMatcher.ValidateAll() if the designated constraints aren't met.
555 type StatsMatcherMultiError []error
556
557 // Error returns a concatenation of all the error messages it wraps.
558 func (m StatsMatcherMultiError) Error() string {
559 var msgs []string
560 for _, err := range m {
561 msgs = append(msgs, err.Error())
562 }
563 return strings.Join(msgs, "; ")
564 }
565
566 // AllErrors returns a list of validation violation errors.
567 func (m StatsMatcherMultiError) AllErrors() []error { return m }
568
569 // StatsMatcherValidationError is the validation error returned by
570 // StatsMatcher.Validate if the designated constraints aren't met.
571 type StatsMatcherValidationError struct {
572 field string
573 reason string
574 cause error
575 key bool
576 }
577
578 // Field function returns field value.
579 func (e StatsMatcherValidationError) Field() string { return e.field }
580
581 // Reason function returns reason value.
582 func (e StatsMatcherValidationError) Reason() string { return e.reason }
583
584 // Cause function returns cause value.
585 func (e StatsMatcherValidationError) Cause() error { return e.cause }
586
587 // Key function returns key value.
588 func (e StatsMatcherValidationError) Key() bool { return e.key }
589
590 // ErrorName returns error name.
591 func (e StatsMatcherValidationError) ErrorName() string { return "StatsMatcherValidationError" }
592
593 // Error satisfies the builtin error interface
594 func (e StatsMatcherValidationError) 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 %sStatsMatcher.%s: %s%s",
607 key,
608 e.field,
609 e.reason,
610 cause)
611 }
612
613 var _ error = StatsMatcherValidationError{}
614
615 var _ interface {
616 Field() string
617 Reason() string
618 Key() bool
619 Cause() error
620 ErrorName() string
621 } = StatsMatcherValidationError{}
622
623 // Validate checks the field values on TagSpecifier with the rules defined in
624 // the proto definition for this message. If any rules are violated, the first
625 // error encountered is returned, or nil if there are no violations.
626 func (m *TagSpecifier) Validate() error {
627 return m.validate(false)
628 }
629
630 // ValidateAll checks the field values on TagSpecifier with the rules defined
631 // in the proto definition for this message. If any rules are violated, the
632 // result is a list of violation errors wrapped in TagSpecifierMultiError, or
633 // nil if none found.
634 func (m *TagSpecifier) ValidateAll() error {
635 return m.validate(true)
636 }
637
638 func (m *TagSpecifier) validate(all bool) error {
639 if m == nil {
640 return nil
641 }
642
643 var errors []error
644
645 // no validation rules for TagName
646
647 switch v := m.TagValue.(type) {
648 case *TagSpecifier_Regex:
649 if v == nil {
650 err := TagSpecifierValidationError{
651 field: "TagValue",
652 reason: "oneof value cannot be a typed-nil",
653 }
654 if !all {
655 return err
656 }
657 errors = append(errors, err)
658 }
659
660 if len(m.GetRegex()) > 1024 {
661 err := TagSpecifierValidationError{
662 field: "Regex",
663 reason: "value length must be at most 1024 bytes",
664 }
665 if !all {
666 return err
667 }
668 errors = append(errors, err)
669 }
670
671 case *TagSpecifier_FixedValue:
672 if v == nil {
673 err := TagSpecifierValidationError{
674 field: "TagValue",
675 reason: "oneof value cannot be a typed-nil",
676 }
677 if !all {
678 return err
679 }
680 errors = append(errors, err)
681 }
682 // no validation rules for FixedValue
683 default:
684 _ = v // ensures v is used
685 }
686
687 if len(errors) > 0 {
688 return TagSpecifierMultiError(errors)
689 }
690
691 return nil
692 }
693
694 // TagSpecifierMultiError is an error wrapping multiple validation errors
695 // returned by TagSpecifier.ValidateAll() if the designated constraints aren't met.
696 type TagSpecifierMultiError []error
697
698 // Error returns a concatenation of all the error messages it wraps.
699 func (m TagSpecifierMultiError) Error() string {
700 var msgs []string
701 for _, err := range m {
702 msgs = append(msgs, err.Error())
703 }
704 return strings.Join(msgs, "; ")
705 }
706
707 // AllErrors returns a list of validation violation errors.
708 func (m TagSpecifierMultiError) AllErrors() []error { return m }
709
710 // TagSpecifierValidationError is the validation error returned by
711 // TagSpecifier.Validate if the designated constraints aren't met.
712 type TagSpecifierValidationError struct {
713 field string
714 reason string
715 cause error
716 key bool
717 }
718
719 // Field function returns field value.
720 func (e TagSpecifierValidationError) Field() string { return e.field }
721
722 // Reason function returns reason value.
723 func (e TagSpecifierValidationError) Reason() string { return e.reason }
724
725 // Cause function returns cause value.
726 func (e TagSpecifierValidationError) Cause() error { return e.cause }
727
728 // Key function returns key value.
729 func (e TagSpecifierValidationError) Key() bool { return e.key }
730
731 // ErrorName returns error name.
732 func (e TagSpecifierValidationError) ErrorName() string { return "TagSpecifierValidationError" }
733
734 // Error satisfies the builtin error interface
735 func (e TagSpecifierValidationError) Error() string {
736 cause := ""
737 if e.cause != nil {
738 cause = fmt.Sprintf(" | caused by: %v", e.cause)
739 }
740
741 key := ""
742 if e.key {
743 key = "key for "
744 }
745
746 return fmt.Sprintf(
747 "invalid %sTagSpecifier.%s: %s%s",
748 key,
749 e.field,
750 e.reason,
751 cause)
752 }
753
754 var _ error = TagSpecifierValidationError{}
755
756 var _ interface {
757 Field() string
758 Reason() string
759 Key() bool
760 Cause() error
761 ErrorName() string
762 } = TagSpecifierValidationError{}
763
764 // Validate checks the field values on HistogramBucketSettings with the rules
765 // defined in the proto definition for this message. If any rules are
766 // violated, the first error encountered is returned, or nil if there are no violations.
767 func (m *HistogramBucketSettings) Validate() error {
768 return m.validate(false)
769 }
770
771 // ValidateAll checks the field values on HistogramBucketSettings with the
772 // rules defined in the proto definition for this message. If any rules are
773 // violated, the result is a list of violation errors wrapped in
774 // HistogramBucketSettingsMultiError, or nil if none found.
775 func (m *HistogramBucketSettings) ValidateAll() error {
776 return m.validate(true)
777 }
778
779 func (m *HistogramBucketSettings) validate(all bool) error {
780 if m == nil {
781 return nil
782 }
783
784 var errors []error
785
786 if m.GetMatch() == nil {
787 err := HistogramBucketSettingsValidationError{
788 field: "Match",
789 reason: "value is required",
790 }
791 if !all {
792 return err
793 }
794 errors = append(errors, err)
795 }
796
797 if all {
798 switch v := interface{}(m.GetMatch()).(type) {
799 case interface{ ValidateAll() error }:
800 if err := v.ValidateAll(); err != nil {
801 errors = append(errors, HistogramBucketSettingsValidationError{
802 field: "Match",
803 reason: "embedded message failed validation",
804 cause: err,
805 })
806 }
807 case interface{ Validate() error }:
808 if err := v.Validate(); err != nil {
809 errors = append(errors, HistogramBucketSettingsValidationError{
810 field: "Match",
811 reason: "embedded message failed validation",
812 cause: err,
813 })
814 }
815 }
816 } else if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok {
817 if err := v.Validate(); err != nil {
818 return HistogramBucketSettingsValidationError{
819 field: "Match",
820 reason: "embedded message failed validation",
821 cause: err,
822 }
823 }
824 }
825
826 if len(m.GetBuckets()) < 1 {
827 err := HistogramBucketSettingsValidationError{
828 field: "Buckets",
829 reason: "value must contain at least 1 item(s)",
830 }
831 if !all {
832 return err
833 }
834 errors = append(errors, err)
835 }
836
837 _HistogramBucketSettings_Buckets_Unique := make(map[float64]struct{}, len(m.GetBuckets()))
838
839 for idx, item := range m.GetBuckets() {
840 _, _ = idx, item
841
842 if _, exists := _HistogramBucketSettings_Buckets_Unique[item]; exists {
843 err := HistogramBucketSettingsValidationError{
844 field: fmt.Sprintf("Buckets[%v]", idx),
845 reason: "repeated value must contain unique items",
846 }
847 if !all {
848 return err
849 }
850 errors = append(errors, err)
851 } else {
852 _HistogramBucketSettings_Buckets_Unique[item] = struct{}{}
853 }
854
855 if item <= 0 {
856 err := HistogramBucketSettingsValidationError{
857 field: fmt.Sprintf("Buckets[%v]", idx),
858 reason: "value must be greater than 0",
859 }
860 if !all {
861 return err
862 }
863 errors = append(errors, err)
864 }
865
866 }
867
868 if len(errors) > 0 {
869 return HistogramBucketSettingsMultiError(errors)
870 }
871
872 return nil
873 }
874
875 // HistogramBucketSettingsMultiError is an error wrapping multiple validation
876 // errors returned by HistogramBucketSettings.ValidateAll() if the designated
877 // constraints aren't met.
878 type HistogramBucketSettingsMultiError []error
879
880 // Error returns a concatenation of all the error messages it wraps.
881 func (m HistogramBucketSettingsMultiError) Error() string {
882 var msgs []string
883 for _, err := range m {
884 msgs = append(msgs, err.Error())
885 }
886 return strings.Join(msgs, "; ")
887 }
888
889 // AllErrors returns a list of validation violation errors.
890 func (m HistogramBucketSettingsMultiError) AllErrors() []error { return m }
891
892 // HistogramBucketSettingsValidationError is the validation error returned by
893 // HistogramBucketSettings.Validate if the designated constraints aren't met.
894 type HistogramBucketSettingsValidationError struct {
895 field string
896 reason string
897 cause error
898 key bool
899 }
900
901 // Field function returns field value.
902 func (e HistogramBucketSettingsValidationError) Field() string { return e.field }
903
904 // Reason function returns reason value.
905 func (e HistogramBucketSettingsValidationError) Reason() string { return e.reason }
906
907 // Cause function returns cause value.
908 func (e HistogramBucketSettingsValidationError) Cause() error { return e.cause }
909
910 // Key function returns key value.
911 func (e HistogramBucketSettingsValidationError) Key() bool { return e.key }
912
913 // ErrorName returns error name.
914 func (e HistogramBucketSettingsValidationError) ErrorName() string {
915 return "HistogramBucketSettingsValidationError"
916 }
917
918 // Error satisfies the builtin error interface
919 func (e HistogramBucketSettingsValidationError) Error() string {
920 cause := ""
921 if e.cause != nil {
922 cause = fmt.Sprintf(" | caused by: %v", e.cause)
923 }
924
925 key := ""
926 if e.key {
927 key = "key for "
928 }
929
930 return fmt.Sprintf(
931 "invalid %sHistogramBucketSettings.%s: %s%s",
932 key,
933 e.field,
934 e.reason,
935 cause)
936 }
937
938 var _ error = HistogramBucketSettingsValidationError{}
939
940 var _ interface {
941 Field() string
942 Reason() string
943 Key() bool
944 Cause() error
945 ErrorName() string
946 } = HistogramBucketSettingsValidationError{}
947
948 // Validate checks the field values on StatsdSink with the rules defined in the
949 // proto definition for this message. If any rules are violated, the first
950 // error encountered is returned, or nil if there are no violations.
951 func (m *StatsdSink) Validate() error {
952 return m.validate(false)
953 }
954
955 // ValidateAll checks the field values on StatsdSink with the rules defined in
956 // the proto definition for this message. If any rules are violated, the
957 // result is a list of violation errors wrapped in StatsdSinkMultiError, or
958 // nil if none found.
959 func (m *StatsdSink) ValidateAll() error {
960 return m.validate(true)
961 }
962
963 func (m *StatsdSink) validate(all bool) error {
964 if m == nil {
965 return nil
966 }
967
968 var errors []error
969
970 // no validation rules for Prefix
971
972 oneofStatsdSpecifierPresent := false
973 switch v := m.StatsdSpecifier.(type) {
974 case *StatsdSink_Address:
975 if v == nil {
976 err := StatsdSinkValidationError{
977 field: "StatsdSpecifier",
978 reason: "oneof value cannot be a typed-nil",
979 }
980 if !all {
981 return err
982 }
983 errors = append(errors, err)
984 }
985 oneofStatsdSpecifierPresent = true
986
987 if all {
988 switch v := interface{}(m.GetAddress()).(type) {
989 case interface{ ValidateAll() error }:
990 if err := v.ValidateAll(); err != nil {
991 errors = append(errors, StatsdSinkValidationError{
992 field: "Address",
993 reason: "embedded message failed validation",
994 cause: err,
995 })
996 }
997 case interface{ Validate() error }:
998 if err := v.Validate(); err != nil {
999 errors = append(errors, StatsdSinkValidationError{
1000 field: "Address",
1001 reason: "embedded message failed validation",
1002 cause: err,
1003 })
1004 }
1005 }
1006 } else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
1007 if err := v.Validate(); err != nil {
1008 return StatsdSinkValidationError{
1009 field: "Address",
1010 reason: "embedded message failed validation",
1011 cause: err,
1012 }
1013 }
1014 }
1015
1016 case *StatsdSink_TcpClusterName:
1017 if v == nil {
1018 err := StatsdSinkValidationError{
1019 field: "StatsdSpecifier",
1020 reason: "oneof value cannot be a typed-nil",
1021 }
1022 if !all {
1023 return err
1024 }
1025 errors = append(errors, err)
1026 }
1027 oneofStatsdSpecifierPresent = true
1028 // no validation rules for TcpClusterName
1029 default:
1030 _ = v // ensures v is used
1031 }
1032 if !oneofStatsdSpecifierPresent {
1033 err := StatsdSinkValidationError{
1034 field: "StatsdSpecifier",
1035 reason: "value is required",
1036 }
1037 if !all {
1038 return err
1039 }
1040 errors = append(errors, err)
1041 }
1042
1043 if len(errors) > 0 {
1044 return StatsdSinkMultiError(errors)
1045 }
1046
1047 return nil
1048 }
1049
1050 // StatsdSinkMultiError is an error wrapping multiple validation errors
1051 // returned by StatsdSink.ValidateAll() if the designated constraints aren't met.
1052 type StatsdSinkMultiError []error
1053
1054 // Error returns a concatenation of all the error messages it wraps.
1055 func (m StatsdSinkMultiError) Error() string {
1056 var msgs []string
1057 for _, err := range m {
1058 msgs = append(msgs, err.Error())
1059 }
1060 return strings.Join(msgs, "; ")
1061 }
1062
1063 // AllErrors returns a list of validation violation errors.
1064 func (m StatsdSinkMultiError) AllErrors() []error { return m }
1065
1066 // StatsdSinkValidationError is the validation error returned by
1067 // StatsdSink.Validate if the designated constraints aren't met.
1068 type StatsdSinkValidationError struct {
1069 field string
1070 reason string
1071 cause error
1072 key bool
1073 }
1074
1075 // Field function returns field value.
1076 func (e StatsdSinkValidationError) Field() string { return e.field }
1077
1078 // Reason function returns reason value.
1079 func (e StatsdSinkValidationError) Reason() string { return e.reason }
1080
1081 // Cause function returns cause value.
1082 func (e StatsdSinkValidationError) Cause() error { return e.cause }
1083
1084 // Key function returns key value.
1085 func (e StatsdSinkValidationError) Key() bool { return e.key }
1086
1087 // ErrorName returns error name.
1088 func (e StatsdSinkValidationError) ErrorName() string { return "StatsdSinkValidationError" }
1089
1090 // Error satisfies the builtin error interface
1091 func (e StatsdSinkValidationError) Error() string {
1092 cause := ""
1093 if e.cause != nil {
1094 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1095 }
1096
1097 key := ""
1098 if e.key {
1099 key = "key for "
1100 }
1101
1102 return fmt.Sprintf(
1103 "invalid %sStatsdSink.%s: %s%s",
1104 key,
1105 e.field,
1106 e.reason,
1107 cause)
1108 }
1109
1110 var _ error = StatsdSinkValidationError{}
1111
1112 var _ interface {
1113 Field() string
1114 Reason() string
1115 Key() bool
1116 Cause() error
1117 ErrorName() string
1118 } = StatsdSinkValidationError{}
1119
1120 // Validate checks the field values on DogStatsdSink with the rules defined in
1121 // the proto definition for this message. If any rules are violated, the first
1122 // error encountered is returned, or nil if there are no violations.
1123 func (m *DogStatsdSink) Validate() error {
1124 return m.validate(false)
1125 }
1126
1127 // ValidateAll checks the field values on DogStatsdSink with the rules defined
1128 // in the proto definition for this message. If any rules are violated, the
1129 // result is a list of violation errors wrapped in DogStatsdSinkMultiError, or
1130 // nil if none found.
1131 func (m *DogStatsdSink) ValidateAll() error {
1132 return m.validate(true)
1133 }
1134
1135 func (m *DogStatsdSink) validate(all bool) error {
1136 if m == nil {
1137 return nil
1138 }
1139
1140 var errors []error
1141
1142 // no validation rules for Prefix
1143
1144 if wrapper := m.GetMaxBytesPerDatagram(); wrapper != nil {
1145
1146 if wrapper.GetValue() <= 0 {
1147 err := DogStatsdSinkValidationError{
1148 field: "MaxBytesPerDatagram",
1149 reason: "value must be greater than 0",
1150 }
1151 if !all {
1152 return err
1153 }
1154 errors = append(errors, err)
1155 }
1156
1157 }
1158
1159 oneofDogStatsdSpecifierPresent := false
1160 switch v := m.DogStatsdSpecifier.(type) {
1161 case *DogStatsdSink_Address:
1162 if v == nil {
1163 err := DogStatsdSinkValidationError{
1164 field: "DogStatsdSpecifier",
1165 reason: "oneof value cannot be a typed-nil",
1166 }
1167 if !all {
1168 return err
1169 }
1170 errors = append(errors, err)
1171 }
1172 oneofDogStatsdSpecifierPresent = true
1173
1174 if all {
1175 switch v := interface{}(m.GetAddress()).(type) {
1176 case interface{ ValidateAll() error }:
1177 if err := v.ValidateAll(); err != nil {
1178 errors = append(errors, DogStatsdSinkValidationError{
1179 field: "Address",
1180 reason: "embedded message failed validation",
1181 cause: err,
1182 })
1183 }
1184 case interface{ Validate() error }:
1185 if err := v.Validate(); err != nil {
1186 errors = append(errors, DogStatsdSinkValidationError{
1187 field: "Address",
1188 reason: "embedded message failed validation",
1189 cause: err,
1190 })
1191 }
1192 }
1193 } else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
1194 if err := v.Validate(); err != nil {
1195 return DogStatsdSinkValidationError{
1196 field: "Address",
1197 reason: "embedded message failed validation",
1198 cause: err,
1199 }
1200 }
1201 }
1202
1203 default:
1204 _ = v // ensures v is used
1205 }
1206 if !oneofDogStatsdSpecifierPresent {
1207 err := DogStatsdSinkValidationError{
1208 field: "DogStatsdSpecifier",
1209 reason: "value is required",
1210 }
1211 if !all {
1212 return err
1213 }
1214 errors = append(errors, err)
1215 }
1216
1217 if len(errors) > 0 {
1218 return DogStatsdSinkMultiError(errors)
1219 }
1220
1221 return nil
1222 }
1223
1224 // DogStatsdSinkMultiError is an error wrapping multiple validation errors
1225 // returned by DogStatsdSink.ValidateAll() if the designated constraints
1226 // aren't met.
1227 type DogStatsdSinkMultiError []error
1228
1229 // Error returns a concatenation of all the error messages it wraps.
1230 func (m DogStatsdSinkMultiError) Error() string {
1231 var msgs []string
1232 for _, err := range m {
1233 msgs = append(msgs, err.Error())
1234 }
1235 return strings.Join(msgs, "; ")
1236 }
1237
1238 // AllErrors returns a list of validation violation errors.
1239 func (m DogStatsdSinkMultiError) AllErrors() []error { return m }
1240
1241 // DogStatsdSinkValidationError is the validation error returned by
1242 // DogStatsdSink.Validate if the designated constraints aren't met.
1243 type DogStatsdSinkValidationError struct {
1244 field string
1245 reason string
1246 cause error
1247 key bool
1248 }
1249
1250 // Field function returns field value.
1251 func (e DogStatsdSinkValidationError) Field() string { return e.field }
1252
1253 // Reason function returns reason value.
1254 func (e DogStatsdSinkValidationError) Reason() string { return e.reason }
1255
1256 // Cause function returns cause value.
1257 func (e DogStatsdSinkValidationError) Cause() error { return e.cause }
1258
1259 // Key function returns key value.
1260 func (e DogStatsdSinkValidationError) Key() bool { return e.key }
1261
1262 // ErrorName returns error name.
1263 func (e DogStatsdSinkValidationError) ErrorName() string { return "DogStatsdSinkValidationError" }
1264
1265 // Error satisfies the builtin error interface
1266 func (e DogStatsdSinkValidationError) Error() string {
1267 cause := ""
1268 if e.cause != nil {
1269 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1270 }
1271
1272 key := ""
1273 if e.key {
1274 key = "key for "
1275 }
1276
1277 return fmt.Sprintf(
1278 "invalid %sDogStatsdSink.%s: %s%s",
1279 key,
1280 e.field,
1281 e.reason,
1282 cause)
1283 }
1284
1285 var _ error = DogStatsdSinkValidationError{}
1286
1287 var _ interface {
1288 Field() string
1289 Reason() string
1290 Key() bool
1291 Cause() error
1292 ErrorName() string
1293 } = DogStatsdSinkValidationError{}
1294
1295 // Validate checks the field values on HystrixSink with the rules defined in
1296 // the proto definition for this message. If any rules are violated, the first
1297 // error encountered is returned, or nil if there are no violations.
1298 func (m *HystrixSink) Validate() error {
1299 return m.validate(false)
1300 }
1301
1302 // ValidateAll checks the field values on HystrixSink with the rules defined in
1303 // the proto definition for this message. If any rules are violated, the
1304 // result is a list of violation errors wrapped in HystrixSinkMultiError, or
1305 // nil if none found.
1306 func (m *HystrixSink) ValidateAll() error {
1307 return m.validate(true)
1308 }
1309
1310 func (m *HystrixSink) validate(all bool) error {
1311 if m == nil {
1312 return nil
1313 }
1314
1315 var errors []error
1316
1317 // no validation rules for NumBuckets
1318
1319 if len(errors) > 0 {
1320 return HystrixSinkMultiError(errors)
1321 }
1322
1323 return nil
1324 }
1325
1326 // HystrixSinkMultiError is an error wrapping multiple validation errors
1327 // returned by HystrixSink.ValidateAll() if the designated constraints aren't met.
1328 type HystrixSinkMultiError []error
1329
1330 // Error returns a concatenation of all the error messages it wraps.
1331 func (m HystrixSinkMultiError) Error() string {
1332 var msgs []string
1333 for _, err := range m {
1334 msgs = append(msgs, err.Error())
1335 }
1336 return strings.Join(msgs, "; ")
1337 }
1338
1339 // AllErrors returns a list of validation violation errors.
1340 func (m HystrixSinkMultiError) AllErrors() []error { return m }
1341
1342 // HystrixSinkValidationError is the validation error returned by
1343 // HystrixSink.Validate if the designated constraints aren't met.
1344 type HystrixSinkValidationError struct {
1345 field string
1346 reason string
1347 cause error
1348 key bool
1349 }
1350
1351 // Field function returns field value.
1352 func (e HystrixSinkValidationError) Field() string { return e.field }
1353
1354 // Reason function returns reason value.
1355 func (e HystrixSinkValidationError) Reason() string { return e.reason }
1356
1357 // Cause function returns cause value.
1358 func (e HystrixSinkValidationError) Cause() error { return e.cause }
1359
1360 // Key function returns key value.
1361 func (e HystrixSinkValidationError) Key() bool { return e.key }
1362
1363 // ErrorName returns error name.
1364 func (e HystrixSinkValidationError) ErrorName() string { return "HystrixSinkValidationError" }
1365
1366 // Error satisfies the builtin error interface
1367 func (e HystrixSinkValidationError) Error() string {
1368 cause := ""
1369 if e.cause != nil {
1370 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1371 }
1372
1373 key := ""
1374 if e.key {
1375 key = "key for "
1376 }
1377
1378 return fmt.Sprintf(
1379 "invalid %sHystrixSink.%s: %s%s",
1380 key,
1381 e.field,
1382 e.reason,
1383 cause)
1384 }
1385
1386 var _ error = HystrixSinkValidationError{}
1387
1388 var _ interface {
1389 Field() string
1390 Reason() string
1391 Key() bool
1392 Cause() error
1393 ErrorName() string
1394 } = HystrixSinkValidationError{}