Debian Codegraph @

envoy/service/discovery/v3/discovery.pb.validate.go

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