Debian Codegraph @

envoy/extensions/transport_sockets/tls/v3/common.pb.validate.go

raw symbols SCIP
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/extensions/transport_sockets/tls/v3/common.proto
4
5 package tlsv3
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 TlsParameters with the rules defined in
40 // the proto definition for this message. If any rules are violated, the first
41 // error encountered is returned, or nil if there are no violations.
42 func (m *TlsParameters) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on TlsParameters with the rules defined
47 // in the proto definition for this message. If any rules are violated, the
48 // result is a list of violation errors wrapped in TlsParametersMultiError, or
49 // nil if none found.
50 func (m *TlsParameters) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *TlsParameters) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 if _, ok := TlsParameters_TlsProtocol_name[int32(m.GetTlsMinimumProtocolVersion())]; !ok {
62 err := TlsParametersValidationError{
63 field: "TlsMinimumProtocolVersion",
64 reason: "value must be one of the defined enum values",
65 }
66 if !all {
67 return err
68 }
69 errors = append(errors, err)
70 }
71
72 if _, ok := TlsParameters_TlsProtocol_name[int32(m.GetTlsMaximumProtocolVersion())]; !ok {
73 err := TlsParametersValidationError{
74 field: "TlsMaximumProtocolVersion",
75 reason: "value must be one of the defined enum values",
76 }
77 if !all {
78 return err
79 }
80 errors = append(errors, err)
81 }
82
83 if len(errors) > 0 {
84 return TlsParametersMultiError(errors)
85 }
86
87 return nil
88 }
89
90 // TlsParametersMultiError is an error wrapping multiple validation errors
91 // returned by TlsParameters.ValidateAll() if the designated constraints
92 // aren't met.
93 type TlsParametersMultiError []error
94
95 // Error returns a concatenation of all the error messages it wraps.
96 func (m TlsParametersMultiError) Error() string {
97 var msgs []string
98 for _, err := range m {
99 msgs = append(msgs, err.Error())
100 }
101 return strings.Join(msgs, "; ")
102 }
103
104 // AllErrors returns a list of validation violation errors.
105 func (m TlsParametersMultiError) AllErrors() []error { return m }
106
107 // TlsParametersValidationError is the validation error returned by
108 // TlsParameters.Validate if the designated constraints aren't met.
109 type TlsParametersValidationError struct {
110 field string
111 reason string
112 cause error
113 key bool
114 }
115
116 // Field function returns field value.
117 func (e TlsParametersValidationError) Field() string { return e.field }
118
119 // Reason function returns reason value.
120 func (e TlsParametersValidationError) Reason() string { return e.reason }
121
122 // Cause function returns cause value.
123 func (e TlsParametersValidationError) Cause() error { return e.cause }
124
125 // Key function returns key value.
126 func (e TlsParametersValidationError) Key() bool { return e.key }
127
128 // ErrorName returns error name.
129 func (e TlsParametersValidationError) ErrorName() string { return "TlsParametersValidationError" }
130
131 // Error satisfies the builtin error interface
132 func (e TlsParametersValidationError) Error() string {
133 cause := ""
134 if e.cause != nil {
135 cause = fmt.Sprintf(" | caused by: %v", e.cause)
136 }
137
138 key := ""
139 if e.key {
140 key = "key for "
141 }
142
143 return fmt.Sprintf(
144 "invalid %sTlsParameters.%s: %s%s",
145 key,
146 e.field,
147 e.reason,
148 cause)
149 }
150
151 var _ error = TlsParametersValidationError{}
152
153 var _ interface {
154 Field() string
155 Reason() string
156 Key() bool
157 Cause() error
158 ErrorName() string
159 } = TlsParametersValidationError{}
160
161 // Validate checks the field values on PrivateKeyProvider with the rules
162 // defined in the proto definition for this message. If any rules are
163 // violated, the first error encountered is returned, or nil if there are no violations.
164 func (m *PrivateKeyProvider) Validate() error {
165 return m.validate(false)
166 }
167
168 // ValidateAll checks the field values on PrivateKeyProvider with the rules
169 // defined in the proto definition for this message. If any rules are
170 // violated, the result is a list of violation errors wrapped in
171 // PrivateKeyProviderMultiError, or nil if none found.
172 func (m *PrivateKeyProvider) ValidateAll() error {
173 return m.validate(true)
174 }
175
176 func (m *PrivateKeyProvider) validate(all bool) error {
177 if m == nil {
178 return nil
179 }
180
181 var errors []error
182
183 if utf8.RuneCountInString(m.GetProviderName()) < 1 {
184 err := PrivateKeyProviderValidationError{
185 field: "ProviderName",
186 reason: "value length must be at least 1 runes",
187 }
188 if !all {
189 return err
190 }
191 errors = append(errors, err)
192 }
193
194 // no validation rules for Fallback
195
196 switch v := m.ConfigType.(type) {
197 case *PrivateKeyProvider_TypedConfig:
198 if v == nil {
199 err := PrivateKeyProviderValidationError{
200 field: "ConfigType",
201 reason: "oneof value cannot be a typed-nil",
202 }
203 if !all {
204 return err
205 }
206 errors = append(errors, err)
207 }
208
209 if all {
210 switch v := interface{}(m.GetTypedConfig()).(type) {
211 case interface{ ValidateAll() error }:
212 if err := v.ValidateAll(); err != nil {
213 errors = append(errors, PrivateKeyProviderValidationError{
214 field: "TypedConfig",
215 reason: "embedded message failed validation",
216 cause: err,
217 })
218 }
219 case interface{ Validate() error }:
220 if err := v.Validate(); err != nil {
221 errors = append(errors, PrivateKeyProviderValidationError{
222 field: "TypedConfig",
223 reason: "embedded message failed validation",
224 cause: err,
225 })
226 }
227 }
228 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
229 if err := v.Validate(); err != nil {
230 return PrivateKeyProviderValidationError{
231 field: "TypedConfig",
232 reason: "embedded message failed validation",
233 cause: err,
234 }
235 }
236 }
237
238 default:
239 _ = v // ensures v is used
240 }
241
242 if len(errors) > 0 {
243 return PrivateKeyProviderMultiError(errors)
244 }
245
246 return nil
247 }
248
249 // PrivateKeyProviderMultiError is an error wrapping multiple validation errors
250 // returned by PrivateKeyProvider.ValidateAll() if the designated constraints
251 // aren't met.
252 type PrivateKeyProviderMultiError []error
253
254 // Error returns a concatenation of all the error messages it wraps.
255 func (m PrivateKeyProviderMultiError) Error() string {
256 var msgs []string
257 for _, err := range m {
258 msgs = append(msgs, err.Error())
259 }
260 return strings.Join(msgs, "; ")
261 }
262
263 // AllErrors returns a list of validation violation errors.
264 func (m PrivateKeyProviderMultiError) AllErrors() []error { return m }
265
266 // PrivateKeyProviderValidationError is the validation error returned by
267 // PrivateKeyProvider.Validate if the designated constraints aren't met.
268 type PrivateKeyProviderValidationError struct {
269 field string
270 reason string
271 cause error
272 key bool
273 }
274
275 // Field function returns field value.
276 func (e PrivateKeyProviderValidationError) Field() string { return e.field }
277
278 // Reason function returns reason value.
279 func (e PrivateKeyProviderValidationError) Reason() string { return e.reason }
280
281 // Cause function returns cause value.
282 func (e PrivateKeyProviderValidationError) Cause() error { return e.cause }
283
284 // Key function returns key value.
285 func (e PrivateKeyProviderValidationError) Key() bool { return e.key }
286
287 // ErrorName returns error name.
288 func (e PrivateKeyProviderValidationError) ErrorName() string {
289 return "PrivateKeyProviderValidationError"
290 }
291
292 // Error satisfies the builtin error interface
293 func (e PrivateKeyProviderValidationError) Error() string {
294 cause := ""
295 if e.cause != nil {
296 cause = fmt.Sprintf(" | caused by: %v", e.cause)
297 }
298
299 key := ""
300 if e.key {
301 key = "key for "
302 }
303
304 return fmt.Sprintf(
305 "invalid %sPrivateKeyProvider.%s: %s%s",
306 key,
307 e.field,
308 e.reason,
309 cause)
310 }
311
312 var _ error = PrivateKeyProviderValidationError{}
313
314 var _ interface {
315 Field() string
316 Reason() string
317 Key() bool
318 Cause() error
319 ErrorName() string
320 } = PrivateKeyProviderValidationError{}
321
322 // Validate checks the field values on TlsCertificate with the rules defined in
323 // the proto definition for this message. If any rules are violated, the first
324 // error encountered is returned, or nil if there are no violations.
325 func (m *TlsCertificate) Validate() error {
326 return m.validate(false)
327 }
328
329 // ValidateAll checks the field values on TlsCertificate with the rules defined
330 // in the proto definition for this message. If any rules are violated, the
331 // result is a list of violation errors wrapped in TlsCertificateMultiError,
332 // or nil if none found.
333 func (m *TlsCertificate) ValidateAll() error {
334 return m.validate(true)
335 }
336
337 func (m *TlsCertificate) validate(all bool) error {
338 if m == nil {
339 return nil
340 }
341
342 var errors []error
343
344 if all {
345 switch v := interface{}(m.GetCertificateChain()).(type) {
346 case interface{ ValidateAll() error }:
347 if err := v.ValidateAll(); err != nil {
348 errors = append(errors, TlsCertificateValidationError{
349 field: "CertificateChain",
350 reason: "embedded message failed validation",
351 cause: err,
352 })
353 }
354 case interface{ Validate() error }:
355 if err := v.Validate(); err != nil {
356 errors = append(errors, TlsCertificateValidationError{
357 field: "CertificateChain",
358 reason: "embedded message failed validation",
359 cause: err,
360 })
361 }
362 }
363 } else if v, ok := interface{}(m.GetCertificateChain()).(interface{ Validate() error }); ok {
364 if err := v.Validate(); err != nil {
365 return TlsCertificateValidationError{
366 field: "CertificateChain",
367 reason: "embedded message failed validation",
368 cause: err,
369 }
370 }
371 }
372
373 if all {
374 switch v := interface{}(m.GetPrivateKey()).(type) {
375 case interface{ ValidateAll() error }:
376 if err := v.ValidateAll(); err != nil {
377 errors = append(errors, TlsCertificateValidationError{
378 field: "PrivateKey",
379 reason: "embedded message failed validation",
380 cause: err,
381 })
382 }
383 case interface{ Validate() error }:
384 if err := v.Validate(); err != nil {
385 errors = append(errors, TlsCertificateValidationError{
386 field: "PrivateKey",
387 reason: "embedded message failed validation",
388 cause: err,
389 })
390 }
391 }
392 } else if v, ok := interface{}(m.GetPrivateKey()).(interface{ Validate() error }); ok {
393 if err := v.Validate(); err != nil {
394 return TlsCertificateValidationError{
395 field: "PrivateKey",
396 reason: "embedded message failed validation",
397 cause: err,
398 }
399 }
400 }
401
402 if all {
403 switch v := interface{}(m.GetPkcs12()).(type) {
404 case interface{ ValidateAll() error }:
405 if err := v.ValidateAll(); err != nil {
406 errors = append(errors, TlsCertificateValidationError{
407 field: "Pkcs12",
408 reason: "embedded message failed validation",
409 cause: err,
410 })
411 }
412 case interface{ Validate() error }:
413 if err := v.Validate(); err != nil {
414 errors = append(errors, TlsCertificateValidationError{
415 field: "Pkcs12",
416 reason: "embedded message failed validation",
417 cause: err,
418 })
419 }
420 }
421 } else if v, ok := interface{}(m.GetPkcs12()).(interface{ Validate() error }); ok {
422 if err := v.Validate(); err != nil {
423 return TlsCertificateValidationError{
424 field: "Pkcs12",
425 reason: "embedded message failed validation",
426 cause: err,
427 }
428 }
429 }
430
431 if all {
432 switch v := interface{}(m.GetWatchedDirectory()).(type) {
433 case interface{ ValidateAll() error }:
434 if err := v.ValidateAll(); err != nil {
435 errors = append(errors, TlsCertificateValidationError{
436 field: "WatchedDirectory",
437 reason: "embedded message failed validation",
438 cause: err,
439 })
440 }
441 case interface{ Validate() error }:
442 if err := v.Validate(); err != nil {
443 errors = append(errors, TlsCertificateValidationError{
444 field: "WatchedDirectory",
445 reason: "embedded message failed validation",
446 cause: err,
447 })
448 }
449 }
450 } else if v, ok := interface{}(m.GetWatchedDirectory()).(interface{ Validate() error }); ok {
451 if err := v.Validate(); err != nil {
452 return TlsCertificateValidationError{
453 field: "WatchedDirectory",
454 reason: "embedded message failed validation",
455 cause: err,
456 }
457 }
458 }
459
460 if all {
461 switch v := interface{}(m.GetPrivateKeyProvider()).(type) {
462 case interface{ ValidateAll() error }:
463 if err := v.ValidateAll(); err != nil {
464 errors = append(errors, TlsCertificateValidationError{
465 field: "PrivateKeyProvider",
466 reason: "embedded message failed validation",
467 cause: err,
468 })
469 }
470 case interface{ Validate() error }:
471 if err := v.Validate(); err != nil {
472 errors = append(errors, TlsCertificateValidationError{
473 field: "PrivateKeyProvider",
474 reason: "embedded message failed validation",
475 cause: err,
476 })
477 }
478 }
479 } else if v, ok := interface{}(m.GetPrivateKeyProvider()).(interface{ Validate() error }); ok {
480 if err := v.Validate(); err != nil {
481 return TlsCertificateValidationError{
482 field: "PrivateKeyProvider",
483 reason: "embedded message failed validation",
484 cause: err,
485 }
486 }
487 }
488
489 if all {
490 switch v := interface{}(m.GetPassword()).(type) {
491 case interface{ ValidateAll() error }:
492 if err := v.ValidateAll(); err != nil {
493 errors = append(errors, TlsCertificateValidationError{
494 field: "Password",
495 reason: "embedded message failed validation",
496 cause: err,
497 })
498 }
499 case interface{ Validate() error }:
500 if err := v.Validate(); err != nil {
501 errors = append(errors, TlsCertificateValidationError{
502 field: "Password",
503 reason: "embedded message failed validation",
504 cause: err,
505 })
506 }
507 }
508 } else if v, ok := interface{}(m.GetPassword()).(interface{ Validate() error }); ok {
509 if err := v.Validate(); err != nil {
510 return TlsCertificateValidationError{
511 field: "Password",
512 reason: "embedded message failed validation",
513 cause: err,
514 }
515 }
516 }
517
518 if all {
519 switch v := interface{}(m.GetOcspStaple()).(type) {
520 case interface{ ValidateAll() error }:
521 if err := v.ValidateAll(); err != nil {
522 errors = append(errors, TlsCertificateValidationError{
523 field: "OcspStaple",
524 reason: "embedded message failed validation",
525 cause: err,
526 })
527 }
528 case interface{ Validate() error }:
529 if err := v.Validate(); err != nil {
530 errors = append(errors, TlsCertificateValidationError{
531 field: "OcspStaple",
532 reason: "embedded message failed validation",
533 cause: err,
534 })
535 }
536 }
537 } else if v, ok := interface{}(m.GetOcspStaple()).(interface{ Validate() error }); ok {
538 if err := v.Validate(); err != nil {
539 return TlsCertificateValidationError{
540 field: "OcspStaple",
541 reason: "embedded message failed validation",
542 cause: err,
543 }
544 }
545 }
546
547 for idx, item := range m.GetSignedCertificateTimestamp() {
548 _, _ = idx, item
549
550 if all {
551 switch v := interface{}(item).(type) {
552 case interface{ ValidateAll() error }:
553 if err := v.ValidateAll(); err != nil {
554 errors = append(errors, TlsCertificateValidationError{
555 field: fmt.Sprintf("SignedCertificateTimestamp[%v]", idx),
556 reason: "embedded message failed validation",
557 cause: err,
558 })
559 }
560 case interface{ Validate() error }:
561 if err := v.Validate(); err != nil {
562 errors = append(errors, TlsCertificateValidationError{
563 field: fmt.Sprintf("SignedCertificateTimestamp[%v]", idx),
564 reason: "embedded message failed validation",
565 cause: err,
566 })
567 }
568 }
569 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
570 if err := v.Validate(); err != nil {
571 return TlsCertificateValidationError{
572 field: fmt.Sprintf("SignedCertificateTimestamp[%v]", idx),
573 reason: "embedded message failed validation",
574 cause: err,
575 }
576 }
577 }
578
579 }
580
581 if len(errors) > 0 {
582 return TlsCertificateMultiError(errors)
583 }
584
585 return nil
586 }
587
588 // TlsCertificateMultiError is an error wrapping multiple validation errors
589 // returned by TlsCertificate.ValidateAll() if the designated constraints
590 // aren't met.
591 type TlsCertificateMultiError []error
592
593 // Error returns a concatenation of all the error messages it wraps.
594 func (m TlsCertificateMultiError) Error() string {
595 var msgs []string
596 for _, err := range m {
597 msgs = append(msgs, err.Error())
598 }
599 return strings.Join(msgs, "; ")
600 }
601
602 // AllErrors returns a list of validation violation errors.
603 func (m TlsCertificateMultiError) AllErrors() []error { return m }
604
605 // TlsCertificateValidationError is the validation error returned by
606 // TlsCertificate.Validate if the designated constraints aren't met.
607 type TlsCertificateValidationError struct {
608 field string
609 reason string
610 cause error
611 key bool
612 }
613
614 // Field function returns field value.
615 func (e TlsCertificateValidationError) Field() string { return e.field }
616
617 // Reason function returns reason value.
618 func (e TlsCertificateValidationError) Reason() string { return e.reason }
619
620 // Cause function returns cause value.
621 func (e TlsCertificateValidationError) Cause() error { return e.cause }
622
623 // Key function returns key value.
624 func (e TlsCertificateValidationError) Key() bool { return e.key }
625
626 // ErrorName returns error name.
627 func (e TlsCertificateValidationError) ErrorName() string { return "TlsCertificateValidationError" }
628
629 // Error satisfies the builtin error interface
630 func (e TlsCertificateValidationError) Error() string {
631 cause := ""
632 if e.cause != nil {
633 cause = fmt.Sprintf(" | caused by: %v", e.cause)
634 }
635
636 key := ""
637 if e.key {
638 key = "key for "
639 }
640
641 return fmt.Sprintf(
642 "invalid %sTlsCertificate.%s: %s%s",
643 key,
644 e.field,
645 e.reason,
646 cause)
647 }
648
649 var _ error = TlsCertificateValidationError{}
650
651 var _ interface {
652 Field() string
653 Reason() string
654 Key() bool
655 Cause() error
656 ErrorName() string
657 } = TlsCertificateValidationError{}
658
659 // Validate checks the field values on TlsSessionTicketKeys with the rules
660 // defined in the proto definition for this message. If any rules are
661 // violated, the first error encountered is returned, or nil if there are no violations.
662 func (m *TlsSessionTicketKeys) Validate() error {
663 return m.validate(false)
664 }
665
666 // ValidateAll checks the field values on TlsSessionTicketKeys with the rules
667 // defined in the proto definition for this message. If any rules are
668 // violated, the result is a list of violation errors wrapped in
669 // TlsSessionTicketKeysMultiError, or nil if none found.
670 func (m *TlsSessionTicketKeys) ValidateAll() error {
671 return m.validate(true)
672 }
673
674 func (m *TlsSessionTicketKeys) validate(all bool) error {
675 if m == nil {
676 return nil
677 }
678
679 var errors []error
680
681 if len(m.GetKeys()) < 1 {
682 err := TlsSessionTicketKeysValidationError{
683 field: "Keys",
684 reason: "value must contain at least 1 item(s)",
685 }
686 if !all {
687 return err
688 }
689 errors = append(errors, err)
690 }
691
692 for idx, item := range m.GetKeys() {
693 _, _ = idx, item
694
695 if all {
696 switch v := interface{}(item).(type) {
697 case interface{ ValidateAll() error }:
698 if err := v.ValidateAll(); err != nil {
699 errors = append(errors, TlsSessionTicketKeysValidationError{
700 field: fmt.Sprintf("Keys[%v]", idx),
701 reason: "embedded message failed validation",
702 cause: err,
703 })
704 }
705 case interface{ Validate() error }:
706 if err := v.Validate(); err != nil {
707 errors = append(errors, TlsSessionTicketKeysValidationError{
708 field: fmt.Sprintf("Keys[%v]", idx),
709 reason: "embedded message failed validation",
710 cause: err,
711 })
712 }
713 }
714 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
715 if err := v.Validate(); err != nil {
716 return TlsSessionTicketKeysValidationError{
717 field: fmt.Sprintf("Keys[%v]", idx),
718 reason: "embedded message failed validation",
719 cause: err,
720 }
721 }
722 }
723
724 }
725
726 if len(errors) > 0 {
727 return TlsSessionTicketKeysMultiError(errors)
728 }
729
730 return nil
731 }
732
733 // TlsSessionTicketKeysMultiError is an error wrapping multiple validation
734 // errors returned by TlsSessionTicketKeys.ValidateAll() if the designated
735 // constraints aren't met.
736 type TlsSessionTicketKeysMultiError []error
737
738 // Error returns a concatenation of all the error messages it wraps.
739 func (m TlsSessionTicketKeysMultiError) Error() string {
740 var msgs []string
741 for _, err := range m {
742 msgs = append(msgs, err.Error())
743 }
744 return strings.Join(msgs, "; ")
745 }
746
747 // AllErrors returns a list of validation violation errors.
748 func (m TlsSessionTicketKeysMultiError) AllErrors() []error { return m }
749
750 // TlsSessionTicketKeysValidationError is the validation error returned by
751 // TlsSessionTicketKeys.Validate if the designated constraints aren't met.
752 type TlsSessionTicketKeysValidationError struct {
753 field string
754 reason string
755 cause error
756 key bool
757 }
758
759 // Field function returns field value.
760 func (e TlsSessionTicketKeysValidationError) Field() string { return e.field }
761
762 // Reason function returns reason value.
763 func (e TlsSessionTicketKeysValidationError) Reason() string { return e.reason }
764
765 // Cause function returns cause value.
766 func (e TlsSessionTicketKeysValidationError) Cause() error { return e.cause }
767
768 // Key function returns key value.
769 func (e TlsSessionTicketKeysValidationError) Key() bool { return e.key }
770
771 // ErrorName returns error name.
772 func (e TlsSessionTicketKeysValidationError) ErrorName() string {
773 return "TlsSessionTicketKeysValidationError"
774 }
775
776 // Error satisfies the builtin error interface
777 func (e TlsSessionTicketKeysValidationError) Error() string {
778 cause := ""
779 if e.cause != nil {
780 cause = fmt.Sprintf(" | caused by: %v", e.cause)
781 }
782
783 key := ""
784 if e.key {
785 key = "key for "
786 }
787
788 return fmt.Sprintf(
789 "invalid %sTlsSessionTicketKeys.%s: %s%s",
790 key,
791 e.field,
792 e.reason,
793 cause)
794 }
795
796 var _ error = TlsSessionTicketKeysValidationError{}
797
798 var _ interface {
799 Field() string
800 Reason() string
801 Key() bool
802 Cause() error
803 ErrorName() string
804 } = TlsSessionTicketKeysValidationError{}
805
806 // Validate checks the field values on CertificateProviderPluginInstance with
807 // the rules defined in the proto definition for this message. If any rules
808 // are violated, the first error encountered is returned, or nil if there are
809 // no violations.
810 func (m *CertificateProviderPluginInstance) Validate() error {
811 return m.validate(false)
812 }
813
814 // ValidateAll checks the field values on CertificateProviderPluginInstance
815 // with the rules defined in the proto definition for this message. If any
816 // rules are violated, the result is a list of violation errors wrapped in
817 // CertificateProviderPluginInstanceMultiError, or nil if none found.
818 func (m *CertificateProviderPluginInstance) ValidateAll() error {
819 return m.validate(true)
820 }
821
822 func (m *CertificateProviderPluginInstance) validate(all bool) error {
823 if m == nil {
824 return nil
825 }
826
827 var errors []error
828
829 if utf8.RuneCountInString(m.GetInstanceName()) < 1 {
830 err := CertificateProviderPluginInstanceValidationError{
831 field: "InstanceName",
832 reason: "value length must be at least 1 runes",
833 }
834 if !all {
835 return err
836 }
837 errors = append(errors, err)
838 }
839
840 // no validation rules for CertificateName
841
842 if len(errors) > 0 {
843 return CertificateProviderPluginInstanceMultiError(errors)
844 }
845
846 return nil
847 }
848
849 // CertificateProviderPluginInstanceMultiError is an error wrapping multiple
850 // validation errors returned by
851 // CertificateProviderPluginInstance.ValidateAll() if the designated
852 // constraints aren't met.
853 type CertificateProviderPluginInstanceMultiError []error
854
855 // Error returns a concatenation of all the error messages it wraps.
856 func (m CertificateProviderPluginInstanceMultiError) Error() string {
857 var msgs []string
858 for _, err := range m {
859 msgs = append(msgs, err.Error())
860 }
861 return strings.Join(msgs, "; ")
862 }
863
864 // AllErrors returns a list of validation violation errors.
865 func (m CertificateProviderPluginInstanceMultiError) AllErrors() []error { return m }
866
867 // CertificateProviderPluginInstanceValidationError is the validation error
868 // returned by CertificateProviderPluginInstance.Validate if the designated
869 // constraints aren't met.
870 type CertificateProviderPluginInstanceValidationError struct {
871 field string
872 reason string
873 cause error
874 key bool
875 }
876
877 // Field function returns field value.
878 func (e CertificateProviderPluginInstanceValidationError) Field() string { return e.field }
879
880 // Reason function returns reason value.
881 func (e CertificateProviderPluginInstanceValidationError) Reason() string { return e.reason }
882
883 // Cause function returns cause value.
884 func (e CertificateProviderPluginInstanceValidationError) Cause() error { return e.cause }
885
886 // Key function returns key value.
887 func (e CertificateProviderPluginInstanceValidationError) Key() bool { return e.key }
888
889 // ErrorName returns error name.
890 func (e CertificateProviderPluginInstanceValidationError) ErrorName() string {
891 return "CertificateProviderPluginInstanceValidationError"
892 }
893
894 // Error satisfies the builtin error interface
895 func (e CertificateProviderPluginInstanceValidationError) Error() string {
896 cause := ""
897 if e.cause != nil {
898 cause = fmt.Sprintf(" | caused by: %v", e.cause)
899 }
900
901 key := ""
902 if e.key {
903 key = "key for "
904 }
905
906 return fmt.Sprintf(
907 "invalid %sCertificateProviderPluginInstance.%s: %s%s",
908 key,
909 e.field,
910 e.reason,
911 cause)
912 }
913
914 var _ error = CertificateProviderPluginInstanceValidationError{}
915
916 var _ interface {
917 Field() string
918 Reason() string
919 Key() bool
920 Cause() error
921 ErrorName() string
922 } = CertificateProviderPluginInstanceValidationError{}
923
924 // Validate checks the field values on SubjectAltNameMatcher with the rules
925 // defined in the proto definition for this message. If any rules are
926 // violated, the first error encountered is returned, or nil if there are no violations.
927 func (m *SubjectAltNameMatcher) Validate() error {
928 return m.validate(false)
929 }
930
931 // ValidateAll checks the field values on SubjectAltNameMatcher with the rules
932 // defined in the proto definition for this message. If any rules are
933 // violated, the result is a list of violation errors wrapped in
934 // SubjectAltNameMatcherMultiError, or nil if none found.
935 func (m *SubjectAltNameMatcher) ValidateAll() error {
936 return m.validate(true)
937 }
938
939 func (m *SubjectAltNameMatcher) validate(all bool) error {
940 if m == nil {
941 return nil
942 }
943
944 var errors []error
945
946 if _, ok := _SubjectAltNameMatcher_SanType_NotInLookup[m.GetSanType()]; ok {
947 err := SubjectAltNameMatcherValidationError{
948 field: "SanType",
949 reason: "value must not be in list [SAN_TYPE_UNSPECIFIED]",
950 }
951 if !all {
952 return err
953 }
954 errors = append(errors, err)
955 }
956
957 if _, ok := SubjectAltNameMatcher_SanType_name[int32(m.GetSanType())]; !ok {
958 err := SubjectAltNameMatcherValidationError{
959 field: "SanType",
960 reason: "value must be one of the defined enum values",
961 }
962 if !all {
963 return err
964 }
965 errors = append(errors, err)
966 }
967
968 if m.GetMatcher() == nil {
969 err := SubjectAltNameMatcherValidationError{
970 field: "Matcher",
971 reason: "value is required",
972 }
973 if !all {
974 return err
975 }
976 errors = append(errors, err)
977 }
978
979 if all {
980 switch v := interface{}(m.GetMatcher()).(type) {
981 case interface{ ValidateAll() error }:
982 if err := v.ValidateAll(); err != nil {
983 errors = append(errors, SubjectAltNameMatcherValidationError{
984 field: "Matcher",
985 reason: "embedded message failed validation",
986 cause: err,
987 })
988 }
989 case interface{ Validate() error }:
990 if err := v.Validate(); err != nil {
991 errors = append(errors, SubjectAltNameMatcherValidationError{
992 field: "Matcher",
993 reason: "embedded message failed validation",
994 cause: err,
995 })
996 }
997 }
998 } else if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok {
999 if err := v.Validate(); err != nil {
1000 return SubjectAltNameMatcherValidationError{
1001 field: "Matcher",
1002 reason: "embedded message failed validation",
1003 cause: err,
1004 }
1005 }
1006 }
1007
1008 // no validation rules for Oid
1009
1010 if len(errors) > 0 {
1011 return SubjectAltNameMatcherMultiError(errors)
1012 }
1013
1014 return nil
1015 }
1016
1017 // SubjectAltNameMatcherMultiError is an error wrapping multiple validation
1018 // errors returned by SubjectAltNameMatcher.ValidateAll() if the designated
1019 // constraints aren't met.
1020 type SubjectAltNameMatcherMultiError []error
1021
1022 // Error returns a concatenation of all the error messages it wraps.
1023 func (m SubjectAltNameMatcherMultiError) Error() string {
1024 var msgs []string
1025 for _, err := range m {
1026 msgs = append(msgs, err.Error())
1027 }
1028 return strings.Join(msgs, "; ")
1029 }
1030
1031 // AllErrors returns a list of validation violation errors.
1032 func (m SubjectAltNameMatcherMultiError) AllErrors() []error { return m }
1033
1034 // SubjectAltNameMatcherValidationError is the validation error returned by
1035 // SubjectAltNameMatcher.Validate if the designated constraints aren't met.
1036 type SubjectAltNameMatcherValidationError struct {
1037 field string
1038 reason string
1039 cause error
1040 key bool
1041 }
1042
1043 // Field function returns field value.
1044 func (e SubjectAltNameMatcherValidationError) Field() string { return e.field }
1045
1046 // Reason function returns reason value.
1047 func (e SubjectAltNameMatcherValidationError) Reason() string { return e.reason }
1048
1049 // Cause function returns cause value.
1050 func (e SubjectAltNameMatcherValidationError) Cause() error { return e.cause }
1051
1052 // Key function returns key value.
1053 func (e SubjectAltNameMatcherValidationError) Key() bool { return e.key }
1054
1055 // ErrorName returns error name.
1056 func (e SubjectAltNameMatcherValidationError) ErrorName() string {
1057 return "SubjectAltNameMatcherValidationError"
1058 }
1059
1060 // Error satisfies the builtin error interface
1061 func (e SubjectAltNameMatcherValidationError) Error() string {
1062 cause := ""
1063 if e.cause != nil {
1064 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1065 }
1066
1067 key := ""
1068 if e.key {
1069 key = "key for "
1070 }
1071
1072 return fmt.Sprintf(
1073 "invalid %sSubjectAltNameMatcher.%s: %s%s",
1074 key,
1075 e.field,
1076 e.reason,
1077 cause)
1078 }
1079
1080 var _ error = SubjectAltNameMatcherValidationError{}
1081
1082 var _ interface {
1083 Field() string
1084 Reason() string
1085 Key() bool
1086 Cause() error
1087 ErrorName() string
1088 } = SubjectAltNameMatcherValidationError{}
1089
1090 var _SubjectAltNameMatcher_SanType_NotInLookup = map[SubjectAltNameMatcher_SanType]struct{}{
1091 0: {},
1092 }
1093
1094 // Validate checks the field values on CertificateValidationContext with the
1095 // rules defined in the proto definition for this message. If any rules are
1096 // violated, the first error encountered is returned, or nil if there are no violations.
1097 func (m *CertificateValidationContext) Validate() error {
1098 return m.validate(false)
1099 }
1100
1101 // ValidateAll checks the field values on CertificateValidationContext with the
1102 // rules defined in the proto definition for this message. If any rules are
1103 // violated, the result is a list of violation errors wrapped in
1104 // CertificateValidationContextMultiError, or nil if none found.
1105 func (m *CertificateValidationContext) ValidateAll() error {
1106 return m.validate(true)
1107 }
1108
1109 func (m *CertificateValidationContext) validate(all bool) error {
1110 if m == nil {
1111 return nil
1112 }
1113
1114 var errors []error
1115
1116 if all {
1117 switch v := interface{}(m.GetTrustedCa()).(type) {
1118 case interface{ ValidateAll() error }:
1119 if err := v.ValidateAll(); err != nil {
1120 errors = append(errors, CertificateValidationContextValidationError{
1121 field: "TrustedCa",
1122 reason: "embedded message failed validation",
1123 cause: err,
1124 })
1125 }
1126 case interface{ Validate() error }:
1127 if err := v.Validate(); err != nil {
1128 errors = append(errors, CertificateValidationContextValidationError{
1129 field: "TrustedCa",
1130 reason: "embedded message failed validation",
1131 cause: err,
1132 })
1133 }
1134 }
1135 } else if v, ok := interface{}(m.GetTrustedCa()).(interface{ Validate() error }); ok {
1136 if err := v.Validate(); err != nil {
1137 return CertificateValidationContextValidationError{
1138 field: "TrustedCa",
1139 reason: "embedded message failed validation",
1140 cause: err,
1141 }
1142 }
1143 }
1144
1145 if all {
1146 switch v := interface{}(m.GetCaCertificateProviderInstance()).(type) {
1147 case interface{ ValidateAll() error }:
1148 if err := v.ValidateAll(); err != nil {
1149 errors = append(errors, CertificateValidationContextValidationError{
1150 field: "CaCertificateProviderInstance",
1151 reason: "embedded message failed validation",
1152 cause: err,
1153 })
1154 }
1155 case interface{ Validate() error }:
1156 if err := v.Validate(); err != nil {
1157 errors = append(errors, CertificateValidationContextValidationError{
1158 field: "CaCertificateProviderInstance",
1159 reason: "embedded message failed validation",
1160 cause: err,
1161 })
1162 }
1163 }
1164 } else if v, ok := interface{}(m.GetCaCertificateProviderInstance()).(interface{ Validate() error }); ok {
1165 if err := v.Validate(); err != nil {
1166 return CertificateValidationContextValidationError{
1167 field: "CaCertificateProviderInstance",
1168 reason: "embedded message failed validation",
1169 cause: err,
1170 }
1171 }
1172 }
1173
1174 if all {
1175 switch v := interface{}(m.GetSystemRootCerts()).(type) {
1176 case interface{ ValidateAll() error }:
1177 if err := v.ValidateAll(); err != nil {
1178 errors = append(errors, CertificateValidationContextValidationError{
1179 field: "SystemRootCerts",
1180 reason: "embedded message failed validation",
1181 cause: err,
1182 })
1183 }
1184 case interface{ Validate() error }:
1185 if err := v.Validate(); err != nil {
1186 errors = append(errors, CertificateValidationContextValidationError{
1187 field: "SystemRootCerts",
1188 reason: "embedded message failed validation",
1189 cause: err,
1190 })
1191 }
1192 }
1193 } else if v, ok := interface{}(m.GetSystemRootCerts()).(interface{ Validate() error }); ok {
1194 if err := v.Validate(); err != nil {
1195 return CertificateValidationContextValidationError{
1196 field: "SystemRootCerts",
1197 reason: "embedded message failed validation",
1198 cause: err,
1199 }
1200 }
1201 }
1202
1203 if all {
1204 switch v := interface{}(m.GetWatchedDirectory()).(type) {
1205 case interface{ ValidateAll() error }:
1206 if err := v.ValidateAll(); err != nil {
1207 errors = append(errors, CertificateValidationContextValidationError{
1208 field: "WatchedDirectory",
1209 reason: "embedded message failed validation",
1210 cause: err,
1211 })
1212 }
1213 case interface{ Validate() error }:
1214 if err := v.Validate(); err != nil {
1215 errors = append(errors, CertificateValidationContextValidationError{
1216 field: "WatchedDirectory",
1217 reason: "embedded message failed validation",
1218 cause: err,
1219 })
1220 }
1221 }
1222 } else if v, ok := interface{}(m.GetWatchedDirectory()).(interface{ Validate() error }); ok {
1223 if err := v.Validate(); err != nil {
1224 return CertificateValidationContextValidationError{
1225 field: "WatchedDirectory",
1226 reason: "embedded message failed validation",
1227 cause: err,
1228 }
1229 }
1230 }
1231
1232 for idx, item := range m.GetVerifyCertificateSpki() {
1233 _, _ = idx, item
1234
1235 if utf8.RuneCountInString(item) < 44 {
1236 err := CertificateValidationContextValidationError{
1237 field: fmt.Sprintf("VerifyCertificateSpki[%v]", idx),
1238 reason: "value length must be at least 44 runes",
1239 }
1240 if !all {
1241 return err
1242 }
1243 errors = append(errors, err)
1244 }
1245
1246 if len(item) > 44 {
1247 err := CertificateValidationContextValidationError{
1248 field: fmt.Sprintf("VerifyCertificateSpki[%v]", idx),
1249 reason: "value length must be at most 44 bytes",
1250 }
1251 if !all {
1252 return err
1253 }
1254 errors = append(errors, err)
1255 }
1256
1257 }
1258
1259 for idx, item := range m.GetVerifyCertificateHash() {
1260 _, _ = idx, item
1261
1262 if utf8.RuneCountInString(item) < 64 {
1263 err := CertificateValidationContextValidationError{
1264 field: fmt.Sprintf("VerifyCertificateHash[%v]", idx),
1265 reason: "value length must be at least 64 runes",
1266 }
1267 if !all {
1268 return err
1269 }
1270 errors = append(errors, err)
1271 }
1272
1273 if len(item) > 95 {
1274 err := CertificateValidationContextValidationError{
1275 field: fmt.Sprintf("VerifyCertificateHash[%v]", idx),
1276 reason: "value length must be at most 95 bytes",
1277 }
1278 if !all {
1279 return err
1280 }
1281 errors = append(errors, err)
1282 }
1283
1284 }
1285
1286 for idx, item := range m.GetMatchTypedSubjectAltNames() {
1287 _, _ = idx, item
1288
1289 if all {
1290 switch v := interface{}(item).(type) {
1291 case interface{ ValidateAll() error }:
1292 if err := v.ValidateAll(); err != nil {
1293 errors = append(errors, CertificateValidationContextValidationError{
1294 field: fmt.Sprintf("MatchTypedSubjectAltNames[%v]", idx),
1295 reason: "embedded message failed validation",
1296 cause: err,
1297 })
1298 }
1299 case interface{ Validate() error }:
1300 if err := v.Validate(); err != nil {
1301 errors = append(errors, CertificateValidationContextValidationError{
1302 field: fmt.Sprintf("MatchTypedSubjectAltNames[%v]", idx),
1303 reason: "embedded message failed validation",
1304 cause: err,
1305 })
1306 }
1307 }
1308 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1309 if err := v.Validate(); err != nil {
1310 return CertificateValidationContextValidationError{
1311 field: fmt.Sprintf("MatchTypedSubjectAltNames[%v]", idx),
1312 reason: "embedded message failed validation",
1313 cause: err,
1314 }
1315 }
1316 }
1317
1318 }
1319
1320 for idx, item := range m.GetMatchSubjectAltNames() {
1321 _, _ = idx, item
1322
1323 if all {
1324 switch v := interface{}(item).(type) {
1325 case interface{ ValidateAll() error }:
1326 if err := v.ValidateAll(); err != nil {
1327 errors = append(errors, CertificateValidationContextValidationError{
1328 field: fmt.Sprintf("MatchSubjectAltNames[%v]", idx),
1329 reason: "embedded message failed validation",
1330 cause: err,
1331 })
1332 }
1333 case interface{ Validate() error }:
1334 if err := v.Validate(); err != nil {
1335 errors = append(errors, CertificateValidationContextValidationError{
1336 field: fmt.Sprintf("MatchSubjectAltNames[%v]", idx),
1337 reason: "embedded message failed validation",
1338 cause: err,
1339 })
1340 }
1341 }
1342 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1343 if err := v.Validate(); err != nil {
1344 return CertificateValidationContextValidationError{
1345 field: fmt.Sprintf("MatchSubjectAltNames[%v]", idx),
1346 reason: "embedded message failed validation",
1347 cause: err,
1348 }
1349 }
1350 }
1351
1352 }
1353
1354 if all {
1355 switch v := interface{}(m.GetRequireSignedCertificateTimestamp()).(type) {
1356 case interface{ ValidateAll() error }:
1357 if err := v.ValidateAll(); err != nil {
1358 errors = append(errors, CertificateValidationContextValidationError{
1359 field: "RequireSignedCertificateTimestamp",
1360 reason: "embedded message failed validation",
1361 cause: err,
1362 })
1363 }
1364 case interface{ Validate() error }:
1365 if err := v.Validate(); err != nil {
1366 errors = append(errors, CertificateValidationContextValidationError{
1367 field: "RequireSignedCertificateTimestamp",
1368 reason: "embedded message failed validation",
1369 cause: err,
1370 })
1371 }
1372 }
1373 } else if v, ok := interface{}(m.GetRequireSignedCertificateTimestamp()).(interface{ Validate() error }); ok {
1374 if err := v.Validate(); err != nil {
1375 return CertificateValidationContextValidationError{
1376 field: "RequireSignedCertificateTimestamp",
1377 reason: "embedded message failed validation",
1378 cause: err,
1379 }
1380 }
1381 }
1382
1383 if all {
1384 switch v := interface{}(m.GetCrl()).(type) {
1385 case interface{ ValidateAll() error }:
1386 if err := v.ValidateAll(); err != nil {
1387 errors = append(errors, CertificateValidationContextValidationError{
1388 field: "Crl",
1389 reason: "embedded message failed validation",
1390 cause: err,
1391 })
1392 }
1393 case interface{ Validate() error }:
1394 if err := v.Validate(); err != nil {
1395 errors = append(errors, CertificateValidationContextValidationError{
1396 field: "Crl",
1397 reason: "embedded message failed validation",
1398 cause: err,
1399 })
1400 }
1401 }
1402 } else if v, ok := interface{}(m.GetCrl()).(interface{ Validate() error }); ok {
1403 if err := v.Validate(); err != nil {
1404 return CertificateValidationContextValidationError{
1405 field: "Crl",
1406 reason: "embedded message failed validation",
1407 cause: err,
1408 }
1409 }
1410 }
1411
1412 // no validation rules for AllowExpiredCertificate
1413
1414 if _, ok := CertificateValidationContext_TrustChainVerification_name[int32(m.GetTrustChainVerification())]; !ok {
1415 err := CertificateValidationContextValidationError{
1416 field: "TrustChainVerification",
1417 reason: "value must be one of the defined enum values",
1418 }
1419 if !all {
1420 return err
1421 }
1422 errors = append(errors, err)
1423 }
1424
1425 if all {
1426 switch v := interface{}(m.GetCustomValidatorConfig()).(type) {
1427 case interface{ ValidateAll() error }:
1428 if err := v.ValidateAll(); err != nil {
1429 errors = append(errors, CertificateValidationContextValidationError{
1430 field: "CustomValidatorConfig",
1431 reason: "embedded message failed validation",
1432 cause: err,
1433 })
1434 }
1435 case interface{ Validate() error }:
1436 if err := v.Validate(); err != nil {
1437 errors = append(errors, CertificateValidationContextValidationError{
1438 field: "CustomValidatorConfig",
1439 reason: "embedded message failed validation",
1440 cause: err,
1441 })
1442 }
1443 }
1444 } else if v, ok := interface{}(m.GetCustomValidatorConfig()).(interface{ Validate() error }); ok {
1445 if err := v.Validate(); err != nil {
1446 return CertificateValidationContextValidationError{
1447 field: "CustomValidatorConfig",
1448 reason: "embedded message failed validation",
1449 cause: err,
1450 }
1451 }
1452 }
1453
1454 // no validation rules for OnlyVerifyLeafCertCrl
1455
1456 if wrapper := m.GetMaxVerifyDepth(); wrapper != nil {
1457
1458 if wrapper.GetValue() > 100 {
1459 err := CertificateValidationContextValidationError{
1460 field: "MaxVerifyDepth",
1461 reason: "value must be less than or equal to 100",
1462 }
1463 if !all {
1464 return err
1465 }
1466 errors = append(errors, err)
1467 }
1468
1469 }
1470
1471 if len(errors) > 0 {
1472 return CertificateValidationContextMultiError(errors)
1473 }
1474
1475 return nil
1476 }
1477
1478 // CertificateValidationContextMultiError is an error wrapping multiple
1479 // validation errors returned by CertificateValidationContext.ValidateAll() if
1480 // the designated constraints aren't met.
1481 type CertificateValidationContextMultiError []error
1482
1483 // Error returns a concatenation of all the error messages it wraps.
1484 func (m CertificateValidationContextMultiError) Error() string {
1485 var msgs []string
1486 for _, err := range m {
1487 msgs = append(msgs, err.Error())
1488 }
1489 return strings.Join(msgs, "; ")
1490 }
1491
1492 // AllErrors returns a list of validation violation errors.
1493 func (m CertificateValidationContextMultiError) AllErrors() []error { return m }
1494
1495 // CertificateValidationContextValidationError is the validation error returned
1496 // by CertificateValidationContext.Validate if the designated constraints
1497 // aren't met.
1498 type CertificateValidationContextValidationError struct {
1499 field string
1500 reason string
1501 cause error
1502 key bool
1503 }
1504
1505 // Field function returns field value.
1506 func (e CertificateValidationContextValidationError) Field() string { return e.field }
1507
1508 // Reason function returns reason value.
1509 func (e CertificateValidationContextValidationError) Reason() string { return e.reason }
1510
1511 // Cause function returns cause value.
1512 func (e CertificateValidationContextValidationError) Cause() error { return e.cause }
1513
1514 // Key function returns key value.
1515 func (e CertificateValidationContextValidationError) Key() bool { return e.key }
1516
1517 // ErrorName returns error name.
1518 func (e CertificateValidationContextValidationError) ErrorName() string {
1519 return "CertificateValidationContextValidationError"
1520 }
1521
1522 // Error satisfies the builtin error interface
1523 func (e CertificateValidationContextValidationError) Error() string {
1524 cause := ""
1525 if e.cause != nil {
1526 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1527 }
1528
1529 key := ""
1530 if e.key {
1531 key = "key for "
1532 }
1533
1534 return fmt.Sprintf(
1535 "invalid %sCertificateValidationContext.%s: %s%s",
1536 key,
1537 e.field,
1538 e.reason,
1539 cause)
1540 }
1541
1542 var _ error = CertificateValidationContextValidationError{}
1543
1544 var _ interface {
1545 Field() string
1546 Reason() string
1547 Key() bool
1548 Cause() error
1549 ErrorName() string
1550 } = CertificateValidationContextValidationError{}
1551
1552 // Validate checks the field values on
1553 // CertificateValidationContext_SystemRootCerts with the rules defined in the
1554 // proto definition for this message. If any rules are violated, the first
1555 // error encountered is returned, or nil if there are no violations.
1556 func (m *CertificateValidationContext_SystemRootCerts) Validate() error {
1557 return m.validate(false)
1558 }
1559
1560 // ValidateAll checks the field values on
1561 // CertificateValidationContext_SystemRootCerts with the rules defined in the
1562 // proto definition for this message. If any rules are violated, the result is
1563 // a list of violation errors wrapped in
1564 // CertificateValidationContext_SystemRootCertsMultiError, or nil if none found.
1565 func (m *CertificateValidationContext_SystemRootCerts) ValidateAll() error {
1566 return m.validate(true)
1567 }
1568
1569 func (m *CertificateValidationContext_SystemRootCerts) validate(all bool) error {
1570 if m == nil {
1571 return nil
1572 }
1573
1574 var errors []error
1575
1576 if len(errors) > 0 {
1577 return CertificateValidationContext_SystemRootCertsMultiError(errors)
1578 }
1579
1580 return nil
1581 }
1582
1583 // CertificateValidationContext_SystemRootCertsMultiError is an error wrapping
1584 // multiple validation errors returned by
1585 // CertificateValidationContext_SystemRootCerts.ValidateAll() if the
1586 // designated constraints aren't met.
1587 type CertificateValidationContext_SystemRootCertsMultiError []error
1588
1589 // Error returns a concatenation of all the error messages it wraps.
1590 func (m CertificateValidationContext_SystemRootCertsMultiError) Error() string {
1591 var msgs []string
1592 for _, err := range m {
1593 msgs = append(msgs, err.Error())
1594 }
1595 return strings.Join(msgs, "; ")
1596 }
1597
1598 // AllErrors returns a list of validation violation errors.
1599 func (m CertificateValidationContext_SystemRootCertsMultiError) AllErrors() []error { return m }
1600
1601 // CertificateValidationContext_SystemRootCertsValidationError is the
1602 // validation error returned by
1603 // CertificateValidationContext_SystemRootCerts.Validate if the designated
1604 // constraints aren't met.
1605 type CertificateValidationContext_SystemRootCertsValidationError struct {
1606 field string
1607 reason string
1608 cause error
1609 key bool
1610 }
1611
1612 // Field function returns field value.
1613 func (e CertificateValidationContext_SystemRootCertsValidationError) Field() string { return e.field }
1614
1615 // Reason function returns reason value.
1616 func (e CertificateValidationContext_SystemRootCertsValidationError) Reason() string { return e.reason }
1617
1618 // Cause function returns cause value.
1619 func (e CertificateValidationContext_SystemRootCertsValidationError) Cause() error { return e.cause }
1620
1621 // Key function returns key value.
1622 func (e CertificateValidationContext_SystemRootCertsValidationError) Key() bool { return e.key }
1623
1624 // ErrorName returns error name.
1625 func (e CertificateValidationContext_SystemRootCertsValidationError) ErrorName() string {
1626 return "CertificateValidationContext_SystemRootCertsValidationError"
1627 }
1628
1629 // Error satisfies the builtin error interface
1630 func (e CertificateValidationContext_SystemRootCertsValidationError) Error() string {
1631 cause := ""
1632 if e.cause != nil {
1633 cause = fmt.Sprintf(" | caused by: %v", e.cause)
1634 }
1635
1636 key := ""
1637 if e.key {
1638 key = "key for "
1639 }
1640
1641 return fmt.Sprintf(
1642 "invalid %sCertificateValidationContext_SystemRootCerts.%s: %s%s",
1643 key,
1644 e.field,
1645 e.reason,
1646 cause)
1647 }
1648
1649 var _ error = CertificateValidationContext_SystemRootCertsValidationError{}
1650
1651 var _ interface {
1652 Field() string
1653 Reason() string
1654 Key() bool
1655 Cause() error
1656 ErrorName() string
1657 } = CertificateValidationContext_SystemRootCertsValidationError{}