Debian Codegraph @

envoy/config/route/v3/route_components.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/config/route/v3/route_components.proto
4
5 package routev3
6
7 import (
8 "bytes"
9 "errors"
10 "fmt"
11 "net"
12 "net/mail"
13 "net/url"
14 "regexp"
15 "sort"
16 "strings"
17 "time"
18 "unicode/utf8"
19
20 "google.golang.org/protobuf/types/known/anypb"
21
22 v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
23 )
24
25 // ensure the imports are used
26 var (
27 _ = bytes.MinRead
28 _ = errors.New("")
29 _ = fmt.Print
30 _ = utf8.UTFMax
31 _ = (*regexp.Regexp)(nil)
32 _ = (*strings.Reader)(nil)
33 _ = net.IPv4len
34 _ = time.Duration(0)
35 _ = (*url.URL)(nil)
36 _ = (*mail.Address)(nil)
37 _ = anypb.Any{}
38 _ = sort.Sort
39
40 _ = v3.RoutingPriority(0)
41 )
42
43 // Validate checks the field values on VirtualHost with the rules defined in
44 // the proto definition for this message. If any rules are violated, the first
45 // error encountered is returned, or nil if there are no violations.
46 func (m *VirtualHost) Validate() error {
47 return m.validate(false)
48 }
49
50 // ValidateAll checks the field values on VirtualHost with the rules defined in
51 // the proto definition for this message. If any rules are violated, the
52 // result is a list of violation errors wrapped in VirtualHostMultiError, or
53 // nil if none found.
54 func (m *VirtualHost) ValidateAll() error {
55 return m.validate(true)
56 }
57
58 func (m *VirtualHost) validate(all bool) error {
59 if m == nil {
60 return nil
61 }
62
63 var errors []error
64
65 if utf8.RuneCountInString(m.GetName()) < 1 {
66 err := VirtualHostValidationError{
67 field: "Name",
68 reason: "value length must be at least 1 runes",
69 }
70 if !all {
71 return err
72 }
73 errors = append(errors, err)
74 }
75
76 if len(m.GetDomains()) < 1 {
77 err := VirtualHostValidationError{
78 field: "Domains",
79 reason: "value must contain at least 1 item(s)",
80 }
81 if !all {
82 return err
83 }
84 errors = append(errors, err)
85 }
86
87 for idx, item := range m.GetDomains() {
88 _, _ = idx, item
89
90 if !_VirtualHost_Domains_Pattern.MatchString(item) {
91 err := VirtualHostValidationError{
92 field: fmt.Sprintf("Domains[%v]", idx),
93 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
94 }
95 if !all {
96 return err
97 }
98 errors = append(errors, err)
99 }
100
101 }
102
103 for idx, item := range m.GetRoutes() {
104 _, _ = idx, item
105
106 if all {
107 switch v := interface{}(item).(type) {
108 case interface{ ValidateAll() error }:
109 if err := v.ValidateAll(); err != nil {
110 errors = append(errors, VirtualHostValidationError{
111 field: fmt.Sprintf("Routes[%v]", idx),
112 reason: "embedded message failed validation",
113 cause: err,
114 })
115 }
116 case interface{ Validate() error }:
117 if err := v.Validate(); err != nil {
118 errors = append(errors, VirtualHostValidationError{
119 field: fmt.Sprintf("Routes[%v]", idx),
120 reason: "embedded message failed validation",
121 cause: err,
122 })
123 }
124 }
125 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
126 if err := v.Validate(); err != nil {
127 return VirtualHostValidationError{
128 field: fmt.Sprintf("Routes[%v]", idx),
129 reason: "embedded message failed validation",
130 cause: err,
131 }
132 }
133 }
134
135 }
136
137 if all {
138 switch v := interface{}(m.GetMatcher()).(type) {
139 case interface{ ValidateAll() error }:
140 if err := v.ValidateAll(); err != nil {
141 errors = append(errors, VirtualHostValidationError{
142 field: "Matcher",
143 reason: "embedded message failed validation",
144 cause: err,
145 })
146 }
147 case interface{ Validate() error }:
148 if err := v.Validate(); err != nil {
149 errors = append(errors, VirtualHostValidationError{
150 field: "Matcher",
151 reason: "embedded message failed validation",
152 cause: err,
153 })
154 }
155 }
156 } else if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok {
157 if err := v.Validate(); err != nil {
158 return VirtualHostValidationError{
159 field: "Matcher",
160 reason: "embedded message failed validation",
161 cause: err,
162 }
163 }
164 }
165
166 if _, ok := VirtualHost_TlsRequirementType_name[int32(m.GetRequireTls())]; !ok {
167 err := VirtualHostValidationError{
168 field: "RequireTls",
169 reason: "value must be one of the defined enum values",
170 }
171 if !all {
172 return err
173 }
174 errors = append(errors, err)
175 }
176
177 for idx, item := range m.GetVirtualClusters() {
178 _, _ = idx, item
179
180 if all {
181 switch v := interface{}(item).(type) {
182 case interface{ ValidateAll() error }:
183 if err := v.ValidateAll(); err != nil {
184 errors = append(errors, VirtualHostValidationError{
185 field: fmt.Sprintf("VirtualClusters[%v]", idx),
186 reason: "embedded message failed validation",
187 cause: err,
188 })
189 }
190 case interface{ Validate() error }:
191 if err := v.Validate(); err != nil {
192 errors = append(errors, VirtualHostValidationError{
193 field: fmt.Sprintf("VirtualClusters[%v]", idx),
194 reason: "embedded message failed validation",
195 cause: err,
196 })
197 }
198 }
199 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
200 if err := v.Validate(); err != nil {
201 return VirtualHostValidationError{
202 field: fmt.Sprintf("VirtualClusters[%v]", idx),
203 reason: "embedded message failed validation",
204 cause: err,
205 }
206 }
207 }
208
209 }
210
211 for idx, item := range m.GetRateLimits() {
212 _, _ = idx, item
213
214 if all {
215 switch v := interface{}(item).(type) {
216 case interface{ ValidateAll() error }:
217 if err := v.ValidateAll(); err != nil {
218 errors = append(errors, VirtualHostValidationError{
219 field: fmt.Sprintf("RateLimits[%v]", idx),
220 reason: "embedded message failed validation",
221 cause: err,
222 })
223 }
224 case interface{ Validate() error }:
225 if err := v.Validate(); err != nil {
226 errors = append(errors, VirtualHostValidationError{
227 field: fmt.Sprintf("RateLimits[%v]", idx),
228 reason: "embedded message failed validation",
229 cause: err,
230 })
231 }
232 }
233 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
234 if err := v.Validate(); err != nil {
235 return VirtualHostValidationError{
236 field: fmt.Sprintf("RateLimits[%v]", idx),
237 reason: "embedded message failed validation",
238 cause: err,
239 }
240 }
241 }
242
243 }
244
245 if len(m.GetRequestHeadersToAdd()) > 1000 {
246 err := VirtualHostValidationError{
247 field: "RequestHeadersToAdd",
248 reason: "value must contain no more than 1000 item(s)",
249 }
250 if !all {
251 return err
252 }
253 errors = append(errors, err)
254 }
255
256 for idx, item := range m.GetRequestHeadersToAdd() {
257 _, _ = idx, item
258
259 if all {
260 switch v := interface{}(item).(type) {
261 case interface{ ValidateAll() error }:
262 if err := v.ValidateAll(); err != nil {
263 errors = append(errors, VirtualHostValidationError{
264 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
265 reason: "embedded message failed validation",
266 cause: err,
267 })
268 }
269 case interface{ Validate() error }:
270 if err := v.Validate(); err != nil {
271 errors = append(errors, VirtualHostValidationError{
272 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
273 reason: "embedded message failed validation",
274 cause: err,
275 })
276 }
277 }
278 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
279 if err := v.Validate(); err != nil {
280 return VirtualHostValidationError{
281 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
282 reason: "embedded message failed validation",
283 cause: err,
284 }
285 }
286 }
287
288 }
289
290 for idx, item := range m.GetRequestHeadersToRemove() {
291 _, _ = idx, item
292
293 if utf8.RuneCountInString(item) < 1 {
294 err := VirtualHostValidationError{
295 field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx),
296 reason: "value length must be at least 1 runes",
297 }
298 if !all {
299 return err
300 }
301 errors = append(errors, err)
302 }
303
304 if !_VirtualHost_RequestHeadersToRemove_Pattern.MatchString(item) {
305 err := VirtualHostValidationError{
306 field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx),
307 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
308 }
309 if !all {
310 return err
311 }
312 errors = append(errors, err)
313 }
314
315 }
316
317 if len(m.GetResponseHeadersToAdd()) > 1000 {
318 err := VirtualHostValidationError{
319 field: "ResponseHeadersToAdd",
320 reason: "value must contain no more than 1000 item(s)",
321 }
322 if !all {
323 return err
324 }
325 errors = append(errors, err)
326 }
327
328 for idx, item := range m.GetResponseHeadersToAdd() {
329 _, _ = idx, item
330
331 if all {
332 switch v := interface{}(item).(type) {
333 case interface{ ValidateAll() error }:
334 if err := v.ValidateAll(); err != nil {
335 errors = append(errors, VirtualHostValidationError{
336 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
337 reason: "embedded message failed validation",
338 cause: err,
339 })
340 }
341 case interface{ Validate() error }:
342 if err := v.Validate(); err != nil {
343 errors = append(errors, VirtualHostValidationError{
344 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
345 reason: "embedded message failed validation",
346 cause: err,
347 })
348 }
349 }
350 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
351 if err := v.Validate(); err != nil {
352 return VirtualHostValidationError{
353 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
354 reason: "embedded message failed validation",
355 cause: err,
356 }
357 }
358 }
359
360 }
361
362 for idx, item := range m.GetResponseHeadersToRemove() {
363 _, _ = idx, item
364
365 if utf8.RuneCountInString(item) < 1 {
366 err := VirtualHostValidationError{
367 field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx),
368 reason: "value length must be at least 1 runes",
369 }
370 if !all {
371 return err
372 }
373 errors = append(errors, err)
374 }
375
376 if !_VirtualHost_ResponseHeadersToRemove_Pattern.MatchString(item) {
377 err := VirtualHostValidationError{
378 field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx),
379 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
380 }
381 if !all {
382 return err
383 }
384 errors = append(errors, err)
385 }
386
387 }
388
389 if all {
390 switch v := interface{}(m.GetCors()).(type) {
391 case interface{ ValidateAll() error }:
392 if err := v.ValidateAll(); err != nil {
393 errors = append(errors, VirtualHostValidationError{
394 field: "Cors",
395 reason: "embedded message failed validation",
396 cause: err,
397 })
398 }
399 case interface{ Validate() error }:
400 if err := v.Validate(); err != nil {
401 errors = append(errors, VirtualHostValidationError{
402 field: "Cors",
403 reason: "embedded message failed validation",
404 cause: err,
405 })
406 }
407 }
408 } else if v, ok := interface{}(m.GetCors()).(interface{ Validate() error }); ok {
409 if err := v.Validate(); err != nil {
410 return VirtualHostValidationError{
411 field: "Cors",
412 reason: "embedded message failed validation",
413 cause: err,
414 }
415 }
416 }
417
418 {
419 sorted_keys := make([]string, len(m.GetTypedPerFilterConfig()))
420 i := 0
421 for key := range m.GetTypedPerFilterConfig() {
422 sorted_keys[i] = key
423 i++
424 }
425 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
426 for _, key := range sorted_keys {
427 val := m.GetTypedPerFilterConfig()[key]
428 _ = val
429
430 // no validation rules for TypedPerFilterConfig[key]
431
432 if all {
433 switch v := interface{}(val).(type) {
434 case interface{ ValidateAll() error }:
435 if err := v.ValidateAll(); err != nil {
436 errors = append(errors, VirtualHostValidationError{
437 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key),
438 reason: "embedded message failed validation",
439 cause: err,
440 })
441 }
442 case interface{ Validate() error }:
443 if err := v.Validate(); err != nil {
444 errors = append(errors, VirtualHostValidationError{
445 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key),
446 reason: "embedded message failed validation",
447 cause: err,
448 })
449 }
450 }
451 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
452 if err := v.Validate(); err != nil {
453 return VirtualHostValidationError{
454 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key),
455 reason: "embedded message failed validation",
456 cause: err,
457 }
458 }
459 }
460
461 }
462 }
463
464 // no validation rules for IncludeRequestAttemptCount
465
466 // no validation rules for IncludeAttemptCountInResponse
467
468 if all {
469 switch v := interface{}(m.GetRetryPolicy()).(type) {
470 case interface{ ValidateAll() error }:
471 if err := v.ValidateAll(); err != nil {
472 errors = append(errors, VirtualHostValidationError{
473 field: "RetryPolicy",
474 reason: "embedded message failed validation",
475 cause: err,
476 })
477 }
478 case interface{ Validate() error }:
479 if err := v.Validate(); err != nil {
480 errors = append(errors, VirtualHostValidationError{
481 field: "RetryPolicy",
482 reason: "embedded message failed validation",
483 cause: err,
484 })
485 }
486 }
487 } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok {
488 if err := v.Validate(); err != nil {
489 return VirtualHostValidationError{
490 field: "RetryPolicy",
491 reason: "embedded message failed validation",
492 cause: err,
493 }
494 }
495 }
496
497 if all {
498 switch v := interface{}(m.GetRetryPolicyTypedConfig()).(type) {
499 case interface{ ValidateAll() error }:
500 if err := v.ValidateAll(); err != nil {
501 errors = append(errors, VirtualHostValidationError{
502 field: "RetryPolicyTypedConfig",
503 reason: "embedded message failed validation",
504 cause: err,
505 })
506 }
507 case interface{ Validate() error }:
508 if err := v.Validate(); err != nil {
509 errors = append(errors, VirtualHostValidationError{
510 field: "RetryPolicyTypedConfig",
511 reason: "embedded message failed validation",
512 cause: err,
513 })
514 }
515 }
516 } else if v, ok := interface{}(m.GetRetryPolicyTypedConfig()).(interface{ Validate() error }); ok {
517 if err := v.Validate(); err != nil {
518 return VirtualHostValidationError{
519 field: "RetryPolicyTypedConfig",
520 reason: "embedded message failed validation",
521 cause: err,
522 }
523 }
524 }
525
526 if all {
527 switch v := interface{}(m.GetHedgePolicy()).(type) {
528 case interface{ ValidateAll() error }:
529 if err := v.ValidateAll(); err != nil {
530 errors = append(errors, VirtualHostValidationError{
531 field: "HedgePolicy",
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, VirtualHostValidationError{
539 field: "HedgePolicy",
540 reason: "embedded message failed validation",
541 cause: err,
542 })
543 }
544 }
545 } else if v, ok := interface{}(m.GetHedgePolicy()).(interface{ Validate() error }); ok {
546 if err := v.Validate(); err != nil {
547 return VirtualHostValidationError{
548 field: "HedgePolicy",
549 reason: "embedded message failed validation",
550 cause: err,
551 }
552 }
553 }
554
555 // no validation rules for IncludeIsTimeoutRetryHeader
556
557 if all {
558 switch v := interface{}(m.GetPerRequestBufferLimitBytes()).(type) {
559 case interface{ ValidateAll() error }:
560 if err := v.ValidateAll(); err != nil {
561 errors = append(errors, VirtualHostValidationError{
562 field: "PerRequestBufferLimitBytes",
563 reason: "embedded message failed validation",
564 cause: err,
565 })
566 }
567 case interface{ Validate() error }:
568 if err := v.Validate(); err != nil {
569 errors = append(errors, VirtualHostValidationError{
570 field: "PerRequestBufferLimitBytes",
571 reason: "embedded message failed validation",
572 cause: err,
573 })
574 }
575 }
576 } else if v, ok := interface{}(m.GetPerRequestBufferLimitBytes()).(interface{ Validate() error }); ok {
577 if err := v.Validate(); err != nil {
578 return VirtualHostValidationError{
579 field: "PerRequestBufferLimitBytes",
580 reason: "embedded message failed validation",
581 cause: err,
582 }
583 }
584 }
585
586 for idx, item := range m.GetRequestMirrorPolicies() {
587 _, _ = idx, item
588
589 if all {
590 switch v := interface{}(item).(type) {
591 case interface{ ValidateAll() error }:
592 if err := v.ValidateAll(); err != nil {
593 errors = append(errors, VirtualHostValidationError{
594 field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx),
595 reason: "embedded message failed validation",
596 cause: err,
597 })
598 }
599 case interface{ Validate() error }:
600 if err := v.Validate(); err != nil {
601 errors = append(errors, VirtualHostValidationError{
602 field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx),
603 reason: "embedded message failed validation",
604 cause: err,
605 })
606 }
607 }
608 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
609 if err := v.Validate(); err != nil {
610 return VirtualHostValidationError{
611 field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx),
612 reason: "embedded message failed validation",
613 cause: err,
614 }
615 }
616 }
617
618 }
619
620 if all {
621 switch v := interface{}(m.GetMetadata()).(type) {
622 case interface{ ValidateAll() error }:
623 if err := v.ValidateAll(); err != nil {
624 errors = append(errors, VirtualHostValidationError{
625 field: "Metadata",
626 reason: "embedded message failed validation",
627 cause: err,
628 })
629 }
630 case interface{ Validate() error }:
631 if err := v.Validate(); err != nil {
632 errors = append(errors, VirtualHostValidationError{
633 field: "Metadata",
634 reason: "embedded message failed validation",
635 cause: err,
636 })
637 }
638 }
639 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
640 if err := v.Validate(); err != nil {
641 return VirtualHostValidationError{
642 field: "Metadata",
643 reason: "embedded message failed validation",
644 cause: err,
645 }
646 }
647 }
648
649 if len(errors) > 0 {
650 return VirtualHostMultiError(errors)
651 }
652
653 return nil
654 }
655
656 // VirtualHostMultiError is an error wrapping multiple validation errors
657 // returned by VirtualHost.ValidateAll() if the designated constraints aren't met.
658 type VirtualHostMultiError []error
659
660 // Error returns a concatenation of all the error messages it wraps.
661 func (m VirtualHostMultiError) Error() string {
662 var msgs []string
663 for _, err := range m {
664 msgs = append(msgs, err.Error())
665 }
666 return strings.Join(msgs, "; ")
667 }
668
669 // AllErrors returns a list of validation violation errors.
670 func (m VirtualHostMultiError) AllErrors() []error { return m }
671
672 // VirtualHostValidationError is the validation error returned by
673 // VirtualHost.Validate if the designated constraints aren't met.
674 type VirtualHostValidationError struct {
675 field string
676 reason string
677 cause error
678 key bool
679 }
680
681 // Field function returns field value.
682 func (e VirtualHostValidationError) Field() string { return e.field }
683
684 // Reason function returns reason value.
685 func (e VirtualHostValidationError) Reason() string { return e.reason }
686
687 // Cause function returns cause value.
688 func (e VirtualHostValidationError) Cause() error { return e.cause }
689
690 // Key function returns key value.
691 func (e VirtualHostValidationError) Key() bool { return e.key }
692
693 // ErrorName returns error name.
694 func (e VirtualHostValidationError) ErrorName() string { return "VirtualHostValidationError" }
695
696 // Error satisfies the builtin error interface
697 func (e VirtualHostValidationError) Error() string {
698 cause := ""
699 if e.cause != nil {
700 cause = fmt.Sprintf(" | caused by: %v", e.cause)
701 }
702
703 key := ""
704 if e.key {
705 key = "key for "
706 }
707
708 return fmt.Sprintf(
709 "invalid %sVirtualHost.%s: %s%s",
710 key,
711 e.field,
712 e.reason,
713 cause)
714 }
715
716 var _ error = VirtualHostValidationError{}
717
718 var _ interface {
719 Field() string
720 Reason() string
721 Key() bool
722 Cause() error
723 ErrorName() string
724 } = VirtualHostValidationError{}
725
726 var _VirtualHost_Domains_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
727
728 var _VirtualHost_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
729
730 var _VirtualHost_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
731
732 // Validate checks the field values on FilterAction with the rules defined in
733 // the proto definition for this message. If any rules are violated, the first
734 // error encountered is returned, or nil if there are no violations.
735 func (m *FilterAction) Validate() error {
736 return m.validate(false)
737 }
738
739 // ValidateAll checks the field values on FilterAction with the rules defined
740 // in the proto definition for this message. If any rules are violated, the
741 // result is a list of violation errors wrapped in FilterActionMultiError, or
742 // nil if none found.
743 func (m *FilterAction) ValidateAll() error {
744 return m.validate(true)
745 }
746
747 func (m *FilterAction) validate(all bool) error {
748 if m == nil {
749 return nil
750 }
751
752 var errors []error
753
754 if all {
755 switch v := interface{}(m.GetAction()).(type) {
756 case interface{ ValidateAll() error }:
757 if err := v.ValidateAll(); err != nil {
758 errors = append(errors, FilterActionValidationError{
759 field: "Action",
760 reason: "embedded message failed validation",
761 cause: err,
762 })
763 }
764 case interface{ Validate() error }:
765 if err := v.Validate(); err != nil {
766 errors = append(errors, FilterActionValidationError{
767 field: "Action",
768 reason: "embedded message failed validation",
769 cause: err,
770 })
771 }
772 }
773 } else if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok {
774 if err := v.Validate(); err != nil {
775 return FilterActionValidationError{
776 field: "Action",
777 reason: "embedded message failed validation",
778 cause: err,
779 }
780 }
781 }
782
783 if len(errors) > 0 {
784 return FilterActionMultiError(errors)
785 }
786
787 return nil
788 }
789
790 // FilterActionMultiError is an error wrapping multiple validation errors
791 // returned by FilterAction.ValidateAll() if the designated constraints aren't met.
792 type FilterActionMultiError []error
793
794 // Error returns a concatenation of all the error messages it wraps.
795 func (m FilterActionMultiError) Error() string {
796 var msgs []string
797 for _, err := range m {
798 msgs = append(msgs, err.Error())
799 }
800 return strings.Join(msgs, "; ")
801 }
802
803 // AllErrors returns a list of validation violation errors.
804 func (m FilterActionMultiError) AllErrors() []error { return m }
805
806 // FilterActionValidationError is the validation error returned by
807 // FilterAction.Validate if the designated constraints aren't met.
808 type FilterActionValidationError struct {
809 field string
810 reason string
811 cause error
812 key bool
813 }
814
815 // Field function returns field value.
816 func (e FilterActionValidationError) Field() string { return e.field }
817
818 // Reason function returns reason value.
819 func (e FilterActionValidationError) Reason() string { return e.reason }
820
821 // Cause function returns cause value.
822 func (e FilterActionValidationError) Cause() error { return e.cause }
823
824 // Key function returns key value.
825 func (e FilterActionValidationError) Key() bool { return e.key }
826
827 // ErrorName returns error name.
828 func (e FilterActionValidationError) ErrorName() string { return "FilterActionValidationError" }
829
830 // Error satisfies the builtin error interface
831 func (e FilterActionValidationError) Error() string {
832 cause := ""
833 if e.cause != nil {
834 cause = fmt.Sprintf(" | caused by: %v", e.cause)
835 }
836
837 key := ""
838 if e.key {
839 key = "key for "
840 }
841
842 return fmt.Sprintf(
843 "invalid %sFilterAction.%s: %s%s",
844 key,
845 e.field,
846 e.reason,
847 cause)
848 }
849
850 var _ error = FilterActionValidationError{}
851
852 var _ interface {
853 Field() string
854 Reason() string
855 Key() bool
856 Cause() error
857 ErrorName() string
858 } = FilterActionValidationError{}
859
860 // Validate checks the field values on RouteList with the rules defined in the
861 // proto definition for this message. If any rules are violated, the first
862 // error encountered is returned, or nil if there are no violations.
863 func (m *RouteList) Validate() error {
864 return m.validate(false)
865 }
866
867 // ValidateAll checks the field values on RouteList with the rules defined in
868 // the proto definition for this message. If any rules are violated, the
869 // result is a list of violation errors wrapped in RouteListMultiError, or nil
870 // if none found.
871 func (m *RouteList) ValidateAll() error {
872 return m.validate(true)
873 }
874
875 func (m *RouteList) validate(all bool) error {
876 if m == nil {
877 return nil
878 }
879
880 var errors []error
881
882 for idx, item := range m.GetRoutes() {
883 _, _ = idx, item
884
885 if all {
886 switch v := interface{}(item).(type) {
887 case interface{ ValidateAll() error }:
888 if err := v.ValidateAll(); err != nil {
889 errors = append(errors, RouteListValidationError{
890 field: fmt.Sprintf("Routes[%v]", idx),
891 reason: "embedded message failed validation",
892 cause: err,
893 })
894 }
895 case interface{ Validate() error }:
896 if err := v.Validate(); err != nil {
897 errors = append(errors, RouteListValidationError{
898 field: fmt.Sprintf("Routes[%v]", idx),
899 reason: "embedded message failed validation",
900 cause: err,
901 })
902 }
903 }
904 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
905 if err := v.Validate(); err != nil {
906 return RouteListValidationError{
907 field: fmt.Sprintf("Routes[%v]", idx),
908 reason: "embedded message failed validation",
909 cause: err,
910 }
911 }
912 }
913
914 }
915
916 if len(errors) > 0 {
917 return RouteListMultiError(errors)
918 }
919
920 return nil
921 }
922
923 // RouteListMultiError is an error wrapping multiple validation errors returned
924 // by RouteList.ValidateAll() if the designated constraints aren't met.
925 type RouteListMultiError []error
926
927 // Error returns a concatenation of all the error messages it wraps.
928 func (m RouteListMultiError) Error() string {
929 var msgs []string
930 for _, err := range m {
931 msgs = append(msgs, err.Error())
932 }
933 return strings.Join(msgs, "; ")
934 }
935
936 // AllErrors returns a list of validation violation errors.
937 func (m RouteListMultiError) AllErrors() []error { return m }
938
939 // RouteListValidationError is the validation error returned by
940 // RouteList.Validate if the designated constraints aren't met.
941 type RouteListValidationError struct {
942 field string
943 reason string
944 cause error
945 key bool
946 }
947
948 // Field function returns field value.
949 func (e RouteListValidationError) Field() string { return e.field }
950
951 // Reason function returns reason value.
952 func (e RouteListValidationError) Reason() string { return e.reason }
953
954 // Cause function returns cause value.
955 func (e RouteListValidationError) Cause() error { return e.cause }
956
957 // Key function returns key value.
958 func (e RouteListValidationError) Key() bool { return e.key }
959
960 // ErrorName returns error name.
961 func (e RouteListValidationError) ErrorName() string { return "RouteListValidationError" }
962
963 // Error satisfies the builtin error interface
964 func (e RouteListValidationError) Error() string {
965 cause := ""
966 if e.cause != nil {
967 cause = fmt.Sprintf(" | caused by: %v", e.cause)
968 }
969
970 key := ""
971 if e.key {
972 key = "key for "
973 }
974
975 return fmt.Sprintf(
976 "invalid %sRouteList.%s: %s%s",
977 key,
978 e.field,
979 e.reason,
980 cause)
981 }
982
983 var _ error = RouteListValidationError{}
984
985 var _ interface {
986 Field() string
987 Reason() string
988 Key() bool
989 Cause() error
990 ErrorName() string
991 } = RouteListValidationError{}
992
993 // Validate checks the field values on Route with the rules defined in the
994 // proto definition for this message. If any rules are violated, the first
995 // error encountered is returned, or nil if there are no violations.
996 func (m *Route) Validate() error {
997 return m.validate(false)
998 }
999
1000 // ValidateAll checks the field values on Route with the rules defined in the
1001 // proto definition for this message. If any rules are violated, the result is
1002 // a list of violation errors wrapped in RouteMultiError, or nil if none found.
1003 func (m *Route) ValidateAll() error {
1004 return m.validate(true)
1005 }
1006
1007 func (m *Route) validate(all bool) error {
1008 if m == nil {
1009 return nil
1010 }
1011
1012 var errors []error
1013
1014 // no validation rules for Name
1015
1016 if m.GetMatch() == nil {
1017 err := RouteValidationError{
1018 field: "Match",
1019 reason: "value is required",
1020 }
1021 if !all {
1022 return err
1023 }
1024 errors = append(errors, err)
1025 }
1026
1027 if all {
1028 switch v := interface{}(m.GetMatch()).(type) {
1029 case interface{ ValidateAll() error }:
1030 if err := v.ValidateAll(); err != nil {
1031 errors = append(errors, RouteValidationError{
1032 field: "Match",
1033 reason: "embedded message failed validation",
1034 cause: err,
1035 })
1036 }
1037 case interface{ Validate() error }:
1038 if err := v.Validate(); err != nil {
1039 errors = append(errors, RouteValidationError{
1040 field: "Match",
1041 reason: "embedded message failed validation",
1042 cause: err,
1043 })
1044 }
1045 }
1046 } else if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok {
1047 if err := v.Validate(); err != nil {
1048 return RouteValidationError{
1049 field: "Match",
1050 reason: "embedded message failed validation",
1051 cause: err,
1052 }
1053 }
1054 }
1055
1056 if all {
1057 switch v := interface{}(m.GetMetadata()).(type) {
1058 case interface{ ValidateAll() error }:
1059 if err := v.ValidateAll(); err != nil {
1060 errors = append(errors, RouteValidationError{
1061 field: "Metadata",
1062 reason: "embedded message failed validation",
1063 cause: err,
1064 })
1065 }
1066 case interface{ Validate() error }:
1067 if err := v.Validate(); err != nil {
1068 errors = append(errors, RouteValidationError{
1069 field: "Metadata",
1070 reason: "embedded message failed validation",
1071 cause: err,
1072 })
1073 }
1074 }
1075 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
1076 if err := v.Validate(); err != nil {
1077 return RouteValidationError{
1078 field: "Metadata",
1079 reason: "embedded message failed validation",
1080 cause: err,
1081 }
1082 }
1083 }
1084
1085 if all {
1086 switch v := interface{}(m.GetDecorator()).(type) {
1087 case interface{ ValidateAll() error }:
1088 if err := v.ValidateAll(); err != nil {
1089 errors = append(errors, RouteValidationError{
1090 field: "Decorator",
1091 reason: "embedded message failed validation",
1092 cause: err,
1093 })
1094 }
1095 case interface{ Validate() error }:
1096 if err := v.Validate(); err != nil {
1097 errors = append(errors, RouteValidationError{
1098 field: "Decorator",
1099 reason: "embedded message failed validation",
1100 cause: err,
1101 })
1102 }
1103 }
1104 } else if v, ok := interface{}(m.GetDecorator()).(interface{ Validate() error }); ok {
1105 if err := v.Validate(); err != nil {
1106 return RouteValidationError{
1107 field: "Decorator",
1108 reason: "embedded message failed validation",
1109 cause: err,
1110 }
1111 }
1112 }
1113
1114 {
1115 sorted_keys := make([]string, len(m.GetTypedPerFilterConfig()))
1116 i := 0
1117 for key := range m.GetTypedPerFilterConfig() {
1118 sorted_keys[i] = key
1119 i++
1120 }
1121 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
1122 for _, key := range sorted_keys {
1123 val := m.GetTypedPerFilterConfig()[key]
1124 _ = val
1125
1126 // no validation rules for TypedPerFilterConfig[key]
1127
1128 if all {
1129 switch v := interface{}(val).(type) {
1130 case interface{ ValidateAll() error }:
1131 if err := v.ValidateAll(); err != nil {
1132 errors = append(errors, RouteValidationError{
1133 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key),
1134 reason: "embedded message failed validation",
1135 cause: err,
1136 })
1137 }
1138 case interface{ Validate() error }:
1139 if err := v.Validate(); err != nil {
1140 errors = append(errors, RouteValidationError{
1141 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key),
1142 reason: "embedded message failed validation",
1143 cause: err,
1144 })
1145 }
1146 }
1147 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
1148 if err := v.Validate(); err != nil {
1149 return RouteValidationError{
1150 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key),
1151 reason: "embedded message failed validation",
1152 cause: err,
1153 }
1154 }
1155 }
1156
1157 }
1158 }
1159
1160 if len(m.GetRequestHeadersToAdd()) > 1000 {
1161 err := RouteValidationError{
1162 field: "RequestHeadersToAdd",
1163 reason: "value must contain no more than 1000 item(s)",
1164 }
1165 if !all {
1166 return err
1167 }
1168 errors = append(errors, err)
1169 }
1170
1171 for idx, item := range m.GetRequestHeadersToAdd() {
1172 _, _ = idx, item
1173
1174 if all {
1175 switch v := interface{}(item).(type) {
1176 case interface{ ValidateAll() error }:
1177 if err := v.ValidateAll(); err != nil {
1178 errors = append(errors, RouteValidationError{
1179 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
1180 reason: "embedded message failed validation",
1181 cause: err,
1182 })
1183 }
1184 case interface{ Validate() error }:
1185 if err := v.Validate(); err != nil {
1186 errors = append(errors, RouteValidationError{
1187 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
1188 reason: "embedded message failed validation",
1189 cause: err,
1190 })
1191 }
1192 }
1193 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1194 if err := v.Validate(); err != nil {
1195 return RouteValidationError{
1196 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
1197 reason: "embedded message failed validation",
1198 cause: err,
1199 }
1200 }
1201 }
1202
1203 }
1204
1205 for idx, item := range m.GetRequestHeadersToRemove() {
1206 _, _ = idx, item
1207
1208 if utf8.RuneCountInString(item) < 1 {
1209 err := RouteValidationError{
1210 field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx),
1211 reason: "value length must be at least 1 runes",
1212 }
1213 if !all {
1214 return err
1215 }
1216 errors = append(errors, err)
1217 }
1218
1219 if !_Route_RequestHeadersToRemove_Pattern.MatchString(item) {
1220 err := RouteValidationError{
1221 field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx),
1222 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
1223 }
1224 if !all {
1225 return err
1226 }
1227 errors = append(errors, err)
1228 }
1229
1230 }
1231
1232 if len(m.GetResponseHeadersToAdd()) > 1000 {
1233 err := RouteValidationError{
1234 field: "ResponseHeadersToAdd",
1235 reason: "value must contain no more than 1000 item(s)",
1236 }
1237 if !all {
1238 return err
1239 }
1240 errors = append(errors, err)
1241 }
1242
1243 for idx, item := range m.GetResponseHeadersToAdd() {
1244 _, _ = idx, item
1245
1246 if all {
1247 switch v := interface{}(item).(type) {
1248 case interface{ ValidateAll() error }:
1249 if err := v.ValidateAll(); err != nil {
1250 errors = append(errors, RouteValidationError{
1251 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
1252 reason: "embedded message failed validation",
1253 cause: err,
1254 })
1255 }
1256 case interface{ Validate() error }:
1257 if err := v.Validate(); err != nil {
1258 errors = append(errors, RouteValidationError{
1259 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
1260 reason: "embedded message failed validation",
1261 cause: err,
1262 })
1263 }
1264 }
1265 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1266 if err := v.Validate(); err != nil {
1267 return RouteValidationError{
1268 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
1269 reason: "embedded message failed validation",
1270 cause: err,
1271 }
1272 }
1273 }
1274
1275 }
1276
1277 for idx, item := range m.GetResponseHeadersToRemove() {
1278 _, _ = idx, item
1279
1280 if utf8.RuneCountInString(item) < 1 {
1281 err := RouteValidationError{
1282 field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx),
1283 reason: "value length must be at least 1 runes",
1284 }
1285 if !all {
1286 return err
1287 }
1288 errors = append(errors, err)
1289 }
1290
1291 if !_Route_ResponseHeadersToRemove_Pattern.MatchString(item) {
1292 err := RouteValidationError{
1293 field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx),
1294 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
1295 }
1296 if !all {
1297 return err
1298 }
1299 errors = append(errors, err)
1300 }
1301
1302 }
1303
1304 if all {
1305 switch v := interface{}(m.GetTracing()).(type) {
1306 case interface{ ValidateAll() error }:
1307 if err := v.ValidateAll(); err != nil {
1308 errors = append(errors, RouteValidationError{
1309 field: "Tracing",
1310 reason: "embedded message failed validation",
1311 cause: err,
1312 })
1313 }
1314 case interface{ Validate() error }:
1315 if err := v.Validate(); err != nil {
1316 errors = append(errors, RouteValidationError{
1317 field: "Tracing",
1318 reason: "embedded message failed validation",
1319 cause: err,
1320 })
1321 }
1322 }
1323 } else if v, ok := interface{}(m.GetTracing()).(interface{ Validate() error }); ok {
1324 if err := v.Validate(); err != nil {
1325 return RouteValidationError{
1326 field: "Tracing",
1327 reason: "embedded message failed validation",
1328 cause: err,
1329 }
1330 }
1331 }
1332
1333 if all {
1334 switch v := interface{}(m.GetPerRequestBufferLimitBytes()).(type) {
1335 case interface{ ValidateAll() error }:
1336 if err := v.ValidateAll(); err != nil {
1337 errors = append(errors, RouteValidationError{
1338 field: "PerRequestBufferLimitBytes",
1339 reason: "embedded message failed validation",
1340 cause: err,
1341 })
1342 }
1343 case interface{ Validate() error }:
1344 if err := v.Validate(); err != nil {
1345 errors = append(errors, RouteValidationError{
1346 field: "PerRequestBufferLimitBytes",
1347 reason: "embedded message failed validation",
1348 cause: err,
1349 })
1350 }
1351 }
1352 } else if v, ok := interface{}(m.GetPerRequestBufferLimitBytes()).(interface{ Validate() error }); ok {
1353 if err := v.Validate(); err != nil {
1354 return RouteValidationError{
1355 field: "PerRequestBufferLimitBytes",
1356 reason: "embedded message failed validation",
1357 cause: err,
1358 }
1359 }
1360 }
1361
1362 // no validation rules for StatPrefix
1363
1364 oneofActionPresent := false
1365 switch v := m.Action.(type) {
1366 case *Route_Route:
1367 if v == nil {
1368 err := RouteValidationError{
1369 field: "Action",
1370 reason: "oneof value cannot be a typed-nil",
1371 }
1372 if !all {
1373 return err
1374 }
1375 errors = append(errors, err)
1376 }
1377 oneofActionPresent = true
1378
1379 if all {
1380 switch v := interface{}(m.GetRoute()).(type) {
1381 case interface{ ValidateAll() error }:
1382 if err := v.ValidateAll(); err != nil {
1383 errors = append(errors, RouteValidationError{
1384 field: "Route",
1385 reason: "embedded message failed validation",
1386 cause: err,
1387 })
1388 }
1389 case interface{ Validate() error }:
1390 if err := v.Validate(); err != nil {
1391 errors = append(errors, RouteValidationError{
1392 field: "Route",
1393 reason: "embedded message failed validation",
1394 cause: err,
1395 })
1396 }
1397 }
1398 } else if v, ok := interface{}(m.GetRoute()).(interface{ Validate() error }); ok {
1399 if err := v.Validate(); err != nil {
1400 return RouteValidationError{
1401 field: "Route",
1402 reason: "embedded message failed validation",
1403 cause: err,
1404 }
1405 }
1406 }
1407
1408 case *Route_Redirect:
1409 if v == nil {
1410 err := RouteValidationError{
1411 field: "Action",
1412 reason: "oneof value cannot be a typed-nil",
1413 }
1414 if !all {
1415 return err
1416 }
1417 errors = append(errors, err)
1418 }
1419 oneofActionPresent = true
1420
1421 if all {
1422 switch v := interface{}(m.GetRedirect()).(type) {
1423 case interface{ ValidateAll() error }:
1424 if err := v.ValidateAll(); err != nil {
1425 errors = append(errors, RouteValidationError{
1426 field: "Redirect",
1427 reason: "embedded message failed validation",
1428 cause: err,
1429 })
1430 }
1431 case interface{ Validate() error }:
1432 if err := v.Validate(); err != nil {
1433 errors = append(errors, RouteValidationError{
1434 field: "Redirect",
1435 reason: "embedded message failed validation",
1436 cause: err,
1437 })
1438 }
1439 }
1440 } else if v, ok := interface{}(m.GetRedirect()).(interface{ Validate() error }); ok {
1441 if err := v.Validate(); err != nil {
1442 return RouteValidationError{
1443 field: "Redirect",
1444 reason: "embedded message failed validation",
1445 cause: err,
1446 }
1447 }
1448 }
1449
1450 case *Route_DirectResponse:
1451 if v == nil {
1452 err := RouteValidationError{
1453 field: "Action",
1454 reason: "oneof value cannot be a typed-nil",
1455 }
1456 if !all {
1457 return err
1458 }
1459 errors = append(errors, err)
1460 }
1461 oneofActionPresent = true
1462
1463 if all {
1464 switch v := interface{}(m.GetDirectResponse()).(type) {
1465 case interface{ ValidateAll() error }:
1466 if err := v.ValidateAll(); err != nil {
1467 errors = append(errors, RouteValidationError{
1468 field: "DirectResponse",
1469 reason: "embedded message failed validation",
1470 cause: err,
1471 })
1472 }
1473 case interface{ Validate() error }:
1474 if err := v.Validate(); err != nil {
1475 errors = append(errors, RouteValidationError{
1476 field: "DirectResponse",
1477 reason: "embedded message failed validation",
1478 cause: err,
1479 })
1480 }
1481 }
1482 } else if v, ok := interface{}(m.GetDirectResponse()).(interface{ Validate() error }); ok {
1483 if err := v.Validate(); err != nil {
1484 return RouteValidationError{
1485 field: "DirectResponse",
1486 reason: "embedded message failed validation",
1487 cause: err,
1488 }
1489 }
1490 }
1491
1492 case *Route_FilterAction:
1493 if v == nil {
1494 err := RouteValidationError{
1495 field: "Action",
1496 reason: "oneof value cannot be a typed-nil",
1497 }
1498 if !all {
1499 return err
1500 }
1501 errors = append(errors, err)
1502 }
1503 oneofActionPresent = true
1504
1505 if all {
1506 switch v := interface{}(m.GetFilterAction()).(type) {
1507 case interface{ ValidateAll() error }:
1508 if err := v.ValidateAll(); err != nil {
1509 errors = append(errors, RouteValidationError{
1510 field: "FilterAction",
1511 reason: "embedded message failed validation",
1512 cause: err,
1513 })
1514 }
1515 case interface{ Validate() error }:
1516 if err := v.Validate(); err != nil {
1517 errors = append(errors, RouteValidationError{
1518 field: "FilterAction",
1519 reason: "embedded message failed validation",
1520 cause: err,
1521 })
1522 }
1523 }
1524 } else if v, ok := interface{}(m.GetFilterAction()).(interface{ Validate() error }); ok {
1525 if err := v.Validate(); err != nil {
1526 return RouteValidationError{
1527 field: "FilterAction",
1528 reason: "embedded message failed validation",
1529 cause: err,
1530 }
1531 }
1532 }
1533
1534 case *Route_NonForwardingAction:
1535 if v == nil {
1536 err := RouteValidationError{
1537 field: "Action",
1538 reason: "oneof value cannot be a typed-nil",
1539 }
1540 if !all {
1541 return err
1542 }
1543 errors = append(errors, err)
1544 }
1545 oneofActionPresent = true
1546
1547 if all {
1548 switch v := interface{}(m.GetNonForwardingAction()).(type) {
1549 case interface{ ValidateAll() error }:
1550 if err := v.ValidateAll(); err != nil {
1551 errors = append(errors, RouteValidationError{
1552 field: "NonForwardingAction",
1553 reason: "embedded message failed validation",
1554 cause: err,
1555 })
1556 }
1557 case interface{ Validate() error }:
1558 if err := v.Validate(); err != nil {
1559 errors = append(errors, RouteValidationError{
1560 field: "NonForwardingAction",
1561 reason: "embedded message failed validation",
1562 cause: err,
1563 })
1564 }
1565 }
1566 } else if v, ok := interface{}(m.GetNonForwardingAction()).(interface{ Validate() error }); ok {
1567 if err := v.Validate(); err != nil {
1568 return RouteValidationError{
1569 field: "NonForwardingAction",
1570 reason: "embedded message failed validation",
1571 cause: err,
1572 }
1573 }
1574 }
1575
1576 default:
1577 _ = v // ensures v is used
1578 }
1579 if !oneofActionPresent {
1580 err := RouteValidationError{
1581 field: "Action",
1582 reason: "value is required",
1583 }
1584 if !all {
1585 return err
1586 }
1587 errors = append(errors, err)
1588 }
1589
1590 if len(errors) > 0 {
1591 return RouteMultiError(errors)
1592 }
1593
1594 return nil
1595 }
1596
1597 // RouteMultiError is an error wrapping multiple validation errors returned by
1598 // Route.ValidateAll() if the designated constraints aren't met.
1599 type RouteMultiError []error
1600
1601 // Error returns a concatenation of all the error messages it wraps.
1602 func (m RouteMultiError) Error() string {
1603 var msgs []string
1604 for _, err := range m {
1605 msgs = append(msgs, err.Error())
1606 }
1607 return strings.Join(msgs, "; ")
1608 }
1609
1610 // AllErrors returns a list of validation violation errors.
1611 func (m RouteMultiError) AllErrors() []error { return m }
1612
1613 // RouteValidationError is the validation error returned by Route.Validate if
1614 // the designated constraints aren't met.
1615 type RouteValidationError struct {
1616 field string
1617 reason string
1618 cause error
1619 key bool
1620 }
1621
1622 // Field function returns field value.
1623 func (e RouteValidationError) Field() string { return e.field }
1624
1625 // Reason function returns reason value.
1626 func (e RouteValidationError) Reason() string { return e.reason }
1627
1628 // Cause function returns cause value.
1629 func (e RouteValidationError) Cause() error { return e.cause }
1630
1631 // Key function returns key value.
1632 func (e RouteValidationError) Key() bool { return e.key }
1633
1634 // ErrorName returns error name.
1635 func (e RouteValidationError) ErrorName() string { return "RouteValidationError" }
1636
1637 // Error satisfies the builtin error interface
1638 func (e RouteValidationError) Error() string {
1639 cause := ""
1640 if e.cause != nil {
1641 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1642 }
1643
1644 key := ""
1645 if e.key {
1646 key = "key for "
1647 }
1648
1649 return fmt.Sprintf(
1650 "invalid %sRoute.%s: %s%s",
1651 key,
1652 e.field,
1653 e.reason,
1654 cause)
1655 }
1656
1657 var _ error = RouteValidationError{}
1658
1659 var _ interface {
1660 Field() string
1661 Reason() string
1662 Key() bool
1663 Cause() error
1664 ErrorName() string
1665 } = RouteValidationError{}
1666
1667 var _Route_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
1668
1669 var _Route_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
1670
1671 // Validate checks the field values on WeightedCluster with the rules defined
1672 // in the proto definition for this message. If any rules are violated, the
1673 // first error encountered is returned, or nil if there are no violations.
1674 func (m *WeightedCluster) Validate() error {
1675 return m.validate(false)
1676 }
1677
1678 // ValidateAll checks the field values on WeightedCluster with the rules
1679 // defined in the proto definition for this message. If any rules are
1680 // violated, the result is a list of violation errors wrapped in
1681 // WeightedClusterMultiError, or nil if none found.
1682 func (m *WeightedCluster) ValidateAll() error {
1683 return m.validate(true)
1684 }
1685
1686 func (m *WeightedCluster) validate(all bool) error {
1687 if m == nil {
1688 return nil
1689 }
1690
1691 var errors []error
1692
1693 if len(m.GetClusters()) < 1 {
1694 err := WeightedClusterValidationError{
1695 field: "Clusters",
1696 reason: "value must contain at least 1 item(s)",
1697 }
1698 if !all {
1699 return err
1700 }
1701 errors = append(errors, err)
1702 }
1703
1704 for idx, item := range m.GetClusters() {
1705 _, _ = idx, item
1706
1707 if all {
1708 switch v := interface{}(item).(type) {
1709 case interface{ ValidateAll() error }:
1710 if err := v.ValidateAll(); err != nil {
1711 errors = append(errors, WeightedClusterValidationError{
1712 field: fmt.Sprintf("Clusters[%v]", idx),
1713 reason: "embedded message failed validation",
1714 cause: err,
1715 })
1716 }
1717 case interface{ Validate() error }:
1718 if err := v.Validate(); err != nil {
1719 errors = append(errors, WeightedClusterValidationError{
1720 field: fmt.Sprintf("Clusters[%v]", idx),
1721 reason: "embedded message failed validation",
1722 cause: err,
1723 })
1724 }
1725 }
1726 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1727 if err := v.Validate(); err != nil {
1728 return WeightedClusterValidationError{
1729 field: fmt.Sprintf("Clusters[%v]", idx),
1730 reason: "embedded message failed validation",
1731 cause: err,
1732 }
1733 }
1734 }
1735
1736 }
1737
1738 if all {
1739 switch v := interface{}(m.GetTotalWeight()).(type) {
1740 case interface{ ValidateAll() error }:
1741 if err := v.ValidateAll(); err != nil {
1742 errors = append(errors, WeightedClusterValidationError{
1743 field: "TotalWeight",
1744 reason: "embedded message failed validation",
1745 cause: err,
1746 })
1747 }
1748 case interface{ Validate() error }:
1749 if err := v.Validate(); err != nil {
1750 errors = append(errors, WeightedClusterValidationError{
1751 field: "TotalWeight",
1752 reason: "embedded message failed validation",
1753 cause: err,
1754 })
1755 }
1756 }
1757 } else if v, ok := interface{}(m.GetTotalWeight()).(interface{ Validate() error }); ok {
1758 if err := v.Validate(); err != nil {
1759 return WeightedClusterValidationError{
1760 field: "TotalWeight",
1761 reason: "embedded message failed validation",
1762 cause: err,
1763 }
1764 }
1765 }
1766
1767 // no validation rules for RuntimeKeyPrefix
1768
1769 switch v := m.RandomValueSpecifier.(type) {
1770 case *WeightedCluster_HeaderName:
1771 if v == nil {
1772 err := WeightedClusterValidationError{
1773 field: "RandomValueSpecifier",
1774 reason: "oneof value cannot be a typed-nil",
1775 }
1776 if !all {
1777 return err
1778 }
1779 errors = append(errors, err)
1780 }
1781
1782 if !_WeightedCluster_HeaderName_Pattern.MatchString(m.GetHeaderName()) {
1783 err := WeightedClusterValidationError{
1784 field: "HeaderName",
1785 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
1786 }
1787 if !all {
1788 return err
1789 }
1790 errors = append(errors, err)
1791 }
1792
1793 default:
1794 _ = v // ensures v is used
1795 }
1796
1797 if len(errors) > 0 {
1798 return WeightedClusterMultiError(errors)
1799 }
1800
1801 return nil
1802 }
1803
1804 // WeightedClusterMultiError is an error wrapping multiple validation errors
1805 // returned by WeightedCluster.ValidateAll() if the designated constraints
1806 // aren't met.
1807 type WeightedClusterMultiError []error
1808
1809 // Error returns a concatenation of all the error messages it wraps.
1810 func (m WeightedClusterMultiError) Error() string {
1811 var msgs []string
1812 for _, err := range m {
1813 msgs = append(msgs, err.Error())
1814 }
1815 return strings.Join(msgs, "; ")
1816 }
1817
1818 // AllErrors returns a list of validation violation errors.
1819 func (m WeightedClusterMultiError) AllErrors() []error { return m }
1820
1821 // WeightedClusterValidationError is the validation error returned by
1822 // WeightedCluster.Validate if the designated constraints aren't met.
1823 type WeightedClusterValidationError struct {
1824 field string
1825 reason string
1826 cause error
1827 key bool
1828 }
1829
1830 // Field function returns field value.
1831 func (e WeightedClusterValidationError) Field() string { return e.field }
1832
1833 // Reason function returns reason value.
1834 func (e WeightedClusterValidationError) Reason() string { return e.reason }
1835
1836 // Cause function returns cause value.
1837 func (e WeightedClusterValidationError) Cause() error { return e.cause }
1838
1839 // Key function returns key value.
1840 func (e WeightedClusterValidationError) Key() bool { return e.key }
1841
1842 // ErrorName returns error name.
1843 func (e WeightedClusterValidationError) ErrorName() string { return "WeightedClusterValidationError" }
1844
1845 // Error satisfies the builtin error interface
1846 func (e WeightedClusterValidationError) Error() string {
1847 cause := ""
1848 if e.cause != nil {
1849 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1850 }
1851
1852 key := ""
1853 if e.key {
1854 key = "key for "
1855 }
1856
1857 return fmt.Sprintf(
1858 "invalid %sWeightedCluster.%s: %s%s",
1859 key,
1860 e.field,
1861 e.reason,
1862 cause)
1863 }
1864
1865 var _ error = WeightedClusterValidationError{}
1866
1867 var _ interface {
1868 Field() string
1869 Reason() string
1870 Key() bool
1871 Cause() error
1872 ErrorName() string
1873 } = WeightedClusterValidationError{}
1874
1875 var _WeightedCluster_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
1876
1877 // Validate checks the field values on ClusterSpecifierPlugin with the rules
1878 // defined in the proto definition for this message. If any rules are
1879 // violated, the first error encountered is returned, or nil if there are no violations.
1880 func (m *ClusterSpecifierPlugin) Validate() error {
1881 return m.validate(false)
1882 }
1883
1884 // ValidateAll checks the field values on ClusterSpecifierPlugin with the rules
1885 // defined in the proto definition for this message. If any rules are
1886 // violated, the result is a list of violation errors wrapped in
1887 // ClusterSpecifierPluginMultiError, or nil if none found.
1888 func (m *ClusterSpecifierPlugin) ValidateAll() error {
1889 return m.validate(true)
1890 }
1891
1892 func (m *ClusterSpecifierPlugin) validate(all bool) error {
1893 if m == nil {
1894 return nil
1895 }
1896
1897 var errors []error
1898
1899 if m.GetExtension() == nil {
1900 err := ClusterSpecifierPluginValidationError{
1901 field: "Extension",
1902 reason: "value is required",
1903 }
1904 if !all {
1905 return err
1906 }
1907 errors = append(errors, err)
1908 }
1909
1910 if all {
1911 switch v := interface{}(m.GetExtension()).(type) {
1912 case interface{ ValidateAll() error }:
1913 if err := v.ValidateAll(); err != nil {
1914 errors = append(errors, ClusterSpecifierPluginValidationError{
1915 field: "Extension",
1916 reason: "embedded message failed validation",
1917 cause: err,
1918 })
1919 }
1920 case interface{ Validate() error }:
1921 if err := v.Validate(); err != nil {
1922 errors = append(errors, ClusterSpecifierPluginValidationError{
1923 field: "Extension",
1924 reason: "embedded message failed validation",
1925 cause: err,
1926 })
1927 }
1928 }
1929 } else if v, ok := interface{}(m.GetExtension()).(interface{ Validate() error }); ok {
1930 if err := v.Validate(); err != nil {
1931 return ClusterSpecifierPluginValidationError{
1932 field: "Extension",
1933 reason: "embedded message failed validation",
1934 cause: err,
1935 }
1936 }
1937 }
1938
1939 // no validation rules for IsOptional
1940
1941 if len(errors) > 0 {
1942 return ClusterSpecifierPluginMultiError(errors)
1943 }
1944
1945 return nil
1946 }
1947
1948 // ClusterSpecifierPluginMultiError is an error wrapping multiple validation
1949 // errors returned by ClusterSpecifierPlugin.ValidateAll() if the designated
1950 // constraints aren't met.
1951 type ClusterSpecifierPluginMultiError []error
1952
1953 // Error returns a concatenation of all the error messages it wraps.
1954 func (m ClusterSpecifierPluginMultiError) Error() string {
1955 var msgs []string
1956 for _, err := range m {
1957 msgs = append(msgs, err.Error())
1958 }
1959 return strings.Join(msgs, "; ")
1960 }
1961
1962 // AllErrors returns a list of validation violation errors.
1963 func (m ClusterSpecifierPluginMultiError) AllErrors() []error { return m }
1964
1965 // ClusterSpecifierPluginValidationError is the validation error returned by
1966 // ClusterSpecifierPlugin.Validate if the designated constraints aren't met.
1967 type ClusterSpecifierPluginValidationError struct {
1968 field string
1969 reason string
1970 cause error
1971 key bool
1972 }
1973
1974 // Field function returns field value.
1975 func (e ClusterSpecifierPluginValidationError) Field() string { return e.field }
1976
1977 // Reason function returns reason value.
1978 func (e ClusterSpecifierPluginValidationError) Reason() string { return e.reason }
1979
1980 // Cause function returns cause value.
1981 func (e ClusterSpecifierPluginValidationError) Cause() error { return e.cause }
1982
1983 // Key function returns key value.
1984 func (e ClusterSpecifierPluginValidationError) Key() bool { return e.key }
1985
1986 // ErrorName returns error name.
1987 func (e ClusterSpecifierPluginValidationError) ErrorName() string {
1988 return "ClusterSpecifierPluginValidationError"
1989 }
1990
1991 // Error satisfies the builtin error interface
1992 func (e ClusterSpecifierPluginValidationError) Error() string {
1993 cause := ""
1994 if e.cause != nil {
1995 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1996 }
1997
1998 key := ""
1999 if e.key {
2000 key = "key for "
2001 }
2002
2003 return fmt.Sprintf(
2004 "invalid %sClusterSpecifierPlugin.%s: %s%s",
2005 key,
2006 e.field,
2007 e.reason,
2008 cause)
2009 }
2010
2011 var _ error = ClusterSpecifierPluginValidationError{}
2012
2013 var _ interface {
2014 Field() string
2015 Reason() string
2016 Key() bool
2017 Cause() error
2018 ErrorName() string
2019 } = ClusterSpecifierPluginValidationError{}
2020
2021 // Validate checks the field values on RouteMatch with the rules defined in the
2022 // proto definition for this message. If any rules are violated, the first
2023 // error encountered is returned, or nil if there are no violations.
2024 func (m *RouteMatch) Validate() error {
2025 return m.validate(false)
2026 }
2027
2028 // ValidateAll checks the field values on RouteMatch with the rules defined in
2029 // the proto definition for this message. If any rules are violated, the
2030 // result is a list of violation errors wrapped in RouteMatchMultiError, or
2031 // nil if none found.
2032 func (m *RouteMatch) ValidateAll() error {
2033 return m.validate(true)
2034 }
2035
2036 func (m *RouteMatch) validate(all bool) error {
2037 if m == nil {
2038 return nil
2039 }
2040
2041 var errors []error
2042
2043 if all {
2044 switch v := interface{}(m.GetCaseSensitive()).(type) {
2045 case interface{ ValidateAll() error }:
2046 if err := v.ValidateAll(); err != nil {
2047 errors = append(errors, RouteMatchValidationError{
2048 field: "CaseSensitive",
2049 reason: "embedded message failed validation",
2050 cause: err,
2051 })
2052 }
2053 case interface{ Validate() error }:
2054 if err := v.Validate(); err != nil {
2055 errors = append(errors, RouteMatchValidationError{
2056 field: "CaseSensitive",
2057 reason: "embedded message failed validation",
2058 cause: err,
2059 })
2060 }
2061 }
2062 } else if v, ok := interface{}(m.GetCaseSensitive()).(interface{ Validate() error }); ok {
2063 if err := v.Validate(); err != nil {
2064 return RouteMatchValidationError{
2065 field: "CaseSensitive",
2066 reason: "embedded message failed validation",
2067 cause: err,
2068 }
2069 }
2070 }
2071
2072 if all {
2073 switch v := interface{}(m.GetRuntimeFraction()).(type) {
2074 case interface{ ValidateAll() error }:
2075 if err := v.ValidateAll(); err != nil {
2076 errors = append(errors, RouteMatchValidationError{
2077 field: "RuntimeFraction",
2078 reason: "embedded message failed validation",
2079 cause: err,
2080 })
2081 }
2082 case interface{ Validate() error }:
2083 if err := v.Validate(); err != nil {
2084 errors = append(errors, RouteMatchValidationError{
2085 field: "RuntimeFraction",
2086 reason: "embedded message failed validation",
2087 cause: err,
2088 })
2089 }
2090 }
2091 } else if v, ok := interface{}(m.GetRuntimeFraction()).(interface{ Validate() error }); ok {
2092 if err := v.Validate(); err != nil {
2093 return RouteMatchValidationError{
2094 field: "RuntimeFraction",
2095 reason: "embedded message failed validation",
2096 cause: err,
2097 }
2098 }
2099 }
2100
2101 for idx, item := range m.GetHeaders() {
2102 _, _ = idx, item
2103
2104 if all {
2105 switch v := interface{}(item).(type) {
2106 case interface{ ValidateAll() error }:
2107 if err := v.ValidateAll(); err != nil {
2108 errors = append(errors, RouteMatchValidationError{
2109 field: fmt.Sprintf("Headers[%v]", idx),
2110 reason: "embedded message failed validation",
2111 cause: err,
2112 })
2113 }
2114 case interface{ Validate() error }:
2115 if err := v.Validate(); err != nil {
2116 errors = append(errors, RouteMatchValidationError{
2117 field: fmt.Sprintf("Headers[%v]", idx),
2118 reason: "embedded message failed validation",
2119 cause: err,
2120 })
2121 }
2122 }
2123 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2124 if err := v.Validate(); err != nil {
2125 return RouteMatchValidationError{
2126 field: fmt.Sprintf("Headers[%v]", idx),
2127 reason: "embedded message failed validation",
2128 cause: err,
2129 }
2130 }
2131 }
2132
2133 }
2134
2135 for idx, item := range m.GetQueryParameters() {
2136 _, _ = idx, item
2137
2138 if all {
2139 switch v := interface{}(item).(type) {
2140 case interface{ ValidateAll() error }:
2141 if err := v.ValidateAll(); err != nil {
2142 errors = append(errors, RouteMatchValidationError{
2143 field: fmt.Sprintf("QueryParameters[%v]", idx),
2144 reason: "embedded message failed validation",
2145 cause: err,
2146 })
2147 }
2148 case interface{ Validate() error }:
2149 if err := v.Validate(); err != nil {
2150 errors = append(errors, RouteMatchValidationError{
2151 field: fmt.Sprintf("QueryParameters[%v]", idx),
2152 reason: "embedded message failed validation",
2153 cause: err,
2154 })
2155 }
2156 }
2157 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2158 if err := v.Validate(); err != nil {
2159 return RouteMatchValidationError{
2160 field: fmt.Sprintf("QueryParameters[%v]", idx),
2161 reason: "embedded message failed validation",
2162 cause: err,
2163 }
2164 }
2165 }
2166
2167 }
2168
2169 if all {
2170 switch v := interface{}(m.GetGrpc()).(type) {
2171 case interface{ ValidateAll() error }:
2172 if err := v.ValidateAll(); err != nil {
2173 errors = append(errors, RouteMatchValidationError{
2174 field: "Grpc",
2175 reason: "embedded message failed validation",
2176 cause: err,
2177 })
2178 }
2179 case interface{ Validate() error }:
2180 if err := v.Validate(); err != nil {
2181 errors = append(errors, RouteMatchValidationError{
2182 field: "Grpc",
2183 reason: "embedded message failed validation",
2184 cause: err,
2185 })
2186 }
2187 }
2188 } else if v, ok := interface{}(m.GetGrpc()).(interface{ Validate() error }); ok {
2189 if err := v.Validate(); err != nil {
2190 return RouteMatchValidationError{
2191 field: "Grpc",
2192 reason: "embedded message failed validation",
2193 cause: err,
2194 }
2195 }
2196 }
2197
2198 if all {
2199 switch v := interface{}(m.GetTlsContext()).(type) {
2200 case interface{ ValidateAll() error }:
2201 if err := v.ValidateAll(); err != nil {
2202 errors = append(errors, RouteMatchValidationError{
2203 field: "TlsContext",
2204 reason: "embedded message failed validation",
2205 cause: err,
2206 })
2207 }
2208 case interface{ Validate() error }:
2209 if err := v.Validate(); err != nil {
2210 errors = append(errors, RouteMatchValidationError{
2211 field: "TlsContext",
2212 reason: "embedded message failed validation",
2213 cause: err,
2214 })
2215 }
2216 }
2217 } else if v, ok := interface{}(m.GetTlsContext()).(interface{ Validate() error }); ok {
2218 if err := v.Validate(); err != nil {
2219 return RouteMatchValidationError{
2220 field: "TlsContext",
2221 reason: "embedded message failed validation",
2222 cause: err,
2223 }
2224 }
2225 }
2226
2227 for idx, item := range m.GetDynamicMetadata() {
2228 _, _ = idx, item
2229
2230 if all {
2231 switch v := interface{}(item).(type) {
2232 case interface{ ValidateAll() error }:
2233 if err := v.ValidateAll(); err != nil {
2234 errors = append(errors, RouteMatchValidationError{
2235 field: fmt.Sprintf("DynamicMetadata[%v]", idx),
2236 reason: "embedded message failed validation",
2237 cause: err,
2238 })
2239 }
2240 case interface{ Validate() error }:
2241 if err := v.Validate(); err != nil {
2242 errors = append(errors, RouteMatchValidationError{
2243 field: fmt.Sprintf("DynamicMetadata[%v]", idx),
2244 reason: "embedded message failed validation",
2245 cause: err,
2246 })
2247 }
2248 }
2249 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2250 if err := v.Validate(); err != nil {
2251 return RouteMatchValidationError{
2252 field: fmt.Sprintf("DynamicMetadata[%v]", idx),
2253 reason: "embedded message failed validation",
2254 cause: err,
2255 }
2256 }
2257 }
2258
2259 }
2260
2261 oneofPathSpecifierPresent := false
2262 switch v := m.PathSpecifier.(type) {
2263 case *RouteMatch_Prefix:
2264 if v == nil {
2265 err := RouteMatchValidationError{
2266 field: "PathSpecifier",
2267 reason: "oneof value cannot be a typed-nil",
2268 }
2269 if !all {
2270 return err
2271 }
2272 errors = append(errors, err)
2273 }
2274 oneofPathSpecifierPresent = true
2275 // no validation rules for Prefix
2276 case *RouteMatch_Path:
2277 if v == nil {
2278 err := RouteMatchValidationError{
2279 field: "PathSpecifier",
2280 reason: "oneof value cannot be a typed-nil",
2281 }
2282 if !all {
2283 return err
2284 }
2285 errors = append(errors, err)
2286 }
2287 oneofPathSpecifierPresent = true
2288 // no validation rules for Path
2289 case *RouteMatch_SafeRegex:
2290 if v == nil {
2291 err := RouteMatchValidationError{
2292 field: "PathSpecifier",
2293 reason: "oneof value cannot be a typed-nil",
2294 }
2295 if !all {
2296 return err
2297 }
2298 errors = append(errors, err)
2299 }
2300 oneofPathSpecifierPresent = true
2301
2302 if m.GetSafeRegex() == nil {
2303 err := RouteMatchValidationError{
2304 field: "SafeRegex",
2305 reason: "value is required",
2306 }
2307 if !all {
2308 return err
2309 }
2310 errors = append(errors, err)
2311 }
2312
2313 if all {
2314 switch v := interface{}(m.GetSafeRegex()).(type) {
2315 case interface{ ValidateAll() error }:
2316 if err := v.ValidateAll(); err != nil {
2317 errors = append(errors, RouteMatchValidationError{
2318 field: "SafeRegex",
2319 reason: "embedded message failed validation",
2320 cause: err,
2321 })
2322 }
2323 case interface{ Validate() error }:
2324 if err := v.Validate(); err != nil {
2325 errors = append(errors, RouteMatchValidationError{
2326 field: "SafeRegex",
2327 reason: "embedded message failed validation",
2328 cause: err,
2329 })
2330 }
2331 }
2332 } else if v, ok := interface{}(m.GetSafeRegex()).(interface{ Validate() error }); ok {
2333 if err := v.Validate(); err != nil {
2334 return RouteMatchValidationError{
2335 field: "SafeRegex",
2336 reason: "embedded message failed validation",
2337 cause: err,
2338 }
2339 }
2340 }
2341
2342 case *RouteMatch_ConnectMatcher_:
2343 if v == nil {
2344 err := RouteMatchValidationError{
2345 field: "PathSpecifier",
2346 reason: "oneof value cannot be a typed-nil",
2347 }
2348 if !all {
2349 return err
2350 }
2351 errors = append(errors, err)
2352 }
2353 oneofPathSpecifierPresent = true
2354
2355 if all {
2356 switch v := interface{}(m.GetConnectMatcher()).(type) {
2357 case interface{ ValidateAll() error }:
2358 if err := v.ValidateAll(); err != nil {
2359 errors = append(errors, RouteMatchValidationError{
2360 field: "ConnectMatcher",
2361 reason: "embedded message failed validation",
2362 cause: err,
2363 })
2364 }
2365 case interface{ Validate() error }:
2366 if err := v.Validate(); err != nil {
2367 errors = append(errors, RouteMatchValidationError{
2368 field: "ConnectMatcher",
2369 reason: "embedded message failed validation",
2370 cause: err,
2371 })
2372 }
2373 }
2374 } else if v, ok := interface{}(m.GetConnectMatcher()).(interface{ Validate() error }); ok {
2375 if err := v.Validate(); err != nil {
2376 return RouteMatchValidationError{
2377 field: "ConnectMatcher",
2378 reason: "embedded message failed validation",
2379 cause: err,
2380 }
2381 }
2382 }
2383
2384 case *RouteMatch_PathSeparatedPrefix:
2385 if v == nil {
2386 err := RouteMatchValidationError{
2387 field: "PathSpecifier",
2388 reason: "oneof value cannot be a typed-nil",
2389 }
2390 if !all {
2391 return err
2392 }
2393 errors = append(errors, err)
2394 }
2395 oneofPathSpecifierPresent = true
2396
2397 if !_RouteMatch_PathSeparatedPrefix_Pattern.MatchString(m.GetPathSeparatedPrefix()) {
2398 err := RouteMatchValidationError{
2399 field: "PathSeparatedPrefix",
2400 reason: "value does not match regex pattern \"^[^?#]+[^?#/]$\"",
2401 }
2402 if !all {
2403 return err
2404 }
2405 errors = append(errors, err)
2406 }
2407
2408 case *RouteMatch_PathMatchPolicy:
2409 if v == nil {
2410 err := RouteMatchValidationError{
2411 field: "PathSpecifier",
2412 reason: "oneof value cannot be a typed-nil",
2413 }
2414 if !all {
2415 return err
2416 }
2417 errors = append(errors, err)
2418 }
2419 oneofPathSpecifierPresent = true
2420
2421 if all {
2422 switch v := interface{}(m.GetPathMatchPolicy()).(type) {
2423 case interface{ ValidateAll() error }:
2424 if err := v.ValidateAll(); err != nil {
2425 errors = append(errors, RouteMatchValidationError{
2426 field: "PathMatchPolicy",
2427 reason: "embedded message failed validation",
2428 cause: err,
2429 })
2430 }
2431 case interface{ Validate() error }:
2432 if err := v.Validate(); err != nil {
2433 errors = append(errors, RouteMatchValidationError{
2434 field: "PathMatchPolicy",
2435 reason: "embedded message failed validation",
2436 cause: err,
2437 })
2438 }
2439 }
2440 } else if v, ok := interface{}(m.GetPathMatchPolicy()).(interface{ Validate() error }); ok {
2441 if err := v.Validate(); err != nil {
2442 return RouteMatchValidationError{
2443 field: "PathMatchPolicy",
2444 reason: "embedded message failed validation",
2445 cause: err,
2446 }
2447 }
2448 }
2449
2450 default:
2451 _ = v // ensures v is used
2452 }
2453 if !oneofPathSpecifierPresent {
2454 err := RouteMatchValidationError{
2455 field: "PathSpecifier",
2456 reason: "value is required",
2457 }
2458 if !all {
2459 return err
2460 }
2461 errors = append(errors, err)
2462 }
2463
2464 if len(errors) > 0 {
2465 return RouteMatchMultiError(errors)
2466 }
2467
2468 return nil
2469 }
2470
2471 // RouteMatchMultiError is an error wrapping multiple validation errors
2472 // returned by RouteMatch.ValidateAll() if the designated constraints aren't met.
2473 type RouteMatchMultiError []error
2474
2475 // Error returns a concatenation of all the error messages it wraps.
2476 func (m RouteMatchMultiError) Error() string {
2477 var msgs []string
2478 for _, err := range m {
2479 msgs = append(msgs, err.Error())
2480 }
2481 return strings.Join(msgs, "; ")
2482 }
2483
2484 // AllErrors returns a list of validation violation errors.
2485 func (m RouteMatchMultiError) AllErrors() []error { return m }
2486
2487 // RouteMatchValidationError is the validation error returned by
2488 // RouteMatch.Validate if the designated constraints aren't met.
2489 type RouteMatchValidationError struct {
2490 field string
2491 reason string
2492 cause error
2493 key bool
2494 }
2495
2496 // Field function returns field value.
2497 func (e RouteMatchValidationError) Field() string { return e.field }
2498
2499 // Reason function returns reason value.
2500 func (e RouteMatchValidationError) Reason() string { return e.reason }
2501
2502 // Cause function returns cause value.
2503 func (e RouteMatchValidationError) Cause() error { return e.cause }
2504
2505 // Key function returns key value.
2506 func (e RouteMatchValidationError) Key() bool { return e.key }
2507
2508 // ErrorName returns error name.
2509 func (e RouteMatchValidationError) ErrorName() string { return "RouteMatchValidationError" }
2510
2511 // Error satisfies the builtin error interface
2512 func (e RouteMatchValidationError) Error() string {
2513 cause := ""
2514 if e.cause != nil {
2515 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2516 }
2517
2518 key := ""
2519 if e.key {
2520 key = "key for "
2521 }
2522
2523 return fmt.Sprintf(
2524 "invalid %sRouteMatch.%s: %s%s",
2525 key,
2526 e.field,
2527 e.reason,
2528 cause)
2529 }
2530
2531 var _ error = RouteMatchValidationError{}
2532
2533 var _ interface {
2534 Field() string
2535 Reason() string
2536 Key() bool
2537 Cause() error
2538 ErrorName() string
2539 } = RouteMatchValidationError{}
2540
2541 var _RouteMatch_PathSeparatedPrefix_Pattern = regexp.MustCompile("^[^?#]+[^?#/]$")
2542
2543 // Validate checks the field values on CorsPolicy with the rules defined in the
2544 // proto definition for this message. If any rules are violated, the first
2545 // error encountered is returned, or nil if there are no violations.
2546 func (m *CorsPolicy) Validate() error {
2547 return m.validate(false)
2548 }
2549
2550 // ValidateAll checks the field values on CorsPolicy with the rules defined in
2551 // the proto definition for this message. If any rules are violated, the
2552 // result is a list of violation errors wrapped in CorsPolicyMultiError, or
2553 // nil if none found.
2554 func (m *CorsPolicy) ValidateAll() error {
2555 return m.validate(true)
2556 }
2557
2558 func (m *CorsPolicy) validate(all bool) error {
2559 if m == nil {
2560 return nil
2561 }
2562
2563 var errors []error
2564
2565 for idx, item := range m.GetAllowOriginStringMatch() {
2566 _, _ = idx, item
2567
2568 if all {
2569 switch v := interface{}(item).(type) {
2570 case interface{ ValidateAll() error }:
2571 if err := v.ValidateAll(); err != nil {
2572 errors = append(errors, CorsPolicyValidationError{
2573 field: fmt.Sprintf("AllowOriginStringMatch[%v]", idx),
2574 reason: "embedded message failed validation",
2575 cause: err,
2576 })
2577 }
2578 case interface{ Validate() error }:
2579 if err := v.Validate(); err != nil {
2580 errors = append(errors, CorsPolicyValidationError{
2581 field: fmt.Sprintf("AllowOriginStringMatch[%v]", idx),
2582 reason: "embedded message failed validation",
2583 cause: err,
2584 })
2585 }
2586 }
2587 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2588 if err := v.Validate(); err != nil {
2589 return CorsPolicyValidationError{
2590 field: fmt.Sprintf("AllowOriginStringMatch[%v]", idx),
2591 reason: "embedded message failed validation",
2592 cause: err,
2593 }
2594 }
2595 }
2596
2597 }
2598
2599 // no validation rules for AllowMethods
2600
2601 // no validation rules for AllowHeaders
2602
2603 // no validation rules for ExposeHeaders
2604
2605 // no validation rules for MaxAge
2606
2607 if all {
2608 switch v := interface{}(m.GetAllowCredentials()).(type) {
2609 case interface{ ValidateAll() error }:
2610 if err := v.ValidateAll(); err != nil {
2611 errors = append(errors, CorsPolicyValidationError{
2612 field: "AllowCredentials",
2613 reason: "embedded message failed validation",
2614 cause: err,
2615 })
2616 }
2617 case interface{ Validate() error }:
2618 if err := v.Validate(); err != nil {
2619 errors = append(errors, CorsPolicyValidationError{
2620 field: "AllowCredentials",
2621 reason: "embedded message failed validation",
2622 cause: err,
2623 })
2624 }
2625 }
2626 } else if v, ok := interface{}(m.GetAllowCredentials()).(interface{ Validate() error }); ok {
2627 if err := v.Validate(); err != nil {
2628 return CorsPolicyValidationError{
2629 field: "AllowCredentials",
2630 reason: "embedded message failed validation",
2631 cause: err,
2632 }
2633 }
2634 }
2635
2636 if all {
2637 switch v := interface{}(m.GetShadowEnabled()).(type) {
2638 case interface{ ValidateAll() error }:
2639 if err := v.ValidateAll(); err != nil {
2640 errors = append(errors, CorsPolicyValidationError{
2641 field: "ShadowEnabled",
2642 reason: "embedded message failed validation",
2643 cause: err,
2644 })
2645 }
2646 case interface{ Validate() error }:
2647 if err := v.Validate(); err != nil {
2648 errors = append(errors, CorsPolicyValidationError{
2649 field: "ShadowEnabled",
2650 reason: "embedded message failed validation",
2651 cause: err,
2652 })
2653 }
2654 }
2655 } else if v, ok := interface{}(m.GetShadowEnabled()).(interface{ Validate() error }); ok {
2656 if err := v.Validate(); err != nil {
2657 return CorsPolicyValidationError{
2658 field: "ShadowEnabled",
2659 reason: "embedded message failed validation",
2660 cause: err,
2661 }
2662 }
2663 }
2664
2665 if all {
2666 switch v := interface{}(m.GetAllowPrivateNetworkAccess()).(type) {
2667 case interface{ ValidateAll() error }:
2668 if err := v.ValidateAll(); err != nil {
2669 errors = append(errors, CorsPolicyValidationError{
2670 field: "AllowPrivateNetworkAccess",
2671 reason: "embedded message failed validation",
2672 cause: err,
2673 })
2674 }
2675 case interface{ Validate() error }:
2676 if err := v.Validate(); err != nil {
2677 errors = append(errors, CorsPolicyValidationError{
2678 field: "AllowPrivateNetworkAccess",
2679 reason: "embedded message failed validation",
2680 cause: err,
2681 })
2682 }
2683 }
2684 } else if v, ok := interface{}(m.GetAllowPrivateNetworkAccess()).(interface{ Validate() error }); ok {
2685 if err := v.Validate(); err != nil {
2686 return CorsPolicyValidationError{
2687 field: "AllowPrivateNetworkAccess",
2688 reason: "embedded message failed validation",
2689 cause: err,
2690 }
2691 }
2692 }
2693
2694 if all {
2695 switch v := interface{}(m.GetForwardNotMatchingPreflights()).(type) {
2696 case interface{ ValidateAll() error }:
2697 if err := v.ValidateAll(); err != nil {
2698 errors = append(errors, CorsPolicyValidationError{
2699 field: "ForwardNotMatchingPreflights",
2700 reason: "embedded message failed validation",
2701 cause: err,
2702 })
2703 }
2704 case interface{ Validate() error }:
2705 if err := v.Validate(); err != nil {
2706 errors = append(errors, CorsPolicyValidationError{
2707 field: "ForwardNotMatchingPreflights",
2708 reason: "embedded message failed validation",
2709 cause: err,
2710 })
2711 }
2712 }
2713 } else if v, ok := interface{}(m.GetForwardNotMatchingPreflights()).(interface{ Validate() error }); ok {
2714 if err := v.Validate(); err != nil {
2715 return CorsPolicyValidationError{
2716 field: "ForwardNotMatchingPreflights",
2717 reason: "embedded message failed validation",
2718 cause: err,
2719 }
2720 }
2721 }
2722
2723 switch v := m.EnabledSpecifier.(type) {
2724 case *CorsPolicy_FilterEnabled:
2725 if v == nil {
2726 err := CorsPolicyValidationError{
2727 field: "EnabledSpecifier",
2728 reason: "oneof value cannot be a typed-nil",
2729 }
2730 if !all {
2731 return err
2732 }
2733 errors = append(errors, err)
2734 }
2735
2736 if all {
2737 switch v := interface{}(m.GetFilterEnabled()).(type) {
2738 case interface{ ValidateAll() error }:
2739 if err := v.ValidateAll(); err != nil {
2740 errors = append(errors, CorsPolicyValidationError{
2741 field: "FilterEnabled",
2742 reason: "embedded message failed validation",
2743 cause: err,
2744 })
2745 }
2746 case interface{ Validate() error }:
2747 if err := v.Validate(); err != nil {
2748 errors = append(errors, CorsPolicyValidationError{
2749 field: "FilterEnabled",
2750 reason: "embedded message failed validation",
2751 cause: err,
2752 })
2753 }
2754 }
2755 } else if v, ok := interface{}(m.GetFilterEnabled()).(interface{ Validate() error }); ok {
2756 if err := v.Validate(); err != nil {
2757 return CorsPolicyValidationError{
2758 field: "FilterEnabled",
2759 reason: "embedded message failed validation",
2760 cause: err,
2761 }
2762 }
2763 }
2764
2765 default:
2766 _ = v // ensures v is used
2767 }
2768
2769 if len(errors) > 0 {
2770 return CorsPolicyMultiError(errors)
2771 }
2772
2773 return nil
2774 }
2775
2776 // CorsPolicyMultiError is an error wrapping multiple validation errors
2777 // returned by CorsPolicy.ValidateAll() if the designated constraints aren't met.
2778 type CorsPolicyMultiError []error
2779
2780 // Error returns a concatenation of all the error messages it wraps.
2781 func (m CorsPolicyMultiError) Error() string {
2782 var msgs []string
2783 for _, err := range m {
2784 msgs = append(msgs, err.Error())
2785 }
2786 return strings.Join(msgs, "; ")
2787 }
2788
2789 // AllErrors returns a list of validation violation errors.
2790 func (m CorsPolicyMultiError) AllErrors() []error { return m }
2791
2792 // CorsPolicyValidationError is the validation error returned by
2793 // CorsPolicy.Validate if the designated constraints aren't met.
2794 type CorsPolicyValidationError struct {
2795 field string
2796 reason string
2797 cause error
2798 key bool
2799 }
2800
2801 // Field function returns field value.
2802 func (e CorsPolicyValidationError) Field() string { return e.field }
2803
2804 // Reason function returns reason value.
2805 func (e CorsPolicyValidationError) Reason() string { return e.reason }
2806
2807 // Cause function returns cause value.
2808 func (e CorsPolicyValidationError) Cause() error { return e.cause }
2809
2810 // Key function returns key value.
2811 func (e CorsPolicyValidationError) Key() bool { return e.key }
2812
2813 // ErrorName returns error name.
2814 func (e CorsPolicyValidationError) ErrorName() string { return "CorsPolicyValidationError" }
2815
2816 // Error satisfies the builtin error interface
2817 func (e CorsPolicyValidationError) Error() string {
2818 cause := ""
2819 if e.cause != nil {
2820 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2821 }
2822
2823 key := ""
2824 if e.key {
2825 key = "key for "
2826 }
2827
2828 return fmt.Sprintf(
2829 "invalid %sCorsPolicy.%s: %s%s",
2830 key,
2831 e.field,
2832 e.reason,
2833 cause)
2834 }
2835
2836 var _ error = CorsPolicyValidationError{}
2837
2838 var _ interface {
2839 Field() string
2840 Reason() string
2841 Key() bool
2842 Cause() error
2843 ErrorName() string
2844 } = CorsPolicyValidationError{}
2845
2846 // Validate checks the field values on RouteAction with the rules defined in
2847 // the proto definition for this message. If any rules are violated, the first
2848 // error encountered is returned, or nil if there are no violations.
2849 func (m *RouteAction) Validate() error {
2850 return m.validate(false)
2851 }
2852
2853 // ValidateAll checks the field values on RouteAction with the rules defined in
2854 // the proto definition for this message. If any rules are violated, the
2855 // result is a list of violation errors wrapped in RouteActionMultiError, or
2856 // nil if none found.
2857 func (m *RouteAction) ValidateAll() error {
2858 return m.validate(true)
2859 }
2860
2861 func (m *RouteAction) validate(all bool) error {
2862 if m == nil {
2863 return nil
2864 }
2865
2866 var errors []error
2867
2868 if _, ok := RouteAction_ClusterNotFoundResponseCode_name[int32(m.GetClusterNotFoundResponseCode())]; !ok {
2869 err := RouteActionValidationError{
2870 field: "ClusterNotFoundResponseCode",
2871 reason: "value must be one of the defined enum values",
2872 }
2873 if !all {
2874 return err
2875 }
2876 errors = append(errors, err)
2877 }
2878
2879 if all {
2880 switch v := interface{}(m.GetMetadataMatch()).(type) {
2881 case interface{ ValidateAll() error }:
2882 if err := v.ValidateAll(); err != nil {
2883 errors = append(errors, RouteActionValidationError{
2884 field: "MetadataMatch",
2885 reason: "embedded message failed validation",
2886 cause: err,
2887 })
2888 }
2889 case interface{ Validate() error }:
2890 if err := v.Validate(); err != nil {
2891 errors = append(errors, RouteActionValidationError{
2892 field: "MetadataMatch",
2893 reason: "embedded message failed validation",
2894 cause: err,
2895 })
2896 }
2897 }
2898 } else if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok {
2899 if err := v.Validate(); err != nil {
2900 return RouteActionValidationError{
2901 field: "MetadataMatch",
2902 reason: "embedded message failed validation",
2903 cause: err,
2904 }
2905 }
2906 }
2907
2908 if !_RouteAction_PrefixRewrite_Pattern.MatchString(m.GetPrefixRewrite()) {
2909 err := RouteActionValidationError{
2910 field: "PrefixRewrite",
2911 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
2912 }
2913 if !all {
2914 return err
2915 }
2916 errors = append(errors, err)
2917 }
2918
2919 if all {
2920 switch v := interface{}(m.GetRegexRewrite()).(type) {
2921 case interface{ ValidateAll() error }:
2922 if err := v.ValidateAll(); err != nil {
2923 errors = append(errors, RouteActionValidationError{
2924 field: "RegexRewrite",
2925 reason: "embedded message failed validation",
2926 cause: err,
2927 })
2928 }
2929 case interface{ Validate() error }:
2930 if err := v.Validate(); err != nil {
2931 errors = append(errors, RouteActionValidationError{
2932 field: "RegexRewrite",
2933 reason: "embedded message failed validation",
2934 cause: err,
2935 })
2936 }
2937 }
2938 } else if v, ok := interface{}(m.GetRegexRewrite()).(interface{ Validate() error }); ok {
2939 if err := v.Validate(); err != nil {
2940 return RouteActionValidationError{
2941 field: "RegexRewrite",
2942 reason: "embedded message failed validation",
2943 cause: err,
2944 }
2945 }
2946 }
2947
2948 if all {
2949 switch v := interface{}(m.GetPathRewritePolicy()).(type) {
2950 case interface{ ValidateAll() error }:
2951 if err := v.ValidateAll(); err != nil {
2952 errors = append(errors, RouteActionValidationError{
2953 field: "PathRewritePolicy",
2954 reason: "embedded message failed validation",
2955 cause: err,
2956 })
2957 }
2958 case interface{ Validate() error }:
2959 if err := v.Validate(); err != nil {
2960 errors = append(errors, RouteActionValidationError{
2961 field: "PathRewritePolicy",
2962 reason: "embedded message failed validation",
2963 cause: err,
2964 })
2965 }
2966 }
2967 } else if v, ok := interface{}(m.GetPathRewritePolicy()).(interface{ Validate() error }); ok {
2968 if err := v.Validate(); err != nil {
2969 return RouteActionValidationError{
2970 field: "PathRewritePolicy",
2971 reason: "embedded message failed validation",
2972 cause: err,
2973 }
2974 }
2975 }
2976
2977 // no validation rules for AppendXForwardedHost
2978
2979 if all {
2980 switch v := interface{}(m.GetTimeout()).(type) {
2981 case interface{ ValidateAll() error }:
2982 if err := v.ValidateAll(); err != nil {
2983 errors = append(errors, RouteActionValidationError{
2984 field: "Timeout",
2985 reason: "embedded message failed validation",
2986 cause: err,
2987 })
2988 }
2989 case interface{ Validate() error }:
2990 if err := v.Validate(); err != nil {
2991 errors = append(errors, RouteActionValidationError{
2992 field: "Timeout",
2993 reason: "embedded message failed validation",
2994 cause: err,
2995 })
2996 }
2997 }
2998 } else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok {
2999 if err := v.Validate(); err != nil {
3000 return RouteActionValidationError{
3001 field: "Timeout",
3002 reason: "embedded message failed validation",
3003 cause: err,
3004 }
3005 }
3006 }
3007
3008 if all {
3009 switch v := interface{}(m.GetIdleTimeout()).(type) {
3010 case interface{ ValidateAll() error }:
3011 if err := v.ValidateAll(); err != nil {
3012 errors = append(errors, RouteActionValidationError{
3013 field: "IdleTimeout",
3014 reason: "embedded message failed validation",
3015 cause: err,
3016 })
3017 }
3018 case interface{ Validate() error }:
3019 if err := v.Validate(); err != nil {
3020 errors = append(errors, RouteActionValidationError{
3021 field: "IdleTimeout",
3022 reason: "embedded message failed validation",
3023 cause: err,
3024 })
3025 }
3026 }
3027 } else if v, ok := interface{}(m.GetIdleTimeout()).(interface{ Validate() error }); ok {
3028 if err := v.Validate(); err != nil {
3029 return RouteActionValidationError{
3030 field: "IdleTimeout",
3031 reason: "embedded message failed validation",
3032 cause: err,
3033 }
3034 }
3035 }
3036
3037 if all {
3038 switch v := interface{}(m.GetEarlyDataPolicy()).(type) {
3039 case interface{ ValidateAll() error }:
3040 if err := v.ValidateAll(); err != nil {
3041 errors = append(errors, RouteActionValidationError{
3042 field: "EarlyDataPolicy",
3043 reason: "embedded message failed validation",
3044 cause: err,
3045 })
3046 }
3047 case interface{ Validate() error }:
3048 if err := v.Validate(); err != nil {
3049 errors = append(errors, RouteActionValidationError{
3050 field: "EarlyDataPolicy",
3051 reason: "embedded message failed validation",
3052 cause: err,
3053 })
3054 }
3055 }
3056 } else if v, ok := interface{}(m.GetEarlyDataPolicy()).(interface{ Validate() error }); ok {
3057 if err := v.Validate(); err != nil {
3058 return RouteActionValidationError{
3059 field: "EarlyDataPolicy",
3060 reason: "embedded message failed validation",
3061 cause: err,
3062 }
3063 }
3064 }
3065
3066 if all {
3067 switch v := interface{}(m.GetRetryPolicy()).(type) {
3068 case interface{ ValidateAll() error }:
3069 if err := v.ValidateAll(); err != nil {
3070 errors = append(errors, RouteActionValidationError{
3071 field: "RetryPolicy",
3072 reason: "embedded message failed validation",
3073 cause: err,
3074 })
3075 }
3076 case interface{ Validate() error }:
3077 if err := v.Validate(); err != nil {
3078 errors = append(errors, RouteActionValidationError{
3079 field: "RetryPolicy",
3080 reason: "embedded message failed validation",
3081 cause: err,
3082 })
3083 }
3084 }
3085 } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok {
3086 if err := v.Validate(); err != nil {
3087 return RouteActionValidationError{
3088 field: "RetryPolicy",
3089 reason: "embedded message failed validation",
3090 cause: err,
3091 }
3092 }
3093 }
3094
3095 if all {
3096 switch v := interface{}(m.GetRetryPolicyTypedConfig()).(type) {
3097 case interface{ ValidateAll() error }:
3098 if err := v.ValidateAll(); err != nil {
3099 errors = append(errors, RouteActionValidationError{
3100 field: "RetryPolicyTypedConfig",
3101 reason: "embedded message failed validation",
3102 cause: err,
3103 })
3104 }
3105 case interface{ Validate() error }:
3106 if err := v.Validate(); err != nil {
3107 errors = append(errors, RouteActionValidationError{
3108 field: "RetryPolicyTypedConfig",
3109 reason: "embedded message failed validation",
3110 cause: err,
3111 })
3112 }
3113 }
3114 } else if v, ok := interface{}(m.GetRetryPolicyTypedConfig()).(interface{ Validate() error }); ok {
3115 if err := v.Validate(); err != nil {
3116 return RouteActionValidationError{
3117 field: "RetryPolicyTypedConfig",
3118 reason: "embedded message failed validation",
3119 cause: err,
3120 }
3121 }
3122 }
3123
3124 for idx, item := range m.GetRequestMirrorPolicies() {
3125 _, _ = idx, item
3126
3127 if all {
3128 switch v := interface{}(item).(type) {
3129 case interface{ ValidateAll() error }:
3130 if err := v.ValidateAll(); err != nil {
3131 errors = append(errors, RouteActionValidationError{
3132 field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx),
3133 reason: "embedded message failed validation",
3134 cause: err,
3135 })
3136 }
3137 case interface{ Validate() error }:
3138 if err := v.Validate(); err != nil {
3139 errors = append(errors, RouteActionValidationError{
3140 field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx),
3141 reason: "embedded message failed validation",
3142 cause: err,
3143 })
3144 }
3145 }
3146 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
3147 if err := v.Validate(); err != nil {
3148 return RouteActionValidationError{
3149 field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx),
3150 reason: "embedded message failed validation",
3151 cause: err,
3152 }
3153 }
3154 }
3155
3156 }
3157
3158 if _, ok := v3.RoutingPriority_name[int32(m.GetPriority())]; !ok {
3159 err := RouteActionValidationError{
3160 field: "Priority",
3161 reason: "value must be one of the defined enum values",
3162 }
3163 if !all {
3164 return err
3165 }
3166 errors = append(errors, err)
3167 }
3168
3169 for idx, item := range m.GetRateLimits() {
3170 _, _ = idx, item
3171
3172 if all {
3173 switch v := interface{}(item).(type) {
3174 case interface{ ValidateAll() error }:
3175 if err := v.ValidateAll(); err != nil {
3176 errors = append(errors, RouteActionValidationError{
3177 field: fmt.Sprintf("RateLimits[%v]", idx),
3178 reason: "embedded message failed validation",
3179 cause: err,
3180 })
3181 }
3182 case interface{ Validate() error }:
3183 if err := v.Validate(); err != nil {
3184 errors = append(errors, RouteActionValidationError{
3185 field: fmt.Sprintf("RateLimits[%v]", idx),
3186 reason: "embedded message failed validation",
3187 cause: err,
3188 })
3189 }
3190 }
3191 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
3192 if err := v.Validate(); err != nil {
3193 return RouteActionValidationError{
3194 field: fmt.Sprintf("RateLimits[%v]", idx),
3195 reason: "embedded message failed validation",
3196 cause: err,
3197 }
3198 }
3199 }
3200
3201 }
3202
3203 if all {
3204 switch v := interface{}(m.GetIncludeVhRateLimits()).(type) {
3205 case interface{ ValidateAll() error }:
3206 if err := v.ValidateAll(); err != nil {
3207 errors = append(errors, RouteActionValidationError{
3208 field: "IncludeVhRateLimits",
3209 reason: "embedded message failed validation",
3210 cause: err,
3211 })
3212 }
3213 case interface{ Validate() error }:
3214 if err := v.Validate(); err != nil {
3215 errors = append(errors, RouteActionValidationError{
3216 field: "IncludeVhRateLimits",
3217 reason: "embedded message failed validation",
3218 cause: err,
3219 })
3220 }
3221 }
3222 } else if v, ok := interface{}(m.GetIncludeVhRateLimits()).(interface{ Validate() error }); ok {
3223 if err := v.Validate(); err != nil {
3224 return RouteActionValidationError{
3225 field: "IncludeVhRateLimits",
3226 reason: "embedded message failed validation",
3227 cause: err,
3228 }
3229 }
3230 }
3231
3232 for idx, item := range m.GetHashPolicy() {
3233 _, _ = idx, item
3234
3235 if all {
3236 switch v := interface{}(item).(type) {
3237 case interface{ ValidateAll() error }:
3238 if err := v.ValidateAll(); err != nil {
3239 errors = append(errors, RouteActionValidationError{
3240 field: fmt.Sprintf("HashPolicy[%v]", idx),
3241 reason: "embedded message failed validation",
3242 cause: err,
3243 })
3244 }
3245 case interface{ Validate() error }:
3246 if err := v.Validate(); err != nil {
3247 errors = append(errors, RouteActionValidationError{
3248 field: fmt.Sprintf("HashPolicy[%v]", idx),
3249 reason: "embedded message failed validation",
3250 cause: err,
3251 })
3252 }
3253 }
3254 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
3255 if err := v.Validate(); err != nil {
3256 return RouteActionValidationError{
3257 field: fmt.Sprintf("HashPolicy[%v]", idx),
3258 reason: "embedded message failed validation",
3259 cause: err,
3260 }
3261 }
3262 }
3263
3264 }
3265
3266 if all {
3267 switch v := interface{}(m.GetCors()).(type) {
3268 case interface{ ValidateAll() error }:
3269 if err := v.ValidateAll(); err != nil {
3270 errors = append(errors, RouteActionValidationError{
3271 field: "Cors",
3272 reason: "embedded message failed validation",
3273 cause: err,
3274 })
3275 }
3276 case interface{ Validate() error }:
3277 if err := v.Validate(); err != nil {
3278 errors = append(errors, RouteActionValidationError{
3279 field: "Cors",
3280 reason: "embedded message failed validation",
3281 cause: err,
3282 })
3283 }
3284 }
3285 } else if v, ok := interface{}(m.GetCors()).(interface{ Validate() error }); ok {
3286 if err := v.Validate(); err != nil {
3287 return RouteActionValidationError{
3288 field: "Cors",
3289 reason: "embedded message failed validation",
3290 cause: err,
3291 }
3292 }
3293 }
3294
3295 if all {
3296 switch v := interface{}(m.GetMaxGrpcTimeout()).(type) {
3297 case interface{ ValidateAll() error }:
3298 if err := v.ValidateAll(); err != nil {
3299 errors = append(errors, RouteActionValidationError{
3300 field: "MaxGrpcTimeout",
3301 reason: "embedded message failed validation",
3302 cause: err,
3303 })
3304 }
3305 case interface{ Validate() error }:
3306 if err := v.Validate(); err != nil {
3307 errors = append(errors, RouteActionValidationError{
3308 field: "MaxGrpcTimeout",
3309 reason: "embedded message failed validation",
3310 cause: err,
3311 })
3312 }
3313 }
3314 } else if v, ok := interface{}(m.GetMaxGrpcTimeout()).(interface{ Validate() error }); ok {
3315 if err := v.Validate(); err != nil {
3316 return RouteActionValidationError{
3317 field: "MaxGrpcTimeout",
3318 reason: "embedded message failed validation",
3319 cause: err,
3320 }
3321 }
3322 }
3323
3324 if all {
3325 switch v := interface{}(m.GetGrpcTimeoutOffset()).(type) {
3326 case interface{ ValidateAll() error }:
3327 if err := v.ValidateAll(); err != nil {
3328 errors = append(errors, RouteActionValidationError{
3329 field: "GrpcTimeoutOffset",
3330 reason: "embedded message failed validation",
3331 cause: err,
3332 })
3333 }
3334 case interface{ Validate() error }:
3335 if err := v.Validate(); err != nil {
3336 errors = append(errors, RouteActionValidationError{
3337 field: "GrpcTimeoutOffset",
3338 reason: "embedded message failed validation",
3339 cause: err,
3340 })
3341 }
3342 }
3343 } else if v, ok := interface{}(m.GetGrpcTimeoutOffset()).(interface{ Validate() error }); ok {
3344 if err := v.Validate(); err != nil {
3345 return RouteActionValidationError{
3346 field: "GrpcTimeoutOffset",
3347 reason: "embedded message failed validation",
3348 cause: err,
3349 }
3350 }
3351 }
3352
3353 for idx, item := range m.GetUpgradeConfigs() {
3354 _, _ = idx, item
3355
3356 if all {
3357 switch v := interface{}(item).(type) {
3358 case interface{ ValidateAll() error }:
3359 if err := v.ValidateAll(); err != nil {
3360 errors = append(errors, RouteActionValidationError{
3361 field: fmt.Sprintf("UpgradeConfigs[%v]", idx),
3362 reason: "embedded message failed validation",
3363 cause: err,
3364 })
3365 }
3366 case interface{ Validate() error }:
3367 if err := v.Validate(); err != nil {
3368 errors = append(errors, RouteActionValidationError{
3369 field: fmt.Sprintf("UpgradeConfigs[%v]", idx),
3370 reason: "embedded message failed validation",
3371 cause: err,
3372 })
3373 }
3374 }
3375 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
3376 if err := v.Validate(); err != nil {
3377 return RouteActionValidationError{
3378 field: fmt.Sprintf("UpgradeConfigs[%v]", idx),
3379 reason: "embedded message failed validation",
3380 cause: err,
3381 }
3382 }
3383 }
3384
3385 }
3386
3387 if all {
3388 switch v := interface{}(m.GetInternalRedirectPolicy()).(type) {
3389 case interface{ ValidateAll() error }:
3390 if err := v.ValidateAll(); err != nil {
3391 errors = append(errors, RouteActionValidationError{
3392 field: "InternalRedirectPolicy",
3393 reason: "embedded message failed validation",
3394 cause: err,
3395 })
3396 }
3397 case interface{ Validate() error }:
3398 if err := v.Validate(); err != nil {
3399 errors = append(errors, RouteActionValidationError{
3400 field: "InternalRedirectPolicy",
3401 reason: "embedded message failed validation",
3402 cause: err,
3403 })
3404 }
3405 }
3406 } else if v, ok := interface{}(m.GetInternalRedirectPolicy()).(interface{ Validate() error }); ok {
3407 if err := v.Validate(); err != nil {
3408 return RouteActionValidationError{
3409 field: "InternalRedirectPolicy",
3410 reason: "embedded message failed validation",
3411 cause: err,
3412 }
3413 }
3414 }
3415
3416 // no validation rules for InternalRedirectAction
3417
3418 if all {
3419 switch v := interface{}(m.GetMaxInternalRedirects()).(type) {
3420 case interface{ ValidateAll() error }:
3421 if err := v.ValidateAll(); err != nil {
3422 errors = append(errors, RouteActionValidationError{
3423 field: "MaxInternalRedirects",
3424 reason: "embedded message failed validation",
3425 cause: err,
3426 })
3427 }
3428 case interface{ Validate() error }:
3429 if err := v.Validate(); err != nil {
3430 errors = append(errors, RouteActionValidationError{
3431 field: "MaxInternalRedirects",
3432 reason: "embedded message failed validation",
3433 cause: err,
3434 })
3435 }
3436 }
3437 } else if v, ok := interface{}(m.GetMaxInternalRedirects()).(interface{ Validate() error }); ok {
3438 if err := v.Validate(); err != nil {
3439 return RouteActionValidationError{
3440 field: "MaxInternalRedirects",
3441 reason: "embedded message failed validation",
3442 cause: err,
3443 }
3444 }
3445 }
3446
3447 if all {
3448 switch v := interface{}(m.GetHedgePolicy()).(type) {
3449 case interface{ ValidateAll() error }:
3450 if err := v.ValidateAll(); err != nil {
3451 errors = append(errors, RouteActionValidationError{
3452 field: "HedgePolicy",
3453 reason: "embedded message failed validation",
3454 cause: err,
3455 })
3456 }
3457 case interface{ Validate() error }:
3458 if err := v.Validate(); err != nil {
3459 errors = append(errors, RouteActionValidationError{
3460 field: "HedgePolicy",
3461 reason: "embedded message failed validation",
3462 cause: err,
3463 })
3464 }
3465 }
3466 } else if v, ok := interface{}(m.GetHedgePolicy()).(interface{ Validate() error }); ok {
3467 if err := v.Validate(); err != nil {
3468 return RouteActionValidationError{
3469 field: "HedgePolicy",
3470 reason: "embedded message failed validation",
3471 cause: err,
3472 }
3473 }
3474 }
3475
3476 if all {
3477 switch v := interface{}(m.GetMaxStreamDuration()).(type) {
3478 case interface{ ValidateAll() error }:
3479 if err := v.ValidateAll(); err != nil {
3480 errors = append(errors, RouteActionValidationError{
3481 field: "MaxStreamDuration",
3482 reason: "embedded message failed validation",
3483 cause: err,
3484 })
3485 }
3486 case interface{ Validate() error }:
3487 if err := v.Validate(); err != nil {
3488 errors = append(errors, RouteActionValidationError{
3489 field: "MaxStreamDuration",
3490 reason: "embedded message failed validation",
3491 cause: err,
3492 })
3493 }
3494 }
3495 } else if v, ok := interface{}(m.GetMaxStreamDuration()).(interface{ Validate() error }); ok {
3496 if err := v.Validate(); err != nil {
3497 return RouteActionValidationError{
3498 field: "MaxStreamDuration",
3499 reason: "embedded message failed validation",
3500 cause: err,
3501 }
3502 }
3503 }
3504
3505 oneofClusterSpecifierPresent := false
3506 switch v := m.ClusterSpecifier.(type) {
3507 case *RouteAction_Cluster:
3508 if v == nil {
3509 err := RouteActionValidationError{
3510 field: "ClusterSpecifier",
3511 reason: "oneof value cannot be a typed-nil",
3512 }
3513 if !all {
3514 return err
3515 }
3516 errors = append(errors, err)
3517 }
3518 oneofClusterSpecifierPresent = true
3519
3520 if utf8.RuneCountInString(m.GetCluster()) < 1 {
3521 err := RouteActionValidationError{
3522 field: "Cluster",
3523 reason: "value length must be at least 1 runes",
3524 }
3525 if !all {
3526 return err
3527 }
3528 errors = append(errors, err)
3529 }
3530
3531 case *RouteAction_ClusterHeader:
3532 if v == nil {
3533 err := RouteActionValidationError{
3534 field: "ClusterSpecifier",
3535 reason: "oneof value cannot be a typed-nil",
3536 }
3537 if !all {
3538 return err
3539 }
3540 errors = append(errors, err)
3541 }
3542 oneofClusterSpecifierPresent = true
3543
3544 if utf8.RuneCountInString(m.GetClusterHeader()) < 1 {
3545 err := RouteActionValidationError{
3546 field: "ClusterHeader",
3547 reason: "value length must be at least 1 runes",
3548 }
3549 if !all {
3550 return err
3551 }
3552 errors = append(errors, err)
3553 }
3554
3555 if !_RouteAction_ClusterHeader_Pattern.MatchString(m.GetClusterHeader()) {
3556 err := RouteActionValidationError{
3557 field: "ClusterHeader",
3558 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
3559 }
3560 if !all {
3561 return err
3562 }
3563 errors = append(errors, err)
3564 }
3565
3566 case *RouteAction_WeightedClusters:
3567 if v == nil {
3568 err := RouteActionValidationError{
3569 field: "ClusterSpecifier",
3570 reason: "oneof value cannot be a typed-nil",
3571 }
3572 if !all {
3573 return err
3574 }
3575 errors = append(errors, err)
3576 }
3577 oneofClusterSpecifierPresent = true
3578
3579 if all {
3580 switch v := interface{}(m.GetWeightedClusters()).(type) {
3581 case interface{ ValidateAll() error }:
3582 if err := v.ValidateAll(); err != nil {
3583 errors = append(errors, RouteActionValidationError{
3584 field: "WeightedClusters",
3585 reason: "embedded message failed validation",
3586 cause: err,
3587 })
3588 }
3589 case interface{ Validate() error }:
3590 if err := v.Validate(); err != nil {
3591 errors = append(errors, RouteActionValidationError{
3592 field: "WeightedClusters",
3593 reason: "embedded message failed validation",
3594 cause: err,
3595 })
3596 }
3597 }
3598 } else if v, ok := interface{}(m.GetWeightedClusters()).(interface{ Validate() error }); ok {
3599 if err := v.Validate(); err != nil {
3600 return RouteActionValidationError{
3601 field: "WeightedClusters",
3602 reason: "embedded message failed validation",
3603 cause: err,
3604 }
3605 }
3606 }
3607
3608 case *RouteAction_ClusterSpecifierPlugin:
3609 if v == nil {
3610 err := RouteActionValidationError{
3611 field: "ClusterSpecifier",
3612 reason: "oneof value cannot be a typed-nil",
3613 }
3614 if !all {
3615 return err
3616 }
3617 errors = append(errors, err)
3618 }
3619 oneofClusterSpecifierPresent = true
3620 // no validation rules for ClusterSpecifierPlugin
3621 case *RouteAction_InlineClusterSpecifierPlugin:
3622 if v == nil {
3623 err := RouteActionValidationError{
3624 field: "ClusterSpecifier",
3625 reason: "oneof value cannot be a typed-nil",
3626 }
3627 if !all {
3628 return err
3629 }
3630 errors = append(errors, err)
3631 }
3632 oneofClusterSpecifierPresent = true
3633
3634 if all {
3635 switch v := interface{}(m.GetInlineClusterSpecifierPlugin()).(type) {
3636 case interface{ ValidateAll() error }:
3637 if err := v.ValidateAll(); err != nil {
3638 errors = append(errors, RouteActionValidationError{
3639 field: "InlineClusterSpecifierPlugin",
3640 reason: "embedded message failed validation",
3641 cause: err,
3642 })
3643 }
3644 case interface{ Validate() error }:
3645 if err := v.Validate(); err != nil {
3646 errors = append(errors, RouteActionValidationError{
3647 field: "InlineClusterSpecifierPlugin",
3648 reason: "embedded message failed validation",
3649 cause: err,
3650 })
3651 }
3652 }
3653 } else if v, ok := interface{}(m.GetInlineClusterSpecifierPlugin()).(interface{ Validate() error }); ok {
3654 if err := v.Validate(); err != nil {
3655 return RouteActionValidationError{
3656 field: "InlineClusterSpecifierPlugin",
3657 reason: "embedded message failed validation",
3658 cause: err,
3659 }
3660 }
3661 }
3662
3663 default:
3664 _ = v // ensures v is used
3665 }
3666 if !oneofClusterSpecifierPresent {
3667 err := RouteActionValidationError{
3668 field: "ClusterSpecifier",
3669 reason: "value is required",
3670 }
3671 if !all {
3672 return err
3673 }
3674 errors = append(errors, err)
3675 }
3676 switch v := m.HostRewriteSpecifier.(type) {
3677 case *RouteAction_HostRewriteLiteral:
3678 if v == nil {
3679 err := RouteActionValidationError{
3680 field: "HostRewriteSpecifier",
3681 reason: "oneof value cannot be a typed-nil",
3682 }
3683 if !all {
3684 return err
3685 }
3686 errors = append(errors, err)
3687 }
3688
3689 if !_RouteAction_HostRewriteLiteral_Pattern.MatchString(m.GetHostRewriteLiteral()) {
3690 err := RouteActionValidationError{
3691 field: "HostRewriteLiteral",
3692 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
3693 }
3694 if !all {
3695 return err
3696 }
3697 errors = append(errors, err)
3698 }
3699
3700 case *RouteAction_AutoHostRewrite:
3701 if v == nil {
3702 err := RouteActionValidationError{
3703 field: "HostRewriteSpecifier",
3704 reason: "oneof value cannot be a typed-nil",
3705 }
3706 if !all {
3707 return err
3708 }
3709 errors = append(errors, err)
3710 }
3711
3712 if all {
3713 switch v := interface{}(m.GetAutoHostRewrite()).(type) {
3714 case interface{ ValidateAll() error }:
3715 if err := v.ValidateAll(); err != nil {
3716 errors = append(errors, RouteActionValidationError{
3717 field: "AutoHostRewrite",
3718 reason: "embedded message failed validation",
3719 cause: err,
3720 })
3721 }
3722 case interface{ Validate() error }:
3723 if err := v.Validate(); err != nil {
3724 errors = append(errors, RouteActionValidationError{
3725 field: "AutoHostRewrite",
3726 reason: "embedded message failed validation",
3727 cause: err,
3728 })
3729 }
3730 }
3731 } else if v, ok := interface{}(m.GetAutoHostRewrite()).(interface{ Validate() error }); ok {
3732 if err := v.Validate(); err != nil {
3733 return RouteActionValidationError{
3734 field: "AutoHostRewrite",
3735 reason: "embedded message failed validation",
3736 cause: err,
3737 }
3738 }
3739 }
3740
3741 case *RouteAction_HostRewriteHeader:
3742 if v == nil {
3743 err := RouteActionValidationError{
3744 field: "HostRewriteSpecifier",
3745 reason: "oneof value cannot be a typed-nil",
3746 }
3747 if !all {
3748 return err
3749 }
3750 errors = append(errors, err)
3751 }
3752
3753 if !_RouteAction_HostRewriteHeader_Pattern.MatchString(m.GetHostRewriteHeader()) {
3754 err := RouteActionValidationError{
3755 field: "HostRewriteHeader",
3756 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
3757 }
3758 if !all {
3759 return err
3760 }
3761 errors = append(errors, err)
3762 }
3763
3764 case *RouteAction_HostRewritePathRegex:
3765 if v == nil {
3766 err := RouteActionValidationError{
3767 field: "HostRewriteSpecifier",
3768 reason: "oneof value cannot be a typed-nil",
3769 }
3770 if !all {
3771 return err
3772 }
3773 errors = append(errors, err)
3774 }
3775
3776 if all {
3777 switch v := interface{}(m.GetHostRewritePathRegex()).(type) {
3778 case interface{ ValidateAll() error }:
3779 if err := v.ValidateAll(); err != nil {
3780 errors = append(errors, RouteActionValidationError{
3781 field: "HostRewritePathRegex",
3782 reason: "embedded message failed validation",
3783 cause: err,
3784 })
3785 }
3786 case interface{ Validate() error }:
3787 if err := v.Validate(); err != nil {
3788 errors = append(errors, RouteActionValidationError{
3789 field: "HostRewritePathRegex",
3790 reason: "embedded message failed validation",
3791 cause: err,
3792 })
3793 }
3794 }
3795 } else if v, ok := interface{}(m.GetHostRewritePathRegex()).(interface{ Validate() error }); ok {
3796 if err := v.Validate(); err != nil {
3797 return RouteActionValidationError{
3798 field: "HostRewritePathRegex",
3799 reason: "embedded message failed validation",
3800 cause: err,
3801 }
3802 }
3803 }
3804
3805 default:
3806 _ = v // ensures v is used
3807 }
3808
3809 if len(errors) > 0 {
3810 return RouteActionMultiError(errors)
3811 }
3812
3813 return nil
3814 }
3815
3816 // RouteActionMultiError is an error wrapping multiple validation errors
3817 // returned by RouteAction.ValidateAll() if the designated constraints aren't met.
3818 type RouteActionMultiError []error
3819
3820 // Error returns a concatenation of all the error messages it wraps.
3821 func (m RouteActionMultiError) Error() string {
3822 var msgs []string
3823 for _, err := range m {
3824 msgs = append(msgs, err.Error())
3825 }
3826 return strings.Join(msgs, "; ")
3827 }
3828
3829 // AllErrors returns a list of validation violation errors.
3830 func (m RouteActionMultiError) AllErrors() []error { return m }
3831
3832 // RouteActionValidationError is the validation error returned by
3833 // RouteAction.Validate if the designated constraints aren't met.
3834 type RouteActionValidationError struct {
3835 field string
3836 reason string
3837 cause error
3838 key bool
3839 }
3840
3841 // Field function returns field value.
3842 func (e RouteActionValidationError) Field() string { return e.field }
3843
3844 // Reason function returns reason value.
3845 func (e RouteActionValidationError) Reason() string { return e.reason }
3846
3847 // Cause function returns cause value.
3848 func (e RouteActionValidationError) Cause() error { return e.cause }
3849
3850 // Key function returns key value.
3851 func (e RouteActionValidationError) Key() bool { return e.key }
3852
3853 // ErrorName returns error name.
3854 func (e RouteActionValidationError) ErrorName() string { return "RouteActionValidationError" }
3855
3856 // Error satisfies the builtin error interface
3857 func (e RouteActionValidationError) Error() string {
3858 cause := ""
3859 if e.cause != nil {
3860 cause = fmt.Sprintf(" | caused by: %v", e.cause)
3861 }
3862
3863 key := ""
3864 if e.key {
3865 key = "key for "
3866 }
3867
3868 return fmt.Sprintf(
3869 "invalid %sRouteAction.%s: %s%s",
3870 key,
3871 e.field,
3872 e.reason,
3873 cause)
3874 }
3875
3876 var _ error = RouteActionValidationError{}
3877
3878 var _ interface {
3879 Field() string
3880 Reason() string
3881 Key() bool
3882 Cause() error
3883 ErrorName() string
3884 } = RouteActionValidationError{}
3885
3886 var _RouteAction_ClusterHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
3887
3888 var _RouteAction_PrefixRewrite_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
3889
3890 var _RouteAction_HostRewriteLiteral_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
3891
3892 var _RouteAction_HostRewriteHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
3893
3894 // Validate checks the field values on RetryPolicy with the rules defined in
3895 // the proto definition for this message. If any rules are violated, the first
3896 // error encountered is returned, or nil if there are no violations.
3897 func (m *RetryPolicy) Validate() error {
3898 return m.validate(false)
3899 }
3900
3901 // ValidateAll checks the field values on RetryPolicy with the rules defined in
3902 // the proto definition for this message. If any rules are violated, the
3903 // result is a list of violation errors wrapped in RetryPolicyMultiError, or
3904 // nil if none found.
3905 func (m *RetryPolicy) ValidateAll() error {
3906 return m.validate(true)
3907 }
3908
3909 func (m *RetryPolicy) validate(all bool) error {
3910 if m == nil {
3911 return nil
3912 }
3913
3914 var errors []error
3915
3916 // no validation rules for RetryOn
3917
3918 if all {
3919 switch v := interface{}(m.GetNumRetries()).(type) {
3920 case interface{ ValidateAll() error }:
3921 if err := v.ValidateAll(); err != nil {
3922 errors = append(errors, RetryPolicyValidationError{
3923 field: "NumRetries",
3924 reason: "embedded message failed validation",
3925 cause: err,
3926 })
3927 }
3928 case interface{ Validate() error }:
3929 if err := v.Validate(); err != nil {
3930 errors = append(errors, RetryPolicyValidationError{
3931 field: "NumRetries",
3932 reason: "embedded message failed validation",
3933 cause: err,
3934 })
3935 }
3936 }
3937 } else if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok {
3938 if err := v.Validate(); err != nil {
3939 return RetryPolicyValidationError{
3940 field: "NumRetries",
3941 reason: "embedded message failed validation",
3942 cause: err,
3943 }
3944 }
3945 }
3946
3947 if all {
3948 switch v := interface{}(m.GetPerTryTimeout()).(type) {
3949 case interface{ ValidateAll() error }:
3950 if err := v.ValidateAll(); err != nil {
3951 errors = append(errors, RetryPolicyValidationError{
3952 field: "PerTryTimeout",
3953 reason: "embedded message failed validation",
3954 cause: err,
3955 })
3956 }
3957 case interface{ Validate() error }:
3958 if err := v.Validate(); err != nil {
3959 errors = append(errors, RetryPolicyValidationError{
3960 field: "PerTryTimeout",
3961 reason: "embedded message failed validation",
3962 cause: err,
3963 })
3964 }
3965 }
3966 } else if v, ok := interface{}(m.GetPerTryTimeout()).(interface{ Validate() error }); ok {
3967 if err := v.Validate(); err != nil {
3968 return RetryPolicyValidationError{
3969 field: "PerTryTimeout",
3970 reason: "embedded message failed validation",
3971 cause: err,
3972 }
3973 }
3974 }
3975
3976 if all {
3977 switch v := interface{}(m.GetPerTryIdleTimeout()).(type) {
3978 case interface{ ValidateAll() error }:
3979 if err := v.ValidateAll(); err != nil {
3980 errors = append(errors, RetryPolicyValidationError{
3981 field: "PerTryIdleTimeout",
3982 reason: "embedded message failed validation",
3983 cause: err,
3984 })
3985 }
3986 case interface{ Validate() error }:
3987 if err := v.Validate(); err != nil {
3988 errors = append(errors, RetryPolicyValidationError{
3989 field: "PerTryIdleTimeout",
3990 reason: "embedded message failed validation",
3991 cause: err,
3992 })
3993 }
3994 }
3995 } else if v, ok := interface{}(m.GetPerTryIdleTimeout()).(interface{ Validate() error }); ok {
3996 if err := v.Validate(); err != nil {
3997 return RetryPolicyValidationError{
3998 field: "PerTryIdleTimeout",
3999 reason: "embedded message failed validation",
4000 cause: err,
4001 }
4002 }
4003 }
4004
4005 if all {
4006 switch v := interface{}(m.GetRetryPriority()).(type) {
4007 case interface{ ValidateAll() error }:
4008 if err := v.ValidateAll(); err != nil {
4009 errors = append(errors, RetryPolicyValidationError{
4010 field: "RetryPriority",
4011 reason: "embedded message failed validation",
4012 cause: err,
4013 })
4014 }
4015 case interface{ Validate() error }:
4016 if err := v.Validate(); err != nil {
4017 errors = append(errors, RetryPolicyValidationError{
4018 field: "RetryPriority",
4019 reason: "embedded message failed validation",
4020 cause: err,
4021 })
4022 }
4023 }
4024 } else if v, ok := interface{}(m.GetRetryPriority()).(interface{ Validate() error }); ok {
4025 if err := v.Validate(); err != nil {
4026 return RetryPolicyValidationError{
4027 field: "RetryPriority",
4028 reason: "embedded message failed validation",
4029 cause: err,
4030 }
4031 }
4032 }
4033
4034 for idx, item := range m.GetRetryHostPredicate() {
4035 _, _ = idx, item
4036
4037 if all {
4038 switch v := interface{}(item).(type) {
4039 case interface{ ValidateAll() error }:
4040 if err := v.ValidateAll(); err != nil {
4041 errors = append(errors, RetryPolicyValidationError{
4042 field: fmt.Sprintf("RetryHostPredicate[%v]", idx),
4043 reason: "embedded message failed validation",
4044 cause: err,
4045 })
4046 }
4047 case interface{ Validate() error }:
4048 if err := v.Validate(); err != nil {
4049 errors = append(errors, RetryPolicyValidationError{
4050 field: fmt.Sprintf("RetryHostPredicate[%v]", idx),
4051 reason: "embedded message failed validation",
4052 cause: err,
4053 })
4054 }
4055 }
4056 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
4057 if err := v.Validate(); err != nil {
4058 return RetryPolicyValidationError{
4059 field: fmt.Sprintf("RetryHostPredicate[%v]", idx),
4060 reason: "embedded message failed validation",
4061 cause: err,
4062 }
4063 }
4064 }
4065
4066 }
4067
4068 for idx, item := range m.GetRetryOptionsPredicates() {
4069 _, _ = idx, item
4070
4071 if all {
4072 switch v := interface{}(item).(type) {
4073 case interface{ ValidateAll() error }:
4074 if err := v.ValidateAll(); err != nil {
4075 errors = append(errors, RetryPolicyValidationError{
4076 field: fmt.Sprintf("RetryOptionsPredicates[%v]", idx),
4077 reason: "embedded message failed validation",
4078 cause: err,
4079 })
4080 }
4081 case interface{ Validate() error }:
4082 if err := v.Validate(); err != nil {
4083 errors = append(errors, RetryPolicyValidationError{
4084 field: fmt.Sprintf("RetryOptionsPredicates[%v]", idx),
4085 reason: "embedded message failed validation",
4086 cause: err,
4087 })
4088 }
4089 }
4090 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
4091 if err := v.Validate(); err != nil {
4092 return RetryPolicyValidationError{
4093 field: fmt.Sprintf("RetryOptionsPredicates[%v]", idx),
4094 reason: "embedded message failed validation",
4095 cause: err,
4096 }
4097 }
4098 }
4099
4100 }
4101
4102 // no validation rules for HostSelectionRetryMaxAttempts
4103
4104 if all {
4105 switch v := interface{}(m.GetRetryBackOff()).(type) {
4106 case interface{ ValidateAll() error }:
4107 if err := v.ValidateAll(); err != nil {
4108 errors = append(errors, RetryPolicyValidationError{
4109 field: "RetryBackOff",
4110 reason: "embedded message failed validation",
4111 cause: err,
4112 })
4113 }
4114 case interface{ Validate() error }:
4115 if err := v.Validate(); err != nil {
4116 errors = append(errors, RetryPolicyValidationError{
4117 field: "RetryBackOff",
4118 reason: "embedded message failed validation",
4119 cause: err,
4120 })
4121 }
4122 }
4123 } else if v, ok := interface{}(m.GetRetryBackOff()).(interface{ Validate() error }); ok {
4124 if err := v.Validate(); err != nil {
4125 return RetryPolicyValidationError{
4126 field: "RetryBackOff",
4127 reason: "embedded message failed validation",
4128 cause: err,
4129 }
4130 }
4131 }
4132
4133 if all {
4134 switch v := interface{}(m.GetRateLimitedRetryBackOff()).(type) {
4135 case interface{ ValidateAll() error }:
4136 if err := v.ValidateAll(); err != nil {
4137 errors = append(errors, RetryPolicyValidationError{
4138 field: "RateLimitedRetryBackOff",
4139 reason: "embedded message failed validation",
4140 cause: err,
4141 })
4142 }
4143 case interface{ Validate() error }:
4144 if err := v.Validate(); err != nil {
4145 errors = append(errors, RetryPolicyValidationError{
4146 field: "RateLimitedRetryBackOff",
4147 reason: "embedded message failed validation",
4148 cause: err,
4149 })
4150 }
4151 }
4152 } else if v, ok := interface{}(m.GetRateLimitedRetryBackOff()).(interface{ Validate() error }); ok {
4153 if err := v.Validate(); err != nil {
4154 return RetryPolicyValidationError{
4155 field: "RateLimitedRetryBackOff",
4156 reason: "embedded message failed validation",
4157 cause: err,
4158 }
4159 }
4160 }
4161
4162 for idx, item := range m.GetRetriableHeaders() {
4163 _, _ = idx, item
4164
4165 if all {
4166 switch v := interface{}(item).(type) {
4167 case interface{ ValidateAll() error }:
4168 if err := v.ValidateAll(); err != nil {
4169 errors = append(errors, RetryPolicyValidationError{
4170 field: fmt.Sprintf("RetriableHeaders[%v]", idx),
4171 reason: "embedded message failed validation",
4172 cause: err,
4173 })
4174 }
4175 case interface{ Validate() error }:
4176 if err := v.Validate(); err != nil {
4177 errors = append(errors, RetryPolicyValidationError{
4178 field: fmt.Sprintf("RetriableHeaders[%v]", idx),
4179 reason: "embedded message failed validation",
4180 cause: err,
4181 })
4182 }
4183 }
4184 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
4185 if err := v.Validate(); err != nil {
4186 return RetryPolicyValidationError{
4187 field: fmt.Sprintf("RetriableHeaders[%v]", idx),
4188 reason: "embedded message failed validation",
4189 cause: err,
4190 }
4191 }
4192 }
4193
4194 }
4195
4196 for idx, item := range m.GetRetriableRequestHeaders() {
4197 _, _ = idx, item
4198
4199 if all {
4200 switch v := interface{}(item).(type) {
4201 case interface{ ValidateAll() error }:
4202 if err := v.ValidateAll(); err != nil {
4203 errors = append(errors, RetryPolicyValidationError{
4204 field: fmt.Sprintf("RetriableRequestHeaders[%v]", idx),
4205 reason: "embedded message failed validation",
4206 cause: err,
4207 })
4208 }
4209 case interface{ Validate() error }:
4210 if err := v.Validate(); err != nil {
4211 errors = append(errors, RetryPolicyValidationError{
4212 field: fmt.Sprintf("RetriableRequestHeaders[%v]", idx),
4213 reason: "embedded message failed validation",
4214 cause: err,
4215 })
4216 }
4217 }
4218 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
4219 if err := v.Validate(); err != nil {
4220 return RetryPolicyValidationError{
4221 field: fmt.Sprintf("RetriableRequestHeaders[%v]", idx),
4222 reason: "embedded message failed validation",
4223 cause: err,
4224 }
4225 }
4226 }
4227
4228 }
4229
4230 if len(errors) > 0 {
4231 return RetryPolicyMultiError(errors)
4232 }
4233
4234 return nil
4235 }
4236
4237 // RetryPolicyMultiError is an error wrapping multiple validation errors
4238 // returned by RetryPolicy.ValidateAll() if the designated constraints aren't met.
4239 type RetryPolicyMultiError []error
4240
4241 // Error returns a concatenation of all the error messages it wraps.
4242 func (m RetryPolicyMultiError) Error() string {
4243 var msgs []string
4244 for _, err := range m {
4245 msgs = append(msgs, err.Error())
4246 }
4247 return strings.Join(msgs, "; ")
4248 }
4249
4250 // AllErrors returns a list of validation violation errors.
4251 func (m RetryPolicyMultiError) AllErrors() []error { return m }
4252
4253 // RetryPolicyValidationError is the validation error returned by
4254 // RetryPolicy.Validate if the designated constraints aren't met.
4255 type RetryPolicyValidationError struct {
4256 field string
4257 reason string
4258 cause error
4259 key bool
4260 }
4261
4262 // Field function returns field value.
4263 func (e RetryPolicyValidationError) Field() string { return e.field }
4264
4265 // Reason function returns reason value.
4266 func (e RetryPolicyValidationError) Reason() string { return e.reason }
4267
4268 // Cause function returns cause value.
4269 func (e RetryPolicyValidationError) Cause() error { return e.cause }
4270
4271 // Key function returns key value.
4272 func (e RetryPolicyValidationError) Key() bool { return e.key }
4273
4274 // ErrorName returns error name.
4275 func (e RetryPolicyValidationError) ErrorName() string { return "RetryPolicyValidationError" }
4276
4277 // Error satisfies the builtin error interface
4278 func (e RetryPolicyValidationError) Error() string {
4279 cause := ""
4280 if e.cause != nil {
4281 cause = fmt.Sprintf(" | caused by: %v", e.cause)
4282 }
4283
4284 key := ""
4285 if e.key {
4286 key = "key for "
4287 }
4288
4289 return fmt.Sprintf(
4290 "invalid %sRetryPolicy.%s: %s%s",
4291 key,
4292 e.field,
4293 e.reason,
4294 cause)
4295 }
4296
4297 var _ error = RetryPolicyValidationError{}
4298
4299 var _ interface {
4300 Field() string
4301 Reason() string
4302 Key() bool
4303 Cause() error
4304 ErrorName() string
4305 } = RetryPolicyValidationError{}
4306
4307 // Validate checks the field values on HedgePolicy with the rules defined in
4308 // the proto definition for this message. If any rules are violated, the first
4309 // error encountered is returned, or nil if there are no violations.
4310 func (m *HedgePolicy) Validate() error {
4311 return m.validate(false)
4312 }
4313
4314 // ValidateAll checks the field values on HedgePolicy with the rules defined in
4315 // the proto definition for this message. If any rules are violated, the
4316 // result is a list of violation errors wrapped in HedgePolicyMultiError, or
4317 // nil if none found.
4318 func (m *HedgePolicy) ValidateAll() error {
4319 return m.validate(true)
4320 }
4321
4322 func (m *HedgePolicy) validate(all bool) error {
4323 if m == nil {
4324 return nil
4325 }
4326
4327 var errors []error
4328
4329 if wrapper := m.GetInitialRequests(); wrapper != nil {
4330
4331 if wrapper.GetValue() < 1 {
4332 err := HedgePolicyValidationError{
4333 field: "InitialRequests",
4334 reason: "value must be greater than or equal to 1",
4335 }
4336 if !all {
4337 return err
4338 }
4339 errors = append(errors, err)
4340 }
4341
4342 }
4343
4344 if all {
4345 switch v := interface{}(m.GetAdditionalRequestChance()).(type) {
4346 case interface{ ValidateAll() error }:
4347 if err := v.ValidateAll(); err != nil {
4348 errors = append(errors, HedgePolicyValidationError{
4349 field: "AdditionalRequestChance",
4350 reason: "embedded message failed validation",
4351 cause: err,
4352 })
4353 }
4354 case interface{ Validate() error }:
4355 if err := v.Validate(); err != nil {
4356 errors = append(errors, HedgePolicyValidationError{
4357 field: "AdditionalRequestChance",
4358 reason: "embedded message failed validation",
4359 cause: err,
4360 })
4361 }
4362 }
4363 } else if v, ok := interface{}(m.GetAdditionalRequestChance()).(interface{ Validate() error }); ok {
4364 if err := v.Validate(); err != nil {
4365 return HedgePolicyValidationError{
4366 field: "AdditionalRequestChance",
4367 reason: "embedded message failed validation",
4368 cause: err,
4369 }
4370 }
4371 }
4372
4373 // no validation rules for HedgeOnPerTryTimeout
4374
4375 if len(errors) > 0 {
4376 return HedgePolicyMultiError(errors)
4377 }
4378
4379 return nil
4380 }
4381
4382 // HedgePolicyMultiError is an error wrapping multiple validation errors
4383 // returned by HedgePolicy.ValidateAll() if the designated constraints aren't met.
4384 type HedgePolicyMultiError []error
4385
4386 // Error returns a concatenation of all the error messages it wraps.
4387 func (m HedgePolicyMultiError) Error() string {
4388 var msgs []string
4389 for _, err := range m {
4390 msgs = append(msgs, err.Error())
4391 }
4392 return strings.Join(msgs, "; ")
4393 }
4394
4395 // AllErrors returns a list of validation violation errors.
4396 func (m HedgePolicyMultiError) AllErrors() []error { return m }
4397
4398 // HedgePolicyValidationError is the validation error returned by
4399 // HedgePolicy.Validate if the designated constraints aren't met.
4400 type HedgePolicyValidationError struct {
4401 field string
4402 reason string
4403 cause error
4404 key bool
4405 }
4406
4407 // Field function returns field value.
4408 func (e HedgePolicyValidationError) Field() string { return e.field }
4409
4410 // Reason function returns reason value.
4411 func (e HedgePolicyValidationError) Reason() string { return e.reason }
4412
4413 // Cause function returns cause value.
4414 func (e HedgePolicyValidationError) Cause() error { return e.cause }
4415
4416 // Key function returns key value.
4417 func (e HedgePolicyValidationError) Key() bool { return e.key }
4418
4419 // ErrorName returns error name.
4420 func (e HedgePolicyValidationError) ErrorName() string { return "HedgePolicyValidationError" }
4421
4422 // Error satisfies the builtin error interface
4423 func (e HedgePolicyValidationError) Error() string {
4424 cause := ""
4425 if e.cause != nil {
4426 cause = fmt.Sprintf(" | caused by: %v", e.cause)
4427 }
4428
4429 key := ""
4430 if e.key {
4431 key = "key for "
4432 }
4433
4434 return fmt.Sprintf(
4435 "invalid %sHedgePolicy.%s: %s%s",
4436 key,
4437 e.field,
4438 e.reason,
4439 cause)
4440 }
4441
4442 var _ error = HedgePolicyValidationError{}
4443
4444 var _ interface {
4445 Field() string
4446 Reason() string
4447 Key() bool
4448 Cause() error
4449 ErrorName() string
4450 } = HedgePolicyValidationError{}
4451
4452 // Validate checks the field values on RedirectAction with the rules defined in
4453 // the proto definition for this message. If any rules are violated, the first
4454 // error encountered is returned, or nil if there are no violations.
4455 func (m *RedirectAction) Validate() error {
4456 return m.validate(false)
4457 }
4458
4459 // ValidateAll checks the field values on RedirectAction with the rules defined
4460 // in the proto definition for this message. If any rules are violated, the
4461 // result is a list of violation errors wrapped in RedirectActionMultiError,
4462 // or nil if none found.
4463 func (m *RedirectAction) ValidateAll() error {
4464 return m.validate(true)
4465 }
4466
4467 func (m *RedirectAction) validate(all bool) error {
4468 if m == nil {
4469 return nil
4470 }
4471
4472 var errors []error
4473
4474 if !_RedirectAction_HostRedirect_Pattern.MatchString(m.GetHostRedirect()) {
4475 err := RedirectActionValidationError{
4476 field: "HostRedirect",
4477 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
4478 }
4479 if !all {
4480 return err
4481 }
4482 errors = append(errors, err)
4483 }
4484
4485 // no validation rules for PortRedirect
4486
4487 if _, ok := RedirectAction_RedirectResponseCode_name[int32(m.GetResponseCode())]; !ok {
4488 err := RedirectActionValidationError{
4489 field: "ResponseCode",
4490 reason: "value must be one of the defined enum values",
4491 }
4492 if !all {
4493 return err
4494 }
4495 errors = append(errors, err)
4496 }
4497
4498 // no validation rules for StripQuery
4499
4500 switch v := m.SchemeRewriteSpecifier.(type) {
4501 case *RedirectAction_HttpsRedirect:
4502 if v == nil {
4503 err := RedirectActionValidationError{
4504 field: "SchemeRewriteSpecifier",
4505 reason: "oneof value cannot be a typed-nil",
4506 }
4507 if !all {
4508 return err
4509 }
4510 errors = append(errors, err)
4511 }
4512 // no validation rules for HttpsRedirect
4513 case *RedirectAction_SchemeRedirect:
4514 if v == nil {
4515 err := RedirectActionValidationError{
4516 field: "SchemeRewriteSpecifier",
4517 reason: "oneof value cannot be a typed-nil",
4518 }
4519 if !all {
4520 return err
4521 }
4522 errors = append(errors, err)
4523 }
4524 // no validation rules for SchemeRedirect
4525 default:
4526 _ = v // ensures v is used
4527 }
4528 switch v := m.PathRewriteSpecifier.(type) {
4529 case *RedirectAction_PathRedirect:
4530 if v == nil {
4531 err := RedirectActionValidationError{
4532 field: "PathRewriteSpecifier",
4533 reason: "oneof value cannot be a typed-nil",
4534 }
4535 if !all {
4536 return err
4537 }
4538 errors = append(errors, err)
4539 }
4540
4541 if !_RedirectAction_PathRedirect_Pattern.MatchString(m.GetPathRedirect()) {
4542 err := RedirectActionValidationError{
4543 field: "PathRedirect",
4544 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
4545 }
4546 if !all {
4547 return err
4548 }
4549 errors = append(errors, err)
4550 }
4551
4552 case *RedirectAction_PrefixRewrite:
4553 if v == nil {
4554 err := RedirectActionValidationError{
4555 field: "PathRewriteSpecifier",
4556 reason: "oneof value cannot be a typed-nil",
4557 }
4558 if !all {
4559 return err
4560 }
4561 errors = append(errors, err)
4562 }
4563
4564 if !_RedirectAction_PrefixRewrite_Pattern.MatchString(m.GetPrefixRewrite()) {
4565 err := RedirectActionValidationError{
4566 field: "PrefixRewrite",
4567 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
4568 }
4569 if !all {
4570 return err
4571 }
4572 errors = append(errors, err)
4573 }
4574
4575 case *RedirectAction_RegexRewrite:
4576 if v == nil {
4577 err := RedirectActionValidationError{
4578 field: "PathRewriteSpecifier",
4579 reason: "oneof value cannot be a typed-nil",
4580 }
4581 if !all {
4582 return err
4583 }
4584 errors = append(errors, err)
4585 }
4586
4587 if all {
4588 switch v := interface{}(m.GetRegexRewrite()).(type) {
4589 case interface{ ValidateAll() error }:
4590 if err := v.ValidateAll(); err != nil {
4591 errors = append(errors, RedirectActionValidationError{
4592 field: "RegexRewrite",
4593 reason: "embedded message failed validation",
4594 cause: err,
4595 })
4596 }
4597 case interface{ Validate() error }:
4598 if err := v.Validate(); err != nil {
4599 errors = append(errors, RedirectActionValidationError{
4600 field: "RegexRewrite",
4601 reason: "embedded message failed validation",
4602 cause: err,
4603 })
4604 }
4605 }
4606 } else if v, ok := interface{}(m.GetRegexRewrite()).(interface{ Validate() error }); ok {
4607 if err := v.Validate(); err != nil {
4608 return RedirectActionValidationError{
4609 field: "RegexRewrite",
4610 reason: "embedded message failed validation",
4611 cause: err,
4612 }
4613 }
4614 }
4615
4616 default:
4617 _ = v // ensures v is used
4618 }
4619
4620 if len(errors) > 0 {
4621 return RedirectActionMultiError(errors)
4622 }
4623
4624 return nil
4625 }
4626
4627 // RedirectActionMultiError is an error wrapping multiple validation errors
4628 // returned by RedirectAction.ValidateAll() if the designated constraints
4629 // aren't met.
4630 type RedirectActionMultiError []error
4631
4632 // Error returns a concatenation of all the error messages it wraps.
4633 func (m RedirectActionMultiError) Error() string {
4634 var msgs []string
4635 for _, err := range m {
4636 msgs = append(msgs, err.Error())
4637 }
4638 return strings.Join(msgs, "; ")
4639 }
4640
4641 // AllErrors returns a list of validation violation errors.
4642 func (m RedirectActionMultiError) AllErrors() []error { return m }
4643
4644 // RedirectActionValidationError is the validation error returned by
4645 // RedirectAction.Validate if the designated constraints aren't met.
4646 type RedirectActionValidationError struct {
4647 field string
4648 reason string
4649 cause error
4650 key bool
4651 }
4652
4653 // Field function returns field value.
4654 func (e RedirectActionValidationError) Field() string { return e.field }
4655
4656 // Reason function returns reason value.
4657 func (e RedirectActionValidationError) Reason() string { return e.reason }
4658
4659 // Cause function returns cause value.
4660 func (e RedirectActionValidationError) Cause() error { return e.cause }
4661
4662 // Key function returns key value.
4663 func (e RedirectActionValidationError) Key() bool { return e.key }
4664
4665 // ErrorName returns error name.
4666 func (e RedirectActionValidationError) ErrorName() string { return "RedirectActionValidationError" }
4667
4668 // Error satisfies the builtin error interface
4669 func (e RedirectActionValidationError) Error() string {
4670 cause := ""
4671 if e.cause != nil {
4672 cause = fmt.Sprintf(" | caused by: %v", e.cause)
4673 }
4674
4675 key := ""
4676 if e.key {
4677 key = "key for "
4678 }
4679
4680 return fmt.Sprintf(
4681 "invalid %sRedirectAction.%s: %s%s",
4682 key,
4683 e.field,
4684 e.reason,
4685 cause)
4686 }
4687
4688 var _ error = RedirectActionValidationError{}
4689
4690 var _ interface {
4691 Field() string
4692 Reason() string
4693 Key() bool
4694 Cause() error
4695 ErrorName() string
4696 } = RedirectActionValidationError{}
4697
4698 var _RedirectAction_HostRedirect_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
4699
4700 var _RedirectAction_PathRedirect_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
4701
4702 var _RedirectAction_PrefixRewrite_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
4703
4704 // Validate checks the field values on DirectResponseAction with the rules
4705 // defined in the proto definition for this message. If any rules are
4706 // violated, the first error encountered is returned, or nil if there are no violations.
4707 func (m *DirectResponseAction) Validate() error {
4708 return m.validate(false)
4709 }
4710
4711 // ValidateAll checks the field values on DirectResponseAction with the rules
4712 // defined in the proto definition for this message. If any rules are
4713 // violated, the result is a list of violation errors wrapped in
4714 // DirectResponseActionMultiError, or nil if none found.
4715 func (m *DirectResponseAction) ValidateAll() error {
4716 return m.validate(true)
4717 }
4718
4719 func (m *DirectResponseAction) validate(all bool) error {
4720 if m == nil {
4721 return nil
4722 }
4723
4724 var errors []error
4725
4726 if val := m.GetStatus(); val < 200 || val >= 600 {
4727 err := DirectResponseActionValidationError{
4728 field: "Status",
4729 reason: "value must be inside range [200, 600)",
4730 }
4731 if !all {
4732 return err
4733 }
4734 errors = append(errors, err)
4735 }
4736
4737 if all {
4738 switch v := interface{}(m.GetBody()).(type) {
4739 case interface{ ValidateAll() error }:
4740 if err := v.ValidateAll(); err != nil {
4741 errors = append(errors, DirectResponseActionValidationError{
4742 field: "Body",
4743 reason: "embedded message failed validation",
4744 cause: err,
4745 })
4746 }
4747 case interface{ Validate() error }:
4748 if err := v.Validate(); err != nil {
4749 errors = append(errors, DirectResponseActionValidationError{
4750 field: "Body",
4751 reason: "embedded message failed validation",
4752 cause: err,
4753 })
4754 }
4755 }
4756 } else if v, ok := interface{}(m.GetBody()).(interface{ Validate() error }); ok {
4757 if err := v.Validate(); err != nil {
4758 return DirectResponseActionValidationError{
4759 field: "Body",
4760 reason: "embedded message failed validation",
4761 cause: err,
4762 }
4763 }
4764 }
4765
4766 if len(errors) > 0 {
4767 return DirectResponseActionMultiError(errors)
4768 }
4769
4770 return nil
4771 }
4772
4773 // DirectResponseActionMultiError is an error wrapping multiple validation
4774 // errors returned by DirectResponseAction.ValidateAll() if the designated
4775 // constraints aren't met.
4776 type DirectResponseActionMultiError []error
4777
4778 // Error returns a concatenation of all the error messages it wraps.
4779 func (m DirectResponseActionMultiError) Error() string {
4780 var msgs []string
4781 for _, err := range m {
4782 msgs = append(msgs, err.Error())
4783 }
4784 return strings.Join(msgs, "; ")
4785 }
4786
4787 // AllErrors returns a list of validation violation errors.
4788 func (m DirectResponseActionMultiError) AllErrors() []error { return m }
4789
4790 // DirectResponseActionValidationError is the validation error returned by
4791 // DirectResponseAction.Validate if the designated constraints aren't met.
4792 type DirectResponseActionValidationError struct {
4793 field string
4794 reason string
4795 cause error
4796 key bool
4797 }
4798
4799 // Field function returns field value.
4800 func (e DirectResponseActionValidationError) Field() string { return e.field }
4801
4802 // Reason function returns reason value.
4803 func (e DirectResponseActionValidationError) Reason() string { return e.reason }
4804
4805 // Cause function returns cause value.
4806 func (e DirectResponseActionValidationError) Cause() error { return e.cause }
4807
4808 // Key function returns key value.
4809 func (e DirectResponseActionValidationError) Key() bool { return e.key }
4810
4811 // ErrorName returns error name.
4812 func (e DirectResponseActionValidationError) ErrorName() string {
4813 return "DirectResponseActionValidationError"
4814 }
4815
4816 // Error satisfies the builtin error interface
4817 func (e DirectResponseActionValidationError) Error() string {
4818 cause := ""
4819 if e.cause != nil {
4820 cause = fmt.Sprintf(" | caused by: %v", e.cause)
4821 }
4822
4823 key := ""
4824 if e.key {
4825 key = "key for "
4826 }
4827
4828 return fmt.Sprintf(
4829 "invalid %sDirectResponseAction.%s: %s%s",
4830 key,
4831 e.field,
4832 e.reason,
4833 cause)
4834 }
4835
4836 var _ error = DirectResponseActionValidationError{}
4837
4838 var _ interface {
4839 Field() string
4840 Reason() string
4841 Key() bool
4842 Cause() error
4843 ErrorName() string
4844 } = DirectResponseActionValidationError{}
4845
4846 // Validate checks the field values on NonForwardingAction with the rules
4847 // defined in the proto definition for this message. If any rules are
4848 // violated, the first error encountered is returned, or nil if there are no violations.
4849 func (m *NonForwardingAction) Validate() error {
4850 return m.validate(false)
4851 }
4852
4853 // ValidateAll checks the field values on NonForwardingAction with the rules
4854 // defined in the proto definition for this message. If any rules are
4855 // violated, the result is a list of violation errors wrapped in
4856 // NonForwardingActionMultiError, or nil if none found.
4857 func (m *NonForwardingAction) ValidateAll() error {
4858 return m.validate(true)
4859 }
4860
4861 func (m *NonForwardingAction) validate(all bool) error {
4862 if m == nil {
4863 return nil
4864 }
4865
4866 var errors []error
4867
4868 if len(errors) > 0 {
4869 return NonForwardingActionMultiError(errors)
4870 }
4871
4872 return nil
4873 }
4874
4875 // NonForwardingActionMultiError is an error wrapping multiple validation
4876 // errors returned by NonForwardingAction.ValidateAll() if the designated
4877 // constraints aren't met.
4878 type NonForwardingActionMultiError []error
4879
4880 // Error returns a concatenation of all the error messages it wraps.
4881 func (m NonForwardingActionMultiError) Error() string {
4882 var msgs []string
4883 for _, err := range m {
4884 msgs = append(msgs, err.Error())
4885 }
4886 return strings.Join(msgs, "; ")
4887 }
4888
4889 // AllErrors returns a list of validation violation errors.
4890 func (m NonForwardingActionMultiError) AllErrors() []error { return m }
4891
4892 // NonForwardingActionValidationError is the validation error returned by
4893 // NonForwardingAction.Validate if the designated constraints aren't met.
4894 type NonForwardingActionValidationError struct {
4895 field string
4896 reason string
4897 cause error
4898 key bool
4899 }
4900
4901 // Field function returns field value.
4902 func (e NonForwardingActionValidationError) Field() string { return e.field }
4903
4904 // Reason function returns reason value.
4905 func (e NonForwardingActionValidationError) Reason() string { return e.reason }
4906
4907 // Cause function returns cause value.
4908 func (e NonForwardingActionValidationError) Cause() error { return e.cause }
4909
4910 // Key function returns key value.
4911 func (e NonForwardingActionValidationError) Key() bool { return e.key }
4912
4913 // ErrorName returns error name.
4914 func (e NonForwardingActionValidationError) ErrorName() string {
4915 return "NonForwardingActionValidationError"
4916 }
4917
4918 // Error satisfies the builtin error interface
4919 func (e NonForwardingActionValidationError) Error() string {
4920 cause := ""
4921 if e.cause != nil {
4922 cause = fmt.Sprintf(" | caused by: %v", e.cause)
4923 }
4924
4925 key := ""
4926 if e.key {
4927 key = "key for "
4928 }
4929
4930 return fmt.Sprintf(
4931 "invalid %sNonForwardingAction.%s: %s%s",
4932 key,
4933 e.field,
4934 e.reason,
4935 cause)
4936 }
4937
4938 var _ error = NonForwardingActionValidationError{}
4939
4940 var _ interface {
4941 Field() string
4942 Reason() string
4943 Key() bool
4944 Cause() error
4945 ErrorName() string
4946 } = NonForwardingActionValidationError{}
4947
4948 // Validate checks the field values on Decorator with the rules defined in the
4949 // proto definition for this message. If any rules are violated, the first
4950 // error encountered is returned, or nil if there are no violations.
4951 func (m *Decorator) Validate() error {
4952 return m.validate(false)
4953 }
4954
4955 // ValidateAll checks the field values on Decorator with the rules defined in
4956 // the proto definition for this message. If any rules are violated, the
4957 // result is a list of violation errors wrapped in DecoratorMultiError, or nil
4958 // if none found.
4959 func (m *Decorator) ValidateAll() error {
4960 return m.validate(true)
4961 }
4962
4963 func (m *Decorator) validate(all bool) error {
4964 if m == nil {
4965 return nil
4966 }
4967
4968 var errors []error
4969
4970 if utf8.RuneCountInString(m.GetOperation()) < 1 {
4971 err := DecoratorValidationError{
4972 field: "Operation",
4973 reason: "value length must be at least 1 runes",
4974 }
4975 if !all {
4976 return err
4977 }
4978 errors = append(errors, err)
4979 }
4980
4981 if all {
4982 switch v := interface{}(m.GetPropagate()).(type) {
4983 case interface{ ValidateAll() error }:
4984 if err := v.ValidateAll(); err != nil {
4985 errors = append(errors, DecoratorValidationError{
4986 field: "Propagate",
4987 reason: "embedded message failed validation",
4988 cause: err,
4989 })
4990 }
4991 case interface{ Validate() error }:
4992 if err := v.Validate(); err != nil {
4993 errors = append(errors, DecoratorValidationError{
4994 field: "Propagate",
4995 reason: "embedded message failed validation",
4996 cause: err,
4997 })
4998 }
4999 }
5000 } else if v, ok := interface{}(m.GetPropagate()).(interface{ Validate() error }); ok {
5001 if err := v.Validate(); err != nil {
5002 return DecoratorValidationError{
5003 field: "Propagate",
5004 reason: "embedded message failed validation",
5005 cause: err,
5006 }
5007 }
5008 }
5009
5010 if len(errors) > 0 {
5011 return DecoratorMultiError(errors)
5012 }
5013
5014 return nil
5015 }
5016
5017 // DecoratorMultiError is an error wrapping multiple validation errors returned
5018 // by Decorator.ValidateAll() if the designated constraints aren't met.
5019 type DecoratorMultiError []error
5020
5021 // Error returns a concatenation of all the error messages it wraps.
5022 func (m DecoratorMultiError) Error() string {
5023 var msgs []string
5024 for _, err := range m {
5025 msgs = append(msgs, err.Error())
5026 }
5027 return strings.Join(msgs, "; ")
5028 }
5029
5030 // AllErrors returns a list of validation violation errors.
5031 func (m DecoratorMultiError) AllErrors() []error { return m }
5032
5033 // DecoratorValidationError is the validation error returned by
5034 // Decorator.Validate if the designated constraints aren't met.
5035 type DecoratorValidationError struct {
5036 field string
5037 reason string
5038 cause error
5039 key bool
5040 }
5041
5042 // Field function returns field value.
5043 func (e DecoratorValidationError) Field() string { return e.field }
5044
5045 // Reason function returns reason value.
5046 func (e DecoratorValidationError) Reason() string { return e.reason }
5047
5048 // Cause function returns cause value.
5049 func (e DecoratorValidationError) Cause() error { return e.cause }
5050
5051 // Key function returns key value.
5052 func (e DecoratorValidationError) Key() bool { return e.key }
5053
5054 // ErrorName returns error name.
5055 func (e DecoratorValidationError) ErrorName() string { return "DecoratorValidationError" }
5056
5057 // Error satisfies the builtin error interface
5058 func (e DecoratorValidationError) Error() string {
5059 cause := ""
5060 if e.cause != nil {
5061 cause = fmt.Sprintf(" | caused by: %v", e.cause)
5062 }
5063
5064 key := ""
5065 if e.key {
5066 key = "key for "
5067 }
5068
5069 return fmt.Sprintf(
5070 "invalid %sDecorator.%s: %s%s",
5071 key,
5072 e.field,
5073 e.reason,
5074 cause)
5075 }
5076
5077 var _ error = DecoratorValidationError{}
5078
5079 var _ interface {
5080 Field() string
5081 Reason() string
5082 Key() bool
5083 Cause() error
5084 ErrorName() string
5085 } = DecoratorValidationError{}
5086
5087 // Validate checks the field values on Tracing with the rules defined in the
5088 // proto definition for this message. If any rules are violated, the first
5089 // error encountered is returned, or nil if there are no violations.
5090 func (m *Tracing) Validate() error {
5091 return m.validate(false)
5092 }
5093
5094 // ValidateAll checks the field values on Tracing with the rules defined in the
5095 // proto definition for this message. If any rules are violated, the result is
5096 // a list of violation errors wrapped in TracingMultiError, or nil if none found.
5097 func (m *Tracing) ValidateAll() error {
5098 return m.validate(true)
5099 }
5100
5101 func (m *Tracing) validate(all bool) error {
5102 if m == nil {
5103 return nil
5104 }
5105
5106 var errors []error
5107
5108 if all {
5109 switch v := interface{}(m.GetClientSampling()).(type) {
5110 case interface{ ValidateAll() error }:
5111 if err := v.ValidateAll(); err != nil {
5112 errors = append(errors, TracingValidationError{
5113 field: "ClientSampling",
5114 reason: "embedded message failed validation",
5115 cause: err,
5116 })
5117 }
5118 case interface{ Validate() error }:
5119 if err := v.Validate(); err != nil {
5120 errors = append(errors, TracingValidationError{
5121 field: "ClientSampling",
5122 reason: "embedded message failed validation",
5123 cause: err,
5124 })
5125 }
5126 }
5127 } else if v, ok := interface{}(m.GetClientSampling()).(interface{ Validate() error }); ok {
5128 if err := v.Validate(); err != nil {
5129 return TracingValidationError{
5130 field: "ClientSampling",
5131 reason: "embedded message failed validation",
5132 cause: err,
5133 }
5134 }
5135 }
5136
5137 if all {
5138 switch v := interface{}(m.GetRandomSampling()).(type) {
5139 case interface{ ValidateAll() error }:
5140 if err := v.ValidateAll(); err != nil {
5141 errors = append(errors, TracingValidationError{
5142 field: "RandomSampling",
5143 reason: "embedded message failed validation",
5144 cause: err,
5145 })
5146 }
5147 case interface{ Validate() error }:
5148 if err := v.Validate(); err != nil {
5149 errors = append(errors, TracingValidationError{
5150 field: "RandomSampling",
5151 reason: "embedded message failed validation",
5152 cause: err,
5153 })
5154 }
5155 }
5156 } else if v, ok := interface{}(m.GetRandomSampling()).(interface{ Validate() error }); ok {
5157 if err := v.Validate(); err != nil {
5158 return TracingValidationError{
5159 field: "RandomSampling",
5160 reason: "embedded message failed validation",
5161 cause: err,
5162 }
5163 }
5164 }
5165
5166 if all {
5167 switch v := interface{}(m.GetOverallSampling()).(type) {
5168 case interface{ ValidateAll() error }:
5169 if err := v.ValidateAll(); err != nil {
5170 errors = append(errors, TracingValidationError{
5171 field: "OverallSampling",
5172 reason: "embedded message failed validation",
5173 cause: err,
5174 })
5175 }
5176 case interface{ Validate() error }:
5177 if err := v.Validate(); err != nil {
5178 errors = append(errors, TracingValidationError{
5179 field: "OverallSampling",
5180 reason: "embedded message failed validation",
5181 cause: err,
5182 })
5183 }
5184 }
5185 } else if v, ok := interface{}(m.GetOverallSampling()).(interface{ Validate() error }); ok {
5186 if err := v.Validate(); err != nil {
5187 return TracingValidationError{
5188 field: "OverallSampling",
5189 reason: "embedded message failed validation",
5190 cause: err,
5191 }
5192 }
5193 }
5194
5195 for idx, item := range m.GetCustomTags() {
5196 _, _ = idx, item
5197
5198 if all {
5199 switch v := interface{}(item).(type) {
5200 case interface{ ValidateAll() error }:
5201 if err := v.ValidateAll(); err != nil {
5202 errors = append(errors, TracingValidationError{
5203 field: fmt.Sprintf("CustomTags[%v]", idx),
5204 reason: "embedded message failed validation",
5205 cause: err,
5206 })
5207 }
5208 case interface{ Validate() error }:
5209 if err := v.Validate(); err != nil {
5210 errors = append(errors, TracingValidationError{
5211 field: fmt.Sprintf("CustomTags[%v]", idx),
5212 reason: "embedded message failed validation",
5213 cause: err,
5214 })
5215 }
5216 }
5217 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
5218 if err := v.Validate(); err != nil {
5219 return TracingValidationError{
5220 field: fmt.Sprintf("CustomTags[%v]", idx),
5221 reason: "embedded message failed validation",
5222 cause: err,
5223 }
5224 }
5225 }
5226
5227 }
5228
5229 if len(errors) > 0 {
5230 return TracingMultiError(errors)
5231 }
5232
5233 return nil
5234 }
5235
5236 // TracingMultiError is an error wrapping multiple validation errors returned
5237 // by Tracing.ValidateAll() if the designated constraints aren't met.
5238 type TracingMultiError []error
5239
5240 // Error returns a concatenation of all the error messages it wraps.
5241 func (m TracingMultiError) Error() string {
5242 var msgs []string
5243 for _, err := range m {
5244 msgs = append(msgs, err.Error())
5245 }
5246 return strings.Join(msgs, "; ")
5247 }
5248
5249 // AllErrors returns a list of validation violation errors.
5250 func (m TracingMultiError) AllErrors() []error { return m }
5251
5252 // TracingValidationError is the validation error returned by Tracing.Validate
5253 // if the designated constraints aren't met.
5254 type TracingValidationError struct {
5255 field string
5256 reason string
5257 cause error
5258 key bool
5259 }
5260
5261 // Field function returns field value.
5262 func (e TracingValidationError) Field() string { return e.field }
5263
5264 // Reason function returns reason value.
5265 func (e TracingValidationError) Reason() string { return e.reason }
5266
5267 // Cause function returns cause value.
5268 func (e TracingValidationError) Cause() error { return e.cause }
5269
5270 // Key function returns key value.
5271 func (e TracingValidationError) Key() bool { return e.key }
5272
5273 // ErrorName returns error name.
5274 func (e TracingValidationError) ErrorName() string { return "TracingValidationError" }
5275
5276 // Error satisfies the builtin error interface
5277 func (e TracingValidationError) Error() string {
5278 cause := ""
5279 if e.cause != nil {
5280 cause = fmt.Sprintf(" | caused by: %v", e.cause)
5281 }
5282
5283 key := ""
5284 if e.key {
5285 key = "key for "
5286 }
5287
5288 return fmt.Sprintf(
5289 "invalid %sTracing.%s: %s%s",
5290 key,
5291 e.field,
5292 e.reason,
5293 cause)
5294 }
5295
5296 var _ error = TracingValidationError{}
5297
5298 var _ interface {
5299 Field() string
5300 Reason() string
5301 Key() bool
5302 Cause() error
5303 ErrorName() string
5304 } = TracingValidationError{}
5305
5306 // Validate checks the field values on VirtualCluster with the rules defined in
5307 // the proto definition for this message. If any rules are violated, the first
5308 // error encountered is returned, or nil if there are no violations.
5309 func (m *VirtualCluster) Validate() error {
5310 return m.validate(false)
5311 }
5312
5313 // ValidateAll checks the field values on VirtualCluster with the rules defined
5314 // in the proto definition for this message. If any rules are violated, the
5315 // result is a list of violation errors wrapped in VirtualClusterMultiError,
5316 // or nil if none found.
5317 func (m *VirtualCluster) ValidateAll() error {
5318 return m.validate(true)
5319 }
5320
5321 func (m *VirtualCluster) validate(all bool) error {
5322 if m == nil {
5323 return nil
5324 }
5325
5326 var errors []error
5327
5328 for idx, item := range m.GetHeaders() {
5329 _, _ = idx, item
5330
5331 if all {
5332 switch v := interface{}(item).(type) {
5333 case interface{ ValidateAll() error }:
5334 if err := v.ValidateAll(); err != nil {
5335 errors = append(errors, VirtualClusterValidationError{
5336 field: fmt.Sprintf("Headers[%v]", idx),
5337 reason: "embedded message failed validation",
5338 cause: err,
5339 })
5340 }
5341 case interface{ Validate() error }:
5342 if err := v.Validate(); err != nil {
5343 errors = append(errors, VirtualClusterValidationError{
5344 field: fmt.Sprintf("Headers[%v]", idx),
5345 reason: "embedded message failed validation",
5346 cause: err,
5347 })
5348 }
5349 }
5350 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
5351 if err := v.Validate(); err != nil {
5352 return VirtualClusterValidationError{
5353 field: fmt.Sprintf("Headers[%v]", idx),
5354 reason: "embedded message failed validation",
5355 cause: err,
5356 }
5357 }
5358 }
5359
5360 }
5361
5362 if utf8.RuneCountInString(m.GetName()) < 1 {
5363 err := VirtualClusterValidationError{
5364 field: "Name",
5365 reason: "value length must be at least 1 runes",
5366 }
5367 if !all {
5368 return err
5369 }
5370 errors = append(errors, err)
5371 }
5372
5373 if len(errors) > 0 {
5374 return VirtualClusterMultiError(errors)
5375 }
5376
5377 return nil
5378 }
5379
5380 // VirtualClusterMultiError is an error wrapping multiple validation errors
5381 // returned by VirtualCluster.ValidateAll() if the designated constraints
5382 // aren't met.
5383 type VirtualClusterMultiError []error
5384
5385 // Error returns a concatenation of all the error messages it wraps.
5386 func (m VirtualClusterMultiError) Error() string {
5387 var msgs []string
5388 for _, err := range m {
5389 msgs = append(msgs, err.Error())
5390 }
5391 return strings.Join(msgs, "; ")
5392 }
5393
5394 // AllErrors returns a list of validation violation errors.
5395 func (m VirtualClusterMultiError) AllErrors() []error { return m }
5396
5397 // VirtualClusterValidationError is the validation error returned by
5398 // VirtualCluster.Validate if the designated constraints aren't met.
5399 type VirtualClusterValidationError struct {
5400 field string
5401 reason string
5402 cause error
5403 key bool
5404 }
5405
5406 // Field function returns field value.
5407 func (e VirtualClusterValidationError) Field() string { return e.field }
5408
5409 // Reason function returns reason value.
5410 func (e VirtualClusterValidationError) Reason() string { return e.reason }
5411
5412 // Cause function returns cause value.
5413 func (e VirtualClusterValidationError) Cause() error { return e.cause }
5414
5415 // Key function returns key value.
5416 func (e VirtualClusterValidationError) Key() bool { return e.key }
5417
5418 // ErrorName returns error name.
5419 func (e VirtualClusterValidationError) ErrorName() string { return "VirtualClusterValidationError" }
5420
5421 // Error satisfies the builtin error interface
5422 func (e VirtualClusterValidationError) Error() string {
5423 cause := ""
5424 if e.cause != nil {
5425 cause = fmt.Sprintf(" | caused by: %v", e.cause)
5426 }
5427
5428 key := ""
5429 if e.key {
5430 key = "key for "
5431 }
5432
5433 return fmt.Sprintf(
5434 "invalid %sVirtualCluster.%s: %s%s",
5435 key,
5436 e.field,
5437 e.reason,
5438 cause)
5439 }
5440
5441 var _ error = VirtualClusterValidationError{}
5442
5443 var _ interface {
5444 Field() string
5445 Reason() string
5446 Key() bool
5447 Cause() error
5448 ErrorName() string
5449 } = VirtualClusterValidationError{}
5450
5451 // Validate checks the field values on RateLimit with the rules defined in the
5452 // proto definition for this message. If any rules are violated, the first
5453 // error encountered is returned, or nil if there are no violations.
5454 func (m *RateLimit) Validate() error {
5455 return m.validate(false)
5456 }
5457
5458 // ValidateAll checks the field values on RateLimit with the rules defined in
5459 // the proto definition for this message. If any rules are violated, the
5460 // result is a list of violation errors wrapped in RateLimitMultiError, or nil
5461 // if none found.
5462 func (m *RateLimit) ValidateAll() error {
5463 return m.validate(true)
5464 }
5465
5466 func (m *RateLimit) validate(all bool) error {
5467 if m == nil {
5468 return nil
5469 }
5470
5471 var errors []error
5472
5473 if wrapper := m.GetStage(); wrapper != nil {
5474
5475 if wrapper.GetValue() > 10 {
5476 err := RateLimitValidationError{
5477 field: "Stage",
5478 reason: "value must be less than or equal to 10",
5479 }
5480 if !all {
5481 return err
5482 }
5483 errors = append(errors, err)
5484 }
5485
5486 }
5487
5488 // no validation rules for DisableKey
5489
5490 if len(m.GetActions()) < 1 {
5491 err := RateLimitValidationError{
5492 field: "Actions",
5493 reason: "value must contain at least 1 item(s)",
5494 }
5495 if !all {
5496 return err
5497 }
5498 errors = append(errors, err)
5499 }
5500
5501 for idx, item := range m.GetActions() {
5502 _, _ = idx, item
5503
5504 if all {
5505 switch v := interface{}(item).(type) {
5506 case interface{ ValidateAll() error }:
5507 if err := v.ValidateAll(); err != nil {
5508 errors = append(errors, RateLimitValidationError{
5509 field: fmt.Sprintf("Actions[%v]", idx),
5510 reason: "embedded message failed validation",
5511 cause: err,
5512 })
5513 }
5514 case interface{ Validate() error }:
5515 if err := v.Validate(); err != nil {
5516 errors = append(errors, RateLimitValidationError{
5517 field: fmt.Sprintf("Actions[%v]", idx),
5518 reason: "embedded message failed validation",
5519 cause: err,
5520 })
5521 }
5522 }
5523 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
5524 if err := v.Validate(); err != nil {
5525 return RateLimitValidationError{
5526 field: fmt.Sprintf("Actions[%v]", idx),
5527 reason: "embedded message failed validation",
5528 cause: err,
5529 }
5530 }
5531 }
5532
5533 }
5534
5535 if all {
5536 switch v := interface{}(m.GetLimit()).(type) {
5537 case interface{ ValidateAll() error }:
5538 if err := v.ValidateAll(); err != nil {
5539 errors = append(errors, RateLimitValidationError{
5540 field: "Limit",
5541 reason: "embedded message failed validation",
5542 cause: err,
5543 })
5544 }
5545 case interface{ Validate() error }:
5546 if err := v.Validate(); err != nil {
5547 errors = append(errors, RateLimitValidationError{
5548 field: "Limit",
5549 reason: "embedded message failed validation",
5550 cause: err,
5551 })
5552 }
5553 }
5554 } else if v, ok := interface{}(m.GetLimit()).(interface{ Validate() error }); ok {
5555 if err := v.Validate(); err != nil {
5556 return RateLimitValidationError{
5557 field: "Limit",
5558 reason: "embedded message failed validation",
5559 cause: err,
5560 }
5561 }
5562 }
5563
5564 if all {
5565 switch v := interface{}(m.GetHitsAddend()).(type) {
5566 case interface{ ValidateAll() error }:
5567 if err := v.ValidateAll(); err != nil {
5568 errors = append(errors, RateLimitValidationError{
5569 field: "HitsAddend",
5570 reason: "embedded message failed validation",
5571 cause: err,
5572 })
5573 }
5574 case interface{ Validate() error }:
5575 if err := v.Validate(); err != nil {
5576 errors = append(errors, RateLimitValidationError{
5577 field: "HitsAddend",
5578 reason: "embedded message failed validation",
5579 cause: err,
5580 })
5581 }
5582 }
5583 } else if v, ok := interface{}(m.GetHitsAddend()).(interface{ Validate() error }); ok {
5584 if err := v.Validate(); err != nil {
5585 return RateLimitValidationError{
5586 field: "HitsAddend",
5587 reason: "embedded message failed validation",
5588 cause: err,
5589 }
5590 }
5591 }
5592
5593 // no validation rules for ApplyOnStreamDone
5594
5595 if len(errors) > 0 {
5596 return RateLimitMultiError(errors)
5597 }
5598
5599 return nil
5600 }
5601
5602 // RateLimitMultiError is an error wrapping multiple validation errors returned
5603 // by RateLimit.ValidateAll() if the designated constraints aren't met.
5604 type RateLimitMultiError []error
5605
5606 // Error returns a concatenation of all the error messages it wraps.
5607 func (m RateLimitMultiError) Error() string {
5608 var msgs []string
5609 for _, err := range m {
5610 msgs = append(msgs, err.Error())
5611 }
5612 return strings.Join(msgs, "; ")
5613 }
5614
5615 // AllErrors returns a list of validation violation errors.
5616 func (m RateLimitMultiError) AllErrors() []error { return m }
5617
5618 // RateLimitValidationError is the validation error returned by
5619 // RateLimit.Validate if the designated constraints aren't met.
5620 type RateLimitValidationError struct {
5621 field string
5622 reason string
5623 cause error
5624 key bool
5625 }
5626
5627 // Field function returns field value.
5628 func (e RateLimitValidationError) Field() string { return e.field }
5629
5630 // Reason function returns reason value.
5631 func (e RateLimitValidationError) Reason() string { return e.reason }
5632
5633 // Cause function returns cause value.
5634 func (e RateLimitValidationError) Cause() error { return e.cause }
5635
5636 // Key function returns key value.
5637 func (e RateLimitValidationError) Key() bool { return e.key }
5638
5639 // ErrorName returns error name.
5640 func (e RateLimitValidationError) ErrorName() string { return "RateLimitValidationError" }
5641
5642 // Error satisfies the builtin error interface
5643 func (e RateLimitValidationError) Error() string {
5644 cause := ""
5645 if e.cause != nil {
5646 cause = fmt.Sprintf(" | caused by: %v", e.cause)
5647 }
5648
5649 key := ""
5650 if e.key {
5651 key = "key for "
5652 }
5653
5654 return fmt.Sprintf(
5655 "invalid %sRateLimit.%s: %s%s",
5656 key,
5657 e.field,
5658 e.reason,
5659 cause)
5660 }
5661
5662 var _ error = RateLimitValidationError{}
5663
5664 var _ interface {
5665 Field() string
5666 Reason() string
5667 Key() bool
5668 Cause() error
5669 ErrorName() string
5670 } = RateLimitValidationError{}
5671
5672 // Validate checks the field values on HeaderMatcher with the rules defined in
5673 // the proto definition for this message. If any rules are violated, the first
5674 // error encountered is returned, or nil if there are no violations.
5675 func (m *HeaderMatcher) Validate() error {
5676 return m.validate(false)
5677 }
5678
5679 // ValidateAll checks the field values on HeaderMatcher with the rules defined
5680 // in the proto definition for this message. If any rules are violated, the
5681 // result is a list of violation errors wrapped in HeaderMatcherMultiError, or
5682 // nil if none found.
5683 func (m *HeaderMatcher) ValidateAll() error {
5684 return m.validate(true)
5685 }
5686
5687 func (m *HeaderMatcher) validate(all bool) error {
5688 if m == nil {
5689 return nil
5690 }
5691
5692 var errors []error
5693
5694 if utf8.RuneCountInString(m.GetName()) < 1 {
5695 err := HeaderMatcherValidationError{
5696 field: "Name",
5697 reason: "value length must be at least 1 runes",
5698 }
5699 if !all {
5700 return err
5701 }
5702 errors = append(errors, err)
5703 }
5704
5705 if !_HeaderMatcher_Name_Pattern.MatchString(m.GetName()) {
5706 err := HeaderMatcherValidationError{
5707 field: "Name",
5708 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
5709 }
5710 if !all {
5711 return err
5712 }
5713 errors = append(errors, err)
5714 }
5715
5716 // no validation rules for InvertMatch
5717
5718 // no validation rules for TreatMissingHeaderAsEmpty
5719
5720 switch v := m.HeaderMatchSpecifier.(type) {
5721 case *HeaderMatcher_ExactMatch:
5722 if v == nil {
5723 err := HeaderMatcherValidationError{
5724 field: "HeaderMatchSpecifier",
5725 reason: "oneof value cannot be a typed-nil",
5726 }
5727 if !all {
5728 return err
5729 }
5730 errors = append(errors, err)
5731 }
5732 // no validation rules for ExactMatch
5733 case *HeaderMatcher_SafeRegexMatch:
5734 if v == nil {
5735 err := HeaderMatcherValidationError{
5736 field: "HeaderMatchSpecifier",
5737 reason: "oneof value cannot be a typed-nil",
5738 }
5739 if !all {
5740 return err
5741 }
5742 errors = append(errors, err)
5743 }
5744
5745 if all {
5746 switch v := interface{}(m.GetSafeRegexMatch()).(type) {
5747 case interface{ ValidateAll() error }:
5748 if err := v.ValidateAll(); err != nil {
5749 errors = append(errors, HeaderMatcherValidationError{
5750 field: "SafeRegexMatch",
5751 reason: "embedded message failed validation",
5752 cause: err,
5753 })
5754 }
5755 case interface{ Validate() error }:
5756 if err := v.Validate(); err != nil {
5757 errors = append(errors, HeaderMatcherValidationError{
5758 field: "SafeRegexMatch",
5759 reason: "embedded message failed validation",
5760 cause: err,
5761 })
5762 }
5763 }
5764 } else if v, ok := interface{}(m.GetSafeRegexMatch()).(interface{ Validate() error }); ok {
5765 if err := v.Validate(); err != nil {
5766 return HeaderMatcherValidationError{
5767 field: "SafeRegexMatch",
5768 reason: "embedded message failed validation",
5769 cause: err,
5770 }
5771 }
5772 }
5773
5774 case *HeaderMatcher_RangeMatch:
5775 if v == nil {
5776 err := HeaderMatcherValidationError{
5777 field: "HeaderMatchSpecifier",
5778 reason: "oneof value cannot be a typed-nil",
5779 }
5780 if !all {
5781 return err
5782 }
5783 errors = append(errors, err)
5784 }
5785
5786 if all {
5787 switch v := interface{}(m.GetRangeMatch()).(type) {
5788 case interface{ ValidateAll() error }:
5789 if err := v.ValidateAll(); err != nil {
5790 errors = append(errors, HeaderMatcherValidationError{
5791 field: "RangeMatch",
5792 reason: "embedded message failed validation",
5793 cause: err,
5794 })
5795 }
5796 case interface{ Validate() error }:
5797 if err := v.Validate(); err != nil {
5798 errors = append(errors, HeaderMatcherValidationError{
5799 field: "RangeMatch",
5800 reason: "embedded message failed validation",
5801 cause: err,
5802 })
5803 }
5804 }
5805 } else if v, ok := interface{}(m.GetRangeMatch()).(interface{ Validate() error }); ok {
5806 if err := v.Validate(); err != nil {
5807 return HeaderMatcherValidationError{
5808 field: "RangeMatch",
5809 reason: "embedded message failed validation",
5810 cause: err,
5811 }
5812 }
5813 }
5814
5815 case *HeaderMatcher_PresentMatch:
5816 if v == nil {
5817 err := HeaderMatcherValidationError{
5818 field: "HeaderMatchSpecifier",
5819 reason: "oneof value cannot be a typed-nil",
5820 }
5821 if !all {
5822 return err
5823 }
5824 errors = append(errors, err)
5825 }
5826 // no validation rules for PresentMatch
5827 case *HeaderMatcher_PrefixMatch:
5828 if v == nil {
5829 err := HeaderMatcherValidationError{
5830 field: "HeaderMatchSpecifier",
5831 reason: "oneof value cannot be a typed-nil",
5832 }
5833 if !all {
5834 return err
5835 }
5836 errors = append(errors, err)
5837 }
5838
5839 if utf8.RuneCountInString(m.GetPrefixMatch()) < 1 {
5840 err := HeaderMatcherValidationError{
5841 field: "PrefixMatch",
5842 reason: "value length must be at least 1 runes",
5843 }
5844 if !all {
5845 return err
5846 }
5847 errors = append(errors, err)
5848 }
5849
5850 case *HeaderMatcher_SuffixMatch:
5851 if v == nil {
5852 err := HeaderMatcherValidationError{
5853 field: "HeaderMatchSpecifier",
5854 reason: "oneof value cannot be a typed-nil",
5855 }
5856 if !all {
5857 return err
5858 }
5859 errors = append(errors, err)
5860 }
5861
5862 if utf8.RuneCountInString(m.GetSuffixMatch()) < 1 {
5863 err := HeaderMatcherValidationError{
5864 field: "SuffixMatch",
5865 reason: "value length must be at least 1 runes",
5866 }
5867 if !all {
5868 return err
5869 }
5870 errors = append(errors, err)
5871 }
5872
5873 case *HeaderMatcher_ContainsMatch:
5874 if v == nil {
5875 err := HeaderMatcherValidationError{
5876 field: "HeaderMatchSpecifier",
5877 reason: "oneof value cannot be a typed-nil",
5878 }
5879 if !all {
5880 return err
5881 }
5882 errors = append(errors, err)
5883 }
5884
5885 if utf8.RuneCountInString(m.GetContainsMatch()) < 1 {
5886 err := HeaderMatcherValidationError{
5887 field: "ContainsMatch",
5888 reason: "value length must be at least 1 runes",
5889 }
5890 if !all {
5891 return err
5892 }
5893 errors = append(errors, err)
5894 }
5895
5896 case *HeaderMatcher_StringMatch:
5897 if v == nil {
5898 err := HeaderMatcherValidationError{
5899 field: "HeaderMatchSpecifier",
5900 reason: "oneof value cannot be a typed-nil",
5901 }
5902 if !all {
5903 return err
5904 }
5905 errors = append(errors, err)
5906 }
5907
5908 if all {
5909 switch v := interface{}(m.GetStringMatch()).(type) {
5910 case interface{ ValidateAll() error }:
5911 if err := v.ValidateAll(); err != nil {
5912 errors = append(errors, HeaderMatcherValidationError{
5913 field: "StringMatch",
5914 reason: "embedded message failed validation",
5915 cause: err,
5916 })
5917 }
5918 case interface{ Validate() error }:
5919 if err := v.Validate(); err != nil {
5920 errors = append(errors, HeaderMatcherValidationError{
5921 field: "StringMatch",
5922 reason: "embedded message failed validation",
5923 cause: err,
5924 })
5925 }
5926 }
5927 } else if v, ok := interface{}(m.GetStringMatch()).(interface{ Validate() error }); ok {
5928 if err := v.Validate(); err != nil {
5929 return HeaderMatcherValidationError{
5930 field: "StringMatch",
5931 reason: "embedded message failed validation",
5932 cause: err,
5933 }
5934 }
5935 }
5936
5937 default:
5938 _ = v // ensures v is used
5939 }
5940
5941 if len(errors) > 0 {
5942 return HeaderMatcherMultiError(errors)
5943 }
5944
5945 return nil
5946 }
5947
5948 // HeaderMatcherMultiError is an error wrapping multiple validation errors
5949 // returned by HeaderMatcher.ValidateAll() if the designated constraints
5950 // aren't met.
5951 type HeaderMatcherMultiError []error
5952
5953 // Error returns a concatenation of all the error messages it wraps.
5954 func (m HeaderMatcherMultiError) Error() string {
5955 var msgs []string
5956 for _, err := range m {
5957 msgs = append(msgs, err.Error())
5958 }
5959 return strings.Join(msgs, "; ")
5960 }
5961
5962 // AllErrors returns a list of validation violation errors.
5963 func (m HeaderMatcherMultiError) AllErrors() []error { return m }
5964
5965 // HeaderMatcherValidationError is the validation error returned by
5966 // HeaderMatcher.Validate if the designated constraints aren't met.
5967 type HeaderMatcherValidationError struct {
5968 field string
5969 reason string
5970 cause error
5971 key bool
5972 }
5973
5974 // Field function returns field value.
5975 func (e HeaderMatcherValidationError) Field() string { return e.field }
5976
5977 // Reason function returns reason value.
5978 func (e HeaderMatcherValidationError) Reason() string { return e.reason }
5979
5980 // Cause function returns cause value.
5981 func (e HeaderMatcherValidationError) Cause() error { return e.cause }
5982
5983 // Key function returns key value.
5984 func (e HeaderMatcherValidationError) Key() bool { return e.key }
5985
5986 // ErrorName returns error name.
5987 func (e HeaderMatcherValidationError) ErrorName() string { return "HeaderMatcherValidationError" }
5988
5989 // Error satisfies the builtin error interface
5990 func (e HeaderMatcherValidationError) Error() string {
5991 cause := ""
5992 if e.cause != nil {
5993 cause = fmt.Sprintf(" | caused by: %v", e.cause)
5994 }
5995
5996 key := ""
5997 if e.key {
5998 key = "key for "
5999 }
6000
6001 return fmt.Sprintf(
6002 "invalid %sHeaderMatcher.%s: %s%s",
6003 key,
6004 e.field,
6005 e.reason,
6006 cause)
6007 }
6008
6009 var _ error = HeaderMatcherValidationError{}
6010
6011 var _ interface {
6012 Field() string
6013 Reason() string
6014 Key() bool
6015 Cause() error
6016 ErrorName() string
6017 } = HeaderMatcherValidationError{}
6018
6019 var _HeaderMatcher_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
6020
6021 // Validate checks the field values on QueryParameterMatcher with the rules
6022 // defined in the proto definition for this message. If any rules are
6023 // violated, the first error encountered is returned, or nil if there are no violations.
6024 func (m *QueryParameterMatcher) Validate() error {
6025 return m.validate(false)
6026 }
6027
6028 // ValidateAll checks the field values on QueryParameterMatcher with the rules
6029 // defined in the proto definition for this message. If any rules are
6030 // violated, the result is a list of violation errors wrapped in
6031 // QueryParameterMatcherMultiError, or nil if none found.
6032 func (m *QueryParameterMatcher) ValidateAll() error {
6033 return m.validate(true)
6034 }
6035
6036 func (m *QueryParameterMatcher) validate(all bool) error {
6037 if m == nil {
6038 return nil
6039 }
6040
6041 var errors []error
6042
6043 if utf8.RuneCountInString(m.GetName()) < 1 {
6044 err := QueryParameterMatcherValidationError{
6045 field: "Name",
6046 reason: "value length must be at least 1 runes",
6047 }
6048 if !all {
6049 return err
6050 }
6051 errors = append(errors, err)
6052 }
6053
6054 if len(m.GetName()) > 1024 {
6055 err := QueryParameterMatcherValidationError{
6056 field: "Name",
6057 reason: "value length must be at most 1024 bytes",
6058 }
6059 if !all {
6060 return err
6061 }
6062 errors = append(errors, err)
6063 }
6064
6065 switch v := m.QueryParameterMatchSpecifier.(type) {
6066 case *QueryParameterMatcher_StringMatch:
6067 if v == nil {
6068 err := QueryParameterMatcherValidationError{
6069 field: "QueryParameterMatchSpecifier",
6070 reason: "oneof value cannot be a typed-nil",
6071 }
6072 if !all {
6073 return err
6074 }
6075 errors = append(errors, err)
6076 }
6077
6078 if m.GetStringMatch() == nil {
6079 err := QueryParameterMatcherValidationError{
6080 field: "StringMatch",
6081 reason: "value is required",
6082 }
6083 if !all {
6084 return err
6085 }
6086 errors = append(errors, err)
6087 }
6088
6089 if all {
6090 switch v := interface{}(m.GetStringMatch()).(type) {
6091 case interface{ ValidateAll() error }:
6092 if err := v.ValidateAll(); err != nil {
6093 errors = append(errors, QueryParameterMatcherValidationError{
6094 field: "StringMatch",
6095 reason: "embedded message failed validation",
6096 cause: err,
6097 })
6098 }
6099 case interface{ Validate() error }:
6100 if err := v.Validate(); err != nil {
6101 errors = append(errors, QueryParameterMatcherValidationError{
6102 field: "StringMatch",
6103 reason: "embedded message failed validation",
6104 cause: err,
6105 })
6106 }
6107 }
6108 } else if v, ok := interface{}(m.GetStringMatch()).(interface{ Validate() error }); ok {
6109 if err := v.Validate(); err != nil {
6110 return QueryParameterMatcherValidationError{
6111 field: "StringMatch",
6112 reason: "embedded message failed validation",
6113 cause: err,
6114 }
6115 }
6116 }
6117
6118 case *QueryParameterMatcher_PresentMatch:
6119 if v == nil {
6120 err := QueryParameterMatcherValidationError{
6121 field: "QueryParameterMatchSpecifier",
6122 reason: "oneof value cannot be a typed-nil",
6123 }
6124 if !all {
6125 return err
6126 }
6127 errors = append(errors, err)
6128 }
6129 // no validation rules for PresentMatch
6130 default:
6131 _ = v // ensures v is used
6132 }
6133
6134 if len(errors) > 0 {
6135 return QueryParameterMatcherMultiError(errors)
6136 }
6137
6138 return nil
6139 }
6140
6141 // QueryParameterMatcherMultiError is an error wrapping multiple validation
6142 // errors returned by QueryParameterMatcher.ValidateAll() if the designated
6143 // constraints aren't met.
6144 type QueryParameterMatcherMultiError []error
6145
6146 // Error returns a concatenation of all the error messages it wraps.
6147 func (m QueryParameterMatcherMultiError) Error() string {
6148 var msgs []string
6149 for _, err := range m {
6150 msgs = append(msgs, err.Error())
6151 }
6152 return strings.Join(msgs, "; ")
6153 }
6154
6155 // AllErrors returns a list of validation violation errors.
6156 func (m QueryParameterMatcherMultiError) AllErrors() []error { return m }
6157
6158 // QueryParameterMatcherValidationError is the validation error returned by
6159 // QueryParameterMatcher.Validate if the designated constraints aren't met.
6160 type QueryParameterMatcherValidationError struct {
6161 field string
6162 reason string
6163 cause error
6164 key bool
6165 }
6166
6167 // Field function returns field value.
6168 func (e QueryParameterMatcherValidationError) Field() string { return e.field }
6169
6170 // Reason function returns reason value.
6171 func (e QueryParameterMatcherValidationError) Reason() string { return e.reason }
6172
6173 // Cause function returns cause value.
6174 func (e QueryParameterMatcherValidationError) Cause() error { return e.cause }
6175
6176 // Key function returns key value.
6177 func (e QueryParameterMatcherValidationError) Key() bool { return e.key }
6178
6179 // ErrorName returns error name.
6180 func (e QueryParameterMatcherValidationError) ErrorName() string {
6181 return "QueryParameterMatcherValidationError"
6182 }
6183
6184 // Error satisfies the builtin error interface
6185 func (e QueryParameterMatcherValidationError) Error() string {
6186 cause := ""
6187 if e.cause != nil {
6188 cause = fmt.Sprintf(" | caused by: %v", e.cause)
6189 }
6190
6191 key := ""
6192 if e.key {
6193 key = "key for "
6194 }
6195
6196 return fmt.Sprintf(
6197 "invalid %sQueryParameterMatcher.%s: %s%s",
6198 key,
6199 e.field,
6200 e.reason,
6201 cause)
6202 }
6203
6204 var _ error = QueryParameterMatcherValidationError{}
6205
6206 var _ interface {
6207 Field() string
6208 Reason() string
6209 Key() bool
6210 Cause() error
6211 ErrorName() string
6212 } = QueryParameterMatcherValidationError{}
6213
6214 // Validate checks the field values on InternalRedirectPolicy with the rules
6215 // defined in the proto definition for this message. If any rules are
6216 // violated, the first error encountered is returned, or nil if there are no violations.
6217 func (m *InternalRedirectPolicy) Validate() error {
6218 return m.validate(false)
6219 }
6220
6221 // ValidateAll checks the field values on InternalRedirectPolicy with the rules
6222 // defined in the proto definition for this message. If any rules are
6223 // violated, the result is a list of violation errors wrapped in
6224 // InternalRedirectPolicyMultiError, or nil if none found.
6225 func (m *InternalRedirectPolicy) ValidateAll() error {
6226 return m.validate(true)
6227 }
6228
6229 func (m *InternalRedirectPolicy) validate(all bool) error {
6230 if m == nil {
6231 return nil
6232 }
6233
6234 var errors []error
6235
6236 if all {
6237 switch v := interface{}(m.GetMaxInternalRedirects()).(type) {
6238 case interface{ ValidateAll() error }:
6239 if err := v.ValidateAll(); err != nil {
6240 errors = append(errors, InternalRedirectPolicyValidationError{
6241 field: "MaxInternalRedirects",
6242 reason: "embedded message failed validation",
6243 cause: err,
6244 })
6245 }
6246 case interface{ Validate() error }:
6247 if err := v.Validate(); err != nil {
6248 errors = append(errors, InternalRedirectPolicyValidationError{
6249 field: "MaxInternalRedirects",
6250 reason: "embedded message failed validation",
6251 cause: err,
6252 })
6253 }
6254 }
6255 } else if v, ok := interface{}(m.GetMaxInternalRedirects()).(interface{ Validate() error }); ok {
6256 if err := v.Validate(); err != nil {
6257 return InternalRedirectPolicyValidationError{
6258 field: "MaxInternalRedirects",
6259 reason: "embedded message failed validation",
6260 cause: err,
6261 }
6262 }
6263 }
6264
6265 if len(m.GetRedirectResponseCodes()) > 5 {
6266 err := InternalRedirectPolicyValidationError{
6267 field: "RedirectResponseCodes",
6268 reason: "value must contain no more than 5 item(s)",
6269 }
6270 if !all {
6271 return err
6272 }
6273 errors = append(errors, err)
6274 }
6275
6276 for idx, item := range m.GetPredicates() {
6277 _, _ = idx, item
6278
6279 if all {
6280 switch v := interface{}(item).(type) {
6281 case interface{ ValidateAll() error }:
6282 if err := v.ValidateAll(); err != nil {
6283 errors = append(errors, InternalRedirectPolicyValidationError{
6284 field: fmt.Sprintf("Predicates[%v]", idx),
6285 reason: "embedded message failed validation",
6286 cause: err,
6287 })
6288 }
6289 case interface{ Validate() error }:
6290 if err := v.Validate(); err != nil {
6291 errors = append(errors, InternalRedirectPolicyValidationError{
6292 field: fmt.Sprintf("Predicates[%v]", idx),
6293 reason: "embedded message failed validation",
6294 cause: err,
6295 })
6296 }
6297 }
6298 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
6299 if err := v.Validate(); err != nil {
6300 return InternalRedirectPolicyValidationError{
6301 field: fmt.Sprintf("Predicates[%v]", idx),
6302 reason: "embedded message failed validation",
6303 cause: err,
6304 }
6305 }
6306 }
6307
6308 }
6309
6310 // no validation rules for AllowCrossSchemeRedirect
6311
6312 _InternalRedirectPolicy_ResponseHeadersToCopy_Unique := make(map[string]struct{}, len(m.GetResponseHeadersToCopy()))
6313
6314 for idx, item := range m.GetResponseHeadersToCopy() {
6315 _, _ = idx, item
6316
6317 if _, exists := _InternalRedirectPolicy_ResponseHeadersToCopy_Unique[item]; exists {
6318 err := InternalRedirectPolicyValidationError{
6319 field: fmt.Sprintf("ResponseHeadersToCopy[%v]", idx),
6320 reason: "repeated value must contain unique items",
6321 }
6322 if !all {
6323 return err
6324 }
6325 errors = append(errors, err)
6326 } else {
6327 _InternalRedirectPolicy_ResponseHeadersToCopy_Unique[item] = struct{}{}
6328 }
6329
6330 if !_InternalRedirectPolicy_ResponseHeadersToCopy_Pattern.MatchString(item) {
6331 err := InternalRedirectPolicyValidationError{
6332 field: fmt.Sprintf("ResponseHeadersToCopy[%v]", idx),
6333 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
6334 }
6335 if !all {
6336 return err
6337 }
6338 errors = append(errors, err)
6339 }
6340
6341 }
6342
6343 if len(errors) > 0 {
6344 return InternalRedirectPolicyMultiError(errors)
6345 }
6346
6347 return nil
6348 }
6349
6350 // InternalRedirectPolicyMultiError is an error wrapping multiple validation
6351 // errors returned by InternalRedirectPolicy.ValidateAll() if the designated
6352 // constraints aren't met.
6353 type InternalRedirectPolicyMultiError []error
6354
6355 // Error returns a concatenation of all the error messages it wraps.
6356 func (m InternalRedirectPolicyMultiError) Error() string {
6357 var msgs []string
6358 for _, err := range m {
6359 msgs = append(msgs, err.Error())
6360 }
6361 return strings.Join(msgs, "; ")
6362 }
6363
6364 // AllErrors returns a list of validation violation errors.
6365 func (m InternalRedirectPolicyMultiError) AllErrors() []error { return m }
6366
6367 // InternalRedirectPolicyValidationError is the validation error returned by
6368 // InternalRedirectPolicy.Validate if the designated constraints aren't met.
6369 type InternalRedirectPolicyValidationError struct {
6370 field string
6371 reason string
6372 cause error
6373 key bool
6374 }
6375
6376 // Field function returns field value.
6377 func (e InternalRedirectPolicyValidationError) Field() string { return e.field }
6378
6379 // Reason function returns reason value.
6380 func (e InternalRedirectPolicyValidationError) Reason() string { return e.reason }
6381
6382 // Cause function returns cause value.
6383 func (e InternalRedirectPolicyValidationError) Cause() error { return e.cause }
6384
6385 // Key function returns key value.
6386 func (e InternalRedirectPolicyValidationError) Key() bool { return e.key }
6387
6388 // ErrorName returns error name.
6389 func (e InternalRedirectPolicyValidationError) ErrorName() string {
6390 return "InternalRedirectPolicyValidationError"
6391 }
6392
6393 // Error satisfies the builtin error interface
6394 func (e InternalRedirectPolicyValidationError) Error() string {
6395 cause := ""
6396 if e.cause != nil {
6397 cause = fmt.Sprintf(" | caused by: %v", e.cause)
6398 }
6399
6400 key := ""
6401 if e.key {
6402 key = "key for "
6403 }
6404
6405 return fmt.Sprintf(
6406 "invalid %sInternalRedirectPolicy.%s: %s%s",
6407 key,
6408 e.field,
6409 e.reason,
6410 cause)
6411 }
6412
6413 var _ error = InternalRedirectPolicyValidationError{}
6414
6415 var _ interface {
6416 Field() string
6417 Reason() string
6418 Key() bool
6419 Cause() error
6420 ErrorName() string
6421 } = InternalRedirectPolicyValidationError{}
6422
6423 var _InternalRedirectPolicy_ResponseHeadersToCopy_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
6424
6425 // Validate checks the field values on FilterConfig with the rules defined in
6426 // the proto definition for this message. If any rules are violated, the first
6427 // error encountered is returned, or nil if there are no violations.
6428 func (m *FilterConfig) Validate() error {
6429 return m.validate(false)
6430 }
6431
6432 // ValidateAll checks the field values on FilterConfig with the rules defined
6433 // in the proto definition for this message. If any rules are violated, the
6434 // result is a list of violation errors wrapped in FilterConfigMultiError, or
6435 // nil if none found.
6436 func (m *FilterConfig) ValidateAll() error {
6437 return m.validate(true)
6438 }
6439
6440 func (m *FilterConfig) validate(all bool) error {
6441 if m == nil {
6442 return nil
6443 }
6444
6445 var errors []error
6446
6447 if all {
6448 switch v := interface{}(m.GetConfig()).(type) {
6449 case interface{ ValidateAll() error }:
6450 if err := v.ValidateAll(); err != nil {
6451 errors = append(errors, FilterConfigValidationError{
6452 field: "Config",
6453 reason: "embedded message failed validation",
6454 cause: err,
6455 })
6456 }
6457 case interface{ Validate() error }:
6458 if err := v.Validate(); err != nil {
6459 errors = append(errors, FilterConfigValidationError{
6460 field: "Config",
6461 reason: "embedded message failed validation",
6462 cause: err,
6463 })
6464 }
6465 }
6466 } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
6467 if err := v.Validate(); err != nil {
6468 return FilterConfigValidationError{
6469 field: "Config",
6470 reason: "embedded message failed validation",
6471 cause: err,
6472 }
6473 }
6474 }
6475
6476 // no validation rules for IsOptional
6477
6478 // no validation rules for Disabled
6479
6480 if len(errors) > 0 {
6481 return FilterConfigMultiError(errors)
6482 }
6483
6484 return nil
6485 }
6486
6487 // FilterConfigMultiError is an error wrapping multiple validation errors
6488 // returned by FilterConfig.ValidateAll() if the designated constraints aren't met.
6489 type FilterConfigMultiError []error
6490
6491 // Error returns a concatenation of all the error messages it wraps.
6492 func (m FilterConfigMultiError) Error() string {
6493 var msgs []string
6494 for _, err := range m {
6495 msgs = append(msgs, err.Error())
6496 }
6497 return strings.Join(msgs, "; ")
6498 }
6499
6500 // AllErrors returns a list of validation violation errors.
6501 func (m FilterConfigMultiError) AllErrors() []error { return m }
6502
6503 // FilterConfigValidationError is the validation error returned by
6504 // FilterConfig.Validate if the designated constraints aren't met.
6505 type FilterConfigValidationError struct {
6506 field string
6507 reason string
6508 cause error
6509 key bool
6510 }
6511
6512 // Field function returns field value.
6513 func (e FilterConfigValidationError) Field() string { return e.field }
6514
6515 // Reason function returns reason value.
6516 func (e FilterConfigValidationError) Reason() string { return e.reason }
6517
6518 // Cause function returns cause value.
6519 func (e FilterConfigValidationError) Cause() error { return e.cause }
6520
6521 // Key function returns key value.
6522 func (e FilterConfigValidationError) Key() bool { return e.key }
6523
6524 // ErrorName returns error name.
6525 func (e FilterConfigValidationError) ErrorName() string { return "FilterConfigValidationError" }
6526
6527 // Error satisfies the builtin error interface
6528 func (e FilterConfigValidationError) Error() string {
6529 cause := ""
6530 if e.cause != nil {
6531 cause = fmt.Sprintf(" | caused by: %v", e.cause)
6532 }
6533
6534 key := ""
6535 if e.key {
6536 key = "key for "
6537 }
6538
6539 return fmt.Sprintf(
6540 "invalid %sFilterConfig.%s: %s%s",
6541 key,
6542 e.field,
6543 e.reason,
6544 cause)
6545 }
6546
6547 var _ error = FilterConfigValidationError{}
6548
6549 var _ interface {
6550 Field() string
6551 Reason() string
6552 Key() bool
6553 Cause() error
6554 ErrorName() string
6555 } = FilterConfigValidationError{}
6556
6557 // Validate checks the field values on WeightedCluster_ClusterWeight with the
6558 // rules defined in the proto definition for this message. If any rules are
6559 // violated, the first error encountered is returned, or nil if there are no violations.
6560 func (m *WeightedCluster_ClusterWeight) Validate() error {
6561 return m.validate(false)
6562 }
6563
6564 // ValidateAll checks the field values on WeightedCluster_ClusterWeight with
6565 // the rules defined in the proto definition for this message. If any rules
6566 // are violated, the result is a list of violation errors wrapped in
6567 // WeightedCluster_ClusterWeightMultiError, or nil if none found.
6568 func (m *WeightedCluster_ClusterWeight) ValidateAll() error {
6569 return m.validate(true)
6570 }
6571
6572 func (m *WeightedCluster_ClusterWeight) validate(all bool) error {
6573 if m == nil {
6574 return nil
6575 }
6576
6577 var errors []error
6578
6579 // no validation rules for Name
6580
6581 if !_WeightedCluster_ClusterWeight_ClusterHeader_Pattern.MatchString(m.GetClusterHeader()) {
6582 err := WeightedCluster_ClusterWeightValidationError{
6583 field: "ClusterHeader",
6584 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
6585 }
6586 if !all {
6587 return err
6588 }
6589 errors = append(errors, err)
6590 }
6591
6592 if all {
6593 switch v := interface{}(m.GetWeight()).(type) {
6594 case interface{ ValidateAll() error }:
6595 if err := v.ValidateAll(); err != nil {
6596 errors = append(errors, WeightedCluster_ClusterWeightValidationError{
6597 field: "Weight",
6598 reason: "embedded message failed validation",
6599 cause: err,
6600 })
6601 }
6602 case interface{ Validate() error }:
6603 if err := v.Validate(); err != nil {
6604 errors = append(errors, WeightedCluster_ClusterWeightValidationError{
6605 field: "Weight",
6606 reason: "embedded message failed validation",
6607 cause: err,
6608 })
6609 }
6610 }
6611 } else if v, ok := interface{}(m.GetWeight()).(interface{ Validate() error }); ok {
6612 if err := v.Validate(); err != nil {
6613 return WeightedCluster_ClusterWeightValidationError{
6614 field: "Weight",
6615 reason: "embedded message failed validation",
6616 cause: err,
6617 }
6618 }
6619 }
6620
6621 if all {
6622 switch v := interface{}(m.GetMetadataMatch()).(type) {
6623 case interface{ ValidateAll() error }:
6624 if err := v.ValidateAll(); err != nil {
6625 errors = append(errors, WeightedCluster_ClusterWeightValidationError{
6626 field: "MetadataMatch",
6627 reason: "embedded message failed validation",
6628 cause: err,
6629 })
6630 }
6631 case interface{ Validate() error }:
6632 if err := v.Validate(); err != nil {
6633 errors = append(errors, WeightedCluster_ClusterWeightValidationError{
6634 field: "MetadataMatch",
6635 reason: "embedded message failed validation",
6636 cause: err,
6637 })
6638 }
6639 }
6640 } else if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok {
6641 if err := v.Validate(); err != nil {
6642 return WeightedCluster_ClusterWeightValidationError{
6643 field: "MetadataMatch",
6644 reason: "embedded message failed validation",
6645 cause: err,
6646 }
6647 }
6648 }
6649
6650 if len(m.GetRequestHeadersToAdd()) > 1000 {
6651 err := WeightedCluster_ClusterWeightValidationError{
6652 field: "RequestHeadersToAdd",
6653 reason: "value must contain no more than 1000 item(s)",
6654 }
6655 if !all {
6656 return err
6657 }
6658 errors = append(errors, err)
6659 }
6660
6661 for idx, item := range m.GetRequestHeadersToAdd() {
6662 _, _ = idx, item
6663
6664 if all {
6665 switch v := interface{}(item).(type) {
6666 case interface{ ValidateAll() error }:
6667 if err := v.ValidateAll(); err != nil {
6668 errors = append(errors, WeightedCluster_ClusterWeightValidationError{
6669 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
6670 reason: "embedded message failed validation",
6671 cause: err,
6672 })
6673 }
6674 case interface{ Validate() error }:
6675 if err := v.Validate(); err != nil {
6676 errors = append(errors, WeightedCluster_ClusterWeightValidationError{
6677 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
6678 reason: "embedded message failed validation",
6679 cause: err,
6680 })
6681 }
6682 }
6683 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
6684 if err := v.Validate(); err != nil {
6685 return WeightedCluster_ClusterWeightValidationError{
6686 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
6687 reason: "embedded message failed validation",
6688 cause: err,
6689 }
6690 }
6691 }
6692
6693 }
6694
6695 for idx, item := range m.GetRequestHeadersToRemove() {
6696 _, _ = idx, item
6697
6698 if !_WeightedCluster_ClusterWeight_RequestHeadersToRemove_Pattern.MatchString(item) {
6699 err := WeightedCluster_ClusterWeightValidationError{
6700 field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx),
6701 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
6702 }
6703 if !all {
6704 return err
6705 }
6706 errors = append(errors, err)
6707 }
6708
6709 }
6710
6711 if len(m.GetResponseHeadersToAdd()) > 1000 {
6712 err := WeightedCluster_ClusterWeightValidationError{
6713 field: "ResponseHeadersToAdd",
6714 reason: "value must contain no more than 1000 item(s)",
6715 }
6716 if !all {
6717 return err
6718 }
6719 errors = append(errors, err)
6720 }
6721
6722 for idx, item := range m.GetResponseHeadersToAdd() {
6723 _, _ = idx, item
6724
6725 if all {
6726 switch v := interface{}(item).(type) {
6727 case interface{ ValidateAll() error }:
6728 if err := v.ValidateAll(); err != nil {
6729 errors = append(errors, WeightedCluster_ClusterWeightValidationError{
6730 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
6731 reason: "embedded message failed validation",
6732 cause: err,
6733 })
6734 }
6735 case interface{ Validate() error }:
6736 if err := v.Validate(); err != nil {
6737 errors = append(errors, WeightedCluster_ClusterWeightValidationError{
6738 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
6739 reason: "embedded message failed validation",
6740 cause: err,
6741 })
6742 }
6743 }
6744 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
6745 if err := v.Validate(); err != nil {
6746 return WeightedCluster_ClusterWeightValidationError{
6747 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
6748 reason: "embedded message failed validation",
6749 cause: err,
6750 }
6751 }
6752 }
6753
6754 }
6755
6756 for idx, item := range m.GetResponseHeadersToRemove() {
6757 _, _ = idx, item
6758
6759 if !_WeightedCluster_ClusterWeight_ResponseHeadersToRemove_Pattern.MatchString(item) {
6760 err := WeightedCluster_ClusterWeightValidationError{
6761 field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx),
6762 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
6763 }
6764 if !all {
6765 return err
6766 }
6767 errors = append(errors, err)
6768 }
6769
6770 }
6771
6772 {
6773 sorted_keys := make([]string, len(m.GetTypedPerFilterConfig()))
6774 i := 0
6775 for key := range m.GetTypedPerFilterConfig() {
6776 sorted_keys[i] = key
6777 i++
6778 }
6779 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
6780 for _, key := range sorted_keys {
6781 val := m.GetTypedPerFilterConfig()[key]
6782 _ = val
6783
6784 // no validation rules for TypedPerFilterConfig[key]
6785
6786 if all {
6787 switch v := interface{}(val).(type) {
6788 case interface{ ValidateAll() error }:
6789 if err := v.ValidateAll(); err != nil {
6790 errors = append(errors, WeightedCluster_ClusterWeightValidationError{
6791 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key),
6792 reason: "embedded message failed validation",
6793 cause: err,
6794 })
6795 }
6796 case interface{ Validate() error }:
6797 if err := v.Validate(); err != nil {
6798 errors = append(errors, WeightedCluster_ClusterWeightValidationError{
6799 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key),
6800 reason: "embedded message failed validation",
6801 cause: err,
6802 })
6803 }
6804 }
6805 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
6806 if err := v.Validate(); err != nil {
6807 return WeightedCluster_ClusterWeightValidationError{
6808 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key),
6809 reason: "embedded message failed validation",
6810 cause: err,
6811 }
6812 }
6813 }
6814
6815 }
6816 }
6817
6818 switch v := m.HostRewriteSpecifier.(type) {
6819 case *WeightedCluster_ClusterWeight_HostRewriteLiteral:
6820 if v == nil {
6821 err := WeightedCluster_ClusterWeightValidationError{
6822 field: "HostRewriteSpecifier",
6823 reason: "oneof value cannot be a typed-nil",
6824 }
6825 if !all {
6826 return err
6827 }
6828 errors = append(errors, err)
6829 }
6830
6831 if !_WeightedCluster_ClusterWeight_HostRewriteLiteral_Pattern.MatchString(m.GetHostRewriteLiteral()) {
6832 err := WeightedCluster_ClusterWeightValidationError{
6833 field: "HostRewriteLiteral",
6834 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
6835 }
6836 if !all {
6837 return err
6838 }
6839 errors = append(errors, err)
6840 }
6841
6842 default:
6843 _ = v // ensures v is used
6844 }
6845
6846 if len(errors) > 0 {
6847 return WeightedCluster_ClusterWeightMultiError(errors)
6848 }
6849
6850 return nil
6851 }
6852
6853 // WeightedCluster_ClusterWeightMultiError is an error wrapping multiple
6854 // validation errors returned by WeightedCluster_ClusterWeight.ValidateAll()
6855 // if the designated constraints aren't met.
6856 type WeightedCluster_ClusterWeightMultiError []error
6857
6858 // Error returns a concatenation of all the error messages it wraps.
6859 func (m WeightedCluster_ClusterWeightMultiError) Error() string {
6860 var msgs []string
6861 for _, err := range m {
6862 msgs = append(msgs, err.Error())
6863 }
6864 return strings.Join(msgs, "; ")
6865 }
6866
6867 // AllErrors returns a list of validation violation errors.
6868 func (m WeightedCluster_ClusterWeightMultiError) AllErrors() []error { return m }
6869
6870 // WeightedCluster_ClusterWeightValidationError is the validation error
6871 // returned by WeightedCluster_ClusterWeight.Validate if the designated
6872 // constraints aren't met.
6873 type WeightedCluster_ClusterWeightValidationError struct {
6874 field string
6875 reason string
6876 cause error
6877 key bool
6878 }
6879
6880 // Field function returns field value.
6881 func (e WeightedCluster_ClusterWeightValidationError) Field() string { return e.field }
6882
6883 // Reason function returns reason value.
6884 func (e WeightedCluster_ClusterWeightValidationError) Reason() string { return e.reason }
6885
6886 // Cause function returns cause value.
6887 func (e WeightedCluster_ClusterWeightValidationError) Cause() error { return e.cause }
6888
6889 // Key function returns key value.
6890 func (e WeightedCluster_ClusterWeightValidationError) Key() bool { return e.key }
6891
6892 // ErrorName returns error name.
6893 func (e WeightedCluster_ClusterWeightValidationError) ErrorName() string {
6894 return "WeightedCluster_ClusterWeightValidationError"
6895 }
6896
6897 // Error satisfies the builtin error interface
6898 func (e WeightedCluster_ClusterWeightValidationError) Error() string {
6899 cause := ""
6900 if e.cause != nil {
6901 cause = fmt.Sprintf(" | caused by: %v", e.cause)
6902 }
6903
6904 key := ""
6905 if e.key {
6906 key = "key for "
6907 }
6908
6909 return fmt.Sprintf(
6910 "invalid %sWeightedCluster_ClusterWeight.%s: %s%s",
6911 key,
6912 e.field,
6913 e.reason,
6914 cause)
6915 }
6916
6917 var _ error = WeightedCluster_ClusterWeightValidationError{}
6918
6919 var _ interface {
6920 Field() string
6921 Reason() string
6922 Key() bool
6923 Cause() error
6924 ErrorName() string
6925 } = WeightedCluster_ClusterWeightValidationError{}
6926
6927 var _WeightedCluster_ClusterWeight_ClusterHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
6928
6929 var _WeightedCluster_ClusterWeight_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
6930
6931 var _WeightedCluster_ClusterWeight_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
6932
6933 var _WeightedCluster_ClusterWeight_HostRewriteLiteral_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
6934
6935 // Validate checks the field values on RouteMatch_GrpcRouteMatchOptions with
6936 // the rules defined in the proto definition for this message. If any rules
6937 // are violated, the first error encountered is returned, or nil if there are
6938 // no violations.
6939 func (m *RouteMatch_GrpcRouteMatchOptions) Validate() error {
6940 return m.validate(false)
6941 }
6942
6943 // ValidateAll checks the field values on RouteMatch_GrpcRouteMatchOptions with
6944 // the rules defined in the proto definition for this message. If any rules
6945 // are violated, the result is a list of violation errors wrapped in
6946 // RouteMatch_GrpcRouteMatchOptionsMultiError, or nil if none found.
6947 func (m *RouteMatch_GrpcRouteMatchOptions) ValidateAll() error {
6948 return m.validate(true)
6949 }
6950
6951 func (m *RouteMatch_GrpcRouteMatchOptions) validate(all bool) error {
6952 if m == nil {
6953 return nil
6954 }
6955
6956 var errors []error
6957
6958 if len(errors) > 0 {
6959 return RouteMatch_GrpcRouteMatchOptionsMultiError(errors)
6960 }
6961
6962 return nil
6963 }
6964
6965 // RouteMatch_GrpcRouteMatchOptionsMultiError is an error wrapping multiple
6966 // validation errors returned by
6967 // RouteMatch_GrpcRouteMatchOptions.ValidateAll() if the designated
6968 // constraints aren't met.
6969 type RouteMatch_GrpcRouteMatchOptionsMultiError []error
6970
6971 // Error returns a concatenation of all the error messages it wraps.
6972 func (m RouteMatch_GrpcRouteMatchOptionsMultiError) Error() string {
6973 var msgs []string
6974 for _, err := range m {
6975 msgs = append(msgs, err.Error())
6976 }
6977 return strings.Join(msgs, "; ")
6978 }
6979
6980 // AllErrors returns a list of validation violation errors.
6981 func (m RouteMatch_GrpcRouteMatchOptionsMultiError) AllErrors() []error { return m }
6982
6983 // RouteMatch_GrpcRouteMatchOptionsValidationError is the validation error
6984 // returned by RouteMatch_GrpcRouteMatchOptions.Validate if the designated
6985 // constraints aren't met.
6986 type RouteMatch_GrpcRouteMatchOptionsValidationError struct {
6987 field string
6988 reason string
6989 cause error
6990 key bool
6991 }
6992
6993 // Field function returns field value.
6994 func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Field() string { return e.field }
6995
6996 // Reason function returns reason value.
6997 func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Reason() string { return e.reason }
6998
6999 // Cause function returns cause value.
7000 func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Cause() error { return e.cause }
7001
7002 // Key function returns key value.
7003 func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Key() bool { return e.key }
7004
7005 // ErrorName returns error name.
7006 func (e RouteMatch_GrpcRouteMatchOptionsValidationError) ErrorName() string {
7007 return "RouteMatch_GrpcRouteMatchOptionsValidationError"
7008 }
7009
7010 // Error satisfies the builtin error interface
7011 func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Error() string {
7012 cause := ""
7013 if e.cause != nil {
7014 cause = fmt.Sprintf(" | caused by: %v", e.cause)
7015 }
7016
7017 key := ""
7018 if e.key {
7019 key = "key for "
7020 }
7021
7022 return fmt.Sprintf(
7023 "invalid %sRouteMatch_GrpcRouteMatchOptions.%s: %s%s",
7024 key,
7025 e.field,
7026 e.reason,
7027 cause)
7028 }
7029
7030 var _ error = RouteMatch_GrpcRouteMatchOptionsValidationError{}
7031
7032 var _ interface {
7033 Field() string
7034 Reason() string
7035 Key() bool
7036 Cause() error
7037 ErrorName() string
7038 } = RouteMatch_GrpcRouteMatchOptionsValidationError{}
7039
7040 // Validate checks the field values on RouteMatch_TlsContextMatchOptions with
7041 // the rules defined in the proto definition for this message. If any rules
7042 // are violated, the first error encountered is returned, or nil if there are
7043 // no violations.
7044 func (m *RouteMatch_TlsContextMatchOptions) Validate() error {
7045 return m.validate(false)
7046 }
7047
7048 // ValidateAll checks the field values on RouteMatch_TlsContextMatchOptions
7049 // with the rules defined in the proto definition for this message. If any
7050 // rules are violated, the result is a list of violation errors wrapped in
7051 // RouteMatch_TlsContextMatchOptionsMultiError, or nil if none found.
7052 func (m *RouteMatch_TlsContextMatchOptions) ValidateAll() error {
7053 return m.validate(true)
7054 }
7055
7056 func (m *RouteMatch_TlsContextMatchOptions) validate(all bool) error {
7057 if m == nil {
7058 return nil
7059 }
7060
7061 var errors []error
7062
7063 if all {
7064 switch v := interface{}(m.GetPresented()).(type) {
7065 case interface{ ValidateAll() error }:
7066 if err := v.ValidateAll(); err != nil {
7067 errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{
7068 field: "Presented",
7069 reason: "embedded message failed validation",
7070 cause: err,
7071 })
7072 }
7073 case interface{ Validate() error }:
7074 if err := v.Validate(); err != nil {
7075 errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{
7076 field: "Presented",
7077 reason: "embedded message failed validation",
7078 cause: err,
7079 })
7080 }
7081 }
7082 } else if v, ok := interface{}(m.GetPresented()).(interface{ Validate() error }); ok {
7083 if err := v.Validate(); err != nil {
7084 return RouteMatch_TlsContextMatchOptionsValidationError{
7085 field: "Presented",
7086 reason: "embedded message failed validation",
7087 cause: err,
7088 }
7089 }
7090 }
7091
7092 if all {
7093 switch v := interface{}(m.GetValidated()).(type) {
7094 case interface{ ValidateAll() error }:
7095 if err := v.ValidateAll(); err != nil {
7096 errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{
7097 field: "Validated",
7098 reason: "embedded message failed validation",
7099 cause: err,
7100 })
7101 }
7102 case interface{ Validate() error }:
7103 if err := v.Validate(); err != nil {
7104 errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{
7105 field: "Validated",
7106 reason: "embedded message failed validation",
7107 cause: err,
7108 })
7109 }
7110 }
7111 } else if v, ok := interface{}(m.GetValidated()).(interface{ Validate() error }); ok {
7112 if err := v.Validate(); err != nil {
7113 return RouteMatch_TlsContextMatchOptionsValidationError{
7114 field: "Validated",
7115 reason: "embedded message failed validation",
7116 cause: err,
7117 }
7118 }
7119 }
7120
7121 if len(errors) > 0 {
7122 return RouteMatch_TlsContextMatchOptionsMultiError(errors)
7123 }
7124
7125 return nil
7126 }
7127
7128 // RouteMatch_TlsContextMatchOptionsMultiError is an error wrapping multiple
7129 // validation errors returned by
7130 // RouteMatch_TlsContextMatchOptions.ValidateAll() if the designated
7131 // constraints aren't met.
7132 type RouteMatch_TlsContextMatchOptionsMultiError []error
7133
7134 // Error returns a concatenation of all the error messages it wraps.
7135 func (m RouteMatch_TlsContextMatchOptionsMultiError) Error() string {
7136 var msgs []string
7137 for _, err := range m {
7138 msgs = append(msgs, err.Error())
7139 }
7140 return strings.Join(msgs, "; ")
7141 }
7142
7143 // AllErrors returns a list of validation violation errors.
7144 func (m RouteMatch_TlsContextMatchOptionsMultiError) AllErrors() []error { return m }
7145
7146 // RouteMatch_TlsContextMatchOptionsValidationError is the validation error
7147 // returned by RouteMatch_TlsContextMatchOptions.Validate if the designated
7148 // constraints aren't met.
7149 type RouteMatch_TlsContextMatchOptionsValidationError struct {
7150 field string
7151 reason string
7152 cause error
7153 key bool
7154 }
7155
7156 // Field function returns field value.
7157 func (e RouteMatch_TlsContextMatchOptionsValidationError) Field() string { return e.field }
7158
7159 // Reason function returns reason value.
7160 func (e RouteMatch_TlsContextMatchOptionsValidationError) Reason() string { return e.reason }
7161
7162 // Cause function returns cause value.
7163 func (e RouteMatch_TlsContextMatchOptionsValidationError) Cause() error { return e.cause }
7164
7165 // Key function returns key value.
7166 func (e RouteMatch_TlsContextMatchOptionsValidationError) Key() bool { return e.key }
7167
7168 // ErrorName returns error name.
7169 func (e RouteMatch_TlsContextMatchOptionsValidationError) ErrorName() string {
7170 return "RouteMatch_TlsContextMatchOptionsValidationError"
7171 }
7172
7173 // Error satisfies the builtin error interface
7174 func (e RouteMatch_TlsContextMatchOptionsValidationError) Error() string {
7175 cause := ""
7176 if e.cause != nil {
7177 cause = fmt.Sprintf(" | caused by: %v", e.cause)
7178 }
7179
7180 key := ""
7181 if e.key {
7182 key = "key for "
7183 }
7184
7185 return fmt.Sprintf(
7186 "invalid %sRouteMatch_TlsContextMatchOptions.%s: %s%s",
7187 key,
7188 e.field,
7189 e.reason,
7190 cause)
7191 }
7192
7193 var _ error = RouteMatch_TlsContextMatchOptionsValidationError{}
7194
7195 var _ interface {
7196 Field() string
7197 Reason() string
7198 Key() bool
7199 Cause() error
7200 ErrorName() string
7201 } = RouteMatch_TlsContextMatchOptionsValidationError{}
7202
7203 // Validate checks the field values on RouteMatch_ConnectMatcher with the rules
7204 // defined in the proto definition for this message. If any rules are
7205 // violated, the first error encountered is returned, or nil if there are no violations.
7206 func (m *RouteMatch_ConnectMatcher) Validate() error {
7207 return m.validate(false)
7208 }
7209
7210 // ValidateAll checks the field values on RouteMatch_ConnectMatcher with the
7211 // rules defined in the proto definition for this message. If any rules are
7212 // violated, the result is a list of violation errors wrapped in
7213 // RouteMatch_ConnectMatcherMultiError, or nil if none found.
7214 func (m *RouteMatch_ConnectMatcher) ValidateAll() error {
7215 return m.validate(true)
7216 }
7217
7218 func (m *RouteMatch_ConnectMatcher) validate(all bool) error {
7219 if m == nil {
7220 return nil
7221 }
7222
7223 var errors []error
7224
7225 if len(errors) > 0 {
7226 return RouteMatch_ConnectMatcherMultiError(errors)
7227 }
7228
7229 return nil
7230 }
7231
7232 // RouteMatch_ConnectMatcherMultiError is an error wrapping multiple validation
7233 // errors returned by RouteMatch_ConnectMatcher.ValidateAll() if the
7234 // designated constraints aren't met.
7235 type RouteMatch_ConnectMatcherMultiError []error
7236
7237 // Error returns a concatenation of all the error messages it wraps.
7238 func (m RouteMatch_ConnectMatcherMultiError) Error() string {
7239 var msgs []string
7240 for _, err := range m {
7241 msgs = append(msgs, err.Error())
7242 }
7243 return strings.Join(msgs, "; ")
7244 }
7245
7246 // AllErrors returns a list of validation violation errors.
7247 func (m RouteMatch_ConnectMatcherMultiError) AllErrors() []error { return m }
7248
7249 // RouteMatch_ConnectMatcherValidationError is the validation error returned by
7250 // RouteMatch_ConnectMatcher.Validate if the designated constraints aren't met.
7251 type RouteMatch_ConnectMatcherValidationError struct {
7252 field string
7253 reason string
7254 cause error
7255 key bool
7256 }
7257
7258 // Field function returns field value.
7259 func (e RouteMatch_ConnectMatcherValidationError) Field() string { return e.field }
7260
7261 // Reason function returns reason value.
7262 func (e RouteMatch_ConnectMatcherValidationError) Reason() string { return e.reason }
7263
7264 // Cause function returns cause value.
7265 func (e RouteMatch_ConnectMatcherValidationError) Cause() error { return e.cause }
7266
7267 // Key function returns key value.
7268 func (e RouteMatch_ConnectMatcherValidationError) Key() bool { return e.key }
7269
7270 // ErrorName returns error name.
7271 func (e RouteMatch_ConnectMatcherValidationError) ErrorName() string {
7272 return "RouteMatch_ConnectMatcherValidationError"
7273 }
7274
7275 // Error satisfies the builtin error interface
7276 func (e RouteMatch_ConnectMatcherValidationError) Error() string {
7277 cause := ""
7278 if e.cause != nil {
7279 cause = fmt.Sprintf(" | caused by: %v", e.cause)
7280 }
7281
7282 key := ""
7283 if e.key {
7284 key = "key for "
7285 }
7286
7287 return fmt.Sprintf(
7288 "invalid %sRouteMatch_ConnectMatcher.%s: %s%s",
7289 key,
7290 e.field,
7291 e.reason,
7292 cause)
7293 }
7294
7295 var _ error = RouteMatch_ConnectMatcherValidationError{}
7296
7297 var _ interface {
7298 Field() string
7299 Reason() string
7300 Key() bool
7301 Cause() error
7302 ErrorName() string
7303 } = RouteMatch_ConnectMatcherValidationError{}
7304
7305 // Validate checks the field values on RouteAction_RequestMirrorPolicy with the
7306 // rules defined in the proto definition for this message. If any rules are
7307 // violated, the first error encountered is returned, or nil if there are no violations.
7308 func (m *RouteAction_RequestMirrorPolicy) Validate() error {
7309 return m.validate(false)
7310 }
7311
7312 // ValidateAll checks the field values on RouteAction_RequestMirrorPolicy with
7313 // the rules defined in the proto definition for this message. If any rules
7314 // are violated, the result is a list of violation errors wrapped in
7315 // RouteAction_RequestMirrorPolicyMultiError, or nil if none found.
7316 func (m *RouteAction_RequestMirrorPolicy) ValidateAll() error {
7317 return m.validate(true)
7318 }
7319
7320 func (m *RouteAction_RequestMirrorPolicy) validate(all bool) error {
7321 if m == nil {
7322 return nil
7323 }
7324
7325 var errors []error
7326
7327 // no validation rules for Cluster
7328
7329 if !_RouteAction_RequestMirrorPolicy_ClusterHeader_Pattern.MatchString(m.GetClusterHeader()) {
7330 err := RouteAction_RequestMirrorPolicyValidationError{
7331 field: "ClusterHeader",
7332 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
7333 }
7334 if !all {
7335 return err
7336 }
7337 errors = append(errors, err)
7338 }
7339
7340 if all {
7341 switch v := interface{}(m.GetRuntimeFraction()).(type) {
7342 case interface{ ValidateAll() error }:
7343 if err := v.ValidateAll(); err != nil {
7344 errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{
7345 field: "RuntimeFraction",
7346 reason: "embedded message failed validation",
7347 cause: err,
7348 })
7349 }
7350 case interface{ Validate() error }:
7351 if err := v.Validate(); err != nil {
7352 errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{
7353 field: "RuntimeFraction",
7354 reason: "embedded message failed validation",
7355 cause: err,
7356 })
7357 }
7358 }
7359 } else if v, ok := interface{}(m.GetRuntimeFraction()).(interface{ Validate() error }); ok {
7360 if err := v.Validate(); err != nil {
7361 return RouteAction_RequestMirrorPolicyValidationError{
7362 field: "RuntimeFraction",
7363 reason: "embedded message failed validation",
7364 cause: err,
7365 }
7366 }
7367 }
7368
7369 if all {
7370 switch v := interface{}(m.GetTraceSampled()).(type) {
7371 case interface{ ValidateAll() error }:
7372 if err := v.ValidateAll(); err != nil {
7373 errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{
7374 field: "TraceSampled",
7375 reason: "embedded message failed validation",
7376 cause: err,
7377 })
7378 }
7379 case interface{ Validate() error }:
7380 if err := v.Validate(); err != nil {
7381 errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{
7382 field: "TraceSampled",
7383 reason: "embedded message failed validation",
7384 cause: err,
7385 })
7386 }
7387 }
7388 } else if v, ok := interface{}(m.GetTraceSampled()).(interface{ Validate() error }); ok {
7389 if err := v.Validate(); err != nil {
7390 return RouteAction_RequestMirrorPolicyValidationError{
7391 field: "TraceSampled",
7392 reason: "embedded message failed validation",
7393 cause: err,
7394 }
7395 }
7396 }
7397
7398 // no validation rules for DisableShadowHostSuffixAppend
7399
7400 if len(errors) > 0 {
7401 return RouteAction_RequestMirrorPolicyMultiError(errors)
7402 }
7403
7404 return nil
7405 }
7406
7407 // RouteAction_RequestMirrorPolicyMultiError is an error wrapping multiple
7408 // validation errors returned by RouteAction_RequestMirrorPolicy.ValidateAll()
7409 // if the designated constraints aren't met.
7410 type RouteAction_RequestMirrorPolicyMultiError []error
7411
7412 // Error returns a concatenation of all the error messages it wraps.
7413 func (m RouteAction_RequestMirrorPolicyMultiError) Error() string {
7414 var msgs []string
7415 for _, err := range m {
7416 msgs = append(msgs, err.Error())
7417 }
7418 return strings.Join(msgs, "; ")
7419 }
7420
7421 // AllErrors returns a list of validation violation errors.
7422 func (m RouteAction_RequestMirrorPolicyMultiError) AllErrors() []error { return m }
7423
7424 // RouteAction_RequestMirrorPolicyValidationError is the validation error
7425 // returned by RouteAction_RequestMirrorPolicy.Validate if the designated
7426 // constraints aren't met.
7427 type RouteAction_RequestMirrorPolicyValidationError struct {
7428 field string
7429 reason string
7430 cause error
7431 key bool
7432 }
7433
7434 // Field function returns field value.
7435 func (e RouteAction_RequestMirrorPolicyValidationError) Field() string { return e.field }
7436
7437 // Reason function returns reason value.
7438 func (e RouteAction_RequestMirrorPolicyValidationError) Reason() string { return e.reason }
7439
7440 // Cause function returns cause value.
7441 func (e RouteAction_RequestMirrorPolicyValidationError) Cause() error { return e.cause }
7442
7443 // Key function returns key value.
7444 func (e RouteAction_RequestMirrorPolicyValidationError) Key() bool { return e.key }
7445
7446 // ErrorName returns error name.
7447 func (e RouteAction_RequestMirrorPolicyValidationError) ErrorName() string {
7448 return "RouteAction_RequestMirrorPolicyValidationError"
7449 }
7450
7451 // Error satisfies the builtin error interface
7452 func (e RouteAction_RequestMirrorPolicyValidationError) Error() string {
7453 cause := ""
7454 if e.cause != nil {
7455 cause = fmt.Sprintf(" | caused by: %v", e.cause)
7456 }
7457
7458 key := ""
7459 if e.key {
7460 key = "key for "
7461 }
7462
7463 return fmt.Sprintf(
7464 "invalid %sRouteAction_RequestMirrorPolicy.%s: %s%s",
7465 key,
7466 e.field,
7467 e.reason,
7468 cause)
7469 }
7470
7471 var _ error = RouteAction_RequestMirrorPolicyValidationError{}
7472
7473 var _ interface {
7474 Field() string
7475 Reason() string
7476 Key() bool
7477 Cause() error
7478 ErrorName() string
7479 } = RouteAction_RequestMirrorPolicyValidationError{}
7480
7481 var _RouteAction_RequestMirrorPolicy_ClusterHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
7482
7483 // Validate checks the field values on RouteAction_HashPolicy with the rules
7484 // defined in the proto definition for this message. If any rules are
7485 // violated, the first error encountered is returned, or nil if there are no violations.
7486 func (m *RouteAction_HashPolicy) Validate() error {
7487 return m.validate(false)
7488 }
7489
7490 // ValidateAll checks the field values on RouteAction_HashPolicy with the rules
7491 // defined in the proto definition for this message. If any rules are
7492 // violated, the result is a list of violation errors wrapped in
7493 // RouteAction_HashPolicyMultiError, or nil if none found.
7494 func (m *RouteAction_HashPolicy) ValidateAll() error {
7495 return m.validate(true)
7496 }
7497
7498 func (m *RouteAction_HashPolicy) validate(all bool) error {
7499 if m == nil {
7500 return nil
7501 }
7502
7503 var errors []error
7504
7505 // no validation rules for Terminal
7506
7507 oneofPolicySpecifierPresent := false
7508 switch v := m.PolicySpecifier.(type) {
7509 case *RouteAction_HashPolicy_Header_:
7510 if v == nil {
7511 err := RouteAction_HashPolicyValidationError{
7512 field: "PolicySpecifier",
7513 reason: "oneof value cannot be a typed-nil",
7514 }
7515 if !all {
7516 return err
7517 }
7518 errors = append(errors, err)
7519 }
7520 oneofPolicySpecifierPresent = true
7521
7522 if all {
7523 switch v := interface{}(m.GetHeader()).(type) {
7524 case interface{ ValidateAll() error }:
7525 if err := v.ValidateAll(); err != nil {
7526 errors = append(errors, RouteAction_HashPolicyValidationError{
7527 field: "Header",
7528 reason: "embedded message failed validation",
7529 cause: err,
7530 })
7531 }
7532 case interface{ Validate() error }:
7533 if err := v.Validate(); err != nil {
7534 errors = append(errors, RouteAction_HashPolicyValidationError{
7535 field: "Header",
7536 reason: "embedded message failed validation",
7537 cause: err,
7538 })
7539 }
7540 }
7541 } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
7542 if err := v.Validate(); err != nil {
7543 return RouteAction_HashPolicyValidationError{
7544 field: "Header",
7545 reason: "embedded message failed validation",
7546 cause: err,
7547 }
7548 }
7549 }
7550
7551 case *RouteAction_HashPolicy_Cookie_:
7552 if v == nil {
7553 err := RouteAction_HashPolicyValidationError{
7554 field: "PolicySpecifier",
7555 reason: "oneof value cannot be a typed-nil",
7556 }
7557 if !all {
7558 return err
7559 }
7560 errors = append(errors, err)
7561 }
7562 oneofPolicySpecifierPresent = true
7563
7564 if all {
7565 switch v := interface{}(m.GetCookie()).(type) {
7566 case interface{ ValidateAll() error }:
7567 if err := v.ValidateAll(); err != nil {
7568 errors = append(errors, RouteAction_HashPolicyValidationError{
7569 field: "Cookie",
7570 reason: "embedded message failed validation",
7571 cause: err,
7572 })
7573 }
7574 case interface{ Validate() error }:
7575 if err := v.Validate(); err != nil {
7576 errors = append(errors, RouteAction_HashPolicyValidationError{
7577 field: "Cookie",
7578 reason: "embedded message failed validation",
7579 cause: err,
7580 })
7581 }
7582 }
7583 } else if v, ok := interface{}(m.GetCookie()).(interface{ Validate() error }); ok {
7584 if err := v.Validate(); err != nil {
7585 return RouteAction_HashPolicyValidationError{
7586 field: "Cookie",
7587 reason: "embedded message failed validation",
7588 cause: err,
7589 }
7590 }
7591 }
7592
7593 case *RouteAction_HashPolicy_ConnectionProperties_:
7594 if v == nil {
7595 err := RouteAction_HashPolicyValidationError{
7596 field: "PolicySpecifier",
7597 reason: "oneof value cannot be a typed-nil",
7598 }
7599 if !all {
7600 return err
7601 }
7602 errors = append(errors, err)
7603 }
7604 oneofPolicySpecifierPresent = true
7605
7606 if all {
7607 switch v := interface{}(m.GetConnectionProperties()).(type) {
7608 case interface{ ValidateAll() error }:
7609 if err := v.ValidateAll(); err != nil {
7610 errors = append(errors, RouteAction_HashPolicyValidationError{
7611 field: "ConnectionProperties",
7612 reason: "embedded message failed validation",
7613 cause: err,
7614 })
7615 }
7616 case interface{ Validate() error }:
7617 if err := v.Validate(); err != nil {
7618 errors = append(errors, RouteAction_HashPolicyValidationError{
7619 field: "ConnectionProperties",
7620 reason: "embedded message failed validation",
7621 cause: err,
7622 })
7623 }
7624 }
7625 } else if v, ok := interface{}(m.GetConnectionProperties()).(interface{ Validate() error }); ok {
7626 if err := v.Validate(); err != nil {
7627 return RouteAction_HashPolicyValidationError{
7628 field: "ConnectionProperties",
7629 reason: "embedded message failed validation",
7630 cause: err,
7631 }
7632 }
7633 }
7634
7635 case *RouteAction_HashPolicy_QueryParameter_:
7636 if v == nil {
7637 err := RouteAction_HashPolicyValidationError{
7638 field: "PolicySpecifier",
7639 reason: "oneof value cannot be a typed-nil",
7640 }
7641 if !all {
7642 return err
7643 }
7644 errors = append(errors, err)
7645 }
7646 oneofPolicySpecifierPresent = true
7647
7648 if all {
7649 switch v := interface{}(m.GetQueryParameter()).(type) {
7650 case interface{ ValidateAll() error }:
7651 if err := v.ValidateAll(); err != nil {
7652 errors = append(errors, RouteAction_HashPolicyValidationError{
7653 field: "QueryParameter",
7654 reason: "embedded message failed validation",
7655 cause: err,
7656 })
7657 }
7658 case interface{ Validate() error }:
7659 if err := v.Validate(); err != nil {
7660 errors = append(errors, RouteAction_HashPolicyValidationError{
7661 field: "QueryParameter",
7662 reason: "embedded message failed validation",
7663 cause: err,
7664 })
7665 }
7666 }
7667 } else if v, ok := interface{}(m.GetQueryParameter()).(interface{ Validate() error }); ok {
7668 if err := v.Validate(); err != nil {
7669 return RouteAction_HashPolicyValidationError{
7670 field: "QueryParameter",
7671 reason: "embedded message failed validation",
7672 cause: err,
7673 }
7674 }
7675 }
7676
7677 case *RouteAction_HashPolicy_FilterState_:
7678 if v == nil {
7679 err := RouteAction_HashPolicyValidationError{
7680 field: "PolicySpecifier",
7681 reason: "oneof value cannot be a typed-nil",
7682 }
7683 if !all {
7684 return err
7685 }
7686 errors = append(errors, err)
7687 }
7688 oneofPolicySpecifierPresent = true
7689
7690 if all {
7691 switch v := interface{}(m.GetFilterState()).(type) {
7692 case interface{ ValidateAll() error }:
7693 if err := v.ValidateAll(); err != nil {
7694 errors = append(errors, RouteAction_HashPolicyValidationError{
7695 field: "FilterState",
7696 reason: "embedded message failed validation",
7697 cause: err,
7698 })
7699 }
7700 case interface{ Validate() error }:
7701 if err := v.Validate(); err != nil {
7702 errors = append(errors, RouteAction_HashPolicyValidationError{
7703 field: "FilterState",
7704 reason: "embedded message failed validation",
7705 cause: err,
7706 })
7707 }
7708 }
7709 } else if v, ok := interface{}(m.GetFilterState()).(interface{ Validate() error }); ok {
7710 if err := v.Validate(); err != nil {
7711 return RouteAction_HashPolicyValidationError{
7712 field: "FilterState",
7713 reason: "embedded message failed validation",
7714 cause: err,
7715 }
7716 }
7717 }
7718
7719 default:
7720 _ = v // ensures v is used
7721 }
7722 if !oneofPolicySpecifierPresent {
7723 err := RouteAction_HashPolicyValidationError{
7724 field: "PolicySpecifier",
7725 reason: "value is required",
7726 }
7727 if !all {
7728 return err
7729 }
7730 errors = append(errors, err)
7731 }
7732
7733 if len(errors) > 0 {
7734 return RouteAction_HashPolicyMultiError(errors)
7735 }
7736
7737 return nil
7738 }
7739
7740 // RouteAction_HashPolicyMultiError is an error wrapping multiple validation
7741 // errors returned by RouteAction_HashPolicy.ValidateAll() if the designated
7742 // constraints aren't met.
7743 type RouteAction_HashPolicyMultiError []error
7744
7745 // Error returns a concatenation of all the error messages it wraps.
7746 func (m RouteAction_HashPolicyMultiError) Error() string {
7747 var msgs []string
7748 for _, err := range m {
7749 msgs = append(msgs, err.Error())
7750 }
7751 return strings.Join(msgs, "; ")
7752 }
7753
7754 // AllErrors returns a list of validation violation errors.
7755 func (m RouteAction_HashPolicyMultiError) AllErrors() []error { return m }
7756
7757 // RouteAction_HashPolicyValidationError is the validation error returned by
7758 // RouteAction_HashPolicy.Validate if the designated constraints aren't met.
7759 type RouteAction_HashPolicyValidationError struct {
7760 field string
7761 reason string
7762 cause error
7763 key bool
7764 }
7765
7766 // Field function returns field value.
7767 func (e RouteAction_HashPolicyValidationError) Field() string { return e.field }
7768
7769 // Reason function returns reason value.
7770 func (e RouteAction_HashPolicyValidationError) Reason() string { return e.reason }
7771
7772 // Cause function returns cause value.
7773 func (e RouteAction_HashPolicyValidationError) Cause() error { return e.cause }
7774
7775 // Key function returns key value.
7776 func (e RouteAction_HashPolicyValidationError) Key() bool { return e.key }
7777
7778 // ErrorName returns error name.
7779 func (e RouteAction_HashPolicyValidationError) ErrorName() string {
7780 return "RouteAction_HashPolicyValidationError"
7781 }
7782
7783 // Error satisfies the builtin error interface
7784 func (e RouteAction_HashPolicyValidationError) Error() string {
7785 cause := ""
7786 if e.cause != nil {
7787 cause = fmt.Sprintf(" | caused by: %v", e.cause)
7788 }
7789
7790 key := ""
7791 if e.key {
7792 key = "key for "
7793 }
7794
7795 return fmt.Sprintf(
7796 "invalid %sRouteAction_HashPolicy.%s: %s%s",
7797 key,
7798 e.field,
7799 e.reason,
7800 cause)
7801 }
7802
7803 var _ error = RouteAction_HashPolicyValidationError{}
7804
7805 var _ interface {
7806 Field() string
7807 Reason() string
7808 Key() bool
7809 Cause() error
7810 ErrorName() string
7811 } = RouteAction_HashPolicyValidationError{}
7812
7813 // Validate checks the field values on RouteAction_UpgradeConfig with the rules
7814 // defined in the proto definition for this message. If any rules are
7815 // violated, the first error encountered is returned, or nil if there are no violations.
7816 func (m *RouteAction_UpgradeConfig) Validate() error {
7817 return m.validate(false)
7818 }
7819
7820 // ValidateAll checks the field values on RouteAction_UpgradeConfig with the
7821 // rules defined in the proto definition for this message. If any rules are
7822 // violated, the result is a list of violation errors wrapped in
7823 // RouteAction_UpgradeConfigMultiError, or nil if none found.
7824 func (m *RouteAction_UpgradeConfig) ValidateAll() error {
7825 return m.validate(true)
7826 }
7827
7828 func (m *RouteAction_UpgradeConfig) validate(all bool) error {
7829 if m == nil {
7830 return nil
7831 }
7832
7833 var errors []error
7834
7835 if utf8.RuneCountInString(m.GetUpgradeType()) < 1 {
7836 err := RouteAction_UpgradeConfigValidationError{
7837 field: "UpgradeType",
7838 reason: "value length must be at least 1 runes",
7839 }
7840 if !all {
7841 return err
7842 }
7843 errors = append(errors, err)
7844 }
7845
7846 if !_RouteAction_UpgradeConfig_UpgradeType_Pattern.MatchString(m.GetUpgradeType()) {
7847 err := RouteAction_UpgradeConfigValidationError{
7848 field: "UpgradeType",
7849 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
7850 }
7851 if !all {
7852 return err
7853 }
7854 errors = append(errors, err)
7855 }
7856
7857 if all {
7858 switch v := interface{}(m.GetEnabled()).(type) {
7859 case interface{ ValidateAll() error }:
7860 if err := v.ValidateAll(); err != nil {
7861 errors = append(errors, RouteAction_UpgradeConfigValidationError{
7862 field: "Enabled",
7863 reason: "embedded message failed validation",
7864 cause: err,
7865 })
7866 }
7867 case interface{ Validate() error }:
7868 if err := v.Validate(); err != nil {
7869 errors = append(errors, RouteAction_UpgradeConfigValidationError{
7870 field: "Enabled",
7871 reason: "embedded message failed validation",
7872 cause: err,
7873 })
7874 }
7875 }
7876 } else if v, ok := interface{}(m.GetEnabled()).(interface{ Validate() error }); ok {
7877 if err := v.Validate(); err != nil {
7878 return RouteAction_UpgradeConfigValidationError{
7879 field: "Enabled",
7880 reason: "embedded message failed validation",
7881 cause: err,
7882 }
7883 }
7884 }
7885
7886 if all {
7887 switch v := interface{}(m.GetConnectConfig()).(type) {
7888 case interface{ ValidateAll() error }:
7889 if err := v.ValidateAll(); err != nil {
7890 errors = append(errors, RouteAction_UpgradeConfigValidationError{
7891 field: "ConnectConfig",
7892 reason: "embedded message failed validation",
7893 cause: err,
7894 })
7895 }
7896 case interface{ Validate() error }:
7897 if err := v.Validate(); err != nil {
7898 errors = append(errors, RouteAction_UpgradeConfigValidationError{
7899 field: "ConnectConfig",
7900 reason: "embedded message failed validation",
7901 cause: err,
7902 })
7903 }
7904 }
7905 } else if v, ok := interface{}(m.GetConnectConfig()).(interface{ Validate() error }); ok {
7906 if err := v.Validate(); err != nil {
7907 return RouteAction_UpgradeConfigValidationError{
7908 field: "ConnectConfig",
7909 reason: "embedded message failed validation",
7910 cause: err,
7911 }
7912 }
7913 }
7914
7915 if len(errors) > 0 {
7916 return RouteAction_UpgradeConfigMultiError(errors)
7917 }
7918
7919 return nil
7920 }
7921
7922 // RouteAction_UpgradeConfigMultiError is an error wrapping multiple validation
7923 // errors returned by RouteAction_UpgradeConfig.ValidateAll() if the
7924 // designated constraints aren't met.
7925 type RouteAction_UpgradeConfigMultiError []error
7926
7927 // Error returns a concatenation of all the error messages it wraps.
7928 func (m RouteAction_UpgradeConfigMultiError) Error() string {
7929 var msgs []string
7930 for _, err := range m {
7931 msgs = append(msgs, err.Error())
7932 }
7933 return strings.Join(msgs, "; ")
7934 }
7935
7936 // AllErrors returns a list of validation violation errors.
7937 func (m RouteAction_UpgradeConfigMultiError) AllErrors() []error { return m }
7938
7939 // RouteAction_UpgradeConfigValidationError is the validation error returned by
7940 // RouteAction_UpgradeConfig.Validate if the designated constraints aren't met.
7941 type RouteAction_UpgradeConfigValidationError struct {
7942 field string
7943 reason string
7944 cause error
7945 key bool
7946 }
7947
7948 // Field function returns field value.
7949 func (e RouteAction_UpgradeConfigValidationError) Field() string { return e.field }
7950
7951 // Reason function returns reason value.
7952 func (e RouteAction_UpgradeConfigValidationError) Reason() string { return e.reason }
7953
7954 // Cause function returns cause value.
7955 func (e RouteAction_UpgradeConfigValidationError) Cause() error { return e.cause }
7956
7957 // Key function returns key value.
7958 func (e RouteAction_UpgradeConfigValidationError) Key() bool { return e.key }
7959
7960 // ErrorName returns error name.
7961 func (e RouteAction_UpgradeConfigValidationError) ErrorName() string {
7962 return "RouteAction_UpgradeConfigValidationError"
7963 }
7964
7965 // Error satisfies the builtin error interface
7966 func (e RouteAction_UpgradeConfigValidationError) Error() string {
7967 cause := ""
7968 if e.cause != nil {
7969 cause = fmt.Sprintf(" | caused by: %v", e.cause)
7970 }
7971
7972 key := ""
7973 if e.key {
7974 key = "key for "
7975 }
7976
7977 return fmt.Sprintf(
7978 "invalid %sRouteAction_UpgradeConfig.%s: %s%s",
7979 key,
7980 e.field,
7981 e.reason,
7982 cause)
7983 }
7984
7985 var _ error = RouteAction_UpgradeConfigValidationError{}
7986
7987 var _ interface {
7988 Field() string
7989 Reason() string
7990 Key() bool
7991 Cause() error
7992 ErrorName() string
7993 } = RouteAction_UpgradeConfigValidationError{}
7994
7995 var _RouteAction_UpgradeConfig_UpgradeType_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
7996
7997 // Validate checks the field values on RouteAction_MaxStreamDuration with the
7998 // rules defined in the proto definition for this message. If any rules are
7999 // violated, the first error encountered is returned, or nil if there are no violations.
8000 func (m *RouteAction_MaxStreamDuration) Validate() error {
8001 return m.validate(false)
8002 }
8003
8004 // ValidateAll checks the field values on RouteAction_MaxStreamDuration with
8005 // the rules defined in the proto definition for this message. If any rules
8006 // are violated, the result is a list of violation errors wrapped in
8007 // RouteAction_MaxStreamDurationMultiError, or nil if none found.
8008 func (m *RouteAction_MaxStreamDuration) ValidateAll() error {
8009 return m.validate(true)
8010 }
8011
8012 func (m *RouteAction_MaxStreamDuration) validate(all bool) error {
8013 if m == nil {
8014 return nil
8015 }
8016
8017 var errors []error
8018
8019 if all {
8020 switch v := interface{}(m.GetMaxStreamDuration()).(type) {
8021 case interface{ ValidateAll() error }:
8022 if err := v.ValidateAll(); err != nil {
8023 errors = append(errors, RouteAction_MaxStreamDurationValidationError{
8024 field: "MaxStreamDuration",
8025 reason: "embedded message failed validation",
8026 cause: err,
8027 })
8028 }
8029 case interface{ Validate() error }:
8030 if err := v.Validate(); err != nil {
8031 errors = append(errors, RouteAction_MaxStreamDurationValidationError{
8032 field: "MaxStreamDuration",
8033 reason: "embedded message failed validation",
8034 cause: err,
8035 })
8036 }
8037 }
8038 } else if v, ok := interface{}(m.GetMaxStreamDuration()).(interface{ Validate() error }); ok {
8039 if err := v.Validate(); err != nil {
8040 return RouteAction_MaxStreamDurationValidationError{
8041 field: "MaxStreamDuration",
8042 reason: "embedded message failed validation",
8043 cause: err,
8044 }
8045 }
8046 }
8047
8048 if all {
8049 switch v := interface{}(m.GetGrpcTimeoutHeaderMax()).(type) {
8050 case interface{ ValidateAll() error }:
8051 if err := v.ValidateAll(); err != nil {
8052 errors = append(errors, RouteAction_MaxStreamDurationValidationError{
8053 field: "GrpcTimeoutHeaderMax",
8054 reason: "embedded message failed validation",
8055 cause: err,
8056 })
8057 }
8058 case interface{ Validate() error }:
8059 if err := v.Validate(); err != nil {
8060 errors = append(errors, RouteAction_MaxStreamDurationValidationError{
8061 field: "GrpcTimeoutHeaderMax",
8062 reason: "embedded message failed validation",
8063 cause: err,
8064 })
8065 }
8066 }
8067 } else if v, ok := interface{}(m.GetGrpcTimeoutHeaderMax()).(interface{ Validate() error }); ok {
8068 if err := v.Validate(); err != nil {
8069 return RouteAction_MaxStreamDurationValidationError{
8070 field: "GrpcTimeoutHeaderMax",
8071 reason: "embedded message failed validation",
8072 cause: err,
8073 }
8074 }
8075 }
8076
8077 if all {
8078 switch v := interface{}(m.GetGrpcTimeoutHeaderOffset()).(type) {
8079 case interface{ ValidateAll() error }:
8080 if err := v.ValidateAll(); err != nil {
8081 errors = append(errors, RouteAction_MaxStreamDurationValidationError{
8082 field: "GrpcTimeoutHeaderOffset",
8083 reason: "embedded message failed validation",
8084 cause: err,
8085 })
8086 }
8087 case interface{ Validate() error }:
8088 if err := v.Validate(); err != nil {
8089 errors = append(errors, RouteAction_MaxStreamDurationValidationError{
8090 field: "GrpcTimeoutHeaderOffset",
8091 reason: "embedded message failed validation",
8092 cause: err,
8093 })
8094 }
8095 }
8096 } else if v, ok := interface{}(m.GetGrpcTimeoutHeaderOffset()).(interface{ Validate() error }); ok {
8097 if err := v.Validate(); err != nil {
8098 return RouteAction_MaxStreamDurationValidationError{
8099 field: "GrpcTimeoutHeaderOffset",
8100 reason: "embedded message failed validation",
8101 cause: err,
8102 }
8103 }
8104 }
8105
8106 if len(errors) > 0 {
8107 return RouteAction_MaxStreamDurationMultiError(errors)
8108 }
8109
8110 return nil
8111 }
8112
8113 // RouteAction_MaxStreamDurationMultiError is an error wrapping multiple
8114 // validation errors returned by RouteAction_MaxStreamDuration.ValidateAll()
8115 // if the designated constraints aren't met.
8116 type RouteAction_MaxStreamDurationMultiError []error
8117
8118 // Error returns a concatenation of all the error messages it wraps.
8119 func (m RouteAction_MaxStreamDurationMultiError) Error() string {
8120 var msgs []string
8121 for _, err := range m {
8122 msgs = append(msgs, err.Error())
8123 }
8124 return strings.Join(msgs, "; ")
8125 }
8126
8127 // AllErrors returns a list of validation violation errors.
8128 func (m RouteAction_MaxStreamDurationMultiError) AllErrors() []error { return m }
8129
8130 // RouteAction_MaxStreamDurationValidationError is the validation error
8131 // returned by RouteAction_MaxStreamDuration.Validate if the designated
8132 // constraints aren't met.
8133 type RouteAction_MaxStreamDurationValidationError struct {
8134 field string
8135 reason string
8136 cause error
8137 key bool
8138 }
8139
8140 // Field function returns field value.
8141 func (e RouteAction_MaxStreamDurationValidationError) Field() string { return e.field }
8142
8143 // Reason function returns reason value.
8144 func (e RouteAction_MaxStreamDurationValidationError) Reason() string { return e.reason }
8145
8146 // Cause function returns cause value.
8147 func (e RouteAction_MaxStreamDurationValidationError) Cause() error { return e.cause }
8148
8149 // Key function returns key value.
8150 func (e RouteAction_MaxStreamDurationValidationError) Key() bool { return e.key }
8151
8152 // ErrorName returns error name.
8153 func (e RouteAction_MaxStreamDurationValidationError) ErrorName() string {
8154 return "RouteAction_MaxStreamDurationValidationError"
8155 }
8156
8157 // Error satisfies the builtin error interface
8158 func (e RouteAction_MaxStreamDurationValidationError) Error() string {
8159 cause := ""
8160 if e.cause != nil {
8161 cause = fmt.Sprintf(" | caused by: %v", e.cause)
8162 }
8163
8164 key := ""
8165 if e.key {
8166 key = "key for "
8167 }
8168
8169 return fmt.Sprintf(
8170 "invalid %sRouteAction_MaxStreamDuration.%s: %s%s",
8171 key,
8172 e.field,
8173 e.reason,
8174 cause)
8175 }
8176
8177 var _ error = RouteAction_MaxStreamDurationValidationError{}
8178
8179 var _ interface {
8180 Field() string
8181 Reason() string
8182 Key() bool
8183 Cause() error
8184 ErrorName() string
8185 } = RouteAction_MaxStreamDurationValidationError{}
8186
8187 // Validate checks the field values on RouteAction_HashPolicy_Header with the
8188 // rules defined in the proto definition for this message. If any rules are
8189 // violated, the first error encountered is returned, or nil if there are no violations.
8190 func (m *RouteAction_HashPolicy_Header) Validate() error {
8191 return m.validate(false)
8192 }
8193
8194 // ValidateAll checks the field values on RouteAction_HashPolicy_Header with
8195 // the rules defined in the proto definition for this message. If any rules
8196 // are violated, the result is a list of violation errors wrapped in
8197 // RouteAction_HashPolicy_HeaderMultiError, or nil if none found.
8198 func (m *RouteAction_HashPolicy_Header) ValidateAll() error {
8199 return m.validate(true)
8200 }
8201
8202 func (m *RouteAction_HashPolicy_Header) validate(all bool) error {
8203 if m == nil {
8204 return nil
8205 }
8206
8207 var errors []error
8208
8209 if utf8.RuneCountInString(m.GetHeaderName()) < 1 {
8210 err := RouteAction_HashPolicy_HeaderValidationError{
8211 field: "HeaderName",
8212 reason: "value length must be at least 1 runes",
8213 }
8214 if !all {
8215 return err
8216 }
8217 errors = append(errors, err)
8218 }
8219
8220 if !_RouteAction_HashPolicy_Header_HeaderName_Pattern.MatchString(m.GetHeaderName()) {
8221 err := RouteAction_HashPolicy_HeaderValidationError{
8222 field: "HeaderName",
8223 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
8224 }
8225 if !all {
8226 return err
8227 }
8228 errors = append(errors, err)
8229 }
8230
8231 if all {
8232 switch v := interface{}(m.GetRegexRewrite()).(type) {
8233 case interface{ ValidateAll() error }:
8234 if err := v.ValidateAll(); err != nil {
8235 errors = append(errors, RouteAction_HashPolicy_HeaderValidationError{
8236 field: "RegexRewrite",
8237 reason: "embedded message failed validation",
8238 cause: err,
8239 })
8240 }
8241 case interface{ Validate() error }:
8242 if err := v.Validate(); err != nil {
8243 errors = append(errors, RouteAction_HashPolicy_HeaderValidationError{
8244 field: "RegexRewrite",
8245 reason: "embedded message failed validation",
8246 cause: err,
8247 })
8248 }
8249 }
8250 } else if v, ok := interface{}(m.GetRegexRewrite()).(interface{ Validate() error }); ok {
8251 if err := v.Validate(); err != nil {
8252 return RouteAction_HashPolicy_HeaderValidationError{
8253 field: "RegexRewrite",
8254 reason: "embedded message failed validation",
8255 cause: err,
8256 }
8257 }
8258 }
8259
8260 if len(errors) > 0 {
8261 return RouteAction_HashPolicy_HeaderMultiError(errors)
8262 }
8263
8264 return nil
8265 }
8266
8267 // RouteAction_HashPolicy_HeaderMultiError is an error wrapping multiple
8268 // validation errors returned by RouteAction_HashPolicy_Header.ValidateAll()
8269 // if the designated constraints aren't met.
8270 type RouteAction_HashPolicy_HeaderMultiError []error
8271
8272 // Error returns a concatenation of all the error messages it wraps.
8273 func (m RouteAction_HashPolicy_HeaderMultiError) Error() string {
8274 var msgs []string
8275 for _, err := range m {
8276 msgs = append(msgs, err.Error())
8277 }
8278 return strings.Join(msgs, "; ")
8279 }
8280
8281 // AllErrors returns a list of validation violation errors.
8282 func (m RouteAction_HashPolicy_HeaderMultiError) AllErrors() []error { return m }
8283
8284 // RouteAction_HashPolicy_HeaderValidationError is the validation error
8285 // returned by RouteAction_HashPolicy_Header.Validate if the designated
8286 // constraints aren't met.
8287 type RouteAction_HashPolicy_HeaderValidationError struct {
8288 field string
8289 reason string
8290 cause error
8291 key bool
8292 }
8293
8294 // Field function returns field value.
8295 func (e RouteAction_HashPolicy_HeaderValidationError) Field() string { return e.field }
8296
8297 // Reason function returns reason value.
8298 func (e RouteAction_HashPolicy_HeaderValidationError) Reason() string { return e.reason }
8299
8300 // Cause function returns cause value.
8301 func (e RouteAction_HashPolicy_HeaderValidationError) Cause() error { return e.cause }
8302
8303 // Key function returns key value.
8304 func (e RouteAction_HashPolicy_HeaderValidationError) Key() bool { return e.key }
8305
8306 // ErrorName returns error name.
8307 func (e RouteAction_HashPolicy_HeaderValidationError) ErrorName() string {
8308 return "RouteAction_HashPolicy_HeaderValidationError"
8309 }
8310
8311 // Error satisfies the builtin error interface
8312 func (e RouteAction_HashPolicy_HeaderValidationError) Error() string {
8313 cause := ""
8314 if e.cause != nil {
8315 cause = fmt.Sprintf(" | caused by: %v", e.cause)
8316 }
8317
8318 key := ""
8319 if e.key {
8320 key = "key for "
8321 }
8322
8323 return fmt.Sprintf(
8324 "invalid %sRouteAction_HashPolicy_Header.%s: %s%s",
8325 key,
8326 e.field,
8327 e.reason,
8328 cause)
8329 }
8330
8331 var _ error = RouteAction_HashPolicy_HeaderValidationError{}
8332
8333 var _ interface {
8334 Field() string
8335 Reason() string
8336 Key() bool
8337 Cause() error
8338 ErrorName() string
8339 } = RouteAction_HashPolicy_HeaderValidationError{}
8340
8341 var _RouteAction_HashPolicy_Header_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
8342
8343 // Validate checks the field values on RouteAction_HashPolicy_CookieAttribute
8344 // with the rules defined in the proto definition for this message. If any
8345 // rules are violated, the first error encountered is returned, or nil if
8346 // there are no violations.
8347 func (m *RouteAction_HashPolicy_CookieAttribute) Validate() error {
8348 return m.validate(false)
8349 }
8350
8351 // ValidateAll checks the field values on
8352 // RouteAction_HashPolicy_CookieAttribute with the rules defined in the proto
8353 // definition for this message. If any rules are violated, the result is a
8354 // list of violation errors wrapped in
8355 // RouteAction_HashPolicy_CookieAttributeMultiError, or nil if none found.
8356 func (m *RouteAction_HashPolicy_CookieAttribute) ValidateAll() error {
8357 return m.validate(true)
8358 }
8359
8360 func (m *RouteAction_HashPolicy_CookieAttribute) validate(all bool) error {
8361 if m == nil {
8362 return nil
8363 }
8364
8365 var errors []error
8366
8367 if utf8.RuneCountInString(m.GetName()) < 1 {
8368 err := RouteAction_HashPolicy_CookieAttributeValidationError{
8369 field: "Name",
8370 reason: "value length must be at least 1 runes",
8371 }
8372 if !all {
8373 return err
8374 }
8375 errors = append(errors, err)
8376 }
8377
8378 if len(m.GetName()) > 16384 {
8379 err := RouteAction_HashPolicy_CookieAttributeValidationError{
8380 field: "Name",
8381 reason: "value length must be at most 16384 bytes",
8382 }
8383 if !all {
8384 return err
8385 }
8386 errors = append(errors, err)
8387 }
8388
8389 if !_RouteAction_HashPolicy_CookieAttribute_Name_Pattern.MatchString(m.GetName()) {
8390 err := RouteAction_HashPolicy_CookieAttributeValidationError{
8391 field: "Name",
8392 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
8393 }
8394 if !all {
8395 return err
8396 }
8397 errors = append(errors, err)
8398 }
8399
8400 if len(m.GetValue()) > 16384 {
8401 err := RouteAction_HashPolicy_CookieAttributeValidationError{
8402 field: "Value",
8403 reason: "value length must be at most 16384 bytes",
8404 }
8405 if !all {
8406 return err
8407 }
8408 errors = append(errors, err)
8409 }
8410
8411 if !_RouteAction_HashPolicy_CookieAttribute_Value_Pattern.MatchString(m.GetValue()) {
8412 err := RouteAction_HashPolicy_CookieAttributeValidationError{
8413 field: "Value",
8414 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
8415 }
8416 if !all {
8417 return err
8418 }
8419 errors = append(errors, err)
8420 }
8421
8422 if len(errors) > 0 {
8423 return RouteAction_HashPolicy_CookieAttributeMultiError(errors)
8424 }
8425
8426 return nil
8427 }
8428
8429 // RouteAction_HashPolicy_CookieAttributeMultiError is an error wrapping
8430 // multiple validation errors returned by
8431 // RouteAction_HashPolicy_CookieAttribute.ValidateAll() if the designated
8432 // constraints aren't met.
8433 type RouteAction_HashPolicy_CookieAttributeMultiError []error
8434
8435 // Error returns a concatenation of all the error messages it wraps.
8436 func (m RouteAction_HashPolicy_CookieAttributeMultiError) Error() string {
8437 var msgs []string
8438 for _, err := range m {
8439 msgs = append(msgs, err.Error())
8440 }
8441 return strings.Join(msgs, "; ")
8442 }
8443
8444 // AllErrors returns a list of validation violation errors.
8445 func (m RouteAction_HashPolicy_CookieAttributeMultiError) AllErrors() []error { return m }
8446
8447 // RouteAction_HashPolicy_CookieAttributeValidationError is the validation
8448 // error returned by RouteAction_HashPolicy_CookieAttribute.Validate if the
8449 // designated constraints aren't met.
8450 type RouteAction_HashPolicy_CookieAttributeValidationError struct {
8451 field string
8452 reason string
8453 cause error
8454 key bool
8455 }
8456
8457 // Field function returns field value.
8458 func (e RouteAction_HashPolicy_CookieAttributeValidationError) Field() string { return e.field }
8459
8460 // Reason function returns reason value.
8461 func (e RouteAction_HashPolicy_CookieAttributeValidationError) Reason() string { return e.reason }
8462
8463 // Cause function returns cause value.
8464 func (e RouteAction_HashPolicy_CookieAttributeValidationError) Cause() error { return e.cause }
8465
8466 // Key function returns key value.
8467 func (e RouteAction_HashPolicy_CookieAttributeValidationError) Key() bool { return e.key }
8468
8469 // ErrorName returns error name.
8470 func (e RouteAction_HashPolicy_CookieAttributeValidationError) ErrorName() string {
8471 return "RouteAction_HashPolicy_CookieAttributeValidationError"
8472 }
8473
8474 // Error satisfies the builtin error interface
8475 func (e RouteAction_HashPolicy_CookieAttributeValidationError) Error() string {
8476 cause := ""
8477 if e.cause != nil {
8478 cause = fmt.Sprintf(" | caused by: %v", e.cause)
8479 }
8480
8481 key := ""
8482 if e.key {
8483 key = "key for "
8484 }
8485
8486 return fmt.Sprintf(
8487 "invalid %sRouteAction_HashPolicy_CookieAttribute.%s: %s%s",
8488 key,
8489 e.field,
8490 e.reason,
8491 cause)
8492 }
8493
8494 var _ error = RouteAction_HashPolicy_CookieAttributeValidationError{}
8495
8496 var _ interface {
8497 Field() string
8498 Reason() string
8499 Key() bool
8500 Cause() error
8501 ErrorName() string
8502 } = RouteAction_HashPolicy_CookieAttributeValidationError{}
8503
8504 var _RouteAction_HashPolicy_CookieAttribute_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
8505
8506 var _RouteAction_HashPolicy_CookieAttribute_Value_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
8507
8508 // Validate checks the field values on RouteAction_HashPolicy_Cookie with the
8509 // rules defined in the proto definition for this message. If any rules are
8510 // violated, the first error encountered is returned, or nil if there are no violations.
8511 func (m *RouteAction_HashPolicy_Cookie) Validate() error {
8512 return m.validate(false)
8513 }
8514
8515 // ValidateAll checks the field values on RouteAction_HashPolicy_Cookie with
8516 // the rules defined in the proto definition for this message. If any rules
8517 // are violated, the result is a list of violation errors wrapped in
8518 // RouteAction_HashPolicy_CookieMultiError, or nil if none found.
8519 func (m *RouteAction_HashPolicy_Cookie) ValidateAll() error {
8520 return m.validate(true)
8521 }
8522
8523 func (m *RouteAction_HashPolicy_Cookie) validate(all bool) error {
8524 if m == nil {
8525 return nil
8526 }
8527
8528 var errors []error
8529
8530 if utf8.RuneCountInString(m.GetName()) < 1 {
8531 err := RouteAction_HashPolicy_CookieValidationError{
8532 field: "Name",
8533 reason: "value length must be at least 1 runes",
8534 }
8535 if !all {
8536 return err
8537 }
8538 errors = append(errors, err)
8539 }
8540
8541 if all {
8542 switch v := interface{}(m.GetTtl()).(type) {
8543 case interface{ ValidateAll() error }:
8544 if err := v.ValidateAll(); err != nil {
8545 errors = append(errors, RouteAction_HashPolicy_CookieValidationError{
8546 field: "Ttl",
8547 reason: "embedded message failed validation",
8548 cause: err,
8549 })
8550 }
8551 case interface{ Validate() error }:
8552 if err := v.Validate(); err != nil {
8553 errors = append(errors, RouteAction_HashPolicy_CookieValidationError{
8554 field: "Ttl",
8555 reason: "embedded message failed validation",
8556 cause: err,
8557 })
8558 }
8559 }
8560 } else if v, ok := interface{}(m.GetTtl()).(interface{ Validate() error }); ok {
8561 if err := v.Validate(); err != nil {
8562 return RouteAction_HashPolicy_CookieValidationError{
8563 field: "Ttl",
8564 reason: "embedded message failed validation",
8565 cause: err,
8566 }
8567 }
8568 }
8569
8570 // no validation rules for Path
8571
8572 for idx, item := range m.GetAttributes() {
8573 _, _ = idx, item
8574
8575 if all {
8576 switch v := interface{}(item).(type) {
8577 case interface{ ValidateAll() error }:
8578 if err := v.ValidateAll(); err != nil {
8579 errors = append(errors, RouteAction_HashPolicy_CookieValidationError{
8580 field: fmt.Sprintf("Attributes[%v]", idx),
8581 reason: "embedded message failed validation",
8582 cause: err,
8583 })
8584 }
8585 case interface{ Validate() error }:
8586 if err := v.Validate(); err != nil {
8587 errors = append(errors, RouteAction_HashPolicy_CookieValidationError{
8588 field: fmt.Sprintf("Attributes[%v]", idx),
8589 reason: "embedded message failed validation",
8590 cause: err,
8591 })
8592 }
8593 }
8594 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
8595 if err := v.Validate(); err != nil {
8596 return RouteAction_HashPolicy_CookieValidationError{
8597 field: fmt.Sprintf("Attributes[%v]", idx),
8598 reason: "embedded message failed validation",
8599 cause: err,
8600 }
8601 }
8602 }
8603
8604 }
8605
8606 if len(errors) > 0 {
8607 return RouteAction_HashPolicy_CookieMultiError(errors)
8608 }
8609
8610 return nil
8611 }
8612
8613 // RouteAction_HashPolicy_CookieMultiError is an error wrapping multiple
8614 // validation errors returned by RouteAction_HashPolicy_Cookie.ValidateAll()
8615 // if the designated constraints aren't met.
8616 type RouteAction_HashPolicy_CookieMultiError []error
8617
8618 // Error returns a concatenation of all the error messages it wraps.
8619 func (m RouteAction_HashPolicy_CookieMultiError) Error() string {
8620 var msgs []string
8621 for _, err := range m {
8622 msgs = append(msgs, err.Error())
8623 }
8624 return strings.Join(msgs, "; ")
8625 }
8626
8627 // AllErrors returns a list of validation violation errors.
8628 func (m RouteAction_HashPolicy_CookieMultiError) AllErrors() []error { return m }
8629
8630 // RouteAction_HashPolicy_CookieValidationError is the validation error
8631 // returned by RouteAction_HashPolicy_Cookie.Validate if the designated
8632 // constraints aren't met.
8633 type RouteAction_HashPolicy_CookieValidationError struct {
8634 field string
8635 reason string
8636 cause error
8637 key bool
8638 }
8639
8640 // Field function returns field value.
8641 func (e RouteAction_HashPolicy_CookieValidationError) Field() string { return e.field }
8642
8643 // Reason function returns reason value.
8644 func (e RouteAction_HashPolicy_CookieValidationError) Reason() string { return e.reason }
8645
8646 // Cause function returns cause value.
8647 func (e RouteAction_HashPolicy_CookieValidationError) Cause() error { return e.cause }
8648
8649 // Key function returns key value.
8650 func (e RouteAction_HashPolicy_CookieValidationError) Key() bool { return e.key }
8651
8652 // ErrorName returns error name.
8653 func (e RouteAction_HashPolicy_CookieValidationError) ErrorName() string {
8654 return "RouteAction_HashPolicy_CookieValidationError"
8655 }
8656
8657 // Error satisfies the builtin error interface
8658 func (e RouteAction_HashPolicy_CookieValidationError) Error() string {
8659 cause := ""
8660 if e.cause != nil {
8661 cause = fmt.Sprintf(" | caused by: %v", e.cause)
8662 }
8663
8664 key := ""
8665 if e.key {
8666 key = "key for "
8667 }
8668
8669 return fmt.Sprintf(
8670 "invalid %sRouteAction_HashPolicy_Cookie.%s: %s%s",
8671 key,
8672 e.field,
8673 e.reason,
8674 cause)
8675 }
8676
8677 var _ error = RouteAction_HashPolicy_CookieValidationError{}
8678
8679 var _ interface {
8680 Field() string
8681 Reason() string
8682 Key() bool
8683 Cause() error
8684 ErrorName() string
8685 } = RouteAction_HashPolicy_CookieValidationError{}
8686
8687 // Validate checks the field values on
8688 // RouteAction_HashPolicy_ConnectionProperties with the rules defined in the
8689 // proto definition for this message. If any rules are violated, the first
8690 // error encountered is returned, or nil if there are no violations.
8691 func (m *RouteAction_HashPolicy_ConnectionProperties) Validate() error {
8692 return m.validate(false)
8693 }
8694
8695 // ValidateAll checks the field values on
8696 // RouteAction_HashPolicy_ConnectionProperties with the rules defined in the
8697 // proto definition for this message. If any rules are violated, the result is
8698 // a list of violation errors wrapped in
8699 // RouteAction_HashPolicy_ConnectionPropertiesMultiError, or nil if none found.
8700 func (m *RouteAction_HashPolicy_ConnectionProperties) ValidateAll() error {
8701 return m.validate(true)
8702 }
8703
8704 func (m *RouteAction_HashPolicy_ConnectionProperties) validate(all bool) error {
8705 if m == nil {
8706 return nil
8707 }
8708
8709 var errors []error
8710
8711 // no validation rules for SourceIp
8712
8713 if len(errors) > 0 {
8714 return RouteAction_HashPolicy_ConnectionPropertiesMultiError(errors)
8715 }
8716
8717 return nil
8718 }
8719
8720 // RouteAction_HashPolicy_ConnectionPropertiesMultiError is an error wrapping
8721 // multiple validation errors returned by
8722 // RouteAction_HashPolicy_ConnectionProperties.ValidateAll() if the designated
8723 // constraints aren't met.
8724 type RouteAction_HashPolicy_ConnectionPropertiesMultiError []error
8725
8726 // Error returns a concatenation of all the error messages it wraps.
8727 func (m RouteAction_HashPolicy_ConnectionPropertiesMultiError) Error() string {
8728 var msgs []string
8729 for _, err := range m {
8730 msgs = append(msgs, err.Error())
8731 }
8732 return strings.Join(msgs, "; ")
8733 }
8734
8735 // AllErrors returns a list of validation violation errors.
8736 func (m RouteAction_HashPolicy_ConnectionPropertiesMultiError) AllErrors() []error { return m }
8737
8738 // RouteAction_HashPolicy_ConnectionPropertiesValidationError is the validation
8739 // error returned by RouteAction_HashPolicy_ConnectionProperties.Validate if
8740 // the designated constraints aren't met.
8741 type RouteAction_HashPolicy_ConnectionPropertiesValidationError struct {
8742 field string
8743 reason string
8744 cause error
8745 key bool
8746 }
8747
8748 // Field function returns field value.
8749 func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Field() string { return e.field }
8750
8751 // Reason function returns reason value.
8752 func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Reason() string { return e.reason }
8753
8754 // Cause function returns cause value.
8755 func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Cause() error { return e.cause }
8756
8757 // Key function returns key value.
8758 func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Key() bool { return e.key }
8759
8760 // ErrorName returns error name.
8761 func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) ErrorName() string {
8762 return "RouteAction_HashPolicy_ConnectionPropertiesValidationError"
8763 }
8764
8765 // Error satisfies the builtin error interface
8766 func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Error() string {
8767 cause := ""
8768 if e.cause != nil {
8769 cause = fmt.Sprintf(" | caused by: %v", e.cause)
8770 }
8771
8772 key := ""
8773 if e.key {
8774 key = "key for "
8775 }
8776
8777 return fmt.Sprintf(
8778 "invalid %sRouteAction_HashPolicy_ConnectionProperties.%s: %s%s",
8779 key,
8780 e.field,
8781 e.reason,
8782 cause)
8783 }
8784
8785 var _ error = RouteAction_HashPolicy_ConnectionPropertiesValidationError{}
8786
8787 var _ interface {
8788 Field() string
8789 Reason() string
8790 Key() bool
8791 Cause() error
8792 ErrorName() string
8793 } = RouteAction_HashPolicy_ConnectionPropertiesValidationError{}
8794
8795 // Validate checks the field values on RouteAction_HashPolicy_QueryParameter
8796 // with the rules defined in the proto definition for this message. If any
8797 // rules are violated, the first error encountered is returned, or nil if
8798 // there are no violations.
8799 func (m *RouteAction_HashPolicy_QueryParameter) Validate() error {
8800 return m.validate(false)
8801 }
8802
8803 // ValidateAll checks the field values on RouteAction_HashPolicy_QueryParameter
8804 // with the rules defined in the proto definition for this message. If any
8805 // rules are violated, the result is a list of violation errors wrapped in
8806 // RouteAction_HashPolicy_QueryParameterMultiError, or nil if none found.
8807 func (m *RouteAction_HashPolicy_QueryParameter) ValidateAll() error {
8808 return m.validate(true)
8809 }
8810
8811 func (m *RouteAction_HashPolicy_QueryParameter) validate(all bool) error {
8812 if m == nil {
8813 return nil
8814 }
8815
8816 var errors []error
8817
8818 if utf8.RuneCountInString(m.GetName()) < 1 {
8819 err := RouteAction_HashPolicy_QueryParameterValidationError{
8820 field: "Name",
8821 reason: "value length must be at least 1 runes",
8822 }
8823 if !all {
8824 return err
8825 }
8826 errors = append(errors, err)
8827 }
8828
8829 if len(errors) > 0 {
8830 return RouteAction_HashPolicy_QueryParameterMultiError(errors)
8831 }
8832
8833 return nil
8834 }
8835
8836 // RouteAction_HashPolicy_QueryParameterMultiError is an error wrapping
8837 // multiple validation errors returned by
8838 // RouteAction_HashPolicy_QueryParameter.ValidateAll() if the designated
8839 // constraints aren't met.
8840 type RouteAction_HashPolicy_QueryParameterMultiError []error
8841
8842 // Error returns a concatenation of all the error messages it wraps.
8843 func (m RouteAction_HashPolicy_QueryParameterMultiError) Error() string {
8844 var msgs []string
8845 for _, err := range m {
8846 msgs = append(msgs, err.Error())
8847 }
8848 return strings.Join(msgs, "; ")
8849 }
8850
8851 // AllErrors returns a list of validation violation errors.
8852 func (m RouteAction_HashPolicy_QueryParameterMultiError) AllErrors() []error { return m }
8853
8854 // RouteAction_HashPolicy_QueryParameterValidationError is the validation error
8855 // returned by RouteAction_HashPolicy_QueryParameter.Validate if the
8856 // designated constraints aren't met.
8857 type RouteAction_HashPolicy_QueryParameterValidationError struct {
8858 field string
8859 reason string
8860 cause error
8861 key bool
8862 }
8863
8864 // Field function returns field value.
8865 func (e RouteAction_HashPolicy_QueryParameterValidationError) Field() string { return e.field }
8866
8867 // Reason function returns reason value.
8868 func (e RouteAction_HashPolicy_QueryParameterValidationError) Reason() string { return e.reason }
8869
8870 // Cause function returns cause value.
8871 func (e RouteAction_HashPolicy_QueryParameterValidationError) Cause() error { return e.cause }
8872
8873 // Key function returns key value.
8874 func (e RouteAction_HashPolicy_QueryParameterValidationError) Key() bool { return e.key }
8875
8876 // ErrorName returns error name.
8877 func (e RouteAction_HashPolicy_QueryParameterValidationError) ErrorName() string {
8878 return "RouteAction_HashPolicy_QueryParameterValidationError"
8879 }
8880
8881 // Error satisfies the builtin error interface
8882 func (e RouteAction_HashPolicy_QueryParameterValidationError) Error() string {
8883 cause := ""
8884 if e.cause != nil {
8885 cause = fmt.Sprintf(" | caused by: %v", e.cause)
8886 }
8887
8888 key := ""
8889 if e.key {
8890 key = "key for "
8891 }
8892
8893 return fmt.Sprintf(
8894 "invalid %sRouteAction_HashPolicy_QueryParameter.%s: %s%s",
8895 key,
8896 e.field,
8897 e.reason,
8898 cause)
8899 }
8900
8901 var _ error = RouteAction_HashPolicy_QueryParameterValidationError{}
8902
8903 var _ interface {
8904 Field() string
8905 Reason() string
8906 Key() bool
8907 Cause() error
8908 ErrorName() string
8909 } = RouteAction_HashPolicy_QueryParameterValidationError{}
8910
8911 // Validate checks the field values on RouteAction_HashPolicy_FilterState with
8912 // the rules defined in the proto definition for this message. If any rules
8913 // are violated, the first error encountered is returned, or nil if there are
8914 // no violations.
8915 func (m *RouteAction_HashPolicy_FilterState) Validate() error {
8916 return m.validate(false)
8917 }
8918
8919 // ValidateAll checks the field values on RouteAction_HashPolicy_FilterState
8920 // with the rules defined in the proto definition for this message. If any
8921 // rules are violated, the result is a list of violation errors wrapped in
8922 // RouteAction_HashPolicy_FilterStateMultiError, or nil if none found.
8923 func (m *RouteAction_HashPolicy_FilterState) ValidateAll() error {
8924 return m.validate(true)
8925 }
8926
8927 func (m *RouteAction_HashPolicy_FilterState) validate(all bool) error {
8928 if m == nil {
8929 return nil
8930 }
8931
8932 var errors []error
8933
8934 if utf8.RuneCountInString(m.GetKey()) < 1 {
8935 err := RouteAction_HashPolicy_FilterStateValidationError{
8936 field: "Key",
8937 reason: "value length must be at least 1 runes",
8938 }
8939 if !all {
8940 return err
8941 }
8942 errors = append(errors, err)
8943 }
8944
8945 if len(errors) > 0 {
8946 return RouteAction_HashPolicy_FilterStateMultiError(errors)
8947 }
8948
8949 return nil
8950 }
8951
8952 // RouteAction_HashPolicy_FilterStateMultiError is an error wrapping multiple
8953 // validation errors returned by
8954 // RouteAction_HashPolicy_FilterState.ValidateAll() if the designated
8955 // constraints aren't met.
8956 type RouteAction_HashPolicy_FilterStateMultiError []error
8957
8958 // Error returns a concatenation of all the error messages it wraps.
8959 func (m RouteAction_HashPolicy_FilterStateMultiError) Error() string {
8960 var msgs []string
8961 for _, err := range m {
8962 msgs = append(msgs, err.Error())
8963 }
8964 return strings.Join(msgs, "; ")
8965 }
8966
8967 // AllErrors returns a list of validation violation errors.
8968 func (m RouteAction_HashPolicy_FilterStateMultiError) AllErrors() []error { return m }
8969
8970 // RouteAction_HashPolicy_FilterStateValidationError is the validation error
8971 // returned by RouteAction_HashPolicy_FilterState.Validate if the designated
8972 // constraints aren't met.
8973 type RouteAction_HashPolicy_FilterStateValidationError struct {
8974 field string
8975 reason string
8976 cause error
8977 key bool
8978 }
8979
8980 // Field function returns field value.
8981 func (e RouteAction_HashPolicy_FilterStateValidationError) Field() string { return e.field }
8982
8983 // Reason function returns reason value.
8984 func (e RouteAction_HashPolicy_FilterStateValidationError) Reason() string { return e.reason }
8985
8986 // Cause function returns cause value.
8987 func (e RouteAction_HashPolicy_FilterStateValidationError) Cause() error { return e.cause }
8988
8989 // Key function returns key value.
8990 func (e RouteAction_HashPolicy_FilterStateValidationError) Key() bool { return e.key }
8991
8992 // ErrorName returns error name.
8993 func (e RouteAction_HashPolicy_FilterStateValidationError) ErrorName() string {
8994 return "RouteAction_HashPolicy_FilterStateValidationError"
8995 }
8996
8997 // Error satisfies the builtin error interface
8998 func (e RouteAction_HashPolicy_FilterStateValidationError) Error() string {
8999 cause := ""
9000 if e.cause != nil {
9001 cause = fmt.Sprintf(" | caused by: %v", e.cause)
9002 }
9003
9004 key := ""
9005 if e.key {
9006 key = "key for "
9007 }
9008
9009 return fmt.Sprintf(
9010 "invalid %sRouteAction_HashPolicy_FilterState.%s: %s%s",
9011 key,
9012 e.field,
9013 e.reason,
9014 cause)
9015 }
9016
9017 var _ error = RouteAction_HashPolicy_FilterStateValidationError{}
9018
9019 var _ interface {
9020 Field() string
9021 Reason() string
9022 Key() bool
9023 Cause() error
9024 ErrorName() string
9025 } = RouteAction_HashPolicy_FilterStateValidationError{}
9026
9027 // Validate checks the field values on RouteAction_UpgradeConfig_ConnectConfig
9028 // with the rules defined in the proto definition for this message. If any
9029 // rules are violated, the first error encountered is returned, or nil if
9030 // there are no violations.
9031 func (m *RouteAction_UpgradeConfig_ConnectConfig) Validate() error {
9032 return m.validate(false)
9033 }
9034
9035 // ValidateAll checks the field values on
9036 // RouteAction_UpgradeConfig_ConnectConfig with the rules defined in the proto
9037 // definition for this message. If any rules are violated, the result is a
9038 // list of violation errors wrapped in
9039 // RouteAction_UpgradeConfig_ConnectConfigMultiError, or nil if none found.
9040 func (m *RouteAction_UpgradeConfig_ConnectConfig) ValidateAll() error {
9041 return m.validate(true)
9042 }
9043
9044 func (m *RouteAction_UpgradeConfig_ConnectConfig) validate(all bool) error {
9045 if m == nil {
9046 return nil
9047 }
9048
9049 var errors []error
9050
9051 if all {
9052 switch v := interface{}(m.GetProxyProtocolConfig()).(type) {
9053 case interface{ ValidateAll() error }:
9054 if err := v.ValidateAll(); err != nil {
9055 errors = append(errors, RouteAction_UpgradeConfig_ConnectConfigValidationError{
9056 field: "ProxyProtocolConfig",
9057 reason: "embedded message failed validation",
9058 cause: err,
9059 })
9060 }
9061 case interface{ Validate() error }:
9062 if err := v.Validate(); err != nil {
9063 errors = append(errors, RouteAction_UpgradeConfig_ConnectConfigValidationError{
9064 field: "ProxyProtocolConfig",
9065 reason: "embedded message failed validation",
9066 cause: err,
9067 })
9068 }
9069 }
9070 } else if v, ok := interface{}(m.GetProxyProtocolConfig()).(interface{ Validate() error }); ok {
9071 if err := v.Validate(); err != nil {
9072 return RouteAction_UpgradeConfig_ConnectConfigValidationError{
9073 field: "ProxyProtocolConfig",
9074 reason: "embedded message failed validation",
9075 cause: err,
9076 }
9077 }
9078 }
9079
9080 // no validation rules for AllowPost
9081
9082 if len(errors) > 0 {
9083 return RouteAction_UpgradeConfig_ConnectConfigMultiError(errors)
9084 }
9085
9086 return nil
9087 }
9088
9089 // RouteAction_UpgradeConfig_ConnectConfigMultiError is an error wrapping
9090 // multiple validation errors returned by
9091 // RouteAction_UpgradeConfig_ConnectConfig.ValidateAll() if the designated
9092 // constraints aren't met.
9093 type RouteAction_UpgradeConfig_ConnectConfigMultiError []error
9094
9095 // Error returns a concatenation of all the error messages it wraps.
9096 func (m RouteAction_UpgradeConfig_ConnectConfigMultiError) Error() string {
9097 var msgs []string
9098 for _, err := range m {
9099 msgs = append(msgs, err.Error())
9100 }
9101 return strings.Join(msgs, "; ")
9102 }
9103
9104 // AllErrors returns a list of validation violation errors.
9105 func (m RouteAction_UpgradeConfig_ConnectConfigMultiError) AllErrors() []error { return m }
9106
9107 // RouteAction_UpgradeConfig_ConnectConfigValidationError is the validation
9108 // error returned by RouteAction_UpgradeConfig_ConnectConfig.Validate if the
9109 // designated constraints aren't met.
9110 type RouteAction_UpgradeConfig_ConnectConfigValidationError struct {
9111 field string
9112 reason string
9113 cause error
9114 key bool
9115 }
9116
9117 // Field function returns field value.
9118 func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Field() string { return e.field }
9119
9120 // Reason function returns reason value.
9121 func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Reason() string { return e.reason }
9122
9123 // Cause function returns cause value.
9124 func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Cause() error { return e.cause }
9125
9126 // Key function returns key value.
9127 func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Key() bool { return e.key }
9128
9129 // ErrorName returns error name.
9130 func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) ErrorName() string {
9131 return "RouteAction_UpgradeConfig_ConnectConfigValidationError"
9132 }
9133
9134 // Error satisfies the builtin error interface
9135 func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Error() string {
9136 cause := ""
9137 if e.cause != nil {
9138 cause = fmt.Sprintf(" | caused by: %v", e.cause)
9139 }
9140
9141 key := ""
9142 if e.key {
9143 key = "key for "
9144 }
9145
9146 return fmt.Sprintf(
9147 "invalid %sRouteAction_UpgradeConfig_ConnectConfig.%s: %s%s",
9148 key,
9149 e.field,
9150 e.reason,
9151 cause)
9152 }
9153
9154 var _ error = RouteAction_UpgradeConfig_ConnectConfigValidationError{}
9155
9156 var _ interface {
9157 Field() string
9158 Reason() string
9159 Key() bool
9160 Cause() error
9161 ErrorName() string
9162 } = RouteAction_UpgradeConfig_ConnectConfigValidationError{}
9163
9164 // Validate checks the field values on RetryPolicy_RetryPriority with the rules
9165 // defined in the proto definition for this message. If any rules are
9166 // violated, the first error encountered is returned, or nil if there are no violations.
9167 func (m *RetryPolicy_RetryPriority) Validate() error {
9168 return m.validate(false)
9169 }
9170
9171 // ValidateAll checks the field values on RetryPolicy_RetryPriority with the
9172 // rules defined in the proto definition for this message. If any rules are
9173 // violated, the result is a list of violation errors wrapped in
9174 // RetryPolicy_RetryPriorityMultiError, or nil if none found.
9175 func (m *RetryPolicy_RetryPriority) ValidateAll() error {
9176 return m.validate(true)
9177 }
9178
9179 func (m *RetryPolicy_RetryPriority) validate(all bool) error {
9180 if m == nil {
9181 return nil
9182 }
9183
9184 var errors []error
9185
9186 if utf8.RuneCountInString(m.GetName()) < 1 {
9187 err := RetryPolicy_RetryPriorityValidationError{
9188 field: "Name",
9189 reason: "value length must be at least 1 runes",
9190 }
9191 if !all {
9192 return err
9193 }
9194 errors = append(errors, err)
9195 }
9196
9197 switch v := m.ConfigType.(type) {
9198 case *RetryPolicy_RetryPriority_TypedConfig:
9199 if v == nil {
9200 err := RetryPolicy_RetryPriorityValidationError{
9201 field: "ConfigType",
9202 reason: "oneof value cannot be a typed-nil",
9203 }
9204 if !all {
9205 return err
9206 }
9207 errors = append(errors, err)
9208 }
9209
9210 if all {
9211 switch v := interface{}(m.GetTypedConfig()).(type) {
9212 case interface{ ValidateAll() error }:
9213 if err := v.ValidateAll(); err != nil {
9214 errors = append(errors, RetryPolicy_RetryPriorityValidationError{
9215 field: "TypedConfig",
9216 reason: "embedded message failed validation",
9217 cause: err,
9218 })
9219 }
9220 case interface{ Validate() error }:
9221 if err := v.Validate(); err != nil {
9222 errors = append(errors, RetryPolicy_RetryPriorityValidationError{
9223 field: "TypedConfig",
9224 reason: "embedded message failed validation",
9225 cause: err,
9226 })
9227 }
9228 }
9229 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
9230 if err := v.Validate(); err != nil {
9231 return RetryPolicy_RetryPriorityValidationError{
9232 field: "TypedConfig",
9233 reason: "embedded message failed validation",
9234 cause: err,
9235 }
9236 }
9237 }
9238
9239 default:
9240 _ = v // ensures v is used
9241 }
9242
9243 if len(errors) > 0 {
9244 return RetryPolicy_RetryPriorityMultiError(errors)
9245 }
9246
9247 return nil
9248 }
9249
9250 // RetryPolicy_RetryPriorityMultiError is an error wrapping multiple validation
9251 // errors returned by RetryPolicy_RetryPriority.ValidateAll() if the
9252 // designated constraints aren't met.
9253 type RetryPolicy_RetryPriorityMultiError []error
9254
9255 // Error returns a concatenation of all the error messages it wraps.
9256 func (m RetryPolicy_RetryPriorityMultiError) Error() string {
9257 var msgs []string
9258 for _, err := range m {
9259 msgs = append(msgs, err.Error())
9260 }
9261 return strings.Join(msgs, "; ")
9262 }
9263
9264 // AllErrors returns a list of validation violation errors.
9265 func (m RetryPolicy_RetryPriorityMultiError) AllErrors() []error { return m }
9266
9267 // RetryPolicy_RetryPriorityValidationError is the validation error returned by
9268 // RetryPolicy_RetryPriority.Validate if the designated constraints aren't met.
9269 type RetryPolicy_RetryPriorityValidationError struct {
9270 field string
9271 reason string
9272 cause error
9273 key bool
9274 }
9275
9276 // Field function returns field value.
9277 func (e RetryPolicy_RetryPriorityValidationError) Field() string { return e.field }
9278
9279 // Reason function returns reason value.
9280 func (e RetryPolicy_RetryPriorityValidationError) Reason() string { return e.reason }
9281
9282 // Cause function returns cause value.
9283 func (e RetryPolicy_RetryPriorityValidationError) Cause() error { return e.cause }
9284
9285 // Key function returns key value.
9286 func (e RetryPolicy_RetryPriorityValidationError) Key() bool { return e.key }
9287
9288 // ErrorName returns error name.
9289 func (e RetryPolicy_RetryPriorityValidationError) ErrorName() string {
9290 return "RetryPolicy_RetryPriorityValidationError"
9291 }
9292
9293 // Error satisfies the builtin error interface
9294 func (e RetryPolicy_RetryPriorityValidationError) Error() string {
9295 cause := ""
9296 if e.cause != nil {
9297 cause = fmt.Sprintf(" | caused by: %v", e.cause)
9298 }
9299
9300 key := ""
9301 if e.key {
9302 key = "key for "
9303 }
9304
9305 return fmt.Sprintf(
9306 "invalid %sRetryPolicy_RetryPriority.%s: %s%s",
9307 key,
9308 e.field,
9309 e.reason,
9310 cause)
9311 }
9312
9313 var _ error = RetryPolicy_RetryPriorityValidationError{}
9314
9315 var _ interface {
9316 Field() string
9317 Reason() string
9318 Key() bool
9319 Cause() error
9320 ErrorName() string
9321 } = RetryPolicy_RetryPriorityValidationError{}
9322
9323 // Validate checks the field values on RetryPolicy_RetryHostPredicate with the
9324 // rules defined in the proto definition for this message. If any rules are
9325 // violated, the first error encountered is returned, or nil if there are no violations.
9326 func (m *RetryPolicy_RetryHostPredicate) Validate() error {
9327 return m.validate(false)
9328 }
9329
9330 // ValidateAll checks the field values on RetryPolicy_RetryHostPredicate with
9331 // the rules defined in the proto definition for this message. If any rules
9332 // are violated, the result is a list of violation errors wrapped in
9333 // RetryPolicy_RetryHostPredicateMultiError, or nil if none found.
9334 func (m *RetryPolicy_RetryHostPredicate) ValidateAll() error {
9335 return m.validate(true)
9336 }
9337
9338 func (m *RetryPolicy_RetryHostPredicate) validate(all bool) error {
9339 if m == nil {
9340 return nil
9341 }
9342
9343 var errors []error
9344
9345 if utf8.RuneCountInString(m.GetName()) < 1 {
9346 err := RetryPolicy_RetryHostPredicateValidationError{
9347 field: "Name",
9348 reason: "value length must be at least 1 runes",
9349 }
9350 if !all {
9351 return err
9352 }
9353 errors = append(errors, err)
9354 }
9355
9356 switch v := m.ConfigType.(type) {
9357 case *RetryPolicy_RetryHostPredicate_TypedConfig:
9358 if v == nil {
9359 err := RetryPolicy_RetryHostPredicateValidationError{
9360 field: "ConfigType",
9361 reason: "oneof value cannot be a typed-nil",
9362 }
9363 if !all {
9364 return err
9365 }
9366 errors = append(errors, err)
9367 }
9368
9369 if all {
9370 switch v := interface{}(m.GetTypedConfig()).(type) {
9371 case interface{ ValidateAll() error }:
9372 if err := v.ValidateAll(); err != nil {
9373 errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{
9374 field: "TypedConfig",
9375 reason: "embedded message failed validation",
9376 cause: err,
9377 })
9378 }
9379 case interface{ Validate() error }:
9380 if err := v.Validate(); err != nil {
9381 errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{
9382 field: "TypedConfig",
9383 reason: "embedded message failed validation",
9384 cause: err,
9385 })
9386 }
9387 }
9388 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
9389 if err := v.Validate(); err != nil {
9390 return RetryPolicy_RetryHostPredicateValidationError{
9391 field: "TypedConfig",
9392 reason: "embedded message failed validation",
9393 cause: err,
9394 }
9395 }
9396 }
9397
9398 default:
9399 _ = v // ensures v is used
9400 }
9401
9402 if len(errors) > 0 {
9403 return RetryPolicy_RetryHostPredicateMultiError(errors)
9404 }
9405
9406 return nil
9407 }
9408
9409 // RetryPolicy_RetryHostPredicateMultiError is an error wrapping multiple
9410 // validation errors returned by RetryPolicy_RetryHostPredicate.ValidateAll()
9411 // if the designated constraints aren't met.
9412 type RetryPolicy_RetryHostPredicateMultiError []error
9413
9414 // Error returns a concatenation of all the error messages it wraps.
9415 func (m RetryPolicy_RetryHostPredicateMultiError) Error() string {
9416 var msgs []string
9417 for _, err := range m {
9418 msgs = append(msgs, err.Error())
9419 }
9420 return strings.Join(msgs, "; ")
9421 }
9422
9423 // AllErrors returns a list of validation violation errors.
9424 func (m RetryPolicy_RetryHostPredicateMultiError) AllErrors() []error { return m }
9425
9426 // RetryPolicy_RetryHostPredicateValidationError is the validation error
9427 // returned by RetryPolicy_RetryHostPredicate.Validate if the designated
9428 // constraints aren't met.
9429 type RetryPolicy_RetryHostPredicateValidationError struct {
9430 field string
9431 reason string
9432 cause error
9433 key bool
9434 }
9435
9436 // Field function returns field value.
9437 func (e RetryPolicy_RetryHostPredicateValidationError) Field() string { return e.field }
9438
9439 // Reason function returns reason value.
9440 func (e RetryPolicy_RetryHostPredicateValidationError) Reason() string { return e.reason }
9441
9442 // Cause function returns cause value.
9443 func (e RetryPolicy_RetryHostPredicateValidationError) Cause() error { return e.cause }
9444
9445 // Key function returns key value.
9446 func (e RetryPolicy_RetryHostPredicateValidationError) Key() bool { return e.key }
9447
9448 // ErrorName returns error name.
9449 func (e RetryPolicy_RetryHostPredicateValidationError) ErrorName() string {
9450 return "RetryPolicy_RetryHostPredicateValidationError"
9451 }
9452
9453 // Error satisfies the builtin error interface
9454 func (e RetryPolicy_RetryHostPredicateValidationError) Error() string {
9455 cause := ""
9456 if e.cause != nil {
9457 cause = fmt.Sprintf(" | caused by: %v", e.cause)
9458 }
9459
9460 key := ""
9461 if e.key {
9462 key = "key for "
9463 }
9464
9465 return fmt.Sprintf(
9466 "invalid %sRetryPolicy_RetryHostPredicate.%s: %s%s",
9467 key,
9468 e.field,
9469 e.reason,
9470 cause)
9471 }
9472
9473 var _ error = RetryPolicy_RetryHostPredicateValidationError{}
9474
9475 var _ interface {
9476 Field() string
9477 Reason() string
9478 Key() bool
9479 Cause() error
9480 ErrorName() string
9481 } = RetryPolicy_RetryHostPredicateValidationError{}
9482
9483 // Validate checks the field values on RetryPolicy_RetryBackOff with the rules
9484 // defined in the proto definition for this message. If any rules are
9485 // violated, the first error encountered is returned, or nil if there are no violations.
9486 func (m *RetryPolicy_RetryBackOff) Validate() error {
9487 return m.validate(false)
9488 }
9489
9490 // ValidateAll checks the field values on RetryPolicy_RetryBackOff with the
9491 // rules defined in the proto definition for this message. If any rules are
9492 // violated, the result is a list of violation errors wrapped in
9493 // RetryPolicy_RetryBackOffMultiError, or nil if none found.
9494 func (m *RetryPolicy_RetryBackOff) ValidateAll() error {
9495 return m.validate(true)
9496 }
9497
9498 func (m *RetryPolicy_RetryBackOff) validate(all bool) error {
9499 if m == nil {
9500 return nil
9501 }
9502
9503 var errors []error
9504
9505 if m.GetBaseInterval() == nil {
9506 err := RetryPolicy_RetryBackOffValidationError{
9507 field: "BaseInterval",
9508 reason: "value is required",
9509 }
9510 if !all {
9511 return err
9512 }
9513 errors = append(errors, err)
9514 }
9515
9516 if d := m.GetBaseInterval(); d != nil {
9517 dur, err := d.AsDuration(), d.CheckValid()
9518 if err != nil {
9519 err = RetryPolicy_RetryBackOffValidationError{
9520 field: "BaseInterval",
9521 reason: "value is not a valid duration",
9522 cause: err,
9523 }
9524 if !all {
9525 return err
9526 }
9527 errors = append(errors, err)
9528 } else {
9529
9530 gt := time.Duration(0*time.Second + 0*time.Nanosecond)
9531
9532 if dur <= gt {
9533 err := RetryPolicy_RetryBackOffValidationError{
9534 field: "BaseInterval",
9535 reason: "value must be greater than 0s",
9536 }
9537 if !all {
9538 return err
9539 }
9540 errors = append(errors, err)
9541 }
9542
9543 }
9544 }
9545
9546 if d := m.GetMaxInterval(); d != nil {
9547 dur, err := d.AsDuration(), d.CheckValid()
9548 if err != nil {
9549 err = RetryPolicy_RetryBackOffValidationError{
9550 field: "MaxInterval",
9551 reason: "value is not a valid duration",
9552 cause: err,
9553 }
9554 if !all {
9555 return err
9556 }
9557 errors = append(errors, err)
9558 } else {
9559
9560 gt := time.Duration(0*time.Second + 0*time.Nanosecond)
9561
9562 if dur <= gt {
9563 err := RetryPolicy_RetryBackOffValidationError{
9564 field: "MaxInterval",
9565 reason: "value must be greater than 0s",
9566 }
9567 if !all {
9568 return err
9569 }
9570 errors = append(errors, err)
9571 }
9572
9573 }
9574 }
9575
9576 if len(errors) > 0 {
9577 return RetryPolicy_RetryBackOffMultiError(errors)
9578 }
9579
9580 return nil
9581 }
9582
9583 // RetryPolicy_RetryBackOffMultiError is an error wrapping multiple validation
9584 // errors returned by RetryPolicy_RetryBackOff.ValidateAll() if the designated
9585 // constraints aren't met.
9586 type RetryPolicy_RetryBackOffMultiError []error
9587
9588 // Error returns a concatenation of all the error messages it wraps.
9589 func (m RetryPolicy_RetryBackOffMultiError) Error() string {
9590 var msgs []string
9591 for _, err := range m {
9592 msgs = append(msgs, err.Error())
9593 }
9594 return strings.Join(msgs, "; ")
9595 }
9596
9597 // AllErrors returns a list of validation violation errors.
9598 func (m RetryPolicy_RetryBackOffMultiError) AllErrors() []error { return m }
9599
9600 // RetryPolicy_RetryBackOffValidationError is the validation error returned by
9601 // RetryPolicy_RetryBackOff.Validate if the designated constraints aren't met.
9602 type RetryPolicy_RetryBackOffValidationError struct {
9603 field string
9604 reason string
9605 cause error
9606 key bool
9607 }
9608
9609 // Field function returns field value.
9610 func (e RetryPolicy_RetryBackOffValidationError) Field() string { return e.field }
9611
9612 // Reason function returns reason value.
9613 func (e RetryPolicy_RetryBackOffValidationError) Reason() string { return e.reason }
9614
9615 // Cause function returns cause value.
9616 func (e RetryPolicy_RetryBackOffValidationError) Cause() error { return e.cause }
9617
9618 // Key function returns key value.
9619 func (e RetryPolicy_RetryBackOffValidationError) Key() bool { return e.key }
9620
9621 // ErrorName returns error name.
9622 func (e RetryPolicy_RetryBackOffValidationError) ErrorName() string {
9623 return "RetryPolicy_RetryBackOffValidationError"
9624 }
9625
9626 // Error satisfies the builtin error interface
9627 func (e RetryPolicy_RetryBackOffValidationError) Error() string {
9628 cause := ""
9629 if e.cause != nil {
9630 cause = fmt.Sprintf(" | caused by: %v", e.cause)
9631 }
9632
9633 key := ""
9634 if e.key {
9635 key = "key for "
9636 }
9637
9638 return fmt.Sprintf(
9639 "invalid %sRetryPolicy_RetryBackOff.%s: %s%s",
9640 key,
9641 e.field,
9642 e.reason,
9643 cause)
9644 }
9645
9646 var _ error = RetryPolicy_RetryBackOffValidationError{}
9647
9648 var _ interface {
9649 Field() string
9650 Reason() string
9651 Key() bool
9652 Cause() error
9653 ErrorName() string
9654 } = RetryPolicy_RetryBackOffValidationError{}
9655
9656 // Validate checks the field values on RetryPolicy_ResetHeader with the rules
9657 // defined in the proto definition for this message. If any rules are
9658 // violated, the first error encountered is returned, or nil if there are no violations.
9659 func (m *RetryPolicy_ResetHeader) Validate() error {
9660 return m.validate(false)
9661 }
9662
9663 // ValidateAll checks the field values on RetryPolicy_ResetHeader with the
9664 // rules defined in the proto definition for this message. If any rules are
9665 // violated, the result is a list of violation errors wrapped in
9666 // RetryPolicy_ResetHeaderMultiError, or nil if none found.
9667 func (m *RetryPolicy_ResetHeader) ValidateAll() error {
9668 return m.validate(true)
9669 }
9670
9671 func (m *RetryPolicy_ResetHeader) validate(all bool) error {
9672 if m == nil {
9673 return nil
9674 }
9675
9676 var errors []error
9677
9678 if utf8.RuneCountInString(m.GetName()) < 1 {
9679 err := RetryPolicy_ResetHeaderValidationError{
9680 field: "Name",
9681 reason: "value length must be at least 1 runes",
9682 }
9683 if !all {
9684 return err
9685 }
9686 errors = append(errors, err)
9687 }
9688
9689 if !_RetryPolicy_ResetHeader_Name_Pattern.MatchString(m.GetName()) {
9690 err := RetryPolicy_ResetHeaderValidationError{
9691 field: "Name",
9692 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
9693 }
9694 if !all {
9695 return err
9696 }
9697 errors = append(errors, err)
9698 }
9699
9700 if _, ok := RetryPolicy_ResetHeaderFormat_name[int32(m.GetFormat())]; !ok {
9701 err := RetryPolicy_ResetHeaderValidationError{
9702 field: "Format",
9703 reason: "value must be one of the defined enum values",
9704 }
9705 if !all {
9706 return err
9707 }
9708 errors = append(errors, err)
9709 }
9710
9711 if len(errors) > 0 {
9712 return RetryPolicy_ResetHeaderMultiError(errors)
9713 }
9714
9715 return nil
9716 }
9717
9718 // RetryPolicy_ResetHeaderMultiError is an error wrapping multiple validation
9719 // errors returned by RetryPolicy_ResetHeader.ValidateAll() if the designated
9720 // constraints aren't met.
9721 type RetryPolicy_ResetHeaderMultiError []error
9722
9723 // Error returns a concatenation of all the error messages it wraps.
9724 func (m RetryPolicy_ResetHeaderMultiError) Error() string {
9725 var msgs []string
9726 for _, err := range m {
9727 msgs = append(msgs, err.Error())
9728 }
9729 return strings.Join(msgs, "; ")
9730 }
9731
9732 // AllErrors returns a list of validation violation errors.
9733 func (m RetryPolicy_ResetHeaderMultiError) AllErrors() []error { return m }
9734
9735 // RetryPolicy_ResetHeaderValidationError is the validation error returned by
9736 // RetryPolicy_ResetHeader.Validate if the designated constraints aren't met.
9737 type RetryPolicy_ResetHeaderValidationError struct {
9738 field string
9739 reason string
9740 cause error
9741 key bool
9742 }
9743
9744 // Field function returns field value.
9745 func (e RetryPolicy_ResetHeaderValidationError) Field() string { return e.field }
9746
9747 // Reason function returns reason value.
9748 func (e RetryPolicy_ResetHeaderValidationError) Reason() string { return e.reason }
9749
9750 // Cause function returns cause value.
9751 func (e RetryPolicy_ResetHeaderValidationError) Cause() error { return e.cause }
9752
9753 // Key function returns key value.
9754 func (e RetryPolicy_ResetHeaderValidationError) Key() bool { return e.key }
9755
9756 // ErrorName returns error name.
9757 func (e RetryPolicy_ResetHeaderValidationError) ErrorName() string {
9758 return "RetryPolicy_ResetHeaderValidationError"
9759 }
9760
9761 // Error satisfies the builtin error interface
9762 func (e RetryPolicy_ResetHeaderValidationError) Error() string {
9763 cause := ""
9764 if e.cause != nil {
9765 cause = fmt.Sprintf(" | caused by: %v", e.cause)
9766 }
9767
9768 key := ""
9769 if e.key {
9770 key = "key for "
9771 }
9772
9773 return fmt.Sprintf(
9774 "invalid %sRetryPolicy_ResetHeader.%s: %s%s",
9775 key,
9776 e.field,
9777 e.reason,
9778 cause)
9779 }
9780
9781 var _ error = RetryPolicy_ResetHeaderValidationError{}
9782
9783 var _ interface {
9784 Field() string
9785 Reason() string
9786 Key() bool
9787 Cause() error
9788 ErrorName() string
9789 } = RetryPolicy_ResetHeaderValidationError{}
9790
9791 var _RetryPolicy_ResetHeader_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
9792
9793 // Validate checks the field values on RetryPolicy_RateLimitedRetryBackOff with
9794 // the rules defined in the proto definition for this message. If any rules
9795 // are violated, the first error encountered is returned, or nil if there are
9796 // no violations.
9797 func (m *RetryPolicy_RateLimitedRetryBackOff) Validate() error {
9798 return m.validate(false)
9799 }
9800
9801 // ValidateAll checks the field values on RetryPolicy_RateLimitedRetryBackOff
9802 // with the rules defined in the proto definition for this message. If any
9803 // rules are violated, the result is a list of violation errors wrapped in
9804 // RetryPolicy_RateLimitedRetryBackOffMultiError, or nil if none found.
9805 func (m *RetryPolicy_RateLimitedRetryBackOff) ValidateAll() error {
9806 return m.validate(true)
9807 }
9808
9809 func (m *RetryPolicy_RateLimitedRetryBackOff) validate(all bool) error {
9810 if m == nil {
9811 return nil
9812 }
9813
9814 var errors []error
9815
9816 if len(m.GetResetHeaders()) < 1 {
9817 err := RetryPolicy_RateLimitedRetryBackOffValidationError{
9818 field: "ResetHeaders",
9819 reason: "value must contain at least 1 item(s)",
9820 }
9821 if !all {
9822 return err
9823 }
9824 errors = append(errors, err)
9825 }
9826
9827 for idx, item := range m.GetResetHeaders() {
9828 _, _ = idx, item
9829
9830 if all {
9831 switch v := interface{}(item).(type) {
9832 case interface{ ValidateAll() error }:
9833 if err := v.ValidateAll(); err != nil {
9834 errors = append(errors, RetryPolicy_RateLimitedRetryBackOffValidationError{
9835 field: fmt.Sprintf("ResetHeaders[%v]", idx),
9836 reason: "embedded message failed validation",
9837 cause: err,
9838 })
9839 }
9840 case interface{ Validate() error }:
9841 if err := v.Validate(); err != nil {
9842 errors = append(errors, RetryPolicy_RateLimitedRetryBackOffValidationError{
9843 field: fmt.Sprintf("ResetHeaders[%v]", idx),
9844 reason: "embedded message failed validation",
9845 cause: err,
9846 })
9847 }
9848 }
9849 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
9850 if err := v.Validate(); err != nil {
9851 return RetryPolicy_RateLimitedRetryBackOffValidationError{
9852 field: fmt.Sprintf("ResetHeaders[%v]", idx),
9853 reason: "embedded message failed validation",
9854 cause: err,
9855 }
9856 }
9857 }
9858
9859 }
9860
9861 if d := m.GetMaxInterval(); d != nil {
9862 dur, err := d.AsDuration(), d.CheckValid()
9863 if err != nil {
9864 err = RetryPolicy_RateLimitedRetryBackOffValidationError{
9865 field: "MaxInterval",
9866 reason: "value is not a valid duration",
9867 cause: err,
9868 }
9869 if !all {
9870 return err
9871 }
9872 errors = append(errors, err)
9873 } else {
9874
9875 gt := time.Duration(0*time.Second + 0*time.Nanosecond)
9876
9877 if dur <= gt {
9878 err := RetryPolicy_RateLimitedRetryBackOffValidationError{
9879 field: "MaxInterval",
9880 reason: "value must be greater than 0s",
9881 }
9882 if !all {
9883 return err
9884 }
9885 errors = append(errors, err)
9886 }
9887
9888 }
9889 }
9890
9891 if len(errors) > 0 {
9892 return RetryPolicy_RateLimitedRetryBackOffMultiError(errors)
9893 }
9894
9895 return nil
9896 }
9897
9898 // RetryPolicy_RateLimitedRetryBackOffMultiError is an error wrapping multiple
9899 // validation errors returned by
9900 // RetryPolicy_RateLimitedRetryBackOff.ValidateAll() if the designated
9901 // constraints aren't met.
9902 type RetryPolicy_RateLimitedRetryBackOffMultiError []error
9903
9904 // Error returns a concatenation of all the error messages it wraps.
9905 func (m RetryPolicy_RateLimitedRetryBackOffMultiError) Error() string {
9906 var msgs []string
9907 for _, err := range m {
9908 msgs = append(msgs, err.Error())
9909 }
9910 return strings.Join(msgs, "; ")
9911 }
9912
9913 // AllErrors returns a list of validation violation errors.
9914 func (m RetryPolicy_RateLimitedRetryBackOffMultiError) AllErrors() []error { return m }
9915
9916 // RetryPolicy_RateLimitedRetryBackOffValidationError is the validation error
9917 // returned by RetryPolicy_RateLimitedRetryBackOff.Validate if the designated
9918 // constraints aren't met.
9919 type RetryPolicy_RateLimitedRetryBackOffValidationError struct {
9920 field string
9921 reason string
9922 cause error
9923 key bool
9924 }
9925
9926 // Field function returns field value.
9927 func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Field() string { return e.field }
9928
9929 // Reason function returns reason value.
9930 func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Reason() string { return e.reason }
9931
9932 // Cause function returns cause value.
9933 func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Cause() error { return e.cause }
9934
9935 // Key function returns key value.
9936 func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Key() bool { return e.key }
9937
9938 // ErrorName returns error name.
9939 func (e RetryPolicy_RateLimitedRetryBackOffValidationError) ErrorName() string {
9940 return "RetryPolicy_RateLimitedRetryBackOffValidationError"
9941 }
9942
9943 // Error satisfies the builtin error interface
9944 func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Error() string {
9945 cause := ""
9946 if e.cause != nil {
9947 cause = fmt.Sprintf(" | caused by: %v", e.cause)
9948 }
9949
9950 key := ""
9951 if e.key {
9952 key = "key for "
9953 }
9954
9955 return fmt.Sprintf(
9956 "invalid %sRetryPolicy_RateLimitedRetryBackOff.%s: %s%s",
9957 key,
9958 e.field,
9959 e.reason,
9960 cause)
9961 }
9962
9963 var _ error = RetryPolicy_RateLimitedRetryBackOffValidationError{}
9964
9965 var _ interface {
9966 Field() string
9967 Reason() string
9968 Key() bool
9969 Cause() error
9970 ErrorName() string
9971 } = RetryPolicy_RateLimitedRetryBackOffValidationError{}
9972
9973 // Validate checks the field values on RateLimit_Action with the rules defined
9974 // in the proto definition for this message. If any rules are violated, the
9975 // first error encountered is returned, or nil if there are no violations.
9976 func (m *RateLimit_Action) Validate() error {
9977 return m.validate(false)
9978 }
9979
9980 // ValidateAll checks the field values on RateLimit_Action with the rules
9981 // defined in the proto definition for this message. If any rules are
9982 // violated, the result is a list of violation errors wrapped in
9983 // RateLimit_ActionMultiError, or nil if none found.
9984 func (m *RateLimit_Action) ValidateAll() error {
9985 return m.validate(true)
9986 }
9987
9988 func (m *RateLimit_Action) validate(all bool) error {
9989 if m == nil {
9990 return nil
9991 }
9992
9993 var errors []error
9994
9995 oneofActionSpecifierPresent := false
9996 switch v := m.ActionSpecifier.(type) {
9997 case *RateLimit_Action_SourceCluster_:
9998 if v == nil {
9999 err := RateLimit_ActionValidationError{
10000 field: "ActionSpecifier",
10001 reason: "oneof value cannot be a typed-nil",
10002 }
10003 if !all {
10004 return err
10005 }
10006 errors = append(errors, err)
10007 }
10008 oneofActionSpecifierPresent = true
10009
10010 if all {
10011 switch v := interface{}(m.GetSourceCluster()).(type) {
10012 case interface{ ValidateAll() error }:
10013 if err := v.ValidateAll(); err != nil {
10014 errors = append(errors, RateLimit_ActionValidationError{
10015 field: "SourceCluster",
10016 reason: "embedded message failed validation",
10017 cause: err,
10018 })
10019 }
10020 case interface{ Validate() error }:
10021 if err := v.Validate(); err != nil {
10022 errors = append(errors, RateLimit_ActionValidationError{
10023 field: "SourceCluster",
10024 reason: "embedded message failed validation",
10025 cause: err,
10026 })
10027 }
10028 }
10029 } else if v, ok := interface{}(m.GetSourceCluster()).(interface{ Validate() error }); ok {
10030 if err := v.Validate(); err != nil {
10031 return RateLimit_ActionValidationError{
10032 field: "SourceCluster",
10033 reason: "embedded message failed validation",
10034 cause: err,
10035 }
10036 }
10037 }
10038
10039 case *RateLimit_Action_DestinationCluster_:
10040 if v == nil {
10041 err := RateLimit_ActionValidationError{
10042 field: "ActionSpecifier",
10043 reason: "oneof value cannot be a typed-nil",
10044 }
10045 if !all {
10046 return err
10047 }
10048 errors = append(errors, err)
10049 }
10050 oneofActionSpecifierPresent = true
10051
10052 if all {
10053 switch v := interface{}(m.GetDestinationCluster()).(type) {
10054 case interface{ ValidateAll() error }:
10055 if err := v.ValidateAll(); err != nil {
10056 errors = append(errors, RateLimit_ActionValidationError{
10057 field: "DestinationCluster",
10058 reason: "embedded message failed validation",
10059 cause: err,
10060 })
10061 }
10062 case interface{ Validate() error }:
10063 if err := v.Validate(); err != nil {
10064 errors = append(errors, RateLimit_ActionValidationError{
10065 field: "DestinationCluster",
10066 reason: "embedded message failed validation",
10067 cause: err,
10068 })
10069 }
10070 }
10071 } else if v, ok := interface{}(m.GetDestinationCluster()).(interface{ Validate() error }); ok {
10072 if err := v.Validate(); err != nil {
10073 return RateLimit_ActionValidationError{
10074 field: "DestinationCluster",
10075 reason: "embedded message failed validation",
10076 cause: err,
10077 }
10078 }
10079 }
10080
10081 case *RateLimit_Action_RequestHeaders_:
10082 if v == nil {
10083 err := RateLimit_ActionValidationError{
10084 field: "ActionSpecifier",
10085 reason: "oneof value cannot be a typed-nil",
10086 }
10087 if !all {
10088 return err
10089 }
10090 errors = append(errors, err)
10091 }
10092 oneofActionSpecifierPresent = true
10093
10094 if all {
10095 switch v := interface{}(m.GetRequestHeaders()).(type) {
10096 case interface{ ValidateAll() error }:
10097 if err := v.ValidateAll(); err != nil {
10098 errors = append(errors, RateLimit_ActionValidationError{
10099 field: "RequestHeaders",
10100 reason: "embedded message failed validation",
10101 cause: err,
10102 })
10103 }
10104 case interface{ Validate() error }:
10105 if err := v.Validate(); err != nil {
10106 errors = append(errors, RateLimit_ActionValidationError{
10107 field: "RequestHeaders",
10108 reason: "embedded message failed validation",
10109 cause: err,
10110 })
10111 }
10112 }
10113 } else if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok {
10114 if err := v.Validate(); err != nil {
10115 return RateLimit_ActionValidationError{
10116 field: "RequestHeaders",
10117 reason: "embedded message failed validation",
10118 cause: err,
10119 }
10120 }
10121 }
10122
10123 case *RateLimit_Action_RemoteAddress_:
10124 if v == nil {
10125 err := RateLimit_ActionValidationError{
10126 field: "ActionSpecifier",
10127 reason: "oneof value cannot be a typed-nil",
10128 }
10129 if !all {
10130 return err
10131 }
10132 errors = append(errors, err)
10133 }
10134 oneofActionSpecifierPresent = true
10135
10136 if all {
10137 switch v := interface{}(m.GetRemoteAddress()).(type) {
10138 case interface{ ValidateAll() error }:
10139 if err := v.ValidateAll(); err != nil {
10140 errors = append(errors, RateLimit_ActionValidationError{
10141 field: "RemoteAddress",
10142 reason: "embedded message failed validation",
10143 cause: err,
10144 })
10145 }
10146 case interface{ Validate() error }:
10147 if err := v.Validate(); err != nil {
10148 errors = append(errors, RateLimit_ActionValidationError{
10149 field: "RemoteAddress",
10150 reason: "embedded message failed validation",
10151 cause: err,
10152 })
10153 }
10154 }
10155 } else if v, ok := interface{}(m.GetRemoteAddress()).(interface{ Validate() error }); ok {
10156 if err := v.Validate(); err != nil {
10157 return RateLimit_ActionValidationError{
10158 field: "RemoteAddress",
10159 reason: "embedded message failed validation",
10160 cause: err,
10161 }
10162 }
10163 }
10164
10165 case *RateLimit_Action_GenericKey_:
10166 if v == nil {
10167 err := RateLimit_ActionValidationError{
10168 field: "ActionSpecifier",
10169 reason: "oneof value cannot be a typed-nil",
10170 }
10171 if !all {
10172 return err
10173 }
10174 errors = append(errors, err)
10175 }
10176 oneofActionSpecifierPresent = true
10177
10178 if all {
10179 switch v := interface{}(m.GetGenericKey()).(type) {
10180 case interface{ ValidateAll() error }:
10181 if err := v.ValidateAll(); err != nil {
10182 errors = append(errors, RateLimit_ActionValidationError{
10183 field: "GenericKey",
10184 reason: "embedded message failed validation",
10185 cause: err,
10186 })
10187 }
10188 case interface{ Validate() error }:
10189 if err := v.Validate(); err != nil {
10190 errors = append(errors, RateLimit_ActionValidationError{
10191 field: "GenericKey",
10192 reason: "embedded message failed validation",
10193 cause: err,
10194 })
10195 }
10196 }
10197 } else if v, ok := interface{}(m.GetGenericKey()).(interface{ Validate() error }); ok {
10198 if err := v.Validate(); err != nil {
10199 return RateLimit_ActionValidationError{
10200 field: "GenericKey",
10201 reason: "embedded message failed validation",
10202 cause: err,
10203 }
10204 }
10205 }
10206
10207 case *RateLimit_Action_HeaderValueMatch_:
10208 if v == nil {
10209 err := RateLimit_ActionValidationError{
10210 field: "ActionSpecifier",
10211 reason: "oneof value cannot be a typed-nil",
10212 }
10213 if !all {
10214 return err
10215 }
10216 errors = append(errors, err)
10217 }
10218 oneofActionSpecifierPresent = true
10219
10220 if all {
10221 switch v := interface{}(m.GetHeaderValueMatch()).(type) {
10222 case interface{ ValidateAll() error }:
10223 if err := v.ValidateAll(); err != nil {
10224 errors = append(errors, RateLimit_ActionValidationError{
10225 field: "HeaderValueMatch",
10226 reason: "embedded message failed validation",
10227 cause: err,
10228 })
10229 }
10230 case interface{ Validate() error }:
10231 if err := v.Validate(); err != nil {
10232 errors = append(errors, RateLimit_ActionValidationError{
10233 field: "HeaderValueMatch",
10234 reason: "embedded message failed validation",
10235 cause: err,
10236 })
10237 }
10238 }
10239 } else if v, ok := interface{}(m.GetHeaderValueMatch()).(interface{ Validate() error }); ok {
10240 if err := v.Validate(); err != nil {
10241 return RateLimit_ActionValidationError{
10242 field: "HeaderValueMatch",
10243 reason: "embedded message failed validation",
10244 cause: err,
10245 }
10246 }
10247 }
10248
10249 case *RateLimit_Action_DynamicMetadata:
10250 if v == nil {
10251 err := RateLimit_ActionValidationError{
10252 field: "ActionSpecifier",
10253 reason: "oneof value cannot be a typed-nil",
10254 }
10255 if !all {
10256 return err
10257 }
10258 errors = append(errors, err)
10259 }
10260 oneofActionSpecifierPresent = true
10261
10262 if all {
10263 switch v := interface{}(m.GetDynamicMetadata()).(type) {
10264 case interface{ ValidateAll() error }:
10265 if err := v.ValidateAll(); err != nil {
10266 errors = append(errors, RateLimit_ActionValidationError{
10267 field: "DynamicMetadata",
10268 reason: "embedded message failed validation",
10269 cause: err,
10270 })
10271 }
10272 case interface{ Validate() error }:
10273 if err := v.Validate(); err != nil {
10274 errors = append(errors, RateLimit_ActionValidationError{
10275 field: "DynamicMetadata",
10276 reason: "embedded message failed validation",
10277 cause: err,
10278 })
10279 }
10280 }
10281 } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok {
10282 if err := v.Validate(); err != nil {
10283 return RateLimit_ActionValidationError{
10284 field: "DynamicMetadata",
10285 reason: "embedded message failed validation",
10286 cause: err,
10287 }
10288 }
10289 }
10290
10291 case *RateLimit_Action_Metadata:
10292 if v == nil {
10293 err := RateLimit_ActionValidationError{
10294 field: "ActionSpecifier",
10295 reason: "oneof value cannot be a typed-nil",
10296 }
10297 if !all {
10298 return err
10299 }
10300 errors = append(errors, err)
10301 }
10302 oneofActionSpecifierPresent = true
10303
10304 if all {
10305 switch v := interface{}(m.GetMetadata()).(type) {
10306 case interface{ ValidateAll() error }:
10307 if err := v.ValidateAll(); err != nil {
10308 errors = append(errors, RateLimit_ActionValidationError{
10309 field: "Metadata",
10310 reason: "embedded message failed validation",
10311 cause: err,
10312 })
10313 }
10314 case interface{ Validate() error }:
10315 if err := v.Validate(); err != nil {
10316 errors = append(errors, RateLimit_ActionValidationError{
10317 field: "Metadata",
10318 reason: "embedded message failed validation",
10319 cause: err,
10320 })
10321 }
10322 }
10323 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
10324 if err := v.Validate(); err != nil {
10325 return RateLimit_ActionValidationError{
10326 field: "Metadata",
10327 reason: "embedded message failed validation",
10328 cause: err,
10329 }
10330 }
10331 }
10332
10333 case *RateLimit_Action_Extension:
10334 if v == nil {
10335 err := RateLimit_ActionValidationError{
10336 field: "ActionSpecifier",
10337 reason: "oneof value cannot be a typed-nil",
10338 }
10339 if !all {
10340 return err
10341 }
10342 errors = append(errors, err)
10343 }
10344 oneofActionSpecifierPresent = true
10345
10346 if all {
10347 switch v := interface{}(m.GetExtension()).(type) {
10348 case interface{ ValidateAll() error }:
10349 if err := v.ValidateAll(); err != nil {
10350 errors = append(errors, RateLimit_ActionValidationError{
10351 field: "Extension",
10352 reason: "embedded message failed validation",
10353 cause: err,
10354 })
10355 }
10356 case interface{ Validate() error }:
10357 if err := v.Validate(); err != nil {
10358 errors = append(errors, RateLimit_ActionValidationError{
10359 field: "Extension",
10360 reason: "embedded message failed validation",
10361 cause: err,
10362 })
10363 }
10364 }
10365 } else if v, ok := interface{}(m.GetExtension()).(interface{ Validate() error }); ok {
10366 if err := v.Validate(); err != nil {
10367 return RateLimit_ActionValidationError{
10368 field: "Extension",
10369 reason: "embedded message failed validation",
10370 cause: err,
10371 }
10372 }
10373 }
10374
10375 case *RateLimit_Action_MaskedRemoteAddress_:
10376 if v == nil {
10377 err := RateLimit_ActionValidationError{
10378 field: "ActionSpecifier",
10379 reason: "oneof value cannot be a typed-nil",
10380 }
10381 if !all {
10382 return err
10383 }
10384 errors = append(errors, err)
10385 }
10386 oneofActionSpecifierPresent = true
10387
10388 if all {
10389 switch v := interface{}(m.GetMaskedRemoteAddress()).(type) {
10390 case interface{ ValidateAll() error }:
10391 if err := v.ValidateAll(); err != nil {
10392 errors = append(errors, RateLimit_ActionValidationError{
10393 field: "MaskedRemoteAddress",
10394 reason: "embedded message failed validation",
10395 cause: err,
10396 })
10397 }
10398 case interface{ Validate() error }:
10399 if err := v.Validate(); err != nil {
10400 errors = append(errors, RateLimit_ActionValidationError{
10401 field: "MaskedRemoteAddress",
10402 reason: "embedded message failed validation",
10403 cause: err,
10404 })
10405 }
10406 }
10407 } else if v, ok := interface{}(m.GetMaskedRemoteAddress()).(interface{ Validate() error }); ok {
10408 if err := v.Validate(); err != nil {
10409 return RateLimit_ActionValidationError{
10410 field: "MaskedRemoteAddress",
10411 reason: "embedded message failed validation",
10412 cause: err,
10413 }
10414 }
10415 }
10416
10417 case *RateLimit_Action_QueryParameterValueMatch_:
10418 if v == nil {
10419 err := RateLimit_ActionValidationError{
10420 field: "ActionSpecifier",
10421 reason: "oneof value cannot be a typed-nil",
10422 }
10423 if !all {
10424 return err
10425 }
10426 errors = append(errors, err)
10427 }
10428 oneofActionSpecifierPresent = true
10429
10430 if all {
10431 switch v := interface{}(m.GetQueryParameterValueMatch()).(type) {
10432 case interface{ ValidateAll() error }:
10433 if err := v.ValidateAll(); err != nil {
10434 errors = append(errors, RateLimit_ActionValidationError{
10435 field: "QueryParameterValueMatch",
10436 reason: "embedded message failed validation",
10437 cause: err,
10438 })
10439 }
10440 case interface{ Validate() error }:
10441 if err := v.Validate(); err != nil {
10442 errors = append(errors, RateLimit_ActionValidationError{
10443 field: "QueryParameterValueMatch",
10444 reason: "embedded message failed validation",
10445 cause: err,
10446 })
10447 }
10448 }
10449 } else if v, ok := interface{}(m.GetQueryParameterValueMatch()).(interface{ Validate() error }); ok {
10450 if err := v.Validate(); err != nil {
10451 return RateLimit_ActionValidationError{
10452 field: "QueryParameterValueMatch",
10453 reason: "embedded message failed validation",
10454 cause: err,
10455 }
10456 }
10457 }
10458
10459 default:
10460 _ = v // ensures v is used
10461 }
10462 if !oneofActionSpecifierPresent {
10463 err := RateLimit_ActionValidationError{
10464 field: "ActionSpecifier",
10465 reason: "value is required",
10466 }
10467 if !all {
10468 return err
10469 }
10470 errors = append(errors, err)
10471 }
10472
10473 if len(errors) > 0 {
10474 return RateLimit_ActionMultiError(errors)
10475 }
10476
10477 return nil
10478 }
10479
10480 // RateLimit_ActionMultiError is an error wrapping multiple validation errors
10481 // returned by RateLimit_Action.ValidateAll() if the designated constraints
10482 // aren't met.
10483 type RateLimit_ActionMultiError []error
10484
10485 // Error returns a concatenation of all the error messages it wraps.
10486 func (m RateLimit_ActionMultiError) Error() string {
10487 var msgs []string
10488 for _, err := range m {
10489 msgs = append(msgs, err.Error())
10490 }
10491 return strings.Join(msgs, "; ")
10492 }
10493
10494 // AllErrors returns a list of validation violation errors.
10495 func (m RateLimit_ActionMultiError) AllErrors() []error { return m }
10496
10497 // RateLimit_ActionValidationError is the validation error returned by
10498 // RateLimit_Action.Validate if the designated constraints aren't met.
10499 type RateLimit_ActionValidationError struct {
10500 field string
10501 reason string
10502 cause error
10503 key bool
10504 }
10505
10506 // Field function returns field value.
10507 func (e RateLimit_ActionValidationError) Field() string { return e.field }
10508
10509 // Reason function returns reason value.
10510 func (e RateLimit_ActionValidationError) Reason() string { return e.reason }
10511
10512 // Cause function returns cause value.
10513 func (e RateLimit_ActionValidationError) Cause() error { return e.cause }
10514
10515 // Key function returns key value.
10516 func (e RateLimit_ActionValidationError) Key() bool { return e.key }
10517
10518 // ErrorName returns error name.
10519 func (e RateLimit_ActionValidationError) ErrorName() string { return "RateLimit_ActionValidationError" }
10520
10521 // Error satisfies the builtin error interface
10522 func (e RateLimit_ActionValidationError) Error() string {
10523 cause := ""
10524 if e.cause != nil {
10525 cause = fmt.Sprintf(" | caused by: %v", e.cause)
10526 }
10527
10528 key := ""
10529 if e.key {
10530 key = "key for "
10531 }
10532
10533 return fmt.Sprintf(
10534 "invalid %sRateLimit_Action.%s: %s%s",
10535 key,
10536 e.field,
10537 e.reason,
10538 cause)
10539 }
10540
10541 var _ error = RateLimit_ActionValidationError{}
10542
10543 var _ interface {
10544 Field() string
10545 Reason() string
10546 Key() bool
10547 Cause() error
10548 ErrorName() string
10549 } = RateLimit_ActionValidationError{}
10550
10551 // Validate checks the field values on RateLimit_Override with the rules
10552 // defined in the proto definition for this message. If any rules are
10553 // violated, the first error encountered is returned, or nil if there are no violations.
10554 func (m *RateLimit_Override) Validate() error {
10555 return m.validate(false)
10556 }
10557
10558 // ValidateAll checks the field values on RateLimit_Override with the rules
10559 // defined in the proto definition for this message. If any rules are
10560 // violated, the result is a list of violation errors wrapped in
10561 // RateLimit_OverrideMultiError, or nil if none found.
10562 func (m *RateLimit_Override) ValidateAll() error {
10563 return m.validate(true)
10564 }
10565
10566 func (m *RateLimit_Override) validate(all bool) error {
10567 if m == nil {
10568 return nil
10569 }
10570
10571 var errors []error
10572
10573 oneofOverrideSpecifierPresent := false
10574 switch v := m.OverrideSpecifier.(type) {
10575 case *RateLimit_Override_DynamicMetadata_:
10576 if v == nil {
10577 err := RateLimit_OverrideValidationError{
10578 field: "OverrideSpecifier",
10579 reason: "oneof value cannot be a typed-nil",
10580 }
10581 if !all {
10582 return err
10583 }
10584 errors = append(errors, err)
10585 }
10586 oneofOverrideSpecifierPresent = true
10587
10588 if all {
10589 switch v := interface{}(m.GetDynamicMetadata()).(type) {
10590 case interface{ ValidateAll() error }:
10591 if err := v.ValidateAll(); err != nil {
10592 errors = append(errors, RateLimit_OverrideValidationError{
10593 field: "DynamicMetadata",
10594 reason: "embedded message failed validation",
10595 cause: err,
10596 })
10597 }
10598 case interface{ Validate() error }:
10599 if err := v.Validate(); err != nil {
10600 errors = append(errors, RateLimit_OverrideValidationError{
10601 field: "DynamicMetadata",
10602 reason: "embedded message failed validation",
10603 cause: err,
10604 })
10605 }
10606 }
10607 } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok {
10608 if err := v.Validate(); err != nil {
10609 return RateLimit_OverrideValidationError{
10610 field: "DynamicMetadata",
10611 reason: "embedded message failed validation",
10612 cause: err,
10613 }
10614 }
10615 }
10616
10617 default:
10618 _ = v // ensures v is used
10619 }
10620 if !oneofOverrideSpecifierPresent {
10621 err := RateLimit_OverrideValidationError{
10622 field: "OverrideSpecifier",
10623 reason: "value is required",
10624 }
10625 if !all {
10626 return err
10627 }
10628 errors = append(errors, err)
10629 }
10630
10631 if len(errors) > 0 {
10632 return RateLimit_OverrideMultiError(errors)
10633 }
10634
10635 return nil
10636 }
10637
10638 // RateLimit_OverrideMultiError is an error wrapping multiple validation errors
10639 // returned by RateLimit_Override.ValidateAll() if the designated constraints
10640 // aren't met.
10641 type RateLimit_OverrideMultiError []error
10642
10643 // Error returns a concatenation of all the error messages it wraps.
10644 func (m RateLimit_OverrideMultiError) Error() string {
10645 var msgs []string
10646 for _, err := range m {
10647 msgs = append(msgs, err.Error())
10648 }
10649 return strings.Join(msgs, "; ")
10650 }
10651
10652 // AllErrors returns a list of validation violation errors.
10653 func (m RateLimit_OverrideMultiError) AllErrors() []error { return m }
10654
10655 // RateLimit_OverrideValidationError is the validation error returned by
10656 // RateLimit_Override.Validate if the designated constraints aren't met.
10657 type RateLimit_OverrideValidationError struct {
10658 field string
10659 reason string
10660 cause error
10661 key bool
10662 }
10663
10664 // Field function returns field value.
10665 func (e RateLimit_OverrideValidationError) Field() string { return e.field }
10666
10667 // Reason function returns reason value.
10668 func (e RateLimit_OverrideValidationError) Reason() string { return e.reason }
10669
10670 // Cause function returns cause value.
10671 func (e RateLimit_OverrideValidationError) Cause() error { return e.cause }
10672
10673 // Key function returns key value.
10674 func (e RateLimit_OverrideValidationError) Key() bool { return e.key }
10675
10676 // ErrorName returns error name.
10677 func (e RateLimit_OverrideValidationError) ErrorName() string {
10678 return "RateLimit_OverrideValidationError"
10679 }
10680
10681 // Error satisfies the builtin error interface
10682 func (e RateLimit_OverrideValidationError) Error() string {
10683 cause := ""
10684 if e.cause != nil {
10685 cause = fmt.Sprintf(" | caused by: %v", e.cause)
10686 }
10687
10688 key := ""
10689 if e.key {
10690 key = "key for "
10691 }
10692
10693 return fmt.Sprintf(
10694 "invalid %sRateLimit_Override.%s: %s%s",
10695 key,
10696 e.field,
10697 e.reason,
10698 cause)
10699 }
10700
10701 var _ error = RateLimit_OverrideValidationError{}
10702
10703 var _ interface {
10704 Field() string
10705 Reason() string
10706 Key() bool
10707 Cause() error
10708 ErrorName() string
10709 } = RateLimit_OverrideValidationError{}
10710
10711 // Validate checks the field values on RateLimit_HitsAddend with the rules
10712 // defined in the proto definition for this message. If any rules are
10713 // violated, the first error encountered is returned, or nil if there are no violations.
10714 func (m *RateLimit_HitsAddend) Validate() error {
10715 return m.validate(false)
10716 }
10717
10718 // ValidateAll checks the field values on RateLimit_HitsAddend with the rules
10719 // defined in the proto definition for this message. If any rules are
10720 // violated, the result is a list of violation errors wrapped in
10721 // RateLimit_HitsAddendMultiError, or nil if none found.
10722 func (m *RateLimit_HitsAddend) ValidateAll() error {
10723 return m.validate(true)
10724 }
10725
10726 func (m *RateLimit_HitsAddend) validate(all bool) error {
10727 if m == nil {
10728 return nil
10729 }
10730
10731 var errors []error
10732
10733 if wrapper := m.GetNumber(); wrapper != nil {
10734
10735 if wrapper.GetValue() > 1000000000 {
10736 err := RateLimit_HitsAddendValidationError{
10737 field: "Number",
10738 reason: "value must be less than or equal to 1000000000",
10739 }
10740 if !all {
10741 return err
10742 }
10743 errors = append(errors, err)
10744 }
10745
10746 }
10747
10748 if m.GetFormat() != "" {
10749
10750 if !strings.HasPrefix(m.GetFormat(), "%") {
10751 err := RateLimit_HitsAddendValidationError{
10752 field: "Format",
10753 reason: "value does not have prefix \"%\"",
10754 }
10755 if !all {
10756 return err
10757 }
10758 errors = append(errors, err)
10759 }
10760
10761 if !strings.HasSuffix(m.GetFormat(), "%") {
10762 err := RateLimit_HitsAddendValidationError{
10763 field: "Format",
10764 reason: "value does not have suffix \"%\"",
10765 }
10766 if !all {
10767 return err
10768 }
10769 errors = append(errors, err)
10770 }
10771
10772 }
10773
10774 if len(errors) > 0 {
10775 return RateLimit_HitsAddendMultiError(errors)
10776 }
10777
10778 return nil
10779 }
10780
10781 // RateLimit_HitsAddendMultiError is an error wrapping multiple validation
10782 // errors returned by RateLimit_HitsAddend.ValidateAll() if the designated
10783 // constraints aren't met.
10784 type RateLimit_HitsAddendMultiError []error
10785
10786 // Error returns a concatenation of all the error messages it wraps.
10787 func (m RateLimit_HitsAddendMultiError) Error() string {
10788 var msgs []string
10789 for _, err := range m {
10790 msgs = append(msgs, err.Error())
10791 }
10792 return strings.Join(msgs, "; ")
10793 }
10794
10795 // AllErrors returns a list of validation violation errors.
10796 func (m RateLimit_HitsAddendMultiError) AllErrors() []error { return m }
10797
10798 // RateLimit_HitsAddendValidationError is the validation error returned by
10799 // RateLimit_HitsAddend.Validate if the designated constraints aren't met.
10800 type RateLimit_HitsAddendValidationError struct {
10801 field string
10802 reason string
10803 cause error
10804 key bool
10805 }
10806
10807 // Field function returns field value.
10808 func (e RateLimit_HitsAddendValidationError) Field() string { return e.field }
10809
10810 // Reason function returns reason value.
10811 func (e RateLimit_HitsAddendValidationError) Reason() string { return e.reason }
10812
10813 // Cause function returns cause value.
10814 func (e RateLimit_HitsAddendValidationError) Cause() error { return e.cause }
10815
10816 // Key function returns key value.
10817 func (e RateLimit_HitsAddendValidationError) Key() bool { return e.key }
10818
10819 // ErrorName returns error name.
10820 func (e RateLimit_HitsAddendValidationError) ErrorName() string {
10821 return "RateLimit_HitsAddendValidationError"
10822 }
10823
10824 // Error satisfies the builtin error interface
10825 func (e RateLimit_HitsAddendValidationError) Error() string {
10826 cause := ""
10827 if e.cause != nil {
10828 cause = fmt.Sprintf(" | caused by: %v", e.cause)
10829 }
10830
10831 key := ""
10832 if e.key {
10833 key = "key for "
10834 }
10835
10836 return fmt.Sprintf(
10837 "invalid %sRateLimit_HitsAddend.%s: %s%s",
10838 key,
10839 e.field,
10840 e.reason,
10841 cause)
10842 }
10843
10844 var _ error = RateLimit_HitsAddendValidationError{}
10845
10846 var _ interface {
10847 Field() string
10848 Reason() string
10849 Key() bool
10850 Cause() error
10851 ErrorName() string
10852 } = RateLimit_HitsAddendValidationError{}
10853
10854 // Validate checks the field values on RateLimit_Action_SourceCluster with the
10855 // rules defined in the proto definition for this message. If any rules are
10856 // violated, the first error encountered is returned, or nil if there are no violations.
10857 func (m *RateLimit_Action_SourceCluster) Validate() error {
10858 return m.validate(false)
10859 }
10860
10861 // ValidateAll checks the field values on RateLimit_Action_SourceCluster with
10862 // the rules defined in the proto definition for this message. If any rules
10863 // are violated, the result is a list of violation errors wrapped in
10864 // RateLimit_Action_SourceClusterMultiError, or nil if none found.
10865 func (m *RateLimit_Action_SourceCluster) ValidateAll() error {
10866 return m.validate(true)
10867 }
10868
10869 func (m *RateLimit_Action_SourceCluster) validate(all bool) error {
10870 if m == nil {
10871 return nil
10872 }
10873
10874 var errors []error
10875
10876 if len(errors) > 0 {
10877 return RateLimit_Action_SourceClusterMultiError(errors)
10878 }
10879
10880 return nil
10881 }
10882
10883 // RateLimit_Action_SourceClusterMultiError is an error wrapping multiple
10884 // validation errors returned by RateLimit_Action_SourceCluster.ValidateAll()
10885 // if the designated constraints aren't met.
10886 type RateLimit_Action_SourceClusterMultiError []error
10887
10888 // Error returns a concatenation of all the error messages it wraps.
10889 func (m RateLimit_Action_SourceClusterMultiError) Error() string {
10890 var msgs []string
10891 for _, err := range m {
10892 msgs = append(msgs, err.Error())
10893 }
10894 return strings.Join(msgs, "; ")
10895 }
10896
10897 // AllErrors returns a list of validation violation errors.
10898 func (m RateLimit_Action_SourceClusterMultiError) AllErrors() []error { return m }
10899
10900 // RateLimit_Action_SourceClusterValidationError is the validation error
10901 // returned by RateLimit_Action_SourceCluster.Validate if the designated
10902 // constraints aren't met.
10903 type RateLimit_Action_SourceClusterValidationError struct {
10904 field string
10905 reason string
10906 cause error
10907 key bool
10908 }
10909
10910 // Field function returns field value.
10911 func (e RateLimit_Action_SourceClusterValidationError) Field() string { return e.field }
10912
10913 // Reason function returns reason value.
10914 func (e RateLimit_Action_SourceClusterValidationError) Reason() string { return e.reason }
10915
10916 // Cause function returns cause value.
10917 func (e RateLimit_Action_SourceClusterValidationError) Cause() error { return e.cause }
10918
10919 // Key function returns key value.
10920 func (e RateLimit_Action_SourceClusterValidationError) Key() bool { return e.key }
10921
10922 // ErrorName returns error name.
10923 func (e RateLimit_Action_SourceClusterValidationError) ErrorName() string {
10924 return "RateLimit_Action_SourceClusterValidationError"
10925 }
10926
10927 // Error satisfies the builtin error interface
10928 func (e RateLimit_Action_SourceClusterValidationError) Error() string {
10929 cause := ""
10930 if e.cause != nil {
10931 cause = fmt.Sprintf(" | caused by: %v", e.cause)
10932 }
10933
10934 key := ""
10935 if e.key {
10936 key = "key for "
10937 }
10938
10939 return fmt.Sprintf(
10940 "invalid %sRateLimit_Action_SourceCluster.%s: %s%s",
10941 key,
10942 e.field,
10943 e.reason,
10944 cause)
10945 }
10946
10947 var _ error = RateLimit_Action_SourceClusterValidationError{}
10948
10949 var _ interface {
10950 Field() string
10951 Reason() string
10952 Key() bool
10953 Cause() error
10954 ErrorName() string
10955 } = RateLimit_Action_SourceClusterValidationError{}
10956
10957 // Validate checks the field values on RateLimit_Action_DestinationCluster with
10958 // the rules defined in the proto definition for this message. If any rules
10959 // are violated, the first error encountered is returned, or nil if there are
10960 // no violations.
10961 func (m *RateLimit_Action_DestinationCluster) Validate() error {
10962 return m.validate(false)
10963 }
10964
10965 // ValidateAll checks the field values on RateLimit_Action_DestinationCluster
10966 // with the rules defined in the proto definition for this message. If any
10967 // rules are violated, the result is a list of violation errors wrapped in
10968 // RateLimit_Action_DestinationClusterMultiError, or nil if none found.
10969 func (m *RateLimit_Action_DestinationCluster) ValidateAll() error {
10970 return m.validate(true)
10971 }
10972
10973 func (m *RateLimit_Action_DestinationCluster) validate(all bool) error {
10974 if m == nil {
10975 return nil
10976 }
10977
10978 var errors []error
10979
10980 if len(errors) > 0 {
10981 return RateLimit_Action_DestinationClusterMultiError(errors)
10982 }
10983
10984 return nil
10985 }
10986
10987 // RateLimit_Action_DestinationClusterMultiError is an error wrapping multiple
10988 // validation errors returned by
10989 // RateLimit_Action_DestinationCluster.ValidateAll() if the designated
10990 // constraints aren't met.
10991 type RateLimit_Action_DestinationClusterMultiError []error
10992
10993 // Error returns a concatenation of all the error messages it wraps.
10994 func (m RateLimit_Action_DestinationClusterMultiError) Error() string {
10995 var msgs []string
10996 for _, err := range m {
10997 msgs = append(msgs, err.Error())
10998 }
10999 return strings.Join(msgs, "; ")
11000 }
11001
11002 // AllErrors returns a list of validation violation errors.
11003 func (m RateLimit_Action_DestinationClusterMultiError) AllErrors() []error { return m }
11004
11005 // RateLimit_Action_DestinationClusterValidationError is the validation error
11006 // returned by RateLimit_Action_DestinationCluster.Validate if the designated
11007 // constraints aren't met.
11008 type RateLimit_Action_DestinationClusterValidationError struct {
11009 field string
11010 reason string
11011 cause error
11012 key bool
11013 }
11014
11015 // Field function returns field value.
11016 func (e RateLimit_Action_DestinationClusterValidationError) Field() string { return e.field }
11017
11018 // Reason function returns reason value.
11019 func (e RateLimit_Action_DestinationClusterValidationError) Reason() string { return e.reason }
11020
11021 // Cause function returns cause value.
11022 func (e RateLimit_Action_DestinationClusterValidationError) Cause() error { return e.cause }
11023
11024 // Key function returns key value.
11025 func (e RateLimit_Action_DestinationClusterValidationError) Key() bool { return e.key }
11026
11027 // ErrorName returns error name.
11028 func (e RateLimit_Action_DestinationClusterValidationError) ErrorName() string {
11029 return "RateLimit_Action_DestinationClusterValidationError"
11030 }
11031
11032 // Error satisfies the builtin error interface
11033 func (e RateLimit_Action_DestinationClusterValidationError) Error() string {
11034 cause := ""
11035 if e.cause != nil {
11036 cause = fmt.Sprintf(" | caused by: %v", e.cause)
11037 }
11038
11039 key := ""
11040 if e.key {
11041 key = "key for "
11042 }
11043
11044 return fmt.Sprintf(
11045 "invalid %sRateLimit_Action_DestinationCluster.%s: %s%s",
11046 key,
11047 e.field,
11048 e.reason,
11049 cause)
11050 }
11051
11052 var _ error = RateLimit_Action_DestinationClusterValidationError{}
11053
11054 var _ interface {
11055 Field() string
11056 Reason() string
11057 Key() bool
11058 Cause() error
11059 ErrorName() string
11060 } = RateLimit_Action_DestinationClusterValidationError{}
11061
11062 // Validate checks the field values on RateLimit_Action_RequestHeaders with the
11063 // rules defined in the proto definition for this message. If any rules are
11064 // violated, the first error encountered is returned, or nil if there are no violations.
11065 func (m *RateLimit_Action_RequestHeaders) Validate() error {
11066 return m.validate(false)
11067 }
11068
11069 // ValidateAll checks the field values on RateLimit_Action_RequestHeaders with
11070 // the rules defined in the proto definition for this message. If any rules
11071 // are violated, the result is a list of violation errors wrapped in
11072 // RateLimit_Action_RequestHeadersMultiError, or nil if none found.
11073 func (m *RateLimit_Action_RequestHeaders) ValidateAll() error {
11074 return m.validate(true)
11075 }
11076
11077 func (m *RateLimit_Action_RequestHeaders) validate(all bool) error {
11078 if m == nil {
11079 return nil
11080 }
11081
11082 var errors []error
11083
11084 if utf8.RuneCountInString(m.GetHeaderName()) < 1 {
11085 err := RateLimit_Action_RequestHeadersValidationError{
11086 field: "HeaderName",
11087 reason: "value length must be at least 1 runes",
11088 }
11089 if !all {
11090 return err
11091 }
11092 errors = append(errors, err)
11093 }
11094
11095 if !_RateLimit_Action_RequestHeaders_HeaderName_Pattern.MatchString(m.GetHeaderName()) {
11096 err := RateLimit_Action_RequestHeadersValidationError{
11097 field: "HeaderName",
11098 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
11099 }
11100 if !all {
11101 return err
11102 }
11103 errors = append(errors, err)
11104 }
11105
11106 if utf8.RuneCountInString(m.GetDescriptorKey()) < 1 {
11107 err := RateLimit_Action_RequestHeadersValidationError{
11108 field: "DescriptorKey",
11109 reason: "value length must be at least 1 runes",
11110 }
11111 if !all {
11112 return err
11113 }
11114 errors = append(errors, err)
11115 }
11116
11117 // no validation rules for SkipIfAbsent
11118
11119 if len(errors) > 0 {
11120 return RateLimit_Action_RequestHeadersMultiError(errors)
11121 }
11122
11123 return nil
11124 }
11125
11126 // RateLimit_Action_RequestHeadersMultiError is an error wrapping multiple
11127 // validation errors returned by RateLimit_Action_RequestHeaders.ValidateAll()
11128 // if the designated constraints aren't met.
11129 type RateLimit_Action_RequestHeadersMultiError []error
11130
11131 // Error returns a concatenation of all the error messages it wraps.
11132 func (m RateLimit_Action_RequestHeadersMultiError) Error() string {
11133 var msgs []string
11134 for _, err := range m {
11135 msgs = append(msgs, err.Error())
11136 }
11137 return strings.Join(msgs, "; ")
11138 }
11139
11140 // AllErrors returns a list of validation violation errors.
11141 func (m RateLimit_Action_RequestHeadersMultiError) AllErrors() []error { return m }
11142
11143 // RateLimit_Action_RequestHeadersValidationError is the validation error
11144 // returned by RateLimit_Action_RequestHeaders.Validate if the designated
11145 // constraints aren't met.
11146 type RateLimit_Action_RequestHeadersValidationError struct {
11147 field string
11148 reason string
11149 cause error
11150 key bool
11151 }
11152
11153 // Field function returns field value.
11154 func (e RateLimit_Action_RequestHeadersValidationError) Field() string { return e.field }
11155
11156 // Reason function returns reason value.
11157 func (e RateLimit_Action_RequestHeadersValidationError) Reason() string { return e.reason }
11158
11159 // Cause function returns cause value.
11160 func (e RateLimit_Action_RequestHeadersValidationError) Cause() error { return e.cause }
11161
11162 // Key function returns key value.
11163 func (e RateLimit_Action_RequestHeadersValidationError) Key() bool { return e.key }
11164
11165 // ErrorName returns error name.
11166 func (e RateLimit_Action_RequestHeadersValidationError) ErrorName() string {
11167 return "RateLimit_Action_RequestHeadersValidationError"
11168 }
11169
11170 // Error satisfies the builtin error interface
11171 func (e RateLimit_Action_RequestHeadersValidationError) Error() string {
11172 cause := ""
11173 if e.cause != nil {
11174 cause = fmt.Sprintf(" | caused by: %v", e.cause)
11175 }
11176
11177 key := ""
11178 if e.key {
11179 key = "key for "
11180 }
11181
11182 return fmt.Sprintf(
11183 "invalid %sRateLimit_Action_RequestHeaders.%s: %s%s",
11184 key,
11185 e.field,
11186 e.reason,
11187 cause)
11188 }
11189
11190 var _ error = RateLimit_Action_RequestHeadersValidationError{}
11191
11192 var _ interface {
11193 Field() string
11194 Reason() string
11195 Key() bool
11196 Cause() error
11197 ErrorName() string
11198 } = RateLimit_Action_RequestHeadersValidationError{}
11199
11200 var _RateLimit_Action_RequestHeaders_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
11201
11202 // Validate checks the field values on RateLimit_Action_RemoteAddress with the
11203 // rules defined in the proto definition for this message. If any rules are
11204 // violated, the first error encountered is returned, or nil if there are no violations.
11205 func (m *RateLimit_Action_RemoteAddress) Validate() error {
11206 return m.validate(false)
11207 }
11208
11209 // ValidateAll checks the field values on RateLimit_Action_RemoteAddress with
11210 // the rules defined in the proto definition for this message. If any rules
11211 // are violated, the result is a list of violation errors wrapped in
11212 // RateLimit_Action_RemoteAddressMultiError, or nil if none found.
11213 func (m *RateLimit_Action_RemoteAddress) ValidateAll() error {
11214 return m.validate(true)
11215 }
11216
11217 func (m *RateLimit_Action_RemoteAddress) validate(all bool) error {
11218 if m == nil {
11219 return nil
11220 }
11221
11222 var errors []error
11223
11224 if len(errors) > 0 {
11225 return RateLimit_Action_RemoteAddressMultiError(errors)
11226 }
11227
11228 return nil
11229 }
11230
11231 // RateLimit_Action_RemoteAddressMultiError is an error wrapping multiple
11232 // validation errors returned by RateLimit_Action_RemoteAddress.ValidateAll()
11233 // if the designated constraints aren't met.
11234 type RateLimit_Action_RemoteAddressMultiError []error
11235
11236 // Error returns a concatenation of all the error messages it wraps.
11237 func (m RateLimit_Action_RemoteAddressMultiError) Error() string {
11238 var msgs []string
11239 for _, err := range m {
11240 msgs = append(msgs, err.Error())
11241 }
11242 return strings.Join(msgs, "; ")
11243 }
11244
11245 // AllErrors returns a list of validation violation errors.
11246 func (m RateLimit_Action_RemoteAddressMultiError) AllErrors() []error { return m }
11247
11248 // RateLimit_Action_RemoteAddressValidationError is the validation error
11249 // returned by RateLimit_Action_RemoteAddress.Validate if the designated
11250 // constraints aren't met.
11251 type RateLimit_Action_RemoteAddressValidationError struct {
11252 field string
11253 reason string
11254 cause error
11255 key bool
11256 }
11257
11258 // Field function returns field value.
11259 func (e RateLimit_Action_RemoteAddressValidationError) Field() string { return e.field }
11260
11261 // Reason function returns reason value.
11262 func (e RateLimit_Action_RemoteAddressValidationError) Reason() string { return e.reason }
11263
11264 // Cause function returns cause value.
11265 func (e RateLimit_Action_RemoteAddressValidationError) Cause() error { return e.cause }
11266
11267 // Key function returns key value.
11268 func (e RateLimit_Action_RemoteAddressValidationError) Key() bool { return e.key }
11269
11270 // ErrorName returns error name.
11271 func (e RateLimit_Action_RemoteAddressValidationError) ErrorName() string {
11272 return "RateLimit_Action_RemoteAddressValidationError"
11273 }
11274
11275 // Error satisfies the builtin error interface
11276 func (e RateLimit_Action_RemoteAddressValidationError) Error() string {
11277 cause := ""
11278 if e.cause != nil {
11279 cause = fmt.Sprintf(" | caused by: %v", e.cause)
11280 }
11281
11282 key := ""
11283 if e.key {
11284 key = "key for "
11285 }
11286
11287 return fmt.Sprintf(
11288 "invalid %sRateLimit_Action_RemoteAddress.%s: %s%s",
11289 key,
11290 e.field,
11291 e.reason,
11292 cause)
11293 }
11294
11295 var _ error = RateLimit_Action_RemoteAddressValidationError{}
11296
11297 var _ interface {
11298 Field() string
11299 Reason() string
11300 Key() bool
11301 Cause() error
11302 ErrorName() string
11303 } = RateLimit_Action_RemoteAddressValidationError{}
11304
11305 // Validate checks the field values on RateLimit_Action_MaskedRemoteAddress
11306 // with the rules defined in the proto definition for this message. If any
11307 // rules are violated, the first error encountered is returned, or nil if
11308 // there are no violations.
11309 func (m *RateLimit_Action_MaskedRemoteAddress) Validate() error {
11310 return m.validate(false)
11311 }
11312
11313 // ValidateAll checks the field values on RateLimit_Action_MaskedRemoteAddress
11314 // with the rules defined in the proto definition for this message. If any
11315 // rules are violated, the result is a list of violation errors wrapped in
11316 // RateLimit_Action_MaskedRemoteAddressMultiError, or nil if none found.
11317 func (m *RateLimit_Action_MaskedRemoteAddress) ValidateAll() error {
11318 return m.validate(true)
11319 }
11320
11321 func (m *RateLimit_Action_MaskedRemoteAddress) validate(all bool) error {
11322 if m == nil {
11323 return nil
11324 }
11325
11326 var errors []error
11327
11328 if wrapper := m.GetV4PrefixMaskLen(); wrapper != nil {
11329
11330 if wrapper.GetValue() > 32 {
11331 err := RateLimit_Action_MaskedRemoteAddressValidationError{
11332 field: "V4PrefixMaskLen",
11333 reason: "value must be less than or equal to 32",
11334 }
11335 if !all {
11336 return err
11337 }
11338 errors = append(errors, err)
11339 }
11340
11341 }
11342
11343 if wrapper := m.GetV6PrefixMaskLen(); wrapper != nil {
11344
11345 if wrapper.GetValue() > 128 {
11346 err := RateLimit_Action_MaskedRemoteAddressValidationError{
11347 field: "V6PrefixMaskLen",
11348 reason: "value must be less than or equal to 128",
11349 }
11350 if !all {
11351 return err
11352 }
11353 errors = append(errors, err)
11354 }
11355
11356 }
11357
11358 if len(errors) > 0 {
11359 return RateLimit_Action_MaskedRemoteAddressMultiError(errors)
11360 }
11361
11362 return nil
11363 }
11364
11365 // RateLimit_Action_MaskedRemoteAddressMultiError is an error wrapping multiple
11366 // validation errors returned by
11367 // RateLimit_Action_MaskedRemoteAddress.ValidateAll() if the designated
11368 // constraints aren't met.
11369 type RateLimit_Action_MaskedRemoteAddressMultiError []error
11370
11371 // Error returns a concatenation of all the error messages it wraps.
11372 func (m RateLimit_Action_MaskedRemoteAddressMultiError) Error() string {
11373 var msgs []string
11374 for _, err := range m {
11375 msgs = append(msgs, err.Error())
11376 }
11377 return strings.Join(msgs, "; ")
11378 }
11379
11380 // AllErrors returns a list of validation violation errors.
11381 func (m RateLimit_Action_MaskedRemoteAddressMultiError) AllErrors() []error { return m }
11382
11383 // RateLimit_Action_MaskedRemoteAddressValidationError is the validation error
11384 // returned by RateLimit_Action_MaskedRemoteAddress.Validate if the designated
11385 // constraints aren't met.
11386 type RateLimit_Action_MaskedRemoteAddressValidationError struct {
11387 field string
11388 reason string
11389 cause error
11390 key bool
11391 }
11392
11393 // Field function returns field value.
11394 func (e RateLimit_Action_MaskedRemoteAddressValidationError) Field() string { return e.field }
11395
11396 // Reason function returns reason value.
11397 func (e RateLimit_Action_MaskedRemoteAddressValidationError) Reason() string { return e.reason }
11398
11399 // Cause function returns cause value.
11400 func (e RateLimit_Action_MaskedRemoteAddressValidationError) Cause() error { return e.cause }
11401
11402 // Key function returns key value.
11403 func (e RateLimit_Action_MaskedRemoteAddressValidationError) Key() bool { return e.key }
11404
11405 // ErrorName returns error name.
11406 func (e RateLimit_Action_MaskedRemoteAddressValidationError) ErrorName() string {
11407 return "RateLimit_Action_MaskedRemoteAddressValidationError"
11408 }
11409
11410 // Error satisfies the builtin error interface
11411 func (e RateLimit_Action_MaskedRemoteAddressValidationError) Error() string {
11412 cause := ""
11413 if e.cause != nil {
11414 cause = fmt.Sprintf(" | caused by: %v", e.cause)
11415 }
11416
11417 key := ""
11418 if e.key {
11419 key = "key for "
11420 }
11421
11422 return fmt.Sprintf(
11423 "invalid %sRateLimit_Action_MaskedRemoteAddress.%s: %s%s",
11424 key,
11425 e.field,
11426 e.reason,
11427 cause)
11428 }
11429
11430 var _ error = RateLimit_Action_MaskedRemoteAddressValidationError{}
11431
11432 var _ interface {
11433 Field() string
11434 Reason() string
11435 Key() bool
11436 Cause() error
11437 ErrorName() string
11438 } = RateLimit_Action_MaskedRemoteAddressValidationError{}
11439
11440 // Validate checks the field values on RateLimit_Action_GenericKey with the
11441 // rules defined in the proto definition for this message. If any rules are
11442 // violated, the first error encountered is returned, or nil if there are no violations.
11443 func (m *RateLimit_Action_GenericKey) Validate() error {
11444 return m.validate(false)
11445 }
11446
11447 // ValidateAll checks the field values on RateLimit_Action_GenericKey with the
11448 // rules defined in the proto definition for this message. If any rules are
11449 // violated, the result is a list of violation errors wrapped in
11450 // RateLimit_Action_GenericKeyMultiError, or nil if none found.
11451 func (m *RateLimit_Action_GenericKey) ValidateAll() error {
11452 return m.validate(true)
11453 }
11454
11455 func (m *RateLimit_Action_GenericKey) validate(all bool) error {
11456 if m == nil {
11457 return nil
11458 }
11459
11460 var errors []error
11461
11462 if utf8.RuneCountInString(m.GetDescriptorValue()) < 1 {
11463 err := RateLimit_Action_GenericKeyValidationError{
11464 field: "DescriptorValue",
11465 reason: "value length must be at least 1 runes",
11466 }
11467 if !all {
11468 return err
11469 }
11470 errors = append(errors, err)
11471 }
11472
11473 // no validation rules for DescriptorKey
11474
11475 if len(errors) > 0 {
11476 return RateLimit_Action_GenericKeyMultiError(errors)
11477 }
11478
11479 return nil
11480 }
11481
11482 // RateLimit_Action_GenericKeyMultiError is an error wrapping multiple
11483 // validation errors returned by RateLimit_Action_GenericKey.ValidateAll() if
11484 // the designated constraints aren't met.
11485 type RateLimit_Action_GenericKeyMultiError []error
11486
11487 // Error returns a concatenation of all the error messages it wraps.
11488 func (m RateLimit_Action_GenericKeyMultiError) Error() string {
11489 var msgs []string
11490 for _, err := range m {
11491 msgs = append(msgs, err.Error())
11492 }
11493 return strings.Join(msgs, "; ")
11494 }
11495
11496 // AllErrors returns a list of validation violation errors.
11497 func (m RateLimit_Action_GenericKeyMultiError) AllErrors() []error { return m }
11498
11499 // RateLimit_Action_GenericKeyValidationError is the validation error returned
11500 // by RateLimit_Action_GenericKey.Validate if the designated constraints
11501 // aren't met.
11502 type RateLimit_Action_GenericKeyValidationError struct {
11503 field string
11504 reason string
11505 cause error
11506 key bool
11507 }
11508
11509 // Field function returns field value.
11510 func (e RateLimit_Action_GenericKeyValidationError) Field() string { return e.field }
11511
11512 // Reason function returns reason value.
11513 func (e RateLimit_Action_GenericKeyValidationError) Reason() string { return e.reason }
11514
11515 // Cause function returns cause value.
11516 func (e RateLimit_Action_GenericKeyValidationError) Cause() error { return e.cause }
11517
11518 // Key function returns key value.
11519 func (e RateLimit_Action_GenericKeyValidationError) Key() bool { return e.key }
11520
11521 // ErrorName returns error name.
11522 func (e RateLimit_Action_GenericKeyValidationError) ErrorName() string {
11523 return "RateLimit_Action_GenericKeyValidationError"
11524 }
11525
11526 // Error satisfies the builtin error interface
11527 func (e RateLimit_Action_GenericKeyValidationError) Error() string {
11528 cause := ""
11529 if e.cause != nil {
11530 cause = fmt.Sprintf(" | caused by: %v", e.cause)
11531 }
11532
11533 key := ""
11534 if e.key {
11535 key = "key for "
11536 }
11537
11538 return fmt.Sprintf(
11539 "invalid %sRateLimit_Action_GenericKey.%s: %s%s",
11540 key,
11541 e.field,
11542 e.reason,
11543 cause)
11544 }
11545
11546 var _ error = RateLimit_Action_GenericKeyValidationError{}
11547
11548 var _ interface {
11549 Field() string
11550 Reason() string
11551 Key() bool
11552 Cause() error
11553 ErrorName() string
11554 } = RateLimit_Action_GenericKeyValidationError{}
11555
11556 // Validate checks the field values on RateLimit_Action_HeaderValueMatch with
11557 // the rules defined in the proto definition for this message. If any rules
11558 // are violated, the first error encountered is returned, or nil if there are
11559 // no violations.
11560 func (m *RateLimit_Action_HeaderValueMatch) Validate() error {
11561 return m.validate(false)
11562 }
11563
11564 // ValidateAll checks the field values on RateLimit_Action_HeaderValueMatch
11565 // with the rules defined in the proto definition for this message. If any
11566 // rules are violated, the result is a list of violation errors wrapped in
11567 // RateLimit_Action_HeaderValueMatchMultiError, or nil if none found.
11568 func (m *RateLimit_Action_HeaderValueMatch) ValidateAll() error {
11569 return m.validate(true)
11570 }
11571
11572 func (m *RateLimit_Action_HeaderValueMatch) validate(all bool) error {
11573 if m == nil {
11574 return nil
11575 }
11576
11577 var errors []error
11578
11579 // no validation rules for DescriptorKey
11580
11581 if utf8.RuneCountInString(m.GetDescriptorValue()) < 1 {
11582 err := RateLimit_Action_HeaderValueMatchValidationError{
11583 field: "DescriptorValue",
11584 reason: "value length must be at least 1 runes",
11585 }
11586 if !all {
11587 return err
11588 }
11589 errors = append(errors, err)
11590 }
11591
11592 if all {
11593 switch v := interface{}(m.GetExpectMatch()).(type) {
11594 case interface{ ValidateAll() error }:
11595 if err := v.ValidateAll(); err != nil {
11596 errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{
11597 field: "ExpectMatch",
11598 reason: "embedded message failed validation",
11599 cause: err,
11600 })
11601 }
11602 case interface{ Validate() error }:
11603 if err := v.Validate(); err != nil {
11604 errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{
11605 field: "ExpectMatch",
11606 reason: "embedded message failed validation",
11607 cause: err,
11608 })
11609 }
11610 }
11611 } else if v, ok := interface{}(m.GetExpectMatch()).(interface{ Validate() error }); ok {
11612 if err := v.Validate(); err != nil {
11613 return RateLimit_Action_HeaderValueMatchValidationError{
11614 field: "ExpectMatch",
11615 reason: "embedded message failed validation",
11616 cause: err,
11617 }
11618 }
11619 }
11620
11621 if len(m.GetHeaders()) < 1 {
11622 err := RateLimit_Action_HeaderValueMatchValidationError{
11623 field: "Headers",
11624 reason: "value must contain at least 1 item(s)",
11625 }
11626 if !all {
11627 return err
11628 }
11629 errors = append(errors, err)
11630 }
11631
11632 for idx, item := range m.GetHeaders() {
11633 _, _ = idx, item
11634
11635 if all {
11636 switch v := interface{}(item).(type) {
11637 case interface{ ValidateAll() error }:
11638 if err := v.ValidateAll(); err != nil {
11639 errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{
11640 field: fmt.Sprintf("Headers[%v]", idx),
11641 reason: "embedded message failed validation",
11642 cause: err,
11643 })
11644 }
11645 case interface{ Validate() error }:
11646 if err := v.Validate(); err != nil {
11647 errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{
11648 field: fmt.Sprintf("Headers[%v]", idx),
11649 reason: "embedded message failed validation",
11650 cause: err,
11651 })
11652 }
11653 }
11654 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
11655 if err := v.Validate(); err != nil {
11656 return RateLimit_Action_HeaderValueMatchValidationError{
11657 field: fmt.Sprintf("Headers[%v]", idx),
11658 reason: "embedded message failed validation",
11659 cause: err,
11660 }
11661 }
11662 }
11663
11664 }
11665
11666 if len(errors) > 0 {
11667 return RateLimit_Action_HeaderValueMatchMultiError(errors)
11668 }
11669
11670 return nil
11671 }
11672
11673 // RateLimit_Action_HeaderValueMatchMultiError is an error wrapping multiple
11674 // validation errors returned by
11675 // RateLimit_Action_HeaderValueMatch.ValidateAll() if the designated
11676 // constraints aren't met.
11677 type RateLimit_Action_HeaderValueMatchMultiError []error
11678
11679 // Error returns a concatenation of all the error messages it wraps.
11680 func (m RateLimit_Action_HeaderValueMatchMultiError) Error() string {
11681 var msgs []string
11682 for _, err := range m {
11683 msgs = append(msgs, err.Error())
11684 }
11685 return strings.Join(msgs, "; ")
11686 }
11687
11688 // AllErrors returns a list of validation violation errors.
11689 func (m RateLimit_Action_HeaderValueMatchMultiError) AllErrors() []error { return m }
11690
11691 // RateLimit_Action_HeaderValueMatchValidationError is the validation error
11692 // returned by RateLimit_Action_HeaderValueMatch.Validate if the designated
11693 // constraints aren't met.
11694 type RateLimit_Action_HeaderValueMatchValidationError struct {
11695 field string
11696 reason string
11697 cause error
11698 key bool
11699 }
11700
11701 // Field function returns field value.
11702 func (e RateLimit_Action_HeaderValueMatchValidationError) Field() string { return e.field }
11703
11704 // Reason function returns reason value.
11705 func (e RateLimit_Action_HeaderValueMatchValidationError) Reason() string { return e.reason }
11706
11707 // Cause function returns cause value.
11708 func (e RateLimit_Action_HeaderValueMatchValidationError) Cause() error { return e.cause }
11709
11710 // Key function returns key value.
11711 func (e RateLimit_Action_HeaderValueMatchValidationError) Key() bool { return e.key }
11712
11713 // ErrorName returns error name.
11714 func (e RateLimit_Action_HeaderValueMatchValidationError) ErrorName() string {
11715 return "RateLimit_Action_HeaderValueMatchValidationError"
11716 }
11717
11718 // Error satisfies the builtin error interface
11719 func (e RateLimit_Action_HeaderValueMatchValidationError) Error() string {
11720 cause := ""
11721 if e.cause != nil {
11722 cause = fmt.Sprintf(" | caused by: %v", e.cause)
11723 }
11724
11725 key := ""
11726 if e.key {
11727 key = "key for "
11728 }
11729
11730 return fmt.Sprintf(
11731 "invalid %sRateLimit_Action_HeaderValueMatch.%s: %s%s",
11732 key,
11733 e.field,
11734 e.reason,
11735 cause)
11736 }
11737
11738 var _ error = RateLimit_Action_HeaderValueMatchValidationError{}
11739
11740 var _ interface {
11741 Field() string
11742 Reason() string
11743 Key() bool
11744 Cause() error
11745 ErrorName() string
11746 } = RateLimit_Action_HeaderValueMatchValidationError{}
11747
11748 // Validate checks the field values on RateLimit_Action_DynamicMetaData with
11749 // the rules defined in the proto definition for this message. If any rules
11750 // are violated, the first error encountered is returned, or nil if there are
11751 // no violations.
11752 func (m *RateLimit_Action_DynamicMetaData) Validate() error {
11753 return m.validate(false)
11754 }
11755
11756 // ValidateAll checks the field values on RateLimit_Action_DynamicMetaData with
11757 // the rules defined in the proto definition for this message. If any rules
11758 // are violated, the result is a list of violation errors wrapped in
11759 // RateLimit_Action_DynamicMetaDataMultiError, or nil if none found.
11760 func (m *RateLimit_Action_DynamicMetaData) ValidateAll() error {
11761 return m.validate(true)
11762 }
11763
11764 func (m *RateLimit_Action_DynamicMetaData) validate(all bool) error {
11765 if m == nil {
11766 return nil
11767 }
11768
11769 var errors []error
11770
11771 if utf8.RuneCountInString(m.GetDescriptorKey()) < 1 {
11772 err := RateLimit_Action_DynamicMetaDataValidationError{
11773 field: "DescriptorKey",
11774 reason: "value length must be at least 1 runes",
11775 }
11776 if !all {
11777 return err
11778 }
11779 errors = append(errors, err)
11780 }
11781
11782 if m.GetMetadataKey() == nil {
11783 err := RateLimit_Action_DynamicMetaDataValidationError{
11784 field: "MetadataKey",
11785 reason: "value is required",
11786 }
11787 if !all {
11788 return err
11789 }
11790 errors = append(errors, err)
11791 }
11792
11793 if all {
11794 switch v := interface{}(m.GetMetadataKey()).(type) {
11795 case interface{ ValidateAll() error }:
11796 if err := v.ValidateAll(); err != nil {
11797 errors = append(errors, RateLimit_Action_DynamicMetaDataValidationError{
11798 field: "MetadataKey",
11799 reason: "embedded message failed validation",
11800 cause: err,
11801 })
11802 }
11803 case interface{ Validate() error }:
11804 if err := v.Validate(); err != nil {
11805 errors = append(errors, RateLimit_Action_DynamicMetaDataValidationError{
11806 field: "MetadataKey",
11807 reason: "embedded message failed validation",
11808 cause: err,
11809 })
11810 }
11811 }
11812 } else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok {
11813 if err := v.Validate(); err != nil {
11814 return RateLimit_Action_DynamicMetaDataValidationError{
11815 field: "MetadataKey",
11816 reason: "embedded message failed validation",
11817 cause: err,
11818 }
11819 }
11820 }
11821
11822 // no validation rules for DefaultValue
11823
11824 if len(errors) > 0 {
11825 return RateLimit_Action_DynamicMetaDataMultiError(errors)
11826 }
11827
11828 return nil
11829 }
11830
11831 // RateLimit_Action_DynamicMetaDataMultiError is an error wrapping multiple
11832 // validation errors returned by
11833 // RateLimit_Action_DynamicMetaData.ValidateAll() if the designated
11834 // constraints aren't met.
11835 type RateLimit_Action_DynamicMetaDataMultiError []error
11836
11837 // Error returns a concatenation of all the error messages it wraps.
11838 func (m RateLimit_Action_DynamicMetaDataMultiError) Error() string {
11839 var msgs []string
11840 for _, err := range m {
11841 msgs = append(msgs, err.Error())
11842 }
11843 return strings.Join(msgs, "; ")
11844 }
11845
11846 // AllErrors returns a list of validation violation errors.
11847 func (m RateLimit_Action_DynamicMetaDataMultiError) AllErrors() []error { return m }
11848
11849 // RateLimit_Action_DynamicMetaDataValidationError is the validation error
11850 // returned by RateLimit_Action_DynamicMetaData.Validate if the designated
11851 // constraints aren't met.
11852 type RateLimit_Action_DynamicMetaDataValidationError struct {
11853 field string
11854 reason string
11855 cause error
11856 key bool
11857 }
11858
11859 // Field function returns field value.
11860 func (e RateLimit_Action_DynamicMetaDataValidationError) Field() string { return e.field }
11861
11862 // Reason function returns reason value.
11863 func (e RateLimit_Action_DynamicMetaDataValidationError) Reason() string { return e.reason }
11864
11865 // Cause function returns cause value.
11866 func (e RateLimit_Action_DynamicMetaDataValidationError) Cause() error { return e.cause }
11867
11868 // Key function returns key value.
11869 func (e RateLimit_Action_DynamicMetaDataValidationError) Key() bool { return e.key }
11870
11871 // ErrorName returns error name.
11872 func (e RateLimit_Action_DynamicMetaDataValidationError) ErrorName() string {
11873 return "RateLimit_Action_DynamicMetaDataValidationError"
11874 }
11875
11876 // Error satisfies the builtin error interface
11877 func (e RateLimit_Action_DynamicMetaDataValidationError) Error() string {
11878 cause := ""
11879 if e.cause != nil {
11880 cause = fmt.Sprintf(" | caused by: %v", e.cause)
11881 }
11882
11883 key := ""
11884 if e.key {
11885 key = "key for "
11886 }
11887
11888 return fmt.Sprintf(
11889 "invalid %sRateLimit_Action_DynamicMetaData.%s: %s%s",
11890 key,
11891 e.field,
11892 e.reason,
11893 cause)
11894 }
11895
11896 var _ error = RateLimit_Action_DynamicMetaDataValidationError{}
11897
11898 var _ interface {
11899 Field() string
11900 Reason() string
11901 Key() bool
11902 Cause() error
11903 ErrorName() string
11904 } = RateLimit_Action_DynamicMetaDataValidationError{}
11905
11906 // Validate checks the field values on RateLimit_Action_MetaData with the rules
11907 // defined in the proto definition for this message. If any rules are
11908 // violated, the first error encountered is returned, or nil if there are no violations.
11909 func (m *RateLimit_Action_MetaData) Validate() error {
11910 return m.validate(false)
11911 }
11912
11913 // ValidateAll checks the field values on RateLimit_Action_MetaData with the
11914 // rules defined in the proto definition for this message. If any rules are
11915 // violated, the result is a list of violation errors wrapped in
11916 // RateLimit_Action_MetaDataMultiError, or nil if none found.
11917 func (m *RateLimit_Action_MetaData) ValidateAll() error {
11918 return m.validate(true)
11919 }
11920
11921 func (m *RateLimit_Action_MetaData) validate(all bool) error {
11922 if m == nil {
11923 return nil
11924 }
11925
11926 var errors []error
11927
11928 if utf8.RuneCountInString(m.GetDescriptorKey()) < 1 {
11929 err := RateLimit_Action_MetaDataValidationError{
11930 field: "DescriptorKey",
11931 reason: "value length must be at least 1 runes",
11932 }
11933 if !all {
11934 return err
11935 }
11936 errors = append(errors, err)
11937 }
11938
11939 if m.GetMetadataKey() == nil {
11940 err := RateLimit_Action_MetaDataValidationError{
11941 field: "MetadataKey",
11942 reason: "value is required",
11943 }
11944 if !all {
11945 return err
11946 }
11947 errors = append(errors, err)
11948 }
11949
11950 if all {
11951 switch v := interface{}(m.GetMetadataKey()).(type) {
11952 case interface{ ValidateAll() error }:
11953 if err := v.ValidateAll(); err != nil {
11954 errors = append(errors, RateLimit_Action_MetaDataValidationError{
11955 field: "MetadataKey",
11956 reason: "embedded message failed validation",
11957 cause: err,
11958 })
11959 }
11960 case interface{ Validate() error }:
11961 if err := v.Validate(); err != nil {
11962 errors = append(errors, RateLimit_Action_MetaDataValidationError{
11963 field: "MetadataKey",
11964 reason: "embedded message failed validation",
11965 cause: err,
11966 })
11967 }
11968 }
11969 } else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok {
11970 if err := v.Validate(); err != nil {
11971 return RateLimit_Action_MetaDataValidationError{
11972 field: "MetadataKey",
11973 reason: "embedded message failed validation",
11974 cause: err,
11975 }
11976 }
11977 }
11978
11979 // no validation rules for DefaultValue
11980
11981 if _, ok := RateLimit_Action_MetaData_Source_name[int32(m.GetSource())]; !ok {
11982 err := RateLimit_Action_MetaDataValidationError{
11983 field: "Source",
11984 reason: "value must be one of the defined enum values",
11985 }
11986 if !all {
11987 return err
11988 }
11989 errors = append(errors, err)
11990 }
11991
11992 // no validation rules for SkipIfAbsent
11993
11994 if len(errors) > 0 {
11995 return RateLimit_Action_MetaDataMultiError(errors)
11996 }
11997
11998 return nil
11999 }
12000
12001 // RateLimit_Action_MetaDataMultiError is an error wrapping multiple validation
12002 // errors returned by RateLimit_Action_MetaData.ValidateAll() if the
12003 // designated constraints aren't met.
12004 type RateLimit_Action_MetaDataMultiError []error
12005
12006 // Error returns a concatenation of all the error messages it wraps.
12007 func (m RateLimit_Action_MetaDataMultiError) Error() string {
12008 var msgs []string
12009 for _, err := range m {
12010 msgs = append(msgs, err.Error())
12011 }
12012 return strings.Join(msgs, "; ")
12013 }
12014
12015 // AllErrors returns a list of validation violation errors.
12016 func (m RateLimit_Action_MetaDataMultiError) AllErrors() []error { return m }
12017
12018 // RateLimit_Action_MetaDataValidationError is the validation error returned by
12019 // RateLimit_Action_MetaData.Validate if the designated constraints aren't met.
12020 type RateLimit_Action_MetaDataValidationError struct {
12021 field string
12022 reason string
12023 cause error
12024 key bool
12025 }
12026
12027 // Field function returns field value.
12028 func (e RateLimit_Action_MetaDataValidationError) Field() string { return e.field }
12029
12030 // Reason function returns reason value.
12031 func (e RateLimit_Action_MetaDataValidationError) Reason() string { return e.reason }
12032
12033 // Cause function returns cause value.
12034 func (e RateLimit_Action_MetaDataValidationError) Cause() error { return e.cause }
12035
12036 // Key function returns key value.
12037 func (e RateLimit_Action_MetaDataValidationError) Key() bool { return e.key }
12038
12039 // ErrorName returns error name.
12040 func (e RateLimit_Action_MetaDataValidationError) ErrorName() string {
12041 return "RateLimit_Action_MetaDataValidationError"
12042 }
12043
12044 // Error satisfies the builtin error interface
12045 func (e RateLimit_Action_MetaDataValidationError) Error() string {
12046 cause := ""
12047 if e.cause != nil {
12048 cause = fmt.Sprintf(" | caused by: %v", e.cause)
12049 }
12050
12051 key := ""
12052 if e.key {
12053 key = "key for "
12054 }
12055
12056 return fmt.Sprintf(
12057 "invalid %sRateLimit_Action_MetaData.%s: %s%s",
12058 key,
12059 e.field,
12060 e.reason,
12061 cause)
12062 }
12063
12064 var _ error = RateLimit_Action_MetaDataValidationError{}
12065
12066 var _ interface {
12067 Field() string
12068 Reason() string
12069 Key() bool
12070 Cause() error
12071 ErrorName() string
12072 } = RateLimit_Action_MetaDataValidationError{}
12073
12074 // Validate checks the field values on
12075 // RateLimit_Action_QueryParameterValueMatch with the rules defined in the
12076 // proto definition for this message. If any rules are violated, the first
12077 // error encountered is returned, or nil if there are no violations.
12078 func (m *RateLimit_Action_QueryParameterValueMatch) Validate() error {
12079 return m.validate(false)
12080 }
12081
12082 // ValidateAll checks the field values on
12083 // RateLimit_Action_QueryParameterValueMatch with the rules defined in the
12084 // proto definition for this message. If any rules are violated, the result is
12085 // a list of violation errors wrapped in
12086 // RateLimit_Action_QueryParameterValueMatchMultiError, or nil if none found.
12087 func (m *RateLimit_Action_QueryParameterValueMatch) ValidateAll() error {
12088 return m.validate(true)
12089 }
12090
12091 func (m *RateLimit_Action_QueryParameterValueMatch) validate(all bool) error {
12092 if m == nil {
12093 return nil
12094 }
12095
12096 var errors []error
12097
12098 // no validation rules for DescriptorKey
12099
12100 if utf8.RuneCountInString(m.GetDescriptorValue()) < 1 {
12101 err := RateLimit_Action_QueryParameterValueMatchValidationError{
12102 field: "DescriptorValue",
12103 reason: "value length must be at least 1 runes",
12104 }
12105 if !all {
12106 return err
12107 }
12108 errors = append(errors, err)
12109 }
12110
12111 if all {
12112 switch v := interface{}(m.GetExpectMatch()).(type) {
12113 case interface{ ValidateAll() error }:
12114 if err := v.ValidateAll(); err != nil {
12115 errors = append(errors, RateLimit_Action_QueryParameterValueMatchValidationError{
12116 field: "ExpectMatch",
12117 reason: "embedded message failed validation",
12118 cause: err,
12119 })
12120 }
12121 case interface{ Validate() error }:
12122 if err := v.Validate(); err != nil {
12123 errors = append(errors, RateLimit_Action_QueryParameterValueMatchValidationError{
12124 field: "ExpectMatch",
12125 reason: "embedded message failed validation",
12126 cause: err,
12127 })
12128 }
12129 }
12130 } else if v, ok := interface{}(m.GetExpectMatch()).(interface{ Validate() error }); ok {
12131 if err := v.Validate(); err != nil {
12132 return RateLimit_Action_QueryParameterValueMatchValidationError{
12133 field: "ExpectMatch",
12134 reason: "embedded message failed validation",
12135 cause: err,
12136 }
12137 }
12138 }
12139
12140 if len(m.GetQueryParameters()) < 1 {
12141 err := RateLimit_Action_QueryParameterValueMatchValidationError{
12142 field: "QueryParameters",
12143 reason: "value must contain at least 1 item(s)",
12144 }
12145 if !all {
12146 return err
12147 }
12148 errors = append(errors, err)
12149 }
12150
12151 for idx, item := range m.GetQueryParameters() {
12152 _, _ = idx, item
12153
12154 if all {
12155 switch v := interface{}(item).(type) {
12156 case interface{ ValidateAll() error }:
12157 if err := v.ValidateAll(); err != nil {
12158 errors = append(errors, RateLimit_Action_QueryParameterValueMatchValidationError{
12159 field: fmt.Sprintf("QueryParameters[%v]", idx),
12160 reason: "embedded message failed validation",
12161 cause: err,
12162 })
12163 }
12164 case interface{ Validate() error }:
12165 if err := v.Validate(); err != nil {
12166 errors = append(errors, RateLimit_Action_QueryParameterValueMatchValidationError{
12167 field: fmt.Sprintf("QueryParameters[%v]", idx),
12168 reason: "embedded message failed validation",
12169 cause: err,
12170 })
12171 }
12172 }
12173 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
12174 if err := v.Validate(); err != nil {
12175 return RateLimit_Action_QueryParameterValueMatchValidationError{
12176 field: fmt.Sprintf("QueryParameters[%v]", idx),
12177 reason: "embedded message failed validation",
12178 cause: err,
12179 }
12180 }
12181 }
12182
12183 }
12184
12185 if len(errors) > 0 {
12186 return RateLimit_Action_QueryParameterValueMatchMultiError(errors)
12187 }
12188
12189 return nil
12190 }
12191
12192 // RateLimit_Action_QueryParameterValueMatchMultiError is an error wrapping
12193 // multiple validation errors returned by
12194 // RateLimit_Action_QueryParameterValueMatch.ValidateAll() if the designated
12195 // constraints aren't met.
12196 type RateLimit_Action_QueryParameterValueMatchMultiError []error
12197
12198 // Error returns a concatenation of all the error messages it wraps.
12199 func (m RateLimit_Action_QueryParameterValueMatchMultiError) Error() string {
12200 var msgs []string
12201 for _, err := range m {
12202 msgs = append(msgs, err.Error())
12203 }
12204 return strings.Join(msgs, "; ")
12205 }
12206
12207 // AllErrors returns a list of validation violation errors.
12208 func (m RateLimit_Action_QueryParameterValueMatchMultiError) AllErrors() []error { return m }
12209
12210 // RateLimit_Action_QueryParameterValueMatchValidationError is the validation
12211 // error returned by RateLimit_Action_QueryParameterValueMatch.Validate if the
12212 // designated constraints aren't met.
12213 type RateLimit_Action_QueryParameterValueMatchValidationError struct {
12214 field string
12215 reason string
12216 cause error
12217 key bool
12218 }
12219
12220 // Field function returns field value.
12221 func (e RateLimit_Action_QueryParameterValueMatchValidationError) Field() string { return e.field }
12222
12223 // Reason function returns reason value.
12224 func (e RateLimit_Action_QueryParameterValueMatchValidationError) Reason() string { return e.reason }
12225
12226 // Cause function returns cause value.
12227 func (e RateLimit_Action_QueryParameterValueMatchValidationError) Cause() error { return e.cause }
12228
12229 // Key function returns key value.
12230 func (e RateLimit_Action_QueryParameterValueMatchValidationError) Key() bool { return e.key }
12231
12232 // ErrorName returns error name.
12233 func (e RateLimit_Action_QueryParameterValueMatchValidationError) ErrorName() string {
12234 return "RateLimit_Action_QueryParameterValueMatchValidationError"
12235 }
12236
12237 // Error satisfies the builtin error interface
12238 func (e RateLimit_Action_QueryParameterValueMatchValidationError) Error() string {
12239 cause := ""
12240 if e.cause != nil {
12241 cause = fmt.Sprintf(" | caused by: %v", e.cause)
12242 }
12243
12244 key := ""
12245 if e.key {
12246 key = "key for "
12247 }
12248
12249 return fmt.Sprintf(
12250 "invalid %sRateLimit_Action_QueryParameterValueMatch.%s: %s%s",
12251 key,
12252 e.field,
12253 e.reason,
12254 cause)
12255 }
12256
12257 var _ error = RateLimit_Action_QueryParameterValueMatchValidationError{}
12258
12259 var _ interface {
12260 Field() string
12261 Reason() string
12262 Key() bool
12263 Cause() error
12264 ErrorName() string
12265 } = RateLimit_Action_QueryParameterValueMatchValidationError{}
12266
12267 // Validate checks the field values on RateLimit_Override_DynamicMetadata with
12268 // the rules defined in the proto definition for this message. If any rules
12269 // are violated, the first error encountered is returned, or nil if there are
12270 // no violations.
12271 func (m *RateLimit_Override_DynamicMetadata) Validate() error {
12272 return m.validate(false)
12273 }
12274
12275 // ValidateAll checks the field values on RateLimit_Override_DynamicMetadata
12276 // with the rules defined in the proto definition for this message. If any
12277 // rules are violated, the result is a list of violation errors wrapped in
12278 // RateLimit_Override_DynamicMetadataMultiError, or nil if none found.
12279 func (m *RateLimit_Override_DynamicMetadata) ValidateAll() error {
12280 return m.validate(true)
12281 }
12282
12283 func (m *RateLimit_Override_DynamicMetadata) validate(all bool) error {
12284 if m == nil {
12285 return nil
12286 }
12287
12288 var errors []error
12289
12290 if m.GetMetadataKey() == nil {
12291 err := RateLimit_Override_DynamicMetadataValidationError{
12292 field: "MetadataKey",
12293 reason: "value is required",
12294 }
12295 if !all {
12296 return err
12297 }
12298 errors = append(errors, err)
12299 }
12300
12301 if all {
12302 switch v := interface{}(m.GetMetadataKey()).(type) {
12303 case interface{ ValidateAll() error }:
12304 if err := v.ValidateAll(); err != nil {
12305 errors = append(errors, RateLimit_Override_DynamicMetadataValidationError{
12306 field: "MetadataKey",
12307 reason: "embedded message failed validation",
12308 cause: err,
12309 })
12310 }
12311 case interface{ Validate() error }:
12312 if err := v.Validate(); err != nil {
12313 errors = append(errors, RateLimit_Override_DynamicMetadataValidationError{
12314 field: "MetadataKey",
12315 reason: "embedded message failed validation",
12316 cause: err,
12317 })
12318 }
12319 }
12320 } else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok {
12321 if err := v.Validate(); err != nil {
12322 return RateLimit_Override_DynamicMetadataValidationError{
12323 field: "MetadataKey",
12324 reason: "embedded message failed validation",
12325 cause: err,
12326 }
12327 }
12328 }
12329
12330 if len(errors) > 0 {
12331 return RateLimit_Override_DynamicMetadataMultiError(errors)
12332 }
12333
12334 return nil
12335 }
12336
12337 // RateLimit_Override_DynamicMetadataMultiError is an error wrapping multiple
12338 // validation errors returned by
12339 // RateLimit_Override_DynamicMetadata.ValidateAll() if the designated
12340 // constraints aren't met.
12341 type RateLimit_Override_DynamicMetadataMultiError []error
12342
12343 // Error returns a concatenation of all the error messages it wraps.
12344 func (m RateLimit_Override_DynamicMetadataMultiError) Error() string {
12345 var msgs []string
12346 for _, err := range m {
12347 msgs = append(msgs, err.Error())
12348 }
12349 return strings.Join(msgs, "; ")
12350 }
12351
12352 // AllErrors returns a list of validation violation errors.
12353 func (m RateLimit_Override_DynamicMetadataMultiError) AllErrors() []error { return m }
12354
12355 // RateLimit_Override_DynamicMetadataValidationError is the validation error
12356 // returned by RateLimit_Override_DynamicMetadata.Validate if the designated
12357 // constraints aren't met.
12358 type RateLimit_Override_DynamicMetadataValidationError struct {
12359 field string
12360 reason string
12361 cause error
12362 key bool
12363 }
12364
12365 // Field function returns field value.
12366 func (e RateLimit_Override_DynamicMetadataValidationError) Field() string { return e.field }
12367
12368 // Reason function returns reason value.
12369 func (e RateLimit_Override_DynamicMetadataValidationError) Reason() string { return e.reason }
12370
12371 // Cause function returns cause value.
12372 func (e RateLimit_Override_DynamicMetadataValidationError) Cause() error { return e.cause }
12373
12374 // Key function returns key value.
12375 func (e RateLimit_Override_DynamicMetadataValidationError) Key() bool { return e.key }
12376
12377 // ErrorName returns error name.
12378 func (e RateLimit_Override_DynamicMetadataValidationError) ErrorName() string {
12379 return "RateLimit_Override_DynamicMetadataValidationError"
12380 }
12381
12382 // Error satisfies the builtin error interface
12383 func (e RateLimit_Override_DynamicMetadataValidationError) Error() string {
12384 cause := ""
12385 if e.cause != nil {
12386 cause = fmt.Sprintf(" | caused by: %v", e.cause)
12387 }
12388
12389 key := ""
12390 if e.key {
12391 key = "key for "
12392 }
12393
12394 return fmt.Sprintf(
12395 "invalid %sRateLimit_Override_DynamicMetadata.%s: %s%s",
12396 key,
12397 e.field,
12398 e.reason,
12399 cause)
12400 }
12401
12402 var _ error = RateLimit_Override_DynamicMetadataValidationError{}
12403
12404 var _ interface {
12405 Field() string
12406 Reason() string
12407 Key() bool
12408 Cause() error
12409 ErrorName() string
12410 } = RateLimit_Override_DynamicMetadataValidationError{}