Debian Codegraph @

envoy/config/overload/v3/overload.pb.validate.go

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