Debian Codegraph @

envoy/service/rate_limit_quota/v3/rlqs.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/service/rate_limit_quota/v3/rlqs.proto
4
5 package rate_limit_quotav3
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 RateLimitQuotaUsageReports with the
40 // rules 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 *RateLimitQuotaUsageReports) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on RateLimitQuotaUsageReports with the
47 // rules 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 // RateLimitQuotaUsageReportsMultiError, or nil if none found.
50 func (m *RateLimitQuotaUsageReports) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *RateLimitQuotaUsageReports) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 if utf8.RuneCountInString(m.GetDomain()) < 1 {
62 err := RateLimitQuotaUsageReportsValidationError{
63 field: "Domain",
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 if len(m.GetBucketQuotaUsages()) < 1 {
73 err := RateLimitQuotaUsageReportsValidationError{
74 field: "BucketQuotaUsages",
75 reason: "value must contain at least 1 item(s)",
76 }
77 if !all {
78 return err
79 }
80 errors = append(errors, err)
81 }
82
83 for idx, item := range m.GetBucketQuotaUsages() {
84 _, _ = idx, item
85
86 if all {
87 switch v := interface{}(item).(type) {
88 case interface{ ValidateAll() error }:
89 if err := v.ValidateAll(); err != nil {
90 errors = append(errors, RateLimitQuotaUsageReportsValidationError{
91 field: fmt.Sprintf("BucketQuotaUsages[%v]", idx),
92 reason: "embedded message failed validation",
93 cause: err,
94 })
95 }
96 case interface{ Validate() error }:
97 if err := v.Validate(); err != nil {
98 errors = append(errors, RateLimitQuotaUsageReportsValidationError{
99 field: fmt.Sprintf("BucketQuotaUsages[%v]", idx),
100 reason: "embedded message failed validation",
101 cause: err,
102 })
103 }
104 }
105 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
106 if err := v.Validate(); err != nil {
107 return RateLimitQuotaUsageReportsValidationError{
108 field: fmt.Sprintf("BucketQuotaUsages[%v]", idx),
109 reason: "embedded message failed validation",
110 cause: err,
111 }
112 }
113 }
114
115 }
116
117 if len(errors) > 0 {
118 return RateLimitQuotaUsageReportsMultiError(errors)
119 }
120
121 return nil
122 }
123
124 // RateLimitQuotaUsageReportsMultiError is an error wrapping multiple
125 // validation errors returned by RateLimitQuotaUsageReports.ValidateAll() if
126 // the designated constraints aren't met.
127 type RateLimitQuotaUsageReportsMultiError []error
128
129 // Error returns a concatenation of all the error messages it wraps.
130 func (m RateLimitQuotaUsageReportsMultiError) Error() string {
131 var msgs []string
132 for _, err := range m {
133 msgs = append(msgs, err.Error())
134 }
135 return strings.Join(msgs, "; ")
136 }
137
138 // AllErrors returns a list of validation violation errors.
139 func (m RateLimitQuotaUsageReportsMultiError) AllErrors() []error { return m }
140
141 // RateLimitQuotaUsageReportsValidationError is the validation error returned
142 // by RateLimitQuotaUsageReports.Validate if the designated constraints aren't met.
143 type RateLimitQuotaUsageReportsValidationError struct {
144 field string
145 reason string
146 cause error
147 key bool
148 }
149
150 // Field function returns field value.
151 func (e RateLimitQuotaUsageReportsValidationError) Field() string { return e.field }
152
153 // Reason function returns reason value.
154 func (e RateLimitQuotaUsageReportsValidationError) Reason() string { return e.reason }
155
156 // Cause function returns cause value.
157 func (e RateLimitQuotaUsageReportsValidationError) Cause() error { return e.cause }
158
159 // Key function returns key value.
160 func (e RateLimitQuotaUsageReportsValidationError) Key() bool { return e.key }
161
162 // ErrorName returns error name.
163 func (e RateLimitQuotaUsageReportsValidationError) ErrorName() string {
164 return "RateLimitQuotaUsageReportsValidationError"
165 }
166
167 // Error satisfies the builtin error interface
168 func (e RateLimitQuotaUsageReportsValidationError) Error() string {
169 cause := ""
170 if e.cause != nil {
171 cause = fmt.Sprintf(" | caused by: %v", e.cause)
172 }
173
174 key := ""
175 if e.key {
176 key = "key for "
177 }
178
179 return fmt.Sprintf(
180 "invalid %sRateLimitQuotaUsageReports.%s: %s%s",
181 key,
182 e.field,
183 e.reason,
184 cause)
185 }
186
187 var _ error = RateLimitQuotaUsageReportsValidationError{}
188
189 var _ interface {
190 Field() string
191 Reason() string
192 Key() bool
193 Cause() error
194 ErrorName() string
195 } = RateLimitQuotaUsageReportsValidationError{}
196
197 // Validate checks the field values on RateLimitQuotaResponse with the rules
198 // defined in the proto definition for this message. If any rules are
199 // violated, the first error encountered is returned, or nil if there are no violations.
200 func (m *RateLimitQuotaResponse) Validate() error {
201 return m.validate(false)
202 }
203
204 // ValidateAll checks the field values on RateLimitQuotaResponse with the rules
205 // defined in the proto definition for this message. If any rules are
206 // violated, the result is a list of violation errors wrapped in
207 // RateLimitQuotaResponseMultiError, or nil if none found.
208 func (m *RateLimitQuotaResponse) ValidateAll() error {
209 return m.validate(true)
210 }
211
212 func (m *RateLimitQuotaResponse) validate(all bool) error {
213 if m == nil {
214 return nil
215 }
216
217 var errors []error
218
219 if len(m.GetBucketAction()) < 1 {
220 err := RateLimitQuotaResponseValidationError{
221 field: "BucketAction",
222 reason: "value must contain at least 1 item(s)",
223 }
224 if !all {
225 return err
226 }
227 errors = append(errors, err)
228 }
229
230 for idx, item := range m.GetBucketAction() {
231 _, _ = idx, item
232
233 if all {
234 switch v := interface{}(item).(type) {
235 case interface{ ValidateAll() error }:
236 if err := v.ValidateAll(); err != nil {
237 errors = append(errors, RateLimitQuotaResponseValidationError{
238 field: fmt.Sprintf("BucketAction[%v]", idx),
239 reason: "embedded message failed validation",
240 cause: err,
241 })
242 }
243 case interface{ Validate() error }:
244 if err := v.Validate(); err != nil {
245 errors = append(errors, RateLimitQuotaResponseValidationError{
246 field: fmt.Sprintf("BucketAction[%v]", idx),
247 reason: "embedded message failed validation",
248 cause: err,
249 })
250 }
251 }
252 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
253 if err := v.Validate(); err != nil {
254 return RateLimitQuotaResponseValidationError{
255 field: fmt.Sprintf("BucketAction[%v]", idx),
256 reason: "embedded message failed validation",
257 cause: err,
258 }
259 }
260 }
261
262 }
263
264 if len(errors) > 0 {
265 return RateLimitQuotaResponseMultiError(errors)
266 }
267
268 return nil
269 }
270
271 // RateLimitQuotaResponseMultiError is an error wrapping multiple validation
272 // errors returned by RateLimitQuotaResponse.ValidateAll() if the designated
273 // constraints aren't met.
274 type RateLimitQuotaResponseMultiError []error
275
276 // Error returns a concatenation of all the error messages it wraps.
277 func (m RateLimitQuotaResponseMultiError) Error() string {
278 var msgs []string
279 for _, err := range m {
280 msgs = append(msgs, err.Error())
281 }
282 return strings.Join(msgs, "; ")
283 }
284
285 // AllErrors returns a list of validation violation errors.
286 func (m RateLimitQuotaResponseMultiError) AllErrors() []error { return m }
287
288 // RateLimitQuotaResponseValidationError is the validation error returned by
289 // RateLimitQuotaResponse.Validate if the designated constraints aren't met.
290 type RateLimitQuotaResponseValidationError struct {
291 field string
292 reason string
293 cause error
294 key bool
295 }
296
297 // Field function returns field value.
298 func (e RateLimitQuotaResponseValidationError) Field() string { return e.field }
299
300 // Reason function returns reason value.
301 func (e RateLimitQuotaResponseValidationError) Reason() string { return e.reason }
302
303 // Cause function returns cause value.
304 func (e RateLimitQuotaResponseValidationError) Cause() error { return e.cause }
305
306 // Key function returns key value.
307 func (e RateLimitQuotaResponseValidationError) Key() bool { return e.key }
308
309 // ErrorName returns error name.
310 func (e RateLimitQuotaResponseValidationError) ErrorName() string {
311 return "RateLimitQuotaResponseValidationError"
312 }
313
314 // Error satisfies the builtin error interface
315 func (e RateLimitQuotaResponseValidationError) Error() string {
316 cause := ""
317 if e.cause != nil {
318 cause = fmt.Sprintf(" | caused by: %v", e.cause)
319 }
320
321 key := ""
322 if e.key {
323 key = "key for "
324 }
325
326 return fmt.Sprintf(
327 "invalid %sRateLimitQuotaResponse.%s: %s%s",
328 key,
329 e.field,
330 e.reason,
331 cause)
332 }
333
334 var _ error = RateLimitQuotaResponseValidationError{}
335
336 var _ interface {
337 Field() string
338 Reason() string
339 Key() bool
340 Cause() error
341 ErrorName() string
342 } = RateLimitQuotaResponseValidationError{}
343
344 // Validate checks the field values on BucketId with the rules defined in the
345 // proto definition for this message. If any rules are violated, the first
346 // error encountered is returned, or nil if there are no violations.
347 func (m *BucketId) Validate() error {
348 return m.validate(false)
349 }
350
351 // ValidateAll checks the field values on BucketId with the rules defined in
352 // the proto definition for this message. If any rules are violated, the
353 // result is a list of violation errors wrapped in BucketIdMultiError, or nil
354 // if none found.
355 func (m *BucketId) ValidateAll() error {
356 return m.validate(true)
357 }
358
359 func (m *BucketId) validate(all bool) error {
360 if m == nil {
361 return nil
362 }
363
364 var errors []error
365
366 if len(m.GetBucket()) < 1 {
367 err := BucketIdValidationError{
368 field: "Bucket",
369 reason: "value must contain at least 1 pair(s)",
370 }
371 if !all {
372 return err
373 }
374 errors = append(errors, err)
375 }
376
377 {
378 sorted_keys := make([]string, len(m.GetBucket()))
379 i := 0
380 for key := range m.GetBucket() {
381 sorted_keys[i] = key
382 i++
383 }
384 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
385 for _, key := range sorted_keys {
386 val := m.GetBucket()[key]
387 _ = val
388
389 if utf8.RuneCountInString(key) < 1 {
390 err := BucketIdValidationError{
391 field: fmt.Sprintf("Bucket[%v]", key),
392 reason: "value length must be at least 1 runes",
393 }
394 if !all {
395 return err
396 }
397 errors = append(errors, err)
398 }
399
400 if utf8.RuneCountInString(val) < 1 {
401 err := BucketIdValidationError{
402 field: fmt.Sprintf("Bucket[%v]", key),
403 reason: "value length must be at least 1 runes",
404 }
405 if !all {
406 return err
407 }
408 errors = append(errors, err)
409 }
410
411 }
412 }
413
414 if len(errors) > 0 {
415 return BucketIdMultiError(errors)
416 }
417
418 return nil
419 }
420
421 // BucketIdMultiError is an error wrapping multiple validation errors returned
422 // by BucketId.ValidateAll() if the designated constraints aren't met.
423 type BucketIdMultiError []error
424
425 // Error returns a concatenation of all the error messages it wraps.
426 func (m BucketIdMultiError) Error() string {
427 var msgs []string
428 for _, err := range m {
429 msgs = append(msgs, err.Error())
430 }
431 return strings.Join(msgs, "; ")
432 }
433
434 // AllErrors returns a list of validation violation errors.
435 func (m BucketIdMultiError) AllErrors() []error { return m }
436
437 // BucketIdValidationError is the validation error returned by
438 // BucketId.Validate if the designated constraints aren't met.
439 type BucketIdValidationError struct {
440 field string
441 reason string
442 cause error
443 key bool
444 }
445
446 // Field function returns field value.
447 func (e BucketIdValidationError) Field() string { return e.field }
448
449 // Reason function returns reason value.
450 func (e BucketIdValidationError) Reason() string { return e.reason }
451
452 // Cause function returns cause value.
453 func (e BucketIdValidationError) Cause() error { return e.cause }
454
455 // Key function returns key value.
456 func (e BucketIdValidationError) Key() bool { return e.key }
457
458 // ErrorName returns error name.
459 func (e BucketIdValidationError) ErrorName() string { return "BucketIdValidationError" }
460
461 // Error satisfies the builtin error interface
462 func (e BucketIdValidationError) Error() string {
463 cause := ""
464 if e.cause != nil {
465 cause = fmt.Sprintf(" | caused by: %v", e.cause)
466 }
467
468 key := ""
469 if e.key {
470 key = "key for "
471 }
472
473 return fmt.Sprintf(
474 "invalid %sBucketId.%s: %s%s",
475 key,
476 e.field,
477 e.reason,
478 cause)
479 }
480
481 var _ error = BucketIdValidationError{}
482
483 var _ interface {
484 Field() string
485 Reason() string
486 Key() bool
487 Cause() error
488 ErrorName() string
489 } = BucketIdValidationError{}
490
491 // Validate checks the field values on
492 // RateLimitQuotaUsageReports_BucketQuotaUsage with the rules defined in the
493 // proto definition for this message. If any rules are violated, the first
494 // error encountered is returned, or nil if there are no violations.
495 func (m *RateLimitQuotaUsageReports_BucketQuotaUsage) Validate() error {
496 return m.validate(false)
497 }
498
499 // ValidateAll checks the field values on
500 // RateLimitQuotaUsageReports_BucketQuotaUsage with the rules defined in the
501 // proto definition for this message. If any rules are violated, the result is
502 // a list of violation errors wrapped in
503 // RateLimitQuotaUsageReports_BucketQuotaUsageMultiError, or nil if none found.
504 func (m *RateLimitQuotaUsageReports_BucketQuotaUsage) ValidateAll() error {
505 return m.validate(true)
506 }
507
508 func (m *RateLimitQuotaUsageReports_BucketQuotaUsage) validate(all bool) error {
509 if m == nil {
510 return nil
511 }
512
513 var errors []error
514
515 if m.GetBucketId() == nil {
516 err := RateLimitQuotaUsageReports_BucketQuotaUsageValidationError{
517 field: "BucketId",
518 reason: "value is required",
519 }
520 if !all {
521 return err
522 }
523 errors = append(errors, err)
524 }
525
526 if all {
527 switch v := interface{}(m.GetBucketId()).(type) {
528 case interface{ ValidateAll() error }:
529 if err := v.ValidateAll(); err != nil {
530 errors = append(errors, RateLimitQuotaUsageReports_BucketQuotaUsageValidationError{
531 field: "BucketId",
532 reason: "embedded message failed validation",
533 cause: err,
534 })
535 }
536 case interface{ Validate() error }:
537 if err := v.Validate(); err != nil {
538 errors = append(errors, RateLimitQuotaUsageReports_BucketQuotaUsageValidationError{
539 field: "BucketId",
540 reason: "embedded message failed validation",
541 cause: err,
542 })
543 }
544 }
545 } else if v, ok := interface{}(m.GetBucketId()).(interface{ Validate() error }); ok {
546 if err := v.Validate(); err != nil {
547 return RateLimitQuotaUsageReports_BucketQuotaUsageValidationError{
548 field: "BucketId",
549 reason: "embedded message failed validation",
550 cause: err,
551 }
552 }
553 }
554
555 if m.GetTimeElapsed() == nil {
556 err := RateLimitQuotaUsageReports_BucketQuotaUsageValidationError{
557 field: "TimeElapsed",
558 reason: "value is required",
559 }
560 if !all {
561 return err
562 }
563 errors = append(errors, err)
564 }
565
566 if d := m.GetTimeElapsed(); d != nil {
567 dur, err := d.AsDuration(), d.CheckValid()
568 if err != nil {
569 err = RateLimitQuotaUsageReports_BucketQuotaUsageValidationError{
570 field: "TimeElapsed",
571 reason: "value is not a valid duration",
572 cause: err,
573 }
574 if !all {
575 return err
576 }
577 errors = append(errors, err)
578 } else {
579
580 gt := time.Duration(0*time.Second + 0*time.Nanosecond)
581
582 if dur <= gt {
583 err := RateLimitQuotaUsageReports_BucketQuotaUsageValidationError{
584 field: "TimeElapsed",
585 reason: "value must be greater than 0s",
586 }
587 if !all {
588 return err
589 }
590 errors = append(errors, err)
591 }
592
593 }
594 }
595
596 // no validation rules for NumRequestsAllowed
597
598 // no validation rules for NumRequestsDenied
599
600 if len(errors) > 0 {
601 return RateLimitQuotaUsageReports_BucketQuotaUsageMultiError(errors)
602 }
603
604 return nil
605 }
606
607 // RateLimitQuotaUsageReports_BucketQuotaUsageMultiError is an error wrapping
608 // multiple validation errors returned by
609 // RateLimitQuotaUsageReports_BucketQuotaUsage.ValidateAll() if the designated
610 // constraints aren't met.
611 type RateLimitQuotaUsageReports_BucketQuotaUsageMultiError []error
612
613 // Error returns a concatenation of all the error messages it wraps.
614 func (m RateLimitQuotaUsageReports_BucketQuotaUsageMultiError) Error() string {
615 var msgs []string
616 for _, err := range m {
617 msgs = append(msgs, err.Error())
618 }
619 return strings.Join(msgs, "; ")
620 }
621
622 // AllErrors returns a list of validation violation errors.
623 func (m RateLimitQuotaUsageReports_BucketQuotaUsageMultiError) AllErrors() []error { return m }
624
625 // RateLimitQuotaUsageReports_BucketQuotaUsageValidationError is the validation
626 // error returned by RateLimitQuotaUsageReports_BucketQuotaUsage.Validate if
627 // the designated constraints aren't met.
628 type RateLimitQuotaUsageReports_BucketQuotaUsageValidationError struct {
629 field string
630 reason string
631 cause error
632 key bool
633 }
634
635 // Field function returns field value.
636 func (e RateLimitQuotaUsageReports_BucketQuotaUsageValidationError) Field() string { return e.field }
637
638 // Reason function returns reason value.
639 func (e RateLimitQuotaUsageReports_BucketQuotaUsageValidationError) Reason() string { return e.reason }
640
641 // Cause function returns cause value.
642 func (e RateLimitQuotaUsageReports_BucketQuotaUsageValidationError) Cause() error { return e.cause }
643
644 // Key function returns key value.
645 func (e RateLimitQuotaUsageReports_BucketQuotaUsageValidationError) Key() bool { return e.key }
646
647 // ErrorName returns error name.
648 func (e RateLimitQuotaUsageReports_BucketQuotaUsageValidationError) ErrorName() string {
649 return "RateLimitQuotaUsageReports_BucketQuotaUsageValidationError"
650 }
651
652 // Error satisfies the builtin error interface
653 func (e RateLimitQuotaUsageReports_BucketQuotaUsageValidationError) Error() string {
654 cause := ""
655 if e.cause != nil {
656 cause = fmt.Sprintf(" | caused by: %v", e.cause)
657 }
658
659 key := ""
660 if e.key {
661 key = "key for "
662 }
663
664 return fmt.Sprintf(
665 "invalid %sRateLimitQuotaUsageReports_BucketQuotaUsage.%s: %s%s",
666 key,
667 e.field,
668 e.reason,
669 cause)
670 }
671
672 var _ error = RateLimitQuotaUsageReports_BucketQuotaUsageValidationError{}
673
674 var _ interface {
675 Field() string
676 Reason() string
677 Key() bool
678 Cause() error
679 ErrorName() string
680 } = RateLimitQuotaUsageReports_BucketQuotaUsageValidationError{}
681
682 // Validate checks the field values on RateLimitQuotaResponse_BucketAction with
683 // the rules defined in the proto definition for this message. If any rules
684 // are violated, the first error encountered is returned, or nil if there are
685 // no violations.
686 func (m *RateLimitQuotaResponse_BucketAction) Validate() error {
687 return m.validate(false)
688 }
689
690 // ValidateAll checks the field values on RateLimitQuotaResponse_BucketAction
691 // with the rules defined in the proto definition for this message. If any
692 // rules are violated, the result is a list of violation errors wrapped in
693 // RateLimitQuotaResponse_BucketActionMultiError, or nil if none found.
694 func (m *RateLimitQuotaResponse_BucketAction) ValidateAll() error {
695 return m.validate(true)
696 }
697
698 func (m *RateLimitQuotaResponse_BucketAction) validate(all bool) error {
699 if m == nil {
700 return nil
701 }
702
703 var errors []error
704
705 if m.GetBucketId() == nil {
706 err := RateLimitQuotaResponse_BucketActionValidationError{
707 field: "BucketId",
708 reason: "value is required",
709 }
710 if !all {
711 return err
712 }
713 errors = append(errors, err)
714 }
715
716 if all {
717 switch v := interface{}(m.GetBucketId()).(type) {
718 case interface{ ValidateAll() error }:
719 if err := v.ValidateAll(); err != nil {
720 errors = append(errors, RateLimitQuotaResponse_BucketActionValidationError{
721 field: "BucketId",
722 reason: "embedded message failed validation",
723 cause: err,
724 })
725 }
726 case interface{ Validate() error }:
727 if err := v.Validate(); err != nil {
728 errors = append(errors, RateLimitQuotaResponse_BucketActionValidationError{
729 field: "BucketId",
730 reason: "embedded message failed validation",
731 cause: err,
732 })
733 }
734 }
735 } else if v, ok := interface{}(m.GetBucketId()).(interface{ Validate() error }); ok {
736 if err := v.Validate(); err != nil {
737 return RateLimitQuotaResponse_BucketActionValidationError{
738 field: "BucketId",
739 reason: "embedded message failed validation",
740 cause: err,
741 }
742 }
743 }
744
745 oneofBucketActionPresent := false
746 switch v := m.BucketAction.(type) {
747 case *RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction_:
748 if v == nil {
749 err := RateLimitQuotaResponse_BucketActionValidationError{
750 field: "BucketAction",
751 reason: "oneof value cannot be a typed-nil",
752 }
753 if !all {
754 return err
755 }
756 errors = append(errors, err)
757 }
758 oneofBucketActionPresent = true
759
760 if all {
761 switch v := interface{}(m.GetQuotaAssignmentAction()).(type) {
762 case interface{ ValidateAll() error }:
763 if err := v.ValidateAll(); err != nil {
764 errors = append(errors, RateLimitQuotaResponse_BucketActionValidationError{
765 field: "QuotaAssignmentAction",
766 reason: "embedded message failed validation",
767 cause: err,
768 })
769 }
770 case interface{ Validate() error }:
771 if err := v.Validate(); err != nil {
772 errors = append(errors, RateLimitQuotaResponse_BucketActionValidationError{
773 field: "QuotaAssignmentAction",
774 reason: "embedded message failed validation",
775 cause: err,
776 })
777 }
778 }
779 } else if v, ok := interface{}(m.GetQuotaAssignmentAction()).(interface{ Validate() error }); ok {
780 if err := v.Validate(); err != nil {
781 return RateLimitQuotaResponse_BucketActionValidationError{
782 field: "QuotaAssignmentAction",
783 reason: "embedded message failed validation",
784 cause: err,
785 }
786 }
787 }
788
789 case *RateLimitQuotaResponse_BucketAction_AbandonAction_:
790 if v == nil {
791 err := RateLimitQuotaResponse_BucketActionValidationError{
792 field: "BucketAction",
793 reason: "oneof value cannot be a typed-nil",
794 }
795 if !all {
796 return err
797 }
798 errors = append(errors, err)
799 }
800 oneofBucketActionPresent = true
801
802 if all {
803 switch v := interface{}(m.GetAbandonAction()).(type) {
804 case interface{ ValidateAll() error }:
805 if err := v.ValidateAll(); err != nil {
806 errors = append(errors, RateLimitQuotaResponse_BucketActionValidationError{
807 field: "AbandonAction",
808 reason: "embedded message failed validation",
809 cause: err,
810 })
811 }
812 case interface{ Validate() error }:
813 if err := v.Validate(); err != nil {
814 errors = append(errors, RateLimitQuotaResponse_BucketActionValidationError{
815 field: "AbandonAction",
816 reason: "embedded message failed validation",
817 cause: err,
818 })
819 }
820 }
821 } else if v, ok := interface{}(m.GetAbandonAction()).(interface{ Validate() error }); ok {
822 if err := v.Validate(); err != nil {
823 return RateLimitQuotaResponse_BucketActionValidationError{
824 field: "AbandonAction",
825 reason: "embedded message failed validation",
826 cause: err,
827 }
828 }
829 }
830
831 default:
832 _ = v // ensures v is used
833 }
834 if !oneofBucketActionPresent {
835 err := RateLimitQuotaResponse_BucketActionValidationError{
836 field: "BucketAction",
837 reason: "value is required",
838 }
839 if !all {
840 return err
841 }
842 errors = append(errors, err)
843 }
844
845 if len(errors) > 0 {
846 return RateLimitQuotaResponse_BucketActionMultiError(errors)
847 }
848
849 return nil
850 }
851
852 // RateLimitQuotaResponse_BucketActionMultiError is an error wrapping multiple
853 // validation errors returned by
854 // RateLimitQuotaResponse_BucketAction.ValidateAll() if the designated
855 // constraints aren't met.
856 type RateLimitQuotaResponse_BucketActionMultiError []error
857
858 // Error returns a concatenation of all the error messages it wraps.
859 func (m RateLimitQuotaResponse_BucketActionMultiError) Error() string {
860 var msgs []string
861 for _, err := range m {
862 msgs = append(msgs, err.Error())
863 }
864 return strings.Join(msgs, "; ")
865 }
866
867 // AllErrors returns a list of validation violation errors.
868 func (m RateLimitQuotaResponse_BucketActionMultiError) AllErrors() []error { return m }
869
870 // RateLimitQuotaResponse_BucketActionValidationError is the validation error
871 // returned by RateLimitQuotaResponse_BucketAction.Validate if the designated
872 // constraints aren't met.
873 type RateLimitQuotaResponse_BucketActionValidationError struct {
874 field string
875 reason string
876 cause error
877 key bool
878 }
879
880 // Field function returns field value.
881 func (e RateLimitQuotaResponse_BucketActionValidationError) Field() string { return e.field }
882
883 // Reason function returns reason value.
884 func (e RateLimitQuotaResponse_BucketActionValidationError) Reason() string { return e.reason }
885
886 // Cause function returns cause value.
887 func (e RateLimitQuotaResponse_BucketActionValidationError) Cause() error { return e.cause }
888
889 // Key function returns key value.
890 func (e RateLimitQuotaResponse_BucketActionValidationError) Key() bool { return e.key }
891
892 // ErrorName returns error name.
893 func (e RateLimitQuotaResponse_BucketActionValidationError) ErrorName() string {
894 return "RateLimitQuotaResponse_BucketActionValidationError"
895 }
896
897 // Error satisfies the builtin error interface
898 func (e RateLimitQuotaResponse_BucketActionValidationError) Error() string {
899 cause := ""
900 if e.cause != nil {
901 cause = fmt.Sprintf(" | caused by: %v", e.cause)
902 }
903
904 key := ""
905 if e.key {
906 key = "key for "
907 }
908
909 return fmt.Sprintf(
910 "invalid %sRateLimitQuotaResponse_BucketAction.%s: %s%s",
911 key,
912 e.field,
913 e.reason,
914 cause)
915 }
916
917 var _ error = RateLimitQuotaResponse_BucketActionValidationError{}
918
919 var _ interface {
920 Field() string
921 Reason() string
922 Key() bool
923 Cause() error
924 ErrorName() string
925 } = RateLimitQuotaResponse_BucketActionValidationError{}
926
927 // Validate checks the field values on
928 // RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction with the rules
929 // defined in the proto definition for this message. If any rules are
930 // violated, the first error encountered is returned, or nil if there are no violations.
931 func (m *RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction) Validate() error {
932 return m.validate(false)
933 }
934
935 // ValidateAll checks the field values on
936 // RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction with the rules
937 // defined in the proto definition for this message. If any rules are
938 // violated, the result is a list of violation errors wrapped in
939 // RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionMultiError, or nil
940 // if none found.
941 func (m *RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction) ValidateAll() error {
942 return m.validate(true)
943 }
944
945 func (m *RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction) validate(all bool) error {
946 if m == nil {
947 return nil
948 }
949
950 var errors []error
951
952 if d := m.GetAssignmentTimeToLive(); d != nil {
953 dur, err := d.AsDuration(), d.CheckValid()
954 if err != nil {
955 err = RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError{
956 field: "AssignmentTimeToLive",
957 reason: "value is not a valid duration",
958 cause: err,
959 }
960 if !all {
961 return err
962 }
963 errors = append(errors, err)
964 } else {
965
966 gte := time.Duration(0*time.Second + 0*time.Nanosecond)
967
968 if dur < gte {
969 err := RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError{
970 field: "AssignmentTimeToLive",
971 reason: "value must be greater than or equal to 0s",
972 }
973 if !all {
974 return err
975 }
976 errors = append(errors, err)
977 }
978
979 }
980 }
981
982 if all {
983 switch v := interface{}(m.GetRateLimitStrategy()).(type) {
984 case interface{ ValidateAll() error }:
985 if err := v.ValidateAll(); err != nil {
986 errors = append(errors, RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError{
987 field: "RateLimitStrategy",
988 reason: "embedded message failed validation",
989 cause: err,
990 })
991 }
992 case interface{ Validate() error }:
993 if err := v.Validate(); err != nil {
994 errors = append(errors, RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError{
995 field: "RateLimitStrategy",
996 reason: "embedded message failed validation",
997 cause: err,
998 })
999 }
1000 }
1001 } else if v, ok := interface{}(m.GetRateLimitStrategy()).(interface{ Validate() error }); ok {
1002 if err := v.Validate(); err != nil {
1003 return RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError{
1004 field: "RateLimitStrategy",
1005 reason: "embedded message failed validation",
1006 cause: err,
1007 }
1008 }
1009 }
1010
1011 if len(errors) > 0 {
1012 return RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionMultiError(errors)
1013 }
1014
1015 return nil
1016 }
1017
1018 // RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionMultiError is an
1019 // error wrapping multiple validation errors returned by
1020 // RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction.ValidateAll() if
1021 // the designated constraints aren't met.
1022 type RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionMultiError []error
1023
1024 // Error returns a concatenation of all the error messages it wraps.
1025 func (m RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionMultiError) Error() string {
1026 var msgs []string
1027 for _, err := range m {
1028 msgs = append(msgs, err.Error())
1029 }
1030 return strings.Join(msgs, "; ")
1031 }
1032
1033 // AllErrors returns a list of validation violation errors.
1034 func (m RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionMultiError) AllErrors() []error {
1035 return m
1036 }
1037
1038 // RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError is
1039 // the validation error returned by
1040 // RateLimitQuotaResponse_BucketAction_QuotaAssignmentAction.Validate if the
1041 // designated constraints aren't met.
1042 type RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError struct {
1043 field string
1044 reason string
1045 cause error
1046 key bool
1047 }
1048
1049 // Field function returns field value.
1050 func (e RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError) Field() string {
1051 return e.field
1052 }
1053
1054 // Reason function returns reason value.
1055 func (e RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError) Reason() string {
1056 return e.reason
1057 }
1058
1059 // Cause function returns cause value.
1060 func (e RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError) Cause() error {
1061 return e.cause
1062 }
1063
1064 // Key function returns key value.
1065 func (e RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError) Key() bool {
1066 return e.key
1067 }
1068
1069 // ErrorName returns error name.
1070 func (e RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError) ErrorName() string {
1071 return "RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError"
1072 }
1073
1074 // Error satisfies the builtin error interface
1075 func (e RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError) Error() string {
1076 cause := ""
1077 if e.cause != nil {
1078 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1079 }
1080
1081 key := ""
1082 if e.key {
1083 key = "key for "
1084 }
1085
1086 return fmt.Sprintf(
1087 "invalid %sRateLimitQuotaResponse_BucketAction_QuotaAssignmentAction.%s: %s%s",
1088 key,
1089 e.field,
1090 e.reason,
1091 cause)
1092 }
1093
1094 var _ error = RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError{}
1095
1096 var _ interface {
1097 Field() string
1098 Reason() string
1099 Key() bool
1100 Cause() error
1101 ErrorName() string
1102 } = RateLimitQuotaResponse_BucketAction_QuotaAssignmentActionValidationError{}
1103
1104 // Validate checks the field values on
1105 // RateLimitQuotaResponse_BucketAction_AbandonAction with the rules defined in
1106 // the proto definition for this message. If any rules are violated, the first
1107 // error encountered is returned, or nil if there are no violations.
1108 func (m *RateLimitQuotaResponse_BucketAction_AbandonAction) Validate() error {
1109 return m.validate(false)
1110 }
1111
1112 // ValidateAll checks the field values on
1113 // RateLimitQuotaResponse_BucketAction_AbandonAction with the rules defined in
1114 // the proto definition for this message. If any rules are violated, the
1115 // result is a list of violation errors wrapped in
1116 // RateLimitQuotaResponse_BucketAction_AbandonActionMultiError, or nil if none found.
1117 func (m *RateLimitQuotaResponse_BucketAction_AbandonAction) ValidateAll() error {
1118 return m.validate(true)
1119 }
1120
1121 func (m *RateLimitQuotaResponse_BucketAction_AbandonAction) validate(all bool) error {
1122 if m == nil {
1123 return nil
1124 }
1125
1126 var errors []error
1127
1128 if len(errors) > 0 {
1129 return RateLimitQuotaResponse_BucketAction_AbandonActionMultiError(errors)
1130 }
1131
1132 return nil
1133 }
1134
1135 // RateLimitQuotaResponse_BucketAction_AbandonActionMultiError is an error
1136 // wrapping multiple validation errors returned by
1137 // RateLimitQuotaResponse_BucketAction_AbandonAction.ValidateAll() if the
1138 // designated constraints aren't met.
1139 type RateLimitQuotaResponse_BucketAction_AbandonActionMultiError []error
1140
1141 // Error returns a concatenation of all the error messages it wraps.
1142 func (m RateLimitQuotaResponse_BucketAction_AbandonActionMultiError) Error() string {
1143 var msgs []string
1144 for _, err := range m {
1145 msgs = append(msgs, err.Error())
1146 }
1147 return strings.Join(msgs, "; ")
1148 }
1149
1150 // AllErrors returns a list of validation violation errors.
1151 func (m RateLimitQuotaResponse_BucketAction_AbandonActionMultiError) AllErrors() []error { return m }
1152
1153 // RateLimitQuotaResponse_BucketAction_AbandonActionValidationError is the
1154 // validation error returned by
1155 // RateLimitQuotaResponse_BucketAction_AbandonAction.Validate if the
1156 // designated constraints aren't met.
1157 type RateLimitQuotaResponse_BucketAction_AbandonActionValidationError struct {
1158 field string
1159 reason string
1160 cause error
1161 key bool
1162 }
1163
1164 // Field function returns field value.
1165 func (e RateLimitQuotaResponse_BucketAction_AbandonActionValidationError) Field() string {
1166 return e.field
1167 }
1168
1169 // Reason function returns reason value.
1170 func (e RateLimitQuotaResponse_BucketAction_AbandonActionValidationError) Reason() string {
1171 return e.reason
1172 }
1173
1174 // Cause function returns cause value.
1175 func (e RateLimitQuotaResponse_BucketAction_AbandonActionValidationError) Cause() error {
1176 return e.cause
1177 }
1178
1179 // Key function returns key value.
1180 func (e RateLimitQuotaResponse_BucketAction_AbandonActionValidationError) Key() bool { return e.key }
1181
1182 // ErrorName returns error name.
1183 func (e RateLimitQuotaResponse_BucketAction_AbandonActionValidationError) ErrorName() string {
1184 return "RateLimitQuotaResponse_BucketAction_AbandonActionValidationError"
1185 }
1186
1187 // Error satisfies the builtin error interface
1188 func (e RateLimitQuotaResponse_BucketAction_AbandonActionValidationError) Error() string {
1189 cause := ""
1190 if e.cause != nil {
1191 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1192 }
1193
1194 key := ""
1195 if e.key {
1196 key = "key for "
1197 }
1198
1199 return fmt.Sprintf(
1200 "invalid %sRateLimitQuotaResponse_BucketAction_AbandonAction.%s: %s%s",
1201 key,
1202 e.field,
1203 e.reason,
1204 cause)
1205 }
1206
1207 var _ error = RateLimitQuotaResponse_BucketAction_AbandonActionValidationError{}
1208
1209 var _ interface {
1210 Field() string
1211 Reason() string
1212 Key() bool
1213 Cause() error
1214 ErrorName() string
1215 } = RateLimitQuotaResponse_BucketAction_AbandonActionValidationError{}