Debian Codegraph @

envoy/service/status/v2/csds.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/service/status/v2/csds.proto
4
5 package statusv2
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 ClientStatusRequest with the rules
40 // defined in the proto definition for this message. If any rules are
41 // violated, the first error encountered is returned, or nil if there are no violations.
42 func (m *ClientStatusRequest) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on ClientStatusRequest 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 // ClientStatusRequestMultiError, or nil if none found.
50 func (m *ClientStatusRequest) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *ClientStatusRequest) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 for idx, item := range m.GetNodeMatchers() {
62 _, _ = idx, item
63
64 if all {
65 switch v := interface{}(item).(type) {
66 case interface{ ValidateAll() error }:
67 if err := v.ValidateAll(); err != nil {
68 errors = append(errors, ClientStatusRequestValidationError{
69 field: fmt.Sprintf("NodeMatchers[%v]", idx),
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, ClientStatusRequestValidationError{
77 field: fmt.Sprintf("NodeMatchers[%v]", idx),
78 reason: "embedded message failed validation",
79 cause: err,
80 })
81 }
82 }
83 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
84 if err := v.Validate(); err != nil {
85 return ClientStatusRequestValidationError{
86 field: fmt.Sprintf("NodeMatchers[%v]", idx),
87 reason: "embedded message failed validation",
88 cause: err,
89 }
90 }
91 }
92
93 }
94
95 if len(errors) > 0 {
96 return ClientStatusRequestMultiError(errors)
97 }
98
99 return nil
100 }
101
102 // ClientStatusRequestMultiError is an error wrapping multiple validation
103 // errors returned by ClientStatusRequest.ValidateAll() if the designated
104 // constraints aren't met.
105 type ClientStatusRequestMultiError []error
106
107 // Error returns a concatenation of all the error messages it wraps.
108 func (m ClientStatusRequestMultiError) Error() string {
109 var msgs []string
110 for _, err := range m {
111 msgs = append(msgs, err.Error())
112 }
113 return strings.Join(msgs, "; ")
114 }
115
116 // AllErrors returns a list of validation violation errors.
117 func (m ClientStatusRequestMultiError) AllErrors() []error { return m }
118
119 // ClientStatusRequestValidationError is the validation error returned by
120 // ClientStatusRequest.Validate if the designated constraints aren't met.
121 type ClientStatusRequestValidationError struct {
122 field string
123 reason string
124 cause error
125 key bool
126 }
127
128 // Field function returns field value.
129 func (e ClientStatusRequestValidationError) Field() string { return e.field }
130
131 // Reason function returns reason value.
132 func (e ClientStatusRequestValidationError) Reason() string { return e.reason }
133
134 // Cause function returns cause value.
135 func (e ClientStatusRequestValidationError) Cause() error { return e.cause }
136
137 // Key function returns key value.
138 func (e ClientStatusRequestValidationError) Key() bool { return e.key }
139
140 // ErrorName returns error name.
141 func (e ClientStatusRequestValidationError) ErrorName() string {
142 return "ClientStatusRequestValidationError"
143 }
144
145 // Error satisfies the builtin error interface
146 func (e ClientStatusRequestValidationError) 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 %sClientStatusRequest.%s: %s%s",
159 key,
160 e.field,
161 e.reason,
162 cause)
163 }
164
165 var _ error = ClientStatusRequestValidationError{}
166
167 var _ interface {
168 Field() string
169 Reason() string
170 Key() bool
171 Cause() error
172 ErrorName() string
173 } = ClientStatusRequestValidationError{}
174
175 // Validate checks the field values on PerXdsConfig with the rules defined in
176 // the proto definition for this message. If any rules are violated, the first
177 // error encountered is returned, or nil if there are no violations.
178 func (m *PerXdsConfig) Validate() error {
179 return m.validate(false)
180 }
181
182 // ValidateAll checks the field values on PerXdsConfig with the rules defined
183 // in the proto definition for this message. If any rules are violated, the
184 // result is a list of violation errors wrapped in PerXdsConfigMultiError, or
185 // nil if none found.
186 func (m *PerXdsConfig) ValidateAll() error {
187 return m.validate(true)
188 }
189
190 func (m *PerXdsConfig) validate(all bool) error {
191 if m == nil {
192 return nil
193 }
194
195 var errors []error
196
197 // no validation rules for Status
198
199 switch v := m.PerXdsConfig.(type) {
200 case *PerXdsConfig_ListenerConfig:
201 if v == nil {
202 err := PerXdsConfigValidationError{
203 field: "PerXdsConfig",
204 reason: "oneof value cannot be a typed-nil",
205 }
206 if !all {
207 return err
208 }
209 errors = append(errors, err)
210 }
211
212 if all {
213 switch v := interface{}(m.GetListenerConfig()).(type) {
214 case interface{ ValidateAll() error }:
215 if err := v.ValidateAll(); err != nil {
216 errors = append(errors, PerXdsConfigValidationError{
217 field: "ListenerConfig",
218 reason: "embedded message failed validation",
219 cause: err,
220 })
221 }
222 case interface{ Validate() error }:
223 if err := v.Validate(); err != nil {
224 errors = append(errors, PerXdsConfigValidationError{
225 field: "ListenerConfig",
226 reason: "embedded message failed validation",
227 cause: err,
228 })
229 }
230 }
231 } else if v, ok := interface{}(m.GetListenerConfig()).(interface{ Validate() error }); ok {
232 if err := v.Validate(); err != nil {
233 return PerXdsConfigValidationError{
234 field: "ListenerConfig",
235 reason: "embedded message failed validation",
236 cause: err,
237 }
238 }
239 }
240
241 case *PerXdsConfig_ClusterConfig:
242 if v == nil {
243 err := PerXdsConfigValidationError{
244 field: "PerXdsConfig",
245 reason: "oneof value cannot be a typed-nil",
246 }
247 if !all {
248 return err
249 }
250 errors = append(errors, err)
251 }
252
253 if all {
254 switch v := interface{}(m.GetClusterConfig()).(type) {
255 case interface{ ValidateAll() error }:
256 if err := v.ValidateAll(); err != nil {
257 errors = append(errors, PerXdsConfigValidationError{
258 field: "ClusterConfig",
259 reason: "embedded message failed validation",
260 cause: err,
261 })
262 }
263 case interface{ Validate() error }:
264 if err := v.Validate(); err != nil {
265 errors = append(errors, PerXdsConfigValidationError{
266 field: "ClusterConfig",
267 reason: "embedded message failed validation",
268 cause: err,
269 })
270 }
271 }
272 } else if v, ok := interface{}(m.GetClusterConfig()).(interface{ Validate() error }); ok {
273 if err := v.Validate(); err != nil {
274 return PerXdsConfigValidationError{
275 field: "ClusterConfig",
276 reason: "embedded message failed validation",
277 cause: err,
278 }
279 }
280 }
281
282 case *PerXdsConfig_RouteConfig:
283 if v == nil {
284 err := PerXdsConfigValidationError{
285 field: "PerXdsConfig",
286 reason: "oneof value cannot be a typed-nil",
287 }
288 if !all {
289 return err
290 }
291 errors = append(errors, err)
292 }
293
294 if all {
295 switch v := interface{}(m.GetRouteConfig()).(type) {
296 case interface{ ValidateAll() error }:
297 if err := v.ValidateAll(); err != nil {
298 errors = append(errors, PerXdsConfigValidationError{
299 field: "RouteConfig",
300 reason: "embedded message failed validation",
301 cause: err,
302 })
303 }
304 case interface{ Validate() error }:
305 if err := v.Validate(); err != nil {
306 errors = append(errors, PerXdsConfigValidationError{
307 field: "RouteConfig",
308 reason: "embedded message failed validation",
309 cause: err,
310 })
311 }
312 }
313 } else if v, ok := interface{}(m.GetRouteConfig()).(interface{ Validate() error }); ok {
314 if err := v.Validate(); err != nil {
315 return PerXdsConfigValidationError{
316 field: "RouteConfig",
317 reason: "embedded message failed validation",
318 cause: err,
319 }
320 }
321 }
322
323 case *PerXdsConfig_ScopedRouteConfig:
324 if v == nil {
325 err := PerXdsConfigValidationError{
326 field: "PerXdsConfig",
327 reason: "oneof value cannot be a typed-nil",
328 }
329 if !all {
330 return err
331 }
332 errors = append(errors, err)
333 }
334
335 if all {
336 switch v := interface{}(m.GetScopedRouteConfig()).(type) {
337 case interface{ ValidateAll() error }:
338 if err := v.ValidateAll(); err != nil {
339 errors = append(errors, PerXdsConfigValidationError{
340 field: "ScopedRouteConfig",
341 reason: "embedded message failed validation",
342 cause: err,
343 })
344 }
345 case interface{ Validate() error }:
346 if err := v.Validate(); err != nil {
347 errors = append(errors, PerXdsConfigValidationError{
348 field: "ScopedRouteConfig",
349 reason: "embedded message failed validation",
350 cause: err,
351 })
352 }
353 }
354 } else if v, ok := interface{}(m.GetScopedRouteConfig()).(interface{ Validate() error }); ok {
355 if err := v.Validate(); err != nil {
356 return PerXdsConfigValidationError{
357 field: "ScopedRouteConfig",
358 reason: "embedded message failed validation",
359 cause: err,
360 }
361 }
362 }
363
364 default:
365 _ = v // ensures v is used
366 }
367
368 if len(errors) > 0 {
369 return PerXdsConfigMultiError(errors)
370 }
371
372 return nil
373 }
374
375 // PerXdsConfigMultiError is an error wrapping multiple validation errors
376 // returned by PerXdsConfig.ValidateAll() if the designated constraints aren't met.
377 type PerXdsConfigMultiError []error
378
379 // Error returns a concatenation of all the error messages it wraps.
380 func (m PerXdsConfigMultiError) Error() string {
381 var msgs []string
382 for _, err := range m {
383 msgs = append(msgs, err.Error())
384 }
385 return strings.Join(msgs, "; ")
386 }
387
388 // AllErrors returns a list of validation violation errors.
389 func (m PerXdsConfigMultiError) AllErrors() []error { return m }
390
391 // PerXdsConfigValidationError is the validation error returned by
392 // PerXdsConfig.Validate if the designated constraints aren't met.
393 type PerXdsConfigValidationError struct {
394 field string
395 reason string
396 cause error
397 key bool
398 }
399
400 // Field function returns field value.
401 func (e PerXdsConfigValidationError) Field() string { return e.field }
402
403 // Reason function returns reason value.
404 func (e PerXdsConfigValidationError) Reason() string { return e.reason }
405
406 // Cause function returns cause value.
407 func (e PerXdsConfigValidationError) Cause() error { return e.cause }
408
409 // Key function returns key value.
410 func (e PerXdsConfigValidationError) Key() bool { return e.key }
411
412 // ErrorName returns error name.
413 func (e PerXdsConfigValidationError) ErrorName() string { return "PerXdsConfigValidationError" }
414
415 // Error satisfies the builtin error interface
416 func (e PerXdsConfigValidationError) Error() string {
417 cause := ""
418 if e.cause != nil {
419 cause = fmt.Sprintf(" | caused by: %v", e.cause)
420 }
421
422 key := ""
423 if e.key {
424 key = "key for "
425 }
426
427 return fmt.Sprintf(
428 "invalid %sPerXdsConfig.%s: %s%s",
429 key,
430 e.field,
431 e.reason,
432 cause)
433 }
434
435 var _ error = PerXdsConfigValidationError{}
436
437 var _ interface {
438 Field() string
439 Reason() string
440 Key() bool
441 Cause() error
442 ErrorName() string
443 } = PerXdsConfigValidationError{}
444
445 // Validate checks the field values on ClientConfig with the rules defined in
446 // the proto definition for this message. If any rules are violated, the first
447 // error encountered is returned, or nil if there are no violations.
448 func (m *ClientConfig) Validate() error {
449 return m.validate(false)
450 }
451
452 // ValidateAll checks the field values on ClientConfig with the rules defined
453 // in the proto definition for this message. If any rules are violated, the
454 // result is a list of violation errors wrapped in ClientConfigMultiError, or
455 // nil if none found.
456 func (m *ClientConfig) ValidateAll() error {
457 return m.validate(true)
458 }
459
460 func (m *ClientConfig) validate(all bool) error {
461 if m == nil {
462 return nil
463 }
464
465 var errors []error
466
467 if all {
468 switch v := interface{}(m.GetNode()).(type) {
469 case interface{ ValidateAll() error }:
470 if err := v.ValidateAll(); err != nil {
471 errors = append(errors, ClientConfigValidationError{
472 field: "Node",
473 reason: "embedded message failed validation",
474 cause: err,
475 })
476 }
477 case interface{ Validate() error }:
478 if err := v.Validate(); err != nil {
479 errors = append(errors, ClientConfigValidationError{
480 field: "Node",
481 reason: "embedded message failed validation",
482 cause: err,
483 })
484 }
485 }
486 } else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
487 if err := v.Validate(); err != nil {
488 return ClientConfigValidationError{
489 field: "Node",
490 reason: "embedded message failed validation",
491 cause: err,
492 }
493 }
494 }
495
496 for idx, item := range m.GetXdsConfig() {
497 _, _ = idx, item
498
499 if all {
500 switch v := interface{}(item).(type) {
501 case interface{ ValidateAll() error }:
502 if err := v.ValidateAll(); err != nil {
503 errors = append(errors, ClientConfigValidationError{
504 field: fmt.Sprintf("XdsConfig[%v]", idx),
505 reason: "embedded message failed validation",
506 cause: err,
507 })
508 }
509 case interface{ Validate() error }:
510 if err := v.Validate(); err != nil {
511 errors = append(errors, ClientConfigValidationError{
512 field: fmt.Sprintf("XdsConfig[%v]", idx),
513 reason: "embedded message failed validation",
514 cause: err,
515 })
516 }
517 }
518 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
519 if err := v.Validate(); err != nil {
520 return ClientConfigValidationError{
521 field: fmt.Sprintf("XdsConfig[%v]", idx),
522 reason: "embedded message failed validation",
523 cause: err,
524 }
525 }
526 }
527
528 }
529
530 if len(errors) > 0 {
531 return ClientConfigMultiError(errors)
532 }
533
534 return nil
535 }
536
537 // ClientConfigMultiError is an error wrapping multiple validation errors
538 // returned by ClientConfig.ValidateAll() if the designated constraints aren't met.
539 type ClientConfigMultiError []error
540
541 // Error returns a concatenation of all the error messages it wraps.
542 func (m ClientConfigMultiError) Error() string {
543 var msgs []string
544 for _, err := range m {
545 msgs = append(msgs, err.Error())
546 }
547 return strings.Join(msgs, "; ")
548 }
549
550 // AllErrors returns a list of validation violation errors.
551 func (m ClientConfigMultiError) AllErrors() []error { return m }
552
553 // ClientConfigValidationError is the validation error returned by
554 // ClientConfig.Validate if the designated constraints aren't met.
555 type ClientConfigValidationError struct {
556 field string
557 reason string
558 cause error
559 key bool
560 }
561
562 // Field function returns field value.
563 func (e ClientConfigValidationError) Field() string { return e.field }
564
565 // Reason function returns reason value.
566 func (e ClientConfigValidationError) Reason() string { return e.reason }
567
568 // Cause function returns cause value.
569 func (e ClientConfigValidationError) Cause() error { return e.cause }
570
571 // Key function returns key value.
572 func (e ClientConfigValidationError) Key() bool { return e.key }
573
574 // ErrorName returns error name.
575 func (e ClientConfigValidationError) ErrorName() string { return "ClientConfigValidationError" }
576
577 // Error satisfies the builtin error interface
578 func (e ClientConfigValidationError) Error() string {
579 cause := ""
580 if e.cause != nil {
581 cause = fmt.Sprintf(" | caused by: %v", e.cause)
582 }
583
584 key := ""
585 if e.key {
586 key = "key for "
587 }
588
589 return fmt.Sprintf(
590 "invalid %sClientConfig.%s: %s%s",
591 key,
592 e.field,
593 e.reason,
594 cause)
595 }
596
597 var _ error = ClientConfigValidationError{}
598
599 var _ interface {
600 Field() string
601 Reason() string
602 Key() bool
603 Cause() error
604 ErrorName() string
605 } = ClientConfigValidationError{}
606
607 // Validate checks the field values on ClientStatusResponse with the rules
608 // defined in the proto definition for this message. If any rules are
609 // violated, the first error encountered is returned, or nil if there are no violations.
610 func (m *ClientStatusResponse) Validate() error {
611 return m.validate(false)
612 }
613
614 // ValidateAll checks the field values on ClientStatusResponse with the rules
615 // defined in the proto definition for this message. If any rules are
616 // violated, the result is a list of violation errors wrapped in
617 // ClientStatusResponseMultiError, or nil if none found.
618 func (m *ClientStatusResponse) ValidateAll() error {
619 return m.validate(true)
620 }
621
622 func (m *ClientStatusResponse) validate(all bool) error {
623 if m == nil {
624 return nil
625 }
626
627 var errors []error
628
629 for idx, item := range m.GetConfig() {
630 _, _ = idx, item
631
632 if all {
633 switch v := interface{}(item).(type) {
634 case interface{ ValidateAll() error }:
635 if err := v.ValidateAll(); err != nil {
636 errors = append(errors, ClientStatusResponseValidationError{
637 field: fmt.Sprintf("Config[%v]", idx),
638 reason: "embedded message failed validation",
639 cause: err,
640 })
641 }
642 case interface{ Validate() error }:
643 if err := v.Validate(); err != nil {
644 errors = append(errors, ClientStatusResponseValidationError{
645 field: fmt.Sprintf("Config[%v]", idx),
646 reason: "embedded message failed validation",
647 cause: err,
648 })
649 }
650 }
651 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
652 if err := v.Validate(); err != nil {
653 return ClientStatusResponseValidationError{
654 field: fmt.Sprintf("Config[%v]", idx),
655 reason: "embedded message failed validation",
656 cause: err,
657 }
658 }
659 }
660
661 }
662
663 if len(errors) > 0 {
664 return ClientStatusResponseMultiError(errors)
665 }
666
667 return nil
668 }
669
670 // ClientStatusResponseMultiError is an error wrapping multiple validation
671 // errors returned by ClientStatusResponse.ValidateAll() if the designated
672 // constraints aren't met.
673 type ClientStatusResponseMultiError []error
674
675 // Error returns a concatenation of all the error messages it wraps.
676 func (m ClientStatusResponseMultiError) Error() string {
677 var msgs []string
678 for _, err := range m {
679 msgs = append(msgs, err.Error())
680 }
681 return strings.Join(msgs, "; ")
682 }
683
684 // AllErrors returns a list of validation violation errors.
685 func (m ClientStatusResponseMultiError) AllErrors() []error { return m }
686
687 // ClientStatusResponseValidationError is the validation error returned by
688 // ClientStatusResponse.Validate if the designated constraints aren't met.
689 type ClientStatusResponseValidationError struct {
690 field string
691 reason string
692 cause error
693 key bool
694 }
695
696 // Field function returns field value.
697 func (e ClientStatusResponseValidationError) Field() string { return e.field }
698
699 // Reason function returns reason value.
700 func (e ClientStatusResponseValidationError) Reason() string { return e.reason }
701
702 // Cause function returns cause value.
703 func (e ClientStatusResponseValidationError) Cause() error { return e.cause }
704
705 // Key function returns key value.
706 func (e ClientStatusResponseValidationError) Key() bool { return e.key }
707
708 // ErrorName returns error name.
709 func (e ClientStatusResponseValidationError) ErrorName() string {
710 return "ClientStatusResponseValidationError"
711 }
712
713 // Error satisfies the builtin error interface
714 func (e ClientStatusResponseValidationError) Error() string {
715 cause := ""
716 if e.cause != nil {
717 cause = fmt.Sprintf(" | caused by: %v", e.cause)
718 }
719
720 key := ""
721 if e.key {
722 key = "key for "
723 }
724
725 return fmt.Sprintf(
726 "invalid %sClientStatusResponse.%s: %s%s",
727 key,
728 e.field,
729 e.reason,
730 cause)
731 }
732
733 var _ error = ClientStatusResponseValidationError{}
734
735 var _ interface {
736 Field() string
737 Reason() string
738 Key() bool
739 Cause() error
740 ErrorName() string
741 } = ClientStatusResponseValidationError{}