Debian Codegraph @

envoy/service/ratelimit/v3/rls.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/service/ratelimit/v3/rls.proto
4
5 package ratelimitv3
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 RateLimitRequest 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 *RateLimitRequest) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on RateLimitRequest 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 // RateLimitRequestMultiError, or nil if none found.
50 func (m *RateLimitRequest) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *RateLimitRequest) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 // no validation rules for Domain
62
63 for idx, item := range m.GetDescriptors() {
64 _, _ = idx, item
65
66 if all {
67 switch v := interface{}(item).(type) {
68 case interface{ ValidateAll() error }:
69 if err := v.ValidateAll(); err != nil {
70 errors = append(errors, RateLimitRequestValidationError{
71 field: fmt.Sprintf("Descriptors[%v]", idx),
72 reason: "embedded message failed validation",
73 cause: err,
74 })
75 }
76 case interface{ Validate() error }:
77 if err := v.Validate(); err != nil {
78 errors = append(errors, RateLimitRequestValidationError{
79 field: fmt.Sprintf("Descriptors[%v]", idx),
80 reason: "embedded message failed validation",
81 cause: err,
82 })
83 }
84 }
85 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
86 if err := v.Validate(); err != nil {
87 return RateLimitRequestValidationError{
88 field: fmt.Sprintf("Descriptors[%v]", idx),
89 reason: "embedded message failed validation",
90 cause: err,
91 }
92 }
93 }
94
95 }
96
97 // no validation rules for HitsAddend
98
99 if len(errors) > 0 {
100 return RateLimitRequestMultiError(errors)
101 }
102
103 return nil
104 }
105
106 // RateLimitRequestMultiError is an error wrapping multiple validation errors
107 // returned by RateLimitRequest.ValidateAll() if the designated constraints
108 // aren't met.
109 type RateLimitRequestMultiError []error
110
111 // Error returns a concatenation of all the error messages it wraps.
112 func (m RateLimitRequestMultiError) Error() string {
113 var msgs []string
114 for _, err := range m {
115 msgs = append(msgs, err.Error())
116 }
117 return strings.Join(msgs, "; ")
118 }
119
120 // AllErrors returns a list of validation violation errors.
121 func (m RateLimitRequestMultiError) AllErrors() []error { return m }
122
123 // RateLimitRequestValidationError is the validation error returned by
124 // RateLimitRequest.Validate if the designated constraints aren't met.
125 type RateLimitRequestValidationError struct {
126 field string
127 reason string
128 cause error
129 key bool
130 }
131
132 // Field function returns field value.
133 func (e RateLimitRequestValidationError) Field() string { return e.field }
134
135 // Reason function returns reason value.
136 func (e RateLimitRequestValidationError) Reason() string { return e.reason }
137
138 // Cause function returns cause value.
139 func (e RateLimitRequestValidationError) Cause() error { return e.cause }
140
141 // Key function returns key value.
142 func (e RateLimitRequestValidationError) Key() bool { return e.key }
143
144 // ErrorName returns error name.
145 func (e RateLimitRequestValidationError) ErrorName() string { return "RateLimitRequestValidationError" }
146
147 // Error satisfies the builtin error interface
148 func (e RateLimitRequestValidationError) Error() string {
149 cause := ""
150 if e.cause != nil {
151 cause = fmt.Sprintf(" | caused by: %v", e.cause)
152 }
153
154 key := ""
155 if e.key {
156 key = "key for "
157 }
158
159 return fmt.Sprintf(
160 "invalid %sRateLimitRequest.%s: %s%s",
161 key,
162 e.field,
163 e.reason,
164 cause)
165 }
166
167 var _ error = RateLimitRequestValidationError{}
168
169 var _ interface {
170 Field() string
171 Reason() string
172 Key() bool
173 Cause() error
174 ErrorName() string
175 } = RateLimitRequestValidationError{}
176
177 // Validate checks the field values on RateLimitResponse with the rules defined
178 // in the proto definition for this message. If any rules are violated, the
179 // first error encountered is returned, or nil if there are no violations.
180 func (m *RateLimitResponse) Validate() error {
181 return m.validate(false)
182 }
183
184 // ValidateAll checks the field values on RateLimitResponse with the rules
185 // defined in the proto definition for this message. If any rules are
186 // violated, the result is a list of violation errors wrapped in
187 // RateLimitResponseMultiError, or nil if none found.
188 func (m *RateLimitResponse) ValidateAll() error {
189 return m.validate(true)
190 }
191
192 func (m *RateLimitResponse) validate(all bool) error {
193 if m == nil {
194 return nil
195 }
196
197 var errors []error
198
199 // no validation rules for OverallCode
200
201 for idx, item := range m.GetStatuses() {
202 _, _ = idx, item
203
204 if all {
205 switch v := interface{}(item).(type) {
206 case interface{ ValidateAll() error }:
207 if err := v.ValidateAll(); err != nil {
208 errors = append(errors, RateLimitResponseValidationError{
209 field: fmt.Sprintf("Statuses[%v]", idx),
210 reason: "embedded message failed validation",
211 cause: err,
212 })
213 }
214 case interface{ Validate() error }:
215 if err := v.Validate(); err != nil {
216 errors = append(errors, RateLimitResponseValidationError{
217 field: fmt.Sprintf("Statuses[%v]", idx),
218 reason: "embedded message failed validation",
219 cause: err,
220 })
221 }
222 }
223 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
224 if err := v.Validate(); err != nil {
225 return RateLimitResponseValidationError{
226 field: fmt.Sprintf("Statuses[%v]", idx),
227 reason: "embedded message failed validation",
228 cause: err,
229 }
230 }
231 }
232
233 }
234
235 for idx, item := range m.GetResponseHeadersToAdd() {
236 _, _ = idx, item
237
238 if all {
239 switch v := interface{}(item).(type) {
240 case interface{ ValidateAll() error }:
241 if err := v.ValidateAll(); err != nil {
242 errors = append(errors, RateLimitResponseValidationError{
243 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
244 reason: "embedded message failed validation",
245 cause: err,
246 })
247 }
248 case interface{ Validate() error }:
249 if err := v.Validate(); err != nil {
250 errors = append(errors, RateLimitResponseValidationError{
251 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
252 reason: "embedded message failed validation",
253 cause: err,
254 })
255 }
256 }
257 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
258 if err := v.Validate(); err != nil {
259 return RateLimitResponseValidationError{
260 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
261 reason: "embedded message failed validation",
262 cause: err,
263 }
264 }
265 }
266
267 }
268
269 for idx, item := range m.GetRequestHeadersToAdd() {
270 _, _ = idx, item
271
272 if all {
273 switch v := interface{}(item).(type) {
274 case interface{ ValidateAll() error }:
275 if err := v.ValidateAll(); err != nil {
276 errors = append(errors, RateLimitResponseValidationError{
277 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
278 reason: "embedded message failed validation",
279 cause: err,
280 })
281 }
282 case interface{ Validate() error }:
283 if err := v.Validate(); err != nil {
284 errors = append(errors, RateLimitResponseValidationError{
285 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
286 reason: "embedded message failed validation",
287 cause: err,
288 })
289 }
290 }
291 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
292 if err := v.Validate(); err != nil {
293 return RateLimitResponseValidationError{
294 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
295 reason: "embedded message failed validation",
296 cause: err,
297 }
298 }
299 }
300
301 }
302
303 // no validation rules for RawBody
304
305 if all {
306 switch v := interface{}(m.GetDynamicMetadata()).(type) {
307 case interface{ ValidateAll() error }:
308 if err := v.ValidateAll(); err != nil {
309 errors = append(errors, RateLimitResponseValidationError{
310 field: "DynamicMetadata",
311 reason: "embedded message failed validation",
312 cause: err,
313 })
314 }
315 case interface{ Validate() error }:
316 if err := v.Validate(); err != nil {
317 errors = append(errors, RateLimitResponseValidationError{
318 field: "DynamicMetadata",
319 reason: "embedded message failed validation",
320 cause: err,
321 })
322 }
323 }
324 } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok {
325 if err := v.Validate(); err != nil {
326 return RateLimitResponseValidationError{
327 field: "DynamicMetadata",
328 reason: "embedded message failed validation",
329 cause: err,
330 }
331 }
332 }
333
334 if all {
335 switch v := interface{}(m.GetQuota()).(type) {
336 case interface{ ValidateAll() error }:
337 if err := v.ValidateAll(); err != nil {
338 errors = append(errors, RateLimitResponseValidationError{
339 field: "Quota",
340 reason: "embedded message failed validation",
341 cause: err,
342 })
343 }
344 case interface{ Validate() error }:
345 if err := v.Validate(); err != nil {
346 errors = append(errors, RateLimitResponseValidationError{
347 field: "Quota",
348 reason: "embedded message failed validation",
349 cause: err,
350 })
351 }
352 }
353 } else if v, ok := interface{}(m.GetQuota()).(interface{ Validate() error }); ok {
354 if err := v.Validate(); err != nil {
355 return RateLimitResponseValidationError{
356 field: "Quota",
357 reason: "embedded message failed validation",
358 cause: err,
359 }
360 }
361 }
362
363 if len(errors) > 0 {
364 return RateLimitResponseMultiError(errors)
365 }
366
367 return nil
368 }
369
370 // RateLimitResponseMultiError is an error wrapping multiple validation errors
371 // returned by RateLimitResponse.ValidateAll() if the designated constraints
372 // aren't met.
373 type RateLimitResponseMultiError []error
374
375 // Error returns a concatenation of all the error messages it wraps.
376 func (m RateLimitResponseMultiError) Error() string {
377 var msgs []string
378 for _, err := range m {
379 msgs = append(msgs, err.Error())
380 }
381 return strings.Join(msgs, "; ")
382 }
383
384 // AllErrors returns a list of validation violation errors.
385 func (m RateLimitResponseMultiError) AllErrors() []error { return m }
386
387 // RateLimitResponseValidationError is the validation error returned by
388 // RateLimitResponse.Validate if the designated constraints aren't met.
389 type RateLimitResponseValidationError struct {
390 field string
391 reason string
392 cause error
393 key bool
394 }
395
396 // Field function returns field value.
397 func (e RateLimitResponseValidationError) Field() string { return e.field }
398
399 // Reason function returns reason value.
400 func (e RateLimitResponseValidationError) Reason() string { return e.reason }
401
402 // Cause function returns cause value.
403 func (e RateLimitResponseValidationError) Cause() error { return e.cause }
404
405 // Key function returns key value.
406 func (e RateLimitResponseValidationError) Key() bool { return e.key }
407
408 // ErrorName returns error name.
409 func (e RateLimitResponseValidationError) ErrorName() string {
410 return "RateLimitResponseValidationError"
411 }
412
413 // Error satisfies the builtin error interface
414 func (e RateLimitResponseValidationError) Error() string {
415 cause := ""
416 if e.cause != nil {
417 cause = fmt.Sprintf(" | caused by: %v", e.cause)
418 }
419
420 key := ""
421 if e.key {
422 key = "key for "
423 }
424
425 return fmt.Sprintf(
426 "invalid %sRateLimitResponse.%s: %s%s",
427 key,
428 e.field,
429 e.reason,
430 cause)
431 }
432
433 var _ error = RateLimitResponseValidationError{}
434
435 var _ interface {
436 Field() string
437 Reason() string
438 Key() bool
439 Cause() error
440 ErrorName() string
441 } = RateLimitResponseValidationError{}
442
443 // Validate checks the field values on RateLimitResponse_RateLimit with the
444 // rules defined in the proto definition for this message. If any rules are
445 // violated, the first error encountered is returned, or nil if there are no violations.
446 func (m *RateLimitResponse_RateLimit) Validate() error {
447 return m.validate(false)
448 }
449
450 // ValidateAll checks the field values on RateLimitResponse_RateLimit with the
451 // rules defined in the proto definition for this message. If any rules are
452 // violated, the result is a list of violation errors wrapped in
453 // RateLimitResponse_RateLimitMultiError, or nil if none found.
454 func (m *RateLimitResponse_RateLimit) ValidateAll() error {
455 return m.validate(true)
456 }
457
458 func (m *RateLimitResponse_RateLimit) validate(all bool) error {
459 if m == nil {
460 return nil
461 }
462
463 var errors []error
464
465 // no validation rules for Name
466
467 // no validation rules for RequestsPerUnit
468
469 // no validation rules for Unit
470
471 if len(errors) > 0 {
472 return RateLimitResponse_RateLimitMultiError(errors)
473 }
474
475 return nil
476 }
477
478 // RateLimitResponse_RateLimitMultiError is an error wrapping multiple
479 // validation errors returned by RateLimitResponse_RateLimit.ValidateAll() if
480 // the designated constraints aren't met.
481 type RateLimitResponse_RateLimitMultiError []error
482
483 // Error returns a concatenation of all the error messages it wraps.
484 func (m RateLimitResponse_RateLimitMultiError) Error() string {
485 var msgs []string
486 for _, err := range m {
487 msgs = append(msgs, err.Error())
488 }
489 return strings.Join(msgs, "; ")
490 }
491
492 // AllErrors returns a list of validation violation errors.
493 func (m RateLimitResponse_RateLimitMultiError) AllErrors() []error { return m }
494
495 // RateLimitResponse_RateLimitValidationError is the validation error returned
496 // by RateLimitResponse_RateLimit.Validate if the designated constraints
497 // aren't met.
498 type RateLimitResponse_RateLimitValidationError struct {
499 field string
500 reason string
501 cause error
502 key bool
503 }
504
505 // Field function returns field value.
506 func (e RateLimitResponse_RateLimitValidationError) Field() string { return e.field }
507
508 // Reason function returns reason value.
509 func (e RateLimitResponse_RateLimitValidationError) Reason() string { return e.reason }
510
511 // Cause function returns cause value.
512 func (e RateLimitResponse_RateLimitValidationError) Cause() error { return e.cause }
513
514 // Key function returns key value.
515 func (e RateLimitResponse_RateLimitValidationError) Key() bool { return e.key }
516
517 // ErrorName returns error name.
518 func (e RateLimitResponse_RateLimitValidationError) ErrorName() string {
519 return "RateLimitResponse_RateLimitValidationError"
520 }
521
522 // Error satisfies the builtin error interface
523 func (e RateLimitResponse_RateLimitValidationError) Error() string {
524 cause := ""
525 if e.cause != nil {
526 cause = fmt.Sprintf(" | caused by: %v", e.cause)
527 }
528
529 key := ""
530 if e.key {
531 key = "key for "
532 }
533
534 return fmt.Sprintf(
535 "invalid %sRateLimitResponse_RateLimit.%s: %s%s",
536 key,
537 e.field,
538 e.reason,
539 cause)
540 }
541
542 var _ error = RateLimitResponse_RateLimitValidationError{}
543
544 var _ interface {
545 Field() string
546 Reason() string
547 Key() bool
548 Cause() error
549 ErrorName() string
550 } = RateLimitResponse_RateLimitValidationError{}
551
552 // Validate checks the field values on RateLimitResponse_Quota with the rules
553 // defined in the proto definition for this message. If any rules are
554 // violated, the first error encountered is returned, or nil if there are no violations.
555 func (m *RateLimitResponse_Quota) Validate() error {
556 return m.validate(false)
557 }
558
559 // ValidateAll checks the field values on RateLimitResponse_Quota with the
560 // rules defined in the proto definition for this message. If any rules are
561 // violated, the result is a list of violation errors wrapped in
562 // RateLimitResponse_QuotaMultiError, or nil if none found.
563 func (m *RateLimitResponse_Quota) ValidateAll() error {
564 return m.validate(true)
565 }
566
567 func (m *RateLimitResponse_Quota) validate(all bool) error {
568 if m == nil {
569 return nil
570 }
571
572 var errors []error
573
574 if m.GetRequests() <= 0 {
575 err := RateLimitResponse_QuotaValidationError{
576 field: "Requests",
577 reason: "value must be greater than 0",
578 }
579 if !all {
580 return err
581 }
582 errors = append(errors, err)
583 }
584
585 // no validation rules for Id
586
587 switch v := m.ExpirationSpecifier.(type) {
588 case *RateLimitResponse_Quota_ValidUntil:
589 if v == nil {
590 err := RateLimitResponse_QuotaValidationError{
591 field: "ExpirationSpecifier",
592 reason: "oneof value cannot be a typed-nil",
593 }
594 if !all {
595 return err
596 }
597 errors = append(errors, err)
598 }
599
600 if all {
601 switch v := interface{}(m.GetValidUntil()).(type) {
602 case interface{ ValidateAll() error }:
603 if err := v.ValidateAll(); err != nil {
604 errors = append(errors, RateLimitResponse_QuotaValidationError{
605 field: "ValidUntil",
606 reason: "embedded message failed validation",
607 cause: err,
608 })
609 }
610 case interface{ Validate() error }:
611 if err := v.Validate(); err != nil {
612 errors = append(errors, RateLimitResponse_QuotaValidationError{
613 field: "ValidUntil",
614 reason: "embedded message failed validation",
615 cause: err,
616 })
617 }
618 }
619 } else if v, ok := interface{}(m.GetValidUntil()).(interface{ Validate() error }); ok {
620 if err := v.Validate(); err != nil {
621 return RateLimitResponse_QuotaValidationError{
622 field: "ValidUntil",
623 reason: "embedded message failed validation",
624 cause: err,
625 }
626 }
627 }
628
629 default:
630 _ = v // ensures v is used
631 }
632
633 if len(errors) > 0 {
634 return RateLimitResponse_QuotaMultiError(errors)
635 }
636
637 return nil
638 }
639
640 // RateLimitResponse_QuotaMultiError is an error wrapping multiple validation
641 // errors returned by RateLimitResponse_Quota.ValidateAll() if the designated
642 // constraints aren't met.
643 type RateLimitResponse_QuotaMultiError []error
644
645 // Error returns a concatenation of all the error messages it wraps.
646 func (m RateLimitResponse_QuotaMultiError) Error() string {
647 var msgs []string
648 for _, err := range m {
649 msgs = append(msgs, err.Error())
650 }
651 return strings.Join(msgs, "; ")
652 }
653
654 // AllErrors returns a list of validation violation errors.
655 func (m RateLimitResponse_QuotaMultiError) AllErrors() []error { return m }
656
657 // RateLimitResponse_QuotaValidationError is the validation error returned by
658 // RateLimitResponse_Quota.Validate if the designated constraints aren't met.
659 type RateLimitResponse_QuotaValidationError struct {
660 field string
661 reason string
662 cause error
663 key bool
664 }
665
666 // Field function returns field value.
667 func (e RateLimitResponse_QuotaValidationError) Field() string { return e.field }
668
669 // Reason function returns reason value.
670 func (e RateLimitResponse_QuotaValidationError) Reason() string { return e.reason }
671
672 // Cause function returns cause value.
673 func (e RateLimitResponse_QuotaValidationError) Cause() error { return e.cause }
674
675 // Key function returns key value.
676 func (e RateLimitResponse_QuotaValidationError) Key() bool { return e.key }
677
678 // ErrorName returns error name.
679 func (e RateLimitResponse_QuotaValidationError) ErrorName() string {
680 return "RateLimitResponse_QuotaValidationError"
681 }
682
683 // Error satisfies the builtin error interface
684 func (e RateLimitResponse_QuotaValidationError) Error() string {
685 cause := ""
686 if e.cause != nil {
687 cause = fmt.Sprintf(" | caused by: %v", e.cause)
688 }
689
690 key := ""
691 if e.key {
692 key = "key for "
693 }
694
695 return fmt.Sprintf(
696 "invalid %sRateLimitResponse_Quota.%s: %s%s",
697 key,
698 e.field,
699 e.reason,
700 cause)
701 }
702
703 var _ error = RateLimitResponse_QuotaValidationError{}
704
705 var _ interface {
706 Field() string
707 Reason() string
708 Key() bool
709 Cause() error
710 ErrorName() string
711 } = RateLimitResponse_QuotaValidationError{}
712
713 // Validate checks the field values on RateLimitResponse_DescriptorStatus with
714 // the rules defined in the proto definition for this message. If any rules
715 // are violated, the first error encountered is returned, or nil if there are
716 // no violations.
717 func (m *RateLimitResponse_DescriptorStatus) Validate() error {
718 return m.validate(false)
719 }
720
721 // ValidateAll checks the field values on RateLimitResponse_DescriptorStatus
722 // with the rules defined in the proto definition for this message. If any
723 // rules are violated, the result is a list of violation errors wrapped in
724 // RateLimitResponse_DescriptorStatusMultiError, or nil if none found.
725 func (m *RateLimitResponse_DescriptorStatus) ValidateAll() error {
726 return m.validate(true)
727 }
728
729 func (m *RateLimitResponse_DescriptorStatus) validate(all bool) error {
730 if m == nil {
731 return nil
732 }
733
734 var errors []error
735
736 // no validation rules for Code
737
738 if all {
739 switch v := interface{}(m.GetCurrentLimit()).(type) {
740 case interface{ ValidateAll() error }:
741 if err := v.ValidateAll(); err != nil {
742 errors = append(errors, RateLimitResponse_DescriptorStatusValidationError{
743 field: "CurrentLimit",
744 reason: "embedded message failed validation",
745 cause: err,
746 })
747 }
748 case interface{ Validate() error }:
749 if err := v.Validate(); err != nil {
750 errors = append(errors, RateLimitResponse_DescriptorStatusValidationError{
751 field: "CurrentLimit",
752 reason: "embedded message failed validation",
753 cause: err,
754 })
755 }
756 }
757 } else if v, ok := interface{}(m.GetCurrentLimit()).(interface{ Validate() error }); ok {
758 if err := v.Validate(); err != nil {
759 return RateLimitResponse_DescriptorStatusValidationError{
760 field: "CurrentLimit",
761 reason: "embedded message failed validation",
762 cause: err,
763 }
764 }
765 }
766
767 // no validation rules for LimitRemaining
768
769 if all {
770 switch v := interface{}(m.GetDurationUntilReset()).(type) {
771 case interface{ ValidateAll() error }:
772 if err := v.ValidateAll(); err != nil {
773 errors = append(errors, RateLimitResponse_DescriptorStatusValidationError{
774 field: "DurationUntilReset",
775 reason: "embedded message failed validation",
776 cause: err,
777 })
778 }
779 case interface{ Validate() error }:
780 if err := v.Validate(); err != nil {
781 errors = append(errors, RateLimitResponse_DescriptorStatusValidationError{
782 field: "DurationUntilReset",
783 reason: "embedded message failed validation",
784 cause: err,
785 })
786 }
787 }
788 } else if v, ok := interface{}(m.GetDurationUntilReset()).(interface{ Validate() error }); ok {
789 if err := v.Validate(); err != nil {
790 return RateLimitResponse_DescriptorStatusValidationError{
791 field: "DurationUntilReset",
792 reason: "embedded message failed validation",
793 cause: err,
794 }
795 }
796 }
797
798 if all {
799 switch v := interface{}(m.GetQuota()).(type) {
800 case interface{ ValidateAll() error }:
801 if err := v.ValidateAll(); err != nil {
802 errors = append(errors, RateLimitResponse_DescriptorStatusValidationError{
803 field: "Quota",
804 reason: "embedded message failed validation",
805 cause: err,
806 })
807 }
808 case interface{ Validate() error }:
809 if err := v.Validate(); err != nil {
810 errors = append(errors, RateLimitResponse_DescriptorStatusValidationError{
811 field: "Quota",
812 reason: "embedded message failed validation",
813 cause: err,
814 })
815 }
816 }
817 } else if v, ok := interface{}(m.GetQuota()).(interface{ Validate() error }); ok {
818 if err := v.Validate(); err != nil {
819 return RateLimitResponse_DescriptorStatusValidationError{
820 field: "Quota",
821 reason: "embedded message failed validation",
822 cause: err,
823 }
824 }
825 }
826
827 if len(errors) > 0 {
828 return RateLimitResponse_DescriptorStatusMultiError(errors)
829 }
830
831 return nil
832 }
833
834 // RateLimitResponse_DescriptorStatusMultiError is an error wrapping multiple
835 // validation errors returned by
836 // RateLimitResponse_DescriptorStatus.ValidateAll() if the designated
837 // constraints aren't met.
838 type RateLimitResponse_DescriptorStatusMultiError []error
839
840 // Error returns a concatenation of all the error messages it wraps.
841 func (m RateLimitResponse_DescriptorStatusMultiError) Error() string {
842 var msgs []string
843 for _, err := range m {
844 msgs = append(msgs, err.Error())
845 }
846 return strings.Join(msgs, "; ")
847 }
848
849 // AllErrors returns a list of validation violation errors.
850 func (m RateLimitResponse_DescriptorStatusMultiError) AllErrors() []error { return m }
851
852 // RateLimitResponse_DescriptorStatusValidationError is the validation error
853 // returned by RateLimitResponse_DescriptorStatus.Validate if the designated
854 // constraints aren't met.
855 type RateLimitResponse_DescriptorStatusValidationError struct {
856 field string
857 reason string
858 cause error
859 key bool
860 }
861
862 // Field function returns field value.
863 func (e RateLimitResponse_DescriptorStatusValidationError) Field() string { return e.field }
864
865 // Reason function returns reason value.
866 func (e RateLimitResponse_DescriptorStatusValidationError) Reason() string { return e.reason }
867
868 // Cause function returns cause value.
869 func (e RateLimitResponse_DescriptorStatusValidationError) Cause() error { return e.cause }
870
871 // Key function returns key value.
872 func (e RateLimitResponse_DescriptorStatusValidationError) Key() bool { return e.key }
873
874 // ErrorName returns error name.
875 func (e RateLimitResponse_DescriptorStatusValidationError) ErrorName() string {
876 return "RateLimitResponse_DescriptorStatusValidationError"
877 }
878
879 // Error satisfies the builtin error interface
880 func (e RateLimitResponse_DescriptorStatusValidationError) Error() string {
881 cause := ""
882 if e.cause != nil {
883 cause = fmt.Sprintf(" | caused by: %v", e.cause)
884 }
885
886 key := ""
887 if e.key {
888 key = "key for "
889 }
890
891 return fmt.Sprintf(
892 "invalid %sRateLimitResponse_DescriptorStatus.%s: %s%s",
893 key,
894 e.field,
895 e.reason,
896 cause)
897 }
898
899 var _ error = RateLimitResponse_DescriptorStatusValidationError{}
900
901 var _ interface {
902 Field() string
903 Reason() string
904 Key() bool
905 Cause() error
906 ErrorName() string
907 } = RateLimitResponse_DescriptorStatusValidationError{}