1
2
3
4 package v2alpha
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.HealthStatus(0)
40 )
41
42
43
44
45 func (m *Clusters) Validate() error {
46 return m.validate(false)
47 }
48
49
50
51
52
53 func (m *Clusters) ValidateAll() error {
54 return m.validate(true)
55 }
56
57 func (m *Clusters) validate(all bool) error {
58 if m == nil {
59 return nil
60 }
61
62 var errors []error
63
64 for idx, item := range m.GetClusterStatuses() {
65 _, _ = idx, item
66
67 if all {
68 switch v := interface{}(item).(type) {
69 case interface{ ValidateAll() error }:
70 if err := v.ValidateAll(); err != nil {
71 errors = append(errors, ClustersValidationError{
72 field: fmt.Sprintf("ClusterStatuses[%v]", idx),
73 reason: "embedded message failed validation",
74 cause: err,
75 })
76 }
77 case interface{ Validate() error }:
78 if err := v.Validate(); err != nil {
79 errors = append(errors, ClustersValidationError{
80 field: fmt.Sprintf("ClusterStatuses[%v]", idx),
81 reason: "embedded message failed validation",
82 cause: err,
83 })
84 }
85 }
86 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
87 if err := v.Validate(); err != nil {
88 return ClustersValidationError{
89 field: fmt.Sprintf("ClusterStatuses[%v]", idx),
90 reason: "embedded message failed validation",
91 cause: err,
92 }
93 }
94 }
95
96 }
97
98 if len(errors) > 0 {
99 return ClustersMultiError(errors)
100 }
101
102 return nil
103 }
104
105
106
107 type ClustersMultiError []error
108
109
110 func (m ClustersMultiError) Error() string {
111 var msgs []string
112 for _, err := range m {
113 msgs = append(msgs, err.Error())
114 }
115 return strings.Join(msgs, "; ")
116 }
117
118
119 func (m ClustersMultiError) AllErrors() []error { return m }
120
121
122
123 type ClustersValidationError struct {
124 field string
125 reason string
126 cause error
127 key bool
128 }
129
130
131 func (e ClustersValidationError) Field() string { return e.field }
132
133
134 func (e ClustersValidationError) Reason() string { return e.reason }
135
136
137 func (e ClustersValidationError) Cause() error { return e.cause }
138
139
140 func (e ClustersValidationError) Key() bool { return e.key }
141
142
143 func (e ClustersValidationError) ErrorName() string { return "ClustersValidationError" }
144
145
146 func (e ClustersValidationError) Error() string {
147 cause := ""
148 if e.cause != nil {
149 cause = fmt.Sprintf(" | caused by: %v", e.cause)
150 }
151
152 key := ""
153 if e.key {
154 key = "key for "
155 }
156
157 return fmt.Sprintf(
158 "invalid %sClusters.%s: %s%s",
159 key,
160 e.field,
161 e.reason,
162 cause)
163 }
164
165 var _ error = ClustersValidationError{}
166
167 var _ interface {
168 Field() string
169 Reason() string
170 Key() bool
171 Cause() error
172 ErrorName() string
173 } = ClustersValidationError{}
174
175
176
177
178 func (m *ClusterStatus) Validate() error {
179 return m.validate(false)
180 }
181
182
183
184
185
186 func (m *ClusterStatus) ValidateAll() error {
187 return m.validate(true)
188 }
189
190 func (m *ClusterStatus) validate(all bool) error {
191 if m == nil {
192 return nil
193 }
194
195 var errors []error
196
197
198
199
200
201 if all {
202 switch v := interface{}(m.GetSuccessRateEjectionThreshold()).(type) {
203 case interface{ ValidateAll() error }:
204 if err := v.ValidateAll(); err != nil {
205 errors = append(errors, ClusterStatusValidationError{
206 field: "SuccessRateEjectionThreshold",
207 reason: "embedded message failed validation",
208 cause: err,
209 })
210 }
211 case interface{ Validate() error }:
212 if err := v.Validate(); err != nil {
213 errors = append(errors, ClusterStatusValidationError{
214 field: "SuccessRateEjectionThreshold",
215 reason: "embedded message failed validation",
216 cause: err,
217 })
218 }
219 }
220 } else if v, ok := interface{}(m.GetSuccessRateEjectionThreshold()).(interface{ Validate() error }); ok {
221 if err := v.Validate(); err != nil {
222 return ClusterStatusValidationError{
223 field: "SuccessRateEjectionThreshold",
224 reason: "embedded message failed validation",
225 cause: err,
226 }
227 }
228 }
229
230 for idx, item := range m.GetHostStatuses() {
231 _, _ = idx, item
232
233 if all {
234 switch v := interface{}(item).(type) {
235 case interface{ ValidateAll() error }:
236 if err := v.ValidateAll(); err != nil {
237 errors = append(errors, ClusterStatusValidationError{
238 field: fmt.Sprintf("HostStatuses[%v]", idx),
239 reason: "embedded message failed validation",
240 cause: err,
241 })
242 }
243 case interface{ Validate() error }:
244 if err := v.Validate(); err != nil {
245 errors = append(errors, ClusterStatusValidationError{
246 field: fmt.Sprintf("HostStatuses[%v]", idx),
247 reason: "embedded message failed validation",
248 cause: err,
249 })
250 }
251 }
252 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
253 if err := v.Validate(); err != nil {
254 return ClusterStatusValidationError{
255 field: fmt.Sprintf("HostStatuses[%v]", idx),
256 reason: "embedded message failed validation",
257 cause: err,
258 }
259 }
260 }
261
262 }
263
264 if all {
265 switch v := interface{}(m.GetLocalOriginSuccessRateEjectionThreshold()).(type) {
266 case interface{ ValidateAll() error }:
267 if err := v.ValidateAll(); err != nil {
268 errors = append(errors, ClusterStatusValidationError{
269 field: "LocalOriginSuccessRateEjectionThreshold",
270 reason: "embedded message failed validation",
271 cause: err,
272 })
273 }
274 case interface{ Validate() error }:
275 if err := v.Validate(); err != nil {
276 errors = append(errors, ClusterStatusValidationError{
277 field: "LocalOriginSuccessRateEjectionThreshold",
278 reason: "embedded message failed validation",
279 cause: err,
280 })
281 }
282 }
283 } else if v, ok := interface{}(m.GetLocalOriginSuccessRateEjectionThreshold()).(interface{ Validate() error }); ok {
284 if err := v.Validate(); err != nil {
285 return ClusterStatusValidationError{
286 field: "LocalOriginSuccessRateEjectionThreshold",
287 reason: "embedded message failed validation",
288 cause: err,
289 }
290 }
291 }
292
293 if len(errors) > 0 {
294 return ClusterStatusMultiError(errors)
295 }
296
297 return nil
298 }
299
300
301
302
303 type ClusterStatusMultiError []error
304
305
306 func (m ClusterStatusMultiError) Error() string {
307 var msgs []string
308 for _, err := range m {
309 msgs = append(msgs, err.Error())
310 }
311 return strings.Join(msgs, "; ")
312 }
313
314
315 func (m ClusterStatusMultiError) AllErrors() []error { return m }
316
317
318
319 type ClusterStatusValidationError struct {
320 field string
321 reason string
322 cause error
323 key bool
324 }
325
326
327 func (e ClusterStatusValidationError) Field() string { return e.field }
328
329
330 func (e ClusterStatusValidationError) Reason() string { return e.reason }
331
332
333 func (e ClusterStatusValidationError) Cause() error { return e.cause }
334
335
336 func (e ClusterStatusValidationError) Key() bool { return e.key }
337
338
339 func (e ClusterStatusValidationError) ErrorName() string { return "ClusterStatusValidationError" }
340
341
342 func (e ClusterStatusValidationError) 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 %sClusterStatus.%s: %s%s",
355 key,
356 e.field,
357 e.reason,
358 cause)
359 }
360
361 var _ error = ClusterStatusValidationError{}
362
363 var _ interface {
364 Field() string
365 Reason() string
366 Key() bool
367 Cause() error
368 ErrorName() string
369 } = ClusterStatusValidationError{}
370
371
372
373
374 func (m *HostStatus) Validate() error {
375 return m.validate(false)
376 }
377
378
379
380
381
382 func (m *HostStatus) ValidateAll() error {
383 return m.validate(true)
384 }
385
386 func (m *HostStatus) validate(all bool) error {
387 if m == nil {
388 return nil
389 }
390
391 var errors []error
392
393 if all {
394 switch v := interface{}(m.GetAddress()).(type) {
395 case interface{ ValidateAll() error }:
396 if err := v.ValidateAll(); err != nil {
397 errors = append(errors, HostStatusValidationError{
398 field: "Address",
399 reason: "embedded message failed validation",
400 cause: err,
401 })
402 }
403 case interface{ Validate() error }:
404 if err := v.Validate(); err != nil {
405 errors = append(errors, HostStatusValidationError{
406 field: "Address",
407 reason: "embedded message failed validation",
408 cause: err,
409 })
410 }
411 }
412 } else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
413 if err := v.Validate(); err != nil {
414 return HostStatusValidationError{
415 field: "Address",
416 reason: "embedded message failed validation",
417 cause: err,
418 }
419 }
420 }
421
422 for idx, item := range m.GetStats() {
423 _, _ = idx, item
424
425 if all {
426 switch v := interface{}(item).(type) {
427 case interface{ ValidateAll() error }:
428 if err := v.ValidateAll(); err != nil {
429 errors = append(errors, HostStatusValidationError{
430 field: fmt.Sprintf("Stats[%v]", idx),
431 reason: "embedded message failed validation",
432 cause: err,
433 })
434 }
435 case interface{ Validate() error }:
436 if err := v.Validate(); err != nil {
437 errors = append(errors, HostStatusValidationError{
438 field: fmt.Sprintf("Stats[%v]", idx),
439 reason: "embedded message failed validation",
440 cause: err,
441 })
442 }
443 }
444 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
445 if err := v.Validate(); err != nil {
446 return HostStatusValidationError{
447 field: fmt.Sprintf("Stats[%v]", idx),
448 reason: "embedded message failed validation",
449 cause: err,
450 }
451 }
452 }
453
454 }
455
456 if all {
457 switch v := interface{}(m.GetHealthStatus()).(type) {
458 case interface{ ValidateAll() error }:
459 if err := v.ValidateAll(); err != nil {
460 errors = append(errors, HostStatusValidationError{
461 field: "HealthStatus",
462 reason: "embedded message failed validation",
463 cause: err,
464 })
465 }
466 case interface{ Validate() error }:
467 if err := v.Validate(); err != nil {
468 errors = append(errors, HostStatusValidationError{
469 field: "HealthStatus",
470 reason: "embedded message failed validation",
471 cause: err,
472 })
473 }
474 }
475 } else if v, ok := interface{}(m.GetHealthStatus()).(interface{ Validate() error }); ok {
476 if err := v.Validate(); err != nil {
477 return HostStatusValidationError{
478 field: "HealthStatus",
479 reason: "embedded message failed validation",
480 cause: err,
481 }
482 }
483 }
484
485 if all {
486 switch v := interface{}(m.GetSuccessRate()).(type) {
487 case interface{ ValidateAll() error }:
488 if err := v.ValidateAll(); err != nil {
489 errors = append(errors, HostStatusValidationError{
490 field: "SuccessRate",
491 reason: "embedded message failed validation",
492 cause: err,
493 })
494 }
495 case interface{ Validate() error }:
496 if err := v.Validate(); err != nil {
497 errors = append(errors, HostStatusValidationError{
498 field: "SuccessRate",
499 reason: "embedded message failed validation",
500 cause: err,
501 })
502 }
503 }
504 } else if v, ok := interface{}(m.GetSuccessRate()).(interface{ Validate() error }); ok {
505 if err := v.Validate(); err != nil {
506 return HostStatusValidationError{
507 field: "SuccessRate",
508 reason: "embedded message failed validation",
509 cause: err,
510 }
511 }
512 }
513
514
515
516
517
518
519
520 if all {
521 switch v := interface{}(m.GetLocalOriginSuccessRate()).(type) {
522 case interface{ ValidateAll() error }:
523 if err := v.ValidateAll(); err != nil {
524 errors = append(errors, HostStatusValidationError{
525 field: "LocalOriginSuccessRate",
526 reason: "embedded message failed validation",
527 cause: err,
528 })
529 }
530 case interface{ Validate() error }:
531 if err := v.Validate(); err != nil {
532 errors = append(errors, HostStatusValidationError{
533 field: "LocalOriginSuccessRate",
534 reason: "embedded message failed validation",
535 cause: err,
536 })
537 }
538 }
539 } else if v, ok := interface{}(m.GetLocalOriginSuccessRate()).(interface{ Validate() error }); ok {
540 if err := v.Validate(); err != nil {
541 return HostStatusValidationError{
542 field: "LocalOriginSuccessRate",
543 reason: "embedded message failed validation",
544 cause: err,
545 }
546 }
547 }
548
549 if all {
550 switch v := interface{}(m.GetLocality()).(type) {
551 case interface{ ValidateAll() error }:
552 if err := v.ValidateAll(); err != nil {
553 errors = append(errors, HostStatusValidationError{
554 field: "Locality",
555 reason: "embedded message failed validation",
556 cause: err,
557 })
558 }
559 case interface{ Validate() error }:
560 if err := v.Validate(); err != nil {
561 errors = append(errors, HostStatusValidationError{
562 field: "Locality",
563 reason: "embedded message failed validation",
564 cause: err,
565 })
566 }
567 }
568 } else if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok {
569 if err := v.Validate(); err != nil {
570 return HostStatusValidationError{
571 field: "Locality",
572 reason: "embedded message failed validation",
573 cause: err,
574 }
575 }
576 }
577
578 if len(errors) > 0 {
579 return HostStatusMultiError(errors)
580 }
581
582 return nil
583 }
584
585
586
587 type HostStatusMultiError []error
588
589
590 func (m HostStatusMultiError) Error() string {
591 var msgs []string
592 for _, err := range m {
593 msgs = append(msgs, err.Error())
594 }
595 return strings.Join(msgs, "; ")
596 }
597
598
599 func (m HostStatusMultiError) AllErrors() []error { return m }
600
601
602
603 type HostStatusValidationError struct {
604 field string
605 reason string
606 cause error
607 key bool
608 }
609
610
611 func (e HostStatusValidationError) Field() string { return e.field }
612
613
614 func (e HostStatusValidationError) Reason() string { return e.reason }
615
616
617 func (e HostStatusValidationError) Cause() error { return e.cause }
618
619
620 func (e HostStatusValidationError) Key() bool { return e.key }
621
622
623 func (e HostStatusValidationError) ErrorName() string { return "HostStatusValidationError" }
624
625
626 func (e HostStatusValidationError) Error() string {
627 cause := ""
628 if e.cause != nil {
629 cause = fmt.Sprintf(" | caused by: %v", e.cause)
630 }
631
632 key := ""
633 if e.key {
634 key = "key for "
635 }
636
637 return fmt.Sprintf(
638 "invalid %sHostStatus.%s: %s%s",
639 key,
640 e.field,
641 e.reason,
642 cause)
643 }
644
645 var _ error = HostStatusValidationError{}
646
647 var _ interface {
648 Field() string
649 Reason() string
650 Key() bool
651 Cause() error
652 ErrorName() string
653 } = HostStatusValidationError{}
654
655
656
657
658 func (m *HostHealthStatus) Validate() error {
659 return m.validate(false)
660 }
661
662
663
664
665
666 func (m *HostHealthStatus) ValidateAll() error {
667 return m.validate(true)
668 }
669
670 func (m *HostHealthStatus) validate(all bool) error {
671 if m == nil {
672 return nil
673 }
674
675 var errors []error
676
677
678
679
680
681
682
683
684
685
686
687
688
689 if len(errors) > 0 {
690 return HostHealthStatusMultiError(errors)
691 }
692
693 return nil
694 }
695
696
697
698
699 type HostHealthStatusMultiError []error
700
701
702 func (m HostHealthStatusMultiError) Error() string {
703 var msgs []string
704 for _, err := range m {
705 msgs = append(msgs, err.Error())
706 }
707 return strings.Join(msgs, "; ")
708 }
709
710
711 func (m HostHealthStatusMultiError) AllErrors() []error { return m }
712
713
714
715 type HostHealthStatusValidationError struct {
716 field string
717 reason string
718 cause error
719 key bool
720 }
721
722
723 func (e HostHealthStatusValidationError) Field() string { return e.field }
724
725
726 func (e HostHealthStatusValidationError) Reason() string { return e.reason }
727
728
729 func (e HostHealthStatusValidationError) Cause() error { return e.cause }
730
731
732 func (e HostHealthStatusValidationError) Key() bool { return e.key }
733
734
735 func (e HostHealthStatusValidationError) ErrorName() string { return "HostHealthStatusValidationError" }
736
737
738 func (e HostHealthStatusValidationError) Error() string {
739 cause := ""
740 if e.cause != nil {
741 cause = fmt.Sprintf(" | caused by: %v", e.cause)
742 }
743
744 key := ""
745 if e.key {
746 key = "key for "
747 }
748
749 return fmt.Sprintf(
750 "invalid %sHostHealthStatus.%s: %s%s",
751 key,
752 e.field,
753 e.reason,
754 cause)
755 }
756
757 var _ error = HostHealthStatusValidationError{}
758
759 var _ interface {
760 Field() string
761 Reason() string
762 Key() bool
763 Cause() error
764 ErrorName() string
765 } = HostHealthStatusValidationError{}
766
View as plain text