Debian Codegraph @

envoy/config/endpoint/v3/load_report.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/config/endpoint/v3/load_report.proto
4
5 package endpointv3
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 UpstreamLocalityStats with the rules
40 // defined in the proto definition for this message. If any rules are
41 // violated, the first error encountered is returned, or nil if there are no violations.
42 func (m *UpstreamLocalityStats) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on UpstreamLocalityStats with the rules
47 // defined in the proto definition for this message. If any rules are
48 // violated, the result is a list of violation errors wrapped in
49 // UpstreamLocalityStatsMultiError, or nil if none found.
50 func (m *UpstreamLocalityStats) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *UpstreamLocalityStats) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 if all {
62 switch v := interface{}(m.GetLocality()).(type) {
63 case interface{ ValidateAll() error }:
64 if err := v.ValidateAll(); err != nil {
65 errors = append(errors, UpstreamLocalityStatsValidationError{
66 field: "Locality",
67 reason: "embedded message failed validation",
68 cause: err,
69 })
70 }
71 case interface{ Validate() error }:
72 if err := v.Validate(); err != nil {
73 errors = append(errors, UpstreamLocalityStatsValidationError{
74 field: "Locality",
75 reason: "embedded message failed validation",
76 cause: err,
77 })
78 }
79 }
80 } else if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok {
81 if err := v.Validate(); err != nil {
82 return UpstreamLocalityStatsValidationError{
83 field: "Locality",
84 reason: "embedded message failed validation",
85 cause: err,
86 }
87 }
88 }
89
90 // no validation rules for TotalSuccessfulRequests
91
92 // no validation rules for TotalRequestsInProgress
93
94 // no validation rules for TotalErrorRequests
95
96 // no validation rules for TotalIssuedRequests
97
98 // no validation rules for TotalActiveConnections
99
100 // no validation rules for TotalNewConnections
101
102 // no validation rules for TotalFailConnections
103
104 if all {
105 switch v := interface{}(m.GetCpuUtilization()).(type) {
106 case interface{ ValidateAll() error }:
107 if err := v.ValidateAll(); err != nil {
108 errors = append(errors, UpstreamLocalityStatsValidationError{
109 field: "CpuUtilization",
110 reason: "embedded message failed validation",
111 cause: err,
112 })
113 }
114 case interface{ Validate() error }:
115 if err := v.Validate(); err != nil {
116 errors = append(errors, UpstreamLocalityStatsValidationError{
117 field: "CpuUtilization",
118 reason: "embedded message failed validation",
119 cause: err,
120 })
121 }
122 }
123 } else if v, ok := interface{}(m.GetCpuUtilization()).(interface{ Validate() error }); ok {
124 if err := v.Validate(); err != nil {
125 return UpstreamLocalityStatsValidationError{
126 field: "CpuUtilization",
127 reason: "embedded message failed validation",
128 cause: err,
129 }
130 }
131 }
132
133 if all {
134 switch v := interface{}(m.GetMemUtilization()).(type) {
135 case interface{ ValidateAll() error }:
136 if err := v.ValidateAll(); err != nil {
137 errors = append(errors, UpstreamLocalityStatsValidationError{
138 field: "MemUtilization",
139 reason: "embedded message failed validation",
140 cause: err,
141 })
142 }
143 case interface{ Validate() error }:
144 if err := v.Validate(); err != nil {
145 errors = append(errors, UpstreamLocalityStatsValidationError{
146 field: "MemUtilization",
147 reason: "embedded message failed validation",
148 cause: err,
149 })
150 }
151 }
152 } else if v, ok := interface{}(m.GetMemUtilization()).(interface{ Validate() error }); ok {
153 if err := v.Validate(); err != nil {
154 return UpstreamLocalityStatsValidationError{
155 field: "MemUtilization",
156 reason: "embedded message failed validation",
157 cause: err,
158 }
159 }
160 }
161
162 if all {
163 switch v := interface{}(m.GetApplicationUtilization()).(type) {
164 case interface{ ValidateAll() error }:
165 if err := v.ValidateAll(); err != nil {
166 errors = append(errors, UpstreamLocalityStatsValidationError{
167 field: "ApplicationUtilization",
168 reason: "embedded message failed validation",
169 cause: err,
170 })
171 }
172 case interface{ Validate() error }:
173 if err := v.Validate(); err != nil {
174 errors = append(errors, UpstreamLocalityStatsValidationError{
175 field: "ApplicationUtilization",
176 reason: "embedded message failed validation",
177 cause: err,
178 })
179 }
180 }
181 } else if v, ok := interface{}(m.GetApplicationUtilization()).(interface{ Validate() error }); ok {
182 if err := v.Validate(); err != nil {
183 return UpstreamLocalityStatsValidationError{
184 field: "ApplicationUtilization",
185 reason: "embedded message failed validation",
186 cause: err,
187 }
188 }
189 }
190
191 for idx, item := range m.GetLoadMetricStats() {
192 _, _ = idx, item
193
194 if all {
195 switch v := interface{}(item).(type) {
196 case interface{ ValidateAll() error }:
197 if err := v.ValidateAll(); err != nil {
198 errors = append(errors, UpstreamLocalityStatsValidationError{
199 field: fmt.Sprintf("LoadMetricStats[%v]", idx),
200 reason: "embedded message failed validation",
201 cause: err,
202 })
203 }
204 case interface{ Validate() error }:
205 if err := v.Validate(); err != nil {
206 errors = append(errors, UpstreamLocalityStatsValidationError{
207 field: fmt.Sprintf("LoadMetricStats[%v]", idx),
208 reason: "embedded message failed validation",
209 cause: err,
210 })
211 }
212 }
213 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
214 if err := v.Validate(); err != nil {
215 return UpstreamLocalityStatsValidationError{
216 field: fmt.Sprintf("LoadMetricStats[%v]", idx),
217 reason: "embedded message failed validation",
218 cause: err,
219 }
220 }
221 }
222
223 }
224
225 for idx, item := range m.GetUpstreamEndpointStats() {
226 _, _ = idx, item
227
228 if all {
229 switch v := interface{}(item).(type) {
230 case interface{ ValidateAll() error }:
231 if err := v.ValidateAll(); err != nil {
232 errors = append(errors, UpstreamLocalityStatsValidationError{
233 field: fmt.Sprintf("UpstreamEndpointStats[%v]", idx),
234 reason: "embedded message failed validation",
235 cause: err,
236 })
237 }
238 case interface{ Validate() error }:
239 if err := v.Validate(); err != nil {
240 errors = append(errors, UpstreamLocalityStatsValidationError{
241 field: fmt.Sprintf("UpstreamEndpointStats[%v]", idx),
242 reason: "embedded message failed validation",
243 cause: err,
244 })
245 }
246 }
247 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
248 if err := v.Validate(); err != nil {
249 return UpstreamLocalityStatsValidationError{
250 field: fmt.Sprintf("UpstreamEndpointStats[%v]", idx),
251 reason: "embedded message failed validation",
252 cause: err,
253 }
254 }
255 }
256
257 }
258
259 // no validation rules for Priority
260
261 if len(errors) > 0 {
262 return UpstreamLocalityStatsMultiError(errors)
263 }
264
265 return nil
266 }
267
268 // UpstreamLocalityStatsMultiError is an error wrapping multiple validation
269 // errors returned by UpstreamLocalityStats.ValidateAll() if the designated
270 // constraints aren't met.
271 type UpstreamLocalityStatsMultiError []error
272
273 // Error returns a concatenation of all the error messages it wraps.
274 func (m UpstreamLocalityStatsMultiError) Error() string {
275 var msgs []string
276 for _, err := range m {
277 msgs = append(msgs, err.Error())
278 }
279 return strings.Join(msgs, "; ")
280 }
281
282 // AllErrors returns a list of validation violation errors.
283 func (m UpstreamLocalityStatsMultiError) AllErrors() []error { return m }
284
285 // UpstreamLocalityStatsValidationError is the validation error returned by
286 // UpstreamLocalityStats.Validate if the designated constraints aren't met.
287 type UpstreamLocalityStatsValidationError struct {
288 field string
289 reason string
290 cause error
291 key bool
292 }
293
294 // Field function returns field value.
295 func (e UpstreamLocalityStatsValidationError) Field() string { return e.field }
296
297 // Reason function returns reason value.
298 func (e UpstreamLocalityStatsValidationError) Reason() string { return e.reason }
299
300 // Cause function returns cause value.
301 func (e UpstreamLocalityStatsValidationError) Cause() error { return e.cause }
302
303 // Key function returns key value.
304 func (e UpstreamLocalityStatsValidationError) Key() bool { return e.key }
305
306 // ErrorName returns error name.
307 func (e UpstreamLocalityStatsValidationError) ErrorName() string {
308 return "UpstreamLocalityStatsValidationError"
309 }
310
311 // Error satisfies the builtin error interface
312 func (e UpstreamLocalityStatsValidationError) Error() string {
313 cause := ""
314 if e.cause != nil {
315 cause = fmt.Sprintf(" | caused by: %v", e.cause)
316 }
317
318 key := ""
319 if e.key {
320 key = "key for "
321 }
322
323 return fmt.Sprintf(
324 "invalid %sUpstreamLocalityStats.%s: %s%s",
325 key,
326 e.field,
327 e.reason,
328 cause)
329 }
330
331 var _ error = UpstreamLocalityStatsValidationError{}
332
333 var _ interface {
334 Field() string
335 Reason() string
336 Key() bool
337 Cause() error
338 ErrorName() string
339 } = UpstreamLocalityStatsValidationError{}
340
341 // Validate checks the field values on UpstreamEndpointStats with the rules
342 // defined in the proto definition for this message. If any rules are
343 // violated, the first error encountered is returned, or nil if there are no violations.
344 func (m *UpstreamEndpointStats) Validate() error {
345 return m.validate(false)
346 }
347
348 // ValidateAll checks the field values on UpstreamEndpointStats with the rules
349 // defined in the proto definition for this message. If any rules are
350 // violated, the result is a list of violation errors wrapped in
351 // UpstreamEndpointStatsMultiError, or nil if none found.
352 func (m *UpstreamEndpointStats) ValidateAll() error {
353 return m.validate(true)
354 }
355
356 func (m *UpstreamEndpointStats) validate(all bool) error {
357 if m == nil {
358 return nil
359 }
360
361 var errors []error
362
363 if all {
364 switch v := interface{}(m.GetAddress()).(type) {
365 case interface{ ValidateAll() error }:
366 if err := v.ValidateAll(); err != nil {
367 errors = append(errors, UpstreamEndpointStatsValidationError{
368 field: "Address",
369 reason: "embedded message failed validation",
370 cause: err,
371 })
372 }
373 case interface{ Validate() error }:
374 if err := v.Validate(); err != nil {
375 errors = append(errors, UpstreamEndpointStatsValidationError{
376 field: "Address",
377 reason: "embedded message failed validation",
378 cause: err,
379 })
380 }
381 }
382 } else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
383 if err := v.Validate(); err != nil {
384 return UpstreamEndpointStatsValidationError{
385 field: "Address",
386 reason: "embedded message failed validation",
387 cause: err,
388 }
389 }
390 }
391
392 if all {
393 switch v := interface{}(m.GetMetadata()).(type) {
394 case interface{ ValidateAll() error }:
395 if err := v.ValidateAll(); err != nil {
396 errors = append(errors, UpstreamEndpointStatsValidationError{
397 field: "Metadata",
398 reason: "embedded message failed validation",
399 cause: err,
400 })
401 }
402 case interface{ Validate() error }:
403 if err := v.Validate(); err != nil {
404 errors = append(errors, UpstreamEndpointStatsValidationError{
405 field: "Metadata",
406 reason: "embedded message failed validation",
407 cause: err,
408 })
409 }
410 }
411 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
412 if err := v.Validate(); err != nil {
413 return UpstreamEndpointStatsValidationError{
414 field: "Metadata",
415 reason: "embedded message failed validation",
416 cause: err,
417 }
418 }
419 }
420
421 // no validation rules for TotalSuccessfulRequests
422
423 // no validation rules for TotalRequestsInProgress
424
425 // no validation rules for TotalErrorRequests
426
427 // no validation rules for TotalIssuedRequests
428
429 for idx, item := range m.GetLoadMetricStats() {
430 _, _ = idx, item
431
432 if all {
433 switch v := interface{}(item).(type) {
434 case interface{ ValidateAll() error }:
435 if err := v.ValidateAll(); err != nil {
436 errors = append(errors, UpstreamEndpointStatsValidationError{
437 field: fmt.Sprintf("LoadMetricStats[%v]", idx),
438 reason: "embedded message failed validation",
439 cause: err,
440 })
441 }
442 case interface{ Validate() error }:
443 if err := v.Validate(); err != nil {
444 errors = append(errors, UpstreamEndpointStatsValidationError{
445 field: fmt.Sprintf("LoadMetricStats[%v]", idx),
446 reason: "embedded message failed validation",
447 cause: err,
448 })
449 }
450 }
451 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
452 if err := v.Validate(); err != nil {
453 return UpstreamEndpointStatsValidationError{
454 field: fmt.Sprintf("LoadMetricStats[%v]", idx),
455 reason: "embedded message failed validation",
456 cause: err,
457 }
458 }
459 }
460
461 }
462
463 if len(errors) > 0 {
464 return UpstreamEndpointStatsMultiError(errors)
465 }
466
467 return nil
468 }
469
470 // UpstreamEndpointStatsMultiError is an error wrapping multiple validation
471 // errors returned by UpstreamEndpointStats.ValidateAll() if the designated
472 // constraints aren't met.
473 type UpstreamEndpointStatsMultiError []error
474
475 // Error returns a concatenation of all the error messages it wraps.
476 func (m UpstreamEndpointStatsMultiError) Error() string {
477 var msgs []string
478 for _, err := range m {
479 msgs = append(msgs, err.Error())
480 }
481 return strings.Join(msgs, "; ")
482 }
483
484 // AllErrors returns a list of validation violation errors.
485 func (m UpstreamEndpointStatsMultiError) AllErrors() []error { return m }
486
487 // UpstreamEndpointStatsValidationError is the validation error returned by
488 // UpstreamEndpointStats.Validate if the designated constraints aren't met.
489 type UpstreamEndpointStatsValidationError struct {
490 field string
491 reason string
492 cause error
493 key bool
494 }
495
496 // Field function returns field value.
497 func (e UpstreamEndpointStatsValidationError) Field() string { return e.field }
498
499 // Reason function returns reason value.
500 func (e UpstreamEndpointStatsValidationError) Reason() string { return e.reason }
501
502 // Cause function returns cause value.
503 func (e UpstreamEndpointStatsValidationError) Cause() error { return e.cause }
504
505 // Key function returns key value.
506 func (e UpstreamEndpointStatsValidationError) Key() bool { return e.key }
507
508 // ErrorName returns error name.
509 func (e UpstreamEndpointStatsValidationError) ErrorName() string {
510 return "UpstreamEndpointStatsValidationError"
511 }
512
513 // Error satisfies the builtin error interface
514 func (e UpstreamEndpointStatsValidationError) Error() string {
515 cause := ""
516 if e.cause != nil {
517 cause = fmt.Sprintf(" | caused by: %v", e.cause)
518 }
519
520 key := ""
521 if e.key {
522 key = "key for "
523 }
524
525 return fmt.Sprintf(
526 "invalid %sUpstreamEndpointStats.%s: %s%s",
527 key,
528 e.field,
529 e.reason,
530 cause)
531 }
532
533 var _ error = UpstreamEndpointStatsValidationError{}
534
535 var _ interface {
536 Field() string
537 Reason() string
538 Key() bool
539 Cause() error
540 ErrorName() string
541 } = UpstreamEndpointStatsValidationError{}
542
543 // Validate checks the field values on EndpointLoadMetricStats with the rules
544 // defined in the proto definition for this message. If any rules are
545 // violated, the first error encountered is returned, or nil if there are no violations.
546 func (m *EndpointLoadMetricStats) Validate() error {
547 return m.validate(false)
548 }
549
550 // ValidateAll checks the field values on EndpointLoadMetricStats with the
551 // rules defined in the proto definition for this message. If any rules are
552 // violated, the result is a list of violation errors wrapped in
553 // EndpointLoadMetricStatsMultiError, or nil if none found.
554 func (m *EndpointLoadMetricStats) ValidateAll() error {
555 return m.validate(true)
556 }
557
558 func (m *EndpointLoadMetricStats) validate(all bool) error {
559 if m == nil {
560 return nil
561 }
562
563 var errors []error
564
565 // no validation rules for MetricName
566
567 // no validation rules for NumRequestsFinishedWithMetric
568
569 // no validation rules for TotalMetricValue
570
571 if len(errors) > 0 {
572 return EndpointLoadMetricStatsMultiError(errors)
573 }
574
575 return nil
576 }
577
578 // EndpointLoadMetricStatsMultiError is an error wrapping multiple validation
579 // errors returned by EndpointLoadMetricStats.ValidateAll() if the designated
580 // constraints aren't met.
581 type EndpointLoadMetricStatsMultiError []error
582
583 // Error returns a concatenation of all the error messages it wraps.
584 func (m EndpointLoadMetricStatsMultiError) Error() string {
585 var msgs []string
586 for _, err := range m {
587 msgs = append(msgs, err.Error())
588 }
589 return strings.Join(msgs, "; ")
590 }
591
592 // AllErrors returns a list of validation violation errors.
593 func (m EndpointLoadMetricStatsMultiError) AllErrors() []error { return m }
594
595 // EndpointLoadMetricStatsValidationError is the validation error returned by
596 // EndpointLoadMetricStats.Validate if the designated constraints aren't met.
597 type EndpointLoadMetricStatsValidationError struct {
598 field string
599 reason string
600 cause error
601 key bool
602 }
603
604 // Field function returns field value.
605 func (e EndpointLoadMetricStatsValidationError) Field() string { return e.field }
606
607 // Reason function returns reason value.
608 func (e EndpointLoadMetricStatsValidationError) Reason() string { return e.reason }
609
610 // Cause function returns cause value.
611 func (e EndpointLoadMetricStatsValidationError) Cause() error { return e.cause }
612
613 // Key function returns key value.
614 func (e EndpointLoadMetricStatsValidationError) Key() bool { return e.key }
615
616 // ErrorName returns error name.
617 func (e EndpointLoadMetricStatsValidationError) ErrorName() string {
618 return "EndpointLoadMetricStatsValidationError"
619 }
620
621 // Error satisfies the builtin error interface
622 func (e EndpointLoadMetricStatsValidationError) Error() string {
623 cause := ""
624 if e.cause != nil {
625 cause = fmt.Sprintf(" | caused by: %v", e.cause)
626 }
627
628 key := ""
629 if e.key {
630 key = "key for "
631 }
632
633 return fmt.Sprintf(
634 "invalid %sEndpointLoadMetricStats.%s: %s%s",
635 key,
636 e.field,
637 e.reason,
638 cause)
639 }
640
641 var _ error = EndpointLoadMetricStatsValidationError{}
642
643 var _ interface {
644 Field() string
645 Reason() string
646 Key() bool
647 Cause() error
648 ErrorName() string
649 } = EndpointLoadMetricStatsValidationError{}
650
651 // Validate checks the field values on UnnamedEndpointLoadMetricStats with the
652 // rules defined in the proto definition for this message. If any rules are
653 // violated, the first error encountered is returned, or nil if there are no violations.
654 func (m *UnnamedEndpointLoadMetricStats) Validate() error {
655 return m.validate(false)
656 }
657
658 // ValidateAll checks the field values on UnnamedEndpointLoadMetricStats with
659 // the rules defined in the proto definition for this message. If any rules
660 // are violated, the result is a list of violation errors wrapped in
661 // UnnamedEndpointLoadMetricStatsMultiError, or nil if none found.
662 func (m *UnnamedEndpointLoadMetricStats) ValidateAll() error {
663 return m.validate(true)
664 }
665
666 func (m *UnnamedEndpointLoadMetricStats) validate(all bool) error {
667 if m == nil {
668 return nil
669 }
670
671 var errors []error
672
673 // no validation rules for NumRequestsFinishedWithMetric
674
675 // no validation rules for TotalMetricValue
676
677 if len(errors) > 0 {
678 return UnnamedEndpointLoadMetricStatsMultiError(errors)
679 }
680
681 return nil
682 }
683
684 // UnnamedEndpointLoadMetricStatsMultiError is an error wrapping multiple
685 // validation errors returned by UnnamedEndpointLoadMetricStats.ValidateAll()
686 // if the designated constraints aren't met.
687 type UnnamedEndpointLoadMetricStatsMultiError []error
688
689 // Error returns a concatenation of all the error messages it wraps.
690 func (m UnnamedEndpointLoadMetricStatsMultiError) Error() string {
691 var msgs []string
692 for _, err := range m {
693 msgs = append(msgs, err.Error())
694 }
695 return strings.Join(msgs, "; ")
696 }
697
698 // AllErrors returns a list of validation violation errors.
699 func (m UnnamedEndpointLoadMetricStatsMultiError) AllErrors() []error { return m }
700
701 // UnnamedEndpointLoadMetricStatsValidationError is the validation error
702 // returned by UnnamedEndpointLoadMetricStats.Validate if the designated
703 // constraints aren't met.
704 type UnnamedEndpointLoadMetricStatsValidationError struct {
705 field string
706 reason string
707 cause error
708 key bool
709 }
710
711 // Field function returns field value.
712 func (e UnnamedEndpointLoadMetricStatsValidationError) Field() string { return e.field }
713
714 // Reason function returns reason value.
715 func (e UnnamedEndpointLoadMetricStatsValidationError) Reason() string { return e.reason }
716
717 // Cause function returns cause value.
718 func (e UnnamedEndpointLoadMetricStatsValidationError) Cause() error { return e.cause }
719
720 // Key function returns key value.
721 func (e UnnamedEndpointLoadMetricStatsValidationError) Key() bool { return e.key }
722
723 // ErrorName returns error name.
724 func (e UnnamedEndpointLoadMetricStatsValidationError) ErrorName() string {
725 return "UnnamedEndpointLoadMetricStatsValidationError"
726 }
727
728 // Error satisfies the builtin error interface
729 func (e UnnamedEndpointLoadMetricStatsValidationError) Error() string {
730 cause := ""
731 if e.cause != nil {
732 cause = fmt.Sprintf(" | caused by: %v", e.cause)
733 }
734
735 key := ""
736 if e.key {
737 key = "key for "
738 }
739
740 return fmt.Sprintf(
741 "invalid %sUnnamedEndpointLoadMetricStats.%s: %s%s",
742 key,
743 e.field,
744 e.reason,
745 cause)
746 }
747
748 var _ error = UnnamedEndpointLoadMetricStatsValidationError{}
749
750 var _ interface {
751 Field() string
752 Reason() string
753 Key() bool
754 Cause() error
755 ErrorName() string
756 } = UnnamedEndpointLoadMetricStatsValidationError{}
757
758 // Validate checks the field values on ClusterStats with the rules defined in
759 // the proto definition for this message. If any rules are violated, the first
760 // error encountered is returned, or nil if there are no violations.
761 func (m *ClusterStats) Validate() error {
762 return m.validate(false)
763 }
764
765 // ValidateAll checks the field values on ClusterStats with the rules defined
766 // in the proto definition for this message. If any rules are violated, the
767 // result is a list of violation errors wrapped in ClusterStatsMultiError, or
768 // nil if none found.
769 func (m *ClusterStats) ValidateAll() error {
770 return m.validate(true)
771 }
772
773 func (m *ClusterStats) validate(all bool) error {
774 if m == nil {
775 return nil
776 }
777
778 var errors []error
779
780 if utf8.RuneCountInString(m.GetClusterName()) < 1 {
781 err := ClusterStatsValidationError{
782 field: "ClusterName",
783 reason: "value length must be at least 1 runes",
784 }
785 if !all {
786 return err
787 }
788 errors = append(errors, err)
789 }
790
791 // no validation rules for ClusterServiceName
792
793 if len(m.GetUpstreamLocalityStats()) < 1 {
794 err := ClusterStatsValidationError{
795 field: "UpstreamLocalityStats",
796 reason: "value must contain at least 1 item(s)",
797 }
798 if !all {
799 return err
800 }
801 errors = append(errors, err)
802 }
803
804 for idx, item := range m.GetUpstreamLocalityStats() {
805 _, _ = idx, item
806
807 if all {
808 switch v := interface{}(item).(type) {
809 case interface{ ValidateAll() error }:
810 if err := v.ValidateAll(); err != nil {
811 errors = append(errors, ClusterStatsValidationError{
812 field: fmt.Sprintf("UpstreamLocalityStats[%v]", idx),
813 reason: "embedded message failed validation",
814 cause: err,
815 })
816 }
817 case interface{ Validate() error }:
818 if err := v.Validate(); err != nil {
819 errors = append(errors, ClusterStatsValidationError{
820 field: fmt.Sprintf("UpstreamLocalityStats[%v]", idx),
821 reason: "embedded message failed validation",
822 cause: err,
823 })
824 }
825 }
826 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
827 if err := v.Validate(); err != nil {
828 return ClusterStatsValidationError{
829 field: fmt.Sprintf("UpstreamLocalityStats[%v]", idx),
830 reason: "embedded message failed validation",
831 cause: err,
832 }
833 }
834 }
835
836 }
837
838 // no validation rules for TotalDroppedRequests
839
840 for idx, item := range m.GetDroppedRequests() {
841 _, _ = idx, item
842
843 if all {
844 switch v := interface{}(item).(type) {
845 case interface{ ValidateAll() error }:
846 if err := v.ValidateAll(); err != nil {
847 errors = append(errors, ClusterStatsValidationError{
848 field: fmt.Sprintf("DroppedRequests[%v]", idx),
849 reason: "embedded message failed validation",
850 cause: err,
851 })
852 }
853 case interface{ Validate() error }:
854 if err := v.Validate(); err != nil {
855 errors = append(errors, ClusterStatsValidationError{
856 field: fmt.Sprintf("DroppedRequests[%v]", idx),
857 reason: "embedded message failed validation",
858 cause: err,
859 })
860 }
861 }
862 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
863 if err := v.Validate(); err != nil {
864 return ClusterStatsValidationError{
865 field: fmt.Sprintf("DroppedRequests[%v]", idx),
866 reason: "embedded message failed validation",
867 cause: err,
868 }
869 }
870 }
871
872 }
873
874 if all {
875 switch v := interface{}(m.GetLoadReportInterval()).(type) {
876 case interface{ ValidateAll() error }:
877 if err := v.ValidateAll(); err != nil {
878 errors = append(errors, ClusterStatsValidationError{
879 field: "LoadReportInterval",
880 reason: "embedded message failed validation",
881 cause: err,
882 })
883 }
884 case interface{ Validate() error }:
885 if err := v.Validate(); err != nil {
886 errors = append(errors, ClusterStatsValidationError{
887 field: "LoadReportInterval",
888 reason: "embedded message failed validation",
889 cause: err,
890 })
891 }
892 }
893 } else if v, ok := interface{}(m.GetLoadReportInterval()).(interface{ Validate() error }); ok {
894 if err := v.Validate(); err != nil {
895 return ClusterStatsValidationError{
896 field: "LoadReportInterval",
897 reason: "embedded message failed validation",
898 cause: err,
899 }
900 }
901 }
902
903 if len(errors) > 0 {
904 return ClusterStatsMultiError(errors)
905 }
906
907 return nil
908 }
909
910 // ClusterStatsMultiError is an error wrapping multiple validation errors
911 // returned by ClusterStats.ValidateAll() if the designated constraints aren't met.
912 type ClusterStatsMultiError []error
913
914 // Error returns a concatenation of all the error messages it wraps.
915 func (m ClusterStatsMultiError) 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 ClusterStatsMultiError) AllErrors() []error { return m }
925
926 // ClusterStatsValidationError is the validation error returned by
927 // ClusterStats.Validate if the designated constraints aren't met.
928 type ClusterStatsValidationError struct {
929 field string
930 reason string
931 cause error
932 key bool
933 }
934
935 // Field function returns field value.
936 func (e ClusterStatsValidationError) Field() string { return e.field }
937
938 // Reason function returns reason value.
939 func (e ClusterStatsValidationError) Reason() string { return e.reason }
940
941 // Cause function returns cause value.
942 func (e ClusterStatsValidationError) Cause() error { return e.cause }
943
944 // Key function returns key value.
945 func (e ClusterStatsValidationError) Key() bool { return e.key }
946
947 // ErrorName returns error name.
948 func (e ClusterStatsValidationError) ErrorName() string { return "ClusterStatsValidationError" }
949
950 // Error satisfies the builtin error interface
951 func (e ClusterStatsValidationError) 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 %sClusterStats.%s: %s%s",
964 key,
965 e.field,
966 e.reason,
967 cause)
968 }
969
970 var _ error = ClusterStatsValidationError{}
971
972 var _ interface {
973 Field() string
974 Reason() string
975 Key() bool
976 Cause() error
977 ErrorName() string
978 } = ClusterStatsValidationError{}
979
980 // Validate checks the field values on ClusterStats_DroppedRequests with the
981 // rules defined in the proto definition for this message. If any rules are
982 // violated, the first error encountered is returned, or nil if there are no violations.
983 func (m *ClusterStats_DroppedRequests) Validate() error {
984 return m.validate(false)
985 }
986
987 // ValidateAll checks the field values on ClusterStats_DroppedRequests with the
988 // rules defined in the proto definition for this message. If any rules are
989 // violated, the result is a list of violation errors wrapped in
990 // ClusterStats_DroppedRequestsMultiError, or nil if none found.
991 func (m *ClusterStats_DroppedRequests) ValidateAll() error {
992 return m.validate(true)
993 }
994
995 func (m *ClusterStats_DroppedRequests) validate(all bool) error {
996 if m == nil {
997 return nil
998 }
999
1000 var errors []error
1001
1002 if utf8.RuneCountInString(m.GetCategory()) < 1 {
1003 err := ClusterStats_DroppedRequestsValidationError{
1004 field: "Category",
1005 reason: "value length must be at least 1 runes",
1006 }
1007 if !all {
1008 return err
1009 }
1010 errors = append(errors, err)
1011 }
1012
1013 // no validation rules for DroppedCount
1014
1015 if len(errors) > 0 {
1016 return ClusterStats_DroppedRequestsMultiError(errors)
1017 }
1018
1019 return nil
1020 }
1021
1022 // ClusterStats_DroppedRequestsMultiError is an error wrapping multiple
1023 // validation errors returned by ClusterStats_DroppedRequests.ValidateAll() if
1024 // the designated constraints aren't met.
1025 type ClusterStats_DroppedRequestsMultiError []error
1026
1027 // Error returns a concatenation of all the error messages it wraps.
1028 func (m ClusterStats_DroppedRequestsMultiError) 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 ClusterStats_DroppedRequestsMultiError) AllErrors() []error { return m }
1038
1039 // ClusterStats_DroppedRequestsValidationError is the validation error returned
1040 // by ClusterStats_DroppedRequests.Validate if the designated constraints
1041 // aren't met.
1042 type ClusterStats_DroppedRequestsValidationError struct {
1043 field string
1044 reason string
1045 cause error
1046 key bool
1047 }
1048
1049 // Field function returns field value.
1050 func (e ClusterStats_DroppedRequestsValidationError) Field() string { return e.field }
1051
1052 // Reason function returns reason value.
1053 func (e ClusterStats_DroppedRequestsValidationError) Reason() string { return e.reason }
1054
1055 // Cause function returns cause value.
1056 func (e ClusterStats_DroppedRequestsValidationError) Cause() error { return e.cause }
1057
1058 // Key function returns key value.
1059 func (e ClusterStats_DroppedRequestsValidationError) Key() bool { return e.key }
1060
1061 // ErrorName returns error name.
1062 func (e ClusterStats_DroppedRequestsValidationError) ErrorName() string {
1063 return "ClusterStats_DroppedRequestsValidationError"
1064 }
1065
1066 // Error satisfies the builtin error interface
1067 func (e ClusterStats_DroppedRequestsValidationError) Error() string {
1068 cause := ""
1069 if e.cause != nil {
1070 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1071 }
1072
1073 key := ""
1074 if e.key {
1075 key = "key for "
1076 }
1077
1078 return fmt.Sprintf(
1079 "invalid %sClusterStats_DroppedRequests.%s: %s%s",
1080 key,
1081 e.field,
1082 e.reason,
1083 cause)
1084 }
1085
1086 var _ error = ClusterStats_DroppedRequestsValidationError{}
1087
1088 var _ interface {
1089 Field() string
1090 Reason() string
1091 Key() bool
1092 Cause() error
1093 ErrorName() string
1094 } = ClusterStats_DroppedRequestsValidationError{}