Debian Codegraph @

envoy/config/core/v3/base.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/config/core/v3/base.proto
4
5 package corev3
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 Locality 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 *Locality) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on Locality 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 LocalityMultiError, or nil
49 // if none found.
50 func (m *Locality) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *Locality) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 // no validation rules for Region
62
63 // no validation rules for Zone
64
65 // no validation rules for SubZone
66
67 if len(errors) > 0 {
68 return LocalityMultiError(errors)
69 }
70
71 return nil
72 }
73
74 // LocalityMultiError is an error wrapping multiple validation errors returned
75 // by Locality.ValidateAll() if the designated constraints aren't met.
76 type LocalityMultiError []error
77
78 // Error returns a concatenation of all the error messages it wraps.
79 func (m LocalityMultiError) Error() string {
80 var msgs []string
81 for _, err := range m {
82 msgs = append(msgs, err.Error())
83 }
84 return strings.Join(msgs, "; ")
85 }
86
87 // AllErrors returns a list of validation violation errors.
88 func (m LocalityMultiError) AllErrors() []error { return m }
89
90 // LocalityValidationError is the validation error returned by
91 // Locality.Validate if the designated constraints aren't met.
92 type LocalityValidationError struct {
93 field string
94 reason string
95 cause error
96 key bool
97 }
98
99 // Field function returns field value.
100 func (e LocalityValidationError) Field() string { return e.field }
101
102 // Reason function returns reason value.
103 func (e LocalityValidationError) Reason() string { return e.reason }
104
105 // Cause function returns cause value.
106 func (e LocalityValidationError) Cause() error { return e.cause }
107
108 // Key function returns key value.
109 func (e LocalityValidationError) Key() bool { return e.key }
110
111 // ErrorName returns error name.
112 func (e LocalityValidationError) ErrorName() string { return "LocalityValidationError" }
113
114 // Error satisfies the builtin error interface
115 func (e LocalityValidationError) Error() string {
116 cause := ""
117 if e.cause != nil {
118 cause = fmt.Sprintf(" | caused by: %v", e.cause)
119 }
120
121 key := ""
122 if e.key {
123 key = "key for "
124 }
125
126 return fmt.Sprintf(
127 "invalid %sLocality.%s: %s%s",
128 key,
129 e.field,
130 e.reason,
131 cause)
132 }
133
134 var _ error = LocalityValidationError{}
135
136 var _ interface {
137 Field() string
138 Reason() string
139 Key() bool
140 Cause() error
141 ErrorName() string
142 } = LocalityValidationError{}
143
144 // Validate checks the field values on BuildVersion with the rules defined in
145 // the proto definition for this message. If any rules are violated, the first
146 // error encountered is returned, or nil if there are no violations.
147 func (m *BuildVersion) Validate() error {
148 return m.validate(false)
149 }
150
151 // ValidateAll checks the field values on BuildVersion with the rules defined
152 // in the proto definition for this message. If any rules are violated, the
153 // result is a list of violation errors wrapped in BuildVersionMultiError, or
154 // nil if none found.
155 func (m *BuildVersion) ValidateAll() error {
156 return m.validate(true)
157 }
158
159 func (m *BuildVersion) validate(all bool) error {
160 if m == nil {
161 return nil
162 }
163
164 var errors []error
165
166 if all {
167 switch v := interface{}(m.GetVersion()).(type) {
168 case interface{ ValidateAll() error }:
169 if err := v.ValidateAll(); err != nil {
170 errors = append(errors, BuildVersionValidationError{
171 field: "Version",
172 reason: "embedded message failed validation",
173 cause: err,
174 })
175 }
176 case interface{ Validate() error }:
177 if err := v.Validate(); err != nil {
178 errors = append(errors, BuildVersionValidationError{
179 field: "Version",
180 reason: "embedded message failed validation",
181 cause: err,
182 })
183 }
184 }
185 } else if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok {
186 if err := v.Validate(); err != nil {
187 return BuildVersionValidationError{
188 field: "Version",
189 reason: "embedded message failed validation",
190 cause: err,
191 }
192 }
193 }
194
195 if all {
196 switch v := interface{}(m.GetMetadata()).(type) {
197 case interface{ ValidateAll() error }:
198 if err := v.ValidateAll(); err != nil {
199 errors = append(errors, BuildVersionValidationError{
200 field: "Metadata",
201 reason: "embedded message failed validation",
202 cause: err,
203 })
204 }
205 case interface{ Validate() error }:
206 if err := v.Validate(); err != nil {
207 errors = append(errors, BuildVersionValidationError{
208 field: "Metadata",
209 reason: "embedded message failed validation",
210 cause: err,
211 })
212 }
213 }
214 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
215 if err := v.Validate(); err != nil {
216 return BuildVersionValidationError{
217 field: "Metadata",
218 reason: "embedded message failed validation",
219 cause: err,
220 }
221 }
222 }
223
224 if len(errors) > 0 {
225 return BuildVersionMultiError(errors)
226 }
227
228 return nil
229 }
230
231 // BuildVersionMultiError is an error wrapping multiple validation errors
232 // returned by BuildVersion.ValidateAll() if the designated constraints aren't met.
233 type BuildVersionMultiError []error
234
235 // Error returns a concatenation of all the error messages it wraps.
236 func (m BuildVersionMultiError) Error() string {
237 var msgs []string
238 for _, err := range m {
239 msgs = append(msgs, err.Error())
240 }
241 return strings.Join(msgs, "; ")
242 }
243
244 // AllErrors returns a list of validation violation errors.
245 func (m BuildVersionMultiError) AllErrors() []error { return m }
246
247 // BuildVersionValidationError is the validation error returned by
248 // BuildVersion.Validate if the designated constraints aren't met.
249 type BuildVersionValidationError struct {
250 field string
251 reason string
252 cause error
253 key bool
254 }
255
256 // Field function returns field value.
257 func (e BuildVersionValidationError) Field() string { return e.field }
258
259 // Reason function returns reason value.
260 func (e BuildVersionValidationError) Reason() string { return e.reason }
261
262 // Cause function returns cause value.
263 func (e BuildVersionValidationError) Cause() error { return e.cause }
264
265 // Key function returns key value.
266 func (e BuildVersionValidationError) Key() bool { return e.key }
267
268 // ErrorName returns error name.
269 func (e BuildVersionValidationError) ErrorName() string { return "BuildVersionValidationError" }
270
271 // Error satisfies the builtin error interface
272 func (e BuildVersionValidationError) Error() string {
273 cause := ""
274 if e.cause != nil {
275 cause = fmt.Sprintf(" | caused by: %v", e.cause)
276 }
277
278 key := ""
279 if e.key {
280 key = "key for "
281 }
282
283 return fmt.Sprintf(
284 "invalid %sBuildVersion.%s: %s%s",
285 key,
286 e.field,
287 e.reason,
288 cause)
289 }
290
291 var _ error = BuildVersionValidationError{}
292
293 var _ interface {
294 Field() string
295 Reason() string
296 Key() bool
297 Cause() error
298 ErrorName() string
299 } = BuildVersionValidationError{}
300
301 // Validate checks the field values on Extension with the rules defined in the
302 // proto definition for this message. If any rules are violated, the first
303 // error encountered is returned, or nil if there are no violations.
304 func (m *Extension) Validate() error {
305 return m.validate(false)
306 }
307
308 // ValidateAll checks the field values on Extension with the rules defined in
309 // the proto definition for this message. If any rules are violated, the
310 // result is a list of violation errors wrapped in ExtensionMultiError, or nil
311 // if none found.
312 func (m *Extension) ValidateAll() error {
313 return m.validate(true)
314 }
315
316 func (m *Extension) validate(all bool) error {
317 if m == nil {
318 return nil
319 }
320
321 var errors []error
322
323 // no validation rules for Name
324
325 // no validation rules for Category
326
327 // no validation rules for TypeDescriptor
328
329 if all {
330 switch v := interface{}(m.GetVersion()).(type) {
331 case interface{ ValidateAll() error }:
332 if err := v.ValidateAll(); err != nil {
333 errors = append(errors, ExtensionValidationError{
334 field: "Version",
335 reason: "embedded message failed validation",
336 cause: err,
337 })
338 }
339 case interface{ Validate() error }:
340 if err := v.Validate(); err != nil {
341 errors = append(errors, ExtensionValidationError{
342 field: "Version",
343 reason: "embedded message failed validation",
344 cause: err,
345 })
346 }
347 }
348 } else if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok {
349 if err := v.Validate(); err != nil {
350 return ExtensionValidationError{
351 field: "Version",
352 reason: "embedded message failed validation",
353 cause: err,
354 }
355 }
356 }
357
358 // no validation rules for Disabled
359
360 if len(errors) > 0 {
361 return ExtensionMultiError(errors)
362 }
363
364 return nil
365 }
366
367 // ExtensionMultiError is an error wrapping multiple validation errors returned
368 // by Extension.ValidateAll() if the designated constraints aren't met.
369 type ExtensionMultiError []error
370
371 // Error returns a concatenation of all the error messages it wraps.
372 func (m ExtensionMultiError) Error() string {
373 var msgs []string
374 for _, err := range m {
375 msgs = append(msgs, err.Error())
376 }
377 return strings.Join(msgs, "; ")
378 }
379
380 // AllErrors returns a list of validation violation errors.
381 func (m ExtensionMultiError) AllErrors() []error { return m }
382
383 // ExtensionValidationError is the validation error returned by
384 // Extension.Validate if the designated constraints aren't met.
385 type ExtensionValidationError struct {
386 field string
387 reason string
388 cause error
389 key bool
390 }
391
392 // Field function returns field value.
393 func (e ExtensionValidationError) Field() string { return e.field }
394
395 // Reason function returns reason value.
396 func (e ExtensionValidationError) Reason() string { return e.reason }
397
398 // Cause function returns cause value.
399 func (e ExtensionValidationError) Cause() error { return e.cause }
400
401 // Key function returns key value.
402 func (e ExtensionValidationError) Key() bool { return e.key }
403
404 // ErrorName returns error name.
405 func (e ExtensionValidationError) ErrorName() string { return "ExtensionValidationError" }
406
407 // Error satisfies the builtin error interface
408 func (e ExtensionValidationError) Error() string {
409 cause := ""
410 if e.cause != nil {
411 cause = fmt.Sprintf(" | caused by: %v", e.cause)
412 }
413
414 key := ""
415 if e.key {
416 key = "key for "
417 }
418
419 return fmt.Sprintf(
420 "invalid %sExtension.%s: %s%s",
421 key,
422 e.field,
423 e.reason,
424 cause)
425 }
426
427 var _ error = ExtensionValidationError{}
428
429 var _ interface {
430 Field() string
431 Reason() string
432 Key() bool
433 Cause() error
434 ErrorName() string
435 } = ExtensionValidationError{}
436
437 // Validate checks the field values on Node with the rules defined in the proto
438 // definition for this message. If any rules are violated, the first error
439 // encountered is returned, or nil if there are no violations.
440 func (m *Node) Validate() error {
441 return m.validate(false)
442 }
443
444 // ValidateAll checks the field values on Node with the rules defined in the
445 // proto definition for this message. If any rules are violated, the result is
446 // a list of violation errors wrapped in NodeMultiError, or nil if none found.
447 func (m *Node) ValidateAll() error {
448 return m.validate(true)
449 }
450
451 func (m *Node) validate(all bool) error {
452 if m == nil {
453 return nil
454 }
455
456 var errors []error
457
458 // no validation rules for Id
459
460 // no validation rules for Cluster
461
462 if all {
463 switch v := interface{}(m.GetMetadata()).(type) {
464 case interface{ ValidateAll() error }:
465 if err := v.ValidateAll(); err != nil {
466 errors = append(errors, NodeValidationError{
467 field: "Metadata",
468 reason: "embedded message failed validation",
469 cause: err,
470 })
471 }
472 case interface{ Validate() error }:
473 if err := v.Validate(); err != nil {
474 errors = append(errors, NodeValidationError{
475 field: "Metadata",
476 reason: "embedded message failed validation",
477 cause: err,
478 })
479 }
480 }
481 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
482 if err := v.Validate(); err != nil {
483 return NodeValidationError{
484 field: "Metadata",
485 reason: "embedded message failed validation",
486 cause: err,
487 }
488 }
489 }
490
491 {
492 sorted_keys := make([]string, len(m.GetDynamicParameters()))
493 i := 0
494 for key := range m.GetDynamicParameters() {
495 sorted_keys[i] = key
496 i++
497 }
498 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
499 for _, key := range sorted_keys {
500 val := m.GetDynamicParameters()[key]
501 _ = val
502
503 // no validation rules for DynamicParameters[key]
504
505 if all {
506 switch v := interface{}(val).(type) {
507 case interface{ ValidateAll() error }:
508 if err := v.ValidateAll(); err != nil {
509 errors = append(errors, NodeValidationError{
510 field: fmt.Sprintf("DynamicParameters[%v]", key),
511 reason: "embedded message failed validation",
512 cause: err,
513 })
514 }
515 case interface{ Validate() error }:
516 if err := v.Validate(); err != nil {
517 errors = append(errors, NodeValidationError{
518 field: fmt.Sprintf("DynamicParameters[%v]", key),
519 reason: "embedded message failed validation",
520 cause: err,
521 })
522 }
523 }
524 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
525 if err := v.Validate(); err != nil {
526 return NodeValidationError{
527 field: fmt.Sprintf("DynamicParameters[%v]", key),
528 reason: "embedded message failed validation",
529 cause: err,
530 }
531 }
532 }
533
534 }
535 }
536
537 if all {
538 switch v := interface{}(m.GetLocality()).(type) {
539 case interface{ ValidateAll() error }:
540 if err := v.ValidateAll(); err != nil {
541 errors = append(errors, NodeValidationError{
542 field: "Locality",
543 reason: "embedded message failed validation",
544 cause: err,
545 })
546 }
547 case interface{ Validate() error }:
548 if err := v.Validate(); err != nil {
549 errors = append(errors, NodeValidationError{
550 field: "Locality",
551 reason: "embedded message failed validation",
552 cause: err,
553 })
554 }
555 }
556 } else if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok {
557 if err := v.Validate(); err != nil {
558 return NodeValidationError{
559 field: "Locality",
560 reason: "embedded message failed validation",
561 cause: err,
562 }
563 }
564 }
565
566 // no validation rules for UserAgentName
567
568 for idx, item := range m.GetExtensions() {
569 _, _ = idx, item
570
571 if all {
572 switch v := interface{}(item).(type) {
573 case interface{ ValidateAll() error }:
574 if err := v.ValidateAll(); err != nil {
575 errors = append(errors, NodeValidationError{
576 field: fmt.Sprintf("Extensions[%v]", idx),
577 reason: "embedded message failed validation",
578 cause: err,
579 })
580 }
581 case interface{ Validate() error }:
582 if err := v.Validate(); err != nil {
583 errors = append(errors, NodeValidationError{
584 field: fmt.Sprintf("Extensions[%v]", idx),
585 reason: "embedded message failed validation",
586 cause: err,
587 })
588 }
589 }
590 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
591 if err := v.Validate(); err != nil {
592 return NodeValidationError{
593 field: fmt.Sprintf("Extensions[%v]", idx),
594 reason: "embedded message failed validation",
595 cause: err,
596 }
597 }
598 }
599
600 }
601
602 for idx, item := range m.GetListeningAddresses() {
603 _, _ = idx, item
604
605 if all {
606 switch v := interface{}(item).(type) {
607 case interface{ ValidateAll() error }:
608 if err := v.ValidateAll(); err != nil {
609 errors = append(errors, NodeValidationError{
610 field: fmt.Sprintf("ListeningAddresses[%v]", idx),
611 reason: "embedded message failed validation",
612 cause: err,
613 })
614 }
615 case interface{ Validate() error }:
616 if err := v.Validate(); err != nil {
617 errors = append(errors, NodeValidationError{
618 field: fmt.Sprintf("ListeningAddresses[%v]", idx),
619 reason: "embedded message failed validation",
620 cause: err,
621 })
622 }
623 }
624 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
625 if err := v.Validate(); err != nil {
626 return NodeValidationError{
627 field: fmt.Sprintf("ListeningAddresses[%v]", idx),
628 reason: "embedded message failed validation",
629 cause: err,
630 }
631 }
632 }
633
634 }
635
636 switch v := m.UserAgentVersionType.(type) {
637 case *Node_UserAgentVersion:
638 if v == nil {
639 err := NodeValidationError{
640 field: "UserAgentVersionType",
641 reason: "oneof value cannot be a typed-nil",
642 }
643 if !all {
644 return err
645 }
646 errors = append(errors, err)
647 }
648 // no validation rules for UserAgentVersion
649 case *Node_UserAgentBuildVersion:
650 if v == nil {
651 err := NodeValidationError{
652 field: "UserAgentVersionType",
653 reason: "oneof value cannot be a typed-nil",
654 }
655 if !all {
656 return err
657 }
658 errors = append(errors, err)
659 }
660
661 if all {
662 switch v := interface{}(m.GetUserAgentBuildVersion()).(type) {
663 case interface{ ValidateAll() error }:
664 if err := v.ValidateAll(); err != nil {
665 errors = append(errors, NodeValidationError{
666 field: "UserAgentBuildVersion",
667 reason: "embedded message failed validation",
668 cause: err,
669 })
670 }
671 case interface{ Validate() error }:
672 if err := v.Validate(); err != nil {
673 errors = append(errors, NodeValidationError{
674 field: "UserAgentBuildVersion",
675 reason: "embedded message failed validation",
676 cause: err,
677 })
678 }
679 }
680 } else if v, ok := interface{}(m.GetUserAgentBuildVersion()).(interface{ Validate() error }); ok {
681 if err := v.Validate(); err != nil {
682 return NodeValidationError{
683 field: "UserAgentBuildVersion",
684 reason: "embedded message failed validation",
685 cause: err,
686 }
687 }
688 }
689
690 default:
691 _ = v // ensures v is used
692 }
693
694 if len(errors) > 0 {
695 return NodeMultiError(errors)
696 }
697
698 return nil
699 }
700
701 // NodeMultiError is an error wrapping multiple validation errors returned by
702 // Node.ValidateAll() if the designated constraints aren't met.
703 type NodeMultiError []error
704
705 // Error returns a concatenation of all the error messages it wraps.
706 func (m NodeMultiError) Error() string {
707 var msgs []string
708 for _, err := range m {
709 msgs = append(msgs, err.Error())
710 }
711 return strings.Join(msgs, "; ")
712 }
713
714 // AllErrors returns a list of validation violation errors.
715 func (m NodeMultiError) AllErrors() []error { return m }
716
717 // NodeValidationError is the validation error returned by Node.Validate if the
718 // designated constraints aren't met.
719 type NodeValidationError struct {
720 field string
721 reason string
722 cause error
723 key bool
724 }
725
726 // Field function returns field value.
727 func (e NodeValidationError) Field() string { return e.field }
728
729 // Reason function returns reason value.
730 func (e NodeValidationError) Reason() string { return e.reason }
731
732 // Cause function returns cause value.
733 func (e NodeValidationError) Cause() error { return e.cause }
734
735 // Key function returns key value.
736 func (e NodeValidationError) Key() bool { return e.key }
737
738 // ErrorName returns error name.
739 func (e NodeValidationError) ErrorName() string { return "NodeValidationError" }
740
741 // Error satisfies the builtin error interface
742 func (e NodeValidationError) Error() string {
743 cause := ""
744 if e.cause != nil {
745 cause = fmt.Sprintf(" | caused by: %v", e.cause)
746 }
747
748 key := ""
749 if e.key {
750 key = "key for "
751 }
752
753 return fmt.Sprintf(
754 "invalid %sNode.%s: %s%s",
755 key,
756 e.field,
757 e.reason,
758 cause)
759 }
760
761 var _ error = NodeValidationError{}
762
763 var _ interface {
764 Field() string
765 Reason() string
766 Key() bool
767 Cause() error
768 ErrorName() string
769 } = NodeValidationError{}
770
771 // Validate checks the field values on Metadata with the rules defined in the
772 // proto definition for this message. If any rules are violated, the first
773 // error encountered is returned, or nil if there are no violations.
774 func (m *Metadata) Validate() error {
775 return m.validate(false)
776 }
777
778 // ValidateAll checks the field values on Metadata with the rules defined in
779 // the proto definition for this message. If any rules are violated, the
780 // result is a list of violation errors wrapped in MetadataMultiError, or nil
781 // if none found.
782 func (m *Metadata) ValidateAll() error {
783 return m.validate(true)
784 }
785
786 func (m *Metadata) validate(all bool) error {
787 if m == nil {
788 return nil
789 }
790
791 var errors []error
792
793 {
794 sorted_keys := make([]string, len(m.GetFilterMetadata()))
795 i := 0
796 for key := range m.GetFilterMetadata() {
797 sorted_keys[i] = key
798 i++
799 }
800 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
801 for _, key := range sorted_keys {
802 val := m.GetFilterMetadata()[key]
803 _ = val
804
805 if utf8.RuneCountInString(key) < 1 {
806 err := MetadataValidationError{
807 field: fmt.Sprintf("FilterMetadata[%v]", key),
808 reason: "value length must be at least 1 runes",
809 }
810 if !all {
811 return err
812 }
813 errors = append(errors, err)
814 }
815
816 if all {
817 switch v := interface{}(val).(type) {
818 case interface{ ValidateAll() error }:
819 if err := v.ValidateAll(); err != nil {
820 errors = append(errors, MetadataValidationError{
821 field: fmt.Sprintf("FilterMetadata[%v]", key),
822 reason: "embedded message failed validation",
823 cause: err,
824 })
825 }
826 case interface{ Validate() error }:
827 if err := v.Validate(); err != nil {
828 errors = append(errors, MetadataValidationError{
829 field: fmt.Sprintf("FilterMetadata[%v]", key),
830 reason: "embedded message failed validation",
831 cause: err,
832 })
833 }
834 }
835 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
836 if err := v.Validate(); err != nil {
837 return MetadataValidationError{
838 field: fmt.Sprintf("FilterMetadata[%v]", key),
839 reason: "embedded message failed validation",
840 cause: err,
841 }
842 }
843 }
844
845 }
846 }
847
848 {
849 sorted_keys := make([]string, len(m.GetTypedFilterMetadata()))
850 i := 0
851 for key := range m.GetTypedFilterMetadata() {
852 sorted_keys[i] = key
853 i++
854 }
855 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
856 for _, key := range sorted_keys {
857 val := m.GetTypedFilterMetadata()[key]
858 _ = val
859
860 if utf8.RuneCountInString(key) < 1 {
861 err := MetadataValidationError{
862 field: fmt.Sprintf("TypedFilterMetadata[%v]", key),
863 reason: "value length must be at least 1 runes",
864 }
865 if !all {
866 return err
867 }
868 errors = append(errors, err)
869 }
870
871 if all {
872 switch v := interface{}(val).(type) {
873 case interface{ ValidateAll() error }:
874 if err := v.ValidateAll(); err != nil {
875 errors = append(errors, MetadataValidationError{
876 field: fmt.Sprintf("TypedFilterMetadata[%v]", key),
877 reason: "embedded message failed validation",
878 cause: err,
879 })
880 }
881 case interface{ Validate() error }:
882 if err := v.Validate(); err != nil {
883 errors = append(errors, MetadataValidationError{
884 field: fmt.Sprintf("TypedFilterMetadata[%v]", key),
885 reason: "embedded message failed validation",
886 cause: err,
887 })
888 }
889 }
890 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
891 if err := v.Validate(); err != nil {
892 return MetadataValidationError{
893 field: fmt.Sprintf("TypedFilterMetadata[%v]", key),
894 reason: "embedded message failed validation",
895 cause: err,
896 }
897 }
898 }
899
900 }
901 }
902
903 if len(errors) > 0 {
904 return MetadataMultiError(errors)
905 }
906
907 return nil
908 }
909
910 // MetadataMultiError is an error wrapping multiple validation errors returned
911 // by Metadata.ValidateAll() if the designated constraints aren't met.
912 type MetadataMultiError []error
913
914 // Error returns a concatenation of all the error messages it wraps.
915 func (m MetadataMultiError) Error() string {
916 var msgs []string
917 for _, err := range m {
918 msgs = append(msgs, err.Error())
919 }
920 return strings.Join(msgs, "; ")
921 }
922
923 // AllErrors returns a list of validation violation errors.
924 func (m MetadataMultiError) AllErrors() []error { return m }
925
926 // MetadataValidationError is the validation error returned by
927 // Metadata.Validate if the designated constraints aren't met.
928 type MetadataValidationError struct {
929 field string
930 reason string
931 cause error
932 key bool
933 }
934
935 // Field function returns field value.
936 func (e MetadataValidationError) Field() string { return e.field }
937
938 // Reason function returns reason value.
939 func (e MetadataValidationError) Reason() string { return e.reason }
940
941 // Cause function returns cause value.
942 func (e MetadataValidationError) Cause() error { return e.cause }
943
944 // Key function returns key value.
945 func (e MetadataValidationError) Key() bool { return e.key }
946
947 // ErrorName returns error name.
948 func (e MetadataValidationError) ErrorName() string { return "MetadataValidationError" }
949
950 // Error satisfies the builtin error interface
951 func (e MetadataValidationError) Error() string {
952 cause := ""
953 if e.cause != nil {
954 cause = fmt.Sprintf(" | caused by: %v", e.cause)
955 }
956
957 key := ""
958 if e.key {
959 key = "key for "
960 }
961
962 return fmt.Sprintf(
963 "invalid %sMetadata.%s: %s%s",
964 key,
965 e.field,
966 e.reason,
967 cause)
968 }
969
970 var _ error = MetadataValidationError{}
971
972 var _ interface {
973 Field() string
974 Reason() string
975 Key() bool
976 Cause() error
977 ErrorName() string
978 } = MetadataValidationError{}
979
980 // Validate checks the field values on RuntimeUInt32 with the rules defined in
981 // the proto definition for this message. If any rules are violated, the first
982 // error encountered is returned, or nil if there are no violations.
983 func (m *RuntimeUInt32) Validate() error {
984 return m.validate(false)
985 }
986
987 // ValidateAll checks the field values on RuntimeUInt32 with the rules defined
988 // in the proto definition for this message. If any rules are violated, the
989 // result is a list of violation errors wrapped in RuntimeUInt32MultiError, or
990 // nil if none found.
991 func (m *RuntimeUInt32) ValidateAll() error {
992 return m.validate(true)
993 }
994
995 func (m *RuntimeUInt32) validate(all bool) error {
996 if m == nil {
997 return nil
998 }
999
1000 var errors []error
1001
1002 // no validation rules for DefaultValue
1003
1004 if utf8.RuneCountInString(m.GetRuntimeKey()) < 1 {
1005 err := RuntimeUInt32ValidationError{
1006 field: "RuntimeKey",
1007 reason: "value length must be at least 1 runes",
1008 }
1009 if !all {
1010 return err
1011 }
1012 errors = append(errors, err)
1013 }
1014
1015 if len(errors) > 0 {
1016 return RuntimeUInt32MultiError(errors)
1017 }
1018
1019 return nil
1020 }
1021
1022 // RuntimeUInt32MultiError is an error wrapping multiple validation errors
1023 // returned by RuntimeUInt32.ValidateAll() if the designated constraints
1024 // aren't met.
1025 type RuntimeUInt32MultiError []error
1026
1027 // Error returns a concatenation of all the error messages it wraps.
1028 func (m RuntimeUInt32MultiError) Error() string {
1029 var msgs []string
1030 for _, err := range m {
1031 msgs = append(msgs, err.Error())
1032 }
1033 return strings.Join(msgs, "; ")
1034 }
1035
1036 // AllErrors returns a list of validation violation errors.
1037 func (m RuntimeUInt32MultiError) AllErrors() []error { return m }
1038
1039 // RuntimeUInt32ValidationError is the validation error returned by
1040 // RuntimeUInt32.Validate if the designated constraints aren't met.
1041 type RuntimeUInt32ValidationError struct {
1042 field string
1043 reason string
1044 cause error
1045 key bool
1046 }
1047
1048 // Field function returns field value.
1049 func (e RuntimeUInt32ValidationError) Field() string { return e.field }
1050
1051 // Reason function returns reason value.
1052 func (e RuntimeUInt32ValidationError) Reason() string { return e.reason }
1053
1054 // Cause function returns cause value.
1055 func (e RuntimeUInt32ValidationError) Cause() error { return e.cause }
1056
1057 // Key function returns key value.
1058 func (e RuntimeUInt32ValidationError) Key() bool { return e.key }
1059
1060 // ErrorName returns error name.
1061 func (e RuntimeUInt32ValidationError) ErrorName() string { return "RuntimeUInt32ValidationError" }
1062
1063 // Error satisfies the builtin error interface
1064 func (e RuntimeUInt32ValidationError) Error() string {
1065 cause := ""
1066 if e.cause != nil {
1067 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1068 }
1069
1070 key := ""
1071 if e.key {
1072 key = "key for "
1073 }
1074
1075 return fmt.Sprintf(
1076 "invalid %sRuntimeUInt32.%s: %s%s",
1077 key,
1078 e.field,
1079 e.reason,
1080 cause)
1081 }
1082
1083 var _ error = RuntimeUInt32ValidationError{}
1084
1085 var _ interface {
1086 Field() string
1087 Reason() string
1088 Key() bool
1089 Cause() error
1090 ErrorName() string
1091 } = RuntimeUInt32ValidationError{}
1092
1093 // Validate checks the field values on RuntimePercent with the rules defined in
1094 // the proto definition for this message. If any rules are violated, the first
1095 // error encountered is returned, or nil if there are no violations.
1096 func (m *RuntimePercent) Validate() error {
1097 return m.validate(false)
1098 }
1099
1100 // ValidateAll checks the field values on RuntimePercent with the rules defined
1101 // in the proto definition for this message. If any rules are violated, the
1102 // result is a list of violation errors wrapped in RuntimePercentMultiError,
1103 // or nil if none found.
1104 func (m *RuntimePercent) ValidateAll() error {
1105 return m.validate(true)
1106 }
1107
1108 func (m *RuntimePercent) validate(all bool) error {
1109 if m == nil {
1110 return nil
1111 }
1112
1113 var errors []error
1114
1115 if all {
1116 switch v := interface{}(m.GetDefaultValue()).(type) {
1117 case interface{ ValidateAll() error }:
1118 if err := v.ValidateAll(); err != nil {
1119 errors = append(errors, RuntimePercentValidationError{
1120 field: "DefaultValue",
1121 reason: "embedded message failed validation",
1122 cause: err,
1123 })
1124 }
1125 case interface{ Validate() error }:
1126 if err := v.Validate(); err != nil {
1127 errors = append(errors, RuntimePercentValidationError{
1128 field: "DefaultValue",
1129 reason: "embedded message failed validation",
1130 cause: err,
1131 })
1132 }
1133 }
1134 } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok {
1135 if err := v.Validate(); err != nil {
1136 return RuntimePercentValidationError{
1137 field: "DefaultValue",
1138 reason: "embedded message failed validation",
1139 cause: err,
1140 }
1141 }
1142 }
1143
1144 if utf8.RuneCountInString(m.GetRuntimeKey()) < 1 {
1145 err := RuntimePercentValidationError{
1146 field: "RuntimeKey",
1147 reason: "value length must be at least 1 runes",
1148 }
1149 if !all {
1150 return err
1151 }
1152 errors = append(errors, err)
1153 }
1154
1155 if len(errors) > 0 {
1156 return RuntimePercentMultiError(errors)
1157 }
1158
1159 return nil
1160 }
1161
1162 // RuntimePercentMultiError is an error wrapping multiple validation errors
1163 // returned by RuntimePercent.ValidateAll() if the designated constraints
1164 // aren't met.
1165 type RuntimePercentMultiError []error
1166
1167 // Error returns a concatenation of all the error messages it wraps.
1168 func (m RuntimePercentMultiError) Error() string {
1169 var msgs []string
1170 for _, err := range m {
1171 msgs = append(msgs, err.Error())
1172 }
1173 return strings.Join(msgs, "; ")
1174 }
1175
1176 // AllErrors returns a list of validation violation errors.
1177 func (m RuntimePercentMultiError) AllErrors() []error { return m }
1178
1179 // RuntimePercentValidationError is the validation error returned by
1180 // RuntimePercent.Validate if the designated constraints aren't met.
1181 type RuntimePercentValidationError struct {
1182 field string
1183 reason string
1184 cause error
1185 key bool
1186 }
1187
1188 // Field function returns field value.
1189 func (e RuntimePercentValidationError) Field() string { return e.field }
1190
1191 // Reason function returns reason value.
1192 func (e RuntimePercentValidationError) Reason() string { return e.reason }
1193
1194 // Cause function returns cause value.
1195 func (e RuntimePercentValidationError) Cause() error { return e.cause }
1196
1197 // Key function returns key value.
1198 func (e RuntimePercentValidationError) Key() bool { return e.key }
1199
1200 // ErrorName returns error name.
1201 func (e RuntimePercentValidationError) ErrorName() string { return "RuntimePercentValidationError" }
1202
1203 // Error satisfies the builtin error interface
1204 func (e RuntimePercentValidationError) Error() string {
1205 cause := ""
1206 if e.cause != nil {
1207 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1208 }
1209
1210 key := ""
1211 if e.key {
1212 key = "key for "
1213 }
1214
1215 return fmt.Sprintf(
1216 "invalid %sRuntimePercent.%s: %s%s",
1217 key,
1218 e.field,
1219 e.reason,
1220 cause)
1221 }
1222
1223 var _ error = RuntimePercentValidationError{}
1224
1225 var _ interface {
1226 Field() string
1227 Reason() string
1228 Key() bool
1229 Cause() error
1230 ErrorName() string
1231 } = RuntimePercentValidationError{}
1232
1233 // Validate checks the field values on RuntimeDouble with the rules defined in
1234 // the proto definition for this message. If any rules are violated, the first
1235 // error encountered is returned, or nil if there are no violations.
1236 func (m *RuntimeDouble) Validate() error {
1237 return m.validate(false)
1238 }
1239
1240 // ValidateAll checks the field values on RuntimeDouble with the rules defined
1241 // in the proto definition for this message. If any rules are violated, the
1242 // result is a list of violation errors wrapped in RuntimeDoubleMultiError, or
1243 // nil if none found.
1244 func (m *RuntimeDouble) ValidateAll() error {
1245 return m.validate(true)
1246 }
1247
1248 func (m *RuntimeDouble) validate(all bool) error {
1249 if m == nil {
1250 return nil
1251 }
1252
1253 var errors []error
1254
1255 // no validation rules for DefaultValue
1256
1257 if utf8.RuneCountInString(m.GetRuntimeKey()) < 1 {
1258 err := RuntimeDoubleValidationError{
1259 field: "RuntimeKey",
1260 reason: "value length must be at least 1 runes",
1261 }
1262 if !all {
1263 return err
1264 }
1265 errors = append(errors, err)
1266 }
1267
1268 if len(errors) > 0 {
1269 return RuntimeDoubleMultiError(errors)
1270 }
1271
1272 return nil
1273 }
1274
1275 // RuntimeDoubleMultiError is an error wrapping multiple validation errors
1276 // returned by RuntimeDouble.ValidateAll() if the designated constraints
1277 // aren't met.
1278 type RuntimeDoubleMultiError []error
1279
1280 // Error returns a concatenation of all the error messages it wraps.
1281 func (m RuntimeDoubleMultiError) Error() string {
1282 var msgs []string
1283 for _, err := range m {
1284 msgs = append(msgs, err.Error())
1285 }
1286 return strings.Join(msgs, "; ")
1287 }
1288
1289 // AllErrors returns a list of validation violation errors.
1290 func (m RuntimeDoubleMultiError) AllErrors() []error { return m }
1291
1292 // RuntimeDoubleValidationError is the validation error returned by
1293 // RuntimeDouble.Validate if the designated constraints aren't met.
1294 type RuntimeDoubleValidationError struct {
1295 field string
1296 reason string
1297 cause error
1298 key bool
1299 }
1300
1301 // Field function returns field value.
1302 func (e RuntimeDoubleValidationError) Field() string { return e.field }
1303
1304 // Reason function returns reason value.
1305 func (e RuntimeDoubleValidationError) Reason() string { return e.reason }
1306
1307 // Cause function returns cause value.
1308 func (e RuntimeDoubleValidationError) Cause() error { return e.cause }
1309
1310 // Key function returns key value.
1311 func (e RuntimeDoubleValidationError) Key() bool { return e.key }
1312
1313 // ErrorName returns error name.
1314 func (e RuntimeDoubleValidationError) ErrorName() string { return "RuntimeDoubleValidationError" }
1315
1316 // Error satisfies the builtin error interface
1317 func (e RuntimeDoubleValidationError) Error() string {
1318 cause := ""
1319 if e.cause != nil {
1320 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1321 }
1322
1323 key := ""
1324 if e.key {
1325 key = "key for "
1326 }
1327
1328 return fmt.Sprintf(
1329 "invalid %sRuntimeDouble.%s: %s%s",
1330 key,
1331 e.field,
1332 e.reason,
1333 cause)
1334 }
1335
1336 var _ error = RuntimeDoubleValidationError{}
1337
1338 var _ interface {
1339 Field() string
1340 Reason() string
1341 Key() bool
1342 Cause() error
1343 ErrorName() string
1344 } = RuntimeDoubleValidationError{}
1345
1346 // Validate checks the field values on RuntimeFeatureFlag with the rules
1347 // defined in the proto definition for this message. If any rules are
1348 // violated, the first error encountered is returned, or nil if there are no violations.
1349 func (m *RuntimeFeatureFlag) Validate() error {
1350 return m.validate(false)
1351 }
1352
1353 // ValidateAll checks the field values on RuntimeFeatureFlag with the rules
1354 // defined in the proto definition for this message. If any rules are
1355 // violated, the result is a list of violation errors wrapped in
1356 // RuntimeFeatureFlagMultiError, or nil if none found.
1357 func (m *RuntimeFeatureFlag) ValidateAll() error {
1358 return m.validate(true)
1359 }
1360
1361 func (m *RuntimeFeatureFlag) validate(all bool) error {
1362 if m == nil {
1363 return nil
1364 }
1365
1366 var errors []error
1367
1368 if m.GetDefaultValue() == nil {
1369 err := RuntimeFeatureFlagValidationError{
1370 field: "DefaultValue",
1371 reason: "value is required",
1372 }
1373 if !all {
1374 return err
1375 }
1376 errors = append(errors, err)
1377 }
1378
1379 if all {
1380 switch v := interface{}(m.GetDefaultValue()).(type) {
1381 case interface{ ValidateAll() error }:
1382 if err := v.ValidateAll(); err != nil {
1383 errors = append(errors, RuntimeFeatureFlagValidationError{
1384 field: "DefaultValue",
1385 reason: "embedded message failed validation",
1386 cause: err,
1387 })
1388 }
1389 case interface{ Validate() error }:
1390 if err := v.Validate(); err != nil {
1391 errors = append(errors, RuntimeFeatureFlagValidationError{
1392 field: "DefaultValue",
1393 reason: "embedded message failed validation",
1394 cause: err,
1395 })
1396 }
1397 }
1398 } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok {
1399 if err := v.Validate(); err != nil {
1400 return RuntimeFeatureFlagValidationError{
1401 field: "DefaultValue",
1402 reason: "embedded message failed validation",
1403 cause: err,
1404 }
1405 }
1406 }
1407
1408 if utf8.RuneCountInString(m.GetRuntimeKey()) < 1 {
1409 err := RuntimeFeatureFlagValidationError{
1410 field: "RuntimeKey",
1411 reason: "value length must be at least 1 runes",
1412 }
1413 if !all {
1414 return err
1415 }
1416 errors = append(errors, err)
1417 }
1418
1419 if len(errors) > 0 {
1420 return RuntimeFeatureFlagMultiError(errors)
1421 }
1422
1423 return nil
1424 }
1425
1426 // RuntimeFeatureFlagMultiError is an error wrapping multiple validation errors
1427 // returned by RuntimeFeatureFlag.ValidateAll() if the designated constraints
1428 // aren't met.
1429 type RuntimeFeatureFlagMultiError []error
1430
1431 // Error returns a concatenation of all the error messages it wraps.
1432 func (m RuntimeFeatureFlagMultiError) Error() string {
1433 var msgs []string
1434 for _, err := range m {
1435 msgs = append(msgs, err.Error())
1436 }
1437 return strings.Join(msgs, "; ")
1438 }
1439
1440 // AllErrors returns a list of validation violation errors.
1441 func (m RuntimeFeatureFlagMultiError) AllErrors() []error { return m }
1442
1443 // RuntimeFeatureFlagValidationError is the validation error returned by
1444 // RuntimeFeatureFlag.Validate if the designated constraints aren't met.
1445 type RuntimeFeatureFlagValidationError struct {
1446 field string
1447 reason string
1448 cause error
1449 key bool
1450 }
1451
1452 // Field function returns field value.
1453 func (e RuntimeFeatureFlagValidationError) Field() string { return e.field }
1454
1455 // Reason function returns reason value.
1456 func (e RuntimeFeatureFlagValidationError) Reason() string { return e.reason }
1457
1458 // Cause function returns cause value.
1459 func (e RuntimeFeatureFlagValidationError) Cause() error { return e.cause }
1460
1461 // Key function returns key value.
1462 func (e RuntimeFeatureFlagValidationError) Key() bool { return e.key }
1463
1464 // ErrorName returns error name.
1465 func (e RuntimeFeatureFlagValidationError) ErrorName() string {
1466 return "RuntimeFeatureFlagValidationError"
1467 }
1468
1469 // Error satisfies the builtin error interface
1470 func (e RuntimeFeatureFlagValidationError) Error() string {
1471 cause := ""
1472 if e.cause != nil {
1473 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1474 }
1475
1476 key := ""
1477 if e.key {
1478 key = "key for "
1479 }
1480
1481 return fmt.Sprintf(
1482 "invalid %sRuntimeFeatureFlag.%s: %s%s",
1483 key,
1484 e.field,
1485 e.reason,
1486 cause)
1487 }
1488
1489 var _ error = RuntimeFeatureFlagValidationError{}
1490
1491 var _ interface {
1492 Field() string
1493 Reason() string
1494 Key() bool
1495 Cause() error
1496 ErrorName() string
1497 } = RuntimeFeatureFlagValidationError{}
1498
1499 // Validate checks the field values on KeyValue with the rules defined in the
1500 // proto definition for this message. If any rules are violated, the first
1501 // error encountered is returned, or nil if there are no violations.
1502 func (m *KeyValue) Validate() error {
1503 return m.validate(false)
1504 }
1505
1506 // ValidateAll checks the field values on KeyValue with the rules defined in
1507 // the proto definition for this message. If any rules are violated, the
1508 // result is a list of violation errors wrapped in KeyValueMultiError, or nil
1509 // if none found.
1510 func (m *KeyValue) ValidateAll() error {
1511 return m.validate(true)
1512 }
1513
1514 func (m *KeyValue) validate(all bool) error {
1515 if m == nil {
1516 return nil
1517 }
1518
1519 var errors []error
1520
1521 if utf8.RuneCountInString(m.GetKey()) < 1 {
1522 err := KeyValueValidationError{
1523 field: "Key",
1524 reason: "value length must be at least 1 runes",
1525 }
1526 if !all {
1527 return err
1528 }
1529 errors = append(errors, err)
1530 }
1531
1532 if len(m.GetKey()) > 16384 {
1533 err := KeyValueValidationError{
1534 field: "Key",
1535 reason: "value length must be at most 16384 bytes",
1536 }
1537 if !all {
1538 return err
1539 }
1540 errors = append(errors, err)
1541 }
1542
1543 // no validation rules for Value
1544
1545 if len(errors) > 0 {
1546 return KeyValueMultiError(errors)
1547 }
1548
1549 return nil
1550 }
1551
1552 // KeyValueMultiError is an error wrapping multiple validation errors returned
1553 // by KeyValue.ValidateAll() if the designated constraints aren't met.
1554 type KeyValueMultiError []error
1555
1556 // Error returns a concatenation of all the error messages it wraps.
1557 func (m KeyValueMultiError) Error() string {
1558 var msgs []string
1559 for _, err := range m {
1560 msgs = append(msgs, err.Error())
1561 }
1562 return strings.Join(msgs, "; ")
1563 }
1564
1565 // AllErrors returns a list of validation violation errors.
1566 func (m KeyValueMultiError) AllErrors() []error { return m }
1567
1568 // KeyValueValidationError is the validation error returned by
1569 // KeyValue.Validate if the designated constraints aren't met.
1570 type KeyValueValidationError struct {
1571 field string
1572 reason string
1573 cause error
1574 key bool
1575 }
1576
1577 // Field function returns field value.
1578 func (e KeyValueValidationError) Field() string { return e.field }
1579
1580 // Reason function returns reason value.
1581 func (e KeyValueValidationError) Reason() string { return e.reason }
1582
1583 // Cause function returns cause value.
1584 func (e KeyValueValidationError) Cause() error { return e.cause }
1585
1586 // Key function returns key value.
1587 func (e KeyValueValidationError) Key() bool { return e.key }
1588
1589 // ErrorName returns error name.
1590 func (e KeyValueValidationError) ErrorName() string { return "KeyValueValidationError" }
1591
1592 // Error satisfies the builtin error interface
1593 func (e KeyValueValidationError) Error() string {
1594 cause := ""
1595 if e.cause != nil {
1596 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1597 }
1598
1599 key := ""
1600 if e.key {
1601 key = "key for "
1602 }
1603
1604 return fmt.Sprintf(
1605 "invalid %sKeyValue.%s: %s%s",
1606 key,
1607 e.field,
1608 e.reason,
1609 cause)
1610 }
1611
1612 var _ error = KeyValueValidationError{}
1613
1614 var _ interface {
1615 Field() string
1616 Reason() string
1617 Key() bool
1618 Cause() error
1619 ErrorName() string
1620 } = KeyValueValidationError{}
1621
1622 // Validate checks the field values on KeyValuePair with the rules defined in
1623 // the proto definition for this message. If any rules are violated, the first
1624 // error encountered is returned, or nil if there are no violations.
1625 func (m *KeyValuePair) Validate() error {
1626 return m.validate(false)
1627 }
1628
1629 // ValidateAll checks the field values on KeyValuePair with the rules defined
1630 // in the proto definition for this message. If any rules are violated, the
1631 // result is a list of violation errors wrapped in KeyValuePairMultiError, or
1632 // nil if none found.
1633 func (m *KeyValuePair) ValidateAll() error {
1634 return m.validate(true)
1635 }
1636
1637 func (m *KeyValuePair) validate(all bool) error {
1638 if m == nil {
1639 return nil
1640 }
1641
1642 var errors []error
1643
1644 if utf8.RuneCountInString(m.GetKey()) < 1 {
1645 err := KeyValuePairValidationError{
1646 field: "Key",
1647 reason: "value length must be at least 1 runes",
1648 }
1649 if !all {
1650 return err
1651 }
1652 errors = append(errors, err)
1653 }
1654
1655 if len(m.GetKey()) > 16384 {
1656 err := KeyValuePairValidationError{
1657 field: "Key",
1658 reason: "value length must be at most 16384 bytes",
1659 }
1660 if !all {
1661 return err
1662 }
1663 errors = append(errors, err)
1664 }
1665
1666 if all {
1667 switch v := interface{}(m.GetValue()).(type) {
1668 case interface{ ValidateAll() error }:
1669 if err := v.ValidateAll(); err != nil {
1670 errors = append(errors, KeyValuePairValidationError{
1671 field: "Value",
1672 reason: "embedded message failed validation",
1673 cause: err,
1674 })
1675 }
1676 case interface{ Validate() error }:
1677 if err := v.Validate(); err != nil {
1678 errors = append(errors, KeyValuePairValidationError{
1679 field: "Value",
1680 reason: "embedded message failed validation",
1681 cause: err,
1682 })
1683 }
1684 }
1685 } else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok {
1686 if err := v.Validate(); err != nil {
1687 return KeyValuePairValidationError{
1688 field: "Value",
1689 reason: "embedded message failed validation",
1690 cause: err,
1691 }
1692 }
1693 }
1694
1695 if len(errors) > 0 {
1696 return KeyValuePairMultiError(errors)
1697 }
1698
1699 return nil
1700 }
1701
1702 // KeyValuePairMultiError is an error wrapping multiple validation errors
1703 // returned by KeyValuePair.ValidateAll() if the designated constraints aren't met.
1704 type KeyValuePairMultiError []error
1705
1706 // Error returns a concatenation of all the error messages it wraps.
1707 func (m KeyValuePairMultiError) Error() string {
1708 var msgs []string
1709 for _, err := range m {
1710 msgs = append(msgs, err.Error())
1711 }
1712 return strings.Join(msgs, "; ")
1713 }
1714
1715 // AllErrors returns a list of validation violation errors.
1716 func (m KeyValuePairMultiError) AllErrors() []error { return m }
1717
1718 // KeyValuePairValidationError is the validation error returned by
1719 // KeyValuePair.Validate if the designated constraints aren't met.
1720 type KeyValuePairValidationError struct {
1721 field string
1722 reason string
1723 cause error
1724 key bool
1725 }
1726
1727 // Field function returns field value.
1728 func (e KeyValuePairValidationError) Field() string { return e.field }
1729
1730 // Reason function returns reason value.
1731 func (e KeyValuePairValidationError) Reason() string { return e.reason }
1732
1733 // Cause function returns cause value.
1734 func (e KeyValuePairValidationError) Cause() error { return e.cause }
1735
1736 // Key function returns key value.
1737 func (e KeyValuePairValidationError) Key() bool { return e.key }
1738
1739 // ErrorName returns error name.
1740 func (e KeyValuePairValidationError) ErrorName() string { return "KeyValuePairValidationError" }
1741
1742 // Error satisfies the builtin error interface
1743 func (e KeyValuePairValidationError) Error() string {
1744 cause := ""
1745 if e.cause != nil {
1746 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1747 }
1748
1749 key := ""
1750 if e.key {
1751 key = "key for "
1752 }
1753
1754 return fmt.Sprintf(
1755 "invalid %sKeyValuePair.%s: %s%s",
1756 key,
1757 e.field,
1758 e.reason,
1759 cause)
1760 }
1761
1762 var _ error = KeyValuePairValidationError{}
1763
1764 var _ interface {
1765 Field() string
1766 Reason() string
1767 Key() bool
1768 Cause() error
1769 ErrorName() string
1770 } = KeyValuePairValidationError{}
1771
1772 // Validate checks the field values on KeyValueAppend with the rules defined in
1773 // the proto definition for this message. If any rules are violated, the first
1774 // error encountered is returned, or nil if there are no violations.
1775 func (m *KeyValueAppend) Validate() error {
1776 return m.validate(false)
1777 }
1778
1779 // ValidateAll checks the field values on KeyValueAppend with the rules defined
1780 // in the proto definition for this message. If any rules are violated, the
1781 // result is a list of violation errors wrapped in KeyValueAppendMultiError,
1782 // or nil if none found.
1783 func (m *KeyValueAppend) ValidateAll() error {
1784 return m.validate(true)
1785 }
1786
1787 func (m *KeyValueAppend) validate(all bool) error {
1788 if m == nil {
1789 return nil
1790 }
1791
1792 var errors []error
1793
1794 if all {
1795 switch v := interface{}(m.GetRecord()).(type) {
1796 case interface{ ValidateAll() error }:
1797 if err := v.ValidateAll(); err != nil {
1798 errors = append(errors, KeyValueAppendValidationError{
1799 field: "Record",
1800 reason: "embedded message failed validation",
1801 cause: err,
1802 })
1803 }
1804 case interface{ Validate() error }:
1805 if err := v.Validate(); err != nil {
1806 errors = append(errors, KeyValueAppendValidationError{
1807 field: "Record",
1808 reason: "embedded message failed validation",
1809 cause: err,
1810 })
1811 }
1812 }
1813 } else if v, ok := interface{}(m.GetRecord()).(interface{ Validate() error }); ok {
1814 if err := v.Validate(); err != nil {
1815 return KeyValueAppendValidationError{
1816 field: "Record",
1817 reason: "embedded message failed validation",
1818 cause: err,
1819 }
1820 }
1821 }
1822
1823 // skipping validation for entry
1824
1825 if _, ok := KeyValueAppend_KeyValueAppendAction_name[int32(m.GetAction())]; !ok {
1826 err := KeyValueAppendValidationError{
1827 field: "Action",
1828 reason: "value must be one of the defined enum values",
1829 }
1830 if !all {
1831 return err
1832 }
1833 errors = append(errors, err)
1834 }
1835
1836 if len(errors) > 0 {
1837 return KeyValueAppendMultiError(errors)
1838 }
1839
1840 return nil
1841 }
1842
1843 // KeyValueAppendMultiError is an error wrapping multiple validation errors
1844 // returned by KeyValueAppend.ValidateAll() if the designated constraints
1845 // aren't met.
1846 type KeyValueAppendMultiError []error
1847
1848 // Error returns a concatenation of all the error messages it wraps.
1849 func (m KeyValueAppendMultiError) Error() string {
1850 var msgs []string
1851 for _, err := range m {
1852 msgs = append(msgs, err.Error())
1853 }
1854 return strings.Join(msgs, "; ")
1855 }
1856
1857 // AllErrors returns a list of validation violation errors.
1858 func (m KeyValueAppendMultiError) AllErrors() []error { return m }
1859
1860 // KeyValueAppendValidationError is the validation error returned by
1861 // KeyValueAppend.Validate if the designated constraints aren't met.
1862 type KeyValueAppendValidationError struct {
1863 field string
1864 reason string
1865 cause error
1866 key bool
1867 }
1868
1869 // Field function returns field value.
1870 func (e KeyValueAppendValidationError) Field() string { return e.field }
1871
1872 // Reason function returns reason value.
1873 func (e KeyValueAppendValidationError) Reason() string { return e.reason }
1874
1875 // Cause function returns cause value.
1876 func (e KeyValueAppendValidationError) Cause() error { return e.cause }
1877
1878 // Key function returns key value.
1879 func (e KeyValueAppendValidationError) Key() bool { return e.key }
1880
1881 // ErrorName returns error name.
1882 func (e KeyValueAppendValidationError) ErrorName() string { return "KeyValueAppendValidationError" }
1883
1884 // Error satisfies the builtin error interface
1885 func (e KeyValueAppendValidationError) Error() string {
1886 cause := ""
1887 if e.cause != nil {
1888 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1889 }
1890
1891 key := ""
1892 if e.key {
1893 key = "key for "
1894 }
1895
1896 return fmt.Sprintf(
1897 "invalid %sKeyValueAppend.%s: %s%s",
1898 key,
1899 e.field,
1900 e.reason,
1901 cause)
1902 }
1903
1904 var _ error = KeyValueAppendValidationError{}
1905
1906 var _ interface {
1907 Field() string
1908 Reason() string
1909 Key() bool
1910 Cause() error
1911 ErrorName() string
1912 } = KeyValueAppendValidationError{}
1913
1914 // Validate checks the field values on KeyValueMutation with the rules defined
1915 // in the proto definition for this message. If any rules are violated, the
1916 // first error encountered is returned, or nil if there are no violations.
1917 func (m *KeyValueMutation) Validate() error {
1918 return m.validate(false)
1919 }
1920
1921 // ValidateAll checks the field values on KeyValueMutation with the rules
1922 // defined in the proto definition for this message. If any rules are
1923 // violated, the result is a list of violation errors wrapped in
1924 // KeyValueMutationMultiError, or nil if none found.
1925 func (m *KeyValueMutation) ValidateAll() error {
1926 return m.validate(true)
1927 }
1928
1929 func (m *KeyValueMutation) validate(all bool) error {
1930 if m == nil {
1931 return nil
1932 }
1933
1934 var errors []error
1935
1936 if all {
1937 switch v := interface{}(m.GetAppend()).(type) {
1938 case interface{ ValidateAll() error }:
1939 if err := v.ValidateAll(); err != nil {
1940 errors = append(errors, KeyValueMutationValidationError{
1941 field: "Append",
1942 reason: "embedded message failed validation",
1943 cause: err,
1944 })
1945 }
1946 case interface{ Validate() error }:
1947 if err := v.Validate(); err != nil {
1948 errors = append(errors, KeyValueMutationValidationError{
1949 field: "Append",
1950 reason: "embedded message failed validation",
1951 cause: err,
1952 })
1953 }
1954 }
1955 } else if v, ok := interface{}(m.GetAppend()).(interface{ Validate() error }); ok {
1956 if err := v.Validate(); err != nil {
1957 return KeyValueMutationValidationError{
1958 field: "Append",
1959 reason: "embedded message failed validation",
1960 cause: err,
1961 }
1962 }
1963 }
1964
1965 if len(m.GetRemove()) > 16384 {
1966 err := KeyValueMutationValidationError{
1967 field: "Remove",
1968 reason: "value length must be at most 16384 bytes",
1969 }
1970 if !all {
1971 return err
1972 }
1973 errors = append(errors, err)
1974 }
1975
1976 if len(errors) > 0 {
1977 return KeyValueMutationMultiError(errors)
1978 }
1979
1980 return nil
1981 }
1982
1983 // KeyValueMutationMultiError is an error wrapping multiple validation errors
1984 // returned by KeyValueMutation.ValidateAll() if the designated constraints
1985 // aren't met.
1986 type KeyValueMutationMultiError []error
1987
1988 // Error returns a concatenation of all the error messages it wraps.
1989 func (m KeyValueMutationMultiError) Error() string {
1990 var msgs []string
1991 for _, err := range m {
1992 msgs = append(msgs, err.Error())
1993 }
1994 return strings.Join(msgs, "; ")
1995 }
1996
1997 // AllErrors returns a list of validation violation errors.
1998 func (m KeyValueMutationMultiError) AllErrors() []error { return m }
1999
2000 // KeyValueMutationValidationError is the validation error returned by
2001 // KeyValueMutation.Validate if the designated constraints aren't met.
2002 type KeyValueMutationValidationError struct {
2003 field string
2004 reason string
2005 cause error
2006 key bool
2007 }
2008
2009 // Field function returns field value.
2010 func (e KeyValueMutationValidationError) Field() string { return e.field }
2011
2012 // Reason function returns reason value.
2013 func (e KeyValueMutationValidationError) Reason() string { return e.reason }
2014
2015 // Cause function returns cause value.
2016 func (e KeyValueMutationValidationError) Cause() error { return e.cause }
2017
2018 // Key function returns key value.
2019 func (e KeyValueMutationValidationError) Key() bool { return e.key }
2020
2021 // ErrorName returns error name.
2022 func (e KeyValueMutationValidationError) ErrorName() string { return "KeyValueMutationValidationError" }
2023
2024 // Error satisfies the builtin error interface
2025 func (e KeyValueMutationValidationError) Error() string {
2026 cause := ""
2027 if e.cause != nil {
2028 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2029 }
2030
2031 key := ""
2032 if e.key {
2033 key = "key for "
2034 }
2035
2036 return fmt.Sprintf(
2037 "invalid %sKeyValueMutation.%s: %s%s",
2038 key,
2039 e.field,
2040 e.reason,
2041 cause)
2042 }
2043
2044 var _ error = KeyValueMutationValidationError{}
2045
2046 var _ interface {
2047 Field() string
2048 Reason() string
2049 Key() bool
2050 Cause() error
2051 ErrorName() string
2052 } = KeyValueMutationValidationError{}
2053
2054 // Validate checks the field values on QueryParameter with the rules defined in
2055 // the proto definition for this message. If any rules are violated, the first
2056 // error encountered is returned, or nil if there are no violations.
2057 func (m *QueryParameter) Validate() error {
2058 return m.validate(false)
2059 }
2060
2061 // ValidateAll checks the field values on QueryParameter with the rules defined
2062 // in the proto definition for this message. If any rules are violated, the
2063 // result is a list of violation errors wrapped in QueryParameterMultiError,
2064 // or nil if none found.
2065 func (m *QueryParameter) ValidateAll() error {
2066 return m.validate(true)
2067 }
2068
2069 func (m *QueryParameter) validate(all bool) error {
2070 if m == nil {
2071 return nil
2072 }
2073
2074 var errors []error
2075
2076 if utf8.RuneCountInString(m.GetKey()) < 1 {
2077 err := QueryParameterValidationError{
2078 field: "Key",
2079 reason: "value length must be at least 1 runes",
2080 }
2081 if !all {
2082 return err
2083 }
2084 errors = append(errors, err)
2085 }
2086
2087 // no validation rules for Value
2088
2089 if len(errors) > 0 {
2090 return QueryParameterMultiError(errors)
2091 }
2092
2093 return nil
2094 }
2095
2096 // QueryParameterMultiError is an error wrapping multiple validation errors
2097 // returned by QueryParameter.ValidateAll() if the designated constraints
2098 // aren't met.
2099 type QueryParameterMultiError []error
2100
2101 // Error returns a concatenation of all the error messages it wraps.
2102 func (m QueryParameterMultiError) Error() string {
2103 var msgs []string
2104 for _, err := range m {
2105 msgs = append(msgs, err.Error())
2106 }
2107 return strings.Join(msgs, "; ")
2108 }
2109
2110 // AllErrors returns a list of validation violation errors.
2111 func (m QueryParameterMultiError) AllErrors() []error { return m }
2112
2113 // QueryParameterValidationError is the validation error returned by
2114 // QueryParameter.Validate if the designated constraints aren't met.
2115 type QueryParameterValidationError struct {
2116 field string
2117 reason string
2118 cause error
2119 key bool
2120 }
2121
2122 // Field function returns field value.
2123 func (e QueryParameterValidationError) Field() string { return e.field }
2124
2125 // Reason function returns reason value.
2126 func (e QueryParameterValidationError) Reason() string { return e.reason }
2127
2128 // Cause function returns cause value.
2129 func (e QueryParameterValidationError) Cause() error { return e.cause }
2130
2131 // Key function returns key value.
2132 func (e QueryParameterValidationError) Key() bool { return e.key }
2133
2134 // ErrorName returns error name.
2135 func (e QueryParameterValidationError) ErrorName() string { return "QueryParameterValidationError" }
2136
2137 // Error satisfies the builtin error interface
2138 func (e QueryParameterValidationError) Error() string {
2139 cause := ""
2140 if e.cause != nil {
2141 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2142 }
2143
2144 key := ""
2145 if e.key {
2146 key = "key for "
2147 }
2148
2149 return fmt.Sprintf(
2150 "invalid %sQueryParameter.%s: %s%s",
2151 key,
2152 e.field,
2153 e.reason,
2154 cause)
2155 }
2156
2157 var _ error = QueryParameterValidationError{}
2158
2159 var _ interface {
2160 Field() string
2161 Reason() string
2162 Key() bool
2163 Cause() error
2164 ErrorName() string
2165 } = QueryParameterValidationError{}
2166
2167 // Validate checks the field values on HeaderValue with the rules defined in
2168 // the proto definition for this message. If any rules are violated, the first
2169 // error encountered is returned, or nil if there are no violations.
2170 func (m *HeaderValue) Validate() error {
2171 return m.validate(false)
2172 }
2173
2174 // ValidateAll checks the field values on HeaderValue with the rules defined in
2175 // the proto definition for this message. If any rules are violated, the
2176 // result is a list of violation errors wrapped in HeaderValueMultiError, or
2177 // nil if none found.
2178 func (m *HeaderValue) ValidateAll() error {
2179 return m.validate(true)
2180 }
2181
2182 func (m *HeaderValue) validate(all bool) error {
2183 if m == nil {
2184 return nil
2185 }
2186
2187 var errors []error
2188
2189 if utf8.RuneCountInString(m.GetKey()) < 1 {
2190 err := HeaderValueValidationError{
2191 field: "Key",
2192 reason: "value length must be at least 1 runes",
2193 }
2194 if !all {
2195 return err
2196 }
2197 errors = append(errors, err)
2198 }
2199
2200 if len(m.GetKey()) > 16384 {
2201 err := HeaderValueValidationError{
2202 field: "Key",
2203 reason: "value length must be at most 16384 bytes",
2204 }
2205 if !all {
2206 return err
2207 }
2208 errors = append(errors, err)
2209 }
2210
2211 if !_HeaderValue_Key_Pattern.MatchString(m.GetKey()) {
2212 err := HeaderValueValidationError{
2213 field: "Key",
2214 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
2215 }
2216 if !all {
2217 return err
2218 }
2219 errors = append(errors, err)
2220 }
2221
2222 if len(m.GetValue()) > 16384 {
2223 err := HeaderValueValidationError{
2224 field: "Value",
2225 reason: "value length must be at most 16384 bytes",
2226 }
2227 if !all {
2228 return err
2229 }
2230 errors = append(errors, err)
2231 }
2232
2233 if !_HeaderValue_Value_Pattern.MatchString(m.GetValue()) {
2234 err := HeaderValueValidationError{
2235 field: "Value",
2236 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
2237 }
2238 if !all {
2239 return err
2240 }
2241 errors = append(errors, err)
2242 }
2243
2244 if l := len(m.GetRawValue()); l < 0 || l > 16384 {
2245 err := HeaderValueValidationError{
2246 field: "RawValue",
2247 reason: "value length must be between 0 and 16384 bytes, inclusive",
2248 }
2249 if !all {
2250 return err
2251 }
2252 errors = append(errors, err)
2253 }
2254
2255 if len(errors) > 0 {
2256 return HeaderValueMultiError(errors)
2257 }
2258
2259 return nil
2260 }
2261
2262 // HeaderValueMultiError is an error wrapping multiple validation errors
2263 // returned by HeaderValue.ValidateAll() if the designated constraints aren't met.
2264 type HeaderValueMultiError []error
2265
2266 // Error returns a concatenation of all the error messages it wraps.
2267 func (m HeaderValueMultiError) Error() string {
2268 var msgs []string
2269 for _, err := range m {
2270 msgs = append(msgs, err.Error())
2271 }
2272 return strings.Join(msgs, "; ")
2273 }
2274
2275 // AllErrors returns a list of validation violation errors.
2276 func (m HeaderValueMultiError) AllErrors() []error { return m }
2277
2278 // HeaderValueValidationError is the validation error returned by
2279 // HeaderValue.Validate if the designated constraints aren't met.
2280 type HeaderValueValidationError struct {
2281 field string
2282 reason string
2283 cause error
2284 key bool
2285 }
2286
2287 // Field function returns field value.
2288 func (e HeaderValueValidationError) Field() string { return e.field }
2289
2290 // Reason function returns reason value.
2291 func (e HeaderValueValidationError) Reason() string { return e.reason }
2292
2293 // Cause function returns cause value.
2294 func (e HeaderValueValidationError) Cause() error { return e.cause }
2295
2296 // Key function returns key value.
2297 func (e HeaderValueValidationError) Key() bool { return e.key }
2298
2299 // ErrorName returns error name.
2300 func (e HeaderValueValidationError) ErrorName() string { return "HeaderValueValidationError" }
2301
2302 // Error satisfies the builtin error interface
2303 func (e HeaderValueValidationError) Error() string {
2304 cause := ""
2305 if e.cause != nil {
2306 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2307 }
2308
2309 key := ""
2310 if e.key {
2311 key = "key for "
2312 }
2313
2314 return fmt.Sprintf(
2315 "invalid %sHeaderValue.%s: %s%s",
2316 key,
2317 e.field,
2318 e.reason,
2319 cause)
2320 }
2321
2322 var _ error = HeaderValueValidationError{}
2323
2324 var _ interface {
2325 Field() string
2326 Reason() string
2327 Key() bool
2328 Cause() error
2329 ErrorName() string
2330 } = HeaderValueValidationError{}
2331
2332 var _HeaderValue_Key_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
2333
2334 var _HeaderValue_Value_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
2335
2336 // Validate checks the field values on HeaderValueOption with the rules defined
2337 // in the proto definition for this message. If any rules are violated, the
2338 // first error encountered is returned, or nil if there are no violations.
2339 func (m *HeaderValueOption) Validate() error {
2340 return m.validate(false)
2341 }
2342
2343 // ValidateAll checks the field values on HeaderValueOption with the rules
2344 // defined in the proto definition for this message. If any rules are
2345 // violated, the result is a list of violation errors wrapped in
2346 // HeaderValueOptionMultiError, or nil if none found.
2347 func (m *HeaderValueOption) ValidateAll() error {
2348 return m.validate(true)
2349 }
2350
2351 func (m *HeaderValueOption) validate(all bool) error {
2352 if m == nil {
2353 return nil
2354 }
2355
2356 var errors []error
2357
2358 if m.GetHeader() == nil {
2359 err := HeaderValueOptionValidationError{
2360 field: "Header",
2361 reason: "value is required",
2362 }
2363 if !all {
2364 return err
2365 }
2366 errors = append(errors, err)
2367 }
2368
2369 if all {
2370 switch v := interface{}(m.GetHeader()).(type) {
2371 case interface{ ValidateAll() error }:
2372 if err := v.ValidateAll(); err != nil {
2373 errors = append(errors, HeaderValueOptionValidationError{
2374 field: "Header",
2375 reason: "embedded message failed validation",
2376 cause: err,
2377 })
2378 }
2379 case interface{ Validate() error }:
2380 if err := v.Validate(); err != nil {
2381 errors = append(errors, HeaderValueOptionValidationError{
2382 field: "Header",
2383 reason: "embedded message failed validation",
2384 cause: err,
2385 })
2386 }
2387 }
2388 } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
2389 if err := v.Validate(); err != nil {
2390 return HeaderValueOptionValidationError{
2391 field: "Header",
2392 reason: "embedded message failed validation",
2393 cause: err,
2394 }
2395 }
2396 }
2397
2398 if all {
2399 switch v := interface{}(m.GetAppend()).(type) {
2400 case interface{ ValidateAll() error }:
2401 if err := v.ValidateAll(); err != nil {
2402 errors = append(errors, HeaderValueOptionValidationError{
2403 field: "Append",
2404 reason: "embedded message failed validation",
2405 cause: err,
2406 })
2407 }
2408 case interface{ Validate() error }:
2409 if err := v.Validate(); err != nil {
2410 errors = append(errors, HeaderValueOptionValidationError{
2411 field: "Append",
2412 reason: "embedded message failed validation",
2413 cause: err,
2414 })
2415 }
2416 }
2417 } else if v, ok := interface{}(m.GetAppend()).(interface{ Validate() error }); ok {
2418 if err := v.Validate(); err != nil {
2419 return HeaderValueOptionValidationError{
2420 field: "Append",
2421 reason: "embedded message failed validation",
2422 cause: err,
2423 }
2424 }
2425 }
2426
2427 if _, ok := HeaderValueOption_HeaderAppendAction_name[int32(m.GetAppendAction())]; !ok {
2428 err := HeaderValueOptionValidationError{
2429 field: "AppendAction",
2430 reason: "value must be one of the defined enum values",
2431 }
2432 if !all {
2433 return err
2434 }
2435 errors = append(errors, err)
2436 }
2437
2438 // no validation rules for KeepEmptyValue
2439
2440 if len(errors) > 0 {
2441 return HeaderValueOptionMultiError(errors)
2442 }
2443
2444 return nil
2445 }
2446
2447 // HeaderValueOptionMultiError is an error wrapping multiple validation errors
2448 // returned by HeaderValueOption.ValidateAll() if the designated constraints
2449 // aren't met.
2450 type HeaderValueOptionMultiError []error
2451
2452 // Error returns a concatenation of all the error messages it wraps.
2453 func (m HeaderValueOptionMultiError) Error() string {
2454 var msgs []string
2455 for _, err := range m {
2456 msgs = append(msgs, err.Error())
2457 }
2458 return strings.Join(msgs, "; ")
2459 }
2460
2461 // AllErrors returns a list of validation violation errors.
2462 func (m HeaderValueOptionMultiError) AllErrors() []error { return m }
2463
2464 // HeaderValueOptionValidationError is the validation error returned by
2465 // HeaderValueOption.Validate if the designated constraints aren't met.
2466 type HeaderValueOptionValidationError struct {
2467 field string
2468 reason string
2469 cause error
2470 key bool
2471 }
2472
2473 // Field function returns field value.
2474 func (e HeaderValueOptionValidationError) Field() string { return e.field }
2475
2476 // Reason function returns reason value.
2477 func (e HeaderValueOptionValidationError) Reason() string { return e.reason }
2478
2479 // Cause function returns cause value.
2480 func (e HeaderValueOptionValidationError) Cause() error { return e.cause }
2481
2482 // Key function returns key value.
2483 func (e HeaderValueOptionValidationError) Key() bool { return e.key }
2484
2485 // ErrorName returns error name.
2486 func (e HeaderValueOptionValidationError) ErrorName() string {
2487 return "HeaderValueOptionValidationError"
2488 }
2489
2490 // Error satisfies the builtin error interface
2491 func (e HeaderValueOptionValidationError) Error() string {
2492 cause := ""
2493 if e.cause != nil {
2494 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2495 }
2496
2497 key := ""
2498 if e.key {
2499 key = "key for "
2500 }
2501
2502 return fmt.Sprintf(
2503 "invalid %sHeaderValueOption.%s: %s%s",
2504 key,
2505 e.field,
2506 e.reason,
2507 cause)
2508 }
2509
2510 var _ error = HeaderValueOptionValidationError{}
2511
2512 var _ interface {
2513 Field() string
2514 Reason() string
2515 Key() bool
2516 Cause() error
2517 ErrorName() string
2518 } = HeaderValueOptionValidationError{}
2519
2520 // Validate checks the field values on HeaderMap with the rules defined in the
2521 // proto definition for this message. If any rules are violated, the first
2522 // error encountered is returned, or nil if there are no violations.
2523 func (m *HeaderMap) Validate() error {
2524 return m.validate(false)
2525 }
2526
2527 // ValidateAll checks the field values on HeaderMap with the rules defined in
2528 // the proto definition for this message. If any rules are violated, the
2529 // result is a list of violation errors wrapped in HeaderMapMultiError, or nil
2530 // if none found.
2531 func (m *HeaderMap) ValidateAll() error {
2532 return m.validate(true)
2533 }
2534
2535 func (m *HeaderMap) validate(all bool) error {
2536 if m == nil {
2537 return nil
2538 }
2539
2540 var errors []error
2541
2542 for idx, item := range m.GetHeaders() {
2543 _, _ = idx, item
2544
2545 if all {
2546 switch v := interface{}(item).(type) {
2547 case interface{ ValidateAll() error }:
2548 if err := v.ValidateAll(); err != nil {
2549 errors = append(errors, HeaderMapValidationError{
2550 field: fmt.Sprintf("Headers[%v]", idx),
2551 reason: "embedded message failed validation",
2552 cause: err,
2553 })
2554 }
2555 case interface{ Validate() error }:
2556 if err := v.Validate(); err != nil {
2557 errors = append(errors, HeaderMapValidationError{
2558 field: fmt.Sprintf("Headers[%v]", idx),
2559 reason: "embedded message failed validation",
2560 cause: err,
2561 })
2562 }
2563 }
2564 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2565 if err := v.Validate(); err != nil {
2566 return HeaderMapValidationError{
2567 field: fmt.Sprintf("Headers[%v]", idx),
2568 reason: "embedded message failed validation",
2569 cause: err,
2570 }
2571 }
2572 }
2573
2574 }
2575
2576 if len(errors) > 0 {
2577 return HeaderMapMultiError(errors)
2578 }
2579
2580 return nil
2581 }
2582
2583 // HeaderMapMultiError is an error wrapping multiple validation errors returned
2584 // by HeaderMap.ValidateAll() if the designated constraints aren't met.
2585 type HeaderMapMultiError []error
2586
2587 // Error returns a concatenation of all the error messages it wraps.
2588 func (m HeaderMapMultiError) Error() string {
2589 var msgs []string
2590 for _, err := range m {
2591 msgs = append(msgs, err.Error())
2592 }
2593 return strings.Join(msgs, "; ")
2594 }
2595
2596 // AllErrors returns a list of validation violation errors.
2597 func (m HeaderMapMultiError) AllErrors() []error { return m }
2598
2599 // HeaderMapValidationError is the validation error returned by
2600 // HeaderMap.Validate if the designated constraints aren't met.
2601 type HeaderMapValidationError struct {
2602 field string
2603 reason string
2604 cause error
2605 key bool
2606 }
2607
2608 // Field function returns field value.
2609 func (e HeaderMapValidationError) Field() string { return e.field }
2610
2611 // Reason function returns reason value.
2612 func (e HeaderMapValidationError) Reason() string { return e.reason }
2613
2614 // Cause function returns cause value.
2615 func (e HeaderMapValidationError) Cause() error { return e.cause }
2616
2617 // Key function returns key value.
2618 func (e HeaderMapValidationError) Key() bool { return e.key }
2619
2620 // ErrorName returns error name.
2621 func (e HeaderMapValidationError) ErrorName() string { return "HeaderMapValidationError" }
2622
2623 // Error satisfies the builtin error interface
2624 func (e HeaderMapValidationError) Error() string {
2625 cause := ""
2626 if e.cause != nil {
2627 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2628 }
2629
2630 key := ""
2631 if e.key {
2632 key = "key for "
2633 }
2634
2635 return fmt.Sprintf(
2636 "invalid %sHeaderMap.%s: %s%s",
2637 key,
2638 e.field,
2639 e.reason,
2640 cause)
2641 }
2642
2643 var _ error = HeaderMapValidationError{}
2644
2645 var _ interface {
2646 Field() string
2647 Reason() string
2648 Key() bool
2649 Cause() error
2650 ErrorName() string
2651 } = HeaderMapValidationError{}
2652
2653 // Validate checks the field values on WatchedDirectory with the rules defined
2654 // in the proto definition for this message. If any rules are violated, the
2655 // first error encountered is returned, or nil if there are no violations.
2656 func (m *WatchedDirectory) Validate() error {
2657 return m.validate(false)
2658 }
2659
2660 // ValidateAll checks the field values on WatchedDirectory with the rules
2661 // defined in the proto definition for this message. If any rules are
2662 // violated, the result is a list of violation errors wrapped in
2663 // WatchedDirectoryMultiError, or nil if none found.
2664 func (m *WatchedDirectory) ValidateAll() error {
2665 return m.validate(true)
2666 }
2667
2668 func (m *WatchedDirectory) validate(all bool) error {
2669 if m == nil {
2670 return nil
2671 }
2672
2673 var errors []error
2674
2675 if utf8.RuneCountInString(m.GetPath()) < 1 {
2676 err := WatchedDirectoryValidationError{
2677 field: "Path",
2678 reason: "value length must be at least 1 runes",
2679 }
2680 if !all {
2681 return err
2682 }
2683 errors = append(errors, err)
2684 }
2685
2686 if len(errors) > 0 {
2687 return WatchedDirectoryMultiError(errors)
2688 }
2689
2690 return nil
2691 }
2692
2693 // WatchedDirectoryMultiError is an error wrapping multiple validation errors
2694 // returned by WatchedDirectory.ValidateAll() if the designated constraints
2695 // aren't met.
2696 type WatchedDirectoryMultiError []error
2697
2698 // Error returns a concatenation of all the error messages it wraps.
2699 func (m WatchedDirectoryMultiError) Error() string {
2700 var msgs []string
2701 for _, err := range m {
2702 msgs = append(msgs, err.Error())
2703 }
2704 return strings.Join(msgs, "; ")
2705 }
2706
2707 // AllErrors returns a list of validation violation errors.
2708 func (m WatchedDirectoryMultiError) AllErrors() []error { return m }
2709
2710 // WatchedDirectoryValidationError is the validation error returned by
2711 // WatchedDirectory.Validate if the designated constraints aren't met.
2712 type WatchedDirectoryValidationError struct {
2713 field string
2714 reason string
2715 cause error
2716 key bool
2717 }
2718
2719 // Field function returns field value.
2720 func (e WatchedDirectoryValidationError) Field() string { return e.field }
2721
2722 // Reason function returns reason value.
2723 func (e WatchedDirectoryValidationError) Reason() string { return e.reason }
2724
2725 // Cause function returns cause value.
2726 func (e WatchedDirectoryValidationError) Cause() error { return e.cause }
2727
2728 // Key function returns key value.
2729 func (e WatchedDirectoryValidationError) Key() bool { return e.key }
2730
2731 // ErrorName returns error name.
2732 func (e WatchedDirectoryValidationError) ErrorName() string { return "WatchedDirectoryValidationError" }
2733
2734 // Error satisfies the builtin error interface
2735 func (e WatchedDirectoryValidationError) Error() string {
2736 cause := ""
2737 if e.cause != nil {
2738 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2739 }
2740
2741 key := ""
2742 if e.key {
2743 key = "key for "
2744 }
2745
2746 return fmt.Sprintf(
2747 "invalid %sWatchedDirectory.%s: %s%s",
2748 key,
2749 e.field,
2750 e.reason,
2751 cause)
2752 }
2753
2754 var _ error = WatchedDirectoryValidationError{}
2755
2756 var _ interface {
2757 Field() string
2758 Reason() string
2759 Key() bool
2760 Cause() error
2761 ErrorName() string
2762 } = WatchedDirectoryValidationError{}
2763
2764 // Validate checks the field values on DataSource with the rules defined in the
2765 // proto definition for this message. If any rules are violated, the first
2766 // error encountered is returned, or nil if there are no violations.
2767 func (m *DataSource) Validate() error {
2768 return m.validate(false)
2769 }
2770
2771 // ValidateAll checks the field values on DataSource with the rules defined in
2772 // the proto definition for this message. If any rules are violated, the
2773 // result is a list of violation errors wrapped in DataSourceMultiError, or
2774 // nil if none found.
2775 func (m *DataSource) ValidateAll() error {
2776 return m.validate(true)
2777 }
2778
2779 func (m *DataSource) validate(all bool) error {
2780 if m == nil {
2781 return nil
2782 }
2783
2784 var errors []error
2785
2786 if all {
2787 switch v := interface{}(m.GetWatchedDirectory()).(type) {
2788 case interface{ ValidateAll() error }:
2789 if err := v.ValidateAll(); err != nil {
2790 errors = append(errors, DataSourceValidationError{
2791 field: "WatchedDirectory",
2792 reason: "embedded message failed validation",
2793 cause: err,
2794 })
2795 }
2796 case interface{ Validate() error }:
2797 if err := v.Validate(); err != nil {
2798 errors = append(errors, DataSourceValidationError{
2799 field: "WatchedDirectory",
2800 reason: "embedded message failed validation",
2801 cause: err,
2802 })
2803 }
2804 }
2805 } else if v, ok := interface{}(m.GetWatchedDirectory()).(interface{ Validate() error }); ok {
2806 if err := v.Validate(); err != nil {
2807 return DataSourceValidationError{
2808 field: "WatchedDirectory",
2809 reason: "embedded message failed validation",
2810 cause: err,
2811 }
2812 }
2813 }
2814
2815 oneofSpecifierPresent := false
2816 switch v := m.Specifier.(type) {
2817 case *DataSource_Filename:
2818 if v == nil {
2819 err := DataSourceValidationError{
2820 field: "Specifier",
2821 reason: "oneof value cannot be a typed-nil",
2822 }
2823 if !all {
2824 return err
2825 }
2826 errors = append(errors, err)
2827 }
2828 oneofSpecifierPresent = true
2829
2830 if utf8.RuneCountInString(m.GetFilename()) < 1 {
2831 err := DataSourceValidationError{
2832 field: "Filename",
2833 reason: "value length must be at least 1 runes",
2834 }
2835 if !all {
2836 return err
2837 }
2838 errors = append(errors, err)
2839 }
2840
2841 case *DataSource_InlineBytes:
2842 if v == nil {
2843 err := DataSourceValidationError{
2844 field: "Specifier",
2845 reason: "oneof value cannot be a typed-nil",
2846 }
2847 if !all {
2848 return err
2849 }
2850 errors = append(errors, err)
2851 }
2852 oneofSpecifierPresent = true
2853 // no validation rules for InlineBytes
2854 case *DataSource_InlineString:
2855 if v == nil {
2856 err := DataSourceValidationError{
2857 field: "Specifier",
2858 reason: "oneof value cannot be a typed-nil",
2859 }
2860 if !all {
2861 return err
2862 }
2863 errors = append(errors, err)
2864 }
2865 oneofSpecifierPresent = true
2866 // no validation rules for InlineString
2867 case *DataSource_EnvironmentVariable:
2868 if v == nil {
2869 err := DataSourceValidationError{
2870 field: "Specifier",
2871 reason: "oneof value cannot be a typed-nil",
2872 }
2873 if !all {
2874 return err
2875 }
2876 errors = append(errors, err)
2877 }
2878 oneofSpecifierPresent = true
2879
2880 if utf8.RuneCountInString(m.GetEnvironmentVariable()) < 1 {
2881 err := DataSourceValidationError{
2882 field: "EnvironmentVariable",
2883 reason: "value length must be at least 1 runes",
2884 }
2885 if !all {
2886 return err
2887 }
2888 errors = append(errors, err)
2889 }
2890
2891 default:
2892 _ = v // ensures v is used
2893 }
2894 if !oneofSpecifierPresent {
2895 err := DataSourceValidationError{
2896 field: "Specifier",
2897 reason: "value is required",
2898 }
2899 if !all {
2900 return err
2901 }
2902 errors = append(errors, err)
2903 }
2904
2905 if len(errors) > 0 {
2906 return DataSourceMultiError(errors)
2907 }
2908
2909 return nil
2910 }
2911
2912 // DataSourceMultiError is an error wrapping multiple validation errors
2913 // returned by DataSource.ValidateAll() if the designated constraints aren't met.
2914 type DataSourceMultiError []error
2915
2916 // Error returns a concatenation of all the error messages it wraps.
2917 func (m DataSourceMultiError) Error() string {
2918 var msgs []string
2919 for _, err := range m {
2920 msgs = append(msgs, err.Error())
2921 }
2922 return strings.Join(msgs, "; ")
2923 }
2924
2925 // AllErrors returns a list of validation violation errors.
2926 func (m DataSourceMultiError) AllErrors() []error { return m }
2927
2928 // DataSourceValidationError is the validation error returned by
2929 // DataSource.Validate if the designated constraints aren't met.
2930 type DataSourceValidationError struct {
2931 field string
2932 reason string
2933 cause error
2934 key bool
2935 }
2936
2937 // Field function returns field value.
2938 func (e DataSourceValidationError) Field() string { return e.field }
2939
2940 // Reason function returns reason value.
2941 func (e DataSourceValidationError) Reason() string { return e.reason }
2942
2943 // Cause function returns cause value.
2944 func (e DataSourceValidationError) Cause() error { return e.cause }
2945
2946 // Key function returns key value.
2947 func (e DataSourceValidationError) Key() bool { return e.key }
2948
2949 // ErrorName returns error name.
2950 func (e DataSourceValidationError) ErrorName() string { return "DataSourceValidationError" }
2951
2952 // Error satisfies the builtin error interface
2953 func (e DataSourceValidationError) Error() string {
2954 cause := ""
2955 if e.cause != nil {
2956 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2957 }
2958
2959 key := ""
2960 if e.key {
2961 key = "key for "
2962 }
2963
2964 return fmt.Sprintf(
2965 "invalid %sDataSource.%s: %s%s",
2966 key,
2967 e.field,
2968 e.reason,
2969 cause)
2970 }
2971
2972 var _ error = DataSourceValidationError{}
2973
2974 var _ interface {
2975 Field() string
2976 Reason() string
2977 Key() bool
2978 Cause() error
2979 ErrorName() string
2980 } = DataSourceValidationError{}
2981
2982 // Validate checks the field values on RetryPolicy with the rules defined in
2983 // the proto definition for this message. If any rules are violated, the first
2984 // error encountered is returned, or nil if there are no violations.
2985 func (m *RetryPolicy) Validate() error {
2986 return m.validate(false)
2987 }
2988
2989 // ValidateAll checks the field values on RetryPolicy with the rules defined in
2990 // the proto definition for this message. If any rules are violated, the
2991 // result is a list of violation errors wrapped in RetryPolicyMultiError, or
2992 // nil if none found.
2993 func (m *RetryPolicy) ValidateAll() error {
2994 return m.validate(true)
2995 }
2996
2997 func (m *RetryPolicy) validate(all bool) error {
2998 if m == nil {
2999 return nil
3000 }
3001
3002 var errors []error
3003
3004 if all {
3005 switch v := interface{}(m.GetRetryBackOff()).(type) {
3006 case interface{ ValidateAll() error }:
3007 if err := v.ValidateAll(); err != nil {
3008 errors = append(errors, RetryPolicyValidationError{
3009 field: "RetryBackOff",
3010 reason: "embedded message failed validation",
3011 cause: err,
3012 })
3013 }
3014 case interface{ Validate() error }:
3015 if err := v.Validate(); err != nil {
3016 errors = append(errors, RetryPolicyValidationError{
3017 field: "RetryBackOff",
3018 reason: "embedded message failed validation",
3019 cause: err,
3020 })
3021 }
3022 }
3023 } else if v, ok := interface{}(m.GetRetryBackOff()).(interface{ Validate() error }); ok {
3024 if err := v.Validate(); err != nil {
3025 return RetryPolicyValidationError{
3026 field: "RetryBackOff",
3027 reason: "embedded message failed validation",
3028 cause: err,
3029 }
3030 }
3031 }
3032
3033 if all {
3034 switch v := interface{}(m.GetNumRetries()).(type) {
3035 case interface{ ValidateAll() error }:
3036 if err := v.ValidateAll(); err != nil {
3037 errors = append(errors, RetryPolicyValidationError{
3038 field: "NumRetries",
3039 reason: "embedded message failed validation",
3040 cause: err,
3041 })
3042 }
3043 case interface{ Validate() error }:
3044 if err := v.Validate(); err != nil {
3045 errors = append(errors, RetryPolicyValidationError{
3046 field: "NumRetries",
3047 reason: "embedded message failed validation",
3048 cause: err,
3049 })
3050 }
3051 }
3052 } else if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok {
3053 if err := v.Validate(); err != nil {
3054 return RetryPolicyValidationError{
3055 field: "NumRetries",
3056 reason: "embedded message failed validation",
3057 cause: err,
3058 }
3059 }
3060 }
3061
3062 // no validation rules for RetryOn
3063
3064 if all {
3065 switch v := interface{}(m.GetRetryPriority()).(type) {
3066 case interface{ ValidateAll() error }:
3067 if err := v.ValidateAll(); err != nil {
3068 errors = append(errors, RetryPolicyValidationError{
3069 field: "RetryPriority",
3070 reason: "embedded message failed validation",
3071 cause: err,
3072 })
3073 }
3074 case interface{ Validate() error }:
3075 if err := v.Validate(); err != nil {
3076 errors = append(errors, RetryPolicyValidationError{
3077 field: "RetryPriority",
3078 reason: "embedded message failed validation",
3079 cause: err,
3080 })
3081 }
3082 }
3083 } else if v, ok := interface{}(m.GetRetryPriority()).(interface{ Validate() error }); ok {
3084 if err := v.Validate(); err != nil {
3085 return RetryPolicyValidationError{
3086 field: "RetryPriority",
3087 reason: "embedded message failed validation",
3088 cause: err,
3089 }
3090 }
3091 }
3092
3093 for idx, item := range m.GetRetryHostPredicate() {
3094 _, _ = idx, item
3095
3096 if all {
3097 switch v := interface{}(item).(type) {
3098 case interface{ ValidateAll() error }:
3099 if err := v.ValidateAll(); err != nil {
3100 errors = append(errors, RetryPolicyValidationError{
3101 field: fmt.Sprintf("RetryHostPredicate[%v]", idx),
3102 reason: "embedded message failed validation",
3103 cause: err,
3104 })
3105 }
3106 case interface{ Validate() error }:
3107 if err := v.Validate(); err != nil {
3108 errors = append(errors, RetryPolicyValidationError{
3109 field: fmt.Sprintf("RetryHostPredicate[%v]", idx),
3110 reason: "embedded message failed validation",
3111 cause: err,
3112 })
3113 }
3114 }
3115 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
3116 if err := v.Validate(); err != nil {
3117 return RetryPolicyValidationError{
3118 field: fmt.Sprintf("RetryHostPredicate[%v]", idx),
3119 reason: "embedded message failed validation",
3120 cause: err,
3121 }
3122 }
3123 }
3124
3125 }
3126
3127 // no validation rules for HostSelectionRetryMaxAttempts
3128
3129 if len(errors) > 0 {
3130 return RetryPolicyMultiError(errors)
3131 }
3132
3133 return nil
3134 }
3135
3136 // RetryPolicyMultiError is an error wrapping multiple validation errors
3137 // returned by RetryPolicy.ValidateAll() if the designated constraints aren't met.
3138 type RetryPolicyMultiError []error
3139
3140 // Error returns a concatenation of all the error messages it wraps.
3141 func (m RetryPolicyMultiError) Error() string {
3142 var msgs []string
3143 for _, err := range m {
3144 msgs = append(msgs, err.Error())
3145 }
3146 return strings.Join(msgs, "; ")
3147 }
3148
3149 // AllErrors returns a list of validation violation errors.
3150 func (m RetryPolicyMultiError) AllErrors() []error { return m }
3151
3152 // RetryPolicyValidationError is the validation error returned by
3153 // RetryPolicy.Validate if the designated constraints aren't met.
3154 type RetryPolicyValidationError struct {
3155 field string
3156 reason string
3157 cause error
3158 key bool
3159 }
3160
3161 // Field function returns field value.
3162 func (e RetryPolicyValidationError) Field() string { return e.field }
3163
3164 // Reason function returns reason value.
3165 func (e RetryPolicyValidationError) Reason() string { return e.reason }
3166
3167 // Cause function returns cause value.
3168 func (e RetryPolicyValidationError) Cause() error { return e.cause }
3169
3170 // Key function returns key value.
3171 func (e RetryPolicyValidationError) Key() bool { return e.key }
3172
3173 // ErrorName returns error name.
3174 func (e RetryPolicyValidationError) ErrorName() string { return "RetryPolicyValidationError" }
3175
3176 // Error satisfies the builtin error interface
3177 func (e RetryPolicyValidationError) Error() string {
3178 cause := ""
3179 if e.cause != nil {
3180 cause = fmt.Sprintf(" | caused by: %v", e.cause)
3181 }
3182
3183 key := ""
3184 if e.key {
3185 key = "key for "
3186 }
3187
3188 return fmt.Sprintf(
3189 "invalid %sRetryPolicy.%s: %s%s",
3190 key,
3191 e.field,
3192 e.reason,
3193 cause)
3194 }
3195
3196 var _ error = RetryPolicyValidationError{}
3197
3198 var _ interface {
3199 Field() string
3200 Reason() string
3201 Key() bool
3202 Cause() error
3203 ErrorName() string
3204 } = RetryPolicyValidationError{}
3205
3206 // Validate checks the field values on RemoteDataSource with the rules defined
3207 // in the proto definition for this message. If any rules are violated, the
3208 // first error encountered is returned, or nil if there are no violations.
3209 func (m *RemoteDataSource) Validate() error {
3210 return m.validate(false)
3211 }
3212
3213 // ValidateAll checks the field values on RemoteDataSource with the rules
3214 // defined in the proto definition for this message. If any rules are
3215 // violated, the result is a list of violation errors wrapped in
3216 // RemoteDataSourceMultiError, or nil if none found.
3217 func (m *RemoteDataSource) ValidateAll() error {
3218 return m.validate(true)
3219 }
3220
3221 func (m *RemoteDataSource) validate(all bool) error {
3222 if m == nil {
3223 return nil
3224 }
3225
3226 var errors []error
3227
3228 if m.GetHttpUri() == nil {
3229 err := RemoteDataSourceValidationError{
3230 field: "HttpUri",
3231 reason: "value is required",
3232 }
3233 if !all {
3234 return err
3235 }
3236 errors = append(errors, err)
3237 }
3238
3239 if all {
3240 switch v := interface{}(m.GetHttpUri()).(type) {
3241 case interface{ ValidateAll() error }:
3242 if err := v.ValidateAll(); err != nil {
3243 errors = append(errors, RemoteDataSourceValidationError{
3244 field: "HttpUri",
3245 reason: "embedded message failed validation",
3246 cause: err,
3247 })
3248 }
3249 case interface{ Validate() error }:
3250 if err := v.Validate(); err != nil {
3251 errors = append(errors, RemoteDataSourceValidationError{
3252 field: "HttpUri",
3253 reason: "embedded message failed validation",
3254 cause: err,
3255 })
3256 }
3257 }
3258 } else if v, ok := interface{}(m.GetHttpUri()).(interface{ Validate() error }); ok {
3259 if err := v.Validate(); err != nil {
3260 return RemoteDataSourceValidationError{
3261 field: "HttpUri",
3262 reason: "embedded message failed validation",
3263 cause: err,
3264 }
3265 }
3266 }
3267
3268 if utf8.RuneCountInString(m.GetSha256()) < 1 {
3269 err := RemoteDataSourceValidationError{
3270 field: "Sha256",
3271 reason: "value length must be at least 1 runes",
3272 }
3273 if !all {
3274 return err
3275 }
3276 errors = append(errors, err)
3277 }
3278
3279 if all {
3280 switch v := interface{}(m.GetRetryPolicy()).(type) {
3281 case interface{ ValidateAll() error }:
3282 if err := v.ValidateAll(); err != nil {
3283 errors = append(errors, RemoteDataSourceValidationError{
3284 field: "RetryPolicy",
3285 reason: "embedded message failed validation",
3286 cause: err,
3287 })
3288 }
3289 case interface{ Validate() error }:
3290 if err := v.Validate(); err != nil {
3291 errors = append(errors, RemoteDataSourceValidationError{
3292 field: "RetryPolicy",
3293 reason: "embedded message failed validation",
3294 cause: err,
3295 })
3296 }
3297 }
3298 } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok {
3299 if err := v.Validate(); err != nil {
3300 return RemoteDataSourceValidationError{
3301 field: "RetryPolicy",
3302 reason: "embedded message failed validation",
3303 cause: err,
3304 }
3305 }
3306 }
3307
3308 if len(errors) > 0 {
3309 return RemoteDataSourceMultiError(errors)
3310 }
3311
3312 return nil
3313 }
3314
3315 // RemoteDataSourceMultiError is an error wrapping multiple validation errors
3316 // returned by RemoteDataSource.ValidateAll() if the designated constraints
3317 // aren't met.
3318 type RemoteDataSourceMultiError []error
3319
3320 // Error returns a concatenation of all the error messages it wraps.
3321 func (m RemoteDataSourceMultiError) Error() string {
3322 var msgs []string
3323 for _, err := range m {
3324 msgs = append(msgs, err.Error())
3325 }
3326 return strings.Join(msgs, "; ")
3327 }
3328
3329 // AllErrors returns a list of validation violation errors.
3330 func (m RemoteDataSourceMultiError) AllErrors() []error { return m }
3331
3332 // RemoteDataSourceValidationError is the validation error returned by
3333 // RemoteDataSource.Validate if the designated constraints aren't met.
3334 type RemoteDataSourceValidationError struct {
3335 field string
3336 reason string
3337 cause error
3338 key bool
3339 }
3340
3341 // Field function returns field value.
3342 func (e RemoteDataSourceValidationError) Field() string { return e.field }
3343
3344 // Reason function returns reason value.
3345 func (e RemoteDataSourceValidationError) Reason() string { return e.reason }
3346
3347 // Cause function returns cause value.
3348 func (e RemoteDataSourceValidationError) Cause() error { return e.cause }
3349
3350 // Key function returns key value.
3351 func (e RemoteDataSourceValidationError) Key() bool { return e.key }
3352
3353 // ErrorName returns error name.
3354 func (e RemoteDataSourceValidationError) ErrorName() string { return "RemoteDataSourceValidationError" }
3355
3356 // Error satisfies the builtin error interface
3357 func (e RemoteDataSourceValidationError) Error() string {
3358 cause := ""
3359 if e.cause != nil {
3360 cause = fmt.Sprintf(" | caused by: %v", e.cause)
3361 }
3362
3363 key := ""
3364 if e.key {
3365 key = "key for "
3366 }
3367
3368 return fmt.Sprintf(
3369 "invalid %sRemoteDataSource.%s: %s%s",
3370 key,
3371 e.field,
3372 e.reason,
3373 cause)
3374 }
3375
3376 var _ error = RemoteDataSourceValidationError{}
3377
3378 var _ interface {
3379 Field() string
3380 Reason() string
3381 Key() bool
3382 Cause() error
3383 ErrorName() string
3384 } = RemoteDataSourceValidationError{}
3385
3386 // Validate checks the field values on AsyncDataSource with the rules defined
3387 // in the proto definition for this message. If any rules are violated, the
3388 // first error encountered is returned, or nil if there are no violations.
3389 func (m *AsyncDataSource) Validate() error {
3390 return m.validate(false)
3391 }
3392
3393 // ValidateAll checks the field values on AsyncDataSource with the rules
3394 // defined in the proto definition for this message. If any rules are
3395 // violated, the result is a list of violation errors wrapped in
3396 // AsyncDataSourceMultiError, or nil if none found.
3397 func (m *AsyncDataSource) ValidateAll() error {
3398 return m.validate(true)
3399 }
3400
3401 func (m *AsyncDataSource) validate(all bool) error {
3402 if m == nil {
3403 return nil
3404 }
3405
3406 var errors []error
3407
3408 oneofSpecifierPresent := false
3409 switch v := m.Specifier.(type) {
3410 case *AsyncDataSource_Local:
3411 if v == nil {
3412 err := AsyncDataSourceValidationError{
3413 field: "Specifier",
3414 reason: "oneof value cannot be a typed-nil",
3415 }
3416 if !all {
3417 return err
3418 }
3419 errors = append(errors, err)
3420 }
3421 oneofSpecifierPresent = true
3422
3423 if all {
3424 switch v := interface{}(m.GetLocal()).(type) {
3425 case interface{ ValidateAll() error }:
3426 if err := v.ValidateAll(); err != nil {
3427 errors = append(errors, AsyncDataSourceValidationError{
3428 field: "Local",
3429 reason: "embedded message failed validation",
3430 cause: err,
3431 })
3432 }
3433 case interface{ Validate() error }:
3434 if err := v.Validate(); err != nil {
3435 errors = append(errors, AsyncDataSourceValidationError{
3436 field: "Local",
3437 reason: "embedded message failed validation",
3438 cause: err,
3439 })
3440 }
3441 }
3442 } else if v, ok := interface{}(m.GetLocal()).(interface{ Validate() error }); ok {
3443 if err := v.Validate(); err != nil {
3444 return AsyncDataSourceValidationError{
3445 field: "Local",
3446 reason: "embedded message failed validation",
3447 cause: err,
3448 }
3449 }
3450 }
3451
3452 case *AsyncDataSource_Remote:
3453 if v == nil {
3454 err := AsyncDataSourceValidationError{
3455 field: "Specifier",
3456 reason: "oneof value cannot be a typed-nil",
3457 }
3458 if !all {
3459 return err
3460 }
3461 errors = append(errors, err)
3462 }
3463 oneofSpecifierPresent = true
3464
3465 if all {
3466 switch v := interface{}(m.GetRemote()).(type) {
3467 case interface{ ValidateAll() error }:
3468 if err := v.ValidateAll(); err != nil {
3469 errors = append(errors, AsyncDataSourceValidationError{
3470 field: "Remote",
3471 reason: "embedded message failed validation",
3472 cause: err,
3473 })
3474 }
3475 case interface{ Validate() error }:
3476 if err := v.Validate(); err != nil {
3477 errors = append(errors, AsyncDataSourceValidationError{
3478 field: "Remote",
3479 reason: "embedded message failed validation",
3480 cause: err,
3481 })
3482 }
3483 }
3484 } else if v, ok := interface{}(m.GetRemote()).(interface{ Validate() error }); ok {
3485 if err := v.Validate(); err != nil {
3486 return AsyncDataSourceValidationError{
3487 field: "Remote",
3488 reason: "embedded message failed validation",
3489 cause: err,
3490 }
3491 }
3492 }
3493
3494 default:
3495 _ = v // ensures v is used
3496 }
3497 if !oneofSpecifierPresent {
3498 err := AsyncDataSourceValidationError{
3499 field: "Specifier",
3500 reason: "value is required",
3501 }
3502 if !all {
3503 return err
3504 }
3505 errors = append(errors, err)
3506 }
3507
3508 if len(errors) > 0 {
3509 return AsyncDataSourceMultiError(errors)
3510 }
3511
3512 return nil
3513 }
3514
3515 // AsyncDataSourceMultiError is an error wrapping multiple validation errors
3516 // returned by AsyncDataSource.ValidateAll() if the designated constraints
3517 // aren't met.
3518 type AsyncDataSourceMultiError []error
3519
3520 // Error returns a concatenation of all the error messages it wraps.
3521 func (m AsyncDataSourceMultiError) Error() string {
3522 var msgs []string
3523 for _, err := range m {
3524 msgs = append(msgs, err.Error())
3525 }
3526 return strings.Join(msgs, "; ")
3527 }
3528
3529 // AllErrors returns a list of validation violation errors.
3530 func (m AsyncDataSourceMultiError) AllErrors() []error { return m }
3531
3532 // AsyncDataSourceValidationError is the validation error returned by
3533 // AsyncDataSource.Validate if the designated constraints aren't met.
3534 type AsyncDataSourceValidationError struct {
3535 field string
3536 reason string
3537 cause error
3538 key bool
3539 }
3540
3541 // Field function returns field value.
3542 func (e AsyncDataSourceValidationError) Field() string { return e.field }
3543
3544 // Reason function returns reason value.
3545 func (e AsyncDataSourceValidationError) Reason() string { return e.reason }
3546
3547 // Cause function returns cause value.
3548 func (e AsyncDataSourceValidationError) Cause() error { return e.cause }
3549
3550 // Key function returns key value.
3551 func (e AsyncDataSourceValidationError) Key() bool { return e.key }
3552
3553 // ErrorName returns error name.
3554 func (e AsyncDataSourceValidationError) ErrorName() string { return "AsyncDataSourceValidationError" }
3555
3556 // Error satisfies the builtin error interface
3557 func (e AsyncDataSourceValidationError) Error() string {
3558 cause := ""
3559 if e.cause != nil {
3560 cause = fmt.Sprintf(" | caused by: %v", e.cause)
3561 }
3562
3563 key := ""
3564 if e.key {
3565 key = "key for "
3566 }
3567
3568 return fmt.Sprintf(
3569 "invalid %sAsyncDataSource.%s: %s%s",
3570 key,
3571 e.field,
3572 e.reason,
3573 cause)
3574 }
3575
3576 var _ error = AsyncDataSourceValidationError{}
3577
3578 var _ interface {
3579 Field() string
3580 Reason() string
3581 Key() bool
3582 Cause() error
3583 ErrorName() string
3584 } = AsyncDataSourceValidationError{}
3585
3586 // Validate checks the field values on TransportSocket with the rules defined
3587 // in the proto definition for this message. If any rules are violated, the
3588 // first error encountered is returned, or nil if there are no violations.
3589 func (m *TransportSocket) Validate() error {
3590 return m.validate(false)
3591 }
3592
3593 // ValidateAll checks the field values on TransportSocket with the rules
3594 // defined in the proto definition for this message. If any rules are
3595 // violated, the result is a list of violation errors wrapped in
3596 // TransportSocketMultiError, or nil if none found.
3597 func (m *TransportSocket) ValidateAll() error {
3598 return m.validate(true)
3599 }
3600
3601 func (m *TransportSocket) validate(all bool) error {
3602 if m == nil {
3603 return nil
3604 }
3605
3606 var errors []error
3607
3608 if utf8.RuneCountInString(m.GetName()) < 1 {
3609 err := TransportSocketValidationError{
3610 field: "Name",
3611 reason: "value length must be at least 1 runes",
3612 }
3613 if !all {
3614 return err
3615 }
3616 errors = append(errors, err)
3617 }
3618
3619 switch v := m.ConfigType.(type) {
3620 case *TransportSocket_TypedConfig:
3621 if v == nil {
3622 err := TransportSocketValidationError{
3623 field: "ConfigType",
3624 reason: "oneof value cannot be a typed-nil",
3625 }
3626 if !all {
3627 return err
3628 }
3629 errors = append(errors, err)
3630 }
3631
3632 if all {
3633 switch v := interface{}(m.GetTypedConfig()).(type) {
3634 case interface{ ValidateAll() error }:
3635 if err := v.ValidateAll(); err != nil {
3636 errors = append(errors, TransportSocketValidationError{
3637 field: "TypedConfig",
3638 reason: "embedded message failed validation",
3639 cause: err,
3640 })
3641 }
3642 case interface{ Validate() error }:
3643 if err := v.Validate(); err != nil {
3644 errors = append(errors, TransportSocketValidationError{
3645 field: "TypedConfig",
3646 reason: "embedded message failed validation",
3647 cause: err,
3648 })
3649 }
3650 }
3651 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
3652 if err := v.Validate(); err != nil {
3653 return TransportSocketValidationError{
3654 field: "TypedConfig",
3655 reason: "embedded message failed validation",
3656 cause: err,
3657 }
3658 }
3659 }
3660
3661 default:
3662 _ = v // ensures v is used
3663 }
3664
3665 if len(errors) > 0 {
3666 return TransportSocketMultiError(errors)
3667 }
3668
3669 return nil
3670 }
3671
3672 // TransportSocketMultiError is an error wrapping multiple validation errors
3673 // returned by TransportSocket.ValidateAll() if the designated constraints
3674 // aren't met.
3675 type TransportSocketMultiError []error
3676
3677 // Error returns a concatenation of all the error messages it wraps.
3678 func (m TransportSocketMultiError) Error() string {
3679 var msgs []string
3680 for _, err := range m {
3681 msgs = append(msgs, err.Error())
3682 }
3683 return strings.Join(msgs, "; ")
3684 }
3685
3686 // AllErrors returns a list of validation violation errors.
3687 func (m TransportSocketMultiError) AllErrors() []error { return m }
3688
3689 // TransportSocketValidationError is the validation error returned by
3690 // TransportSocket.Validate if the designated constraints aren't met.
3691 type TransportSocketValidationError struct {
3692 field string
3693 reason string
3694 cause error
3695 key bool
3696 }
3697
3698 // Field function returns field value.
3699 func (e TransportSocketValidationError) Field() string { return e.field }
3700
3701 // Reason function returns reason value.
3702 func (e TransportSocketValidationError) Reason() string { return e.reason }
3703
3704 // Cause function returns cause value.
3705 func (e TransportSocketValidationError) Cause() error { return e.cause }
3706
3707 // Key function returns key value.
3708 func (e TransportSocketValidationError) Key() bool { return e.key }
3709
3710 // ErrorName returns error name.
3711 func (e TransportSocketValidationError) ErrorName() string { return "TransportSocketValidationError" }
3712
3713 // Error satisfies the builtin error interface
3714 func (e TransportSocketValidationError) Error() string {
3715 cause := ""
3716 if e.cause != nil {
3717 cause = fmt.Sprintf(" | caused by: %v", e.cause)
3718 }
3719
3720 key := ""
3721 if e.key {
3722 key = "key for "
3723 }
3724
3725 return fmt.Sprintf(
3726 "invalid %sTransportSocket.%s: %s%s",
3727 key,
3728 e.field,
3729 e.reason,
3730 cause)
3731 }
3732
3733 var _ error = TransportSocketValidationError{}
3734
3735 var _ interface {
3736 Field() string
3737 Reason() string
3738 Key() bool
3739 Cause() error
3740 ErrorName() string
3741 } = TransportSocketValidationError{}
3742
3743 // Validate checks the field values on RuntimeFractionalPercent with the rules
3744 // defined in the proto definition for this message. If any rules are
3745 // violated, the first error encountered is returned, or nil if there are no violations.
3746 func (m *RuntimeFractionalPercent) Validate() error {
3747 return m.validate(false)
3748 }
3749
3750 // ValidateAll checks the field values on RuntimeFractionalPercent with the
3751 // rules defined in the proto definition for this message. If any rules are
3752 // violated, the result is a list of violation errors wrapped in
3753 // RuntimeFractionalPercentMultiError, or nil if none found.
3754 func (m *RuntimeFractionalPercent) ValidateAll() error {
3755 return m.validate(true)
3756 }
3757
3758 func (m *RuntimeFractionalPercent) validate(all bool) error {
3759 if m == nil {
3760 return nil
3761 }
3762
3763 var errors []error
3764
3765 if m.GetDefaultValue() == nil {
3766 err := RuntimeFractionalPercentValidationError{
3767 field: "DefaultValue",
3768 reason: "value is required",
3769 }
3770 if !all {
3771 return err
3772 }
3773 errors = append(errors, err)
3774 }
3775
3776 if all {
3777 switch v := interface{}(m.GetDefaultValue()).(type) {
3778 case interface{ ValidateAll() error }:
3779 if err := v.ValidateAll(); err != nil {
3780 errors = append(errors, RuntimeFractionalPercentValidationError{
3781 field: "DefaultValue",
3782 reason: "embedded message failed validation",
3783 cause: err,
3784 })
3785 }
3786 case interface{ Validate() error }:
3787 if err := v.Validate(); err != nil {
3788 errors = append(errors, RuntimeFractionalPercentValidationError{
3789 field: "DefaultValue",
3790 reason: "embedded message failed validation",
3791 cause: err,
3792 })
3793 }
3794 }
3795 } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok {
3796 if err := v.Validate(); err != nil {
3797 return RuntimeFractionalPercentValidationError{
3798 field: "DefaultValue",
3799 reason: "embedded message failed validation",
3800 cause: err,
3801 }
3802 }
3803 }
3804
3805 // no validation rules for RuntimeKey
3806
3807 if len(errors) > 0 {
3808 return RuntimeFractionalPercentMultiError(errors)
3809 }
3810
3811 return nil
3812 }
3813
3814 // RuntimeFractionalPercentMultiError is an error wrapping multiple validation
3815 // errors returned by RuntimeFractionalPercent.ValidateAll() if the designated
3816 // constraints aren't met.
3817 type RuntimeFractionalPercentMultiError []error
3818
3819 // Error returns a concatenation of all the error messages it wraps.
3820 func (m RuntimeFractionalPercentMultiError) Error() string {
3821 var msgs []string
3822 for _, err := range m {
3823 msgs = append(msgs, err.Error())
3824 }
3825 return strings.Join(msgs, "; ")
3826 }
3827
3828 // AllErrors returns a list of validation violation errors.
3829 func (m RuntimeFractionalPercentMultiError) AllErrors() []error { return m }
3830
3831 // RuntimeFractionalPercentValidationError is the validation error returned by
3832 // RuntimeFractionalPercent.Validate if the designated constraints aren't met.
3833 type RuntimeFractionalPercentValidationError struct {
3834 field string
3835 reason string
3836 cause error
3837 key bool
3838 }
3839
3840 // Field function returns field value.
3841 func (e RuntimeFractionalPercentValidationError) Field() string { return e.field }
3842
3843 // Reason function returns reason value.
3844 func (e RuntimeFractionalPercentValidationError) Reason() string { return e.reason }
3845
3846 // Cause function returns cause value.
3847 func (e RuntimeFractionalPercentValidationError) Cause() error { return e.cause }
3848
3849 // Key function returns key value.
3850 func (e RuntimeFractionalPercentValidationError) Key() bool { return e.key }
3851
3852 // ErrorName returns error name.
3853 func (e RuntimeFractionalPercentValidationError) ErrorName() string {
3854 return "RuntimeFractionalPercentValidationError"
3855 }
3856
3857 // Error satisfies the builtin error interface
3858 func (e RuntimeFractionalPercentValidationError) Error() string {
3859 cause := ""
3860 if e.cause != nil {
3861 cause = fmt.Sprintf(" | caused by: %v", e.cause)
3862 }
3863
3864 key := ""
3865 if e.key {
3866 key = "key for "
3867 }
3868
3869 return fmt.Sprintf(
3870 "invalid %sRuntimeFractionalPercent.%s: %s%s",
3871 key,
3872 e.field,
3873 e.reason,
3874 cause)
3875 }
3876
3877 var _ error = RuntimeFractionalPercentValidationError{}
3878
3879 var _ interface {
3880 Field() string
3881 Reason() string
3882 Key() bool
3883 Cause() error
3884 ErrorName() string
3885 } = RuntimeFractionalPercentValidationError{}
3886
3887 // Validate checks the field values on ControlPlane with the rules defined in
3888 // the proto definition for this message. If any rules are violated, the first
3889 // error encountered is returned, or nil if there are no violations.
3890 func (m *ControlPlane) Validate() error {
3891 return m.validate(false)
3892 }
3893
3894 // ValidateAll checks the field values on ControlPlane with the rules defined
3895 // in the proto definition for this message. If any rules are violated, the
3896 // result is a list of violation errors wrapped in ControlPlaneMultiError, or
3897 // nil if none found.
3898 func (m *ControlPlane) ValidateAll() error {
3899 return m.validate(true)
3900 }
3901
3902 func (m *ControlPlane) validate(all bool) error {
3903 if m == nil {
3904 return nil
3905 }
3906
3907 var errors []error
3908
3909 // no validation rules for Identifier
3910
3911 if len(errors) > 0 {
3912 return ControlPlaneMultiError(errors)
3913 }
3914
3915 return nil
3916 }
3917
3918 // ControlPlaneMultiError is an error wrapping multiple validation errors
3919 // returned by ControlPlane.ValidateAll() if the designated constraints aren't met.
3920 type ControlPlaneMultiError []error
3921
3922 // Error returns a concatenation of all the error messages it wraps.
3923 func (m ControlPlaneMultiError) Error() string {
3924 var msgs []string
3925 for _, err := range m {
3926 msgs = append(msgs, err.Error())
3927 }
3928 return strings.Join(msgs, "; ")
3929 }
3930
3931 // AllErrors returns a list of validation violation errors.
3932 func (m ControlPlaneMultiError) AllErrors() []error { return m }
3933
3934 // ControlPlaneValidationError is the validation error returned by
3935 // ControlPlane.Validate if the designated constraints aren't met.
3936 type ControlPlaneValidationError struct {
3937 field string
3938 reason string
3939 cause error
3940 key bool
3941 }
3942
3943 // Field function returns field value.
3944 func (e ControlPlaneValidationError) Field() string { return e.field }
3945
3946 // Reason function returns reason value.
3947 func (e ControlPlaneValidationError) Reason() string { return e.reason }
3948
3949 // Cause function returns cause value.
3950 func (e ControlPlaneValidationError) Cause() error { return e.cause }
3951
3952 // Key function returns key value.
3953 func (e ControlPlaneValidationError) Key() bool { return e.key }
3954
3955 // ErrorName returns error name.
3956 func (e ControlPlaneValidationError) ErrorName() string { return "ControlPlaneValidationError" }
3957
3958 // Error satisfies the builtin error interface
3959 func (e ControlPlaneValidationError) Error() string {
3960 cause := ""
3961 if e.cause != nil {
3962 cause = fmt.Sprintf(" | caused by: %v", e.cause)
3963 }
3964
3965 key := ""
3966 if e.key {
3967 key = "key for "
3968 }
3969
3970 return fmt.Sprintf(
3971 "invalid %sControlPlane.%s: %s%s",
3972 key,
3973 e.field,
3974 e.reason,
3975 cause)
3976 }
3977
3978 var _ error = ControlPlaneValidationError{}
3979
3980 var _ interface {
3981 Field() string
3982 Reason() string
3983 Key() bool
3984 Cause() error
3985 ErrorName() string
3986 } = ControlPlaneValidationError{}
3987
3988 // Validate checks the field values on RetryPolicy_RetryPriority with the rules
3989 // defined in the proto definition for this message. If any rules are
3990 // violated, the first error encountered is returned, or nil if there are no violations.
3991 func (m *RetryPolicy_RetryPriority) Validate() error {
3992 return m.validate(false)
3993 }
3994
3995 // ValidateAll checks the field values on RetryPolicy_RetryPriority with the
3996 // rules defined in the proto definition for this message. If any rules are
3997 // violated, the result is a list of violation errors wrapped in
3998 // RetryPolicy_RetryPriorityMultiError, or nil if none found.
3999 func (m *RetryPolicy_RetryPriority) ValidateAll() error {
4000 return m.validate(true)
4001 }
4002
4003 func (m *RetryPolicy_RetryPriority) validate(all bool) error {
4004 if m == nil {
4005 return nil
4006 }
4007
4008 var errors []error
4009
4010 if utf8.RuneCountInString(m.GetName()) < 1 {
4011 err := RetryPolicy_RetryPriorityValidationError{
4012 field: "Name",
4013 reason: "value length must be at least 1 runes",
4014 }
4015 if !all {
4016 return err
4017 }
4018 errors = append(errors, err)
4019 }
4020
4021 switch v := m.ConfigType.(type) {
4022 case *RetryPolicy_RetryPriority_TypedConfig:
4023 if v == nil {
4024 err := RetryPolicy_RetryPriorityValidationError{
4025 field: "ConfigType",
4026 reason: "oneof value cannot be a typed-nil",
4027 }
4028 if !all {
4029 return err
4030 }
4031 errors = append(errors, err)
4032 }
4033
4034 if all {
4035 switch v := interface{}(m.GetTypedConfig()).(type) {
4036 case interface{ ValidateAll() error }:
4037 if err := v.ValidateAll(); err != nil {
4038 errors = append(errors, RetryPolicy_RetryPriorityValidationError{
4039 field: "TypedConfig",
4040 reason: "embedded message failed validation",
4041 cause: err,
4042 })
4043 }
4044 case interface{ Validate() error }:
4045 if err := v.Validate(); err != nil {
4046 errors = append(errors, RetryPolicy_RetryPriorityValidationError{
4047 field: "TypedConfig",
4048 reason: "embedded message failed validation",
4049 cause: err,
4050 })
4051 }
4052 }
4053 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
4054 if err := v.Validate(); err != nil {
4055 return RetryPolicy_RetryPriorityValidationError{
4056 field: "TypedConfig",
4057 reason: "embedded message failed validation",
4058 cause: err,
4059 }
4060 }
4061 }
4062
4063 default:
4064 _ = v // ensures v is used
4065 }
4066
4067 if len(errors) > 0 {
4068 return RetryPolicy_RetryPriorityMultiError(errors)
4069 }
4070
4071 return nil
4072 }
4073
4074 // RetryPolicy_RetryPriorityMultiError is an error wrapping multiple validation
4075 // errors returned by RetryPolicy_RetryPriority.ValidateAll() if the
4076 // designated constraints aren't met.
4077 type RetryPolicy_RetryPriorityMultiError []error
4078
4079 // Error returns a concatenation of all the error messages it wraps.
4080 func (m RetryPolicy_RetryPriorityMultiError) Error() string {
4081 var msgs []string
4082 for _, err := range m {
4083 msgs = append(msgs, err.Error())
4084 }
4085 return strings.Join(msgs, "; ")
4086 }
4087
4088 // AllErrors returns a list of validation violation errors.
4089 func (m RetryPolicy_RetryPriorityMultiError) AllErrors() []error { return m }
4090
4091 // RetryPolicy_RetryPriorityValidationError is the validation error returned by
4092 // RetryPolicy_RetryPriority.Validate if the designated constraints aren't met.
4093 type RetryPolicy_RetryPriorityValidationError struct {
4094 field string
4095 reason string
4096 cause error
4097 key bool
4098 }
4099
4100 // Field function returns field value.
4101 func (e RetryPolicy_RetryPriorityValidationError) Field() string { return e.field }
4102
4103 // Reason function returns reason value.
4104 func (e RetryPolicy_RetryPriorityValidationError) Reason() string { return e.reason }
4105
4106 // Cause function returns cause value.
4107 func (e RetryPolicy_RetryPriorityValidationError) Cause() error { return e.cause }
4108
4109 // Key function returns key value.
4110 func (e RetryPolicy_RetryPriorityValidationError) Key() bool { return e.key }
4111
4112 // ErrorName returns error name.
4113 func (e RetryPolicy_RetryPriorityValidationError) ErrorName() string {
4114 return "RetryPolicy_RetryPriorityValidationError"
4115 }
4116
4117 // Error satisfies the builtin error interface
4118 func (e RetryPolicy_RetryPriorityValidationError) Error() string {
4119 cause := ""
4120 if e.cause != nil {
4121 cause = fmt.Sprintf(" | caused by: %v", e.cause)
4122 }
4123
4124 key := ""
4125 if e.key {
4126 key = "key for "
4127 }
4128
4129 return fmt.Sprintf(
4130 "invalid %sRetryPolicy_RetryPriority.%s: %s%s",
4131 key,
4132 e.field,
4133 e.reason,
4134 cause)
4135 }
4136
4137 var _ error = RetryPolicy_RetryPriorityValidationError{}
4138
4139 var _ interface {
4140 Field() string
4141 Reason() string
4142 Key() bool
4143 Cause() error
4144 ErrorName() string
4145 } = RetryPolicy_RetryPriorityValidationError{}
4146
4147 // Validate checks the field values on RetryPolicy_RetryHostPredicate with the
4148 // rules defined in the proto definition for this message. If any rules are
4149 // violated, the first error encountered is returned, or nil if there are no violations.
4150 func (m *RetryPolicy_RetryHostPredicate) Validate() error {
4151 return m.validate(false)
4152 }
4153
4154 // ValidateAll checks the field values on RetryPolicy_RetryHostPredicate with
4155 // the rules defined in the proto definition for this message. If any rules
4156 // are violated, the result is a list of violation errors wrapped in
4157 // RetryPolicy_RetryHostPredicateMultiError, or nil if none found.
4158 func (m *RetryPolicy_RetryHostPredicate) ValidateAll() error {
4159 return m.validate(true)
4160 }
4161
4162 func (m *RetryPolicy_RetryHostPredicate) validate(all bool) error {
4163 if m == nil {
4164 return nil
4165 }
4166
4167 var errors []error
4168
4169 if utf8.RuneCountInString(m.GetName()) < 1 {
4170 err := RetryPolicy_RetryHostPredicateValidationError{
4171 field: "Name",
4172 reason: "value length must be at least 1 runes",
4173 }
4174 if !all {
4175 return err
4176 }
4177 errors = append(errors, err)
4178 }
4179
4180 switch v := m.ConfigType.(type) {
4181 case *RetryPolicy_RetryHostPredicate_TypedConfig:
4182 if v == nil {
4183 err := RetryPolicy_RetryHostPredicateValidationError{
4184 field: "ConfigType",
4185 reason: "oneof value cannot be a typed-nil",
4186 }
4187 if !all {
4188 return err
4189 }
4190 errors = append(errors, err)
4191 }
4192
4193 if all {
4194 switch v := interface{}(m.GetTypedConfig()).(type) {
4195 case interface{ ValidateAll() error }:
4196 if err := v.ValidateAll(); err != nil {
4197 errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{
4198 field: "TypedConfig",
4199 reason: "embedded message failed validation",
4200 cause: err,
4201 })
4202 }
4203 case interface{ Validate() error }:
4204 if err := v.Validate(); err != nil {
4205 errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{
4206 field: "TypedConfig",
4207 reason: "embedded message failed validation",
4208 cause: err,
4209 })
4210 }
4211 }
4212 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
4213 if err := v.Validate(); err != nil {
4214 return RetryPolicy_RetryHostPredicateValidationError{
4215 field: "TypedConfig",
4216 reason: "embedded message failed validation",
4217 cause: err,
4218 }
4219 }
4220 }
4221
4222 default:
4223 _ = v // ensures v is used
4224 }
4225
4226 if len(errors) > 0 {
4227 return RetryPolicy_RetryHostPredicateMultiError(errors)
4228 }
4229
4230 return nil
4231 }
4232
4233 // RetryPolicy_RetryHostPredicateMultiError is an error wrapping multiple
4234 // validation errors returned by RetryPolicy_RetryHostPredicate.ValidateAll()
4235 // if the designated constraints aren't met.
4236 type RetryPolicy_RetryHostPredicateMultiError []error
4237
4238 // Error returns a concatenation of all the error messages it wraps.
4239 func (m RetryPolicy_RetryHostPredicateMultiError) Error() string {
4240 var msgs []string
4241 for _, err := range m {
4242 msgs = append(msgs, err.Error())
4243 }
4244 return strings.Join(msgs, "; ")
4245 }
4246
4247 // AllErrors returns a list of validation violation errors.
4248 func (m RetryPolicy_RetryHostPredicateMultiError) AllErrors() []error { return m }
4249
4250 // RetryPolicy_RetryHostPredicateValidationError is the validation error
4251 // returned by RetryPolicy_RetryHostPredicate.Validate if the designated
4252 // constraints aren't met.
4253 type RetryPolicy_RetryHostPredicateValidationError struct {
4254 field string
4255 reason string
4256 cause error
4257 key bool
4258 }
4259
4260 // Field function returns field value.
4261 func (e RetryPolicy_RetryHostPredicateValidationError) Field() string { return e.field }
4262
4263 // Reason function returns reason value.
4264 func (e RetryPolicy_RetryHostPredicateValidationError) Reason() string { return e.reason }
4265
4266 // Cause function returns cause value.
4267 func (e RetryPolicy_RetryHostPredicateValidationError) Cause() error { return e.cause }
4268
4269 // Key function returns key value.
4270 func (e RetryPolicy_RetryHostPredicateValidationError) Key() bool { return e.key }
4271
4272 // ErrorName returns error name.
4273 func (e RetryPolicy_RetryHostPredicateValidationError) ErrorName() string {
4274 return "RetryPolicy_RetryHostPredicateValidationError"
4275 }
4276
4277 // Error satisfies the builtin error interface
4278 func (e RetryPolicy_RetryHostPredicateValidationError) Error() string {
4279 cause := ""
4280 if e.cause != nil {
4281 cause = fmt.Sprintf(" | caused by: %v", e.cause)
4282 }
4283
4284 key := ""
4285 if e.key {
4286 key = "key for "
4287 }
4288
4289 return fmt.Sprintf(
4290 "invalid %sRetryPolicy_RetryHostPredicate.%s: %s%s",
4291 key,
4292 e.field,
4293 e.reason,
4294 cause)
4295 }
4296
4297 var _ error = RetryPolicy_RetryHostPredicateValidationError{}
4298
4299 var _ interface {
4300 Field() string
4301 Reason() string
4302 Key() bool
4303 Cause() error
4304 ErrorName() string
4305 } = RetryPolicy_RetryHostPredicateValidationError{}