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
22
23 var (
24 _ = bytes.MinRead
25 _ = errors.New("")
26 _ = fmt.Print
27 _ = utf8.UTFMax
28 _ = (*regexp.Regexp)(nil)
29 _ = (*strings.Reader)(nil)
30 _ = net.IPv4len
31 _ = time.Duration(0)
32 _ = (*url.URL)(nil)
33 _ = (*mail.Address)(nil)
34 _ = anypb.Any{}
35 _ = sort.Sort
36 )
37
38
39
40
41 func (m *StreamAccessLogsResponse) Validate() error {
42 return m.validate(false)
43 }
44
45
46
47
48
49 func (m *StreamAccessLogsResponse) ValidateAll() error {
50 return m.validate(true)
51 }
52
53 func (m *StreamAccessLogsResponse) validate(all bool) error {
54 if m == nil {
55 return nil
56 }
57
58 var errors []error
59
60 if len(errors) > 0 {
61 return StreamAccessLogsResponseMultiError(errors)
62 }
63
64 return nil
65 }
66
67
68
69
70 type StreamAccessLogsResponseMultiError []error
71
72
73 func (m StreamAccessLogsResponseMultiError) Error() string {
74 var msgs []string
75 for _, err := range m {
76 msgs = append(msgs, err.Error())
77 }
78 return strings.Join(msgs, "; ")
79 }
80
81
82 func (m StreamAccessLogsResponseMultiError) AllErrors() []error { return m }
83
84
85
86 type StreamAccessLogsResponseValidationError struct {
87 field string
88 reason string
89 cause error
90 key bool
91 }
92
93
94 func (e StreamAccessLogsResponseValidationError) Field() string { return e.field }
95
96
97 func (e StreamAccessLogsResponseValidationError) Reason() string { return e.reason }
98
99
100 func (e StreamAccessLogsResponseValidationError) Cause() error { return e.cause }
101
102
103 func (e StreamAccessLogsResponseValidationError) Key() bool { return e.key }
104
105
106 func (e StreamAccessLogsResponseValidationError) ErrorName() string {
107 return "StreamAccessLogsResponseValidationError"
108 }
109
110
111 func (e StreamAccessLogsResponseValidationError) Error() string {
112 cause := ""
113 if e.cause != nil {
114 cause = fmt.Sprintf(" | caused by: %v", e.cause)
115 }
116
117 key := ""
118 if e.key {
119 key = "key for "
120 }
121
122 return fmt.Sprintf(
123 "invalid %sStreamAccessLogsResponse.%s: %s%s",
124 key,
125 e.field,
126 e.reason,
127 cause)
128 }
129
130 var _ error = StreamAccessLogsResponseValidationError{}
131
132 var _ interface {
133 Field() string
134 Reason() string
135 Key() bool
136 Cause() error
137 ErrorName() string
138 } = StreamAccessLogsResponseValidationError{}
139
140
141
142
143 func (m *StreamAccessLogsMessage) Validate() error {
144 return m.validate(false)
145 }
146
147
148
149
150
151 func (m *StreamAccessLogsMessage) ValidateAll() error {
152 return m.validate(true)
153 }
154
155 func (m *StreamAccessLogsMessage) validate(all bool) error {
156 if m == nil {
157 return nil
158 }
159
160 var errors []error
161
162 if all {
163 switch v := interface{}(m.GetIdentifier()).(type) {
164 case interface{ ValidateAll() error }:
165 if err := v.ValidateAll(); err != nil {
166 errors = append(errors, StreamAccessLogsMessageValidationError{
167 field: "Identifier",
168 reason: "embedded message failed validation",
169 cause: err,
170 })
171 }
172 case interface{ Validate() error }:
173 if err := v.Validate(); err != nil {
174 errors = append(errors, StreamAccessLogsMessageValidationError{
175 field: "Identifier",
176 reason: "embedded message failed validation",
177 cause: err,
178 })
179 }
180 }
181 } else if v, ok := interface{}(m.GetIdentifier()).(interface{ Validate() error }); ok {
182 if err := v.Validate(); err != nil {
183 return StreamAccessLogsMessageValidationError{
184 field: "Identifier",
185 reason: "embedded message failed validation",
186 cause: err,
187 }
188 }
189 }
190
191 oneofLogEntriesPresent := false
192 switch v := m.LogEntries.(type) {
193 case *StreamAccessLogsMessage_HttpLogs:
194 if v == nil {
195 err := StreamAccessLogsMessageValidationError{
196 field: "LogEntries",
197 reason: "oneof value cannot be a typed-nil",
198 }
199 if !all {
200 return err
201 }
202 errors = append(errors, err)
203 }
204 oneofLogEntriesPresent = true
205
206 if all {
207 switch v := interface{}(m.GetHttpLogs()).(type) {
208 case interface{ ValidateAll() error }:
209 if err := v.ValidateAll(); err != nil {
210 errors = append(errors, StreamAccessLogsMessageValidationError{
211 field: "HttpLogs",
212 reason: "embedded message failed validation",
213 cause: err,
214 })
215 }
216 case interface{ Validate() error }:
217 if err := v.Validate(); err != nil {
218 errors = append(errors, StreamAccessLogsMessageValidationError{
219 field: "HttpLogs",
220 reason: "embedded message failed validation",
221 cause: err,
222 })
223 }
224 }
225 } else if v, ok := interface{}(m.GetHttpLogs()).(interface{ Validate() error }); ok {
226 if err := v.Validate(); err != nil {
227 return StreamAccessLogsMessageValidationError{
228 field: "HttpLogs",
229 reason: "embedded message failed validation",
230 cause: err,
231 }
232 }
233 }
234
235 case *StreamAccessLogsMessage_TcpLogs:
236 if v == nil {
237 err := StreamAccessLogsMessageValidationError{
238 field: "LogEntries",
239 reason: "oneof value cannot be a typed-nil",
240 }
241 if !all {
242 return err
243 }
244 errors = append(errors, err)
245 }
246 oneofLogEntriesPresent = true
247
248 if all {
249 switch v := interface{}(m.GetTcpLogs()).(type) {
250 case interface{ ValidateAll() error }:
251 if err := v.ValidateAll(); err != nil {
252 errors = append(errors, StreamAccessLogsMessageValidationError{
253 field: "TcpLogs",
254 reason: "embedded message failed validation",
255 cause: err,
256 })
257 }
258 case interface{ Validate() error }:
259 if err := v.Validate(); err != nil {
260 errors = append(errors, StreamAccessLogsMessageValidationError{
261 field: "TcpLogs",
262 reason: "embedded message failed validation",
263 cause: err,
264 })
265 }
266 }
267 } else if v, ok := interface{}(m.GetTcpLogs()).(interface{ Validate() error }); ok {
268 if err := v.Validate(); err != nil {
269 return StreamAccessLogsMessageValidationError{
270 field: "TcpLogs",
271 reason: "embedded message failed validation",
272 cause: err,
273 }
274 }
275 }
276
277 default:
278 _ = v
279 }
280 if !oneofLogEntriesPresent {
281 err := StreamAccessLogsMessageValidationError{
282 field: "LogEntries",
283 reason: "value is required",
284 }
285 if !all {
286 return err
287 }
288 errors = append(errors, err)
289 }
290
291 if len(errors) > 0 {
292 return StreamAccessLogsMessageMultiError(errors)
293 }
294
295 return nil
296 }
297
298
299
300
301 type StreamAccessLogsMessageMultiError []error
302
303
304 func (m StreamAccessLogsMessageMultiError) Error() string {
305 var msgs []string
306 for _, err := range m {
307 msgs = append(msgs, err.Error())
308 }
309 return strings.Join(msgs, "; ")
310 }
311
312
313 func (m StreamAccessLogsMessageMultiError) AllErrors() []error { return m }
314
315
316
317 type StreamAccessLogsMessageValidationError struct {
318 field string
319 reason string
320 cause error
321 key bool
322 }
323
324
325 func (e StreamAccessLogsMessageValidationError) Field() string { return e.field }
326
327
328 func (e StreamAccessLogsMessageValidationError) Reason() string { return e.reason }
329
330
331 func (e StreamAccessLogsMessageValidationError) Cause() error { return e.cause }
332
333
334 func (e StreamAccessLogsMessageValidationError) Key() bool { return e.key }
335
336
337 func (e StreamAccessLogsMessageValidationError) ErrorName() string {
338 return "StreamAccessLogsMessageValidationError"
339 }
340
341
342 func (e StreamAccessLogsMessageValidationError) Error() string {
343 cause := ""
344 if e.cause != nil {
345 cause = fmt.Sprintf(" | caused by: %v", e.cause)
346 }
347
348 key := ""
349 if e.key {
350 key = "key for "
351 }
352
353 return fmt.Sprintf(
354 "invalid %sStreamAccessLogsMessage.%s: %s%s",
355 key,
356 e.field,
357 e.reason,
358 cause)
359 }
360
361 var _ error = StreamAccessLogsMessageValidationError{}
362
363 var _ interface {
364 Field() string
365 Reason() string
366 Key() bool
367 Cause() error
368 ErrorName() string
369 } = StreamAccessLogsMessageValidationError{}
370
371
372
373
374
375 func (m *StreamAccessLogsMessage_Identifier) Validate() error {
376 return m.validate(false)
377 }
378
379
380
381
382
383 func (m *StreamAccessLogsMessage_Identifier) ValidateAll() error {
384 return m.validate(true)
385 }
386
387 func (m *StreamAccessLogsMessage_Identifier) validate(all bool) error {
388 if m == nil {
389 return nil
390 }
391
392 var errors []error
393
394 if m.GetNode() == nil {
395 err := StreamAccessLogsMessage_IdentifierValidationError{
396 field: "Node",
397 reason: "value is required",
398 }
399 if !all {
400 return err
401 }
402 errors = append(errors, err)
403 }
404
405 if all {
406 switch v := interface{}(m.GetNode()).(type) {
407 case interface{ ValidateAll() error }:
408 if err := v.ValidateAll(); err != nil {
409 errors = append(errors, StreamAccessLogsMessage_IdentifierValidationError{
410 field: "Node",
411 reason: "embedded message failed validation",
412 cause: err,
413 })
414 }
415 case interface{ Validate() error }:
416 if err := v.Validate(); err != nil {
417 errors = append(errors, StreamAccessLogsMessage_IdentifierValidationError{
418 field: "Node",
419 reason: "embedded message failed validation",
420 cause: err,
421 })
422 }
423 }
424 } else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
425 if err := v.Validate(); err != nil {
426 return StreamAccessLogsMessage_IdentifierValidationError{
427 field: "Node",
428 reason: "embedded message failed validation",
429 cause: err,
430 }
431 }
432 }
433
434 if len(m.GetLogName()) < 1 {
435 err := StreamAccessLogsMessage_IdentifierValidationError{
436 field: "LogName",
437 reason: "value length must be at least 1 bytes",
438 }
439 if !all {
440 return err
441 }
442 errors = append(errors, err)
443 }
444
445 if len(errors) > 0 {
446 return StreamAccessLogsMessage_IdentifierMultiError(errors)
447 }
448
449 return nil
450 }
451
452
453
454
455
456 type StreamAccessLogsMessage_IdentifierMultiError []error
457
458
459 func (m StreamAccessLogsMessage_IdentifierMultiError) Error() string {
460 var msgs []string
461 for _, err := range m {
462 msgs = append(msgs, err.Error())
463 }
464 return strings.Join(msgs, "; ")
465 }
466
467
468 func (m StreamAccessLogsMessage_IdentifierMultiError) AllErrors() []error { return m }
469
470
471
472
473 type StreamAccessLogsMessage_IdentifierValidationError struct {
474 field string
475 reason string
476 cause error
477 key bool
478 }
479
480
481 func (e StreamAccessLogsMessage_IdentifierValidationError) Field() string { return e.field }
482
483
484 func (e StreamAccessLogsMessage_IdentifierValidationError) Reason() string { return e.reason }
485
486
487 func (e StreamAccessLogsMessage_IdentifierValidationError) Cause() error { return e.cause }
488
489
490 func (e StreamAccessLogsMessage_IdentifierValidationError) Key() bool { return e.key }
491
492
493 func (e StreamAccessLogsMessage_IdentifierValidationError) ErrorName() string {
494 return "StreamAccessLogsMessage_IdentifierValidationError"
495 }
496
497
498 func (e StreamAccessLogsMessage_IdentifierValidationError) Error() string {
499 cause := ""
500 if e.cause != nil {
501 cause = fmt.Sprintf(" | caused by: %v", e.cause)
502 }
503
504 key := ""
505 if e.key {
506 key = "key for "
507 }
508
509 return fmt.Sprintf(
510 "invalid %sStreamAccessLogsMessage_Identifier.%s: %s%s",
511 key,
512 e.field,
513 e.reason,
514 cause)
515 }
516
517 var _ error = StreamAccessLogsMessage_IdentifierValidationError{}
518
519 var _ interface {
520 Field() string
521 Reason() string
522 Key() bool
523 Cause() error
524 ErrorName() string
525 } = StreamAccessLogsMessage_IdentifierValidationError{}
526
527
528
529
530
531 func (m *StreamAccessLogsMessage_HTTPAccessLogEntries) Validate() error {
532 return m.validate(false)
533 }
534
535
536
537
538
539
540 func (m *StreamAccessLogsMessage_HTTPAccessLogEntries) ValidateAll() error {
541 return m.validate(true)
542 }
543
544 func (m *StreamAccessLogsMessage_HTTPAccessLogEntries) validate(all bool) error {
545 if m == nil {
546 return nil
547 }
548
549 var errors []error
550
551 if len(m.GetLogEntry()) < 1 {
552 err := StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{
553 field: "LogEntry",
554 reason: "value must contain at least 1 item(s)",
555 }
556 if !all {
557 return err
558 }
559 errors = append(errors, err)
560 }
561
562 for idx, item := range m.GetLogEntry() {
563 _, _ = idx, item
564
565 if all {
566 switch v := interface{}(item).(type) {
567 case interface{ ValidateAll() error }:
568 if err := v.ValidateAll(); err != nil {
569 errors = append(errors, StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{
570 field: fmt.Sprintf("LogEntry[%v]", idx),
571 reason: "embedded message failed validation",
572 cause: err,
573 })
574 }
575 case interface{ Validate() error }:
576 if err := v.Validate(); err != nil {
577 errors = append(errors, StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{
578 field: fmt.Sprintf("LogEntry[%v]", idx),
579 reason: "embedded message failed validation",
580 cause: err,
581 })
582 }
583 }
584 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
585 if err := v.Validate(); err != nil {
586 return StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{
587 field: fmt.Sprintf("LogEntry[%v]", idx),
588 reason: "embedded message failed validation",
589 cause: err,
590 }
591 }
592 }
593
594 }
595
596 if len(errors) > 0 {
597 return StreamAccessLogsMessage_HTTPAccessLogEntriesMultiError(errors)
598 }
599
600 return nil
601 }
602
603
604
605
606
607 type StreamAccessLogsMessage_HTTPAccessLogEntriesMultiError []error
608
609
610 func (m StreamAccessLogsMessage_HTTPAccessLogEntriesMultiError) Error() string {
611 var msgs []string
612 for _, err := range m {
613 msgs = append(msgs, err.Error())
614 }
615 return strings.Join(msgs, "; ")
616 }
617
618
619 func (m StreamAccessLogsMessage_HTTPAccessLogEntriesMultiError) AllErrors() []error { return m }
620
621
622
623
624
625 type StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError struct {
626 field string
627 reason string
628 cause error
629 key bool
630 }
631
632
633 func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Field() string { return e.field }
634
635
636 func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Reason() string { return e.reason }
637
638
639 func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Cause() error { return e.cause }
640
641
642 func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Key() bool { return e.key }
643
644
645 func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) ErrorName() string {
646 return "StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError"
647 }
648
649
650 func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Error() string {
651 cause := ""
652 if e.cause != nil {
653 cause = fmt.Sprintf(" | caused by: %v", e.cause)
654 }
655
656 key := ""
657 if e.key {
658 key = "key for "
659 }
660
661 return fmt.Sprintf(
662 "invalid %sStreamAccessLogsMessage_HTTPAccessLogEntries.%s: %s%s",
663 key,
664 e.field,
665 e.reason,
666 cause)
667 }
668
669 var _ error = StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{}
670
671 var _ interface {
672 Field() string
673 Reason() string
674 Key() bool
675 Cause() error
676 ErrorName() string
677 } = StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{}
678
679
680
681
682
683 func (m *StreamAccessLogsMessage_TCPAccessLogEntries) Validate() error {
684 return m.validate(false)
685 }
686
687
688
689
690
691
692 func (m *StreamAccessLogsMessage_TCPAccessLogEntries) ValidateAll() error {
693 return m.validate(true)
694 }
695
696 func (m *StreamAccessLogsMessage_TCPAccessLogEntries) validate(all bool) error {
697 if m == nil {
698 return nil
699 }
700
701 var errors []error
702
703 if len(m.GetLogEntry()) < 1 {
704 err := StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{
705 field: "LogEntry",
706 reason: "value must contain at least 1 item(s)",
707 }
708 if !all {
709 return err
710 }
711 errors = append(errors, err)
712 }
713
714 for idx, item := range m.GetLogEntry() {
715 _, _ = idx, item
716
717 if all {
718 switch v := interface{}(item).(type) {
719 case interface{ ValidateAll() error }:
720 if err := v.ValidateAll(); err != nil {
721 errors = append(errors, StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{
722 field: fmt.Sprintf("LogEntry[%v]", idx),
723 reason: "embedded message failed validation",
724 cause: err,
725 })
726 }
727 case interface{ Validate() error }:
728 if err := v.Validate(); err != nil {
729 errors = append(errors, StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{
730 field: fmt.Sprintf("LogEntry[%v]", idx),
731 reason: "embedded message failed validation",
732 cause: err,
733 })
734 }
735 }
736 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
737 if err := v.Validate(); err != nil {
738 return StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{
739 field: fmt.Sprintf("LogEntry[%v]", idx),
740 reason: "embedded message failed validation",
741 cause: err,
742 }
743 }
744 }
745
746 }
747
748 if len(errors) > 0 {
749 return StreamAccessLogsMessage_TCPAccessLogEntriesMultiError(errors)
750 }
751
752 return nil
753 }
754
755
756
757
758
759 type StreamAccessLogsMessage_TCPAccessLogEntriesMultiError []error
760
761
762 func (m StreamAccessLogsMessage_TCPAccessLogEntriesMultiError) Error() string {
763 var msgs []string
764 for _, err := range m {
765 msgs = append(msgs, err.Error())
766 }
767 return strings.Join(msgs, "; ")
768 }
769
770
771 func (m StreamAccessLogsMessage_TCPAccessLogEntriesMultiError) AllErrors() []error { return m }
772
773
774
775
776 type StreamAccessLogsMessage_TCPAccessLogEntriesValidationError struct {
777 field string
778 reason string
779 cause error
780 key bool
781 }
782
783
784 func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Field() string { return e.field }
785
786
787 func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Reason() string { return e.reason }
788
789
790 func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Cause() error { return e.cause }
791
792
793 func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Key() bool { return e.key }
794
795
796 func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) ErrorName() string {
797 return "StreamAccessLogsMessage_TCPAccessLogEntriesValidationError"
798 }
799
800
801 func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Error() string {
802 cause := ""
803 if e.cause != nil {
804 cause = fmt.Sprintf(" | caused by: %v", e.cause)
805 }
806
807 key := ""
808 if e.key {
809 key = "key for "
810 }
811
812 return fmt.Sprintf(
813 "invalid %sStreamAccessLogsMessage_TCPAccessLogEntries.%s: %s%s",
814 key,
815 e.field,
816 e.reason,
817 cause)
818 }
819
820 var _ error = StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{}
821
822 var _ interface {
823 Field() string
824 Reason() string
825 Key() bool
826 Cause() error
827 ErrorName() string
828 } = StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{}
829
View as plain text