Debian Codegraph @

envoy/extensions/upstreams/http/v3/http_protocol_options.pb.validate.go

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