Debian Codegraph @

envoy/config/core/v3/protocol.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/config/core/v3/protocol.proto
4
5 package corev3
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 TcpProtocolOptions 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 *TcpProtocolOptions) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on TcpProtocolOptions 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 // TcpProtocolOptionsMultiError, or nil if none found.
50 func (m *TcpProtocolOptions) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *TcpProtocolOptions) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 if len(errors) > 0 {
62 return TcpProtocolOptionsMultiError(errors)
63 }
64
65 return nil
66 }
67
68 // TcpProtocolOptionsMultiError is an error wrapping multiple validation errors
69 // returned by TcpProtocolOptions.ValidateAll() if the designated constraints
70 // aren't met.
71 type TcpProtocolOptionsMultiError []error
72
73 // Error returns a concatenation of all the error messages it wraps.
74 func (m TcpProtocolOptionsMultiError) Error() string {
75 var msgs []string
76 for _, err := range m {
77 msgs = append(msgs, err.Error())
78 }
79 return strings.Join(msgs, "; ")
80 }
81
82 // AllErrors returns a list of validation violation errors.
83 func (m TcpProtocolOptionsMultiError) AllErrors() []error { return m }
84
85 // TcpProtocolOptionsValidationError is the validation error returned by
86 // TcpProtocolOptions.Validate if the designated constraints aren't met.
87 type TcpProtocolOptionsValidationError struct {
88 field string
89 reason string
90 cause error
91 key bool
92 }
93
94 // Field function returns field value.
95 func (e TcpProtocolOptionsValidationError) Field() string { return e.field }
96
97 // Reason function returns reason value.
98 func (e TcpProtocolOptionsValidationError) Reason() string { return e.reason }
99
100 // Cause function returns cause value.
101 func (e TcpProtocolOptionsValidationError) Cause() error { return e.cause }
102
103 // Key function returns key value.
104 func (e TcpProtocolOptionsValidationError) Key() bool { return e.key }
105
106 // ErrorName returns error name.
107 func (e TcpProtocolOptionsValidationError) ErrorName() string {
108 return "TcpProtocolOptionsValidationError"
109 }
110
111 // Error satisfies the builtin error interface
112 func (e TcpProtocolOptionsValidationError) Error() string {
113 cause := ""
114 if e.cause != nil {
115 cause = fmt.Sprintf(" | caused by: %v", e.cause)
116 }
117
118 key := ""
119 if e.key {
120 key = "key for "
121 }
122
123 return fmt.Sprintf(
124 "invalid %sTcpProtocolOptions.%s: %s%s",
125 key,
126 e.field,
127 e.reason,
128 cause)
129 }
130
131 var _ error = TcpProtocolOptionsValidationError{}
132
133 var _ interface {
134 Field() string
135 Reason() string
136 Key() bool
137 Cause() error
138 ErrorName() string
139 } = TcpProtocolOptionsValidationError{}
140
141 // Validate checks the field values on QuicKeepAliveSettings with the rules
142 // defined in the proto definition for this message. If any rules are
143 // violated, the first error encountered is returned, or nil if there are no violations.
144 func (m *QuicKeepAliveSettings) Validate() error {
145 return m.validate(false)
146 }
147
148 // ValidateAll checks the field values on QuicKeepAliveSettings with the rules
149 // defined in the proto definition for this message. If any rules are
150 // violated, the result is a list of violation errors wrapped in
151 // QuicKeepAliveSettingsMultiError, or nil if none found.
152 func (m *QuicKeepAliveSettings) ValidateAll() error {
153 return m.validate(true)
154 }
155
156 func (m *QuicKeepAliveSettings) validate(all bool) error {
157 if m == nil {
158 return nil
159 }
160
161 var errors []error
162
163 if all {
164 switch v := interface{}(m.GetMaxInterval()).(type) {
165 case interface{ ValidateAll() error }:
166 if err := v.ValidateAll(); err != nil {
167 errors = append(errors, QuicKeepAliveSettingsValidationError{
168 field: "MaxInterval",
169 reason: "embedded message failed validation",
170 cause: err,
171 })
172 }
173 case interface{ Validate() error }:
174 if err := v.Validate(); err != nil {
175 errors = append(errors, QuicKeepAliveSettingsValidationError{
176 field: "MaxInterval",
177 reason: "embedded message failed validation",
178 cause: err,
179 })
180 }
181 }
182 } else if v, ok := interface{}(m.GetMaxInterval()).(interface{ Validate() error }); ok {
183 if err := v.Validate(); err != nil {
184 return QuicKeepAliveSettingsValidationError{
185 field: "MaxInterval",
186 reason: "embedded message failed validation",
187 cause: err,
188 }
189 }
190 }
191
192 if d := m.GetInitialInterval(); d != nil {
193 dur, err := d.AsDuration(), d.CheckValid()
194 if err != nil {
195 err = QuicKeepAliveSettingsValidationError{
196 field: "InitialInterval",
197 reason: "value is not a valid duration",
198 cause: err,
199 }
200 if !all {
201 return err
202 }
203 errors = append(errors, err)
204 } else {
205
206 lte := time.Duration(0*time.Second + 0*time.Nanosecond)
207 gte := time.Duration(0*time.Second + 1000000*time.Nanosecond)
208
209 if dur > lte && dur < gte {
210 err := QuicKeepAliveSettingsValidationError{
211 field: "InitialInterval",
212 reason: "value must be outside range (0s, 1ms)",
213 }
214 if !all {
215 return err
216 }
217 errors = append(errors, err)
218 }
219
220 }
221 }
222
223 if len(errors) > 0 {
224 return QuicKeepAliveSettingsMultiError(errors)
225 }
226
227 return nil
228 }
229
230 // QuicKeepAliveSettingsMultiError is an error wrapping multiple validation
231 // errors returned by QuicKeepAliveSettings.ValidateAll() if the designated
232 // constraints aren't met.
233 type QuicKeepAliveSettingsMultiError []error
234
235 // Error returns a concatenation of all the error messages it wraps.
236 func (m QuicKeepAliveSettingsMultiError) Error() string {
237 var msgs []string
238 for _, err := range m {
239 msgs = append(msgs, err.Error())
240 }
241 return strings.Join(msgs, "; ")
242 }
243
244 // AllErrors returns a list of validation violation errors.
245 func (m QuicKeepAliveSettingsMultiError) AllErrors() []error { return m }
246
247 // QuicKeepAliveSettingsValidationError is the validation error returned by
248 // QuicKeepAliveSettings.Validate if the designated constraints aren't met.
249 type QuicKeepAliveSettingsValidationError struct {
250 field string
251 reason string
252 cause error
253 key bool
254 }
255
256 // Field function returns field value.
257 func (e QuicKeepAliveSettingsValidationError) Field() string { return e.field }
258
259 // Reason function returns reason value.
260 func (e QuicKeepAliveSettingsValidationError) Reason() string { return e.reason }
261
262 // Cause function returns cause value.
263 func (e QuicKeepAliveSettingsValidationError) Cause() error { return e.cause }
264
265 // Key function returns key value.
266 func (e QuicKeepAliveSettingsValidationError) Key() bool { return e.key }
267
268 // ErrorName returns error name.
269 func (e QuicKeepAliveSettingsValidationError) ErrorName() string {
270 return "QuicKeepAliveSettingsValidationError"
271 }
272
273 // Error satisfies the builtin error interface
274 func (e QuicKeepAliveSettingsValidationError) Error() string {
275 cause := ""
276 if e.cause != nil {
277 cause = fmt.Sprintf(" | caused by: %v", e.cause)
278 }
279
280 key := ""
281 if e.key {
282 key = "key for "
283 }
284
285 return fmt.Sprintf(
286 "invalid %sQuicKeepAliveSettings.%s: %s%s",
287 key,
288 e.field,
289 e.reason,
290 cause)
291 }
292
293 var _ error = QuicKeepAliveSettingsValidationError{}
294
295 var _ interface {
296 Field() string
297 Reason() string
298 Key() bool
299 Cause() error
300 ErrorName() string
301 } = QuicKeepAliveSettingsValidationError{}
302
303 // Validate checks the field values on QuicProtocolOptions with the rules
304 // defined in the proto definition for this message. If any rules are
305 // violated, the first error encountered is returned, or nil if there are no violations.
306 func (m *QuicProtocolOptions) Validate() error {
307 return m.validate(false)
308 }
309
310 // ValidateAll checks the field values on QuicProtocolOptions with the rules
311 // defined in the proto definition for this message. If any rules are
312 // violated, the result is a list of violation errors wrapped in
313 // QuicProtocolOptionsMultiError, or nil if none found.
314 func (m *QuicProtocolOptions) ValidateAll() error {
315 return m.validate(true)
316 }
317
318 func (m *QuicProtocolOptions) validate(all bool) error {
319 if m == nil {
320 return nil
321 }
322
323 var errors []error
324
325 if wrapper := m.GetMaxConcurrentStreams(); wrapper != nil {
326
327 if wrapper.GetValue() < 1 {
328 err := QuicProtocolOptionsValidationError{
329 field: "MaxConcurrentStreams",
330 reason: "value must be greater than or equal to 1",
331 }
332 if !all {
333 return err
334 }
335 errors = append(errors, err)
336 }
337
338 }
339
340 if wrapper := m.GetInitialStreamWindowSize(); wrapper != nil {
341
342 if val := wrapper.GetValue(); val < 1 || val > 16777216 {
343 err := QuicProtocolOptionsValidationError{
344 field: "InitialStreamWindowSize",
345 reason: "value must be inside range [1, 16777216]",
346 }
347 if !all {
348 return err
349 }
350 errors = append(errors, err)
351 }
352
353 }
354
355 if wrapper := m.GetInitialConnectionWindowSize(); wrapper != nil {
356
357 if val := wrapper.GetValue(); val < 1 || val > 25165824 {
358 err := QuicProtocolOptionsValidationError{
359 field: "InitialConnectionWindowSize",
360 reason: "value must be inside range [1, 25165824]",
361 }
362 if !all {
363 return err
364 }
365 errors = append(errors, err)
366 }
367
368 }
369
370 if wrapper := m.GetNumTimeoutsToTriggerPortMigration(); wrapper != nil {
371
372 if val := wrapper.GetValue(); val < 0 || val > 5 {
373 err := QuicProtocolOptionsValidationError{
374 field: "NumTimeoutsToTriggerPortMigration",
375 reason: "value must be inside range [0, 5]",
376 }
377 if !all {
378 return err
379 }
380 errors = append(errors, err)
381 }
382
383 }
384
385 if all {
386 switch v := interface{}(m.GetConnectionKeepalive()).(type) {
387 case interface{ ValidateAll() error }:
388 if err := v.ValidateAll(); err != nil {
389 errors = append(errors, QuicProtocolOptionsValidationError{
390 field: "ConnectionKeepalive",
391 reason: "embedded message failed validation",
392 cause: err,
393 })
394 }
395 case interface{ Validate() error }:
396 if err := v.Validate(); err != nil {
397 errors = append(errors, QuicProtocolOptionsValidationError{
398 field: "ConnectionKeepalive",
399 reason: "embedded message failed validation",
400 cause: err,
401 })
402 }
403 }
404 } else if v, ok := interface{}(m.GetConnectionKeepalive()).(interface{ Validate() error }); ok {
405 if err := v.Validate(); err != nil {
406 return QuicProtocolOptionsValidationError{
407 field: "ConnectionKeepalive",
408 reason: "embedded message failed validation",
409 cause: err,
410 }
411 }
412 }
413
414 // no validation rules for ConnectionOptions
415
416 // no validation rules for ClientConnectionOptions
417
418 if d := m.GetIdleNetworkTimeout(); d != nil {
419 dur, err := d.AsDuration(), d.CheckValid()
420 if err != nil {
421 err = QuicProtocolOptionsValidationError{
422 field: "IdleNetworkTimeout",
423 reason: "value is not a valid duration",
424 cause: err,
425 }
426 if !all {
427 return err
428 }
429 errors = append(errors, err)
430 } else {
431
432 lte := time.Duration(600*time.Second + 0*time.Nanosecond)
433 gte := time.Duration(1*time.Second + 0*time.Nanosecond)
434
435 if dur < gte || dur > lte {
436 err := QuicProtocolOptionsValidationError{
437 field: "IdleNetworkTimeout",
438 reason: "value must be inside range [1s, 10m0s]",
439 }
440 if !all {
441 return err
442 }
443 errors = append(errors, err)
444 }
445
446 }
447 }
448
449 if all {
450 switch v := interface{}(m.GetMaxPacketLength()).(type) {
451 case interface{ ValidateAll() error }:
452 if err := v.ValidateAll(); err != nil {
453 errors = append(errors, QuicProtocolOptionsValidationError{
454 field: "MaxPacketLength",
455 reason: "embedded message failed validation",
456 cause: err,
457 })
458 }
459 case interface{ Validate() error }:
460 if err := v.Validate(); err != nil {
461 errors = append(errors, QuicProtocolOptionsValidationError{
462 field: "MaxPacketLength",
463 reason: "embedded message failed validation",
464 cause: err,
465 })
466 }
467 }
468 } else if v, ok := interface{}(m.GetMaxPacketLength()).(interface{ Validate() error }); ok {
469 if err := v.Validate(); err != nil {
470 return QuicProtocolOptionsValidationError{
471 field: "MaxPacketLength",
472 reason: "embedded message failed validation",
473 cause: err,
474 }
475 }
476 }
477
478 if len(errors) > 0 {
479 return QuicProtocolOptionsMultiError(errors)
480 }
481
482 return nil
483 }
484
485 // QuicProtocolOptionsMultiError is an error wrapping multiple validation
486 // errors returned by QuicProtocolOptions.ValidateAll() if the designated
487 // constraints aren't met.
488 type QuicProtocolOptionsMultiError []error
489
490 // Error returns a concatenation of all the error messages it wraps.
491 func (m QuicProtocolOptionsMultiError) Error() string {
492 var msgs []string
493 for _, err := range m {
494 msgs = append(msgs, err.Error())
495 }
496 return strings.Join(msgs, "; ")
497 }
498
499 // AllErrors returns a list of validation violation errors.
500 func (m QuicProtocolOptionsMultiError) AllErrors() []error { return m }
501
502 // QuicProtocolOptionsValidationError is the validation error returned by
503 // QuicProtocolOptions.Validate if the designated constraints aren't met.
504 type QuicProtocolOptionsValidationError struct {
505 field string
506 reason string
507 cause error
508 key bool
509 }
510
511 // Field function returns field value.
512 func (e QuicProtocolOptionsValidationError) Field() string { return e.field }
513
514 // Reason function returns reason value.
515 func (e QuicProtocolOptionsValidationError) Reason() string { return e.reason }
516
517 // Cause function returns cause value.
518 func (e QuicProtocolOptionsValidationError) Cause() error { return e.cause }
519
520 // Key function returns key value.
521 func (e QuicProtocolOptionsValidationError) Key() bool { return e.key }
522
523 // ErrorName returns error name.
524 func (e QuicProtocolOptionsValidationError) ErrorName() string {
525 return "QuicProtocolOptionsValidationError"
526 }
527
528 // Error satisfies the builtin error interface
529 func (e QuicProtocolOptionsValidationError) Error() string {
530 cause := ""
531 if e.cause != nil {
532 cause = fmt.Sprintf(" | caused by: %v", e.cause)
533 }
534
535 key := ""
536 if e.key {
537 key = "key for "
538 }
539
540 return fmt.Sprintf(
541 "invalid %sQuicProtocolOptions.%s: %s%s",
542 key,
543 e.field,
544 e.reason,
545 cause)
546 }
547
548 var _ error = QuicProtocolOptionsValidationError{}
549
550 var _ interface {
551 Field() string
552 Reason() string
553 Key() bool
554 Cause() error
555 ErrorName() string
556 } = QuicProtocolOptionsValidationError{}
557
558 // Validate checks the field values on UpstreamHttpProtocolOptions with the
559 // rules defined in the proto definition for this message. If any rules are
560 // violated, the first error encountered is returned, or nil if there are no violations.
561 func (m *UpstreamHttpProtocolOptions) Validate() error {
562 return m.validate(false)
563 }
564
565 // ValidateAll checks the field values on UpstreamHttpProtocolOptions with the
566 // rules defined in the proto definition for this message. If any rules are
567 // violated, the result is a list of violation errors wrapped in
568 // UpstreamHttpProtocolOptionsMultiError, or nil if none found.
569 func (m *UpstreamHttpProtocolOptions) ValidateAll() error {
570 return m.validate(true)
571 }
572
573 func (m *UpstreamHttpProtocolOptions) validate(all bool) error {
574 if m == nil {
575 return nil
576 }
577
578 var errors []error
579
580 // no validation rules for AutoSni
581
582 // no validation rules for AutoSanValidation
583
584 if m.GetOverrideAutoSniHeader() != "" {
585
586 if !_UpstreamHttpProtocolOptions_OverrideAutoSniHeader_Pattern.MatchString(m.GetOverrideAutoSniHeader()) {
587 err := UpstreamHttpProtocolOptionsValidationError{
588 field: "OverrideAutoSniHeader",
589 reason: "value does not match regex pattern \"^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$\"",
590 }
591 if !all {
592 return err
593 }
594 errors = append(errors, err)
595 }
596
597 }
598
599 if len(errors) > 0 {
600 return UpstreamHttpProtocolOptionsMultiError(errors)
601 }
602
603 return nil
604 }
605
606 // UpstreamHttpProtocolOptionsMultiError is an error wrapping multiple
607 // validation errors returned by UpstreamHttpProtocolOptions.ValidateAll() if
608 // the designated constraints aren't met.
609 type UpstreamHttpProtocolOptionsMultiError []error
610
611 // Error returns a concatenation of all the error messages it wraps.
612 func (m UpstreamHttpProtocolOptionsMultiError) Error() string {
613 var msgs []string
614 for _, err := range m {
615 msgs = append(msgs, err.Error())
616 }
617 return strings.Join(msgs, "; ")
618 }
619
620 // AllErrors returns a list of validation violation errors.
621 func (m UpstreamHttpProtocolOptionsMultiError) AllErrors() []error { return m }
622
623 // UpstreamHttpProtocolOptionsValidationError is the validation error returned
624 // by UpstreamHttpProtocolOptions.Validate if the designated constraints
625 // aren't met.
626 type UpstreamHttpProtocolOptionsValidationError struct {
627 field string
628 reason string
629 cause error
630 key bool
631 }
632
633 // Field function returns field value.
634 func (e UpstreamHttpProtocolOptionsValidationError) Field() string { return e.field }
635
636 // Reason function returns reason value.
637 func (e UpstreamHttpProtocolOptionsValidationError) Reason() string { return e.reason }
638
639 // Cause function returns cause value.
640 func (e UpstreamHttpProtocolOptionsValidationError) Cause() error { return e.cause }
641
642 // Key function returns key value.
643 func (e UpstreamHttpProtocolOptionsValidationError) Key() bool { return e.key }
644
645 // ErrorName returns error name.
646 func (e UpstreamHttpProtocolOptionsValidationError) ErrorName() string {
647 return "UpstreamHttpProtocolOptionsValidationError"
648 }
649
650 // Error satisfies the builtin error interface
651 func (e UpstreamHttpProtocolOptionsValidationError) Error() string {
652 cause := ""
653 if e.cause != nil {
654 cause = fmt.Sprintf(" | caused by: %v", e.cause)
655 }
656
657 key := ""
658 if e.key {
659 key = "key for "
660 }
661
662 return fmt.Sprintf(
663 "invalid %sUpstreamHttpProtocolOptions.%s: %s%s",
664 key,
665 e.field,
666 e.reason,
667 cause)
668 }
669
670 var _ error = UpstreamHttpProtocolOptionsValidationError{}
671
672 var _ interface {
673 Field() string
674 Reason() string
675 Key() bool
676 Cause() error
677 ErrorName() string
678 } = UpstreamHttpProtocolOptionsValidationError{}
679
680 var _UpstreamHttpProtocolOptions_OverrideAutoSniHeader_Pattern = regexp.MustCompile("^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$")
681
682 // Validate checks the field values on AlternateProtocolsCacheOptions with the
683 // rules defined in the proto definition for this message. If any rules are
684 // violated, the first error encountered is returned, or nil if there are no violations.
685 func (m *AlternateProtocolsCacheOptions) Validate() error {
686 return m.validate(false)
687 }
688
689 // ValidateAll checks the field values on AlternateProtocolsCacheOptions with
690 // the rules defined in the proto definition for this message. If any rules
691 // are violated, the result is a list of violation errors wrapped in
692 // AlternateProtocolsCacheOptionsMultiError, or nil if none found.
693 func (m *AlternateProtocolsCacheOptions) ValidateAll() error {
694 return m.validate(true)
695 }
696
697 func (m *AlternateProtocolsCacheOptions) validate(all bool) error {
698 if m == nil {
699 return nil
700 }
701
702 var errors []error
703
704 if utf8.RuneCountInString(m.GetName()) < 1 {
705 err := AlternateProtocolsCacheOptionsValidationError{
706 field: "Name",
707 reason: "value length must be at least 1 runes",
708 }
709 if !all {
710 return err
711 }
712 errors = append(errors, err)
713 }
714
715 if wrapper := m.GetMaxEntries(); wrapper != nil {
716
717 if wrapper.GetValue() <= 0 {
718 err := AlternateProtocolsCacheOptionsValidationError{
719 field: "MaxEntries",
720 reason: "value must be greater than 0",
721 }
722 if !all {
723 return err
724 }
725 errors = append(errors, err)
726 }
727
728 }
729
730 if all {
731 switch v := interface{}(m.GetKeyValueStoreConfig()).(type) {
732 case interface{ ValidateAll() error }:
733 if err := v.ValidateAll(); err != nil {
734 errors = append(errors, AlternateProtocolsCacheOptionsValidationError{
735 field: "KeyValueStoreConfig",
736 reason: "embedded message failed validation",
737 cause: err,
738 })
739 }
740 case interface{ Validate() error }:
741 if err := v.Validate(); err != nil {
742 errors = append(errors, AlternateProtocolsCacheOptionsValidationError{
743 field: "KeyValueStoreConfig",
744 reason: "embedded message failed validation",
745 cause: err,
746 })
747 }
748 }
749 } else if v, ok := interface{}(m.GetKeyValueStoreConfig()).(interface{ Validate() error }); ok {
750 if err := v.Validate(); err != nil {
751 return AlternateProtocolsCacheOptionsValidationError{
752 field: "KeyValueStoreConfig",
753 reason: "embedded message failed validation",
754 cause: err,
755 }
756 }
757 }
758
759 for idx, item := range m.GetPrepopulatedEntries() {
760 _, _ = idx, item
761
762 if all {
763 switch v := interface{}(item).(type) {
764 case interface{ ValidateAll() error }:
765 if err := v.ValidateAll(); err != nil {
766 errors = append(errors, AlternateProtocolsCacheOptionsValidationError{
767 field: fmt.Sprintf("PrepopulatedEntries[%v]", idx),
768 reason: "embedded message failed validation",
769 cause: err,
770 })
771 }
772 case interface{ Validate() error }:
773 if err := v.Validate(); err != nil {
774 errors = append(errors, AlternateProtocolsCacheOptionsValidationError{
775 field: fmt.Sprintf("PrepopulatedEntries[%v]", idx),
776 reason: "embedded message failed validation",
777 cause: err,
778 })
779 }
780 }
781 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
782 if err := v.Validate(); err != nil {
783 return AlternateProtocolsCacheOptionsValidationError{
784 field: fmt.Sprintf("PrepopulatedEntries[%v]", idx),
785 reason: "embedded message failed validation",
786 cause: err,
787 }
788 }
789 }
790
791 }
792
793 if len(errors) > 0 {
794 return AlternateProtocolsCacheOptionsMultiError(errors)
795 }
796
797 return nil
798 }
799
800 // AlternateProtocolsCacheOptionsMultiError is an error wrapping multiple
801 // validation errors returned by AlternateProtocolsCacheOptions.ValidateAll()
802 // if the designated constraints aren't met.
803 type AlternateProtocolsCacheOptionsMultiError []error
804
805 // Error returns a concatenation of all the error messages it wraps.
806 func (m AlternateProtocolsCacheOptionsMultiError) Error() string {
807 var msgs []string
808 for _, err := range m {
809 msgs = append(msgs, err.Error())
810 }
811 return strings.Join(msgs, "; ")
812 }
813
814 // AllErrors returns a list of validation violation errors.
815 func (m AlternateProtocolsCacheOptionsMultiError) AllErrors() []error { return m }
816
817 // AlternateProtocolsCacheOptionsValidationError is the validation error
818 // returned by AlternateProtocolsCacheOptions.Validate if the designated
819 // constraints aren't met.
820 type AlternateProtocolsCacheOptionsValidationError struct {
821 field string
822 reason string
823 cause error
824 key bool
825 }
826
827 // Field function returns field value.
828 func (e AlternateProtocolsCacheOptionsValidationError) Field() string { return e.field }
829
830 // Reason function returns reason value.
831 func (e AlternateProtocolsCacheOptionsValidationError) Reason() string { return e.reason }
832
833 // Cause function returns cause value.
834 func (e AlternateProtocolsCacheOptionsValidationError) Cause() error { return e.cause }
835
836 // Key function returns key value.
837 func (e AlternateProtocolsCacheOptionsValidationError) Key() bool { return e.key }
838
839 // ErrorName returns error name.
840 func (e AlternateProtocolsCacheOptionsValidationError) ErrorName() string {
841 return "AlternateProtocolsCacheOptionsValidationError"
842 }
843
844 // Error satisfies the builtin error interface
845 func (e AlternateProtocolsCacheOptionsValidationError) Error() string {
846 cause := ""
847 if e.cause != nil {
848 cause = fmt.Sprintf(" | caused by: %v", e.cause)
849 }
850
851 key := ""
852 if e.key {
853 key = "key for "
854 }
855
856 return fmt.Sprintf(
857 "invalid %sAlternateProtocolsCacheOptions.%s: %s%s",
858 key,
859 e.field,
860 e.reason,
861 cause)
862 }
863
864 var _ error = AlternateProtocolsCacheOptionsValidationError{}
865
866 var _ interface {
867 Field() string
868 Reason() string
869 Key() bool
870 Cause() error
871 ErrorName() string
872 } = AlternateProtocolsCacheOptionsValidationError{}
873
874 // Validate checks the field values on HttpProtocolOptions with the rules
875 // defined in the proto definition for this message. If any rules are
876 // violated, the first error encountered is returned, or nil if there are no violations.
877 func (m *HttpProtocolOptions) Validate() error {
878 return m.validate(false)
879 }
880
881 // ValidateAll checks the field values on HttpProtocolOptions with the rules
882 // defined in the proto definition for this message. If any rules are
883 // violated, the result is a list of violation errors wrapped in
884 // HttpProtocolOptionsMultiError, or nil if none found.
885 func (m *HttpProtocolOptions) ValidateAll() error {
886 return m.validate(true)
887 }
888
889 func (m *HttpProtocolOptions) validate(all bool) error {
890 if m == nil {
891 return nil
892 }
893
894 var errors []error
895
896 if all {
897 switch v := interface{}(m.GetIdleTimeout()).(type) {
898 case interface{ ValidateAll() error }:
899 if err := v.ValidateAll(); err != nil {
900 errors = append(errors, HttpProtocolOptionsValidationError{
901 field: "IdleTimeout",
902 reason: "embedded message failed validation",
903 cause: err,
904 })
905 }
906 case interface{ Validate() error }:
907 if err := v.Validate(); err != nil {
908 errors = append(errors, HttpProtocolOptionsValidationError{
909 field: "IdleTimeout",
910 reason: "embedded message failed validation",
911 cause: err,
912 })
913 }
914 }
915 } else if v, ok := interface{}(m.GetIdleTimeout()).(interface{ Validate() error }); ok {
916 if err := v.Validate(); err != nil {
917 return HttpProtocolOptionsValidationError{
918 field: "IdleTimeout",
919 reason: "embedded message failed validation",
920 cause: err,
921 }
922 }
923 }
924
925 if all {
926 switch v := interface{}(m.GetMaxConnectionDuration()).(type) {
927 case interface{ ValidateAll() error }:
928 if err := v.ValidateAll(); err != nil {
929 errors = append(errors, HttpProtocolOptionsValidationError{
930 field: "MaxConnectionDuration",
931 reason: "embedded message failed validation",
932 cause: err,
933 })
934 }
935 case interface{ Validate() error }:
936 if err := v.Validate(); err != nil {
937 errors = append(errors, HttpProtocolOptionsValidationError{
938 field: "MaxConnectionDuration",
939 reason: "embedded message failed validation",
940 cause: err,
941 })
942 }
943 }
944 } else if v, ok := interface{}(m.GetMaxConnectionDuration()).(interface{ Validate() error }); ok {
945 if err := v.Validate(); err != nil {
946 return HttpProtocolOptionsValidationError{
947 field: "MaxConnectionDuration",
948 reason: "embedded message failed validation",
949 cause: err,
950 }
951 }
952 }
953
954 if wrapper := m.GetMaxHeadersCount(); wrapper != nil {
955
956 if wrapper.GetValue() < 1 {
957 err := HttpProtocolOptionsValidationError{
958 field: "MaxHeadersCount",
959 reason: "value must be greater than or equal to 1",
960 }
961 if !all {
962 return err
963 }
964 errors = append(errors, err)
965 }
966
967 }
968
969 if wrapper := m.GetMaxResponseHeadersKb(); wrapper != nil {
970
971 if val := wrapper.GetValue(); val <= 0 || val > 8192 {
972 err := HttpProtocolOptionsValidationError{
973 field: "MaxResponseHeadersKb",
974 reason: "value must be inside range (0, 8192]",
975 }
976 if !all {
977 return err
978 }
979 errors = append(errors, err)
980 }
981
982 }
983
984 if all {
985 switch v := interface{}(m.GetMaxStreamDuration()).(type) {
986 case interface{ ValidateAll() error }:
987 if err := v.ValidateAll(); err != nil {
988 errors = append(errors, HttpProtocolOptionsValidationError{
989 field: "MaxStreamDuration",
990 reason: "embedded message failed validation",
991 cause: err,
992 })
993 }
994 case interface{ Validate() error }:
995 if err := v.Validate(); err != nil {
996 errors = append(errors, HttpProtocolOptionsValidationError{
997 field: "MaxStreamDuration",
998 reason: "embedded message failed validation",
999 cause: err,
1000 })
1001 }
1002 }
1003 } else if v, ok := interface{}(m.GetMaxStreamDuration()).(interface{ Validate() error }); ok {
1004 if err := v.Validate(); err != nil {
1005 return HttpProtocolOptionsValidationError{
1006 field: "MaxStreamDuration",
1007 reason: "embedded message failed validation",
1008 cause: err,
1009 }
1010 }
1011 }
1012
1013 // no validation rules for HeadersWithUnderscoresAction
1014
1015 if all {
1016 switch v := interface{}(m.GetMaxRequestsPerConnection()).(type) {
1017 case interface{ ValidateAll() error }:
1018 if err := v.ValidateAll(); err != nil {
1019 errors = append(errors, HttpProtocolOptionsValidationError{
1020 field: "MaxRequestsPerConnection",
1021 reason: "embedded message failed validation",
1022 cause: err,
1023 })
1024 }
1025 case interface{ Validate() error }:
1026 if err := v.Validate(); err != nil {
1027 errors = append(errors, HttpProtocolOptionsValidationError{
1028 field: "MaxRequestsPerConnection",
1029 reason: "embedded message failed validation",
1030 cause: err,
1031 })
1032 }
1033 }
1034 } else if v, ok := interface{}(m.GetMaxRequestsPerConnection()).(interface{ Validate() error }); ok {
1035 if err := v.Validate(); err != nil {
1036 return HttpProtocolOptionsValidationError{
1037 field: "MaxRequestsPerConnection",
1038 reason: "embedded message failed validation",
1039 cause: err,
1040 }
1041 }
1042 }
1043
1044 if len(errors) > 0 {
1045 return HttpProtocolOptionsMultiError(errors)
1046 }
1047
1048 return nil
1049 }
1050
1051 // HttpProtocolOptionsMultiError is an error wrapping multiple validation
1052 // errors returned by HttpProtocolOptions.ValidateAll() if the designated
1053 // constraints aren't met.
1054 type HttpProtocolOptionsMultiError []error
1055
1056 // Error returns a concatenation of all the error messages it wraps.
1057 func (m HttpProtocolOptionsMultiError) Error() string {
1058 var msgs []string
1059 for _, err := range m {
1060 msgs = append(msgs, err.Error())
1061 }
1062 return strings.Join(msgs, "; ")
1063 }
1064
1065 // AllErrors returns a list of validation violation errors.
1066 func (m HttpProtocolOptionsMultiError) AllErrors() []error { return m }
1067
1068 // HttpProtocolOptionsValidationError is the validation error returned by
1069 // HttpProtocolOptions.Validate if the designated constraints aren't met.
1070 type HttpProtocolOptionsValidationError struct {
1071 field string
1072 reason string
1073 cause error
1074 key bool
1075 }
1076
1077 // Field function returns field value.
1078 func (e HttpProtocolOptionsValidationError) Field() string { return e.field }
1079
1080 // Reason function returns reason value.
1081 func (e HttpProtocolOptionsValidationError) Reason() string { return e.reason }
1082
1083 // Cause function returns cause value.
1084 func (e HttpProtocolOptionsValidationError) Cause() error { return e.cause }
1085
1086 // Key function returns key value.
1087 func (e HttpProtocolOptionsValidationError) Key() bool { return e.key }
1088
1089 // ErrorName returns error name.
1090 func (e HttpProtocolOptionsValidationError) ErrorName() string {
1091 return "HttpProtocolOptionsValidationError"
1092 }
1093
1094 // Error satisfies the builtin error interface
1095 func (e HttpProtocolOptionsValidationError) Error() string {
1096 cause := ""
1097 if e.cause != nil {
1098 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1099 }
1100
1101 key := ""
1102 if e.key {
1103 key = "key for "
1104 }
1105
1106 return fmt.Sprintf(
1107 "invalid %sHttpProtocolOptions.%s: %s%s",
1108 key,
1109 e.field,
1110 e.reason,
1111 cause)
1112 }
1113
1114 var _ error = HttpProtocolOptionsValidationError{}
1115
1116 var _ interface {
1117 Field() string
1118 Reason() string
1119 Key() bool
1120 Cause() error
1121 ErrorName() string
1122 } = HttpProtocolOptionsValidationError{}
1123
1124 // Validate checks the field values on Http1ProtocolOptions with the rules
1125 // defined in the proto definition for this message. If any rules are
1126 // violated, the first error encountered is returned, or nil if there are no violations.
1127 func (m *Http1ProtocolOptions) Validate() error {
1128 return m.validate(false)
1129 }
1130
1131 // ValidateAll checks the field values on Http1ProtocolOptions with the rules
1132 // defined in the proto definition for this message. If any rules are
1133 // violated, the result is a list of violation errors wrapped in
1134 // Http1ProtocolOptionsMultiError, or nil if none found.
1135 func (m *Http1ProtocolOptions) ValidateAll() error {
1136 return m.validate(true)
1137 }
1138
1139 func (m *Http1ProtocolOptions) validate(all bool) error {
1140 if m == nil {
1141 return nil
1142 }
1143
1144 var errors []error
1145
1146 if all {
1147 switch v := interface{}(m.GetAllowAbsoluteUrl()).(type) {
1148 case interface{ ValidateAll() error }:
1149 if err := v.ValidateAll(); err != nil {
1150 errors = append(errors, Http1ProtocolOptionsValidationError{
1151 field: "AllowAbsoluteUrl",
1152 reason: "embedded message failed validation",
1153 cause: err,
1154 })
1155 }
1156 case interface{ Validate() error }:
1157 if err := v.Validate(); err != nil {
1158 errors = append(errors, Http1ProtocolOptionsValidationError{
1159 field: "AllowAbsoluteUrl",
1160 reason: "embedded message failed validation",
1161 cause: err,
1162 })
1163 }
1164 }
1165 } else if v, ok := interface{}(m.GetAllowAbsoluteUrl()).(interface{ Validate() error }); ok {
1166 if err := v.Validate(); err != nil {
1167 return Http1ProtocolOptionsValidationError{
1168 field: "AllowAbsoluteUrl",
1169 reason: "embedded message failed validation",
1170 cause: err,
1171 }
1172 }
1173 }
1174
1175 // no validation rules for AcceptHttp_10
1176
1177 // no validation rules for DefaultHostForHttp_10
1178
1179 if all {
1180 switch v := interface{}(m.GetHeaderKeyFormat()).(type) {
1181 case interface{ ValidateAll() error }:
1182 if err := v.ValidateAll(); err != nil {
1183 errors = append(errors, Http1ProtocolOptionsValidationError{
1184 field: "HeaderKeyFormat",
1185 reason: "embedded message failed validation",
1186 cause: err,
1187 })
1188 }
1189 case interface{ Validate() error }:
1190 if err := v.Validate(); err != nil {
1191 errors = append(errors, Http1ProtocolOptionsValidationError{
1192 field: "HeaderKeyFormat",
1193 reason: "embedded message failed validation",
1194 cause: err,
1195 })
1196 }
1197 }
1198 } else if v, ok := interface{}(m.GetHeaderKeyFormat()).(interface{ Validate() error }); ok {
1199 if err := v.Validate(); err != nil {
1200 return Http1ProtocolOptionsValidationError{
1201 field: "HeaderKeyFormat",
1202 reason: "embedded message failed validation",
1203 cause: err,
1204 }
1205 }
1206 }
1207
1208 // no validation rules for EnableTrailers
1209
1210 // no validation rules for AllowChunkedLength
1211
1212 if all {
1213 switch v := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(type) {
1214 case interface{ ValidateAll() error }:
1215 if err := v.ValidateAll(); err != nil {
1216 errors = append(errors, Http1ProtocolOptionsValidationError{
1217 field: "OverrideStreamErrorOnInvalidHttpMessage",
1218 reason: "embedded message failed validation",
1219 cause: err,
1220 })
1221 }
1222 case interface{ Validate() error }:
1223 if err := v.Validate(); err != nil {
1224 errors = append(errors, Http1ProtocolOptionsValidationError{
1225 field: "OverrideStreamErrorOnInvalidHttpMessage",
1226 reason: "embedded message failed validation",
1227 cause: err,
1228 })
1229 }
1230 }
1231 } else if v, ok := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(interface{ Validate() error }); ok {
1232 if err := v.Validate(); err != nil {
1233 return Http1ProtocolOptionsValidationError{
1234 field: "OverrideStreamErrorOnInvalidHttpMessage",
1235 reason: "embedded message failed validation",
1236 cause: err,
1237 }
1238 }
1239 }
1240
1241 // no validation rules for SendFullyQualifiedUrl
1242
1243 if all {
1244 switch v := interface{}(m.GetUseBalsaParser()).(type) {
1245 case interface{ ValidateAll() error }:
1246 if err := v.ValidateAll(); err != nil {
1247 errors = append(errors, Http1ProtocolOptionsValidationError{
1248 field: "UseBalsaParser",
1249 reason: "embedded message failed validation",
1250 cause: err,
1251 })
1252 }
1253 case interface{ Validate() error }:
1254 if err := v.Validate(); err != nil {
1255 errors = append(errors, Http1ProtocolOptionsValidationError{
1256 field: "UseBalsaParser",
1257 reason: "embedded message failed validation",
1258 cause: err,
1259 })
1260 }
1261 }
1262 } else if v, ok := interface{}(m.GetUseBalsaParser()).(interface{ Validate() error }); ok {
1263 if err := v.Validate(); err != nil {
1264 return Http1ProtocolOptionsValidationError{
1265 field: "UseBalsaParser",
1266 reason: "embedded message failed validation",
1267 cause: err,
1268 }
1269 }
1270 }
1271
1272 // no validation rules for AllowCustomMethods
1273
1274 if len(errors) > 0 {
1275 return Http1ProtocolOptionsMultiError(errors)
1276 }
1277
1278 return nil
1279 }
1280
1281 // Http1ProtocolOptionsMultiError is an error wrapping multiple validation
1282 // errors returned by Http1ProtocolOptions.ValidateAll() if the designated
1283 // constraints aren't met.
1284 type Http1ProtocolOptionsMultiError []error
1285
1286 // Error returns a concatenation of all the error messages it wraps.
1287 func (m Http1ProtocolOptionsMultiError) Error() string {
1288 var msgs []string
1289 for _, err := range m {
1290 msgs = append(msgs, err.Error())
1291 }
1292 return strings.Join(msgs, "; ")
1293 }
1294
1295 // AllErrors returns a list of validation violation errors.
1296 func (m Http1ProtocolOptionsMultiError) AllErrors() []error { return m }
1297
1298 // Http1ProtocolOptionsValidationError is the validation error returned by
1299 // Http1ProtocolOptions.Validate if the designated constraints aren't met.
1300 type Http1ProtocolOptionsValidationError struct {
1301 field string
1302 reason string
1303 cause error
1304 key bool
1305 }
1306
1307 // Field function returns field value.
1308 func (e Http1ProtocolOptionsValidationError) Field() string { return e.field }
1309
1310 // Reason function returns reason value.
1311 func (e Http1ProtocolOptionsValidationError) Reason() string { return e.reason }
1312
1313 // Cause function returns cause value.
1314 func (e Http1ProtocolOptionsValidationError) Cause() error { return e.cause }
1315
1316 // Key function returns key value.
1317 func (e Http1ProtocolOptionsValidationError) Key() bool { return e.key }
1318
1319 // ErrorName returns error name.
1320 func (e Http1ProtocolOptionsValidationError) ErrorName() string {
1321 return "Http1ProtocolOptionsValidationError"
1322 }
1323
1324 // Error satisfies the builtin error interface
1325 func (e Http1ProtocolOptionsValidationError) Error() string {
1326 cause := ""
1327 if e.cause != nil {
1328 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1329 }
1330
1331 key := ""
1332 if e.key {
1333 key = "key for "
1334 }
1335
1336 return fmt.Sprintf(
1337 "invalid %sHttp1ProtocolOptions.%s: %s%s",
1338 key,
1339 e.field,
1340 e.reason,
1341 cause)
1342 }
1343
1344 var _ error = Http1ProtocolOptionsValidationError{}
1345
1346 var _ interface {
1347 Field() string
1348 Reason() string
1349 Key() bool
1350 Cause() error
1351 ErrorName() string
1352 } = Http1ProtocolOptionsValidationError{}
1353
1354 // Validate checks the field values on KeepaliveSettings with the rules defined
1355 // in the proto definition for this message. If any rules are violated, the
1356 // first error encountered is returned, or nil if there are no violations.
1357 func (m *KeepaliveSettings) Validate() error {
1358 return m.validate(false)
1359 }
1360
1361 // ValidateAll checks the field values on KeepaliveSettings with the rules
1362 // defined in the proto definition for this message. If any rules are
1363 // violated, the result is a list of violation errors wrapped in
1364 // KeepaliveSettingsMultiError, or nil if none found.
1365 func (m *KeepaliveSettings) ValidateAll() error {
1366 return m.validate(true)
1367 }
1368
1369 func (m *KeepaliveSettings) validate(all bool) error {
1370 if m == nil {
1371 return nil
1372 }
1373
1374 var errors []error
1375
1376 if d := m.GetInterval(); d != nil {
1377 dur, err := d.AsDuration(), d.CheckValid()
1378 if err != nil {
1379 err = KeepaliveSettingsValidationError{
1380 field: "Interval",
1381 reason: "value is not a valid duration",
1382 cause: err,
1383 }
1384 if !all {
1385 return err
1386 }
1387 errors = append(errors, err)
1388 } else {
1389
1390 gte := time.Duration(0*time.Second + 1000000*time.Nanosecond)
1391
1392 if dur < gte {
1393 err := KeepaliveSettingsValidationError{
1394 field: "Interval",
1395 reason: "value must be greater than or equal to 1ms",
1396 }
1397 if !all {
1398 return err
1399 }
1400 errors = append(errors, err)
1401 }
1402
1403 }
1404 }
1405
1406 if m.GetTimeout() == nil {
1407 err := KeepaliveSettingsValidationError{
1408 field: "Timeout",
1409 reason: "value is required",
1410 }
1411 if !all {
1412 return err
1413 }
1414 errors = append(errors, err)
1415 }
1416
1417 if d := m.GetTimeout(); d != nil {
1418 dur, err := d.AsDuration(), d.CheckValid()
1419 if err != nil {
1420 err = KeepaliveSettingsValidationError{
1421 field: "Timeout",
1422 reason: "value is not a valid duration",
1423 cause: err,
1424 }
1425 if !all {
1426 return err
1427 }
1428 errors = append(errors, err)
1429 } else {
1430
1431 gte := time.Duration(0*time.Second + 1000000*time.Nanosecond)
1432
1433 if dur < gte {
1434 err := KeepaliveSettingsValidationError{
1435 field: "Timeout",
1436 reason: "value must be greater than or equal to 1ms",
1437 }
1438 if !all {
1439 return err
1440 }
1441 errors = append(errors, err)
1442 }
1443
1444 }
1445 }
1446
1447 if all {
1448 switch v := interface{}(m.GetIntervalJitter()).(type) {
1449 case interface{ ValidateAll() error }:
1450 if err := v.ValidateAll(); err != nil {
1451 errors = append(errors, KeepaliveSettingsValidationError{
1452 field: "IntervalJitter",
1453 reason: "embedded message failed validation",
1454 cause: err,
1455 })
1456 }
1457 case interface{ Validate() error }:
1458 if err := v.Validate(); err != nil {
1459 errors = append(errors, KeepaliveSettingsValidationError{
1460 field: "IntervalJitter",
1461 reason: "embedded message failed validation",
1462 cause: err,
1463 })
1464 }
1465 }
1466 } else if v, ok := interface{}(m.GetIntervalJitter()).(interface{ Validate() error }); ok {
1467 if err := v.Validate(); err != nil {
1468 return KeepaliveSettingsValidationError{
1469 field: "IntervalJitter",
1470 reason: "embedded message failed validation",
1471 cause: err,
1472 }
1473 }
1474 }
1475
1476 if d := m.GetConnectionIdleInterval(); d != nil {
1477 dur, err := d.AsDuration(), d.CheckValid()
1478 if err != nil {
1479 err = KeepaliveSettingsValidationError{
1480 field: "ConnectionIdleInterval",
1481 reason: "value is not a valid duration",
1482 cause: err,
1483 }
1484 if !all {
1485 return err
1486 }
1487 errors = append(errors, err)
1488 } else {
1489
1490 gte := time.Duration(0*time.Second + 1000000*time.Nanosecond)
1491
1492 if dur < gte {
1493 err := KeepaliveSettingsValidationError{
1494 field: "ConnectionIdleInterval",
1495 reason: "value must be greater than or equal to 1ms",
1496 }
1497 if !all {
1498 return err
1499 }
1500 errors = append(errors, err)
1501 }
1502
1503 }
1504 }
1505
1506 if len(errors) > 0 {
1507 return KeepaliveSettingsMultiError(errors)
1508 }
1509
1510 return nil
1511 }
1512
1513 // KeepaliveSettingsMultiError is an error wrapping multiple validation errors
1514 // returned by KeepaliveSettings.ValidateAll() if the designated constraints
1515 // aren't met.
1516 type KeepaliveSettingsMultiError []error
1517
1518 // Error returns a concatenation of all the error messages it wraps.
1519 func (m KeepaliveSettingsMultiError) Error() string {
1520 var msgs []string
1521 for _, err := range m {
1522 msgs = append(msgs, err.Error())
1523 }
1524 return strings.Join(msgs, "; ")
1525 }
1526
1527 // AllErrors returns a list of validation violation errors.
1528 func (m KeepaliveSettingsMultiError) AllErrors() []error { return m }
1529
1530 // KeepaliveSettingsValidationError is the validation error returned by
1531 // KeepaliveSettings.Validate if the designated constraints aren't met.
1532 type KeepaliveSettingsValidationError struct {
1533 field string
1534 reason string
1535 cause error
1536 key bool
1537 }
1538
1539 // Field function returns field value.
1540 func (e KeepaliveSettingsValidationError) Field() string { return e.field }
1541
1542 // Reason function returns reason value.
1543 func (e KeepaliveSettingsValidationError) Reason() string { return e.reason }
1544
1545 // Cause function returns cause value.
1546 func (e KeepaliveSettingsValidationError) Cause() error { return e.cause }
1547
1548 // Key function returns key value.
1549 func (e KeepaliveSettingsValidationError) Key() bool { return e.key }
1550
1551 // ErrorName returns error name.
1552 func (e KeepaliveSettingsValidationError) ErrorName() string {
1553 return "KeepaliveSettingsValidationError"
1554 }
1555
1556 // Error satisfies the builtin error interface
1557 func (e KeepaliveSettingsValidationError) Error() string {
1558 cause := ""
1559 if e.cause != nil {
1560 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1561 }
1562
1563 key := ""
1564 if e.key {
1565 key = "key for "
1566 }
1567
1568 return fmt.Sprintf(
1569 "invalid %sKeepaliveSettings.%s: %s%s",
1570 key,
1571 e.field,
1572 e.reason,
1573 cause)
1574 }
1575
1576 var _ error = KeepaliveSettingsValidationError{}
1577
1578 var _ interface {
1579 Field() string
1580 Reason() string
1581 Key() bool
1582 Cause() error
1583 ErrorName() string
1584 } = KeepaliveSettingsValidationError{}
1585
1586 // Validate checks the field values on Http2ProtocolOptions with the rules
1587 // defined in the proto definition for this message. If any rules are
1588 // violated, the first error encountered is returned, or nil if there are no violations.
1589 func (m *Http2ProtocolOptions) Validate() error {
1590 return m.validate(false)
1591 }
1592
1593 // ValidateAll checks the field values on Http2ProtocolOptions with the rules
1594 // defined in the proto definition for this message. If any rules are
1595 // violated, the result is a list of violation errors wrapped in
1596 // Http2ProtocolOptionsMultiError, or nil if none found.
1597 func (m *Http2ProtocolOptions) ValidateAll() error {
1598 return m.validate(true)
1599 }
1600
1601 func (m *Http2ProtocolOptions) validate(all bool) error {
1602 if m == nil {
1603 return nil
1604 }
1605
1606 var errors []error
1607
1608 if all {
1609 switch v := interface{}(m.GetHpackTableSize()).(type) {
1610 case interface{ ValidateAll() error }:
1611 if err := v.ValidateAll(); err != nil {
1612 errors = append(errors, Http2ProtocolOptionsValidationError{
1613 field: "HpackTableSize",
1614 reason: "embedded message failed validation",
1615 cause: err,
1616 })
1617 }
1618 case interface{ Validate() error }:
1619 if err := v.Validate(); err != nil {
1620 errors = append(errors, Http2ProtocolOptionsValidationError{
1621 field: "HpackTableSize",
1622 reason: "embedded message failed validation",
1623 cause: err,
1624 })
1625 }
1626 }
1627 } else if v, ok := interface{}(m.GetHpackTableSize()).(interface{ Validate() error }); ok {
1628 if err := v.Validate(); err != nil {
1629 return Http2ProtocolOptionsValidationError{
1630 field: "HpackTableSize",
1631 reason: "embedded message failed validation",
1632 cause: err,
1633 }
1634 }
1635 }
1636
1637 if wrapper := m.GetMaxConcurrentStreams(); wrapper != nil {
1638
1639 if val := wrapper.GetValue(); val < 1 || val > 2147483647 {
1640 err := Http2ProtocolOptionsValidationError{
1641 field: "MaxConcurrentStreams",
1642 reason: "value must be inside range [1, 2147483647]",
1643 }
1644 if !all {
1645 return err
1646 }
1647 errors = append(errors, err)
1648 }
1649
1650 }
1651
1652 if wrapper := m.GetInitialStreamWindowSize(); wrapper != nil {
1653
1654 if val := wrapper.GetValue(); val < 65535 || val > 2147483647 {
1655 err := Http2ProtocolOptionsValidationError{
1656 field: "InitialStreamWindowSize",
1657 reason: "value must be inside range [65535, 2147483647]",
1658 }
1659 if !all {
1660 return err
1661 }
1662 errors = append(errors, err)
1663 }
1664
1665 }
1666
1667 if wrapper := m.GetInitialConnectionWindowSize(); wrapper != nil {
1668
1669 if val := wrapper.GetValue(); val < 65535 || val > 2147483647 {
1670 err := Http2ProtocolOptionsValidationError{
1671 field: "InitialConnectionWindowSize",
1672 reason: "value must be inside range [65535, 2147483647]",
1673 }
1674 if !all {
1675 return err
1676 }
1677 errors = append(errors, err)
1678 }
1679
1680 }
1681
1682 // no validation rules for AllowConnect
1683
1684 // no validation rules for AllowMetadata
1685
1686 if wrapper := m.GetMaxOutboundFrames(); wrapper != nil {
1687
1688 if wrapper.GetValue() < 1 {
1689 err := Http2ProtocolOptionsValidationError{
1690 field: "MaxOutboundFrames",
1691 reason: "value must be greater than or equal to 1",
1692 }
1693 if !all {
1694 return err
1695 }
1696 errors = append(errors, err)
1697 }
1698
1699 }
1700
1701 if wrapper := m.GetMaxOutboundControlFrames(); wrapper != nil {
1702
1703 if wrapper.GetValue() < 1 {
1704 err := Http2ProtocolOptionsValidationError{
1705 field: "MaxOutboundControlFrames",
1706 reason: "value must be greater than or equal to 1",
1707 }
1708 if !all {
1709 return err
1710 }
1711 errors = append(errors, err)
1712 }
1713
1714 }
1715
1716 if all {
1717 switch v := interface{}(m.GetMaxConsecutiveInboundFramesWithEmptyPayload()).(type) {
1718 case interface{ ValidateAll() error }:
1719 if err := v.ValidateAll(); err != nil {
1720 errors = append(errors, Http2ProtocolOptionsValidationError{
1721 field: "MaxConsecutiveInboundFramesWithEmptyPayload",
1722 reason: "embedded message failed validation",
1723 cause: err,
1724 })
1725 }
1726 case interface{ Validate() error }:
1727 if err := v.Validate(); err != nil {
1728 errors = append(errors, Http2ProtocolOptionsValidationError{
1729 field: "MaxConsecutiveInboundFramesWithEmptyPayload",
1730 reason: "embedded message failed validation",
1731 cause: err,
1732 })
1733 }
1734 }
1735 } else if v, ok := interface{}(m.GetMaxConsecutiveInboundFramesWithEmptyPayload()).(interface{ Validate() error }); ok {
1736 if err := v.Validate(); err != nil {
1737 return Http2ProtocolOptionsValidationError{
1738 field: "MaxConsecutiveInboundFramesWithEmptyPayload",
1739 reason: "embedded message failed validation",
1740 cause: err,
1741 }
1742 }
1743 }
1744
1745 if all {
1746 switch v := interface{}(m.GetMaxInboundPriorityFramesPerStream()).(type) {
1747 case interface{ ValidateAll() error }:
1748 if err := v.ValidateAll(); err != nil {
1749 errors = append(errors, Http2ProtocolOptionsValidationError{
1750 field: "MaxInboundPriorityFramesPerStream",
1751 reason: "embedded message failed validation",
1752 cause: err,
1753 })
1754 }
1755 case interface{ Validate() error }:
1756 if err := v.Validate(); err != nil {
1757 errors = append(errors, Http2ProtocolOptionsValidationError{
1758 field: "MaxInboundPriorityFramesPerStream",
1759 reason: "embedded message failed validation",
1760 cause: err,
1761 })
1762 }
1763 }
1764 } else if v, ok := interface{}(m.GetMaxInboundPriorityFramesPerStream()).(interface{ Validate() error }); ok {
1765 if err := v.Validate(); err != nil {
1766 return Http2ProtocolOptionsValidationError{
1767 field: "MaxInboundPriorityFramesPerStream",
1768 reason: "embedded message failed validation",
1769 cause: err,
1770 }
1771 }
1772 }
1773
1774 if wrapper := m.GetMaxInboundWindowUpdateFramesPerDataFrameSent(); wrapper != nil {
1775
1776 if wrapper.GetValue() < 1 {
1777 err := Http2ProtocolOptionsValidationError{
1778 field: "MaxInboundWindowUpdateFramesPerDataFrameSent",
1779 reason: "value must be greater than or equal to 1",
1780 }
1781 if !all {
1782 return err
1783 }
1784 errors = append(errors, err)
1785 }
1786
1787 }
1788
1789 // no validation rules for StreamErrorOnInvalidHttpMessaging
1790
1791 if all {
1792 switch v := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(type) {
1793 case interface{ ValidateAll() error }:
1794 if err := v.ValidateAll(); err != nil {
1795 errors = append(errors, Http2ProtocolOptionsValidationError{
1796 field: "OverrideStreamErrorOnInvalidHttpMessage",
1797 reason: "embedded message failed validation",
1798 cause: err,
1799 })
1800 }
1801 case interface{ Validate() error }:
1802 if err := v.Validate(); err != nil {
1803 errors = append(errors, Http2ProtocolOptionsValidationError{
1804 field: "OverrideStreamErrorOnInvalidHttpMessage",
1805 reason: "embedded message failed validation",
1806 cause: err,
1807 })
1808 }
1809 }
1810 } else if v, ok := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(interface{ Validate() error }); ok {
1811 if err := v.Validate(); err != nil {
1812 return Http2ProtocolOptionsValidationError{
1813 field: "OverrideStreamErrorOnInvalidHttpMessage",
1814 reason: "embedded message failed validation",
1815 cause: err,
1816 }
1817 }
1818 }
1819
1820 for idx, item := range m.GetCustomSettingsParameters() {
1821 _, _ = idx, item
1822
1823 if all {
1824 switch v := interface{}(item).(type) {
1825 case interface{ ValidateAll() error }:
1826 if err := v.ValidateAll(); err != nil {
1827 errors = append(errors, Http2ProtocolOptionsValidationError{
1828 field: fmt.Sprintf("CustomSettingsParameters[%v]", idx),
1829 reason: "embedded message failed validation",
1830 cause: err,
1831 })
1832 }
1833 case interface{ Validate() error }:
1834 if err := v.Validate(); err != nil {
1835 errors = append(errors, Http2ProtocolOptionsValidationError{
1836 field: fmt.Sprintf("CustomSettingsParameters[%v]", idx),
1837 reason: "embedded message failed validation",
1838 cause: err,
1839 })
1840 }
1841 }
1842 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1843 if err := v.Validate(); err != nil {
1844 return Http2ProtocolOptionsValidationError{
1845 field: fmt.Sprintf("CustomSettingsParameters[%v]", idx),
1846 reason: "embedded message failed validation",
1847 cause: err,
1848 }
1849 }
1850 }
1851
1852 }
1853
1854 if all {
1855 switch v := interface{}(m.GetConnectionKeepalive()).(type) {
1856 case interface{ ValidateAll() error }:
1857 if err := v.ValidateAll(); err != nil {
1858 errors = append(errors, Http2ProtocolOptionsValidationError{
1859 field: "ConnectionKeepalive",
1860 reason: "embedded message failed validation",
1861 cause: err,
1862 })
1863 }
1864 case interface{ Validate() error }:
1865 if err := v.Validate(); err != nil {
1866 errors = append(errors, Http2ProtocolOptionsValidationError{
1867 field: "ConnectionKeepalive",
1868 reason: "embedded message failed validation",
1869 cause: err,
1870 })
1871 }
1872 }
1873 } else if v, ok := interface{}(m.GetConnectionKeepalive()).(interface{ Validate() error }); ok {
1874 if err := v.Validate(); err != nil {
1875 return Http2ProtocolOptionsValidationError{
1876 field: "ConnectionKeepalive",
1877 reason: "embedded message failed validation",
1878 cause: err,
1879 }
1880 }
1881 }
1882
1883 if all {
1884 switch v := interface{}(m.GetUseOghttp2Codec()).(type) {
1885 case interface{ ValidateAll() error }:
1886 if err := v.ValidateAll(); err != nil {
1887 errors = append(errors, Http2ProtocolOptionsValidationError{
1888 field: "UseOghttp2Codec",
1889 reason: "embedded message failed validation",
1890 cause: err,
1891 })
1892 }
1893 case interface{ Validate() error }:
1894 if err := v.Validate(); err != nil {
1895 errors = append(errors, Http2ProtocolOptionsValidationError{
1896 field: "UseOghttp2Codec",
1897 reason: "embedded message failed validation",
1898 cause: err,
1899 })
1900 }
1901 }
1902 } else if v, ok := interface{}(m.GetUseOghttp2Codec()).(interface{ Validate() error }); ok {
1903 if err := v.Validate(); err != nil {
1904 return Http2ProtocolOptionsValidationError{
1905 field: "UseOghttp2Codec",
1906 reason: "embedded message failed validation",
1907 cause: err,
1908 }
1909 }
1910 }
1911
1912 if len(errors) > 0 {
1913 return Http2ProtocolOptionsMultiError(errors)
1914 }
1915
1916 return nil
1917 }
1918
1919 // Http2ProtocolOptionsMultiError is an error wrapping multiple validation
1920 // errors returned by Http2ProtocolOptions.ValidateAll() if the designated
1921 // constraints aren't met.
1922 type Http2ProtocolOptionsMultiError []error
1923
1924 // Error returns a concatenation of all the error messages it wraps.
1925 func (m Http2ProtocolOptionsMultiError) Error() string {
1926 var msgs []string
1927 for _, err := range m {
1928 msgs = append(msgs, err.Error())
1929 }
1930 return strings.Join(msgs, "; ")
1931 }
1932
1933 // AllErrors returns a list of validation violation errors.
1934 func (m Http2ProtocolOptionsMultiError) AllErrors() []error { return m }
1935
1936 // Http2ProtocolOptionsValidationError is the validation error returned by
1937 // Http2ProtocolOptions.Validate if the designated constraints aren't met.
1938 type Http2ProtocolOptionsValidationError struct {
1939 field string
1940 reason string
1941 cause error
1942 key bool
1943 }
1944
1945 // Field function returns field value.
1946 func (e Http2ProtocolOptionsValidationError) Field() string { return e.field }
1947
1948 // Reason function returns reason value.
1949 func (e Http2ProtocolOptionsValidationError) Reason() string { return e.reason }
1950
1951 // Cause function returns cause value.
1952 func (e Http2ProtocolOptionsValidationError) Cause() error { return e.cause }
1953
1954 // Key function returns key value.
1955 func (e Http2ProtocolOptionsValidationError) Key() bool { return e.key }
1956
1957 // ErrorName returns error name.
1958 func (e Http2ProtocolOptionsValidationError) ErrorName() string {
1959 return "Http2ProtocolOptionsValidationError"
1960 }
1961
1962 // Error satisfies the builtin error interface
1963 func (e Http2ProtocolOptionsValidationError) Error() string {
1964 cause := ""
1965 if e.cause != nil {
1966 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1967 }
1968
1969 key := ""
1970 if e.key {
1971 key = "key for "
1972 }
1973
1974 return fmt.Sprintf(
1975 "invalid %sHttp2ProtocolOptions.%s: %s%s",
1976 key,
1977 e.field,
1978 e.reason,
1979 cause)
1980 }
1981
1982 var _ error = Http2ProtocolOptionsValidationError{}
1983
1984 var _ interface {
1985 Field() string
1986 Reason() string
1987 Key() bool
1988 Cause() error
1989 ErrorName() string
1990 } = Http2ProtocolOptionsValidationError{}
1991
1992 // Validate checks the field values on GrpcProtocolOptions with the rules
1993 // defined in the proto definition for this message. If any rules are
1994 // violated, the first error encountered is returned, or nil if there are no violations.
1995 func (m *GrpcProtocolOptions) Validate() error {
1996 return m.validate(false)
1997 }
1998
1999 // ValidateAll checks the field values on GrpcProtocolOptions with the rules
2000 // defined in the proto definition for this message. If any rules are
2001 // violated, the result is a list of violation errors wrapped in
2002 // GrpcProtocolOptionsMultiError, or nil if none found.
2003 func (m *GrpcProtocolOptions) ValidateAll() error {
2004 return m.validate(true)
2005 }
2006
2007 func (m *GrpcProtocolOptions) validate(all bool) error {
2008 if m == nil {
2009 return nil
2010 }
2011
2012 var errors []error
2013
2014 if all {
2015 switch v := interface{}(m.GetHttp2ProtocolOptions()).(type) {
2016 case interface{ ValidateAll() error }:
2017 if err := v.ValidateAll(); err != nil {
2018 errors = append(errors, GrpcProtocolOptionsValidationError{
2019 field: "Http2ProtocolOptions",
2020 reason: "embedded message failed validation",
2021 cause: err,
2022 })
2023 }
2024 case interface{ Validate() error }:
2025 if err := v.Validate(); err != nil {
2026 errors = append(errors, GrpcProtocolOptionsValidationError{
2027 field: "Http2ProtocolOptions",
2028 reason: "embedded message failed validation",
2029 cause: err,
2030 })
2031 }
2032 }
2033 } else if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok {
2034 if err := v.Validate(); err != nil {
2035 return GrpcProtocolOptionsValidationError{
2036 field: "Http2ProtocolOptions",
2037 reason: "embedded message failed validation",
2038 cause: err,
2039 }
2040 }
2041 }
2042
2043 if len(errors) > 0 {
2044 return GrpcProtocolOptionsMultiError(errors)
2045 }
2046
2047 return nil
2048 }
2049
2050 // GrpcProtocolOptionsMultiError is an error wrapping multiple validation
2051 // errors returned by GrpcProtocolOptions.ValidateAll() if the designated
2052 // constraints aren't met.
2053 type GrpcProtocolOptionsMultiError []error
2054
2055 // Error returns a concatenation of all the error messages it wraps.
2056 func (m GrpcProtocolOptionsMultiError) Error() string {
2057 var msgs []string
2058 for _, err := range m {
2059 msgs = append(msgs, err.Error())
2060 }
2061 return strings.Join(msgs, "; ")
2062 }
2063
2064 // AllErrors returns a list of validation violation errors.
2065 func (m GrpcProtocolOptionsMultiError) AllErrors() []error { return m }
2066
2067 // GrpcProtocolOptionsValidationError is the validation error returned by
2068 // GrpcProtocolOptions.Validate if the designated constraints aren't met.
2069 type GrpcProtocolOptionsValidationError struct {
2070 field string
2071 reason string
2072 cause error
2073 key bool
2074 }
2075
2076 // Field function returns field value.
2077 func (e GrpcProtocolOptionsValidationError) Field() string { return e.field }
2078
2079 // Reason function returns reason value.
2080 func (e GrpcProtocolOptionsValidationError) Reason() string { return e.reason }
2081
2082 // Cause function returns cause value.
2083 func (e GrpcProtocolOptionsValidationError) Cause() error { return e.cause }
2084
2085 // Key function returns key value.
2086 func (e GrpcProtocolOptionsValidationError) Key() bool { return e.key }
2087
2088 // ErrorName returns error name.
2089 func (e GrpcProtocolOptionsValidationError) ErrorName() string {
2090 return "GrpcProtocolOptionsValidationError"
2091 }
2092
2093 // Error satisfies the builtin error interface
2094 func (e GrpcProtocolOptionsValidationError) Error() string {
2095 cause := ""
2096 if e.cause != nil {
2097 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2098 }
2099
2100 key := ""
2101 if e.key {
2102 key = "key for "
2103 }
2104
2105 return fmt.Sprintf(
2106 "invalid %sGrpcProtocolOptions.%s: %s%s",
2107 key,
2108 e.field,
2109 e.reason,
2110 cause)
2111 }
2112
2113 var _ error = GrpcProtocolOptionsValidationError{}
2114
2115 var _ interface {
2116 Field() string
2117 Reason() string
2118 Key() bool
2119 Cause() error
2120 ErrorName() string
2121 } = GrpcProtocolOptionsValidationError{}
2122
2123 // Validate checks the field values on Http3ProtocolOptions with the rules
2124 // defined in the proto definition for this message. If any rules are
2125 // violated, the first error encountered is returned, or nil if there are no violations.
2126 func (m *Http3ProtocolOptions) Validate() error {
2127 return m.validate(false)
2128 }
2129
2130 // ValidateAll checks the field values on Http3ProtocolOptions with the rules
2131 // defined in the proto definition for this message. If any rules are
2132 // violated, the result is a list of violation errors wrapped in
2133 // Http3ProtocolOptionsMultiError, or nil if none found.
2134 func (m *Http3ProtocolOptions) ValidateAll() error {
2135 return m.validate(true)
2136 }
2137
2138 func (m *Http3ProtocolOptions) validate(all bool) error {
2139 if m == nil {
2140 return nil
2141 }
2142
2143 var errors []error
2144
2145 if all {
2146 switch v := interface{}(m.GetQuicProtocolOptions()).(type) {
2147 case interface{ ValidateAll() error }:
2148 if err := v.ValidateAll(); err != nil {
2149 errors = append(errors, Http3ProtocolOptionsValidationError{
2150 field: "QuicProtocolOptions",
2151 reason: "embedded message failed validation",
2152 cause: err,
2153 })
2154 }
2155 case interface{ Validate() error }:
2156 if err := v.Validate(); err != nil {
2157 errors = append(errors, Http3ProtocolOptionsValidationError{
2158 field: "QuicProtocolOptions",
2159 reason: "embedded message failed validation",
2160 cause: err,
2161 })
2162 }
2163 }
2164 } else if v, ok := interface{}(m.GetQuicProtocolOptions()).(interface{ Validate() error }); ok {
2165 if err := v.Validate(); err != nil {
2166 return Http3ProtocolOptionsValidationError{
2167 field: "QuicProtocolOptions",
2168 reason: "embedded message failed validation",
2169 cause: err,
2170 }
2171 }
2172 }
2173
2174 if all {
2175 switch v := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(type) {
2176 case interface{ ValidateAll() error }:
2177 if err := v.ValidateAll(); err != nil {
2178 errors = append(errors, Http3ProtocolOptionsValidationError{
2179 field: "OverrideStreamErrorOnInvalidHttpMessage",
2180 reason: "embedded message failed validation",
2181 cause: err,
2182 })
2183 }
2184 case interface{ Validate() error }:
2185 if err := v.Validate(); err != nil {
2186 errors = append(errors, Http3ProtocolOptionsValidationError{
2187 field: "OverrideStreamErrorOnInvalidHttpMessage",
2188 reason: "embedded message failed validation",
2189 cause: err,
2190 })
2191 }
2192 }
2193 } else if v, ok := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(interface{ Validate() error }); ok {
2194 if err := v.Validate(); err != nil {
2195 return Http3ProtocolOptionsValidationError{
2196 field: "OverrideStreamErrorOnInvalidHttpMessage",
2197 reason: "embedded message failed validation",
2198 cause: err,
2199 }
2200 }
2201 }
2202
2203 // no validation rules for AllowExtendedConnect
2204
2205 // no validation rules for AllowMetadata
2206
2207 if len(errors) > 0 {
2208 return Http3ProtocolOptionsMultiError(errors)
2209 }
2210
2211 return nil
2212 }
2213
2214 // Http3ProtocolOptionsMultiError is an error wrapping multiple validation
2215 // errors returned by Http3ProtocolOptions.ValidateAll() if the designated
2216 // constraints aren't met.
2217 type Http3ProtocolOptionsMultiError []error
2218
2219 // Error returns a concatenation of all the error messages it wraps.
2220 func (m Http3ProtocolOptionsMultiError) Error() string {
2221 var msgs []string
2222 for _, err := range m {
2223 msgs = append(msgs, err.Error())
2224 }
2225 return strings.Join(msgs, "; ")
2226 }
2227
2228 // AllErrors returns a list of validation violation errors.
2229 func (m Http3ProtocolOptionsMultiError) AllErrors() []error { return m }
2230
2231 // Http3ProtocolOptionsValidationError is the validation error returned by
2232 // Http3ProtocolOptions.Validate if the designated constraints aren't met.
2233 type Http3ProtocolOptionsValidationError struct {
2234 field string
2235 reason string
2236 cause error
2237 key bool
2238 }
2239
2240 // Field function returns field value.
2241 func (e Http3ProtocolOptionsValidationError) Field() string { return e.field }
2242
2243 // Reason function returns reason value.
2244 func (e Http3ProtocolOptionsValidationError) Reason() string { return e.reason }
2245
2246 // Cause function returns cause value.
2247 func (e Http3ProtocolOptionsValidationError) Cause() error { return e.cause }
2248
2249 // Key function returns key value.
2250 func (e Http3ProtocolOptionsValidationError) Key() bool { return e.key }
2251
2252 // ErrorName returns error name.
2253 func (e Http3ProtocolOptionsValidationError) ErrorName() string {
2254 return "Http3ProtocolOptionsValidationError"
2255 }
2256
2257 // Error satisfies the builtin error interface
2258 func (e Http3ProtocolOptionsValidationError) Error() string {
2259 cause := ""
2260 if e.cause != nil {
2261 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2262 }
2263
2264 key := ""
2265 if e.key {
2266 key = "key for "
2267 }
2268
2269 return fmt.Sprintf(
2270 "invalid %sHttp3ProtocolOptions.%s: %s%s",
2271 key,
2272 e.field,
2273 e.reason,
2274 cause)
2275 }
2276
2277 var _ error = Http3ProtocolOptionsValidationError{}
2278
2279 var _ interface {
2280 Field() string
2281 Reason() string
2282 Key() bool
2283 Cause() error
2284 ErrorName() string
2285 } = Http3ProtocolOptionsValidationError{}
2286
2287 // Validate checks the field values on SchemeHeaderTransformation with the
2288 // rules defined in the proto definition for this message. If any rules are
2289 // violated, the first error encountered is returned, or nil if there are no violations.
2290 func (m *SchemeHeaderTransformation) Validate() error {
2291 return m.validate(false)
2292 }
2293
2294 // ValidateAll checks the field values on SchemeHeaderTransformation with the
2295 // rules defined in the proto definition for this message. If any rules are
2296 // violated, the result is a list of violation errors wrapped in
2297 // SchemeHeaderTransformationMultiError, or nil if none found.
2298 func (m *SchemeHeaderTransformation) ValidateAll() error {
2299 return m.validate(true)
2300 }
2301
2302 func (m *SchemeHeaderTransformation) validate(all bool) error {
2303 if m == nil {
2304 return nil
2305 }
2306
2307 var errors []error
2308
2309 // no validation rules for MatchUpstream
2310
2311 switch v := m.Transformation.(type) {
2312 case *SchemeHeaderTransformation_SchemeToOverwrite:
2313 if v == nil {
2314 err := SchemeHeaderTransformationValidationError{
2315 field: "Transformation",
2316 reason: "oneof value cannot be a typed-nil",
2317 }
2318 if !all {
2319 return err
2320 }
2321 errors = append(errors, err)
2322 }
2323
2324 if _, ok := _SchemeHeaderTransformation_SchemeToOverwrite_InLookup[m.GetSchemeToOverwrite()]; !ok {
2325 err := SchemeHeaderTransformationValidationError{
2326 field: "SchemeToOverwrite",
2327 reason: "value must be in list [http https]",
2328 }
2329 if !all {
2330 return err
2331 }
2332 errors = append(errors, err)
2333 }
2334
2335 default:
2336 _ = v // ensures v is used
2337 }
2338
2339 if len(errors) > 0 {
2340 return SchemeHeaderTransformationMultiError(errors)
2341 }
2342
2343 return nil
2344 }
2345
2346 // SchemeHeaderTransformationMultiError is an error wrapping multiple
2347 // validation errors returned by SchemeHeaderTransformation.ValidateAll() if
2348 // the designated constraints aren't met.
2349 type SchemeHeaderTransformationMultiError []error
2350
2351 // Error returns a concatenation of all the error messages it wraps.
2352 func (m SchemeHeaderTransformationMultiError) Error() string {
2353 var msgs []string
2354 for _, err := range m {
2355 msgs = append(msgs, err.Error())
2356 }
2357 return strings.Join(msgs, "; ")
2358 }
2359
2360 // AllErrors returns a list of validation violation errors.
2361 func (m SchemeHeaderTransformationMultiError) AllErrors() []error { return m }
2362
2363 // SchemeHeaderTransformationValidationError is the validation error returned
2364 // by SchemeHeaderTransformation.Validate if the designated constraints aren't met.
2365 type SchemeHeaderTransformationValidationError struct {
2366 field string
2367 reason string
2368 cause error
2369 key bool
2370 }
2371
2372 // Field function returns field value.
2373 func (e SchemeHeaderTransformationValidationError) Field() string { return e.field }
2374
2375 // Reason function returns reason value.
2376 func (e SchemeHeaderTransformationValidationError) Reason() string { return e.reason }
2377
2378 // Cause function returns cause value.
2379 func (e SchemeHeaderTransformationValidationError) Cause() error { return e.cause }
2380
2381 // Key function returns key value.
2382 func (e SchemeHeaderTransformationValidationError) Key() bool { return e.key }
2383
2384 // ErrorName returns error name.
2385 func (e SchemeHeaderTransformationValidationError) ErrorName() string {
2386 return "SchemeHeaderTransformationValidationError"
2387 }
2388
2389 // Error satisfies the builtin error interface
2390 func (e SchemeHeaderTransformationValidationError) Error() string {
2391 cause := ""
2392 if e.cause != nil {
2393 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2394 }
2395
2396 key := ""
2397 if e.key {
2398 key = "key for "
2399 }
2400
2401 return fmt.Sprintf(
2402 "invalid %sSchemeHeaderTransformation.%s: %s%s",
2403 key,
2404 e.field,
2405 e.reason,
2406 cause)
2407 }
2408
2409 var _ error = SchemeHeaderTransformationValidationError{}
2410
2411 var _ interface {
2412 Field() string
2413 Reason() string
2414 Key() bool
2415 Cause() error
2416 ErrorName() string
2417 } = SchemeHeaderTransformationValidationError{}
2418
2419 var _SchemeHeaderTransformation_SchemeToOverwrite_InLookup = map[string]struct{}{
2420 "http": {},
2421 "https": {},
2422 }
2423
2424 // Validate checks the field values on
2425 // AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry with the rules
2426 // defined in the proto definition for this message. If any rules are
2427 // violated, the first error encountered is returned, or nil if there are no violations.
2428 func (m *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) Validate() error {
2429 return m.validate(false)
2430 }
2431
2432 // ValidateAll checks the field values on
2433 // AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry with the rules
2434 // defined in the proto definition for this message. If any rules are
2435 // violated, the result is a list of violation errors wrapped in
2436 // AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError, or
2437 // nil if none found.
2438 func (m *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) ValidateAll() error {
2439 return m.validate(true)
2440 }
2441
2442 func (m *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) validate(all bool) error {
2443 if m == nil {
2444 return nil
2445 }
2446
2447 var errors []error
2448
2449 if m.GetHostname() != "" {
2450
2451 if !_AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry_Hostname_Pattern.MatchString(m.GetHostname()) {
2452 err := AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError{
2453 field: "Hostname",
2454 reason: "value does not match regex pattern \"^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$\"",
2455 }
2456 if !all {
2457 return err
2458 }
2459 errors = append(errors, err)
2460 }
2461
2462 }
2463
2464 if val := m.GetPort(); val <= 0 || val >= 65535 {
2465 err := AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError{
2466 field: "Port",
2467 reason: "value must be inside range (0, 65535)",
2468 }
2469 if !all {
2470 return err
2471 }
2472 errors = append(errors, err)
2473 }
2474
2475 if len(errors) > 0 {
2476 return AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError(errors)
2477 }
2478
2479 return nil
2480 }
2481
2482 // AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError is an
2483 // error wrapping multiple validation errors returned by
2484 // AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry.ValidateAll()
2485 // if the designated constraints aren't met.
2486 type AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError []error
2487
2488 // Error returns a concatenation of all the error messages it wraps.
2489 func (m AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError) Error() string {
2490 var msgs []string
2491 for _, err := range m {
2492 msgs = append(msgs, err.Error())
2493 }
2494 return strings.Join(msgs, "; ")
2495 }
2496
2497 // AllErrors returns a list of validation violation errors.
2498 func (m AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError) AllErrors() []error {
2499 return m
2500 }
2501
2502 // AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError
2503 // is the validation error returned by
2504 // AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry.Validate if the
2505 // designated constraints aren't met.
2506 type AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError struct {
2507 field string
2508 reason string
2509 cause error
2510 key bool
2511 }
2512
2513 // Field function returns field value.
2514 func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) Field() string {
2515 return e.field
2516 }
2517
2518 // Reason function returns reason value.
2519 func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) Reason() string {
2520 return e.reason
2521 }
2522
2523 // Cause function returns cause value.
2524 func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) Cause() error {
2525 return e.cause
2526 }
2527
2528 // Key function returns key value.
2529 func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) Key() bool {
2530 return e.key
2531 }
2532
2533 // ErrorName returns error name.
2534 func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) ErrorName() string {
2535 return "AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError"
2536 }
2537
2538 // Error satisfies the builtin error interface
2539 func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) Error() string {
2540 cause := ""
2541 if e.cause != nil {
2542 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2543 }
2544
2545 key := ""
2546 if e.key {
2547 key = "key for "
2548 }
2549
2550 return fmt.Sprintf(
2551 "invalid %sAlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry.%s: %s%s",
2552 key,
2553 e.field,
2554 e.reason,
2555 cause)
2556 }
2557
2558 var _ error = AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError{}
2559
2560 var _ interface {
2561 Field() string
2562 Reason() string
2563 Key() bool
2564 Cause() error
2565 ErrorName() string
2566 } = AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError{}
2567
2568 var _AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry_Hostname_Pattern = regexp.MustCompile("^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$")
2569
2570 // Validate checks the field values on Http1ProtocolOptions_HeaderKeyFormat
2571 // with the rules defined in the proto definition for this message. If any
2572 // rules are violated, the first error encountered is returned, or nil if
2573 // there are no violations.
2574 func (m *Http1ProtocolOptions_HeaderKeyFormat) Validate() error {
2575 return m.validate(false)
2576 }
2577
2578 // ValidateAll checks the field values on Http1ProtocolOptions_HeaderKeyFormat
2579 // with the rules defined in the proto definition for this message. If any
2580 // rules are violated, the result is a list of violation errors wrapped in
2581 // Http1ProtocolOptions_HeaderKeyFormatMultiError, or nil if none found.
2582 func (m *Http1ProtocolOptions_HeaderKeyFormat) ValidateAll() error {
2583 return m.validate(true)
2584 }
2585
2586 func (m *Http1ProtocolOptions_HeaderKeyFormat) validate(all bool) error {
2587 if m == nil {
2588 return nil
2589 }
2590
2591 var errors []error
2592
2593 oneofHeaderFormatPresent := false
2594 switch v := m.HeaderFormat.(type) {
2595 case *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords_:
2596 if v == nil {
2597 err := Http1ProtocolOptions_HeaderKeyFormatValidationError{
2598 field: "HeaderFormat",
2599 reason: "oneof value cannot be a typed-nil",
2600 }
2601 if !all {
2602 return err
2603 }
2604 errors = append(errors, err)
2605 }
2606 oneofHeaderFormatPresent = true
2607
2608 if all {
2609 switch v := interface{}(m.GetProperCaseWords()).(type) {
2610 case interface{ ValidateAll() error }:
2611 if err := v.ValidateAll(); err != nil {
2612 errors = append(errors, Http1ProtocolOptions_HeaderKeyFormatValidationError{
2613 field: "ProperCaseWords",
2614 reason: "embedded message failed validation",
2615 cause: err,
2616 })
2617 }
2618 case interface{ Validate() error }:
2619 if err := v.Validate(); err != nil {
2620 errors = append(errors, Http1ProtocolOptions_HeaderKeyFormatValidationError{
2621 field: "ProperCaseWords",
2622 reason: "embedded message failed validation",
2623 cause: err,
2624 })
2625 }
2626 }
2627 } else if v, ok := interface{}(m.GetProperCaseWords()).(interface{ Validate() error }); ok {
2628 if err := v.Validate(); err != nil {
2629 return Http1ProtocolOptions_HeaderKeyFormatValidationError{
2630 field: "ProperCaseWords",
2631 reason: "embedded message failed validation",
2632 cause: err,
2633 }
2634 }
2635 }
2636
2637 case *Http1ProtocolOptions_HeaderKeyFormat_StatefulFormatter:
2638 if v == nil {
2639 err := Http1ProtocolOptions_HeaderKeyFormatValidationError{
2640 field: "HeaderFormat",
2641 reason: "oneof value cannot be a typed-nil",
2642 }
2643 if !all {
2644 return err
2645 }
2646 errors = append(errors, err)
2647 }
2648 oneofHeaderFormatPresent = true
2649
2650 if all {
2651 switch v := interface{}(m.GetStatefulFormatter()).(type) {
2652 case interface{ ValidateAll() error }:
2653 if err := v.ValidateAll(); err != nil {
2654 errors = append(errors, Http1ProtocolOptions_HeaderKeyFormatValidationError{
2655 field: "StatefulFormatter",
2656 reason: "embedded message failed validation",
2657 cause: err,
2658 })
2659 }
2660 case interface{ Validate() error }:
2661 if err := v.Validate(); err != nil {
2662 errors = append(errors, Http1ProtocolOptions_HeaderKeyFormatValidationError{
2663 field: "StatefulFormatter",
2664 reason: "embedded message failed validation",
2665 cause: err,
2666 })
2667 }
2668 }
2669 } else if v, ok := interface{}(m.GetStatefulFormatter()).(interface{ Validate() error }); ok {
2670 if err := v.Validate(); err != nil {
2671 return Http1ProtocolOptions_HeaderKeyFormatValidationError{
2672 field: "StatefulFormatter",
2673 reason: "embedded message failed validation",
2674 cause: err,
2675 }
2676 }
2677 }
2678
2679 default:
2680 _ = v // ensures v is used
2681 }
2682 if !oneofHeaderFormatPresent {
2683 err := Http1ProtocolOptions_HeaderKeyFormatValidationError{
2684 field: "HeaderFormat",
2685 reason: "value is required",
2686 }
2687 if !all {
2688 return err
2689 }
2690 errors = append(errors, err)
2691 }
2692
2693 if len(errors) > 0 {
2694 return Http1ProtocolOptions_HeaderKeyFormatMultiError(errors)
2695 }
2696
2697 return nil
2698 }
2699
2700 // Http1ProtocolOptions_HeaderKeyFormatMultiError is an error wrapping multiple
2701 // validation errors returned by
2702 // Http1ProtocolOptions_HeaderKeyFormat.ValidateAll() if the designated
2703 // constraints aren't met.
2704 type Http1ProtocolOptions_HeaderKeyFormatMultiError []error
2705
2706 // Error returns a concatenation of all the error messages it wraps.
2707 func (m Http1ProtocolOptions_HeaderKeyFormatMultiError) Error() string {
2708 var msgs []string
2709 for _, err := range m {
2710 msgs = append(msgs, err.Error())
2711 }
2712 return strings.Join(msgs, "; ")
2713 }
2714
2715 // AllErrors returns a list of validation violation errors.
2716 func (m Http1ProtocolOptions_HeaderKeyFormatMultiError) AllErrors() []error { return m }
2717
2718 // Http1ProtocolOptions_HeaderKeyFormatValidationError is the validation error
2719 // returned by Http1ProtocolOptions_HeaderKeyFormat.Validate if the designated
2720 // constraints aren't met.
2721 type Http1ProtocolOptions_HeaderKeyFormatValidationError struct {
2722 field string
2723 reason string
2724 cause error
2725 key bool
2726 }
2727
2728 // Field function returns field value.
2729 func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) Field() string { return e.field }
2730
2731 // Reason function returns reason value.
2732 func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) Reason() string { return e.reason }
2733
2734 // Cause function returns cause value.
2735 func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) Cause() error { return e.cause }
2736
2737 // Key function returns key value.
2738 func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) Key() bool { return e.key }
2739
2740 // ErrorName returns error name.
2741 func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) ErrorName() string {
2742 return "Http1ProtocolOptions_HeaderKeyFormatValidationError"
2743 }
2744
2745 // Error satisfies the builtin error interface
2746 func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) Error() string {
2747 cause := ""
2748 if e.cause != nil {
2749 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2750 }
2751
2752 key := ""
2753 if e.key {
2754 key = "key for "
2755 }
2756
2757 return fmt.Sprintf(
2758 "invalid %sHttp1ProtocolOptions_HeaderKeyFormat.%s: %s%s",
2759 key,
2760 e.field,
2761 e.reason,
2762 cause)
2763 }
2764
2765 var _ error = Http1ProtocolOptions_HeaderKeyFormatValidationError{}
2766
2767 var _ interface {
2768 Field() string
2769 Reason() string
2770 Key() bool
2771 Cause() error
2772 ErrorName() string
2773 } = Http1ProtocolOptions_HeaderKeyFormatValidationError{}
2774
2775 // Validate checks the field values on
2776 // Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords with the rules defined
2777 // in the proto definition for this message. If any rules are violated, the
2778 // first error encountered is returned, or nil if there are no violations.
2779 func (m *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) Validate() error {
2780 return m.validate(false)
2781 }
2782
2783 // ValidateAll checks the field values on
2784 // Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords with the rules defined
2785 // in the proto definition for this message. If any rules are violated, the
2786 // result is a list of violation errors wrapped in
2787 // Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError, or nil if
2788 // none found.
2789 func (m *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) ValidateAll() error {
2790 return m.validate(true)
2791 }
2792
2793 func (m *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) validate(all bool) error {
2794 if m == nil {
2795 return nil
2796 }
2797
2798 var errors []error
2799
2800 if len(errors) > 0 {
2801 return Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError(errors)
2802 }
2803
2804 return nil
2805 }
2806
2807 // Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError is an error
2808 // wrapping multiple validation errors returned by
2809 // Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords.ValidateAll() if the
2810 // designated constraints aren't met.
2811 type Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError []error
2812
2813 // Error returns a concatenation of all the error messages it wraps.
2814 func (m Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError) Error() string {
2815 var msgs []string
2816 for _, err := range m {
2817 msgs = append(msgs, err.Error())
2818 }
2819 return strings.Join(msgs, "; ")
2820 }
2821
2822 // AllErrors returns a list of validation violation errors.
2823 func (m Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError) AllErrors() []error { return m }
2824
2825 // Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError is the
2826 // validation error returned by
2827 // Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords.Validate if the
2828 // designated constraints aren't met.
2829 type Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError struct {
2830 field string
2831 reason string
2832 cause error
2833 key bool
2834 }
2835
2836 // Field function returns field value.
2837 func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) Field() string {
2838 return e.field
2839 }
2840
2841 // Reason function returns reason value.
2842 func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) Reason() string {
2843 return e.reason
2844 }
2845
2846 // Cause function returns cause value.
2847 func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) Cause() error {
2848 return e.cause
2849 }
2850
2851 // Key function returns key value.
2852 func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) Key() bool { return e.key }
2853
2854 // ErrorName returns error name.
2855 func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) ErrorName() string {
2856 return "Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError"
2857 }
2858
2859 // Error satisfies the builtin error interface
2860 func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) Error() string {
2861 cause := ""
2862 if e.cause != nil {
2863 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2864 }
2865
2866 key := ""
2867 if e.key {
2868 key = "key for "
2869 }
2870
2871 return fmt.Sprintf(
2872 "invalid %sHttp1ProtocolOptions_HeaderKeyFormat_ProperCaseWords.%s: %s%s",
2873 key,
2874 e.field,
2875 e.reason,
2876 cause)
2877 }
2878
2879 var _ error = Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError{}
2880
2881 var _ interface {
2882 Field() string
2883 Reason() string
2884 Key() bool
2885 Cause() error
2886 ErrorName() string
2887 } = Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError{}
2888
2889 // Validate checks the field values on Http2ProtocolOptions_SettingsParameter
2890 // with the rules defined in the proto definition for this message. If any
2891 // rules are violated, the first error encountered is returned, or nil if
2892 // there are no violations.
2893 func (m *Http2ProtocolOptions_SettingsParameter) Validate() error {
2894 return m.validate(false)
2895 }
2896
2897 // ValidateAll checks the field values on
2898 // Http2ProtocolOptions_SettingsParameter with the rules defined in the proto
2899 // definition for this message. If any rules are violated, the result is a
2900 // list of violation errors wrapped in
2901 // Http2ProtocolOptions_SettingsParameterMultiError, or nil if none found.
2902 func (m *Http2ProtocolOptions_SettingsParameter) ValidateAll() error {
2903 return m.validate(true)
2904 }
2905
2906 func (m *Http2ProtocolOptions_SettingsParameter) validate(all bool) error {
2907 if m == nil {
2908 return nil
2909 }
2910
2911 var errors []error
2912
2913 if wrapper := m.GetIdentifier(); wrapper != nil {
2914
2915 if val := wrapper.GetValue(); val < 0 || val > 65535 {
2916 err := Http2ProtocolOptions_SettingsParameterValidationError{
2917 field: "Identifier",
2918 reason: "value must be inside range [0, 65535]",
2919 }
2920 if !all {
2921 return err
2922 }
2923 errors = append(errors, err)
2924 }
2925
2926 } else {
2927 err := Http2ProtocolOptions_SettingsParameterValidationError{
2928 field: "Identifier",
2929 reason: "value is required and must not be nil.",
2930 }
2931 if !all {
2932 return err
2933 }
2934 errors = append(errors, err)
2935 }
2936
2937 if m.GetValue() == nil {
2938 err := Http2ProtocolOptions_SettingsParameterValidationError{
2939 field: "Value",
2940 reason: "value is required",
2941 }
2942 if !all {
2943 return err
2944 }
2945 errors = append(errors, err)
2946 }
2947
2948 if all {
2949 switch v := interface{}(m.GetValue()).(type) {
2950 case interface{ ValidateAll() error }:
2951 if err := v.ValidateAll(); err != nil {
2952 errors = append(errors, Http2ProtocolOptions_SettingsParameterValidationError{
2953 field: "Value",
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, Http2ProtocolOptions_SettingsParameterValidationError{
2961 field: "Value",
2962 reason: "embedded message failed validation",
2963 cause: err,
2964 })
2965 }
2966 }
2967 } else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok {
2968 if err := v.Validate(); err != nil {
2969 return Http2ProtocolOptions_SettingsParameterValidationError{
2970 field: "Value",
2971 reason: "embedded message failed validation",
2972 cause: err,
2973 }
2974 }
2975 }
2976
2977 if len(errors) > 0 {
2978 return Http2ProtocolOptions_SettingsParameterMultiError(errors)
2979 }
2980
2981 return nil
2982 }
2983
2984 // Http2ProtocolOptions_SettingsParameterMultiError is an error wrapping
2985 // multiple validation errors returned by
2986 // Http2ProtocolOptions_SettingsParameter.ValidateAll() if the designated
2987 // constraints aren't met.
2988 type Http2ProtocolOptions_SettingsParameterMultiError []error
2989
2990 // Error returns a concatenation of all the error messages it wraps.
2991 func (m Http2ProtocolOptions_SettingsParameterMultiError) Error() string {
2992 var msgs []string
2993 for _, err := range m {
2994 msgs = append(msgs, err.Error())
2995 }
2996 return strings.Join(msgs, "; ")
2997 }
2998
2999 // AllErrors returns a list of validation violation errors.
3000 func (m Http2ProtocolOptions_SettingsParameterMultiError) AllErrors() []error { return m }
3001
3002 // Http2ProtocolOptions_SettingsParameterValidationError is the validation
3003 // error returned by Http2ProtocolOptions_SettingsParameter.Validate if the
3004 // designated constraints aren't met.
3005 type Http2ProtocolOptions_SettingsParameterValidationError struct {
3006 field string
3007 reason string
3008 cause error
3009 key bool
3010 }
3011
3012 // Field function returns field value.
3013 func (e Http2ProtocolOptions_SettingsParameterValidationError) Field() string { return e.field }
3014
3015 // Reason function returns reason value.
3016 func (e Http2ProtocolOptions_SettingsParameterValidationError) Reason() string { return e.reason }
3017
3018 // Cause function returns cause value.
3019 func (e Http2ProtocolOptions_SettingsParameterValidationError) Cause() error { return e.cause }
3020
3021 // Key function returns key value.
3022 func (e Http2ProtocolOptions_SettingsParameterValidationError) Key() bool { return e.key }
3023
3024 // ErrorName returns error name.
3025 func (e Http2ProtocolOptions_SettingsParameterValidationError) ErrorName() string {
3026 return "Http2ProtocolOptions_SettingsParameterValidationError"
3027 }
3028
3029 // Error satisfies the builtin error interface
3030 func (e Http2ProtocolOptions_SettingsParameterValidationError) Error() string {
3031 cause := ""
3032 if e.cause != nil {
3033 cause = fmt.Sprintf(" | caused by: %v", e.cause)
3034 }
3035
3036 key := ""
3037 if e.key {
3038 key = "key for "
3039 }
3040
3041 return fmt.Sprintf(
3042 "invalid %sHttp2ProtocolOptions_SettingsParameter.%s: %s%s",
3043 key,
3044 e.field,
3045 e.reason,
3046 cause)
3047 }
3048
3049 var _ error = Http2ProtocolOptions_SettingsParameterValidationError{}
3050
3051 var _ interface {
3052 Field() string
3053 Reason() string
3054 Key() bool
3055 Cause() error
3056 ErrorName() string
3057 } = Http2ProtocolOptions_SettingsParameterValidationError{}