Debian Codegraph @

envoy/service/health/v3/hds.pb.validate.go

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