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