1
2
3
4 package accesslogv2
5
6 import (
7 "bytes"
8 "errors"
9 "fmt"
10 "net"
11 "net/mail"
12 "net/url"
13 "regexp"
14 "sort"
15 "strings"
16 "time"
17 "unicode/utf8"
18
19 "google.golang.org/protobuf/types/known/anypb"
20
21 core "github.com/emissary-ingress/emissary/v3/pkg/api/envoy/api/v2/core"
22 )
23
24
25 var (
26 _ = bytes.MinRead
27 _ = errors.New("")
28 _ = fmt.Print
29 _ = utf8.UTFMax
30 _ = (*regexp.Regexp)(nil)
31 _ = (*strings.Reader)(nil)
32 _ = net.IPv4len
33 _ = time.Duration(0)
34 _ = (*url.URL)(nil)
35 _ = (*mail.Address)(nil)
36 _ = anypb.Any{}
37 _ = sort.Sort
38
39 _ = core.RequestMethod(0)
40 )
41
42
43
44
45 func (m *TCPAccessLogEntry) Validate() error {
46 return m.validate(false)
47 }
48
49
50
51
52
53 func (m *TCPAccessLogEntry) ValidateAll() error {
54 return m.validate(true)
55 }
56
57 func (m *TCPAccessLogEntry) validate(all bool) error {
58 if m == nil {
59 return nil
60 }
61
62 var errors []error
63
64 if all {
65 switch v := interface{}(m.GetCommonProperties()).(type) {
66 case interface{ ValidateAll() error }:
67 if err := v.ValidateAll(); err != nil {
68 errors = append(errors, TCPAccessLogEntryValidationError{
69 field: "CommonProperties",
70 reason: "embedded message failed validation",
71 cause: err,
72 })
73 }
74 case interface{ Validate() error }:
75 if err := v.Validate(); err != nil {
76 errors = append(errors, TCPAccessLogEntryValidationError{
77 field: "CommonProperties",
78 reason: "embedded message failed validation",
79 cause: err,
80 })
81 }
82 }
83 } else if v, ok := interface{}(m.GetCommonProperties()).(interface{ Validate() error }); ok {
84 if err := v.Validate(); err != nil {
85 return TCPAccessLogEntryValidationError{
86 field: "CommonProperties",
87 reason: "embedded message failed validation",
88 cause: err,
89 }
90 }
91 }
92
93 if all {
94 switch v := interface{}(m.GetConnectionProperties()).(type) {
95 case interface{ ValidateAll() error }:
96 if err := v.ValidateAll(); err != nil {
97 errors = append(errors, TCPAccessLogEntryValidationError{
98 field: "ConnectionProperties",
99 reason: "embedded message failed validation",
100 cause: err,
101 })
102 }
103 case interface{ Validate() error }:
104 if err := v.Validate(); err != nil {
105 errors = append(errors, TCPAccessLogEntryValidationError{
106 field: "ConnectionProperties",
107 reason: "embedded message failed validation",
108 cause: err,
109 })
110 }
111 }
112 } else if v, ok := interface{}(m.GetConnectionProperties()).(interface{ Validate() error }); ok {
113 if err := v.Validate(); err != nil {
114 return TCPAccessLogEntryValidationError{
115 field: "ConnectionProperties",
116 reason: "embedded message failed validation",
117 cause: err,
118 }
119 }
120 }
121
122 if len(errors) > 0 {
123 return TCPAccessLogEntryMultiError(errors)
124 }
125
126 return nil
127 }
128
129
130
131
132 type TCPAccessLogEntryMultiError []error
133
134
135 func (m TCPAccessLogEntryMultiError) Error() string {
136 var msgs []string
137 for _, err := range m {
138 msgs = append(msgs, err.Error())
139 }
140 return strings.Join(msgs, "; ")
141 }
142
143
144 func (m TCPAccessLogEntryMultiError) AllErrors() []error { return m }
145
146
147
148 type TCPAccessLogEntryValidationError struct {
149 field string
150 reason string
151 cause error
152 key bool
153 }
154
155
156 func (e TCPAccessLogEntryValidationError) Field() string { return e.field }
157
158
159 func (e TCPAccessLogEntryValidationError) Reason() string { return e.reason }
160
161
162 func (e TCPAccessLogEntryValidationError) Cause() error { return e.cause }
163
164
165 func (e TCPAccessLogEntryValidationError) Key() bool { return e.key }
166
167
168 func (e TCPAccessLogEntryValidationError) ErrorName() string {
169 return "TCPAccessLogEntryValidationError"
170 }
171
172
173 func (e TCPAccessLogEntryValidationError) Error() string {
174 cause := ""
175 if e.cause != nil {
176 cause = fmt.Sprintf(" | caused by: %v", e.cause)
177 }
178
179 key := ""
180 if e.key {
181 key = "key for "
182 }
183
184 return fmt.Sprintf(
185 "invalid %sTCPAccessLogEntry.%s: %s%s",
186 key,
187 e.field,
188 e.reason,
189 cause)
190 }
191
192 var _ error = TCPAccessLogEntryValidationError{}
193
194 var _ interface {
195 Field() string
196 Reason() string
197 Key() bool
198 Cause() error
199 ErrorName() string
200 } = TCPAccessLogEntryValidationError{}
201
202
203
204
205 func (m *HTTPAccessLogEntry) Validate() error {
206 return m.validate(false)
207 }
208
209
210
211
212
213 func (m *HTTPAccessLogEntry) ValidateAll() error {
214 return m.validate(true)
215 }
216
217 func (m *HTTPAccessLogEntry) validate(all bool) error {
218 if m == nil {
219 return nil
220 }
221
222 var errors []error
223
224 if all {
225 switch v := interface{}(m.GetCommonProperties()).(type) {
226 case interface{ ValidateAll() error }:
227 if err := v.ValidateAll(); err != nil {
228 errors = append(errors, HTTPAccessLogEntryValidationError{
229 field: "CommonProperties",
230 reason: "embedded message failed validation",
231 cause: err,
232 })
233 }
234 case interface{ Validate() error }:
235 if err := v.Validate(); err != nil {
236 errors = append(errors, HTTPAccessLogEntryValidationError{
237 field: "CommonProperties",
238 reason: "embedded message failed validation",
239 cause: err,
240 })
241 }
242 }
243 } else if v, ok := interface{}(m.GetCommonProperties()).(interface{ Validate() error }); ok {
244 if err := v.Validate(); err != nil {
245 return HTTPAccessLogEntryValidationError{
246 field: "CommonProperties",
247 reason: "embedded message failed validation",
248 cause: err,
249 }
250 }
251 }
252
253
254
255 if all {
256 switch v := interface{}(m.GetRequest()).(type) {
257 case interface{ ValidateAll() error }:
258 if err := v.ValidateAll(); err != nil {
259 errors = append(errors, HTTPAccessLogEntryValidationError{
260 field: "Request",
261 reason: "embedded message failed validation",
262 cause: err,
263 })
264 }
265 case interface{ Validate() error }:
266 if err := v.Validate(); err != nil {
267 errors = append(errors, HTTPAccessLogEntryValidationError{
268 field: "Request",
269 reason: "embedded message failed validation",
270 cause: err,
271 })
272 }
273 }
274 } else if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok {
275 if err := v.Validate(); err != nil {
276 return HTTPAccessLogEntryValidationError{
277 field: "Request",
278 reason: "embedded message failed validation",
279 cause: err,
280 }
281 }
282 }
283
284 if all {
285 switch v := interface{}(m.GetResponse()).(type) {
286 case interface{ ValidateAll() error }:
287 if err := v.ValidateAll(); err != nil {
288 errors = append(errors, HTTPAccessLogEntryValidationError{
289 field: "Response",
290 reason: "embedded message failed validation",
291 cause: err,
292 })
293 }
294 case interface{ Validate() error }:
295 if err := v.Validate(); err != nil {
296 errors = append(errors, HTTPAccessLogEntryValidationError{
297 field: "Response",
298 reason: "embedded message failed validation",
299 cause: err,
300 })
301 }
302 }
303 } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok {
304 if err := v.Validate(); err != nil {
305 return HTTPAccessLogEntryValidationError{
306 field: "Response",
307 reason: "embedded message failed validation",
308 cause: err,
309 }
310 }
311 }
312
313 if len(errors) > 0 {
314 return HTTPAccessLogEntryMultiError(errors)
315 }
316
317 return nil
318 }
319
320
321
322
323 type HTTPAccessLogEntryMultiError []error
324
325
326 func (m HTTPAccessLogEntryMultiError) Error() string {
327 var msgs []string
328 for _, err := range m {
329 msgs = append(msgs, err.Error())
330 }
331 return strings.Join(msgs, "; ")
332 }
333
334
335 func (m HTTPAccessLogEntryMultiError) AllErrors() []error { return m }
336
337
338
339 type HTTPAccessLogEntryValidationError struct {
340 field string
341 reason string
342 cause error
343 key bool
344 }
345
346
347 func (e HTTPAccessLogEntryValidationError) Field() string { return e.field }
348
349
350 func (e HTTPAccessLogEntryValidationError) Reason() string { return e.reason }
351
352
353 func (e HTTPAccessLogEntryValidationError) Cause() error { return e.cause }
354
355
356 func (e HTTPAccessLogEntryValidationError) Key() bool { return e.key }
357
358
359 func (e HTTPAccessLogEntryValidationError) ErrorName() string {
360 return "HTTPAccessLogEntryValidationError"
361 }
362
363
364 func (e HTTPAccessLogEntryValidationError) Error() string {
365 cause := ""
366 if e.cause != nil {
367 cause = fmt.Sprintf(" | caused by: %v", e.cause)
368 }
369
370 key := ""
371 if e.key {
372 key = "key for "
373 }
374
375 return fmt.Sprintf(
376 "invalid %sHTTPAccessLogEntry.%s: %s%s",
377 key,
378 e.field,
379 e.reason,
380 cause)
381 }
382
383 var _ error = HTTPAccessLogEntryValidationError{}
384
385 var _ interface {
386 Field() string
387 Reason() string
388 Key() bool
389 Cause() error
390 ErrorName() string
391 } = HTTPAccessLogEntryValidationError{}
392
393
394
395
396 func (m *ConnectionProperties) Validate() error {
397 return m.validate(false)
398 }
399
400
401
402
403
404 func (m *ConnectionProperties) ValidateAll() error {
405 return m.validate(true)
406 }
407
408 func (m *ConnectionProperties) validate(all bool) error {
409 if m == nil {
410 return nil
411 }
412
413 var errors []error
414
415
416
417
418
419 if len(errors) > 0 {
420 return ConnectionPropertiesMultiError(errors)
421 }
422
423 return nil
424 }
425
426
427
428
429 type ConnectionPropertiesMultiError []error
430
431
432 func (m ConnectionPropertiesMultiError) Error() string {
433 var msgs []string
434 for _, err := range m {
435 msgs = append(msgs, err.Error())
436 }
437 return strings.Join(msgs, "; ")
438 }
439
440
441 func (m ConnectionPropertiesMultiError) AllErrors() []error { return m }
442
443
444
445 type ConnectionPropertiesValidationError struct {
446 field string
447 reason string
448 cause error
449 key bool
450 }
451
452
453 func (e ConnectionPropertiesValidationError) Field() string { return e.field }
454
455
456 func (e ConnectionPropertiesValidationError) Reason() string { return e.reason }
457
458
459 func (e ConnectionPropertiesValidationError) Cause() error { return e.cause }
460
461
462 func (e ConnectionPropertiesValidationError) Key() bool { return e.key }
463
464
465 func (e ConnectionPropertiesValidationError) ErrorName() string {
466 return "ConnectionPropertiesValidationError"
467 }
468
469
470 func (e ConnectionPropertiesValidationError) Error() string {
471 cause := ""
472 if e.cause != nil {
473 cause = fmt.Sprintf(" | caused by: %v", e.cause)
474 }
475
476 key := ""
477 if e.key {
478 key = "key for "
479 }
480
481 return fmt.Sprintf(
482 "invalid %sConnectionProperties.%s: %s%s",
483 key,
484 e.field,
485 e.reason,
486 cause)
487 }
488
489 var _ error = ConnectionPropertiesValidationError{}
490
491 var _ interface {
492 Field() string
493 Reason() string
494 Key() bool
495 Cause() error
496 ErrorName() string
497 } = ConnectionPropertiesValidationError{}
498
499
500
501
502 func (m *AccessLogCommon) Validate() error {
503 return m.validate(false)
504 }
505
506
507
508
509
510 func (m *AccessLogCommon) ValidateAll() error {
511 return m.validate(true)
512 }
513
514 func (m *AccessLogCommon) validate(all bool) error {
515 if m == nil {
516 return nil
517 }
518
519 var errors []error
520
521 if val := m.GetSampleRate(); val <= 0 || val > 1 {
522 err := AccessLogCommonValidationError{
523 field: "SampleRate",
524 reason: "value must be inside range (0, 1]",
525 }
526 if !all {
527 return err
528 }
529 errors = append(errors, err)
530 }
531
532 if all {
533 switch v := interface{}(m.GetDownstreamRemoteAddress()).(type) {
534 case interface{ ValidateAll() error }:
535 if err := v.ValidateAll(); err != nil {
536 errors = append(errors, AccessLogCommonValidationError{
537 field: "DownstreamRemoteAddress",
538 reason: "embedded message failed validation",
539 cause: err,
540 })
541 }
542 case interface{ Validate() error }:
543 if err := v.Validate(); err != nil {
544 errors = append(errors, AccessLogCommonValidationError{
545 field: "DownstreamRemoteAddress",
546 reason: "embedded message failed validation",
547 cause: err,
548 })
549 }
550 }
551 } else if v, ok := interface{}(m.GetDownstreamRemoteAddress()).(interface{ Validate() error }); ok {
552 if err := v.Validate(); err != nil {
553 return AccessLogCommonValidationError{
554 field: "DownstreamRemoteAddress",
555 reason: "embedded message failed validation",
556 cause: err,
557 }
558 }
559 }
560
561 if all {
562 switch v := interface{}(m.GetDownstreamLocalAddress()).(type) {
563 case interface{ ValidateAll() error }:
564 if err := v.ValidateAll(); err != nil {
565 errors = append(errors, AccessLogCommonValidationError{
566 field: "DownstreamLocalAddress",
567 reason: "embedded message failed validation",
568 cause: err,
569 })
570 }
571 case interface{ Validate() error }:
572 if err := v.Validate(); err != nil {
573 errors = append(errors, AccessLogCommonValidationError{
574 field: "DownstreamLocalAddress",
575 reason: "embedded message failed validation",
576 cause: err,
577 })
578 }
579 }
580 } else if v, ok := interface{}(m.GetDownstreamLocalAddress()).(interface{ Validate() error }); ok {
581 if err := v.Validate(); err != nil {
582 return AccessLogCommonValidationError{
583 field: "DownstreamLocalAddress",
584 reason: "embedded message failed validation",
585 cause: err,
586 }
587 }
588 }
589
590 if all {
591 switch v := interface{}(m.GetTlsProperties()).(type) {
592 case interface{ ValidateAll() error }:
593 if err := v.ValidateAll(); err != nil {
594 errors = append(errors, AccessLogCommonValidationError{
595 field: "TlsProperties",
596 reason: "embedded message failed validation",
597 cause: err,
598 })
599 }
600 case interface{ Validate() error }:
601 if err := v.Validate(); err != nil {
602 errors = append(errors, AccessLogCommonValidationError{
603 field: "TlsProperties",
604 reason: "embedded message failed validation",
605 cause: err,
606 })
607 }
608 }
609 } else if v, ok := interface{}(m.GetTlsProperties()).(interface{ Validate() error }); ok {
610 if err := v.Validate(); err != nil {
611 return AccessLogCommonValidationError{
612 field: "TlsProperties",
613 reason: "embedded message failed validation",
614 cause: err,
615 }
616 }
617 }
618
619 if all {
620 switch v := interface{}(m.GetStartTime()).(type) {
621 case interface{ ValidateAll() error }:
622 if err := v.ValidateAll(); err != nil {
623 errors = append(errors, AccessLogCommonValidationError{
624 field: "StartTime",
625 reason: "embedded message failed validation",
626 cause: err,
627 })
628 }
629 case interface{ Validate() error }:
630 if err := v.Validate(); err != nil {
631 errors = append(errors, AccessLogCommonValidationError{
632 field: "StartTime",
633 reason: "embedded message failed validation",
634 cause: err,
635 })
636 }
637 }
638 } else if v, ok := interface{}(m.GetStartTime()).(interface{ Validate() error }); ok {
639 if err := v.Validate(); err != nil {
640 return AccessLogCommonValidationError{
641 field: "StartTime",
642 reason: "embedded message failed validation",
643 cause: err,
644 }
645 }
646 }
647
648 if all {
649 switch v := interface{}(m.GetTimeToLastRxByte()).(type) {
650 case interface{ ValidateAll() error }:
651 if err := v.ValidateAll(); err != nil {
652 errors = append(errors, AccessLogCommonValidationError{
653 field: "TimeToLastRxByte",
654 reason: "embedded message failed validation",
655 cause: err,
656 })
657 }
658 case interface{ Validate() error }:
659 if err := v.Validate(); err != nil {
660 errors = append(errors, AccessLogCommonValidationError{
661 field: "TimeToLastRxByte",
662 reason: "embedded message failed validation",
663 cause: err,
664 })
665 }
666 }
667 } else if v, ok := interface{}(m.GetTimeToLastRxByte()).(interface{ Validate() error }); ok {
668 if err := v.Validate(); err != nil {
669 return AccessLogCommonValidationError{
670 field: "TimeToLastRxByte",
671 reason: "embedded message failed validation",
672 cause: err,
673 }
674 }
675 }
676
677 if all {
678 switch v := interface{}(m.GetTimeToFirstUpstreamTxByte()).(type) {
679 case interface{ ValidateAll() error }:
680 if err := v.ValidateAll(); err != nil {
681 errors = append(errors, AccessLogCommonValidationError{
682 field: "TimeToFirstUpstreamTxByte",
683 reason: "embedded message failed validation",
684 cause: err,
685 })
686 }
687 case interface{ Validate() error }:
688 if err := v.Validate(); err != nil {
689 errors = append(errors, AccessLogCommonValidationError{
690 field: "TimeToFirstUpstreamTxByte",
691 reason: "embedded message failed validation",
692 cause: err,
693 })
694 }
695 }
696 } else if v, ok := interface{}(m.GetTimeToFirstUpstreamTxByte()).(interface{ Validate() error }); ok {
697 if err := v.Validate(); err != nil {
698 return AccessLogCommonValidationError{
699 field: "TimeToFirstUpstreamTxByte",
700 reason: "embedded message failed validation",
701 cause: err,
702 }
703 }
704 }
705
706 if all {
707 switch v := interface{}(m.GetTimeToLastUpstreamTxByte()).(type) {
708 case interface{ ValidateAll() error }:
709 if err := v.ValidateAll(); err != nil {
710 errors = append(errors, AccessLogCommonValidationError{
711 field: "TimeToLastUpstreamTxByte",
712 reason: "embedded message failed validation",
713 cause: err,
714 })
715 }
716 case interface{ Validate() error }:
717 if err := v.Validate(); err != nil {
718 errors = append(errors, AccessLogCommonValidationError{
719 field: "TimeToLastUpstreamTxByte",
720 reason: "embedded message failed validation",
721 cause: err,
722 })
723 }
724 }
725 } else if v, ok := interface{}(m.GetTimeToLastUpstreamTxByte()).(interface{ Validate() error }); ok {
726 if err := v.Validate(); err != nil {
727 return AccessLogCommonValidationError{
728 field: "TimeToLastUpstreamTxByte",
729 reason: "embedded message failed validation",
730 cause: err,
731 }
732 }
733 }
734
735 if all {
736 switch v := interface{}(m.GetTimeToFirstUpstreamRxByte()).(type) {
737 case interface{ ValidateAll() error }:
738 if err := v.ValidateAll(); err != nil {
739 errors = append(errors, AccessLogCommonValidationError{
740 field: "TimeToFirstUpstreamRxByte",
741 reason: "embedded message failed validation",
742 cause: err,
743 })
744 }
745 case interface{ Validate() error }:
746 if err := v.Validate(); err != nil {
747 errors = append(errors, AccessLogCommonValidationError{
748 field: "TimeToFirstUpstreamRxByte",
749 reason: "embedded message failed validation",
750 cause: err,
751 })
752 }
753 }
754 } else if v, ok := interface{}(m.GetTimeToFirstUpstreamRxByte()).(interface{ Validate() error }); ok {
755 if err := v.Validate(); err != nil {
756 return AccessLogCommonValidationError{
757 field: "TimeToFirstUpstreamRxByte",
758 reason: "embedded message failed validation",
759 cause: err,
760 }
761 }
762 }
763
764 if all {
765 switch v := interface{}(m.GetTimeToLastUpstreamRxByte()).(type) {
766 case interface{ ValidateAll() error }:
767 if err := v.ValidateAll(); err != nil {
768 errors = append(errors, AccessLogCommonValidationError{
769 field: "TimeToLastUpstreamRxByte",
770 reason: "embedded message failed validation",
771 cause: err,
772 })
773 }
774 case interface{ Validate() error }:
775 if err := v.Validate(); err != nil {
776 errors = append(errors, AccessLogCommonValidationError{
777 field: "TimeToLastUpstreamRxByte",
778 reason: "embedded message failed validation",
779 cause: err,
780 })
781 }
782 }
783 } else if v, ok := interface{}(m.GetTimeToLastUpstreamRxByte()).(interface{ Validate() error }); ok {
784 if err := v.Validate(); err != nil {
785 return AccessLogCommonValidationError{
786 field: "TimeToLastUpstreamRxByte",
787 reason: "embedded message failed validation",
788 cause: err,
789 }
790 }
791 }
792
793 if all {
794 switch v := interface{}(m.GetTimeToFirstDownstreamTxByte()).(type) {
795 case interface{ ValidateAll() error }:
796 if err := v.ValidateAll(); err != nil {
797 errors = append(errors, AccessLogCommonValidationError{
798 field: "TimeToFirstDownstreamTxByte",
799 reason: "embedded message failed validation",
800 cause: err,
801 })
802 }
803 case interface{ Validate() error }:
804 if err := v.Validate(); err != nil {
805 errors = append(errors, AccessLogCommonValidationError{
806 field: "TimeToFirstDownstreamTxByte",
807 reason: "embedded message failed validation",
808 cause: err,
809 })
810 }
811 }
812 } else if v, ok := interface{}(m.GetTimeToFirstDownstreamTxByte()).(interface{ Validate() error }); ok {
813 if err := v.Validate(); err != nil {
814 return AccessLogCommonValidationError{
815 field: "TimeToFirstDownstreamTxByte",
816 reason: "embedded message failed validation",
817 cause: err,
818 }
819 }
820 }
821
822 if all {
823 switch v := interface{}(m.GetTimeToLastDownstreamTxByte()).(type) {
824 case interface{ ValidateAll() error }:
825 if err := v.ValidateAll(); err != nil {
826 errors = append(errors, AccessLogCommonValidationError{
827 field: "TimeToLastDownstreamTxByte",
828 reason: "embedded message failed validation",
829 cause: err,
830 })
831 }
832 case interface{ Validate() error }:
833 if err := v.Validate(); err != nil {
834 errors = append(errors, AccessLogCommonValidationError{
835 field: "TimeToLastDownstreamTxByte",
836 reason: "embedded message failed validation",
837 cause: err,
838 })
839 }
840 }
841 } else if v, ok := interface{}(m.GetTimeToLastDownstreamTxByte()).(interface{ Validate() error }); ok {
842 if err := v.Validate(); err != nil {
843 return AccessLogCommonValidationError{
844 field: "TimeToLastDownstreamTxByte",
845 reason: "embedded message failed validation",
846 cause: err,
847 }
848 }
849 }
850
851 if all {
852 switch v := interface{}(m.GetUpstreamRemoteAddress()).(type) {
853 case interface{ ValidateAll() error }:
854 if err := v.ValidateAll(); err != nil {
855 errors = append(errors, AccessLogCommonValidationError{
856 field: "UpstreamRemoteAddress",
857 reason: "embedded message failed validation",
858 cause: err,
859 })
860 }
861 case interface{ Validate() error }:
862 if err := v.Validate(); err != nil {
863 errors = append(errors, AccessLogCommonValidationError{
864 field: "UpstreamRemoteAddress",
865 reason: "embedded message failed validation",
866 cause: err,
867 })
868 }
869 }
870 } else if v, ok := interface{}(m.GetUpstreamRemoteAddress()).(interface{ Validate() error }); ok {
871 if err := v.Validate(); err != nil {
872 return AccessLogCommonValidationError{
873 field: "UpstreamRemoteAddress",
874 reason: "embedded message failed validation",
875 cause: err,
876 }
877 }
878 }
879
880 if all {
881 switch v := interface{}(m.GetUpstreamLocalAddress()).(type) {
882 case interface{ ValidateAll() error }:
883 if err := v.ValidateAll(); err != nil {
884 errors = append(errors, AccessLogCommonValidationError{
885 field: "UpstreamLocalAddress",
886 reason: "embedded message failed validation",
887 cause: err,
888 })
889 }
890 case interface{ Validate() error }:
891 if err := v.Validate(); err != nil {
892 errors = append(errors, AccessLogCommonValidationError{
893 field: "UpstreamLocalAddress",
894 reason: "embedded message failed validation",
895 cause: err,
896 })
897 }
898 }
899 } else if v, ok := interface{}(m.GetUpstreamLocalAddress()).(interface{ Validate() error }); ok {
900 if err := v.Validate(); err != nil {
901 return AccessLogCommonValidationError{
902 field: "UpstreamLocalAddress",
903 reason: "embedded message failed validation",
904 cause: err,
905 }
906 }
907 }
908
909
910
911 if all {
912 switch v := interface{}(m.GetResponseFlags()).(type) {
913 case interface{ ValidateAll() error }:
914 if err := v.ValidateAll(); err != nil {
915 errors = append(errors, AccessLogCommonValidationError{
916 field: "ResponseFlags",
917 reason: "embedded message failed validation",
918 cause: err,
919 })
920 }
921 case interface{ Validate() error }:
922 if err := v.Validate(); err != nil {
923 errors = append(errors, AccessLogCommonValidationError{
924 field: "ResponseFlags",
925 reason: "embedded message failed validation",
926 cause: err,
927 })
928 }
929 }
930 } else if v, ok := interface{}(m.GetResponseFlags()).(interface{ Validate() error }); ok {
931 if err := v.Validate(); err != nil {
932 return AccessLogCommonValidationError{
933 field: "ResponseFlags",
934 reason: "embedded message failed validation",
935 cause: err,
936 }
937 }
938 }
939
940 if all {
941 switch v := interface{}(m.GetMetadata()).(type) {
942 case interface{ ValidateAll() error }:
943 if err := v.ValidateAll(); err != nil {
944 errors = append(errors, AccessLogCommonValidationError{
945 field: "Metadata",
946 reason: "embedded message failed validation",
947 cause: err,
948 })
949 }
950 case interface{ Validate() error }:
951 if err := v.Validate(); err != nil {
952 errors = append(errors, AccessLogCommonValidationError{
953 field: "Metadata",
954 reason: "embedded message failed validation",
955 cause: err,
956 })
957 }
958 }
959 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
960 if err := v.Validate(); err != nil {
961 return AccessLogCommonValidationError{
962 field: "Metadata",
963 reason: "embedded message failed validation",
964 cause: err,
965 }
966 }
967 }
968
969
970
971
972
973 if all {
974 switch v := interface{}(m.GetDownstreamDirectRemoteAddress()).(type) {
975 case interface{ ValidateAll() error }:
976 if err := v.ValidateAll(); err != nil {
977 errors = append(errors, AccessLogCommonValidationError{
978 field: "DownstreamDirectRemoteAddress",
979 reason: "embedded message failed validation",
980 cause: err,
981 })
982 }
983 case interface{ Validate() error }:
984 if err := v.Validate(); err != nil {
985 errors = append(errors, AccessLogCommonValidationError{
986 field: "DownstreamDirectRemoteAddress",
987 reason: "embedded message failed validation",
988 cause: err,
989 })
990 }
991 }
992 } else if v, ok := interface{}(m.GetDownstreamDirectRemoteAddress()).(interface{ Validate() error }); ok {
993 if err := v.Validate(); err != nil {
994 return AccessLogCommonValidationError{
995 field: "DownstreamDirectRemoteAddress",
996 reason: "embedded message failed validation",
997 cause: err,
998 }
999 }
1000 }
1001
1002 {
1003 sorted_keys := make([]string, len(m.GetFilterStateObjects()))
1004 i := 0
1005 for key := range m.GetFilterStateObjects() {
1006 sorted_keys[i] = key
1007 i++
1008 }
1009 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
1010 for _, key := range sorted_keys {
1011 val := m.GetFilterStateObjects()[key]
1012 _ = val
1013
1014
1015
1016 if all {
1017 switch v := interface{}(val).(type) {
1018 case interface{ ValidateAll() error }:
1019 if err := v.ValidateAll(); err != nil {
1020 errors = append(errors, AccessLogCommonValidationError{
1021 field: fmt.Sprintf("FilterStateObjects[%v]", key),
1022 reason: "embedded message failed validation",
1023 cause: err,
1024 })
1025 }
1026 case interface{ Validate() error }:
1027 if err := v.Validate(); err != nil {
1028 errors = append(errors, AccessLogCommonValidationError{
1029 field: fmt.Sprintf("FilterStateObjects[%v]", key),
1030 reason: "embedded message failed validation",
1031 cause: err,
1032 })
1033 }
1034 }
1035 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
1036 if err := v.Validate(); err != nil {
1037 return AccessLogCommonValidationError{
1038 field: fmt.Sprintf("FilterStateObjects[%v]", key),
1039 reason: "embedded message failed validation",
1040 cause: err,
1041 }
1042 }
1043 }
1044
1045 }
1046 }
1047
1048 if len(errors) > 0 {
1049 return AccessLogCommonMultiError(errors)
1050 }
1051
1052 return nil
1053 }
1054
1055
1056
1057
1058 type AccessLogCommonMultiError []error
1059
1060
1061 func (m AccessLogCommonMultiError) Error() string {
1062 var msgs []string
1063 for _, err := range m {
1064 msgs = append(msgs, err.Error())
1065 }
1066 return strings.Join(msgs, "; ")
1067 }
1068
1069
1070 func (m AccessLogCommonMultiError) AllErrors() []error { return m }
1071
1072
1073
1074 type AccessLogCommonValidationError struct {
1075 field string
1076 reason string
1077 cause error
1078 key bool
1079 }
1080
1081
1082 func (e AccessLogCommonValidationError) Field() string { return e.field }
1083
1084
1085 func (e AccessLogCommonValidationError) Reason() string { return e.reason }
1086
1087
1088 func (e AccessLogCommonValidationError) Cause() error { return e.cause }
1089
1090
1091 func (e AccessLogCommonValidationError) Key() bool { return e.key }
1092
1093
1094 func (e AccessLogCommonValidationError) ErrorName() string { return "AccessLogCommonValidationError" }
1095
1096
1097 func (e AccessLogCommonValidationError) Error() string {
1098 cause := ""
1099 if e.cause != nil {
1100 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1101 }
1102
1103 key := ""
1104 if e.key {
1105 key = "key for "
1106 }
1107
1108 return fmt.Sprintf(
1109 "invalid %sAccessLogCommon.%s: %s%s",
1110 key,
1111 e.field,
1112 e.reason,
1113 cause)
1114 }
1115
1116 var _ error = AccessLogCommonValidationError{}
1117
1118 var _ interface {
1119 Field() string
1120 Reason() string
1121 Key() bool
1122 Cause() error
1123 ErrorName() string
1124 } = AccessLogCommonValidationError{}
1125
1126
1127
1128
1129 func (m *ResponseFlags) Validate() error {
1130 return m.validate(false)
1131 }
1132
1133
1134
1135
1136
1137 func (m *ResponseFlags) ValidateAll() error {
1138 return m.validate(true)
1139 }
1140
1141 func (m *ResponseFlags) validate(all bool) error {
1142 if m == nil {
1143 return nil
1144 }
1145
1146 var errors []error
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172 if all {
1173 switch v := interface{}(m.GetUnauthorizedDetails()).(type) {
1174 case interface{ ValidateAll() error }:
1175 if err := v.ValidateAll(); err != nil {
1176 errors = append(errors, ResponseFlagsValidationError{
1177 field: "UnauthorizedDetails",
1178 reason: "embedded message failed validation",
1179 cause: err,
1180 })
1181 }
1182 case interface{ Validate() error }:
1183 if err := v.Validate(); err != nil {
1184 errors = append(errors, ResponseFlagsValidationError{
1185 field: "UnauthorizedDetails",
1186 reason: "embedded message failed validation",
1187 cause: err,
1188 })
1189 }
1190 }
1191 } else if v, ok := interface{}(m.GetUnauthorizedDetails()).(interface{ Validate() error }); ok {
1192 if err := v.Validate(); err != nil {
1193 return ResponseFlagsValidationError{
1194 field: "UnauthorizedDetails",
1195 reason: "embedded message failed validation",
1196 cause: err,
1197 }
1198 }
1199 }
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213 if len(errors) > 0 {
1214 return ResponseFlagsMultiError(errors)
1215 }
1216
1217 return nil
1218 }
1219
1220
1221
1222
1223 type ResponseFlagsMultiError []error
1224
1225
1226 func (m ResponseFlagsMultiError) Error() string {
1227 var msgs []string
1228 for _, err := range m {
1229 msgs = append(msgs, err.Error())
1230 }
1231 return strings.Join(msgs, "; ")
1232 }
1233
1234
1235 func (m ResponseFlagsMultiError) AllErrors() []error { return m }
1236
1237
1238
1239 type ResponseFlagsValidationError struct {
1240 field string
1241 reason string
1242 cause error
1243 key bool
1244 }
1245
1246
1247 func (e ResponseFlagsValidationError) Field() string { return e.field }
1248
1249
1250 func (e ResponseFlagsValidationError) Reason() string { return e.reason }
1251
1252
1253 func (e ResponseFlagsValidationError) Cause() error { return e.cause }
1254
1255
1256 func (e ResponseFlagsValidationError) Key() bool { return e.key }
1257
1258
1259 func (e ResponseFlagsValidationError) ErrorName() string { return "ResponseFlagsValidationError" }
1260
1261
1262 func (e ResponseFlagsValidationError) Error() string {
1263 cause := ""
1264 if e.cause != nil {
1265 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1266 }
1267
1268 key := ""
1269 if e.key {
1270 key = "key for "
1271 }
1272
1273 return fmt.Sprintf(
1274 "invalid %sResponseFlags.%s: %s%s",
1275 key,
1276 e.field,
1277 e.reason,
1278 cause)
1279 }
1280
1281 var _ error = ResponseFlagsValidationError{}
1282
1283 var _ interface {
1284 Field() string
1285 Reason() string
1286 Key() bool
1287 Cause() error
1288 ErrorName() string
1289 } = ResponseFlagsValidationError{}
1290
1291
1292
1293
1294 func (m *TLSProperties) Validate() error {
1295 return m.validate(false)
1296 }
1297
1298
1299
1300
1301
1302 func (m *TLSProperties) ValidateAll() error {
1303 return m.validate(true)
1304 }
1305
1306 func (m *TLSProperties) validate(all bool) error {
1307 if m == nil {
1308 return nil
1309 }
1310
1311 var errors []error
1312
1313
1314
1315 if all {
1316 switch v := interface{}(m.GetTlsCipherSuite()).(type) {
1317 case interface{ ValidateAll() error }:
1318 if err := v.ValidateAll(); err != nil {
1319 errors = append(errors, TLSPropertiesValidationError{
1320 field: "TlsCipherSuite",
1321 reason: "embedded message failed validation",
1322 cause: err,
1323 })
1324 }
1325 case interface{ Validate() error }:
1326 if err := v.Validate(); err != nil {
1327 errors = append(errors, TLSPropertiesValidationError{
1328 field: "TlsCipherSuite",
1329 reason: "embedded message failed validation",
1330 cause: err,
1331 })
1332 }
1333 }
1334 } else if v, ok := interface{}(m.GetTlsCipherSuite()).(interface{ Validate() error }); ok {
1335 if err := v.Validate(); err != nil {
1336 return TLSPropertiesValidationError{
1337 field: "TlsCipherSuite",
1338 reason: "embedded message failed validation",
1339 cause: err,
1340 }
1341 }
1342 }
1343
1344
1345
1346 if all {
1347 switch v := interface{}(m.GetLocalCertificateProperties()).(type) {
1348 case interface{ ValidateAll() error }:
1349 if err := v.ValidateAll(); err != nil {
1350 errors = append(errors, TLSPropertiesValidationError{
1351 field: "LocalCertificateProperties",
1352 reason: "embedded message failed validation",
1353 cause: err,
1354 })
1355 }
1356 case interface{ Validate() error }:
1357 if err := v.Validate(); err != nil {
1358 errors = append(errors, TLSPropertiesValidationError{
1359 field: "LocalCertificateProperties",
1360 reason: "embedded message failed validation",
1361 cause: err,
1362 })
1363 }
1364 }
1365 } else if v, ok := interface{}(m.GetLocalCertificateProperties()).(interface{ Validate() error }); ok {
1366 if err := v.Validate(); err != nil {
1367 return TLSPropertiesValidationError{
1368 field: "LocalCertificateProperties",
1369 reason: "embedded message failed validation",
1370 cause: err,
1371 }
1372 }
1373 }
1374
1375 if all {
1376 switch v := interface{}(m.GetPeerCertificateProperties()).(type) {
1377 case interface{ ValidateAll() error }:
1378 if err := v.ValidateAll(); err != nil {
1379 errors = append(errors, TLSPropertiesValidationError{
1380 field: "PeerCertificateProperties",
1381 reason: "embedded message failed validation",
1382 cause: err,
1383 })
1384 }
1385 case interface{ Validate() error }:
1386 if err := v.Validate(); err != nil {
1387 errors = append(errors, TLSPropertiesValidationError{
1388 field: "PeerCertificateProperties",
1389 reason: "embedded message failed validation",
1390 cause: err,
1391 })
1392 }
1393 }
1394 } else if v, ok := interface{}(m.GetPeerCertificateProperties()).(interface{ Validate() error }); ok {
1395 if err := v.Validate(); err != nil {
1396 return TLSPropertiesValidationError{
1397 field: "PeerCertificateProperties",
1398 reason: "embedded message failed validation",
1399 cause: err,
1400 }
1401 }
1402 }
1403
1404
1405
1406 if len(errors) > 0 {
1407 return TLSPropertiesMultiError(errors)
1408 }
1409
1410 return nil
1411 }
1412
1413
1414
1415
1416 type TLSPropertiesMultiError []error
1417
1418
1419 func (m TLSPropertiesMultiError) Error() string {
1420 var msgs []string
1421 for _, err := range m {
1422 msgs = append(msgs, err.Error())
1423 }
1424 return strings.Join(msgs, "; ")
1425 }
1426
1427
1428 func (m TLSPropertiesMultiError) AllErrors() []error { return m }
1429
1430
1431
1432 type TLSPropertiesValidationError struct {
1433 field string
1434 reason string
1435 cause error
1436 key bool
1437 }
1438
1439
1440 func (e TLSPropertiesValidationError) Field() string { return e.field }
1441
1442
1443 func (e TLSPropertiesValidationError) Reason() string { return e.reason }
1444
1445
1446 func (e TLSPropertiesValidationError) Cause() error { return e.cause }
1447
1448
1449 func (e TLSPropertiesValidationError) Key() bool { return e.key }
1450
1451
1452 func (e TLSPropertiesValidationError) ErrorName() string { return "TLSPropertiesValidationError" }
1453
1454
1455 func (e TLSPropertiesValidationError) Error() string {
1456 cause := ""
1457 if e.cause != nil {
1458 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1459 }
1460
1461 key := ""
1462 if e.key {
1463 key = "key for "
1464 }
1465
1466 return fmt.Sprintf(
1467 "invalid %sTLSProperties.%s: %s%s",
1468 key,
1469 e.field,
1470 e.reason,
1471 cause)
1472 }
1473
1474 var _ error = TLSPropertiesValidationError{}
1475
1476 var _ interface {
1477 Field() string
1478 Reason() string
1479 Key() bool
1480 Cause() error
1481 ErrorName() string
1482 } = TLSPropertiesValidationError{}
1483
1484
1485
1486
1487 func (m *HTTPRequestProperties) Validate() error {
1488 return m.validate(false)
1489 }
1490
1491
1492
1493
1494
1495 func (m *HTTPRequestProperties) ValidateAll() error {
1496 return m.validate(true)
1497 }
1498
1499 func (m *HTTPRequestProperties) validate(all bool) error {
1500 if m == nil {
1501 return nil
1502 }
1503
1504 var errors []error
1505
1506 if _, ok := core.RequestMethod_name[int32(m.GetRequestMethod())]; !ok {
1507 err := HTTPRequestPropertiesValidationError{
1508 field: "RequestMethod",
1509 reason: "value must be one of the defined enum values",
1510 }
1511 if !all {
1512 return err
1513 }
1514 errors = append(errors, err)
1515 }
1516
1517
1518
1519
1520
1521 if all {
1522 switch v := interface{}(m.GetPort()).(type) {
1523 case interface{ ValidateAll() error }:
1524 if err := v.ValidateAll(); err != nil {
1525 errors = append(errors, HTTPRequestPropertiesValidationError{
1526 field: "Port",
1527 reason: "embedded message failed validation",
1528 cause: err,
1529 })
1530 }
1531 case interface{ Validate() error }:
1532 if err := v.Validate(); err != nil {
1533 errors = append(errors, HTTPRequestPropertiesValidationError{
1534 field: "Port",
1535 reason: "embedded message failed validation",
1536 cause: err,
1537 })
1538 }
1539 }
1540 } else if v, ok := interface{}(m.GetPort()).(interface{ Validate() error }); ok {
1541 if err := v.Validate(); err != nil {
1542 return HTTPRequestPropertiesValidationError{
1543 field: "Port",
1544 reason: "embedded message failed validation",
1545 cause: err,
1546 }
1547 }
1548 }
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568 if len(errors) > 0 {
1569 return HTTPRequestPropertiesMultiError(errors)
1570 }
1571
1572 return nil
1573 }
1574
1575
1576
1577
1578 type HTTPRequestPropertiesMultiError []error
1579
1580
1581 func (m HTTPRequestPropertiesMultiError) Error() string {
1582 var msgs []string
1583 for _, err := range m {
1584 msgs = append(msgs, err.Error())
1585 }
1586 return strings.Join(msgs, "; ")
1587 }
1588
1589
1590 func (m HTTPRequestPropertiesMultiError) AllErrors() []error { return m }
1591
1592
1593
1594 type HTTPRequestPropertiesValidationError struct {
1595 field string
1596 reason string
1597 cause error
1598 key bool
1599 }
1600
1601
1602 func (e HTTPRequestPropertiesValidationError) Field() string { return e.field }
1603
1604
1605 func (e HTTPRequestPropertiesValidationError) Reason() string { return e.reason }
1606
1607
1608 func (e HTTPRequestPropertiesValidationError) Cause() error { return e.cause }
1609
1610
1611 func (e HTTPRequestPropertiesValidationError) Key() bool { return e.key }
1612
1613
1614 func (e HTTPRequestPropertiesValidationError) ErrorName() string {
1615 return "HTTPRequestPropertiesValidationError"
1616 }
1617
1618
1619 func (e HTTPRequestPropertiesValidationError) Error() string {
1620 cause := ""
1621 if e.cause != nil {
1622 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1623 }
1624
1625 key := ""
1626 if e.key {
1627 key = "key for "
1628 }
1629
1630 return fmt.Sprintf(
1631 "invalid %sHTTPRequestProperties.%s: %s%s",
1632 key,
1633 e.field,
1634 e.reason,
1635 cause)
1636 }
1637
1638 var _ error = HTTPRequestPropertiesValidationError{}
1639
1640 var _ interface {
1641 Field() string
1642 Reason() string
1643 Key() bool
1644 Cause() error
1645 ErrorName() string
1646 } = HTTPRequestPropertiesValidationError{}
1647
1648
1649
1650
1651 func (m *HTTPResponseProperties) Validate() error {
1652 return m.validate(false)
1653 }
1654
1655
1656
1657
1658
1659 func (m *HTTPResponseProperties) ValidateAll() error {
1660 return m.validate(true)
1661 }
1662
1663 func (m *HTTPResponseProperties) validate(all bool) error {
1664 if m == nil {
1665 return nil
1666 }
1667
1668 var errors []error
1669
1670 if all {
1671 switch v := interface{}(m.GetResponseCode()).(type) {
1672 case interface{ ValidateAll() error }:
1673 if err := v.ValidateAll(); err != nil {
1674 errors = append(errors, HTTPResponsePropertiesValidationError{
1675 field: "ResponseCode",
1676 reason: "embedded message failed validation",
1677 cause: err,
1678 })
1679 }
1680 case interface{ Validate() error }:
1681 if err := v.Validate(); err != nil {
1682 errors = append(errors, HTTPResponsePropertiesValidationError{
1683 field: "ResponseCode",
1684 reason: "embedded message failed validation",
1685 cause: err,
1686 })
1687 }
1688 }
1689 } else if v, ok := interface{}(m.GetResponseCode()).(interface{ Validate() error }); ok {
1690 if err := v.Validate(); err != nil {
1691 return HTTPResponsePropertiesValidationError{
1692 field: "ResponseCode",
1693 reason: "embedded message failed validation",
1694 cause: err,
1695 }
1696 }
1697 }
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709 if len(errors) > 0 {
1710 return HTTPResponsePropertiesMultiError(errors)
1711 }
1712
1713 return nil
1714 }
1715
1716
1717
1718
1719 type HTTPResponsePropertiesMultiError []error
1720
1721
1722 func (m HTTPResponsePropertiesMultiError) Error() string {
1723 var msgs []string
1724 for _, err := range m {
1725 msgs = append(msgs, err.Error())
1726 }
1727 return strings.Join(msgs, "; ")
1728 }
1729
1730
1731 func (m HTTPResponsePropertiesMultiError) AllErrors() []error { return m }
1732
1733
1734
1735 type HTTPResponsePropertiesValidationError struct {
1736 field string
1737 reason string
1738 cause error
1739 key bool
1740 }
1741
1742
1743 func (e HTTPResponsePropertiesValidationError) Field() string { return e.field }
1744
1745
1746 func (e HTTPResponsePropertiesValidationError) Reason() string { return e.reason }
1747
1748
1749 func (e HTTPResponsePropertiesValidationError) Cause() error { return e.cause }
1750
1751
1752 func (e HTTPResponsePropertiesValidationError) Key() bool { return e.key }
1753
1754
1755 func (e HTTPResponsePropertiesValidationError) ErrorName() string {
1756 return "HTTPResponsePropertiesValidationError"
1757 }
1758
1759
1760 func (e HTTPResponsePropertiesValidationError) Error() string {
1761 cause := ""
1762 if e.cause != nil {
1763 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1764 }
1765
1766 key := ""
1767 if e.key {
1768 key = "key for "
1769 }
1770
1771 return fmt.Sprintf(
1772 "invalid %sHTTPResponseProperties.%s: %s%s",
1773 key,
1774 e.field,
1775 e.reason,
1776 cause)
1777 }
1778
1779 var _ error = HTTPResponsePropertiesValidationError{}
1780
1781 var _ interface {
1782 Field() string
1783 Reason() string
1784 Key() bool
1785 Cause() error
1786 ErrorName() string
1787 } = HTTPResponsePropertiesValidationError{}
1788
1789
1790
1791
1792 func (m *ResponseFlags_Unauthorized) Validate() error {
1793 return m.validate(false)
1794 }
1795
1796
1797
1798
1799
1800 func (m *ResponseFlags_Unauthorized) ValidateAll() error {
1801 return m.validate(true)
1802 }
1803
1804 func (m *ResponseFlags_Unauthorized) validate(all bool) error {
1805 if m == nil {
1806 return nil
1807 }
1808
1809 var errors []error
1810
1811
1812
1813 if len(errors) > 0 {
1814 return ResponseFlags_UnauthorizedMultiError(errors)
1815 }
1816
1817 return nil
1818 }
1819
1820
1821
1822
1823 type ResponseFlags_UnauthorizedMultiError []error
1824
1825
1826 func (m ResponseFlags_UnauthorizedMultiError) Error() string {
1827 var msgs []string
1828 for _, err := range m {
1829 msgs = append(msgs, err.Error())
1830 }
1831 return strings.Join(msgs, "; ")
1832 }
1833
1834
1835 func (m ResponseFlags_UnauthorizedMultiError) AllErrors() []error { return m }
1836
1837
1838
1839 type ResponseFlags_UnauthorizedValidationError struct {
1840 field string
1841 reason string
1842 cause error
1843 key bool
1844 }
1845
1846
1847 func (e ResponseFlags_UnauthorizedValidationError) Field() string { return e.field }
1848
1849
1850 func (e ResponseFlags_UnauthorizedValidationError) Reason() string { return e.reason }
1851
1852
1853 func (e ResponseFlags_UnauthorizedValidationError) Cause() error { return e.cause }
1854
1855
1856 func (e ResponseFlags_UnauthorizedValidationError) Key() bool { return e.key }
1857
1858
1859 func (e ResponseFlags_UnauthorizedValidationError) ErrorName() string {
1860 return "ResponseFlags_UnauthorizedValidationError"
1861 }
1862
1863
1864 func (e ResponseFlags_UnauthorizedValidationError) Error() string {
1865 cause := ""
1866 if e.cause != nil {
1867 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1868 }
1869
1870 key := ""
1871 if e.key {
1872 key = "key for "
1873 }
1874
1875 return fmt.Sprintf(
1876 "invalid %sResponseFlags_Unauthorized.%s: %s%s",
1877 key,
1878 e.field,
1879 e.reason,
1880 cause)
1881 }
1882
1883 var _ error = ResponseFlags_UnauthorizedValidationError{}
1884
1885 var _ interface {
1886 Field() string
1887 Reason() string
1888 Key() bool
1889 Cause() error
1890 ErrorName() string
1891 } = ResponseFlags_UnauthorizedValidationError{}
1892
1893
1894
1895
1896
1897 func (m *TLSProperties_CertificateProperties) Validate() error {
1898 return m.validate(false)
1899 }
1900
1901
1902
1903
1904
1905 func (m *TLSProperties_CertificateProperties) ValidateAll() error {
1906 return m.validate(true)
1907 }
1908
1909 func (m *TLSProperties_CertificateProperties) validate(all bool) error {
1910 if m == nil {
1911 return nil
1912 }
1913
1914 var errors []error
1915
1916 for idx, item := range m.GetSubjectAltName() {
1917 _, _ = idx, item
1918
1919 if all {
1920 switch v := interface{}(item).(type) {
1921 case interface{ ValidateAll() error }:
1922 if err := v.ValidateAll(); err != nil {
1923 errors = append(errors, TLSProperties_CertificatePropertiesValidationError{
1924 field: fmt.Sprintf("SubjectAltName[%v]", idx),
1925 reason: "embedded message failed validation",
1926 cause: err,
1927 })
1928 }
1929 case interface{ Validate() error }:
1930 if err := v.Validate(); err != nil {
1931 errors = append(errors, TLSProperties_CertificatePropertiesValidationError{
1932 field: fmt.Sprintf("SubjectAltName[%v]", idx),
1933 reason: "embedded message failed validation",
1934 cause: err,
1935 })
1936 }
1937 }
1938 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1939 if err := v.Validate(); err != nil {
1940 return TLSProperties_CertificatePropertiesValidationError{
1941 field: fmt.Sprintf("SubjectAltName[%v]", idx),
1942 reason: "embedded message failed validation",
1943 cause: err,
1944 }
1945 }
1946 }
1947
1948 }
1949
1950
1951
1952 if len(errors) > 0 {
1953 return TLSProperties_CertificatePropertiesMultiError(errors)
1954 }
1955
1956 return nil
1957 }
1958
1959
1960
1961
1962
1963 type TLSProperties_CertificatePropertiesMultiError []error
1964
1965
1966 func (m TLSProperties_CertificatePropertiesMultiError) Error() string {
1967 var msgs []string
1968 for _, err := range m {
1969 msgs = append(msgs, err.Error())
1970 }
1971 return strings.Join(msgs, "; ")
1972 }
1973
1974
1975 func (m TLSProperties_CertificatePropertiesMultiError) AllErrors() []error { return m }
1976
1977
1978
1979
1980 type TLSProperties_CertificatePropertiesValidationError struct {
1981 field string
1982 reason string
1983 cause error
1984 key bool
1985 }
1986
1987
1988 func (e TLSProperties_CertificatePropertiesValidationError) Field() string { return e.field }
1989
1990
1991 func (e TLSProperties_CertificatePropertiesValidationError) Reason() string { return e.reason }
1992
1993
1994 func (e TLSProperties_CertificatePropertiesValidationError) Cause() error { return e.cause }
1995
1996
1997 func (e TLSProperties_CertificatePropertiesValidationError) Key() bool { return e.key }
1998
1999
2000 func (e TLSProperties_CertificatePropertiesValidationError) ErrorName() string {
2001 return "TLSProperties_CertificatePropertiesValidationError"
2002 }
2003
2004
2005 func (e TLSProperties_CertificatePropertiesValidationError) Error() string {
2006 cause := ""
2007 if e.cause != nil {
2008 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2009 }
2010
2011 key := ""
2012 if e.key {
2013 key = "key for "
2014 }
2015
2016 return fmt.Sprintf(
2017 "invalid %sTLSProperties_CertificateProperties.%s: %s%s",
2018 key,
2019 e.field,
2020 e.reason,
2021 cause)
2022 }
2023
2024 var _ error = TLSProperties_CertificatePropertiesValidationError{}
2025
2026 var _ interface {
2027 Field() string
2028 Reason() string
2029 Key() bool
2030 Cause() error
2031 ErrorName() string
2032 } = TLSProperties_CertificatePropertiesValidationError{}
2033
2034
2035
2036
2037
2038 func (m *TLSProperties_CertificateProperties_SubjectAltName) Validate() error {
2039 return m.validate(false)
2040 }
2041
2042
2043
2044
2045
2046
2047
2048 func (m *TLSProperties_CertificateProperties_SubjectAltName) ValidateAll() error {
2049 return m.validate(true)
2050 }
2051
2052 func (m *TLSProperties_CertificateProperties_SubjectAltName) validate(all bool) error {
2053 if m == nil {
2054 return nil
2055 }
2056
2057 var errors []error
2058
2059 switch v := m.San.(type) {
2060 case *TLSProperties_CertificateProperties_SubjectAltName_Uri:
2061 if v == nil {
2062 err := TLSProperties_CertificateProperties_SubjectAltNameValidationError{
2063 field: "San",
2064 reason: "oneof value cannot be a typed-nil",
2065 }
2066 if !all {
2067 return err
2068 }
2069 errors = append(errors, err)
2070 }
2071
2072 case *TLSProperties_CertificateProperties_SubjectAltName_Dns:
2073 if v == nil {
2074 err := TLSProperties_CertificateProperties_SubjectAltNameValidationError{
2075 field: "San",
2076 reason: "oneof value cannot be a typed-nil",
2077 }
2078 if !all {
2079 return err
2080 }
2081 errors = append(errors, err)
2082 }
2083
2084 default:
2085 _ = v
2086 }
2087
2088 if len(errors) > 0 {
2089 return TLSProperties_CertificateProperties_SubjectAltNameMultiError(errors)
2090 }
2091
2092 return nil
2093 }
2094
2095
2096
2097
2098
2099 type TLSProperties_CertificateProperties_SubjectAltNameMultiError []error
2100
2101
2102 func (m TLSProperties_CertificateProperties_SubjectAltNameMultiError) Error() string {
2103 var msgs []string
2104 for _, err := range m {
2105 msgs = append(msgs, err.Error())
2106 }
2107 return strings.Join(msgs, "; ")
2108 }
2109
2110
2111 func (m TLSProperties_CertificateProperties_SubjectAltNameMultiError) AllErrors() []error { return m }
2112
2113
2114
2115
2116
2117 type TLSProperties_CertificateProperties_SubjectAltNameValidationError struct {
2118 field string
2119 reason string
2120 cause error
2121 key bool
2122 }
2123
2124
2125 func (e TLSProperties_CertificateProperties_SubjectAltNameValidationError) Field() string {
2126 return e.field
2127 }
2128
2129
2130 func (e TLSProperties_CertificateProperties_SubjectAltNameValidationError) Reason() string {
2131 return e.reason
2132 }
2133
2134
2135 func (e TLSProperties_CertificateProperties_SubjectAltNameValidationError) Cause() error {
2136 return e.cause
2137 }
2138
2139
2140 func (e TLSProperties_CertificateProperties_SubjectAltNameValidationError) Key() bool { return e.key }
2141
2142
2143 func (e TLSProperties_CertificateProperties_SubjectAltNameValidationError) ErrorName() string {
2144 return "TLSProperties_CertificateProperties_SubjectAltNameValidationError"
2145 }
2146
2147
2148 func (e TLSProperties_CertificateProperties_SubjectAltNameValidationError) Error() string {
2149 cause := ""
2150 if e.cause != nil {
2151 cause = fmt.Sprintf(" | caused by: %v", e.cause)
2152 }
2153
2154 key := ""
2155 if e.key {
2156 key = "key for "
2157 }
2158
2159 return fmt.Sprintf(
2160 "invalid %sTLSProperties_CertificateProperties_SubjectAltName.%s: %s%s",
2161 key,
2162 e.field,
2163 e.reason,
2164 cause)
2165 }
2166
2167 var _ error = TLSProperties_CertificateProperties_SubjectAltNameValidationError{}
2168
2169 var _ interface {
2170 Field() string
2171 Reason() string
2172 Key() bool
2173 Cause() error
2174 ErrorName() string
2175 } = TLSProperties_CertificateProperties_SubjectAltNameValidationError{}
2176
View as plain text