Debian Codegraph @

envoy/service/ext_proc/v3/external_processor.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/service/ext_proc/v3/external_processor.proto
4
5 package ext_procv3
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 ProcessingRequest with the rules defined
40 // in the proto definition for this message. If any rules are violated, the
41 // first error encountered is returned, or nil if there are no violations.
42 func (m *ProcessingRequest) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on ProcessingRequest 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 // ProcessingRequestMultiError, or nil if none found.
50 func (m *ProcessingRequest) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *ProcessingRequest) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 if all {
62 switch v := interface{}(m.GetMetadataContext()).(type) {
63 case interface{ ValidateAll() error }:
64 if err := v.ValidateAll(); err != nil {
65 errors = append(errors, ProcessingRequestValidationError{
66 field: "MetadataContext",
67 reason: "embedded message failed validation",
68 cause: err,
69 })
70 }
71 case interface{ Validate() error }:
72 if err := v.Validate(); err != nil {
73 errors = append(errors, ProcessingRequestValidationError{
74 field: "MetadataContext",
75 reason: "embedded message failed validation",
76 cause: err,
77 })
78 }
79 }
80 } else if v, ok := interface{}(m.GetMetadataContext()).(interface{ Validate() error }); ok {
81 if err := v.Validate(); err != nil {
82 return ProcessingRequestValidationError{
83 field: "MetadataContext",
84 reason: "embedded message failed validation",
85 cause: err,
86 }
87 }
88 }
89
90 {
91 sorted_keys := make([]string, len(m.GetAttributes()))
92 i := 0
93 for key := range m.GetAttributes() {
94 sorted_keys[i] = key
95 i++
96 }
97 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
98 for _, key := range sorted_keys {
99 val := m.GetAttributes()[key]
100 _ = val
101
102 // no validation rules for Attributes[key]
103
104 if all {
105 switch v := interface{}(val).(type) {
106 case interface{ ValidateAll() error }:
107 if err := v.ValidateAll(); err != nil {
108 errors = append(errors, ProcessingRequestValidationError{
109 field: fmt.Sprintf("Attributes[%v]", key),
110 reason: "embedded message failed validation",
111 cause: err,
112 })
113 }
114 case interface{ Validate() error }:
115 if err := v.Validate(); err != nil {
116 errors = append(errors, ProcessingRequestValidationError{
117 field: fmt.Sprintf("Attributes[%v]", key),
118 reason: "embedded message failed validation",
119 cause: err,
120 })
121 }
122 }
123 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
124 if err := v.Validate(); err != nil {
125 return ProcessingRequestValidationError{
126 field: fmt.Sprintf("Attributes[%v]", key),
127 reason: "embedded message failed validation",
128 cause: err,
129 }
130 }
131 }
132
133 }
134 }
135
136 // no validation rules for ObservabilityMode
137
138 oneofRequestPresent := false
139 switch v := m.Request.(type) {
140 case *ProcessingRequest_RequestHeaders:
141 if v == nil {
142 err := ProcessingRequestValidationError{
143 field: "Request",
144 reason: "oneof value cannot be a typed-nil",
145 }
146 if !all {
147 return err
148 }
149 errors = append(errors, err)
150 }
151 oneofRequestPresent = true
152
153 if all {
154 switch v := interface{}(m.GetRequestHeaders()).(type) {
155 case interface{ ValidateAll() error }:
156 if err := v.ValidateAll(); err != nil {
157 errors = append(errors, ProcessingRequestValidationError{
158 field: "RequestHeaders",
159 reason: "embedded message failed validation",
160 cause: err,
161 })
162 }
163 case interface{ Validate() error }:
164 if err := v.Validate(); err != nil {
165 errors = append(errors, ProcessingRequestValidationError{
166 field: "RequestHeaders",
167 reason: "embedded message failed validation",
168 cause: err,
169 })
170 }
171 }
172 } else if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok {
173 if err := v.Validate(); err != nil {
174 return ProcessingRequestValidationError{
175 field: "RequestHeaders",
176 reason: "embedded message failed validation",
177 cause: err,
178 }
179 }
180 }
181
182 case *ProcessingRequest_ResponseHeaders:
183 if v == nil {
184 err := ProcessingRequestValidationError{
185 field: "Request",
186 reason: "oneof value cannot be a typed-nil",
187 }
188 if !all {
189 return err
190 }
191 errors = append(errors, err)
192 }
193 oneofRequestPresent = true
194
195 if all {
196 switch v := interface{}(m.GetResponseHeaders()).(type) {
197 case interface{ ValidateAll() error }:
198 if err := v.ValidateAll(); err != nil {
199 errors = append(errors, ProcessingRequestValidationError{
200 field: "ResponseHeaders",
201 reason: "embedded message failed validation",
202 cause: err,
203 })
204 }
205 case interface{ Validate() error }:
206 if err := v.Validate(); err != nil {
207 errors = append(errors, ProcessingRequestValidationError{
208 field: "ResponseHeaders",
209 reason: "embedded message failed validation",
210 cause: err,
211 })
212 }
213 }
214 } else if v, ok := interface{}(m.GetResponseHeaders()).(interface{ Validate() error }); ok {
215 if err := v.Validate(); err != nil {
216 return ProcessingRequestValidationError{
217 field: "ResponseHeaders",
218 reason: "embedded message failed validation",
219 cause: err,
220 }
221 }
222 }
223
224 case *ProcessingRequest_RequestBody:
225 if v == nil {
226 err := ProcessingRequestValidationError{
227 field: "Request",
228 reason: "oneof value cannot be a typed-nil",
229 }
230 if !all {
231 return err
232 }
233 errors = append(errors, err)
234 }
235 oneofRequestPresent = true
236
237 if all {
238 switch v := interface{}(m.GetRequestBody()).(type) {
239 case interface{ ValidateAll() error }:
240 if err := v.ValidateAll(); err != nil {
241 errors = append(errors, ProcessingRequestValidationError{
242 field: "RequestBody",
243 reason: "embedded message failed validation",
244 cause: err,
245 })
246 }
247 case interface{ Validate() error }:
248 if err := v.Validate(); err != nil {
249 errors = append(errors, ProcessingRequestValidationError{
250 field: "RequestBody",
251 reason: "embedded message failed validation",
252 cause: err,
253 })
254 }
255 }
256 } else if v, ok := interface{}(m.GetRequestBody()).(interface{ Validate() error }); ok {
257 if err := v.Validate(); err != nil {
258 return ProcessingRequestValidationError{
259 field: "RequestBody",
260 reason: "embedded message failed validation",
261 cause: err,
262 }
263 }
264 }
265
266 case *ProcessingRequest_ResponseBody:
267 if v == nil {
268 err := ProcessingRequestValidationError{
269 field: "Request",
270 reason: "oneof value cannot be a typed-nil",
271 }
272 if !all {
273 return err
274 }
275 errors = append(errors, err)
276 }
277 oneofRequestPresent = true
278
279 if all {
280 switch v := interface{}(m.GetResponseBody()).(type) {
281 case interface{ ValidateAll() error }:
282 if err := v.ValidateAll(); err != nil {
283 errors = append(errors, ProcessingRequestValidationError{
284 field: "ResponseBody",
285 reason: "embedded message failed validation",
286 cause: err,
287 })
288 }
289 case interface{ Validate() error }:
290 if err := v.Validate(); err != nil {
291 errors = append(errors, ProcessingRequestValidationError{
292 field: "ResponseBody",
293 reason: "embedded message failed validation",
294 cause: err,
295 })
296 }
297 }
298 } else if v, ok := interface{}(m.GetResponseBody()).(interface{ Validate() error }); ok {
299 if err := v.Validate(); err != nil {
300 return ProcessingRequestValidationError{
301 field: "ResponseBody",
302 reason: "embedded message failed validation",
303 cause: err,
304 }
305 }
306 }
307
308 case *ProcessingRequest_RequestTrailers:
309 if v == nil {
310 err := ProcessingRequestValidationError{
311 field: "Request",
312 reason: "oneof value cannot be a typed-nil",
313 }
314 if !all {
315 return err
316 }
317 errors = append(errors, err)
318 }
319 oneofRequestPresent = true
320
321 if all {
322 switch v := interface{}(m.GetRequestTrailers()).(type) {
323 case interface{ ValidateAll() error }:
324 if err := v.ValidateAll(); err != nil {
325 errors = append(errors, ProcessingRequestValidationError{
326 field: "RequestTrailers",
327 reason: "embedded message failed validation",
328 cause: err,
329 })
330 }
331 case interface{ Validate() error }:
332 if err := v.Validate(); err != nil {
333 errors = append(errors, ProcessingRequestValidationError{
334 field: "RequestTrailers",
335 reason: "embedded message failed validation",
336 cause: err,
337 })
338 }
339 }
340 } else if v, ok := interface{}(m.GetRequestTrailers()).(interface{ Validate() error }); ok {
341 if err := v.Validate(); err != nil {
342 return ProcessingRequestValidationError{
343 field: "RequestTrailers",
344 reason: "embedded message failed validation",
345 cause: err,
346 }
347 }
348 }
349
350 case *ProcessingRequest_ResponseTrailers:
351 if v == nil {
352 err := ProcessingRequestValidationError{
353 field: "Request",
354 reason: "oneof value cannot be a typed-nil",
355 }
356 if !all {
357 return err
358 }
359 errors = append(errors, err)
360 }
361 oneofRequestPresent = true
362
363 if all {
364 switch v := interface{}(m.GetResponseTrailers()).(type) {
365 case interface{ ValidateAll() error }:
366 if err := v.ValidateAll(); err != nil {
367 errors = append(errors, ProcessingRequestValidationError{
368 field: "ResponseTrailers",
369 reason: "embedded message failed validation",
370 cause: err,
371 })
372 }
373 case interface{ Validate() error }:
374 if err := v.Validate(); err != nil {
375 errors = append(errors, ProcessingRequestValidationError{
376 field: "ResponseTrailers",
377 reason: "embedded message failed validation",
378 cause: err,
379 })
380 }
381 }
382 } else if v, ok := interface{}(m.GetResponseTrailers()).(interface{ Validate() error }); ok {
383 if err := v.Validate(); err != nil {
384 return ProcessingRequestValidationError{
385 field: "ResponseTrailers",
386 reason: "embedded message failed validation",
387 cause: err,
388 }
389 }
390 }
391
392 default:
393 _ = v // ensures v is used
394 }
395 if !oneofRequestPresent {
396 err := ProcessingRequestValidationError{
397 field: "Request",
398 reason: "value is required",
399 }
400 if !all {
401 return err
402 }
403 errors = append(errors, err)
404 }
405
406 if len(errors) > 0 {
407 return ProcessingRequestMultiError(errors)
408 }
409
410 return nil
411 }
412
413 // ProcessingRequestMultiError is an error wrapping multiple validation errors
414 // returned by ProcessingRequest.ValidateAll() if the designated constraints
415 // aren't met.
416 type ProcessingRequestMultiError []error
417
418 // Error returns a concatenation of all the error messages it wraps.
419 func (m ProcessingRequestMultiError) Error() string {
420 var msgs []string
421 for _, err := range m {
422 msgs = append(msgs, err.Error())
423 }
424 return strings.Join(msgs, "; ")
425 }
426
427 // AllErrors returns a list of validation violation errors.
428 func (m ProcessingRequestMultiError) AllErrors() []error { return m }
429
430 // ProcessingRequestValidationError is the validation error returned by
431 // ProcessingRequest.Validate if the designated constraints aren't met.
432 type ProcessingRequestValidationError struct {
433 field string
434 reason string
435 cause error
436 key bool
437 }
438
439 // Field function returns field value.
440 func (e ProcessingRequestValidationError) Field() string { return e.field }
441
442 // Reason function returns reason value.
443 func (e ProcessingRequestValidationError) Reason() string { return e.reason }
444
445 // Cause function returns cause value.
446 func (e ProcessingRequestValidationError) Cause() error { return e.cause }
447
448 // Key function returns key value.
449 func (e ProcessingRequestValidationError) Key() bool { return e.key }
450
451 // ErrorName returns error name.
452 func (e ProcessingRequestValidationError) ErrorName() string {
453 return "ProcessingRequestValidationError"
454 }
455
456 // Error satisfies the builtin error interface
457 func (e ProcessingRequestValidationError) Error() string {
458 cause := ""
459 if e.cause != nil {
460 cause = fmt.Sprintf(" | caused by: %v", e.cause)
461 }
462
463 key := ""
464 if e.key {
465 key = "key for "
466 }
467
468 return fmt.Sprintf(
469 "invalid %sProcessingRequest.%s: %s%s",
470 key,
471 e.field,
472 e.reason,
473 cause)
474 }
475
476 var _ error = ProcessingRequestValidationError{}
477
478 var _ interface {
479 Field() string
480 Reason() string
481 Key() bool
482 Cause() error
483 ErrorName() string
484 } = ProcessingRequestValidationError{}
485
486 // Validate checks the field values on ProcessingResponse with the rules
487 // defined in the proto definition for this message. If any rules are
488 // violated, the first error encountered is returned, or nil if there are no violations.
489 func (m *ProcessingResponse) Validate() error {
490 return m.validate(false)
491 }
492
493 // ValidateAll checks the field values on ProcessingResponse with the rules
494 // defined in the proto definition for this message. If any rules are
495 // violated, the result is a list of violation errors wrapped in
496 // ProcessingResponseMultiError, or nil if none found.
497 func (m *ProcessingResponse) ValidateAll() error {
498 return m.validate(true)
499 }
500
501 func (m *ProcessingResponse) validate(all bool) error {
502 if m == nil {
503 return nil
504 }
505
506 var errors []error
507
508 if all {
509 switch v := interface{}(m.GetDynamicMetadata()).(type) {
510 case interface{ ValidateAll() error }:
511 if err := v.ValidateAll(); err != nil {
512 errors = append(errors, ProcessingResponseValidationError{
513 field: "DynamicMetadata",
514 reason: "embedded message failed validation",
515 cause: err,
516 })
517 }
518 case interface{ Validate() error }:
519 if err := v.Validate(); err != nil {
520 errors = append(errors, ProcessingResponseValidationError{
521 field: "DynamicMetadata",
522 reason: "embedded message failed validation",
523 cause: err,
524 })
525 }
526 }
527 } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok {
528 if err := v.Validate(); err != nil {
529 return ProcessingResponseValidationError{
530 field: "DynamicMetadata",
531 reason: "embedded message failed validation",
532 cause: err,
533 }
534 }
535 }
536
537 if all {
538 switch v := interface{}(m.GetModeOverride()).(type) {
539 case interface{ ValidateAll() error }:
540 if err := v.ValidateAll(); err != nil {
541 errors = append(errors, ProcessingResponseValidationError{
542 field: "ModeOverride",
543 reason: "embedded message failed validation",
544 cause: err,
545 })
546 }
547 case interface{ Validate() error }:
548 if err := v.Validate(); err != nil {
549 errors = append(errors, ProcessingResponseValidationError{
550 field: "ModeOverride",
551 reason: "embedded message failed validation",
552 cause: err,
553 })
554 }
555 }
556 } else if v, ok := interface{}(m.GetModeOverride()).(interface{ Validate() error }); ok {
557 if err := v.Validate(); err != nil {
558 return ProcessingResponseValidationError{
559 field: "ModeOverride",
560 reason: "embedded message failed validation",
561 cause: err,
562 }
563 }
564 }
565
566 if all {
567 switch v := interface{}(m.GetOverrideMessageTimeout()).(type) {
568 case interface{ ValidateAll() error }:
569 if err := v.ValidateAll(); err != nil {
570 errors = append(errors, ProcessingResponseValidationError{
571 field: "OverrideMessageTimeout",
572 reason: "embedded message failed validation",
573 cause: err,
574 })
575 }
576 case interface{ Validate() error }:
577 if err := v.Validate(); err != nil {
578 errors = append(errors, ProcessingResponseValidationError{
579 field: "OverrideMessageTimeout",
580 reason: "embedded message failed validation",
581 cause: err,
582 })
583 }
584 }
585 } else if v, ok := interface{}(m.GetOverrideMessageTimeout()).(interface{ Validate() error }); ok {
586 if err := v.Validate(); err != nil {
587 return ProcessingResponseValidationError{
588 field: "OverrideMessageTimeout",
589 reason: "embedded message failed validation",
590 cause: err,
591 }
592 }
593 }
594
595 oneofResponsePresent := false
596 switch v := m.Response.(type) {
597 case *ProcessingResponse_RequestHeaders:
598 if v == nil {
599 err := ProcessingResponseValidationError{
600 field: "Response",
601 reason: "oneof value cannot be a typed-nil",
602 }
603 if !all {
604 return err
605 }
606 errors = append(errors, err)
607 }
608 oneofResponsePresent = true
609
610 if all {
611 switch v := interface{}(m.GetRequestHeaders()).(type) {
612 case interface{ ValidateAll() error }:
613 if err := v.ValidateAll(); err != nil {
614 errors = append(errors, ProcessingResponseValidationError{
615 field: "RequestHeaders",
616 reason: "embedded message failed validation",
617 cause: err,
618 })
619 }
620 case interface{ Validate() error }:
621 if err := v.Validate(); err != nil {
622 errors = append(errors, ProcessingResponseValidationError{
623 field: "RequestHeaders",
624 reason: "embedded message failed validation",
625 cause: err,
626 })
627 }
628 }
629 } else if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok {
630 if err := v.Validate(); err != nil {
631 return ProcessingResponseValidationError{
632 field: "RequestHeaders",
633 reason: "embedded message failed validation",
634 cause: err,
635 }
636 }
637 }
638
639 case *ProcessingResponse_ResponseHeaders:
640 if v == nil {
641 err := ProcessingResponseValidationError{
642 field: "Response",
643 reason: "oneof value cannot be a typed-nil",
644 }
645 if !all {
646 return err
647 }
648 errors = append(errors, err)
649 }
650 oneofResponsePresent = true
651
652 if all {
653 switch v := interface{}(m.GetResponseHeaders()).(type) {
654 case interface{ ValidateAll() error }:
655 if err := v.ValidateAll(); err != nil {
656 errors = append(errors, ProcessingResponseValidationError{
657 field: "ResponseHeaders",
658 reason: "embedded message failed validation",
659 cause: err,
660 })
661 }
662 case interface{ Validate() error }:
663 if err := v.Validate(); err != nil {
664 errors = append(errors, ProcessingResponseValidationError{
665 field: "ResponseHeaders",
666 reason: "embedded message failed validation",
667 cause: err,
668 })
669 }
670 }
671 } else if v, ok := interface{}(m.GetResponseHeaders()).(interface{ Validate() error }); ok {
672 if err := v.Validate(); err != nil {
673 return ProcessingResponseValidationError{
674 field: "ResponseHeaders",
675 reason: "embedded message failed validation",
676 cause: err,
677 }
678 }
679 }
680
681 case *ProcessingResponse_RequestBody:
682 if v == nil {
683 err := ProcessingResponseValidationError{
684 field: "Response",
685 reason: "oneof value cannot be a typed-nil",
686 }
687 if !all {
688 return err
689 }
690 errors = append(errors, err)
691 }
692 oneofResponsePresent = true
693
694 if all {
695 switch v := interface{}(m.GetRequestBody()).(type) {
696 case interface{ ValidateAll() error }:
697 if err := v.ValidateAll(); err != nil {
698 errors = append(errors, ProcessingResponseValidationError{
699 field: "RequestBody",
700 reason: "embedded message failed validation",
701 cause: err,
702 })
703 }
704 case interface{ Validate() error }:
705 if err := v.Validate(); err != nil {
706 errors = append(errors, ProcessingResponseValidationError{
707 field: "RequestBody",
708 reason: "embedded message failed validation",
709 cause: err,
710 })
711 }
712 }
713 } else if v, ok := interface{}(m.GetRequestBody()).(interface{ Validate() error }); ok {
714 if err := v.Validate(); err != nil {
715 return ProcessingResponseValidationError{
716 field: "RequestBody",
717 reason: "embedded message failed validation",
718 cause: err,
719 }
720 }
721 }
722
723 case *ProcessingResponse_ResponseBody:
724 if v == nil {
725 err := ProcessingResponseValidationError{
726 field: "Response",
727 reason: "oneof value cannot be a typed-nil",
728 }
729 if !all {
730 return err
731 }
732 errors = append(errors, err)
733 }
734 oneofResponsePresent = true
735
736 if all {
737 switch v := interface{}(m.GetResponseBody()).(type) {
738 case interface{ ValidateAll() error }:
739 if err := v.ValidateAll(); err != nil {
740 errors = append(errors, ProcessingResponseValidationError{
741 field: "ResponseBody",
742 reason: "embedded message failed validation",
743 cause: err,
744 })
745 }
746 case interface{ Validate() error }:
747 if err := v.Validate(); err != nil {
748 errors = append(errors, ProcessingResponseValidationError{
749 field: "ResponseBody",
750 reason: "embedded message failed validation",
751 cause: err,
752 })
753 }
754 }
755 } else if v, ok := interface{}(m.GetResponseBody()).(interface{ Validate() error }); ok {
756 if err := v.Validate(); err != nil {
757 return ProcessingResponseValidationError{
758 field: "ResponseBody",
759 reason: "embedded message failed validation",
760 cause: err,
761 }
762 }
763 }
764
765 case *ProcessingResponse_RequestTrailers:
766 if v == nil {
767 err := ProcessingResponseValidationError{
768 field: "Response",
769 reason: "oneof value cannot be a typed-nil",
770 }
771 if !all {
772 return err
773 }
774 errors = append(errors, err)
775 }
776 oneofResponsePresent = true
777
778 if all {
779 switch v := interface{}(m.GetRequestTrailers()).(type) {
780 case interface{ ValidateAll() error }:
781 if err := v.ValidateAll(); err != nil {
782 errors = append(errors, ProcessingResponseValidationError{
783 field: "RequestTrailers",
784 reason: "embedded message failed validation",
785 cause: err,
786 })
787 }
788 case interface{ Validate() error }:
789 if err := v.Validate(); err != nil {
790 errors = append(errors, ProcessingResponseValidationError{
791 field: "RequestTrailers",
792 reason: "embedded message failed validation",
793 cause: err,
794 })
795 }
796 }
797 } else if v, ok := interface{}(m.GetRequestTrailers()).(interface{ Validate() error }); ok {
798 if err := v.Validate(); err != nil {
799 return ProcessingResponseValidationError{
800 field: "RequestTrailers",
801 reason: "embedded message failed validation",
802 cause: err,
803 }
804 }
805 }
806
807 case *ProcessingResponse_ResponseTrailers:
808 if v == nil {
809 err := ProcessingResponseValidationError{
810 field: "Response",
811 reason: "oneof value cannot be a typed-nil",
812 }
813 if !all {
814 return err
815 }
816 errors = append(errors, err)
817 }
818 oneofResponsePresent = true
819
820 if all {
821 switch v := interface{}(m.GetResponseTrailers()).(type) {
822 case interface{ ValidateAll() error }:
823 if err := v.ValidateAll(); err != nil {
824 errors = append(errors, ProcessingResponseValidationError{
825 field: "ResponseTrailers",
826 reason: "embedded message failed validation",
827 cause: err,
828 })
829 }
830 case interface{ Validate() error }:
831 if err := v.Validate(); err != nil {
832 errors = append(errors, ProcessingResponseValidationError{
833 field: "ResponseTrailers",
834 reason: "embedded message failed validation",
835 cause: err,
836 })
837 }
838 }
839 } else if v, ok := interface{}(m.GetResponseTrailers()).(interface{ Validate() error }); ok {
840 if err := v.Validate(); err != nil {
841 return ProcessingResponseValidationError{
842 field: "ResponseTrailers",
843 reason: "embedded message failed validation",
844 cause: err,
845 }
846 }
847 }
848
849 case *ProcessingResponse_ImmediateResponse:
850 if v == nil {
851 err := ProcessingResponseValidationError{
852 field: "Response",
853 reason: "oneof value cannot be a typed-nil",
854 }
855 if !all {
856 return err
857 }
858 errors = append(errors, err)
859 }
860 oneofResponsePresent = true
861
862 if all {
863 switch v := interface{}(m.GetImmediateResponse()).(type) {
864 case interface{ ValidateAll() error }:
865 if err := v.ValidateAll(); err != nil {
866 errors = append(errors, ProcessingResponseValidationError{
867 field: "ImmediateResponse",
868 reason: "embedded message failed validation",
869 cause: err,
870 })
871 }
872 case interface{ Validate() error }:
873 if err := v.Validate(); err != nil {
874 errors = append(errors, ProcessingResponseValidationError{
875 field: "ImmediateResponse",
876 reason: "embedded message failed validation",
877 cause: err,
878 })
879 }
880 }
881 } else if v, ok := interface{}(m.GetImmediateResponse()).(interface{ Validate() error }); ok {
882 if err := v.Validate(); err != nil {
883 return ProcessingResponseValidationError{
884 field: "ImmediateResponse",
885 reason: "embedded message failed validation",
886 cause: err,
887 }
888 }
889 }
890
891 default:
892 _ = v // ensures v is used
893 }
894 if !oneofResponsePresent {
895 err := ProcessingResponseValidationError{
896 field: "Response",
897 reason: "value is required",
898 }
899 if !all {
900 return err
901 }
902 errors = append(errors, err)
903 }
904
905 if len(errors) > 0 {
906 return ProcessingResponseMultiError(errors)
907 }
908
909 return nil
910 }
911
912 // ProcessingResponseMultiError is an error wrapping multiple validation errors
913 // returned by ProcessingResponse.ValidateAll() if the designated constraints
914 // aren't met.
915 type ProcessingResponseMultiError []error
916
917 // Error returns a concatenation of all the error messages it wraps.
918 func (m ProcessingResponseMultiError) Error() string {
919 var msgs []string
920 for _, err := range m {
921 msgs = append(msgs, err.Error())
922 }
923 return strings.Join(msgs, "; ")
924 }
925
926 // AllErrors returns a list of validation violation errors.
927 func (m ProcessingResponseMultiError) AllErrors() []error { return m }
928
929 // ProcessingResponseValidationError is the validation error returned by
930 // ProcessingResponse.Validate if the designated constraints aren't met.
931 type ProcessingResponseValidationError struct {
932 field string
933 reason string
934 cause error
935 key bool
936 }
937
938 // Field function returns field value.
939 func (e ProcessingResponseValidationError) Field() string { return e.field }
940
941 // Reason function returns reason value.
942 func (e ProcessingResponseValidationError) Reason() string { return e.reason }
943
944 // Cause function returns cause value.
945 func (e ProcessingResponseValidationError) Cause() error { return e.cause }
946
947 // Key function returns key value.
948 func (e ProcessingResponseValidationError) Key() bool { return e.key }
949
950 // ErrorName returns error name.
951 func (e ProcessingResponseValidationError) ErrorName() string {
952 return "ProcessingResponseValidationError"
953 }
954
955 // Error satisfies the builtin error interface
956 func (e ProcessingResponseValidationError) Error() string {
957 cause := ""
958 if e.cause != nil {
959 cause = fmt.Sprintf(" | caused by: %v", e.cause)
960 }
961
962 key := ""
963 if e.key {
964 key = "key for "
965 }
966
967 return fmt.Sprintf(
968 "invalid %sProcessingResponse.%s: %s%s",
969 key,
970 e.field,
971 e.reason,
972 cause)
973 }
974
975 var _ error = ProcessingResponseValidationError{}
976
977 var _ interface {
978 Field() string
979 Reason() string
980 Key() bool
981 Cause() error
982 ErrorName() string
983 } = ProcessingResponseValidationError{}
984
985 // Validate checks the field values on HttpHeaders with the rules defined in
986 // the proto definition for this message. If any rules are violated, the first
987 // error encountered is returned, or nil if there are no violations.
988 func (m *HttpHeaders) Validate() error {
989 return m.validate(false)
990 }
991
992 // ValidateAll checks the field values on HttpHeaders with the rules defined in
993 // the proto definition for this message. If any rules are violated, the
994 // result is a list of violation errors wrapped in HttpHeadersMultiError, or
995 // nil if none found.
996 func (m *HttpHeaders) ValidateAll() error {
997 return m.validate(true)
998 }
999
1000 func (m *HttpHeaders) validate(all bool) error {
1001 if m == nil {
1002 return nil
1003 }
1004
1005 var errors []error
1006
1007 if all {
1008 switch v := interface{}(m.GetHeaders()).(type) {
1009 case interface{ ValidateAll() error }:
1010 if err := v.ValidateAll(); err != nil {
1011 errors = append(errors, HttpHeadersValidationError{
1012 field: "Headers",
1013 reason: "embedded message failed validation",
1014 cause: err,
1015 })
1016 }
1017 case interface{ Validate() error }:
1018 if err := v.Validate(); err != nil {
1019 errors = append(errors, HttpHeadersValidationError{
1020 field: "Headers",
1021 reason: "embedded message failed validation",
1022 cause: err,
1023 })
1024 }
1025 }
1026 } else if v, ok := interface{}(m.GetHeaders()).(interface{ Validate() error }); ok {
1027 if err := v.Validate(); err != nil {
1028 return HttpHeadersValidationError{
1029 field: "Headers",
1030 reason: "embedded message failed validation",
1031 cause: err,
1032 }
1033 }
1034 }
1035
1036 {
1037 sorted_keys := make([]string, len(m.GetAttributes()))
1038 i := 0
1039 for key := range m.GetAttributes() {
1040 sorted_keys[i] = key
1041 i++
1042 }
1043 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
1044 for _, key := range sorted_keys {
1045 val := m.GetAttributes()[key]
1046 _ = val
1047
1048 // no validation rules for Attributes[key]
1049
1050 if all {
1051 switch v := interface{}(val).(type) {
1052 case interface{ ValidateAll() error }:
1053 if err := v.ValidateAll(); err != nil {
1054 errors = append(errors, HttpHeadersValidationError{
1055 field: fmt.Sprintf("Attributes[%v]", key),
1056 reason: "embedded message failed validation",
1057 cause: err,
1058 })
1059 }
1060 case interface{ Validate() error }:
1061 if err := v.Validate(); err != nil {
1062 errors = append(errors, HttpHeadersValidationError{
1063 field: fmt.Sprintf("Attributes[%v]", key),
1064 reason: "embedded message failed validation",
1065 cause: err,
1066 })
1067 }
1068 }
1069 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
1070 if err := v.Validate(); err != nil {
1071 return HttpHeadersValidationError{
1072 field: fmt.Sprintf("Attributes[%v]", key),
1073 reason: "embedded message failed validation",
1074 cause: err,
1075 }
1076 }
1077 }
1078
1079 }
1080 }
1081
1082 // no validation rules for EndOfStream
1083
1084 if len(errors) > 0 {
1085 return HttpHeadersMultiError(errors)
1086 }
1087
1088 return nil
1089 }
1090
1091 // HttpHeadersMultiError is an error wrapping multiple validation errors
1092 // returned by HttpHeaders.ValidateAll() if the designated constraints aren't met.
1093 type HttpHeadersMultiError []error
1094
1095 // Error returns a concatenation of all the error messages it wraps.
1096 func (m HttpHeadersMultiError) Error() string {
1097 var msgs []string
1098 for _, err := range m {
1099 msgs = append(msgs, err.Error())
1100 }
1101 return strings.Join(msgs, "; ")
1102 }
1103
1104 // AllErrors returns a list of validation violation errors.
1105 func (m HttpHeadersMultiError) AllErrors() []error { return m }
1106
1107 // HttpHeadersValidationError is the validation error returned by
1108 // HttpHeaders.Validate if the designated constraints aren't met.
1109 type HttpHeadersValidationError struct {
1110 field string
1111 reason string
1112 cause error
1113 key bool
1114 }
1115
1116 // Field function returns field value.
1117 func (e HttpHeadersValidationError) Field() string { return e.field }
1118
1119 // Reason function returns reason value.
1120 func (e HttpHeadersValidationError) Reason() string { return e.reason }
1121
1122 // Cause function returns cause value.
1123 func (e HttpHeadersValidationError) Cause() error { return e.cause }
1124
1125 // Key function returns key value.
1126 func (e HttpHeadersValidationError) Key() bool { return e.key }
1127
1128 // ErrorName returns error name.
1129 func (e HttpHeadersValidationError) ErrorName() string { return "HttpHeadersValidationError" }
1130
1131 // Error satisfies the builtin error interface
1132 func (e HttpHeadersValidationError) Error() string {
1133 cause := ""
1134 if e.cause != nil {
1135 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1136 }
1137
1138 key := ""
1139 if e.key {
1140 key = "key for "
1141 }
1142
1143 return fmt.Sprintf(
1144 "invalid %sHttpHeaders.%s: %s%s",
1145 key,
1146 e.field,
1147 e.reason,
1148 cause)
1149 }
1150
1151 var _ error = HttpHeadersValidationError{}
1152
1153 var _ interface {
1154 Field() string
1155 Reason() string
1156 Key() bool
1157 Cause() error
1158 ErrorName() string
1159 } = HttpHeadersValidationError{}
1160
1161 // Validate checks the field values on HttpBody with the rules defined in the
1162 // proto definition for this message. If any rules are violated, the first
1163 // error encountered is returned, or nil if there are no violations.
1164 func (m *HttpBody) Validate() error {
1165 return m.validate(false)
1166 }
1167
1168 // ValidateAll checks the field values on HttpBody with the rules defined in
1169 // the proto definition for this message. If any rules are violated, the
1170 // result is a list of violation errors wrapped in HttpBodyMultiError, or nil
1171 // if none found.
1172 func (m *HttpBody) ValidateAll() error {
1173 return m.validate(true)
1174 }
1175
1176 func (m *HttpBody) validate(all bool) error {
1177 if m == nil {
1178 return nil
1179 }
1180
1181 var errors []error
1182
1183 // no validation rules for Body
1184
1185 // no validation rules for EndOfStream
1186
1187 if len(errors) > 0 {
1188 return HttpBodyMultiError(errors)
1189 }
1190
1191 return nil
1192 }
1193
1194 // HttpBodyMultiError is an error wrapping multiple validation errors returned
1195 // by HttpBody.ValidateAll() if the designated constraints aren't met.
1196 type HttpBodyMultiError []error
1197
1198 // Error returns a concatenation of all the error messages it wraps.
1199 func (m HttpBodyMultiError) Error() string {
1200 var msgs []string
1201 for _, err := range m {
1202 msgs = append(msgs, err.Error())
1203 }
1204 return strings.Join(msgs, "; ")
1205 }
1206
1207 // AllErrors returns a list of validation violation errors.
1208 func (m HttpBodyMultiError) AllErrors() []error { return m }
1209
1210 // HttpBodyValidationError is the validation error returned by
1211 // HttpBody.Validate if the designated constraints aren't met.
1212 type HttpBodyValidationError struct {
1213 field string
1214 reason string
1215 cause error
1216 key bool
1217 }
1218
1219 // Field function returns field value.
1220 func (e HttpBodyValidationError) Field() string { return e.field }
1221
1222 // Reason function returns reason value.
1223 func (e HttpBodyValidationError) Reason() string { return e.reason }
1224
1225 // Cause function returns cause value.
1226 func (e HttpBodyValidationError) Cause() error { return e.cause }
1227
1228 // Key function returns key value.
1229 func (e HttpBodyValidationError) Key() bool { return e.key }
1230
1231 // ErrorName returns error name.
1232 func (e HttpBodyValidationError) ErrorName() string { return "HttpBodyValidationError" }
1233
1234 // Error satisfies the builtin error interface
1235 func (e HttpBodyValidationError) Error() string {
1236 cause := ""
1237 if e.cause != nil {
1238 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1239 }
1240
1241 key := ""
1242 if e.key {
1243 key = "key for "
1244 }
1245
1246 return fmt.Sprintf(
1247 "invalid %sHttpBody.%s: %s%s",
1248 key,
1249 e.field,
1250 e.reason,
1251 cause)
1252 }
1253
1254 var _ error = HttpBodyValidationError{}
1255
1256 var _ interface {
1257 Field() string
1258 Reason() string
1259 Key() bool
1260 Cause() error
1261 ErrorName() string
1262 } = HttpBodyValidationError{}
1263
1264 // Validate checks the field values on HttpTrailers with the rules defined in
1265 // the proto definition for this message. If any rules are violated, the first
1266 // error encountered is returned, or nil if there are no violations.
1267 func (m *HttpTrailers) Validate() error {
1268 return m.validate(false)
1269 }
1270
1271 // ValidateAll checks the field values on HttpTrailers with the rules defined
1272 // in the proto definition for this message. If any rules are violated, the
1273 // result is a list of violation errors wrapped in HttpTrailersMultiError, or
1274 // nil if none found.
1275 func (m *HttpTrailers) ValidateAll() error {
1276 return m.validate(true)
1277 }
1278
1279 func (m *HttpTrailers) validate(all bool) error {
1280 if m == nil {
1281 return nil
1282 }
1283
1284 var errors []error
1285
1286 if all {
1287 switch v := interface{}(m.GetTrailers()).(type) {
1288 case interface{ ValidateAll() error }:
1289 if err := v.ValidateAll(); err != nil {
1290 errors = append(errors, HttpTrailersValidationError{
1291 field: "Trailers",
1292 reason: "embedded message failed validation",
1293 cause: err,
1294 })
1295 }
1296 case interface{ Validate() error }:
1297 if err := v.Validate(); err != nil {
1298 errors = append(errors, HttpTrailersValidationError{
1299 field: "Trailers",
1300 reason: "embedded message failed validation",
1301 cause: err,
1302 })
1303 }
1304 }
1305 } else if v, ok := interface{}(m.GetTrailers()).(interface{ Validate() error }); ok {
1306 if err := v.Validate(); err != nil {
1307 return HttpTrailersValidationError{
1308 field: "Trailers",
1309 reason: "embedded message failed validation",
1310 cause: err,
1311 }
1312 }
1313 }
1314
1315 if len(errors) > 0 {
1316 return HttpTrailersMultiError(errors)
1317 }
1318
1319 return nil
1320 }
1321
1322 // HttpTrailersMultiError is an error wrapping multiple validation errors
1323 // returned by HttpTrailers.ValidateAll() if the designated constraints aren't met.
1324 type HttpTrailersMultiError []error
1325
1326 // Error returns a concatenation of all the error messages it wraps.
1327 func (m HttpTrailersMultiError) Error() string {
1328 var msgs []string
1329 for _, err := range m {
1330 msgs = append(msgs, err.Error())
1331 }
1332 return strings.Join(msgs, "; ")
1333 }
1334
1335 // AllErrors returns a list of validation violation errors.
1336 func (m HttpTrailersMultiError) AllErrors() []error { return m }
1337
1338 // HttpTrailersValidationError is the validation error returned by
1339 // HttpTrailers.Validate if the designated constraints aren't met.
1340 type HttpTrailersValidationError struct {
1341 field string
1342 reason string
1343 cause error
1344 key bool
1345 }
1346
1347 // Field function returns field value.
1348 func (e HttpTrailersValidationError) Field() string { return e.field }
1349
1350 // Reason function returns reason value.
1351 func (e HttpTrailersValidationError) Reason() string { return e.reason }
1352
1353 // Cause function returns cause value.
1354 func (e HttpTrailersValidationError) Cause() error { return e.cause }
1355
1356 // Key function returns key value.
1357 func (e HttpTrailersValidationError) Key() bool { return e.key }
1358
1359 // ErrorName returns error name.
1360 func (e HttpTrailersValidationError) ErrorName() string { return "HttpTrailersValidationError" }
1361
1362 // Error satisfies the builtin error interface
1363 func (e HttpTrailersValidationError) Error() string {
1364 cause := ""
1365 if e.cause != nil {
1366 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1367 }
1368
1369 key := ""
1370 if e.key {
1371 key = "key for "
1372 }
1373
1374 return fmt.Sprintf(
1375 "invalid %sHttpTrailers.%s: %s%s",
1376 key,
1377 e.field,
1378 e.reason,
1379 cause)
1380 }
1381
1382 var _ error = HttpTrailersValidationError{}
1383
1384 var _ interface {
1385 Field() string
1386 Reason() string
1387 Key() bool
1388 Cause() error
1389 ErrorName() string
1390 } = HttpTrailersValidationError{}
1391
1392 // Validate checks the field values on HeadersResponse with the rules defined
1393 // in the proto definition for this message. If any rules are violated, the
1394 // first error encountered is returned, or nil if there are no violations.
1395 func (m *HeadersResponse) Validate() error {
1396 return m.validate(false)
1397 }
1398
1399 // ValidateAll checks the field values on HeadersResponse with the rules
1400 // defined in the proto definition for this message. If any rules are
1401 // violated, the result is a list of violation errors wrapped in
1402 // HeadersResponseMultiError, or nil if none found.
1403 func (m *HeadersResponse) ValidateAll() error {
1404 return m.validate(true)
1405 }
1406
1407 func (m *HeadersResponse) validate(all bool) error {
1408 if m == nil {
1409 return nil
1410 }
1411
1412 var errors []error
1413
1414 if all {
1415 switch v := interface{}(m.GetResponse()).(type) {
1416 case interface{ ValidateAll() error }:
1417 if err := v.ValidateAll(); err != nil {
1418 errors = append(errors, HeadersResponseValidationError{
1419 field: "Response",
1420 reason: "embedded message failed validation",
1421 cause: err,
1422 })
1423 }
1424 case interface{ Validate() error }:
1425 if err := v.Validate(); err != nil {
1426 errors = append(errors, HeadersResponseValidationError{
1427 field: "Response",
1428 reason: "embedded message failed validation",
1429 cause: err,
1430 })
1431 }
1432 }
1433 } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok {
1434 if err := v.Validate(); err != nil {
1435 return HeadersResponseValidationError{
1436 field: "Response",
1437 reason: "embedded message failed validation",
1438 cause: err,
1439 }
1440 }
1441 }
1442
1443 if len(errors) > 0 {
1444 return HeadersResponseMultiError(errors)
1445 }
1446
1447 return nil
1448 }
1449
1450 // HeadersResponseMultiError is an error wrapping multiple validation errors
1451 // returned by HeadersResponse.ValidateAll() if the designated constraints
1452 // aren't met.
1453 type HeadersResponseMultiError []error
1454
1455 // Error returns a concatenation of all the error messages it wraps.
1456 func (m HeadersResponseMultiError) Error() string {
1457 var msgs []string
1458 for _, err := range m {
1459 msgs = append(msgs, err.Error())
1460 }
1461 return strings.Join(msgs, "; ")
1462 }
1463
1464 // AllErrors returns a list of validation violation errors.
1465 func (m HeadersResponseMultiError) AllErrors() []error { return m }
1466
1467 // HeadersResponseValidationError is the validation error returned by
1468 // HeadersResponse.Validate if the designated constraints aren't met.
1469 type HeadersResponseValidationError struct {
1470 field string
1471 reason string
1472 cause error
1473 key bool
1474 }
1475
1476 // Field function returns field value.
1477 func (e HeadersResponseValidationError) Field() string { return e.field }
1478
1479 // Reason function returns reason value.
1480 func (e HeadersResponseValidationError) Reason() string { return e.reason }
1481
1482 // Cause function returns cause value.
1483 func (e HeadersResponseValidationError) Cause() error { return e.cause }
1484
1485 // Key function returns key value.
1486 func (e HeadersResponseValidationError) Key() bool { return e.key }
1487
1488 // ErrorName returns error name.
1489 func (e HeadersResponseValidationError) ErrorName() string { return "HeadersResponseValidationError" }
1490
1491 // Error satisfies the builtin error interface
1492 func (e HeadersResponseValidationError) Error() string {
1493 cause := ""
1494 if e.cause != nil {
1495 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1496 }
1497
1498 key := ""
1499 if e.key {
1500 key = "key for "
1501 }
1502
1503 return fmt.Sprintf(
1504 "invalid %sHeadersResponse.%s: %s%s",
1505 key,
1506 e.field,
1507 e.reason,
1508 cause)
1509 }
1510
1511 var _ error = HeadersResponseValidationError{}
1512
1513 var _ interface {
1514 Field() string
1515 Reason() string
1516 Key() bool
1517 Cause() error
1518 ErrorName() string
1519 } = HeadersResponseValidationError{}
1520
1521 // Validate checks the field values on BodyResponse with the rules defined in
1522 // the proto definition for this message. If any rules are violated, the first
1523 // error encountered is returned, or nil if there are no violations.
1524 func (m *BodyResponse) Validate() error {
1525 return m.validate(false)
1526 }
1527
1528 // ValidateAll checks the field values on BodyResponse with the rules defined
1529 // in the proto definition for this message. If any rules are violated, the
1530 // result is a list of violation errors wrapped in BodyResponseMultiError, or
1531 // nil if none found.
1532 func (m *BodyResponse) ValidateAll() error {
1533 return m.validate(true)
1534 }
1535
1536 func (m *BodyResponse) validate(all bool) error {
1537 if m == nil {
1538 return nil
1539 }
1540
1541 var errors []error
1542
1543 if all {
1544 switch v := interface{}(m.GetResponse()).(type) {
1545 case interface{ ValidateAll() error }:
1546 if err := v.ValidateAll(); err != nil {
1547 errors = append(errors, BodyResponseValidationError{
1548 field: "Response",
1549 reason: "embedded message failed validation",
1550 cause: err,
1551 })
1552 }
1553 case interface{ Validate() error }:
1554 if err := v.Validate(); err != nil {
1555 errors = append(errors, BodyResponseValidationError{
1556 field: "Response",
1557 reason: "embedded message failed validation",
1558 cause: err,
1559 })
1560 }
1561 }
1562 } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok {
1563 if err := v.Validate(); err != nil {
1564 return BodyResponseValidationError{
1565 field: "Response",
1566 reason: "embedded message failed validation",
1567 cause: err,
1568 }
1569 }
1570 }
1571
1572 if len(errors) > 0 {
1573 return BodyResponseMultiError(errors)
1574 }
1575
1576 return nil
1577 }
1578
1579 // BodyResponseMultiError is an error wrapping multiple validation errors
1580 // returned by BodyResponse.ValidateAll() if the designated constraints aren't met.
1581 type BodyResponseMultiError []error
1582
1583 // Error returns a concatenation of all the error messages it wraps.
1584 func (m BodyResponseMultiError) Error() string {
1585 var msgs []string
1586 for _, err := range m {
1587 msgs = append(msgs, err.Error())
1588 }
1589 return strings.Join(msgs, "; ")
1590 }
1591
1592 // AllErrors returns a list of validation violation errors.
1593 func (m BodyResponseMultiError) AllErrors() []error { return m }
1594
1595 // BodyResponseValidationError is the validation error returned by
1596 // BodyResponse.Validate if the designated constraints aren't met.
1597 type BodyResponseValidationError struct {
1598 field string
1599 reason string
1600 cause error
1601 key bool
1602 }
1603
1604 // Field function returns field value.
1605 func (e BodyResponseValidationError) Field() string { return e.field }
1606
1607 // Reason function returns reason value.
1608 func (e BodyResponseValidationError) Reason() string { return e.reason }
1609
1610 // Cause function returns cause value.
1611 func (e BodyResponseValidationError) Cause() error { return e.cause }
1612
1613 // Key function returns key value.
1614 func (e BodyResponseValidationError) Key() bool { return e.key }
1615
1616 // ErrorName returns error name.
1617 func (e BodyResponseValidationError) ErrorName() string { return "BodyResponseValidationError" }
1618
1619 // Error satisfies the builtin error interface
1620 func (e BodyResponseValidationError) Error() string {
1621 cause := ""
1622 if e.cause != nil {
1623 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1624 }
1625
1626 key := ""
1627 if e.key {
1628 key = "key for "
1629 }
1630
1631 return fmt.Sprintf(
1632 "invalid %sBodyResponse.%s: %s%s",
1633 key,
1634 e.field,
1635 e.reason,
1636 cause)
1637 }
1638
1639 var _ error = BodyResponseValidationError{}
1640
1641 var _ interface {
1642 Field() string
1643 Reason() string
1644 Key() bool
1645 Cause() error
1646 ErrorName() string
1647 } = BodyResponseValidationError{}
1648
1649 // Validate checks the field values on TrailersResponse with the rules defined
1650 // in the proto definition for this message. If any rules are violated, the
1651 // first error encountered is returned, or nil if there are no violations.
1652 func (m *TrailersResponse) Validate() error {
1653 return m.validate(false)
1654 }
1655
1656 // ValidateAll checks the field values on TrailersResponse with the rules
1657 // defined in the proto definition for this message. If any rules are
1658 // violated, the result is a list of violation errors wrapped in
1659 // TrailersResponseMultiError, or nil if none found.
1660 func (m *TrailersResponse) ValidateAll() error {
1661 return m.validate(true)
1662 }
1663
1664 func (m *TrailersResponse) validate(all bool) error {
1665 if m == nil {
1666 return nil
1667 }
1668
1669 var errors []error
1670
1671 if all {
1672 switch v := interface{}(m.GetHeaderMutation()).(type) {
1673 case interface{ ValidateAll() error }:
1674 if err := v.ValidateAll(); err != nil {
1675 errors = append(errors, TrailersResponseValidationError{
1676 field: "HeaderMutation",
1677 reason: "embedded message failed validation",
1678 cause: err,
1679 })
1680 }
1681 case interface{ Validate() error }:
1682 if err := v.Validate(); err != nil {
1683 errors = append(errors, TrailersResponseValidationError{
1684 field: "HeaderMutation",
1685 reason: "embedded message failed validation",
1686 cause: err,
1687 })
1688 }
1689 }
1690 } else if v, ok := interface{}(m.GetHeaderMutation()).(interface{ Validate() error }); ok {
1691 if err := v.Validate(); err != nil {
1692 return TrailersResponseValidationError{
1693 field: "HeaderMutation",
1694 reason: "embedded message failed validation",
1695 cause: err,
1696 }
1697 }
1698 }
1699
1700 if len(errors) > 0 {
1701 return TrailersResponseMultiError(errors)
1702 }
1703
1704 return nil
1705 }
1706
1707 // TrailersResponseMultiError is an error wrapping multiple validation errors
1708 // returned by TrailersResponse.ValidateAll() if the designated constraints
1709 // aren't met.
1710 type TrailersResponseMultiError []error
1711
1712 // Error returns a concatenation of all the error messages it wraps.
1713 func (m TrailersResponseMultiError) Error() string {
1714 var msgs []string
1715 for _, err := range m {
1716 msgs = append(msgs, err.Error())
1717 }
1718 return strings.Join(msgs, "; ")
1719 }
1720
1721 // AllErrors returns a list of validation violation errors.
1722 func (m TrailersResponseMultiError) AllErrors() []error { return m }
1723
1724 // TrailersResponseValidationError is the validation error returned by
1725 // TrailersResponse.Validate if the designated constraints aren't met.
1726 type TrailersResponseValidationError struct {
1727 field string
1728 reason string
1729 cause error
1730 key bool
1731 }
1732
1733 // Field function returns field value.
1734 func (e TrailersResponseValidationError) Field() string { return e.field }
1735
1736 // Reason function returns reason value.
1737 func (e TrailersResponseValidationError) Reason() string { return e.reason }
1738
1739 // Cause function returns cause value.
1740 func (e TrailersResponseValidationError) Cause() error { return e.cause }
1741
1742 // Key function returns key value.
1743 func (e TrailersResponseValidationError) Key() bool { return e.key }
1744
1745 // ErrorName returns error name.
1746 func (e TrailersResponseValidationError) ErrorName() string { return "TrailersResponseValidationError" }
1747
1748 // Error satisfies the builtin error interface
1749 func (e TrailersResponseValidationError) Error() string {
1750 cause := ""
1751 if e.cause != nil {
1752 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1753 }
1754
1755 key := ""
1756 if e.key {
1757 key = "key for "
1758 }
1759
1760 return fmt.Sprintf(
1761 "invalid %sTrailersResponse.%s: %s%s",
1762 key,
1763 e.field,
1764 e.reason,
1765 cause)
1766 }
1767
1768 var _ error = TrailersResponseValidationError{}
1769
1770 var _ interface {
1771 Field() string
1772 Reason() string
1773 Key() bool
1774 Cause() error
1775 ErrorName() string
1776 } = TrailersResponseValidationError{}
1777
1778 // Validate checks the field values on CommonResponse with the rules defined in
1779 // the proto definition for this message. If any rules are violated, the first
1780 // error encountered is returned, or nil if there are no violations.
1781 func (m *CommonResponse) Validate() error {
1782 return m.validate(false)
1783 }
1784
1785 // ValidateAll checks the field values on CommonResponse with the rules defined
1786 // in the proto definition for this message. If any rules are violated, the
1787 // result is a list of violation errors wrapped in CommonResponseMultiError,
1788 // or nil if none found.
1789 func (m *CommonResponse) ValidateAll() error {
1790 return m.validate(true)
1791 }
1792
1793 func (m *CommonResponse) validate(all bool) error {
1794 if m == nil {
1795 return nil
1796 }
1797
1798 var errors []error
1799
1800 if _, ok := CommonResponse_ResponseStatus_name[int32(m.GetStatus())]; !ok {
1801 err := CommonResponseValidationError{
1802 field: "Status",
1803 reason: "value must be one of the defined enum values",
1804 }
1805 if !all {
1806 return err
1807 }
1808 errors = append(errors, err)
1809 }
1810
1811 if all {
1812 switch v := interface{}(m.GetHeaderMutation()).(type) {
1813 case interface{ ValidateAll() error }:
1814 if err := v.ValidateAll(); err != nil {
1815 errors = append(errors, CommonResponseValidationError{
1816 field: "HeaderMutation",
1817 reason: "embedded message failed validation",
1818 cause: err,
1819 })
1820 }
1821 case interface{ Validate() error }:
1822 if err := v.Validate(); err != nil {
1823 errors = append(errors, CommonResponseValidationError{
1824 field: "HeaderMutation",
1825 reason: "embedded message failed validation",
1826 cause: err,
1827 })
1828 }
1829 }
1830 } else if v, ok := interface{}(m.GetHeaderMutation()).(interface{ Validate() error }); ok {
1831 if err := v.Validate(); err != nil {
1832 return CommonResponseValidationError{
1833 field: "HeaderMutation",
1834 reason: "embedded message failed validation",
1835 cause: err,
1836 }
1837 }
1838 }
1839
1840 if all {
1841 switch v := interface{}(m.GetBodyMutation()).(type) {
1842 case interface{ ValidateAll() error }:
1843 if err := v.ValidateAll(); err != nil {
1844 errors = append(errors, CommonResponseValidationError{
1845 field: "BodyMutation",
1846 reason: "embedded message failed validation",
1847 cause: err,
1848 })
1849 }
1850 case interface{ Validate() error }:
1851 if err := v.Validate(); err != nil {
1852 errors = append(errors, CommonResponseValidationError{
1853 field: "BodyMutation",
1854 reason: "embedded message failed validation",
1855 cause: err,
1856 })
1857 }
1858 }
1859 } else if v, ok := interface{}(m.GetBodyMutation()).(interface{ Validate() error }); ok {
1860 if err := v.Validate(); err != nil {
1861 return CommonResponseValidationError{
1862 field: "BodyMutation",
1863 reason: "embedded message failed validation",
1864 cause: err,
1865 }
1866 }
1867 }
1868
1869 if all {
1870 switch v := interface{}(m.GetTrailers()).(type) {
1871 case interface{ ValidateAll() error }:
1872 if err := v.ValidateAll(); err != nil {
1873 errors = append(errors, CommonResponseValidationError{
1874 field: "Trailers",
1875 reason: "embedded message failed validation",
1876 cause: err,
1877 })
1878 }
1879 case interface{ Validate() error }:
1880 if err := v.Validate(); err != nil {
1881 errors = append(errors, CommonResponseValidationError{
1882 field: "Trailers",
1883 reason: "embedded message failed validation",
1884 cause: err,
1885 })
1886 }
1887 }
1888 } else if v, ok := interface{}(m.GetTrailers()).(interface{ Validate() error }); ok {
1889 if err := v.Validate(); err != nil {
1890 return CommonResponseValidationError{
1891 field: "Trailers",
1892 reason: "embedded message failed validation",
1893 cause: err,
1894 }
1895 }
1896 }
1897
1898 // no validation rules for ClearRouteCache
1899
1900 if len(errors) > 0 {
1901 return CommonResponseMultiError(errors)
1902 }
1903
1904 return nil
1905 }
1906
1907 // CommonResponseMultiError is an error wrapping multiple validation errors
1908 // returned by CommonResponse.ValidateAll() if the designated constraints
1909 // aren't met.
1910 type CommonResponseMultiError []error
1911
1912 // Error returns a concatenation of all the error messages it wraps.
1913 func (m CommonResponseMultiError) Error() string {
1914 var msgs []string
1915 for _, err := range m {
1916 msgs = append(msgs, err.Error())
1917 }
1918 return strings.Join(msgs, "; ")
1919 }
1920
1921 // AllErrors returns a list of validation violation errors.
1922 func (m CommonResponseMultiError) AllErrors() []error { return m }
1923
1924 // CommonResponseValidationError is the validation error returned by
1925 // CommonResponse.Validate if the designated constraints aren't met.
1926 type CommonResponseValidationError struct {
1927 field string
1928 reason string
1929 cause error
1930 key bool
1931 }
1932
1933 // Field function returns field value.
1934 func (e CommonResponseValidationError) Field() string { return e.field }
1935
1936 // Reason function returns reason value.
1937 func (e CommonResponseValidationError) Reason() string { return e.reason }
1938
1939 // Cause function returns cause value.
1940 func (e CommonResponseValidationError) Cause() error { return e.cause }
1941
1942 // Key function returns key value.
1943 func (e CommonResponseValidationError) Key() bool { return e.key }
1944
1945 // ErrorName returns error name.
1946 func (e CommonResponseValidationError) ErrorName() string { return "CommonResponseValidationError" }
1947
1948 // Error satisfies the builtin error interface
1949 func (e CommonResponseValidationError) Error() string {
1950 cause := ""
1951 if e.cause != nil {
1952 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1953 }
1954
1955 key := ""
1956 if e.key {
1957 key = "key for "
1958 }
1959
1960 return fmt.Sprintf(
1961 "invalid %sCommonResponse.%s: %s%s",
1962 key,
1963 e.field,
1964 e.reason,
1965 cause)
1966 }
1967
1968 var _ error = CommonResponseValidationError{}
1969
1970 var _ interface {
1971 Field() string
1972 Reason() string
1973 Key() bool
1974 Cause() error
1975 ErrorName() string
1976 } = CommonResponseValidationError{}
1977
1978 // Validate checks the field values on ImmediateResponse with the rules defined
1979 // in the proto definition for this message. If any rules are violated, the
1980 // first error encountered is returned, or nil if there are no violations.
1981 func (m *ImmediateResponse) Validate() error {
1982 return m.validate(false)
1983 }
1984
1985 // ValidateAll checks the field values on ImmediateResponse with the rules
1986 // defined in the proto definition for this message. If any rules are
1987 // violated, the result is a list of violation errors wrapped in
1988 // ImmediateResponseMultiError, or nil if none found.
1989 func (m *ImmediateResponse) ValidateAll() error {
1990 return m.validate(true)
1991 }
1992
1993 func (m *ImmediateResponse) validate(all bool) error {
1994 if m == nil {
1995 return nil
1996 }
1997
1998 var errors []error
1999
2000 if m.GetStatus() == nil {
2001 err := ImmediateResponseValidationError{
2002 field: "Status",
2003 reason: "value is required",
2004 }
2005 if !all {
2006 return err
2007 }
2008 errors = append(errors, err)
2009 }
2010
2011 if all {
2012 switch v := interface{}(m.GetStatus()).(type) {
2013 case interface{ ValidateAll() error }:
2014 if err := v.ValidateAll(); err != nil {
2015 errors = append(errors, ImmediateResponseValidationError{
2016 field: "Status",
2017 reason: "embedded message failed validation",
2018 cause: err,
2019 })
2020 }
2021 case interface{ Validate() error }:
2022 if err := v.Validate(); err != nil {
2023 errors = append(errors, ImmediateResponseValidationError{
2024 field: "Status",
2025 reason: "embedded message failed validation",
2026 cause: err,
2027 })
2028 }
2029 }
2030 } else if v, ok := interface{}(m.GetStatus()).(interface{ Validate() error }); ok {
2031 if err := v.Validate(); err != nil {
2032 return ImmediateResponseValidationError{
2033 field: "Status",
2034 reason: "embedded message failed validation",
2035 cause: err,
2036 }
2037 }
2038 }
2039
2040 if all {
2041 switch v := interface{}(m.GetHeaders()).(type) {
2042 case interface{ ValidateAll() error }:
2043 if err := v.ValidateAll(); err != nil {
2044 errors = append(errors, ImmediateResponseValidationError{
2045 field: "Headers",
2046 reason: "embedded message failed validation",
2047 cause: err,
2048 })
2049 }
2050 case interface{ Validate() error }:
2051 if err := v.Validate(); err != nil {
2052 errors = append(errors, ImmediateResponseValidationError{
2053 field: "Headers",
2054 reason: "embedded message failed validation",
2055 cause: err,
2056 })
2057 }
2058 }
2059 } else if v, ok := interface{}(m.GetHeaders()).(interface{ Validate() error }); ok {
2060 if err := v.Validate(); err != nil {
2061 return ImmediateResponseValidationError{
2062 field: "Headers",
2063 reason: "embedded message failed validation",
2064 cause: err,
2065 }
2066 }
2067 }
2068
2069 // no validation rules for Body
2070
2071 if all {
2072 switch v := interface{}(m.GetGrpcStatus()).(type) {
2073 case interface{ ValidateAll() error }:
2074 if err := v.ValidateAll(); err != nil {
2075 errors = append(errors, ImmediateResponseValidationError{
2076 field: "GrpcStatus",
2077 reason: "embedded message failed validation",
2078 cause: err,
2079 })
2080 }
2081 case interface{ Validate() error }:
2082 if err := v.Validate(); err != nil {
2083 errors = append(errors, ImmediateResponseValidationError{
2084 field: "GrpcStatus",
2085 reason: "embedded message failed validation",
2086 cause: err,
2087 })
2088 }
2089 }
2090 } else if v, ok := interface{}(m.GetGrpcStatus()).(interface{ Validate() error }); ok {
2091 if err := v.Validate(); err != nil {
2092 return ImmediateResponseValidationError{
2093 field: "GrpcStatus",
2094 reason: "embedded message failed validation",
2095 cause: err,
2096 }
2097 }
2098 }
2099
2100 // no validation rules for Details
2101
2102 if len(errors) > 0 {
2103 return ImmediateResponseMultiError(errors)
2104 }
2105
2106 return nil
2107 }
2108
2109 // ImmediateResponseMultiError is an error wrapping multiple validation errors
2110 // returned by ImmediateResponse.ValidateAll() if the designated constraints
2111 // aren't met.
2112 type ImmediateResponseMultiError []error
2113
2114 // Error returns a concatenation of all the error messages it wraps.
2115 func (m ImmediateResponseMultiError) Error() string {
2116 var msgs []string
2117 for _, err := range m {
2118 msgs = append(msgs, err.Error())
2119 }
2120 return strings.Join(msgs, "; ")
2121 }
2122
2123 // AllErrors returns a list of validation violation errors.
2124 func (m ImmediateResponseMultiError) AllErrors() []error { return m }
2125
2126 // ImmediateResponseValidationError is the validation error returned by
2127 // ImmediateResponse.Validate if the designated constraints aren't met.
2128 type ImmediateResponseValidationError struct {
2129 field string
2130 reason string
2131 cause error
2132 key bool
2133 }
2134
2135 // Field function returns field value.
2136 func (e ImmediateResponseValidationError) Field() string { return e.field }
2137
2138 // Reason function returns reason value.
2139 func (e ImmediateResponseValidationError) Reason() string { return e.reason }
2140
2141 // Cause function returns cause value.
2142 func (e ImmediateResponseValidationError) Cause() error { return e.cause }
2143
2144 // Key function returns key value.
2145 func (e ImmediateResponseValidationError) Key() bool { return e.key }
2146
2147 // ErrorName returns error name.
2148 func (e ImmediateResponseValidationError) ErrorName() string {
2149 return "ImmediateResponseValidationError"
2150 }
2151
2152 // Error satisfies the builtin error interface
2153 func (e ImmediateResponseValidationError) Error() string {
2154 cause := ""
2155 if e.cause != nil {
2156 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2157 }
2158
2159 key := ""
2160 if e.key {
2161 key = "key for "
2162 }
2163
2164 return fmt.Sprintf(
2165 "invalid %sImmediateResponse.%s: %s%s",
2166 key,
2167 e.field,
2168 e.reason,
2169 cause)
2170 }
2171
2172 var _ error = ImmediateResponseValidationError{}
2173
2174 var _ interface {
2175 Field() string
2176 Reason() string
2177 Key() bool
2178 Cause() error
2179 ErrorName() string
2180 } = ImmediateResponseValidationError{}
2181
2182 // Validate checks the field values on GrpcStatus with the rules defined in the
2183 // proto definition for this message. If any rules are violated, the first
2184 // error encountered is returned, or nil if there are no violations.
2185 func (m *GrpcStatus) Validate() error {
2186 return m.validate(false)
2187 }
2188
2189 // ValidateAll checks the field values on GrpcStatus with the rules defined in
2190 // the proto definition for this message. If any rules are violated, the
2191 // result is a list of violation errors wrapped in GrpcStatusMultiError, or
2192 // nil if none found.
2193 func (m *GrpcStatus) ValidateAll() error {
2194 return m.validate(true)
2195 }
2196
2197 func (m *GrpcStatus) validate(all bool) error {
2198 if m == nil {
2199 return nil
2200 }
2201
2202 var errors []error
2203
2204 // no validation rules for Status
2205
2206 if len(errors) > 0 {
2207 return GrpcStatusMultiError(errors)
2208 }
2209
2210 return nil
2211 }
2212
2213 // GrpcStatusMultiError is an error wrapping multiple validation errors
2214 // returned by GrpcStatus.ValidateAll() if the designated constraints aren't met.
2215 type GrpcStatusMultiError []error
2216
2217 // Error returns a concatenation of all the error messages it wraps.
2218 func (m GrpcStatusMultiError) Error() string {
2219 var msgs []string
2220 for _, err := range m {
2221 msgs = append(msgs, err.Error())
2222 }
2223 return strings.Join(msgs, "; ")
2224 }
2225
2226 // AllErrors returns a list of validation violation errors.
2227 func (m GrpcStatusMultiError) AllErrors() []error { return m }
2228
2229 // GrpcStatusValidationError is the validation error returned by
2230 // GrpcStatus.Validate if the designated constraints aren't met.
2231 type GrpcStatusValidationError struct {
2232 field string
2233 reason string
2234 cause error
2235 key bool
2236 }
2237
2238 // Field function returns field value.
2239 func (e GrpcStatusValidationError) Field() string { return e.field }
2240
2241 // Reason function returns reason value.
2242 func (e GrpcStatusValidationError) Reason() string { return e.reason }
2243
2244 // Cause function returns cause value.
2245 func (e GrpcStatusValidationError) Cause() error { return e.cause }
2246
2247 // Key function returns key value.
2248 func (e GrpcStatusValidationError) Key() bool { return e.key }
2249
2250 // ErrorName returns error name.
2251 func (e GrpcStatusValidationError) ErrorName() string { return "GrpcStatusValidationError" }
2252
2253 // Error satisfies the builtin error interface
2254 func (e GrpcStatusValidationError) Error() string {
2255 cause := ""
2256 if e.cause != nil {
2257 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2258 }
2259
2260 key := ""
2261 if e.key {
2262 key = "key for "
2263 }
2264
2265 return fmt.Sprintf(
2266 "invalid %sGrpcStatus.%s: %s%s",
2267 key,
2268 e.field,
2269 e.reason,
2270 cause)
2271 }
2272
2273 var _ error = GrpcStatusValidationError{}
2274
2275 var _ interface {
2276 Field() string
2277 Reason() string
2278 Key() bool
2279 Cause() error
2280 ErrorName() string
2281 } = GrpcStatusValidationError{}
2282
2283 // Validate checks the field values on HeaderMutation with the rules defined in
2284 // the proto definition for this message. If any rules are violated, the first
2285 // error encountered is returned, or nil if there are no violations.
2286 func (m *HeaderMutation) Validate() error {
2287 return m.validate(false)
2288 }
2289
2290 // ValidateAll checks the field values on HeaderMutation with the rules defined
2291 // in the proto definition for this message. If any rules are violated, the
2292 // result is a list of violation errors wrapped in HeaderMutationMultiError,
2293 // or nil if none found.
2294 func (m *HeaderMutation) ValidateAll() error {
2295 return m.validate(true)
2296 }
2297
2298 func (m *HeaderMutation) validate(all bool) error {
2299 if m == nil {
2300 return nil
2301 }
2302
2303 var errors []error
2304
2305 for idx, item := range m.GetSetHeaders() {
2306 _, _ = idx, item
2307
2308 if all {
2309 switch v := interface{}(item).(type) {
2310 case interface{ ValidateAll() error }:
2311 if err := v.ValidateAll(); err != nil {
2312 errors = append(errors, HeaderMutationValidationError{
2313 field: fmt.Sprintf("SetHeaders[%v]", idx),
2314 reason: "embedded message failed validation",
2315 cause: err,
2316 })
2317 }
2318 case interface{ Validate() error }:
2319 if err := v.Validate(); err != nil {
2320 errors = append(errors, HeaderMutationValidationError{
2321 field: fmt.Sprintf("SetHeaders[%v]", idx),
2322 reason: "embedded message failed validation",
2323 cause: err,
2324 })
2325 }
2326 }
2327 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2328 if err := v.Validate(); err != nil {
2329 return HeaderMutationValidationError{
2330 field: fmt.Sprintf("SetHeaders[%v]", idx),
2331 reason: "embedded message failed validation",
2332 cause: err,
2333 }
2334 }
2335 }
2336
2337 }
2338
2339 if len(errors) > 0 {
2340 return HeaderMutationMultiError(errors)
2341 }
2342
2343 return nil
2344 }
2345
2346 // HeaderMutationMultiError is an error wrapping multiple validation errors
2347 // returned by HeaderMutation.ValidateAll() if the designated constraints
2348 // aren't met.
2349 type HeaderMutationMultiError []error
2350
2351 // Error returns a concatenation of all the error messages it wraps.
2352 func (m HeaderMutationMultiError) 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 HeaderMutationMultiError) AllErrors() []error { return m }
2362
2363 // HeaderMutationValidationError is the validation error returned by
2364 // HeaderMutation.Validate if the designated constraints aren't met.
2365 type HeaderMutationValidationError struct {
2366 field string
2367 reason string
2368 cause error
2369 key bool
2370 }
2371
2372 // Field function returns field value.
2373 func (e HeaderMutationValidationError) Field() string { return e.field }
2374
2375 // Reason function returns reason value.
2376 func (e HeaderMutationValidationError) Reason() string { return e.reason }
2377
2378 // Cause function returns cause value.
2379 func (e HeaderMutationValidationError) Cause() error { return e.cause }
2380
2381 // Key function returns key value.
2382 func (e HeaderMutationValidationError) Key() bool { return e.key }
2383
2384 // ErrorName returns error name.
2385 func (e HeaderMutationValidationError) ErrorName() string { return "HeaderMutationValidationError" }
2386
2387 // Error satisfies the builtin error interface
2388 func (e HeaderMutationValidationError) Error() string {
2389 cause := ""
2390 if e.cause != nil {
2391 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2392 }
2393
2394 key := ""
2395 if e.key {
2396 key = "key for "
2397 }
2398
2399 return fmt.Sprintf(
2400 "invalid %sHeaderMutation.%s: %s%s",
2401 key,
2402 e.field,
2403 e.reason,
2404 cause)
2405 }
2406
2407 var _ error = HeaderMutationValidationError{}
2408
2409 var _ interface {
2410 Field() string
2411 Reason() string
2412 Key() bool
2413 Cause() error
2414 ErrorName() string
2415 } = HeaderMutationValidationError{}
2416
2417 // Validate checks the field values on StreamedBodyResponse with the rules
2418 // defined in the proto definition for this message. If any rules are
2419 // violated, the first error encountered is returned, or nil if there are no violations.
2420 func (m *StreamedBodyResponse) Validate() error {
2421 return m.validate(false)
2422 }
2423
2424 // ValidateAll checks the field values on StreamedBodyResponse with the rules
2425 // defined in the proto definition for this message. If any rules are
2426 // violated, the result is a list of violation errors wrapped in
2427 // StreamedBodyResponseMultiError, or nil if none found.
2428 func (m *StreamedBodyResponse) ValidateAll() error {
2429 return m.validate(true)
2430 }
2431
2432 func (m *StreamedBodyResponse) validate(all bool) error {
2433 if m == nil {
2434 return nil
2435 }
2436
2437 var errors []error
2438
2439 // no validation rules for Body
2440
2441 // no validation rules for EndOfStream
2442
2443 if len(errors) > 0 {
2444 return StreamedBodyResponseMultiError(errors)
2445 }
2446
2447 return nil
2448 }
2449
2450 // StreamedBodyResponseMultiError is an error wrapping multiple validation
2451 // errors returned by StreamedBodyResponse.ValidateAll() if the designated
2452 // constraints aren't met.
2453 type StreamedBodyResponseMultiError []error
2454
2455 // Error returns a concatenation of all the error messages it wraps.
2456 func (m StreamedBodyResponseMultiError) Error() string {
2457 var msgs []string
2458 for _, err := range m {
2459 msgs = append(msgs, err.Error())
2460 }
2461 return strings.Join(msgs, "; ")
2462 }
2463
2464 // AllErrors returns a list of validation violation errors.
2465 func (m StreamedBodyResponseMultiError) AllErrors() []error { return m }
2466
2467 // StreamedBodyResponseValidationError is the validation error returned by
2468 // StreamedBodyResponse.Validate if the designated constraints aren't met.
2469 type StreamedBodyResponseValidationError struct {
2470 field string
2471 reason string
2472 cause error
2473 key bool
2474 }
2475
2476 // Field function returns field value.
2477 func (e StreamedBodyResponseValidationError) Field() string { return e.field }
2478
2479 // Reason function returns reason value.
2480 func (e StreamedBodyResponseValidationError) Reason() string { return e.reason }
2481
2482 // Cause function returns cause value.
2483 func (e StreamedBodyResponseValidationError) Cause() error { return e.cause }
2484
2485 // Key function returns key value.
2486 func (e StreamedBodyResponseValidationError) Key() bool { return e.key }
2487
2488 // ErrorName returns error name.
2489 func (e StreamedBodyResponseValidationError) ErrorName() string {
2490 return "StreamedBodyResponseValidationError"
2491 }
2492
2493 // Error satisfies the builtin error interface
2494 func (e StreamedBodyResponseValidationError) Error() string {
2495 cause := ""
2496 if e.cause != nil {
2497 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2498 }
2499
2500 key := ""
2501 if e.key {
2502 key = "key for "
2503 }
2504
2505 return fmt.Sprintf(
2506 "invalid %sStreamedBodyResponse.%s: %s%s",
2507 key,
2508 e.field,
2509 e.reason,
2510 cause)
2511 }
2512
2513 var _ error = StreamedBodyResponseValidationError{}
2514
2515 var _ interface {
2516 Field() string
2517 Reason() string
2518 Key() bool
2519 Cause() error
2520 ErrorName() string
2521 } = StreamedBodyResponseValidationError{}
2522
2523 // Validate checks the field values on BodyMutation with the rules defined in
2524 // the proto definition for this message. If any rules are violated, the first
2525 // error encountered is returned, or nil if there are no violations.
2526 func (m *BodyMutation) Validate() error {
2527 return m.validate(false)
2528 }
2529
2530 // ValidateAll checks the field values on BodyMutation with the rules defined
2531 // in the proto definition for this message. If any rules are violated, the
2532 // result is a list of violation errors wrapped in BodyMutationMultiError, or
2533 // nil if none found.
2534 func (m *BodyMutation) ValidateAll() error {
2535 return m.validate(true)
2536 }
2537
2538 func (m *BodyMutation) validate(all bool) error {
2539 if m == nil {
2540 return nil
2541 }
2542
2543 var errors []error
2544
2545 switch v := m.Mutation.(type) {
2546 case *BodyMutation_Body:
2547 if v == nil {
2548 err := BodyMutationValidationError{
2549 field: "Mutation",
2550 reason: "oneof value cannot be a typed-nil",
2551 }
2552 if !all {
2553 return err
2554 }
2555 errors = append(errors, err)
2556 }
2557 // no validation rules for Body
2558 case *BodyMutation_ClearBody:
2559 if v == nil {
2560 err := BodyMutationValidationError{
2561 field: "Mutation",
2562 reason: "oneof value cannot be a typed-nil",
2563 }
2564 if !all {
2565 return err
2566 }
2567 errors = append(errors, err)
2568 }
2569 // no validation rules for ClearBody
2570 case *BodyMutation_StreamedResponse:
2571 if v == nil {
2572 err := BodyMutationValidationError{
2573 field: "Mutation",
2574 reason: "oneof value cannot be a typed-nil",
2575 }
2576 if !all {
2577 return err
2578 }
2579 errors = append(errors, err)
2580 }
2581
2582 if all {
2583 switch v := interface{}(m.GetStreamedResponse()).(type) {
2584 case interface{ ValidateAll() error }:
2585 if err := v.ValidateAll(); err != nil {
2586 errors = append(errors, BodyMutationValidationError{
2587 field: "StreamedResponse",
2588 reason: "embedded message failed validation",
2589 cause: err,
2590 })
2591 }
2592 case interface{ Validate() error }:
2593 if err := v.Validate(); err != nil {
2594 errors = append(errors, BodyMutationValidationError{
2595 field: "StreamedResponse",
2596 reason: "embedded message failed validation",
2597 cause: err,
2598 })
2599 }
2600 }
2601 } else if v, ok := interface{}(m.GetStreamedResponse()).(interface{ Validate() error }); ok {
2602 if err := v.Validate(); err != nil {
2603 return BodyMutationValidationError{
2604 field: "StreamedResponse",
2605 reason: "embedded message failed validation",
2606 cause: err,
2607 }
2608 }
2609 }
2610
2611 default:
2612 _ = v // ensures v is used
2613 }
2614
2615 if len(errors) > 0 {
2616 return BodyMutationMultiError(errors)
2617 }
2618
2619 return nil
2620 }
2621
2622 // BodyMutationMultiError is an error wrapping multiple validation errors
2623 // returned by BodyMutation.ValidateAll() if the designated constraints aren't met.
2624 type BodyMutationMultiError []error
2625
2626 // Error returns a concatenation of all the error messages it wraps.
2627 func (m BodyMutationMultiError) Error() string {
2628 var msgs []string
2629 for _, err := range m {
2630 msgs = append(msgs, err.Error())
2631 }
2632 return strings.Join(msgs, "; ")
2633 }
2634
2635 // AllErrors returns a list of validation violation errors.
2636 func (m BodyMutationMultiError) AllErrors() []error { return m }
2637
2638 // BodyMutationValidationError is the validation error returned by
2639 // BodyMutation.Validate if the designated constraints aren't met.
2640 type BodyMutationValidationError struct {
2641 field string
2642 reason string
2643 cause error
2644 key bool
2645 }
2646
2647 // Field function returns field value.
2648 func (e BodyMutationValidationError) Field() string { return e.field }
2649
2650 // Reason function returns reason value.
2651 func (e BodyMutationValidationError) Reason() string { return e.reason }
2652
2653 // Cause function returns cause value.
2654 func (e BodyMutationValidationError) Cause() error { return e.cause }
2655
2656 // Key function returns key value.
2657 func (e BodyMutationValidationError) Key() bool { return e.key }
2658
2659 // ErrorName returns error name.
2660 func (e BodyMutationValidationError) ErrorName() string { return "BodyMutationValidationError" }
2661
2662 // Error satisfies the builtin error interface
2663 func (e BodyMutationValidationError) Error() string {
2664 cause := ""
2665 if e.cause != nil {
2666 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2667 }
2668
2669 key := ""
2670 if e.key {
2671 key = "key for "
2672 }
2673
2674 return fmt.Sprintf(
2675 "invalid %sBodyMutation.%s: %s%s",
2676 key,
2677 e.field,
2678 e.reason,
2679 cause)
2680 }
2681
2682 var _ error = BodyMutationValidationError{}
2683
2684 var _ interface {
2685 Field() string
2686 Reason() string
2687 Key() bool
2688 Cause() error
2689 ErrorName() string
2690 } = BodyMutationValidationError{}