1// Code generated by protoc-gen-validate. DO NOT EDIT.
2// source: envoy/type/metadata/v2/metadata.proto
3
4package envoy_type_metadata_v2
5
6import (
7	"bytes"
8	"errors"
9	"fmt"
10	"net"
11	"net/mail"
12	"net/url"
13	"regexp"
14	"sort"
15	"strings"
16	"time"
17	"unicode/utf8"
18
19	"google.golang.org/protobuf/types/known/anypb"
20)
21
22// ensure the imports are used
23var (
24	_ = bytes.MinRead
25	_ = errors.New("")
26	_ = fmt.Print
27	_ = utf8.UTFMax
28	_ = (*regexp.Regexp)(nil)
29	_ = (*strings.Reader)(nil)
30	_ = net.IPv4len
31	_ = time.Duration(0)
32	_ = (*url.URL)(nil)
33	_ = (*mail.Address)(nil)
34	_ = anypb.Any{}
35	_ = sort.Sort
36)
37
38// Validate checks the field values on MetadataKey with the rules defined in
39// the proto definition for this message. If any rules are violated, the first
40// error encountered is returned, or nil if there are no violations.
41func (m *MetadataKey) Validate() error {
42	return m.validate(false)
43}
44
45// ValidateAll checks the field values on MetadataKey with the rules defined in
46// the proto definition for this message. If any rules are violated, the
47// result is a list of violation errors wrapped in MetadataKeyMultiError, or
48// nil if none found.
49func (m *MetadataKey) ValidateAll() error {
50	return m.validate(true)
51}
52
53func (m *MetadataKey) validate(all bool) error {
54	if m == nil {
55		return nil
56	}
57
58	var errors []error
59
60	if len(m.GetKey()) < 1 {
61		err := MetadataKeyValidationError{
62			field:  "Key",
63			reason: "value length must be at least 1 bytes",
64		}
65		if !all {
66			return err
67		}
68		errors = append(errors, err)
69	}
70
71	if len(m.GetPath()) < 1 {
72		err := MetadataKeyValidationError{
73			field:  "Path",
74			reason: "value must contain at least 1 item(s)",
75		}
76		if !all {
77			return err
78		}
79		errors = append(errors, err)
80	}
81
82	for idx, item := range m.GetPath() {
83		_, _ = idx, item
84
85		if all {
86			switch v := interface{}(item).(type) {
87			case interface{ ValidateAll() error }:
88				if err := v.ValidateAll(); err != nil {
89					errors = append(errors, MetadataKeyValidationError{
90						field:  fmt.Sprintf("Path[%v]", idx),
91						reason: "embedded message failed validation",
92						cause:  err,
93					})
94				}
95			case interface{ Validate() error }:
96				if err := v.Validate(); err != nil {
97					errors = append(errors, MetadataKeyValidationError{
98						field:  fmt.Sprintf("Path[%v]", idx),
99						reason: "embedded message failed validation",
100						cause:  err,
101					})
102				}
103			}
104		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
105			if err := v.Validate(); err != nil {
106				return MetadataKeyValidationError{
107					field:  fmt.Sprintf("Path[%v]", idx),
108					reason: "embedded message failed validation",
109					cause:  err,
110				}
111			}
112		}
113
114	}
115
116	if len(errors) > 0 {
117		return MetadataKeyMultiError(errors)
118	}
119	return nil
120}
121
122// MetadataKeyMultiError is an error wrapping multiple validation errors
123// returned by MetadataKey.ValidateAll() if the designated constraints aren't met.
124type MetadataKeyMultiError []error
125
126// Error returns a concatenation of all the error messages it wraps.
127func (m MetadataKeyMultiError) Error() string {
128	var msgs []string
129	for _, err := range m {
130		msgs = append(msgs, err.Error())
131	}
132	return strings.Join(msgs, "; ")
133}
134
135// AllErrors returns a list of validation violation errors.
136func (m MetadataKeyMultiError) AllErrors() []error { return m }
137
138// MetadataKeyValidationError is the validation error returned by
139// MetadataKey.Validate if the designated constraints aren't met.
140type MetadataKeyValidationError struct {
141	field  string
142	reason string
143	cause  error
144	key    bool
145}
146
147// Field function returns field value.
148func (e MetadataKeyValidationError) Field() string { return e.field }
149
150// Reason function returns reason value.
151func (e MetadataKeyValidationError) Reason() string { return e.reason }
152
153// Cause function returns cause value.
154func (e MetadataKeyValidationError) Cause() error { return e.cause }
155
156// Key function returns key value.
157func (e MetadataKeyValidationError) Key() bool { return e.key }
158
159// ErrorName returns error name.
160func (e MetadataKeyValidationError) ErrorName() string { return "MetadataKeyValidationError" }
161
162// Error satisfies the builtin error interface
163func (e MetadataKeyValidationError) Error() string {
164	cause := ""
165	if e.cause != nil {
166		cause = fmt.Sprintf(" | caused by: %v", e.cause)
167	}
168
169	key := ""
170	if e.key {
171		key = "key for "
172	}
173
174	return fmt.Sprintf(
175		"invalid %sMetadataKey.%s: %s%s",
176		key,
177		e.field,
178		e.reason,
179		cause)
180}
181
182var _ error = MetadataKeyValidationError{}
183
184var _ interface {
185	Field() string
186	Reason() string
187	Key() bool
188	Cause() error
189	ErrorName() string
190} = MetadataKeyValidationError{}
191
192// Validate checks the field values on MetadataKind with the rules defined in
193// the proto definition for this message. If any rules are violated, the first
194// error encountered is returned, or nil if there are no violations.
195func (m *MetadataKind) Validate() error {
196	return m.validate(false)
197}
198
199// ValidateAll checks the field values on MetadataKind with the rules defined
200// in the proto definition for this message. If any rules are violated, the
201// result is a list of violation errors wrapped in MetadataKindMultiError, or
202// nil if none found.
203func (m *MetadataKind) ValidateAll() error {
204	return m.validate(true)
205}
206
207func (m *MetadataKind) validate(all bool) error {
208	if m == nil {
209		return nil
210	}
211
212	var errors []error
213
214	switch m.Kind.(type) {
215
216	case *MetadataKind_Request_:
217
218		if all {
219			switch v := interface{}(m.GetRequest()).(type) {
220			case interface{ ValidateAll() error }:
221				if err := v.ValidateAll(); err != nil {
222					errors = append(errors, MetadataKindValidationError{
223						field:  "Request",
224						reason: "embedded message failed validation",
225						cause:  err,
226					})
227				}
228			case interface{ Validate() error }:
229				if err := v.Validate(); err != nil {
230					errors = append(errors, MetadataKindValidationError{
231						field:  "Request",
232						reason: "embedded message failed validation",
233						cause:  err,
234					})
235				}
236			}
237		} else if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok {
238			if err := v.Validate(); err != nil {
239				return MetadataKindValidationError{
240					field:  "Request",
241					reason: "embedded message failed validation",
242					cause:  err,
243				}
244			}
245		}
246
247	case *MetadataKind_Route_:
248
249		if all {
250			switch v := interface{}(m.GetRoute()).(type) {
251			case interface{ ValidateAll() error }:
252				if err := v.ValidateAll(); err != nil {
253					errors = append(errors, MetadataKindValidationError{
254						field:  "Route",
255						reason: "embedded message failed validation",
256						cause:  err,
257					})
258				}
259			case interface{ Validate() error }:
260				if err := v.Validate(); err != nil {
261					errors = append(errors, MetadataKindValidationError{
262						field:  "Route",
263						reason: "embedded message failed validation",
264						cause:  err,
265					})
266				}
267			}
268		} else if v, ok := interface{}(m.GetRoute()).(interface{ Validate() error }); ok {
269			if err := v.Validate(); err != nil {
270				return MetadataKindValidationError{
271					field:  "Route",
272					reason: "embedded message failed validation",
273					cause:  err,
274				}
275			}
276		}
277
278	case *MetadataKind_Cluster_:
279
280		if all {
281			switch v := interface{}(m.GetCluster()).(type) {
282			case interface{ ValidateAll() error }:
283				if err := v.ValidateAll(); err != nil {
284					errors = append(errors, MetadataKindValidationError{
285						field:  "Cluster",
286						reason: "embedded message failed validation",
287						cause:  err,
288					})
289				}
290			case interface{ Validate() error }:
291				if err := v.Validate(); err != nil {
292					errors = append(errors, MetadataKindValidationError{
293						field:  "Cluster",
294						reason: "embedded message failed validation",
295						cause:  err,
296					})
297				}
298			}
299		} else if v, ok := interface{}(m.GetCluster()).(interface{ Validate() error }); ok {
300			if err := v.Validate(); err != nil {
301				return MetadataKindValidationError{
302					field:  "Cluster",
303					reason: "embedded message failed validation",
304					cause:  err,
305				}
306			}
307		}
308
309	case *MetadataKind_Host_:
310
311		if all {
312			switch v := interface{}(m.GetHost()).(type) {
313			case interface{ ValidateAll() error }:
314				if err := v.ValidateAll(); err != nil {
315					errors = append(errors, MetadataKindValidationError{
316						field:  "Host",
317						reason: "embedded message failed validation",
318						cause:  err,
319					})
320				}
321			case interface{ Validate() error }:
322				if err := v.Validate(); err != nil {
323					errors = append(errors, MetadataKindValidationError{
324						field:  "Host",
325						reason: "embedded message failed validation",
326						cause:  err,
327					})
328				}
329			}
330		} else if v, ok := interface{}(m.GetHost()).(interface{ Validate() error }); ok {
331			if err := v.Validate(); err != nil {
332				return MetadataKindValidationError{
333					field:  "Host",
334					reason: "embedded message failed validation",
335					cause:  err,
336				}
337			}
338		}
339
340	default:
341		err := MetadataKindValidationError{
342			field:  "Kind",
343			reason: "value is required",
344		}
345		if !all {
346			return err
347		}
348		errors = append(errors, err)
349
350	}
351
352	if len(errors) > 0 {
353		return MetadataKindMultiError(errors)
354	}
355	return nil
356}
357
358// MetadataKindMultiError is an error wrapping multiple validation errors
359// returned by MetadataKind.ValidateAll() if the designated constraints aren't met.
360type MetadataKindMultiError []error
361
362// Error returns a concatenation of all the error messages it wraps.
363func (m MetadataKindMultiError) Error() string {
364	var msgs []string
365	for _, err := range m {
366		msgs = append(msgs, err.Error())
367	}
368	return strings.Join(msgs, "; ")
369}
370
371// AllErrors returns a list of validation violation errors.
372func (m MetadataKindMultiError) AllErrors() []error { return m }
373
374// MetadataKindValidationError is the validation error returned by
375// MetadataKind.Validate if the designated constraints aren't met.
376type MetadataKindValidationError struct {
377	field  string
378	reason string
379	cause  error
380	key    bool
381}
382
383// Field function returns field value.
384func (e MetadataKindValidationError) Field() string { return e.field }
385
386// Reason function returns reason value.
387func (e MetadataKindValidationError) Reason() string { return e.reason }
388
389// Cause function returns cause value.
390func (e MetadataKindValidationError) Cause() error { return e.cause }
391
392// Key function returns key value.
393func (e MetadataKindValidationError) Key() bool { return e.key }
394
395// ErrorName returns error name.
396func (e MetadataKindValidationError) ErrorName() string { return "MetadataKindValidationError" }
397
398// Error satisfies the builtin error interface
399func (e MetadataKindValidationError) Error() string {
400	cause := ""
401	if e.cause != nil {
402		cause = fmt.Sprintf(" | caused by: %v", e.cause)
403	}
404
405	key := ""
406	if e.key {
407		key = "key for "
408	}
409
410	return fmt.Sprintf(
411		"invalid %sMetadataKind.%s: %s%s",
412		key,
413		e.field,
414		e.reason,
415		cause)
416}
417
418var _ error = MetadataKindValidationError{}
419
420var _ interface {
421	Field() string
422	Reason() string
423	Key() bool
424	Cause() error
425	ErrorName() string
426} = MetadataKindValidationError{}
427
428// Validate checks the field values on MetadataKey_PathSegment with the rules
429// defined in the proto definition for this message. If any rules are
430// violated, the first error encountered is returned, or nil if there are no violations.
431func (m *MetadataKey_PathSegment) Validate() error {
432	return m.validate(false)
433}
434
435// ValidateAll checks the field values on MetadataKey_PathSegment with the
436// rules defined in the proto definition for this message. If any rules are
437// violated, the result is a list of violation errors wrapped in
438// MetadataKey_PathSegmentMultiError, or nil if none found.
439func (m *MetadataKey_PathSegment) ValidateAll() error {
440	return m.validate(true)
441}
442
443func (m *MetadataKey_PathSegment) validate(all bool) error {
444	if m == nil {
445		return nil
446	}
447
448	var errors []error
449
450	switch m.Segment.(type) {
451
452	case *MetadataKey_PathSegment_Key:
453
454		if len(m.GetKey()) < 1 {
455			err := MetadataKey_PathSegmentValidationError{
456				field:  "Key",
457				reason: "value length must be at least 1 bytes",
458			}
459			if !all {
460				return err
461			}
462			errors = append(errors, err)
463		}
464
465	default:
466		err := MetadataKey_PathSegmentValidationError{
467			field:  "Segment",
468			reason: "value is required",
469		}
470		if !all {
471			return err
472		}
473		errors = append(errors, err)
474
475	}
476
477	if len(errors) > 0 {
478		return MetadataKey_PathSegmentMultiError(errors)
479	}
480	return nil
481}
482
483// MetadataKey_PathSegmentMultiError is an error wrapping multiple validation
484// errors returned by MetadataKey_PathSegment.ValidateAll() if the designated
485// constraints aren't met.
486type MetadataKey_PathSegmentMultiError []error
487
488// Error returns a concatenation of all the error messages it wraps.
489func (m MetadataKey_PathSegmentMultiError) Error() string {
490	var msgs []string
491	for _, err := range m {
492		msgs = append(msgs, err.Error())
493	}
494	return strings.Join(msgs, "; ")
495}
496
497// AllErrors returns a list of validation violation errors.
498func (m MetadataKey_PathSegmentMultiError) AllErrors() []error { return m }
499
500// MetadataKey_PathSegmentValidationError is the validation error returned by
501// MetadataKey_PathSegment.Validate if the designated constraints aren't met.
502type MetadataKey_PathSegmentValidationError struct {
503	field  string
504	reason string
505	cause  error
506	key    bool
507}
508
509// Field function returns field value.
510func (e MetadataKey_PathSegmentValidationError) Field() string { return e.field }
511
512// Reason function returns reason value.
513func (e MetadataKey_PathSegmentValidationError) Reason() string { return e.reason }
514
515// Cause function returns cause value.
516func (e MetadataKey_PathSegmentValidationError) Cause() error { return e.cause }
517
518// Key function returns key value.
519func (e MetadataKey_PathSegmentValidationError) Key() bool { return e.key }
520
521// ErrorName returns error name.
522func (e MetadataKey_PathSegmentValidationError) ErrorName() string {
523	return "MetadataKey_PathSegmentValidationError"
524}
525
526// Error satisfies the builtin error interface
527func (e MetadataKey_PathSegmentValidationError) Error() string {
528	cause := ""
529	if e.cause != nil {
530		cause = fmt.Sprintf(" | caused by: %v", e.cause)
531	}
532
533	key := ""
534	if e.key {
535		key = "key for "
536	}
537
538	return fmt.Sprintf(
539		"invalid %sMetadataKey_PathSegment.%s: %s%s",
540		key,
541		e.field,
542		e.reason,
543		cause)
544}
545
546var _ error = MetadataKey_PathSegmentValidationError{}
547
548var _ interface {
549	Field() string
550	Reason() string
551	Key() bool
552	Cause() error
553	ErrorName() string
554} = MetadataKey_PathSegmentValidationError{}
555
556// Validate checks the field values on MetadataKind_Request with the rules
557// defined in the proto definition for this message. If any rules are
558// violated, the first error encountered is returned, or nil if there are no violations.
559func (m *MetadataKind_Request) Validate() error {
560	return m.validate(false)
561}
562
563// ValidateAll checks the field values on MetadataKind_Request with the rules
564// defined in the proto definition for this message. If any rules are
565// violated, the result is a list of violation errors wrapped in
566// MetadataKind_RequestMultiError, or nil if none found.
567func (m *MetadataKind_Request) ValidateAll() error {
568	return m.validate(true)
569}
570
571func (m *MetadataKind_Request) validate(all bool) error {
572	if m == nil {
573		return nil
574	}
575
576	var errors []error
577
578	if len(errors) > 0 {
579		return MetadataKind_RequestMultiError(errors)
580	}
581	return nil
582}
583
584// MetadataKind_RequestMultiError is an error wrapping multiple validation
585// errors returned by MetadataKind_Request.ValidateAll() if the designated
586// constraints aren't met.
587type MetadataKind_RequestMultiError []error
588
589// Error returns a concatenation of all the error messages it wraps.
590func (m MetadataKind_RequestMultiError) Error() string {
591	var msgs []string
592	for _, err := range m {
593		msgs = append(msgs, err.Error())
594	}
595	return strings.Join(msgs, "; ")
596}
597
598// AllErrors returns a list of validation violation errors.
599func (m MetadataKind_RequestMultiError) AllErrors() []error { return m }
600
601// MetadataKind_RequestValidationError is the validation error returned by
602// MetadataKind_Request.Validate if the designated constraints aren't met.
603type MetadataKind_RequestValidationError struct {
604	field  string
605	reason string
606	cause  error
607	key    bool
608}
609
610// Field function returns field value.
611func (e MetadataKind_RequestValidationError) Field() string { return e.field }
612
613// Reason function returns reason value.
614func (e MetadataKind_RequestValidationError) Reason() string { return e.reason }
615
616// Cause function returns cause value.
617func (e MetadataKind_RequestValidationError) Cause() error { return e.cause }
618
619// Key function returns key value.
620func (e MetadataKind_RequestValidationError) Key() bool { return e.key }
621
622// ErrorName returns error name.
623func (e MetadataKind_RequestValidationError) ErrorName() string {
624	return "MetadataKind_RequestValidationError"
625}
626
627// Error satisfies the builtin error interface
628func (e MetadataKind_RequestValidationError) Error() string {
629	cause := ""
630	if e.cause != nil {
631		cause = fmt.Sprintf(" | caused by: %v", e.cause)
632	}
633
634	key := ""
635	if e.key {
636		key = "key for "
637	}
638
639	return fmt.Sprintf(
640		"invalid %sMetadataKind_Request.%s: %s%s",
641		key,
642		e.field,
643		e.reason,
644		cause)
645}
646
647var _ error = MetadataKind_RequestValidationError{}
648
649var _ interface {
650	Field() string
651	Reason() string
652	Key() bool
653	Cause() error
654	ErrorName() string
655} = MetadataKind_RequestValidationError{}
656
657// Validate checks the field values on MetadataKind_Route with the rules
658// defined in the proto definition for this message. If any rules are
659// violated, the first error encountered is returned, or nil if there are no violations.
660func (m *MetadataKind_Route) Validate() error {
661	return m.validate(false)
662}
663
664// ValidateAll checks the field values on MetadataKind_Route with the rules
665// defined in the proto definition for this message. If any rules are
666// violated, the result is a list of violation errors wrapped in
667// MetadataKind_RouteMultiError, or nil if none found.
668func (m *MetadataKind_Route) ValidateAll() error {
669	return m.validate(true)
670}
671
672func (m *MetadataKind_Route) validate(all bool) error {
673	if m == nil {
674		return nil
675	}
676
677	var errors []error
678
679	if len(errors) > 0 {
680		return MetadataKind_RouteMultiError(errors)
681	}
682	return nil
683}
684
685// MetadataKind_RouteMultiError is an error wrapping multiple validation errors
686// returned by MetadataKind_Route.ValidateAll() if the designated constraints
687// aren't met.
688type MetadataKind_RouteMultiError []error
689
690// Error returns a concatenation of all the error messages it wraps.
691func (m MetadataKind_RouteMultiError) Error() string {
692	var msgs []string
693	for _, err := range m {
694		msgs = append(msgs, err.Error())
695	}
696	return strings.Join(msgs, "; ")
697}
698
699// AllErrors returns a list of validation violation errors.
700func (m MetadataKind_RouteMultiError) AllErrors() []error { return m }
701
702// MetadataKind_RouteValidationError is the validation error returned by
703// MetadataKind_Route.Validate if the designated constraints aren't met.
704type MetadataKind_RouteValidationError struct {
705	field  string
706	reason string
707	cause  error
708	key    bool
709}
710
711// Field function returns field value.
712func (e MetadataKind_RouteValidationError) Field() string { return e.field }
713
714// Reason function returns reason value.
715func (e MetadataKind_RouteValidationError) Reason() string { return e.reason }
716
717// Cause function returns cause value.
718func (e MetadataKind_RouteValidationError) Cause() error { return e.cause }
719
720// Key function returns key value.
721func (e MetadataKind_RouteValidationError) Key() bool { return e.key }
722
723// ErrorName returns error name.
724func (e MetadataKind_RouteValidationError) ErrorName() string {
725	return "MetadataKind_RouteValidationError"
726}
727
728// Error satisfies the builtin error interface
729func (e MetadataKind_RouteValidationError) Error() string {
730	cause := ""
731	if e.cause != nil {
732		cause = fmt.Sprintf(" | caused by: %v", e.cause)
733	}
734
735	key := ""
736	if e.key {
737		key = "key for "
738	}
739
740	return fmt.Sprintf(
741		"invalid %sMetadataKind_Route.%s: %s%s",
742		key,
743		e.field,
744		e.reason,
745		cause)
746}
747
748var _ error = MetadataKind_RouteValidationError{}
749
750var _ interface {
751	Field() string
752	Reason() string
753	Key() bool
754	Cause() error
755	ErrorName() string
756} = MetadataKind_RouteValidationError{}
757
758// Validate checks the field values on MetadataKind_Cluster with the rules
759// defined in the proto definition for this message. If any rules are
760// violated, the first error encountered is returned, or nil if there are no violations.
761func (m *MetadataKind_Cluster) Validate() error {
762	return m.validate(false)
763}
764
765// ValidateAll checks the field values on MetadataKind_Cluster with the rules
766// defined in the proto definition for this message. If any rules are
767// violated, the result is a list of violation errors wrapped in
768// MetadataKind_ClusterMultiError, or nil if none found.
769func (m *MetadataKind_Cluster) ValidateAll() error {
770	return m.validate(true)
771}
772
773func (m *MetadataKind_Cluster) validate(all bool) error {
774	if m == nil {
775		return nil
776	}
777
778	var errors []error
779
780	if len(errors) > 0 {
781		return MetadataKind_ClusterMultiError(errors)
782	}
783	return nil
784}
785
786// MetadataKind_ClusterMultiError is an error wrapping multiple validation
787// errors returned by MetadataKind_Cluster.ValidateAll() if the designated
788// constraints aren't met.
789type MetadataKind_ClusterMultiError []error
790
791// Error returns a concatenation of all the error messages it wraps.
792func (m MetadataKind_ClusterMultiError) Error() string {
793	var msgs []string
794	for _, err := range m {
795		msgs = append(msgs, err.Error())
796	}
797	return strings.Join(msgs, "; ")
798}
799
800// AllErrors returns a list of validation violation errors.
801func (m MetadataKind_ClusterMultiError) AllErrors() []error { return m }
802
803// MetadataKind_ClusterValidationError is the validation error returned by
804// MetadataKind_Cluster.Validate if the designated constraints aren't met.
805type MetadataKind_ClusterValidationError struct {
806	field  string
807	reason string
808	cause  error
809	key    bool
810}
811
812// Field function returns field value.
813func (e MetadataKind_ClusterValidationError) Field() string { return e.field }
814
815// Reason function returns reason value.
816func (e MetadataKind_ClusterValidationError) Reason() string { return e.reason }
817
818// Cause function returns cause value.
819func (e MetadataKind_ClusterValidationError) Cause() error { return e.cause }
820
821// Key function returns key value.
822func (e MetadataKind_ClusterValidationError) Key() bool { return e.key }
823
824// ErrorName returns error name.
825func (e MetadataKind_ClusterValidationError) ErrorName() string {
826	return "MetadataKind_ClusterValidationError"
827}
828
829// Error satisfies the builtin error interface
830func (e MetadataKind_ClusterValidationError) Error() string {
831	cause := ""
832	if e.cause != nil {
833		cause = fmt.Sprintf(" | caused by: %v", e.cause)
834	}
835
836	key := ""
837	if e.key {
838		key = "key for "
839	}
840
841	return fmt.Sprintf(
842		"invalid %sMetadataKind_Cluster.%s: %s%s",
843		key,
844		e.field,
845		e.reason,
846		cause)
847}
848
849var _ error = MetadataKind_ClusterValidationError{}
850
851var _ interface {
852	Field() string
853	Reason() string
854	Key() bool
855	Cause() error
856	ErrorName() string
857} = MetadataKind_ClusterValidationError{}
858
859// Validate checks the field values on MetadataKind_Host with the rules defined
860// in the proto definition for this message. If any rules are violated, the
861// first error encountered is returned, or nil if there are no violations.
862func (m *MetadataKind_Host) Validate() error {
863	return m.validate(false)
864}
865
866// ValidateAll checks the field values on MetadataKind_Host with the rules
867// defined in the proto definition for this message. If any rules are
868// violated, the result is a list of violation errors wrapped in
869// MetadataKind_HostMultiError, or nil if none found.
870func (m *MetadataKind_Host) ValidateAll() error {
871	return m.validate(true)
872}
873
874func (m *MetadataKind_Host) validate(all bool) error {
875	if m == nil {
876		return nil
877	}
878
879	var errors []error
880
881	if len(errors) > 0 {
882		return MetadataKind_HostMultiError(errors)
883	}
884	return nil
885}
886
887// MetadataKind_HostMultiError is an error wrapping multiple validation errors
888// returned by MetadataKind_Host.ValidateAll() if the designated constraints
889// aren't met.
890type MetadataKind_HostMultiError []error
891
892// Error returns a concatenation of all the error messages it wraps.
893func (m MetadataKind_HostMultiError) Error() string {
894	var msgs []string
895	for _, err := range m {
896		msgs = append(msgs, err.Error())
897	}
898	return strings.Join(msgs, "; ")
899}
900
901// AllErrors returns a list of validation violation errors.
902func (m MetadataKind_HostMultiError) AllErrors() []error { return m }
903
904// MetadataKind_HostValidationError is the validation error returned by
905// MetadataKind_Host.Validate if the designated constraints aren't met.
906type MetadataKind_HostValidationError struct {
907	field  string
908	reason string
909	cause  error
910	key    bool
911}
912
913// Field function returns field value.
914func (e MetadataKind_HostValidationError) Field() string { return e.field }
915
916// Reason function returns reason value.
917func (e MetadataKind_HostValidationError) Reason() string { return e.reason }
918
919// Cause function returns cause value.
920func (e MetadataKind_HostValidationError) Cause() error { return e.cause }
921
922// Key function returns key value.
923func (e MetadataKind_HostValidationError) Key() bool { return e.key }
924
925// ErrorName returns error name.
926func (e MetadataKind_HostValidationError) ErrorName() string {
927	return "MetadataKind_HostValidationError"
928}
929
930// Error satisfies the builtin error interface
931func (e MetadataKind_HostValidationError) Error() string {
932	cause := ""
933	if e.cause != nil {
934		cause = fmt.Sprintf(" | caused by: %v", e.cause)
935	}
936
937	key := ""
938	if e.key {
939		key = "key for "
940	}
941
942	return fmt.Sprintf(
943		"invalid %sMetadataKind_Host.%s: %s%s",
944		key,
945		e.field,
946		e.reason,
947		cause)
948}
949
950var _ error = MetadataKind_HostValidationError{}
951
952var _ interface {
953	Field() string
954	Reason() string
955	Key() bool
956	Cause() error
957	ErrorName() string
958} = MetadataKind_HostValidationError{}
959