1// Code generated by protoc-gen-validate. DO NOT EDIT.
2// source: envoy/api/v2/route/route_components.proto
3
4package envoy_api_v2_route
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	core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"
22)
23
24// ensure the imports are used
25var (
26	_ = bytes.MinRead
27	_ = errors.New("")
28	_ = fmt.Print
29	_ = utf8.UTFMax
30	_ = (*regexp.Regexp)(nil)
31	_ = (*strings.Reader)(nil)
32	_ = net.IPv4len
33	_ = time.Duration(0)
34	_ = (*url.URL)(nil)
35	_ = (*mail.Address)(nil)
36	_ = anypb.Any{}
37	_ = sort.Sort
38
39	_ = core.RoutingPriority(0)
40
41	_ = core.RequestMethod(0)
42)
43
44// Validate checks the field values on VirtualHost with the rules defined in
45// the proto definition for this message. If any rules are violated, the first
46// error encountered is returned, or nil if there are no violations.
47func (m *VirtualHost) Validate() error {
48	return m.validate(false)
49}
50
51// ValidateAll checks the field values on VirtualHost with the rules defined in
52// the proto definition for this message. If any rules are violated, the
53// result is a list of violation errors wrapped in VirtualHostMultiError, or
54// nil if none found.
55func (m *VirtualHost) ValidateAll() error {
56	return m.validate(true)
57}
58
59func (m *VirtualHost) validate(all bool) error {
60	if m == nil {
61		return nil
62	}
63
64	var errors []error
65
66	if len(m.GetName()) < 1 {
67		err := VirtualHostValidationError{
68			field:  "Name",
69			reason: "value length must be at least 1 bytes",
70		}
71		if !all {
72			return err
73		}
74		errors = append(errors, err)
75	}
76
77	if len(m.GetDomains()) < 1 {
78		err := VirtualHostValidationError{
79			field:  "Domains",
80			reason: "value must contain at least 1 item(s)",
81		}
82		if !all {
83			return err
84		}
85		errors = append(errors, err)
86	}
87
88	for idx, item := range m.GetDomains() {
89		_, _ = idx, item
90
91		if !_VirtualHost_Domains_Pattern.MatchString(item) {
92			err := VirtualHostValidationError{
93				field:  fmt.Sprintf("Domains[%v]", idx),
94				reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
95			}
96			if !all {
97				return err
98			}
99			errors = append(errors, err)
100		}
101
102	}
103
104	for idx, item := range m.GetRoutes() {
105		_, _ = idx, item
106
107		if all {
108			switch v := interface{}(item).(type) {
109			case interface{ ValidateAll() error }:
110				if err := v.ValidateAll(); err != nil {
111					errors = append(errors, VirtualHostValidationError{
112						field:  fmt.Sprintf("Routes[%v]", idx),
113						reason: "embedded message failed validation",
114						cause:  err,
115					})
116				}
117			case interface{ Validate() error }:
118				if err := v.Validate(); err != nil {
119					errors = append(errors, VirtualHostValidationError{
120						field:  fmt.Sprintf("Routes[%v]", idx),
121						reason: "embedded message failed validation",
122						cause:  err,
123					})
124				}
125			}
126		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
127			if err := v.Validate(); err != nil {
128				return VirtualHostValidationError{
129					field:  fmt.Sprintf("Routes[%v]", idx),
130					reason: "embedded message failed validation",
131					cause:  err,
132				}
133			}
134		}
135
136	}
137
138	if _, ok := VirtualHost_TlsRequirementType_name[int32(m.GetRequireTls())]; !ok {
139		err := VirtualHostValidationError{
140			field:  "RequireTls",
141			reason: "value must be one of the defined enum values",
142		}
143		if !all {
144			return err
145		}
146		errors = append(errors, err)
147	}
148
149	for idx, item := range m.GetVirtualClusters() {
150		_, _ = idx, item
151
152		if all {
153			switch v := interface{}(item).(type) {
154			case interface{ ValidateAll() error }:
155				if err := v.ValidateAll(); err != nil {
156					errors = append(errors, VirtualHostValidationError{
157						field:  fmt.Sprintf("VirtualClusters[%v]", idx),
158						reason: "embedded message failed validation",
159						cause:  err,
160					})
161				}
162			case interface{ Validate() error }:
163				if err := v.Validate(); err != nil {
164					errors = append(errors, VirtualHostValidationError{
165						field:  fmt.Sprintf("VirtualClusters[%v]", idx),
166						reason: "embedded message failed validation",
167						cause:  err,
168					})
169				}
170			}
171		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
172			if err := v.Validate(); err != nil {
173				return VirtualHostValidationError{
174					field:  fmt.Sprintf("VirtualClusters[%v]", idx),
175					reason: "embedded message failed validation",
176					cause:  err,
177				}
178			}
179		}
180
181	}
182
183	for idx, item := range m.GetRateLimits() {
184		_, _ = idx, item
185
186		if all {
187			switch v := interface{}(item).(type) {
188			case interface{ ValidateAll() error }:
189				if err := v.ValidateAll(); err != nil {
190					errors = append(errors, VirtualHostValidationError{
191						field:  fmt.Sprintf("RateLimits[%v]", idx),
192						reason: "embedded message failed validation",
193						cause:  err,
194					})
195				}
196			case interface{ Validate() error }:
197				if err := v.Validate(); err != nil {
198					errors = append(errors, VirtualHostValidationError{
199						field:  fmt.Sprintf("RateLimits[%v]", idx),
200						reason: "embedded message failed validation",
201						cause:  err,
202					})
203				}
204			}
205		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
206			if err := v.Validate(); err != nil {
207				return VirtualHostValidationError{
208					field:  fmt.Sprintf("RateLimits[%v]", idx),
209					reason: "embedded message failed validation",
210					cause:  err,
211				}
212			}
213		}
214
215	}
216
217	if len(m.GetRequestHeadersToAdd()) > 1000 {
218		err := VirtualHostValidationError{
219			field:  "RequestHeadersToAdd",
220			reason: "value must contain no more than 1000 item(s)",
221		}
222		if !all {
223			return err
224		}
225		errors = append(errors, err)
226	}
227
228	for idx, item := range m.GetRequestHeadersToAdd() {
229		_, _ = idx, item
230
231		if all {
232			switch v := interface{}(item).(type) {
233			case interface{ ValidateAll() error }:
234				if err := v.ValidateAll(); err != nil {
235					errors = append(errors, VirtualHostValidationError{
236						field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
237						reason: "embedded message failed validation",
238						cause:  err,
239					})
240				}
241			case interface{ Validate() error }:
242				if err := v.Validate(); err != nil {
243					errors = append(errors, VirtualHostValidationError{
244						field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
245						reason: "embedded message failed validation",
246						cause:  err,
247					})
248				}
249			}
250		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
251			if err := v.Validate(); err != nil {
252				return VirtualHostValidationError{
253					field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
254					reason: "embedded message failed validation",
255					cause:  err,
256				}
257			}
258		}
259
260	}
261
262	if len(m.GetResponseHeadersToAdd()) > 1000 {
263		err := VirtualHostValidationError{
264			field:  "ResponseHeadersToAdd",
265			reason: "value must contain no more than 1000 item(s)",
266		}
267		if !all {
268			return err
269		}
270		errors = append(errors, err)
271	}
272
273	for idx, item := range m.GetResponseHeadersToAdd() {
274		_, _ = idx, item
275
276		if all {
277			switch v := interface{}(item).(type) {
278			case interface{ ValidateAll() error }:
279				if err := v.ValidateAll(); err != nil {
280					errors = append(errors, VirtualHostValidationError{
281						field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
282						reason: "embedded message failed validation",
283						cause:  err,
284					})
285				}
286			case interface{ Validate() error }:
287				if err := v.Validate(); err != nil {
288					errors = append(errors, VirtualHostValidationError{
289						field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
290						reason: "embedded message failed validation",
291						cause:  err,
292					})
293				}
294			}
295		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
296			if err := v.Validate(); err != nil {
297				return VirtualHostValidationError{
298					field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
299					reason: "embedded message failed validation",
300					cause:  err,
301				}
302			}
303		}
304
305	}
306
307	if all {
308		switch v := interface{}(m.GetCors()).(type) {
309		case interface{ ValidateAll() error }:
310			if err := v.ValidateAll(); err != nil {
311				errors = append(errors, VirtualHostValidationError{
312					field:  "Cors",
313					reason: "embedded message failed validation",
314					cause:  err,
315				})
316			}
317		case interface{ Validate() error }:
318			if err := v.Validate(); err != nil {
319				errors = append(errors, VirtualHostValidationError{
320					field:  "Cors",
321					reason: "embedded message failed validation",
322					cause:  err,
323				})
324			}
325		}
326	} else if v, ok := interface{}(m.GetCors()).(interface{ Validate() error }); ok {
327		if err := v.Validate(); err != nil {
328			return VirtualHostValidationError{
329				field:  "Cors",
330				reason: "embedded message failed validation",
331				cause:  err,
332			}
333		}
334	}
335
336	{
337		sorted_keys := make([]string, len(m.GetPerFilterConfig()))
338		i := 0
339		for key := range m.GetPerFilterConfig() {
340			sorted_keys[i] = key
341			i++
342		}
343		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
344		for _, key := range sorted_keys {
345			val := m.GetPerFilterConfig()[key]
346			_ = val
347
348			// no validation rules for PerFilterConfig[key]
349
350			if all {
351				switch v := interface{}(val).(type) {
352				case interface{ ValidateAll() error }:
353					if err := v.ValidateAll(); err != nil {
354						errors = append(errors, VirtualHostValidationError{
355							field:  fmt.Sprintf("PerFilterConfig[%v]", key),
356							reason: "embedded message failed validation",
357							cause:  err,
358						})
359					}
360				case interface{ Validate() error }:
361					if err := v.Validate(); err != nil {
362						errors = append(errors, VirtualHostValidationError{
363							field:  fmt.Sprintf("PerFilterConfig[%v]", key),
364							reason: "embedded message failed validation",
365							cause:  err,
366						})
367					}
368				}
369			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
370				if err := v.Validate(); err != nil {
371					return VirtualHostValidationError{
372						field:  fmt.Sprintf("PerFilterConfig[%v]", key),
373						reason: "embedded message failed validation",
374						cause:  err,
375					}
376				}
377			}
378
379		}
380	}
381
382	{
383		sorted_keys := make([]string, len(m.GetTypedPerFilterConfig()))
384		i := 0
385		for key := range m.GetTypedPerFilterConfig() {
386			sorted_keys[i] = key
387			i++
388		}
389		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
390		for _, key := range sorted_keys {
391			val := m.GetTypedPerFilterConfig()[key]
392			_ = val
393
394			// no validation rules for TypedPerFilterConfig[key]
395
396			if all {
397				switch v := interface{}(val).(type) {
398				case interface{ ValidateAll() error }:
399					if err := v.ValidateAll(); err != nil {
400						errors = append(errors, VirtualHostValidationError{
401							field:  fmt.Sprintf("TypedPerFilterConfig[%v]", key),
402							reason: "embedded message failed validation",
403							cause:  err,
404						})
405					}
406				case interface{ Validate() error }:
407					if err := v.Validate(); err != nil {
408						errors = append(errors, VirtualHostValidationError{
409							field:  fmt.Sprintf("TypedPerFilterConfig[%v]", key),
410							reason: "embedded message failed validation",
411							cause:  err,
412						})
413					}
414				}
415			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
416				if err := v.Validate(); err != nil {
417					return VirtualHostValidationError{
418						field:  fmt.Sprintf("TypedPerFilterConfig[%v]", key),
419						reason: "embedded message failed validation",
420						cause:  err,
421					}
422				}
423			}
424
425		}
426	}
427
428	// no validation rules for IncludeRequestAttemptCount
429
430	// no validation rules for IncludeAttemptCountInResponse
431
432	if all {
433		switch v := interface{}(m.GetRetryPolicy()).(type) {
434		case interface{ ValidateAll() error }:
435			if err := v.ValidateAll(); err != nil {
436				errors = append(errors, VirtualHostValidationError{
437					field:  "RetryPolicy",
438					reason: "embedded message failed validation",
439					cause:  err,
440				})
441			}
442		case interface{ Validate() error }:
443			if err := v.Validate(); err != nil {
444				errors = append(errors, VirtualHostValidationError{
445					field:  "RetryPolicy",
446					reason: "embedded message failed validation",
447					cause:  err,
448				})
449			}
450		}
451	} else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok {
452		if err := v.Validate(); err != nil {
453			return VirtualHostValidationError{
454				field:  "RetryPolicy",
455				reason: "embedded message failed validation",
456				cause:  err,
457			}
458		}
459	}
460
461	if all {
462		switch v := interface{}(m.GetRetryPolicyTypedConfig()).(type) {
463		case interface{ ValidateAll() error }:
464			if err := v.ValidateAll(); err != nil {
465				errors = append(errors, VirtualHostValidationError{
466					field:  "RetryPolicyTypedConfig",
467					reason: "embedded message failed validation",
468					cause:  err,
469				})
470			}
471		case interface{ Validate() error }:
472			if err := v.Validate(); err != nil {
473				errors = append(errors, VirtualHostValidationError{
474					field:  "RetryPolicyTypedConfig",
475					reason: "embedded message failed validation",
476					cause:  err,
477				})
478			}
479		}
480	} else if v, ok := interface{}(m.GetRetryPolicyTypedConfig()).(interface{ Validate() error }); ok {
481		if err := v.Validate(); err != nil {
482			return VirtualHostValidationError{
483				field:  "RetryPolicyTypedConfig",
484				reason: "embedded message failed validation",
485				cause:  err,
486			}
487		}
488	}
489
490	if all {
491		switch v := interface{}(m.GetHedgePolicy()).(type) {
492		case interface{ ValidateAll() error }:
493			if err := v.ValidateAll(); err != nil {
494				errors = append(errors, VirtualHostValidationError{
495					field:  "HedgePolicy",
496					reason: "embedded message failed validation",
497					cause:  err,
498				})
499			}
500		case interface{ Validate() error }:
501			if err := v.Validate(); err != nil {
502				errors = append(errors, VirtualHostValidationError{
503					field:  "HedgePolicy",
504					reason: "embedded message failed validation",
505					cause:  err,
506				})
507			}
508		}
509	} else if v, ok := interface{}(m.GetHedgePolicy()).(interface{ Validate() error }); ok {
510		if err := v.Validate(); err != nil {
511			return VirtualHostValidationError{
512				field:  "HedgePolicy",
513				reason: "embedded message failed validation",
514				cause:  err,
515			}
516		}
517	}
518
519	if all {
520		switch v := interface{}(m.GetPerRequestBufferLimitBytes()).(type) {
521		case interface{ ValidateAll() error }:
522			if err := v.ValidateAll(); err != nil {
523				errors = append(errors, VirtualHostValidationError{
524					field:  "PerRequestBufferLimitBytes",
525					reason: "embedded message failed validation",
526					cause:  err,
527				})
528			}
529		case interface{ Validate() error }:
530			if err := v.Validate(); err != nil {
531				errors = append(errors, VirtualHostValidationError{
532					field:  "PerRequestBufferLimitBytes",
533					reason: "embedded message failed validation",
534					cause:  err,
535				})
536			}
537		}
538	} else if v, ok := interface{}(m.GetPerRequestBufferLimitBytes()).(interface{ Validate() error }); ok {
539		if err := v.Validate(); err != nil {
540			return VirtualHostValidationError{
541				field:  "PerRequestBufferLimitBytes",
542				reason: "embedded message failed validation",
543				cause:  err,
544			}
545		}
546	}
547
548	if len(errors) > 0 {
549		return VirtualHostMultiError(errors)
550	}
551	return nil
552}
553
554// VirtualHostMultiError is an error wrapping multiple validation errors
555// returned by VirtualHost.ValidateAll() if the designated constraints aren't met.
556type VirtualHostMultiError []error
557
558// Error returns a concatenation of all the error messages it wraps.
559func (m VirtualHostMultiError) Error() string {
560	var msgs []string
561	for _, err := range m {
562		msgs = append(msgs, err.Error())
563	}
564	return strings.Join(msgs, "; ")
565}
566
567// AllErrors returns a list of validation violation errors.
568func (m VirtualHostMultiError) AllErrors() []error { return m }
569
570// VirtualHostValidationError is the validation error returned by
571// VirtualHost.Validate if the designated constraints aren't met.
572type VirtualHostValidationError struct {
573	field  string
574	reason string
575	cause  error
576	key    bool
577}
578
579// Field function returns field value.
580func (e VirtualHostValidationError) Field() string { return e.field }
581
582// Reason function returns reason value.
583func (e VirtualHostValidationError) Reason() string { return e.reason }
584
585// Cause function returns cause value.
586func (e VirtualHostValidationError) Cause() error { return e.cause }
587
588// Key function returns key value.
589func (e VirtualHostValidationError) Key() bool { return e.key }
590
591// ErrorName returns error name.
592func (e VirtualHostValidationError) ErrorName() string { return "VirtualHostValidationError" }
593
594// Error satisfies the builtin error interface
595func (e VirtualHostValidationError) Error() string {
596	cause := ""
597	if e.cause != nil {
598		cause = fmt.Sprintf(" | caused by: %v", e.cause)
599	}
600
601	key := ""
602	if e.key {
603		key = "key for "
604	}
605
606	return fmt.Sprintf(
607		"invalid %sVirtualHost.%s: %s%s",
608		key,
609		e.field,
610		e.reason,
611		cause)
612}
613
614var _ error = VirtualHostValidationError{}
615
616var _ interface {
617	Field() string
618	Reason() string
619	Key() bool
620	Cause() error
621	ErrorName() string
622} = VirtualHostValidationError{}
623
624var _VirtualHost_Domains_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
625
626// Validate checks the field values on FilterAction with the rules defined in
627// the proto definition for this message. If any rules are violated, the first
628// error encountered is returned, or nil if there are no violations.
629func (m *FilterAction) Validate() error {
630	return m.validate(false)
631}
632
633// ValidateAll checks the field values on FilterAction with the rules defined
634// in the proto definition for this message. If any rules are violated, the
635// result is a list of violation errors wrapped in FilterActionMultiError, or
636// nil if none found.
637func (m *FilterAction) ValidateAll() error {
638	return m.validate(true)
639}
640
641func (m *FilterAction) validate(all bool) error {
642	if m == nil {
643		return nil
644	}
645
646	var errors []error
647
648	if all {
649		switch v := interface{}(m.GetAction()).(type) {
650		case interface{ ValidateAll() error }:
651			if err := v.ValidateAll(); err != nil {
652				errors = append(errors, FilterActionValidationError{
653					field:  "Action",
654					reason: "embedded message failed validation",
655					cause:  err,
656				})
657			}
658		case interface{ Validate() error }:
659			if err := v.Validate(); err != nil {
660				errors = append(errors, FilterActionValidationError{
661					field:  "Action",
662					reason: "embedded message failed validation",
663					cause:  err,
664				})
665			}
666		}
667	} else if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok {
668		if err := v.Validate(); err != nil {
669			return FilterActionValidationError{
670				field:  "Action",
671				reason: "embedded message failed validation",
672				cause:  err,
673			}
674		}
675	}
676
677	if len(errors) > 0 {
678		return FilterActionMultiError(errors)
679	}
680	return nil
681}
682
683// FilterActionMultiError is an error wrapping multiple validation errors
684// returned by FilterAction.ValidateAll() if the designated constraints aren't met.
685type FilterActionMultiError []error
686
687// Error returns a concatenation of all the error messages it wraps.
688func (m FilterActionMultiError) Error() string {
689	var msgs []string
690	for _, err := range m {
691		msgs = append(msgs, err.Error())
692	}
693	return strings.Join(msgs, "; ")
694}
695
696// AllErrors returns a list of validation violation errors.
697func (m FilterActionMultiError) AllErrors() []error { return m }
698
699// FilterActionValidationError is the validation error returned by
700// FilterAction.Validate if the designated constraints aren't met.
701type FilterActionValidationError struct {
702	field  string
703	reason string
704	cause  error
705	key    bool
706}
707
708// Field function returns field value.
709func (e FilterActionValidationError) Field() string { return e.field }
710
711// Reason function returns reason value.
712func (e FilterActionValidationError) Reason() string { return e.reason }
713
714// Cause function returns cause value.
715func (e FilterActionValidationError) Cause() error { return e.cause }
716
717// Key function returns key value.
718func (e FilterActionValidationError) Key() bool { return e.key }
719
720// ErrorName returns error name.
721func (e FilterActionValidationError) ErrorName() string { return "FilterActionValidationError" }
722
723// Error satisfies the builtin error interface
724func (e FilterActionValidationError) Error() string {
725	cause := ""
726	if e.cause != nil {
727		cause = fmt.Sprintf(" | caused by: %v", e.cause)
728	}
729
730	key := ""
731	if e.key {
732		key = "key for "
733	}
734
735	return fmt.Sprintf(
736		"invalid %sFilterAction.%s: %s%s",
737		key,
738		e.field,
739		e.reason,
740		cause)
741}
742
743var _ error = FilterActionValidationError{}
744
745var _ interface {
746	Field() string
747	Reason() string
748	Key() bool
749	Cause() error
750	ErrorName() string
751} = FilterActionValidationError{}
752
753// Validate checks the field values on Route with the rules defined in the
754// proto definition for this message. If any rules are violated, the first
755// error encountered is returned, or nil if there are no violations.
756func (m *Route) Validate() error {
757	return m.validate(false)
758}
759
760// ValidateAll checks the field values on Route with the rules defined in the
761// proto definition for this message. If any rules are violated, the result is
762// a list of violation errors wrapped in RouteMultiError, or nil if none found.
763func (m *Route) ValidateAll() error {
764	return m.validate(true)
765}
766
767func (m *Route) validate(all bool) error {
768	if m == nil {
769		return nil
770	}
771
772	var errors []error
773
774	// no validation rules for Name
775
776	if m.GetMatch() == nil {
777		err := RouteValidationError{
778			field:  "Match",
779			reason: "value is required",
780		}
781		if !all {
782			return err
783		}
784		errors = append(errors, err)
785	}
786
787	if all {
788		switch v := interface{}(m.GetMatch()).(type) {
789		case interface{ ValidateAll() error }:
790			if err := v.ValidateAll(); err != nil {
791				errors = append(errors, RouteValidationError{
792					field:  "Match",
793					reason: "embedded message failed validation",
794					cause:  err,
795				})
796			}
797		case interface{ Validate() error }:
798			if err := v.Validate(); err != nil {
799				errors = append(errors, RouteValidationError{
800					field:  "Match",
801					reason: "embedded message failed validation",
802					cause:  err,
803				})
804			}
805		}
806	} else if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok {
807		if err := v.Validate(); err != nil {
808			return RouteValidationError{
809				field:  "Match",
810				reason: "embedded message failed validation",
811				cause:  err,
812			}
813		}
814	}
815
816	if all {
817		switch v := interface{}(m.GetMetadata()).(type) {
818		case interface{ ValidateAll() error }:
819			if err := v.ValidateAll(); err != nil {
820				errors = append(errors, RouteValidationError{
821					field:  "Metadata",
822					reason: "embedded message failed validation",
823					cause:  err,
824				})
825			}
826		case interface{ Validate() error }:
827			if err := v.Validate(); err != nil {
828				errors = append(errors, RouteValidationError{
829					field:  "Metadata",
830					reason: "embedded message failed validation",
831					cause:  err,
832				})
833			}
834		}
835	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
836		if err := v.Validate(); err != nil {
837			return RouteValidationError{
838				field:  "Metadata",
839				reason: "embedded message failed validation",
840				cause:  err,
841			}
842		}
843	}
844
845	if all {
846		switch v := interface{}(m.GetDecorator()).(type) {
847		case interface{ ValidateAll() error }:
848			if err := v.ValidateAll(); err != nil {
849				errors = append(errors, RouteValidationError{
850					field:  "Decorator",
851					reason: "embedded message failed validation",
852					cause:  err,
853				})
854			}
855		case interface{ Validate() error }:
856			if err := v.Validate(); err != nil {
857				errors = append(errors, RouteValidationError{
858					field:  "Decorator",
859					reason: "embedded message failed validation",
860					cause:  err,
861				})
862			}
863		}
864	} else if v, ok := interface{}(m.GetDecorator()).(interface{ Validate() error }); ok {
865		if err := v.Validate(); err != nil {
866			return RouteValidationError{
867				field:  "Decorator",
868				reason: "embedded message failed validation",
869				cause:  err,
870			}
871		}
872	}
873
874	{
875		sorted_keys := make([]string, len(m.GetPerFilterConfig()))
876		i := 0
877		for key := range m.GetPerFilterConfig() {
878			sorted_keys[i] = key
879			i++
880		}
881		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
882		for _, key := range sorted_keys {
883			val := m.GetPerFilterConfig()[key]
884			_ = val
885
886			// no validation rules for PerFilterConfig[key]
887
888			if all {
889				switch v := interface{}(val).(type) {
890				case interface{ ValidateAll() error }:
891					if err := v.ValidateAll(); err != nil {
892						errors = append(errors, RouteValidationError{
893							field:  fmt.Sprintf("PerFilterConfig[%v]", key),
894							reason: "embedded message failed validation",
895							cause:  err,
896						})
897					}
898				case interface{ Validate() error }:
899					if err := v.Validate(); err != nil {
900						errors = append(errors, RouteValidationError{
901							field:  fmt.Sprintf("PerFilterConfig[%v]", key),
902							reason: "embedded message failed validation",
903							cause:  err,
904						})
905					}
906				}
907			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
908				if err := v.Validate(); err != nil {
909					return RouteValidationError{
910						field:  fmt.Sprintf("PerFilterConfig[%v]", key),
911						reason: "embedded message failed validation",
912						cause:  err,
913					}
914				}
915			}
916
917		}
918	}
919
920	{
921		sorted_keys := make([]string, len(m.GetTypedPerFilterConfig()))
922		i := 0
923		for key := range m.GetTypedPerFilterConfig() {
924			sorted_keys[i] = key
925			i++
926		}
927		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
928		for _, key := range sorted_keys {
929			val := m.GetTypedPerFilterConfig()[key]
930			_ = val
931
932			// no validation rules for TypedPerFilterConfig[key]
933
934			if all {
935				switch v := interface{}(val).(type) {
936				case interface{ ValidateAll() error }:
937					if err := v.ValidateAll(); err != nil {
938						errors = append(errors, RouteValidationError{
939							field:  fmt.Sprintf("TypedPerFilterConfig[%v]", key),
940							reason: "embedded message failed validation",
941							cause:  err,
942						})
943					}
944				case interface{ Validate() error }:
945					if err := v.Validate(); err != nil {
946						errors = append(errors, RouteValidationError{
947							field:  fmt.Sprintf("TypedPerFilterConfig[%v]", key),
948							reason: "embedded message failed validation",
949							cause:  err,
950						})
951					}
952				}
953			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
954				if err := v.Validate(); err != nil {
955					return RouteValidationError{
956						field:  fmt.Sprintf("TypedPerFilterConfig[%v]", key),
957						reason: "embedded message failed validation",
958						cause:  err,
959					}
960				}
961			}
962
963		}
964	}
965
966	if len(m.GetRequestHeadersToAdd()) > 1000 {
967		err := RouteValidationError{
968			field:  "RequestHeadersToAdd",
969			reason: "value must contain no more than 1000 item(s)",
970		}
971		if !all {
972			return err
973		}
974		errors = append(errors, err)
975	}
976
977	for idx, item := range m.GetRequestHeadersToAdd() {
978		_, _ = idx, item
979
980		if all {
981			switch v := interface{}(item).(type) {
982			case interface{ ValidateAll() error }:
983				if err := v.ValidateAll(); err != nil {
984					errors = append(errors, RouteValidationError{
985						field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
986						reason: "embedded message failed validation",
987						cause:  err,
988					})
989				}
990			case interface{ Validate() error }:
991				if err := v.Validate(); err != nil {
992					errors = append(errors, RouteValidationError{
993						field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
994						reason: "embedded message failed validation",
995						cause:  err,
996					})
997				}
998			}
999		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1000			if err := v.Validate(); err != nil {
1001				return RouteValidationError{
1002					field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
1003					reason: "embedded message failed validation",
1004					cause:  err,
1005				}
1006			}
1007		}
1008
1009	}
1010
1011	if len(m.GetResponseHeadersToAdd()) > 1000 {
1012		err := RouteValidationError{
1013			field:  "ResponseHeadersToAdd",
1014			reason: "value must contain no more than 1000 item(s)",
1015		}
1016		if !all {
1017			return err
1018		}
1019		errors = append(errors, err)
1020	}
1021
1022	for idx, item := range m.GetResponseHeadersToAdd() {
1023		_, _ = idx, item
1024
1025		if all {
1026			switch v := interface{}(item).(type) {
1027			case interface{ ValidateAll() error }:
1028				if err := v.ValidateAll(); err != nil {
1029					errors = append(errors, RouteValidationError{
1030						field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
1031						reason: "embedded message failed validation",
1032						cause:  err,
1033					})
1034				}
1035			case interface{ Validate() error }:
1036				if err := v.Validate(); err != nil {
1037					errors = append(errors, RouteValidationError{
1038						field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
1039						reason: "embedded message failed validation",
1040						cause:  err,
1041					})
1042				}
1043			}
1044		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1045			if err := v.Validate(); err != nil {
1046				return RouteValidationError{
1047					field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
1048					reason: "embedded message failed validation",
1049					cause:  err,
1050				}
1051			}
1052		}
1053
1054	}
1055
1056	if all {
1057		switch v := interface{}(m.GetTracing()).(type) {
1058		case interface{ ValidateAll() error }:
1059			if err := v.ValidateAll(); err != nil {
1060				errors = append(errors, RouteValidationError{
1061					field:  "Tracing",
1062					reason: "embedded message failed validation",
1063					cause:  err,
1064				})
1065			}
1066		case interface{ Validate() error }:
1067			if err := v.Validate(); err != nil {
1068				errors = append(errors, RouteValidationError{
1069					field:  "Tracing",
1070					reason: "embedded message failed validation",
1071					cause:  err,
1072				})
1073			}
1074		}
1075	} else if v, ok := interface{}(m.GetTracing()).(interface{ Validate() error }); ok {
1076		if err := v.Validate(); err != nil {
1077			return RouteValidationError{
1078				field:  "Tracing",
1079				reason: "embedded message failed validation",
1080				cause:  err,
1081			}
1082		}
1083	}
1084
1085	if all {
1086		switch v := interface{}(m.GetPerRequestBufferLimitBytes()).(type) {
1087		case interface{ ValidateAll() error }:
1088			if err := v.ValidateAll(); err != nil {
1089				errors = append(errors, RouteValidationError{
1090					field:  "PerRequestBufferLimitBytes",
1091					reason: "embedded message failed validation",
1092					cause:  err,
1093				})
1094			}
1095		case interface{ Validate() error }:
1096			if err := v.Validate(); err != nil {
1097				errors = append(errors, RouteValidationError{
1098					field:  "PerRequestBufferLimitBytes",
1099					reason: "embedded message failed validation",
1100					cause:  err,
1101				})
1102			}
1103		}
1104	} else if v, ok := interface{}(m.GetPerRequestBufferLimitBytes()).(interface{ Validate() error }); ok {
1105		if err := v.Validate(); err != nil {
1106			return RouteValidationError{
1107				field:  "PerRequestBufferLimitBytes",
1108				reason: "embedded message failed validation",
1109				cause:  err,
1110			}
1111		}
1112	}
1113
1114	switch m.Action.(type) {
1115
1116	case *Route_Route:
1117
1118		if all {
1119			switch v := interface{}(m.GetRoute()).(type) {
1120			case interface{ ValidateAll() error }:
1121				if err := v.ValidateAll(); err != nil {
1122					errors = append(errors, RouteValidationError{
1123						field:  "Route",
1124						reason: "embedded message failed validation",
1125						cause:  err,
1126					})
1127				}
1128			case interface{ Validate() error }:
1129				if err := v.Validate(); err != nil {
1130					errors = append(errors, RouteValidationError{
1131						field:  "Route",
1132						reason: "embedded message failed validation",
1133						cause:  err,
1134					})
1135				}
1136			}
1137		} else if v, ok := interface{}(m.GetRoute()).(interface{ Validate() error }); ok {
1138			if err := v.Validate(); err != nil {
1139				return RouteValidationError{
1140					field:  "Route",
1141					reason: "embedded message failed validation",
1142					cause:  err,
1143				}
1144			}
1145		}
1146
1147	case *Route_Redirect:
1148
1149		if all {
1150			switch v := interface{}(m.GetRedirect()).(type) {
1151			case interface{ ValidateAll() error }:
1152				if err := v.ValidateAll(); err != nil {
1153					errors = append(errors, RouteValidationError{
1154						field:  "Redirect",
1155						reason: "embedded message failed validation",
1156						cause:  err,
1157					})
1158				}
1159			case interface{ Validate() error }:
1160				if err := v.Validate(); err != nil {
1161					errors = append(errors, RouteValidationError{
1162						field:  "Redirect",
1163						reason: "embedded message failed validation",
1164						cause:  err,
1165					})
1166				}
1167			}
1168		} else if v, ok := interface{}(m.GetRedirect()).(interface{ Validate() error }); ok {
1169			if err := v.Validate(); err != nil {
1170				return RouteValidationError{
1171					field:  "Redirect",
1172					reason: "embedded message failed validation",
1173					cause:  err,
1174				}
1175			}
1176		}
1177
1178	case *Route_DirectResponse:
1179
1180		if all {
1181			switch v := interface{}(m.GetDirectResponse()).(type) {
1182			case interface{ ValidateAll() error }:
1183				if err := v.ValidateAll(); err != nil {
1184					errors = append(errors, RouteValidationError{
1185						field:  "DirectResponse",
1186						reason: "embedded message failed validation",
1187						cause:  err,
1188					})
1189				}
1190			case interface{ Validate() error }:
1191				if err := v.Validate(); err != nil {
1192					errors = append(errors, RouteValidationError{
1193						field:  "DirectResponse",
1194						reason: "embedded message failed validation",
1195						cause:  err,
1196					})
1197				}
1198			}
1199		} else if v, ok := interface{}(m.GetDirectResponse()).(interface{ Validate() error }); ok {
1200			if err := v.Validate(); err != nil {
1201				return RouteValidationError{
1202					field:  "DirectResponse",
1203					reason: "embedded message failed validation",
1204					cause:  err,
1205				}
1206			}
1207		}
1208
1209	case *Route_FilterAction:
1210
1211		if all {
1212			switch v := interface{}(m.GetFilterAction()).(type) {
1213			case interface{ ValidateAll() error }:
1214				if err := v.ValidateAll(); err != nil {
1215					errors = append(errors, RouteValidationError{
1216						field:  "FilterAction",
1217						reason: "embedded message failed validation",
1218						cause:  err,
1219					})
1220				}
1221			case interface{ Validate() error }:
1222				if err := v.Validate(); err != nil {
1223					errors = append(errors, RouteValidationError{
1224						field:  "FilterAction",
1225						reason: "embedded message failed validation",
1226						cause:  err,
1227					})
1228				}
1229			}
1230		} else if v, ok := interface{}(m.GetFilterAction()).(interface{ Validate() error }); ok {
1231			if err := v.Validate(); err != nil {
1232				return RouteValidationError{
1233					field:  "FilterAction",
1234					reason: "embedded message failed validation",
1235					cause:  err,
1236				}
1237			}
1238		}
1239
1240	default:
1241		err := RouteValidationError{
1242			field:  "Action",
1243			reason: "value is required",
1244		}
1245		if !all {
1246			return err
1247		}
1248		errors = append(errors, err)
1249
1250	}
1251
1252	if len(errors) > 0 {
1253		return RouteMultiError(errors)
1254	}
1255	return nil
1256}
1257
1258// RouteMultiError is an error wrapping multiple validation errors returned by
1259// Route.ValidateAll() if the designated constraints aren't met.
1260type RouteMultiError []error
1261
1262// Error returns a concatenation of all the error messages it wraps.
1263func (m RouteMultiError) Error() string {
1264	var msgs []string
1265	for _, err := range m {
1266		msgs = append(msgs, err.Error())
1267	}
1268	return strings.Join(msgs, "; ")
1269}
1270
1271// AllErrors returns a list of validation violation errors.
1272func (m RouteMultiError) AllErrors() []error { return m }
1273
1274// RouteValidationError is the validation error returned by Route.Validate if
1275// the designated constraints aren't met.
1276type RouteValidationError struct {
1277	field  string
1278	reason string
1279	cause  error
1280	key    bool
1281}
1282
1283// Field function returns field value.
1284func (e RouteValidationError) Field() string { return e.field }
1285
1286// Reason function returns reason value.
1287func (e RouteValidationError) Reason() string { return e.reason }
1288
1289// Cause function returns cause value.
1290func (e RouteValidationError) Cause() error { return e.cause }
1291
1292// Key function returns key value.
1293func (e RouteValidationError) Key() bool { return e.key }
1294
1295// ErrorName returns error name.
1296func (e RouteValidationError) ErrorName() string { return "RouteValidationError" }
1297
1298// Error satisfies the builtin error interface
1299func (e RouteValidationError) Error() string {
1300	cause := ""
1301	if e.cause != nil {
1302		cause = fmt.Sprintf(" | caused by: %v", e.cause)
1303	}
1304
1305	key := ""
1306	if e.key {
1307		key = "key for "
1308	}
1309
1310	return fmt.Sprintf(
1311		"invalid %sRoute.%s: %s%s",
1312		key,
1313		e.field,
1314		e.reason,
1315		cause)
1316}
1317
1318var _ error = RouteValidationError{}
1319
1320var _ interface {
1321	Field() string
1322	Reason() string
1323	Key() bool
1324	Cause() error
1325	ErrorName() string
1326} = RouteValidationError{}
1327
1328// Validate checks the field values on WeightedCluster with the rules defined
1329// in the proto definition for this message. If any rules are violated, the
1330// first error encountered is returned, or nil if there are no violations.
1331func (m *WeightedCluster) Validate() error {
1332	return m.validate(false)
1333}
1334
1335// ValidateAll checks the field values on WeightedCluster with the rules
1336// defined in the proto definition for this message. If any rules are
1337// violated, the result is a list of violation errors wrapped in
1338// WeightedClusterMultiError, or nil if none found.
1339func (m *WeightedCluster) ValidateAll() error {
1340	return m.validate(true)
1341}
1342
1343func (m *WeightedCluster) validate(all bool) error {
1344	if m == nil {
1345		return nil
1346	}
1347
1348	var errors []error
1349
1350	if len(m.GetClusters()) < 1 {
1351		err := WeightedClusterValidationError{
1352			field:  "Clusters",
1353			reason: "value must contain at least 1 item(s)",
1354		}
1355		if !all {
1356			return err
1357		}
1358		errors = append(errors, err)
1359	}
1360
1361	for idx, item := range m.GetClusters() {
1362		_, _ = idx, item
1363
1364		if all {
1365			switch v := interface{}(item).(type) {
1366			case interface{ ValidateAll() error }:
1367				if err := v.ValidateAll(); err != nil {
1368					errors = append(errors, WeightedClusterValidationError{
1369						field:  fmt.Sprintf("Clusters[%v]", idx),
1370						reason: "embedded message failed validation",
1371						cause:  err,
1372					})
1373				}
1374			case interface{ Validate() error }:
1375				if err := v.Validate(); err != nil {
1376					errors = append(errors, WeightedClusterValidationError{
1377						field:  fmt.Sprintf("Clusters[%v]", idx),
1378						reason: "embedded message failed validation",
1379						cause:  err,
1380					})
1381				}
1382			}
1383		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1384			if err := v.Validate(); err != nil {
1385				return WeightedClusterValidationError{
1386					field:  fmt.Sprintf("Clusters[%v]", idx),
1387					reason: "embedded message failed validation",
1388					cause:  err,
1389				}
1390			}
1391		}
1392
1393	}
1394
1395	if wrapper := m.GetTotalWeight(); wrapper != nil {
1396
1397		if wrapper.GetValue() < 1 {
1398			err := WeightedClusterValidationError{
1399				field:  "TotalWeight",
1400				reason: "value must be greater than or equal to 1",
1401			}
1402			if !all {
1403				return err
1404			}
1405			errors = append(errors, err)
1406		}
1407
1408	}
1409
1410	// no validation rules for RuntimeKeyPrefix
1411
1412	if len(errors) > 0 {
1413		return WeightedClusterMultiError(errors)
1414	}
1415	return nil
1416}
1417
1418// WeightedClusterMultiError is an error wrapping multiple validation errors
1419// returned by WeightedCluster.ValidateAll() if the designated constraints
1420// aren't met.
1421type WeightedClusterMultiError []error
1422
1423// Error returns a concatenation of all the error messages it wraps.
1424func (m WeightedClusterMultiError) Error() string {
1425	var msgs []string
1426	for _, err := range m {
1427		msgs = append(msgs, err.Error())
1428	}
1429	return strings.Join(msgs, "; ")
1430}
1431
1432// AllErrors returns a list of validation violation errors.
1433func (m WeightedClusterMultiError) AllErrors() []error { return m }
1434
1435// WeightedClusterValidationError is the validation error returned by
1436// WeightedCluster.Validate if the designated constraints aren't met.
1437type WeightedClusterValidationError struct {
1438	field  string
1439	reason string
1440	cause  error
1441	key    bool
1442}
1443
1444// Field function returns field value.
1445func (e WeightedClusterValidationError) Field() string { return e.field }
1446
1447// Reason function returns reason value.
1448func (e WeightedClusterValidationError) Reason() string { return e.reason }
1449
1450// Cause function returns cause value.
1451func (e WeightedClusterValidationError) Cause() error { return e.cause }
1452
1453// Key function returns key value.
1454func (e WeightedClusterValidationError) Key() bool { return e.key }
1455
1456// ErrorName returns error name.
1457func (e WeightedClusterValidationError) ErrorName() string { return "WeightedClusterValidationError" }
1458
1459// Error satisfies the builtin error interface
1460func (e WeightedClusterValidationError) Error() string {
1461	cause := ""
1462	if e.cause != nil {
1463		cause = fmt.Sprintf(" | caused by: %v", e.cause)
1464	}
1465
1466	key := ""
1467	if e.key {
1468		key = "key for "
1469	}
1470
1471	return fmt.Sprintf(
1472		"invalid %sWeightedCluster.%s: %s%s",
1473		key,
1474		e.field,
1475		e.reason,
1476		cause)
1477}
1478
1479var _ error = WeightedClusterValidationError{}
1480
1481var _ interface {
1482	Field() string
1483	Reason() string
1484	Key() bool
1485	Cause() error
1486	ErrorName() string
1487} = WeightedClusterValidationError{}
1488
1489// Validate checks the field values on RouteMatch with the rules defined in the
1490// proto definition for this message. If any rules are violated, the first
1491// error encountered is returned, or nil if there are no violations.
1492func (m *RouteMatch) Validate() error {
1493	return m.validate(false)
1494}
1495
1496// ValidateAll checks the field values on RouteMatch with the rules defined in
1497// the proto definition for this message. If any rules are violated, the
1498// result is a list of violation errors wrapped in RouteMatchMultiError, or
1499// nil if none found.
1500func (m *RouteMatch) ValidateAll() error {
1501	return m.validate(true)
1502}
1503
1504func (m *RouteMatch) validate(all bool) error {
1505	if m == nil {
1506		return nil
1507	}
1508
1509	var errors []error
1510
1511	if all {
1512		switch v := interface{}(m.GetCaseSensitive()).(type) {
1513		case interface{ ValidateAll() error }:
1514			if err := v.ValidateAll(); err != nil {
1515				errors = append(errors, RouteMatchValidationError{
1516					field:  "CaseSensitive",
1517					reason: "embedded message failed validation",
1518					cause:  err,
1519				})
1520			}
1521		case interface{ Validate() error }:
1522			if err := v.Validate(); err != nil {
1523				errors = append(errors, RouteMatchValidationError{
1524					field:  "CaseSensitive",
1525					reason: "embedded message failed validation",
1526					cause:  err,
1527				})
1528			}
1529		}
1530	} else if v, ok := interface{}(m.GetCaseSensitive()).(interface{ Validate() error }); ok {
1531		if err := v.Validate(); err != nil {
1532			return RouteMatchValidationError{
1533				field:  "CaseSensitive",
1534				reason: "embedded message failed validation",
1535				cause:  err,
1536			}
1537		}
1538	}
1539
1540	if all {
1541		switch v := interface{}(m.GetRuntimeFraction()).(type) {
1542		case interface{ ValidateAll() error }:
1543			if err := v.ValidateAll(); err != nil {
1544				errors = append(errors, RouteMatchValidationError{
1545					field:  "RuntimeFraction",
1546					reason: "embedded message failed validation",
1547					cause:  err,
1548				})
1549			}
1550		case interface{ Validate() error }:
1551			if err := v.Validate(); err != nil {
1552				errors = append(errors, RouteMatchValidationError{
1553					field:  "RuntimeFraction",
1554					reason: "embedded message failed validation",
1555					cause:  err,
1556				})
1557			}
1558		}
1559	} else if v, ok := interface{}(m.GetRuntimeFraction()).(interface{ Validate() error }); ok {
1560		if err := v.Validate(); err != nil {
1561			return RouteMatchValidationError{
1562				field:  "RuntimeFraction",
1563				reason: "embedded message failed validation",
1564				cause:  err,
1565			}
1566		}
1567	}
1568
1569	for idx, item := range m.GetHeaders() {
1570		_, _ = idx, item
1571
1572		if all {
1573			switch v := interface{}(item).(type) {
1574			case interface{ ValidateAll() error }:
1575				if err := v.ValidateAll(); err != nil {
1576					errors = append(errors, RouteMatchValidationError{
1577						field:  fmt.Sprintf("Headers[%v]", idx),
1578						reason: "embedded message failed validation",
1579						cause:  err,
1580					})
1581				}
1582			case interface{ Validate() error }:
1583				if err := v.Validate(); err != nil {
1584					errors = append(errors, RouteMatchValidationError{
1585						field:  fmt.Sprintf("Headers[%v]", idx),
1586						reason: "embedded message failed validation",
1587						cause:  err,
1588					})
1589				}
1590			}
1591		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1592			if err := v.Validate(); err != nil {
1593				return RouteMatchValidationError{
1594					field:  fmt.Sprintf("Headers[%v]", idx),
1595					reason: "embedded message failed validation",
1596					cause:  err,
1597				}
1598			}
1599		}
1600
1601	}
1602
1603	for idx, item := range m.GetQueryParameters() {
1604		_, _ = idx, item
1605
1606		if all {
1607			switch v := interface{}(item).(type) {
1608			case interface{ ValidateAll() error }:
1609				if err := v.ValidateAll(); err != nil {
1610					errors = append(errors, RouteMatchValidationError{
1611						field:  fmt.Sprintf("QueryParameters[%v]", idx),
1612						reason: "embedded message failed validation",
1613						cause:  err,
1614					})
1615				}
1616			case interface{ Validate() error }:
1617				if err := v.Validate(); err != nil {
1618					errors = append(errors, RouteMatchValidationError{
1619						field:  fmt.Sprintf("QueryParameters[%v]", idx),
1620						reason: "embedded message failed validation",
1621						cause:  err,
1622					})
1623				}
1624			}
1625		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1626			if err := v.Validate(); err != nil {
1627				return RouteMatchValidationError{
1628					field:  fmt.Sprintf("QueryParameters[%v]", idx),
1629					reason: "embedded message failed validation",
1630					cause:  err,
1631				}
1632			}
1633		}
1634
1635	}
1636
1637	if all {
1638		switch v := interface{}(m.GetGrpc()).(type) {
1639		case interface{ ValidateAll() error }:
1640			if err := v.ValidateAll(); err != nil {
1641				errors = append(errors, RouteMatchValidationError{
1642					field:  "Grpc",
1643					reason: "embedded message failed validation",
1644					cause:  err,
1645				})
1646			}
1647		case interface{ Validate() error }:
1648			if err := v.Validate(); err != nil {
1649				errors = append(errors, RouteMatchValidationError{
1650					field:  "Grpc",
1651					reason: "embedded message failed validation",
1652					cause:  err,
1653				})
1654			}
1655		}
1656	} else if v, ok := interface{}(m.GetGrpc()).(interface{ Validate() error }); ok {
1657		if err := v.Validate(); err != nil {
1658			return RouteMatchValidationError{
1659				field:  "Grpc",
1660				reason: "embedded message failed validation",
1661				cause:  err,
1662			}
1663		}
1664	}
1665
1666	if all {
1667		switch v := interface{}(m.GetTlsContext()).(type) {
1668		case interface{ ValidateAll() error }:
1669			if err := v.ValidateAll(); err != nil {
1670				errors = append(errors, RouteMatchValidationError{
1671					field:  "TlsContext",
1672					reason: "embedded message failed validation",
1673					cause:  err,
1674				})
1675			}
1676		case interface{ Validate() error }:
1677			if err := v.Validate(); err != nil {
1678				errors = append(errors, RouteMatchValidationError{
1679					field:  "TlsContext",
1680					reason: "embedded message failed validation",
1681					cause:  err,
1682				})
1683			}
1684		}
1685	} else if v, ok := interface{}(m.GetTlsContext()).(interface{ Validate() error }); ok {
1686		if err := v.Validate(); err != nil {
1687			return RouteMatchValidationError{
1688				field:  "TlsContext",
1689				reason: "embedded message failed validation",
1690				cause:  err,
1691			}
1692		}
1693	}
1694
1695	switch m.PathSpecifier.(type) {
1696
1697	case *RouteMatch_Prefix:
1698		// no validation rules for Prefix
1699
1700	case *RouteMatch_Path:
1701		// no validation rules for Path
1702
1703	case *RouteMatch_Regex:
1704
1705		if len(m.GetRegex()) > 1024 {
1706			err := RouteMatchValidationError{
1707				field:  "Regex",
1708				reason: "value length must be at most 1024 bytes",
1709			}
1710			if !all {
1711				return err
1712			}
1713			errors = append(errors, err)
1714		}
1715
1716	case *RouteMatch_SafeRegex:
1717
1718		if m.GetSafeRegex() == nil {
1719			err := RouteMatchValidationError{
1720				field:  "SafeRegex",
1721				reason: "value is required",
1722			}
1723			if !all {
1724				return err
1725			}
1726			errors = append(errors, err)
1727		}
1728
1729		if all {
1730			switch v := interface{}(m.GetSafeRegex()).(type) {
1731			case interface{ ValidateAll() error }:
1732				if err := v.ValidateAll(); err != nil {
1733					errors = append(errors, RouteMatchValidationError{
1734						field:  "SafeRegex",
1735						reason: "embedded message failed validation",
1736						cause:  err,
1737					})
1738				}
1739			case interface{ Validate() error }:
1740				if err := v.Validate(); err != nil {
1741					errors = append(errors, RouteMatchValidationError{
1742						field:  "SafeRegex",
1743						reason: "embedded message failed validation",
1744						cause:  err,
1745					})
1746				}
1747			}
1748		} else if v, ok := interface{}(m.GetSafeRegex()).(interface{ Validate() error }); ok {
1749			if err := v.Validate(); err != nil {
1750				return RouteMatchValidationError{
1751					field:  "SafeRegex",
1752					reason: "embedded message failed validation",
1753					cause:  err,
1754				}
1755			}
1756		}
1757
1758	default:
1759		err := RouteMatchValidationError{
1760			field:  "PathSpecifier",
1761			reason: "value is required",
1762		}
1763		if !all {
1764			return err
1765		}
1766		errors = append(errors, err)
1767
1768	}
1769
1770	if len(errors) > 0 {
1771		return RouteMatchMultiError(errors)
1772	}
1773	return nil
1774}
1775
1776// RouteMatchMultiError is an error wrapping multiple validation errors
1777// returned by RouteMatch.ValidateAll() if the designated constraints aren't met.
1778type RouteMatchMultiError []error
1779
1780// Error returns a concatenation of all the error messages it wraps.
1781func (m RouteMatchMultiError) Error() string {
1782	var msgs []string
1783	for _, err := range m {
1784		msgs = append(msgs, err.Error())
1785	}
1786	return strings.Join(msgs, "; ")
1787}
1788
1789// AllErrors returns a list of validation violation errors.
1790func (m RouteMatchMultiError) AllErrors() []error { return m }
1791
1792// RouteMatchValidationError is the validation error returned by
1793// RouteMatch.Validate if the designated constraints aren't met.
1794type RouteMatchValidationError struct {
1795	field  string
1796	reason string
1797	cause  error
1798	key    bool
1799}
1800
1801// Field function returns field value.
1802func (e RouteMatchValidationError) Field() string { return e.field }
1803
1804// Reason function returns reason value.
1805func (e RouteMatchValidationError) Reason() string { return e.reason }
1806
1807// Cause function returns cause value.
1808func (e RouteMatchValidationError) Cause() error { return e.cause }
1809
1810// Key function returns key value.
1811func (e RouteMatchValidationError) Key() bool { return e.key }
1812
1813// ErrorName returns error name.
1814func (e RouteMatchValidationError) ErrorName() string { return "RouteMatchValidationError" }
1815
1816// Error satisfies the builtin error interface
1817func (e RouteMatchValidationError) Error() string {
1818	cause := ""
1819	if e.cause != nil {
1820		cause = fmt.Sprintf(" | caused by: %v", e.cause)
1821	}
1822
1823	key := ""
1824	if e.key {
1825		key = "key for "
1826	}
1827
1828	return fmt.Sprintf(
1829		"invalid %sRouteMatch.%s: %s%s",
1830		key,
1831		e.field,
1832		e.reason,
1833		cause)
1834}
1835
1836var _ error = RouteMatchValidationError{}
1837
1838var _ interface {
1839	Field() string
1840	Reason() string
1841	Key() bool
1842	Cause() error
1843	ErrorName() string
1844} = RouteMatchValidationError{}
1845
1846// Validate checks the field values on CorsPolicy with the rules defined in the
1847// proto definition for this message. If any rules are violated, the first
1848// error encountered is returned, or nil if there are no violations.
1849func (m *CorsPolicy) Validate() error {
1850	return m.validate(false)
1851}
1852
1853// ValidateAll checks the field values on CorsPolicy with the rules defined in
1854// the proto definition for this message. If any rules are violated, the
1855// result is a list of violation errors wrapped in CorsPolicyMultiError, or
1856// nil if none found.
1857func (m *CorsPolicy) ValidateAll() error {
1858	return m.validate(true)
1859}
1860
1861func (m *CorsPolicy) validate(all bool) error {
1862	if m == nil {
1863		return nil
1864	}
1865
1866	var errors []error
1867
1868	for idx, item := range m.GetAllowOriginRegex() {
1869		_, _ = idx, item
1870
1871		if len(item) > 1024 {
1872			err := CorsPolicyValidationError{
1873				field:  fmt.Sprintf("AllowOriginRegex[%v]", idx),
1874				reason: "value length must be at most 1024 bytes",
1875			}
1876			if !all {
1877				return err
1878			}
1879			errors = append(errors, err)
1880		}
1881
1882	}
1883
1884	for idx, item := range m.GetAllowOriginStringMatch() {
1885		_, _ = idx, item
1886
1887		if all {
1888			switch v := interface{}(item).(type) {
1889			case interface{ ValidateAll() error }:
1890				if err := v.ValidateAll(); err != nil {
1891					errors = append(errors, CorsPolicyValidationError{
1892						field:  fmt.Sprintf("AllowOriginStringMatch[%v]", idx),
1893						reason: "embedded message failed validation",
1894						cause:  err,
1895					})
1896				}
1897			case interface{ Validate() error }:
1898				if err := v.Validate(); err != nil {
1899					errors = append(errors, CorsPolicyValidationError{
1900						field:  fmt.Sprintf("AllowOriginStringMatch[%v]", idx),
1901						reason: "embedded message failed validation",
1902						cause:  err,
1903					})
1904				}
1905			}
1906		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
1907			if err := v.Validate(); err != nil {
1908				return CorsPolicyValidationError{
1909					field:  fmt.Sprintf("AllowOriginStringMatch[%v]", idx),
1910					reason: "embedded message failed validation",
1911					cause:  err,
1912				}
1913			}
1914		}
1915
1916	}
1917
1918	// no validation rules for AllowMethods
1919
1920	// no validation rules for AllowHeaders
1921
1922	// no validation rules for ExposeHeaders
1923
1924	// no validation rules for MaxAge
1925
1926	if all {
1927		switch v := interface{}(m.GetAllowCredentials()).(type) {
1928		case interface{ ValidateAll() error }:
1929			if err := v.ValidateAll(); err != nil {
1930				errors = append(errors, CorsPolicyValidationError{
1931					field:  "AllowCredentials",
1932					reason: "embedded message failed validation",
1933					cause:  err,
1934				})
1935			}
1936		case interface{ Validate() error }:
1937			if err := v.Validate(); err != nil {
1938				errors = append(errors, CorsPolicyValidationError{
1939					field:  "AllowCredentials",
1940					reason: "embedded message failed validation",
1941					cause:  err,
1942				})
1943			}
1944		}
1945	} else if v, ok := interface{}(m.GetAllowCredentials()).(interface{ Validate() error }); ok {
1946		if err := v.Validate(); err != nil {
1947			return CorsPolicyValidationError{
1948				field:  "AllowCredentials",
1949				reason: "embedded message failed validation",
1950				cause:  err,
1951			}
1952		}
1953	}
1954
1955	if all {
1956		switch v := interface{}(m.GetShadowEnabled()).(type) {
1957		case interface{ ValidateAll() error }:
1958			if err := v.ValidateAll(); err != nil {
1959				errors = append(errors, CorsPolicyValidationError{
1960					field:  "ShadowEnabled",
1961					reason: "embedded message failed validation",
1962					cause:  err,
1963				})
1964			}
1965		case interface{ Validate() error }:
1966			if err := v.Validate(); err != nil {
1967				errors = append(errors, CorsPolicyValidationError{
1968					field:  "ShadowEnabled",
1969					reason: "embedded message failed validation",
1970					cause:  err,
1971				})
1972			}
1973		}
1974	} else if v, ok := interface{}(m.GetShadowEnabled()).(interface{ Validate() error }); ok {
1975		if err := v.Validate(); err != nil {
1976			return CorsPolicyValidationError{
1977				field:  "ShadowEnabled",
1978				reason: "embedded message failed validation",
1979				cause:  err,
1980			}
1981		}
1982	}
1983
1984	switch m.EnabledSpecifier.(type) {
1985
1986	case *CorsPolicy_Enabled:
1987
1988		if all {
1989			switch v := interface{}(m.GetEnabled()).(type) {
1990			case interface{ ValidateAll() error }:
1991				if err := v.ValidateAll(); err != nil {
1992					errors = append(errors, CorsPolicyValidationError{
1993						field:  "Enabled",
1994						reason: "embedded message failed validation",
1995						cause:  err,
1996					})
1997				}
1998			case interface{ Validate() error }:
1999				if err := v.Validate(); err != nil {
2000					errors = append(errors, CorsPolicyValidationError{
2001						field:  "Enabled",
2002						reason: "embedded message failed validation",
2003						cause:  err,
2004					})
2005				}
2006			}
2007		} else if v, ok := interface{}(m.GetEnabled()).(interface{ Validate() error }); ok {
2008			if err := v.Validate(); err != nil {
2009				return CorsPolicyValidationError{
2010					field:  "Enabled",
2011					reason: "embedded message failed validation",
2012					cause:  err,
2013				}
2014			}
2015		}
2016
2017	case *CorsPolicy_FilterEnabled:
2018
2019		if all {
2020			switch v := interface{}(m.GetFilterEnabled()).(type) {
2021			case interface{ ValidateAll() error }:
2022				if err := v.ValidateAll(); err != nil {
2023					errors = append(errors, CorsPolicyValidationError{
2024						field:  "FilterEnabled",
2025						reason: "embedded message failed validation",
2026						cause:  err,
2027					})
2028				}
2029			case interface{ Validate() error }:
2030				if err := v.Validate(); err != nil {
2031					errors = append(errors, CorsPolicyValidationError{
2032						field:  "FilterEnabled",
2033						reason: "embedded message failed validation",
2034						cause:  err,
2035					})
2036				}
2037			}
2038		} else if v, ok := interface{}(m.GetFilterEnabled()).(interface{ Validate() error }); ok {
2039			if err := v.Validate(); err != nil {
2040				return CorsPolicyValidationError{
2041					field:  "FilterEnabled",
2042					reason: "embedded message failed validation",
2043					cause:  err,
2044				}
2045			}
2046		}
2047
2048	}
2049
2050	if len(errors) > 0 {
2051		return CorsPolicyMultiError(errors)
2052	}
2053	return nil
2054}
2055
2056// CorsPolicyMultiError is an error wrapping multiple validation errors
2057// returned by CorsPolicy.ValidateAll() if the designated constraints aren't met.
2058type CorsPolicyMultiError []error
2059
2060// Error returns a concatenation of all the error messages it wraps.
2061func (m CorsPolicyMultiError) Error() string {
2062	var msgs []string
2063	for _, err := range m {
2064		msgs = append(msgs, err.Error())
2065	}
2066	return strings.Join(msgs, "; ")
2067}
2068
2069// AllErrors returns a list of validation violation errors.
2070func (m CorsPolicyMultiError) AllErrors() []error { return m }
2071
2072// CorsPolicyValidationError is the validation error returned by
2073// CorsPolicy.Validate if the designated constraints aren't met.
2074type CorsPolicyValidationError struct {
2075	field  string
2076	reason string
2077	cause  error
2078	key    bool
2079}
2080
2081// Field function returns field value.
2082func (e CorsPolicyValidationError) Field() string { return e.field }
2083
2084// Reason function returns reason value.
2085func (e CorsPolicyValidationError) Reason() string { return e.reason }
2086
2087// Cause function returns cause value.
2088func (e CorsPolicyValidationError) Cause() error { return e.cause }
2089
2090// Key function returns key value.
2091func (e CorsPolicyValidationError) Key() bool { return e.key }
2092
2093// ErrorName returns error name.
2094func (e CorsPolicyValidationError) ErrorName() string { return "CorsPolicyValidationError" }
2095
2096// Error satisfies the builtin error interface
2097func (e CorsPolicyValidationError) Error() string {
2098	cause := ""
2099	if e.cause != nil {
2100		cause = fmt.Sprintf(" | caused by: %v", e.cause)
2101	}
2102
2103	key := ""
2104	if e.key {
2105		key = "key for "
2106	}
2107
2108	return fmt.Sprintf(
2109		"invalid %sCorsPolicy.%s: %s%s",
2110		key,
2111		e.field,
2112		e.reason,
2113		cause)
2114}
2115
2116var _ error = CorsPolicyValidationError{}
2117
2118var _ interface {
2119	Field() string
2120	Reason() string
2121	Key() bool
2122	Cause() error
2123	ErrorName() string
2124} = CorsPolicyValidationError{}
2125
2126// Validate checks the field values on RouteAction with the rules defined in
2127// the proto definition for this message. If any rules are violated, the first
2128// error encountered is returned, or nil if there are no violations.
2129func (m *RouteAction) Validate() error {
2130	return m.validate(false)
2131}
2132
2133// ValidateAll checks the field values on RouteAction with the rules defined in
2134// the proto definition for this message. If any rules are violated, the
2135// result is a list of violation errors wrapped in RouteActionMultiError, or
2136// nil if none found.
2137func (m *RouteAction) ValidateAll() error {
2138	return m.validate(true)
2139}
2140
2141func (m *RouteAction) validate(all bool) error {
2142	if m == nil {
2143		return nil
2144	}
2145
2146	var errors []error
2147
2148	if _, ok := RouteAction_ClusterNotFoundResponseCode_name[int32(m.GetClusterNotFoundResponseCode())]; !ok {
2149		err := RouteActionValidationError{
2150			field:  "ClusterNotFoundResponseCode",
2151			reason: "value must be one of the defined enum values",
2152		}
2153		if !all {
2154			return err
2155		}
2156		errors = append(errors, err)
2157	}
2158
2159	if all {
2160		switch v := interface{}(m.GetMetadataMatch()).(type) {
2161		case interface{ ValidateAll() error }:
2162			if err := v.ValidateAll(); err != nil {
2163				errors = append(errors, RouteActionValidationError{
2164					field:  "MetadataMatch",
2165					reason: "embedded message failed validation",
2166					cause:  err,
2167				})
2168			}
2169		case interface{ Validate() error }:
2170			if err := v.Validate(); err != nil {
2171				errors = append(errors, RouteActionValidationError{
2172					field:  "MetadataMatch",
2173					reason: "embedded message failed validation",
2174					cause:  err,
2175				})
2176			}
2177		}
2178	} else if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok {
2179		if err := v.Validate(); err != nil {
2180			return RouteActionValidationError{
2181				field:  "MetadataMatch",
2182				reason: "embedded message failed validation",
2183				cause:  err,
2184			}
2185		}
2186	}
2187
2188	if !_RouteAction_PrefixRewrite_Pattern.MatchString(m.GetPrefixRewrite()) {
2189		err := RouteActionValidationError{
2190			field:  "PrefixRewrite",
2191			reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
2192		}
2193		if !all {
2194			return err
2195		}
2196		errors = append(errors, err)
2197	}
2198
2199	if all {
2200		switch v := interface{}(m.GetRegexRewrite()).(type) {
2201		case interface{ ValidateAll() error }:
2202			if err := v.ValidateAll(); err != nil {
2203				errors = append(errors, RouteActionValidationError{
2204					field:  "RegexRewrite",
2205					reason: "embedded message failed validation",
2206					cause:  err,
2207				})
2208			}
2209		case interface{ Validate() error }:
2210			if err := v.Validate(); err != nil {
2211				errors = append(errors, RouteActionValidationError{
2212					field:  "RegexRewrite",
2213					reason: "embedded message failed validation",
2214					cause:  err,
2215				})
2216			}
2217		}
2218	} else if v, ok := interface{}(m.GetRegexRewrite()).(interface{ Validate() error }); ok {
2219		if err := v.Validate(); err != nil {
2220			return RouteActionValidationError{
2221				field:  "RegexRewrite",
2222				reason: "embedded message failed validation",
2223				cause:  err,
2224			}
2225		}
2226	}
2227
2228	if all {
2229		switch v := interface{}(m.GetTimeout()).(type) {
2230		case interface{ ValidateAll() error }:
2231			if err := v.ValidateAll(); err != nil {
2232				errors = append(errors, RouteActionValidationError{
2233					field:  "Timeout",
2234					reason: "embedded message failed validation",
2235					cause:  err,
2236				})
2237			}
2238		case interface{ Validate() error }:
2239			if err := v.Validate(); err != nil {
2240				errors = append(errors, RouteActionValidationError{
2241					field:  "Timeout",
2242					reason: "embedded message failed validation",
2243					cause:  err,
2244				})
2245			}
2246		}
2247	} else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok {
2248		if err := v.Validate(); err != nil {
2249			return RouteActionValidationError{
2250				field:  "Timeout",
2251				reason: "embedded message failed validation",
2252				cause:  err,
2253			}
2254		}
2255	}
2256
2257	if all {
2258		switch v := interface{}(m.GetIdleTimeout()).(type) {
2259		case interface{ ValidateAll() error }:
2260			if err := v.ValidateAll(); err != nil {
2261				errors = append(errors, RouteActionValidationError{
2262					field:  "IdleTimeout",
2263					reason: "embedded message failed validation",
2264					cause:  err,
2265				})
2266			}
2267		case interface{ Validate() error }:
2268			if err := v.Validate(); err != nil {
2269				errors = append(errors, RouteActionValidationError{
2270					field:  "IdleTimeout",
2271					reason: "embedded message failed validation",
2272					cause:  err,
2273				})
2274			}
2275		}
2276	} else if v, ok := interface{}(m.GetIdleTimeout()).(interface{ Validate() error }); ok {
2277		if err := v.Validate(); err != nil {
2278			return RouteActionValidationError{
2279				field:  "IdleTimeout",
2280				reason: "embedded message failed validation",
2281				cause:  err,
2282			}
2283		}
2284	}
2285
2286	if all {
2287		switch v := interface{}(m.GetRetryPolicy()).(type) {
2288		case interface{ ValidateAll() error }:
2289			if err := v.ValidateAll(); err != nil {
2290				errors = append(errors, RouteActionValidationError{
2291					field:  "RetryPolicy",
2292					reason: "embedded message failed validation",
2293					cause:  err,
2294				})
2295			}
2296		case interface{ Validate() error }:
2297			if err := v.Validate(); err != nil {
2298				errors = append(errors, RouteActionValidationError{
2299					field:  "RetryPolicy",
2300					reason: "embedded message failed validation",
2301					cause:  err,
2302				})
2303			}
2304		}
2305	} else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok {
2306		if err := v.Validate(); err != nil {
2307			return RouteActionValidationError{
2308				field:  "RetryPolicy",
2309				reason: "embedded message failed validation",
2310				cause:  err,
2311			}
2312		}
2313	}
2314
2315	if all {
2316		switch v := interface{}(m.GetRetryPolicyTypedConfig()).(type) {
2317		case interface{ ValidateAll() error }:
2318			if err := v.ValidateAll(); err != nil {
2319				errors = append(errors, RouteActionValidationError{
2320					field:  "RetryPolicyTypedConfig",
2321					reason: "embedded message failed validation",
2322					cause:  err,
2323				})
2324			}
2325		case interface{ Validate() error }:
2326			if err := v.Validate(); err != nil {
2327				errors = append(errors, RouteActionValidationError{
2328					field:  "RetryPolicyTypedConfig",
2329					reason: "embedded message failed validation",
2330					cause:  err,
2331				})
2332			}
2333		}
2334	} else if v, ok := interface{}(m.GetRetryPolicyTypedConfig()).(interface{ Validate() error }); ok {
2335		if err := v.Validate(); err != nil {
2336			return RouteActionValidationError{
2337				field:  "RetryPolicyTypedConfig",
2338				reason: "embedded message failed validation",
2339				cause:  err,
2340			}
2341		}
2342	}
2343
2344	if all {
2345		switch v := interface{}(m.GetRequestMirrorPolicy()).(type) {
2346		case interface{ ValidateAll() error }:
2347			if err := v.ValidateAll(); err != nil {
2348				errors = append(errors, RouteActionValidationError{
2349					field:  "RequestMirrorPolicy",
2350					reason: "embedded message failed validation",
2351					cause:  err,
2352				})
2353			}
2354		case interface{ Validate() error }:
2355			if err := v.Validate(); err != nil {
2356				errors = append(errors, RouteActionValidationError{
2357					field:  "RequestMirrorPolicy",
2358					reason: "embedded message failed validation",
2359					cause:  err,
2360				})
2361			}
2362		}
2363	} else if v, ok := interface{}(m.GetRequestMirrorPolicy()).(interface{ Validate() error }); ok {
2364		if err := v.Validate(); err != nil {
2365			return RouteActionValidationError{
2366				field:  "RequestMirrorPolicy",
2367				reason: "embedded message failed validation",
2368				cause:  err,
2369			}
2370		}
2371	}
2372
2373	for idx, item := range m.GetRequestMirrorPolicies() {
2374		_, _ = idx, item
2375
2376		if all {
2377			switch v := interface{}(item).(type) {
2378			case interface{ ValidateAll() error }:
2379				if err := v.ValidateAll(); err != nil {
2380					errors = append(errors, RouteActionValidationError{
2381						field:  fmt.Sprintf("RequestMirrorPolicies[%v]", idx),
2382						reason: "embedded message failed validation",
2383						cause:  err,
2384					})
2385				}
2386			case interface{ Validate() error }:
2387				if err := v.Validate(); err != nil {
2388					errors = append(errors, RouteActionValidationError{
2389						field:  fmt.Sprintf("RequestMirrorPolicies[%v]", idx),
2390						reason: "embedded message failed validation",
2391						cause:  err,
2392					})
2393				}
2394			}
2395		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2396			if err := v.Validate(); err != nil {
2397				return RouteActionValidationError{
2398					field:  fmt.Sprintf("RequestMirrorPolicies[%v]", idx),
2399					reason: "embedded message failed validation",
2400					cause:  err,
2401				}
2402			}
2403		}
2404
2405	}
2406
2407	if _, ok := core.RoutingPriority_name[int32(m.GetPriority())]; !ok {
2408		err := RouteActionValidationError{
2409			field:  "Priority",
2410			reason: "value must be one of the defined enum values",
2411		}
2412		if !all {
2413			return err
2414		}
2415		errors = append(errors, err)
2416	}
2417
2418	for idx, item := range m.GetRateLimits() {
2419		_, _ = idx, item
2420
2421		if all {
2422			switch v := interface{}(item).(type) {
2423			case interface{ ValidateAll() error }:
2424				if err := v.ValidateAll(); err != nil {
2425					errors = append(errors, RouteActionValidationError{
2426						field:  fmt.Sprintf("RateLimits[%v]", idx),
2427						reason: "embedded message failed validation",
2428						cause:  err,
2429					})
2430				}
2431			case interface{ Validate() error }:
2432				if err := v.Validate(); err != nil {
2433					errors = append(errors, RouteActionValidationError{
2434						field:  fmt.Sprintf("RateLimits[%v]", idx),
2435						reason: "embedded message failed validation",
2436						cause:  err,
2437					})
2438				}
2439			}
2440		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2441			if err := v.Validate(); err != nil {
2442				return RouteActionValidationError{
2443					field:  fmt.Sprintf("RateLimits[%v]", idx),
2444					reason: "embedded message failed validation",
2445					cause:  err,
2446				}
2447			}
2448		}
2449
2450	}
2451
2452	if all {
2453		switch v := interface{}(m.GetIncludeVhRateLimits()).(type) {
2454		case interface{ ValidateAll() error }:
2455			if err := v.ValidateAll(); err != nil {
2456				errors = append(errors, RouteActionValidationError{
2457					field:  "IncludeVhRateLimits",
2458					reason: "embedded message failed validation",
2459					cause:  err,
2460				})
2461			}
2462		case interface{ Validate() error }:
2463			if err := v.Validate(); err != nil {
2464				errors = append(errors, RouteActionValidationError{
2465					field:  "IncludeVhRateLimits",
2466					reason: "embedded message failed validation",
2467					cause:  err,
2468				})
2469			}
2470		}
2471	} else if v, ok := interface{}(m.GetIncludeVhRateLimits()).(interface{ Validate() error }); ok {
2472		if err := v.Validate(); err != nil {
2473			return RouteActionValidationError{
2474				field:  "IncludeVhRateLimits",
2475				reason: "embedded message failed validation",
2476				cause:  err,
2477			}
2478		}
2479	}
2480
2481	for idx, item := range m.GetHashPolicy() {
2482		_, _ = idx, item
2483
2484		if all {
2485			switch v := interface{}(item).(type) {
2486			case interface{ ValidateAll() error }:
2487				if err := v.ValidateAll(); err != nil {
2488					errors = append(errors, RouteActionValidationError{
2489						field:  fmt.Sprintf("HashPolicy[%v]", idx),
2490						reason: "embedded message failed validation",
2491						cause:  err,
2492					})
2493				}
2494			case interface{ Validate() error }:
2495				if err := v.Validate(); err != nil {
2496					errors = append(errors, RouteActionValidationError{
2497						field:  fmt.Sprintf("HashPolicy[%v]", idx),
2498						reason: "embedded message failed validation",
2499						cause:  err,
2500					})
2501				}
2502			}
2503		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2504			if err := v.Validate(); err != nil {
2505				return RouteActionValidationError{
2506					field:  fmt.Sprintf("HashPolicy[%v]", idx),
2507					reason: "embedded message failed validation",
2508					cause:  err,
2509				}
2510			}
2511		}
2512
2513	}
2514
2515	if all {
2516		switch v := interface{}(m.GetCors()).(type) {
2517		case interface{ ValidateAll() error }:
2518			if err := v.ValidateAll(); err != nil {
2519				errors = append(errors, RouteActionValidationError{
2520					field:  "Cors",
2521					reason: "embedded message failed validation",
2522					cause:  err,
2523				})
2524			}
2525		case interface{ Validate() error }:
2526			if err := v.Validate(); err != nil {
2527				errors = append(errors, RouteActionValidationError{
2528					field:  "Cors",
2529					reason: "embedded message failed validation",
2530					cause:  err,
2531				})
2532			}
2533		}
2534	} else if v, ok := interface{}(m.GetCors()).(interface{ Validate() error }); ok {
2535		if err := v.Validate(); err != nil {
2536			return RouteActionValidationError{
2537				field:  "Cors",
2538				reason: "embedded message failed validation",
2539				cause:  err,
2540			}
2541		}
2542	}
2543
2544	if all {
2545		switch v := interface{}(m.GetMaxGrpcTimeout()).(type) {
2546		case interface{ ValidateAll() error }:
2547			if err := v.ValidateAll(); err != nil {
2548				errors = append(errors, RouteActionValidationError{
2549					field:  "MaxGrpcTimeout",
2550					reason: "embedded message failed validation",
2551					cause:  err,
2552				})
2553			}
2554		case interface{ Validate() error }:
2555			if err := v.Validate(); err != nil {
2556				errors = append(errors, RouteActionValidationError{
2557					field:  "MaxGrpcTimeout",
2558					reason: "embedded message failed validation",
2559					cause:  err,
2560				})
2561			}
2562		}
2563	} else if v, ok := interface{}(m.GetMaxGrpcTimeout()).(interface{ Validate() error }); ok {
2564		if err := v.Validate(); err != nil {
2565			return RouteActionValidationError{
2566				field:  "MaxGrpcTimeout",
2567				reason: "embedded message failed validation",
2568				cause:  err,
2569			}
2570		}
2571	}
2572
2573	if all {
2574		switch v := interface{}(m.GetGrpcTimeoutOffset()).(type) {
2575		case interface{ ValidateAll() error }:
2576			if err := v.ValidateAll(); err != nil {
2577				errors = append(errors, RouteActionValidationError{
2578					field:  "GrpcTimeoutOffset",
2579					reason: "embedded message failed validation",
2580					cause:  err,
2581				})
2582			}
2583		case interface{ Validate() error }:
2584			if err := v.Validate(); err != nil {
2585				errors = append(errors, RouteActionValidationError{
2586					field:  "GrpcTimeoutOffset",
2587					reason: "embedded message failed validation",
2588					cause:  err,
2589				})
2590			}
2591		}
2592	} else if v, ok := interface{}(m.GetGrpcTimeoutOffset()).(interface{ Validate() error }); ok {
2593		if err := v.Validate(); err != nil {
2594			return RouteActionValidationError{
2595				field:  "GrpcTimeoutOffset",
2596				reason: "embedded message failed validation",
2597				cause:  err,
2598			}
2599		}
2600	}
2601
2602	for idx, item := range m.GetUpgradeConfigs() {
2603		_, _ = idx, item
2604
2605		if all {
2606			switch v := interface{}(item).(type) {
2607			case interface{ ValidateAll() error }:
2608				if err := v.ValidateAll(); err != nil {
2609					errors = append(errors, RouteActionValidationError{
2610						field:  fmt.Sprintf("UpgradeConfigs[%v]", idx),
2611						reason: "embedded message failed validation",
2612						cause:  err,
2613					})
2614				}
2615			case interface{ Validate() error }:
2616				if err := v.Validate(); err != nil {
2617					errors = append(errors, RouteActionValidationError{
2618						field:  fmt.Sprintf("UpgradeConfigs[%v]", idx),
2619						reason: "embedded message failed validation",
2620						cause:  err,
2621					})
2622				}
2623			}
2624		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
2625			if err := v.Validate(); err != nil {
2626				return RouteActionValidationError{
2627					field:  fmt.Sprintf("UpgradeConfigs[%v]", idx),
2628					reason: "embedded message failed validation",
2629					cause:  err,
2630				}
2631			}
2632		}
2633
2634	}
2635
2636	// no validation rules for InternalRedirectAction
2637
2638	if all {
2639		switch v := interface{}(m.GetMaxInternalRedirects()).(type) {
2640		case interface{ ValidateAll() error }:
2641			if err := v.ValidateAll(); err != nil {
2642				errors = append(errors, RouteActionValidationError{
2643					field:  "MaxInternalRedirects",
2644					reason: "embedded message failed validation",
2645					cause:  err,
2646				})
2647			}
2648		case interface{ Validate() error }:
2649			if err := v.Validate(); err != nil {
2650				errors = append(errors, RouteActionValidationError{
2651					field:  "MaxInternalRedirects",
2652					reason: "embedded message failed validation",
2653					cause:  err,
2654				})
2655			}
2656		}
2657	} else if v, ok := interface{}(m.GetMaxInternalRedirects()).(interface{ Validate() error }); ok {
2658		if err := v.Validate(); err != nil {
2659			return RouteActionValidationError{
2660				field:  "MaxInternalRedirects",
2661				reason: "embedded message failed validation",
2662				cause:  err,
2663			}
2664		}
2665	}
2666
2667	if all {
2668		switch v := interface{}(m.GetHedgePolicy()).(type) {
2669		case interface{ ValidateAll() error }:
2670			if err := v.ValidateAll(); err != nil {
2671				errors = append(errors, RouteActionValidationError{
2672					field:  "HedgePolicy",
2673					reason: "embedded message failed validation",
2674					cause:  err,
2675				})
2676			}
2677		case interface{ Validate() error }:
2678			if err := v.Validate(); err != nil {
2679				errors = append(errors, RouteActionValidationError{
2680					field:  "HedgePolicy",
2681					reason: "embedded message failed validation",
2682					cause:  err,
2683				})
2684			}
2685		}
2686	} else if v, ok := interface{}(m.GetHedgePolicy()).(interface{ Validate() error }); ok {
2687		if err := v.Validate(); err != nil {
2688			return RouteActionValidationError{
2689				field:  "HedgePolicy",
2690				reason: "embedded message failed validation",
2691				cause:  err,
2692			}
2693		}
2694	}
2695
2696	switch m.ClusterSpecifier.(type) {
2697
2698	case *RouteAction_Cluster:
2699
2700		if len(m.GetCluster()) < 1 {
2701			err := RouteActionValidationError{
2702				field:  "Cluster",
2703				reason: "value length must be at least 1 bytes",
2704			}
2705			if !all {
2706				return err
2707			}
2708			errors = append(errors, err)
2709		}
2710
2711	case *RouteAction_ClusterHeader:
2712
2713		if len(m.GetClusterHeader()) < 1 {
2714			err := RouteActionValidationError{
2715				field:  "ClusterHeader",
2716				reason: "value length must be at least 1 bytes",
2717			}
2718			if !all {
2719				return err
2720			}
2721			errors = append(errors, err)
2722		}
2723
2724		if !_RouteAction_ClusterHeader_Pattern.MatchString(m.GetClusterHeader()) {
2725			err := RouteActionValidationError{
2726				field:  "ClusterHeader",
2727				reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
2728			}
2729			if !all {
2730				return err
2731			}
2732			errors = append(errors, err)
2733		}
2734
2735	case *RouteAction_WeightedClusters:
2736
2737		if all {
2738			switch v := interface{}(m.GetWeightedClusters()).(type) {
2739			case interface{ ValidateAll() error }:
2740				if err := v.ValidateAll(); err != nil {
2741					errors = append(errors, RouteActionValidationError{
2742						field:  "WeightedClusters",
2743						reason: "embedded message failed validation",
2744						cause:  err,
2745					})
2746				}
2747			case interface{ Validate() error }:
2748				if err := v.Validate(); err != nil {
2749					errors = append(errors, RouteActionValidationError{
2750						field:  "WeightedClusters",
2751						reason: "embedded message failed validation",
2752						cause:  err,
2753					})
2754				}
2755			}
2756		} else if v, ok := interface{}(m.GetWeightedClusters()).(interface{ Validate() error }); ok {
2757			if err := v.Validate(); err != nil {
2758				return RouteActionValidationError{
2759					field:  "WeightedClusters",
2760					reason: "embedded message failed validation",
2761					cause:  err,
2762				}
2763			}
2764		}
2765
2766	default:
2767		err := RouteActionValidationError{
2768			field:  "ClusterSpecifier",
2769			reason: "value is required",
2770		}
2771		if !all {
2772			return err
2773		}
2774		errors = append(errors, err)
2775
2776	}
2777
2778	switch m.HostRewriteSpecifier.(type) {
2779
2780	case *RouteAction_HostRewrite:
2781
2782		if !_RouteAction_HostRewrite_Pattern.MatchString(m.GetHostRewrite()) {
2783			err := RouteActionValidationError{
2784				field:  "HostRewrite",
2785				reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
2786			}
2787			if !all {
2788				return err
2789			}
2790			errors = append(errors, err)
2791		}
2792
2793	case *RouteAction_AutoHostRewrite:
2794
2795		if all {
2796			switch v := interface{}(m.GetAutoHostRewrite()).(type) {
2797			case interface{ ValidateAll() error }:
2798				if err := v.ValidateAll(); err != nil {
2799					errors = append(errors, RouteActionValidationError{
2800						field:  "AutoHostRewrite",
2801						reason: "embedded message failed validation",
2802						cause:  err,
2803					})
2804				}
2805			case interface{ Validate() error }:
2806				if err := v.Validate(); err != nil {
2807					errors = append(errors, RouteActionValidationError{
2808						field:  "AutoHostRewrite",
2809						reason: "embedded message failed validation",
2810						cause:  err,
2811					})
2812				}
2813			}
2814		} else if v, ok := interface{}(m.GetAutoHostRewrite()).(interface{ Validate() error }); ok {
2815			if err := v.Validate(); err != nil {
2816				return RouteActionValidationError{
2817					field:  "AutoHostRewrite",
2818					reason: "embedded message failed validation",
2819					cause:  err,
2820				}
2821			}
2822		}
2823
2824	case *RouteAction_AutoHostRewriteHeader:
2825
2826		if !_RouteAction_AutoHostRewriteHeader_Pattern.MatchString(m.GetAutoHostRewriteHeader()) {
2827			err := RouteActionValidationError{
2828				field:  "AutoHostRewriteHeader",
2829				reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
2830			}
2831			if !all {
2832				return err
2833			}
2834			errors = append(errors, err)
2835		}
2836
2837	}
2838
2839	if len(errors) > 0 {
2840		return RouteActionMultiError(errors)
2841	}
2842	return nil
2843}
2844
2845// RouteActionMultiError is an error wrapping multiple validation errors
2846// returned by RouteAction.ValidateAll() if the designated constraints aren't met.
2847type RouteActionMultiError []error
2848
2849// Error returns a concatenation of all the error messages it wraps.
2850func (m RouteActionMultiError) Error() string {
2851	var msgs []string
2852	for _, err := range m {
2853		msgs = append(msgs, err.Error())
2854	}
2855	return strings.Join(msgs, "; ")
2856}
2857
2858// AllErrors returns a list of validation violation errors.
2859func (m RouteActionMultiError) AllErrors() []error { return m }
2860
2861// RouteActionValidationError is the validation error returned by
2862// RouteAction.Validate if the designated constraints aren't met.
2863type RouteActionValidationError struct {
2864	field  string
2865	reason string
2866	cause  error
2867	key    bool
2868}
2869
2870// Field function returns field value.
2871func (e RouteActionValidationError) Field() string { return e.field }
2872
2873// Reason function returns reason value.
2874func (e RouteActionValidationError) Reason() string { return e.reason }
2875
2876// Cause function returns cause value.
2877func (e RouteActionValidationError) Cause() error { return e.cause }
2878
2879// Key function returns key value.
2880func (e RouteActionValidationError) Key() bool { return e.key }
2881
2882// ErrorName returns error name.
2883func (e RouteActionValidationError) ErrorName() string { return "RouteActionValidationError" }
2884
2885// Error satisfies the builtin error interface
2886func (e RouteActionValidationError) Error() string {
2887	cause := ""
2888	if e.cause != nil {
2889		cause = fmt.Sprintf(" | caused by: %v", e.cause)
2890	}
2891
2892	key := ""
2893	if e.key {
2894		key = "key for "
2895	}
2896
2897	return fmt.Sprintf(
2898		"invalid %sRouteAction.%s: %s%s",
2899		key,
2900		e.field,
2901		e.reason,
2902		cause)
2903}
2904
2905var _ error = RouteActionValidationError{}
2906
2907var _ interface {
2908	Field() string
2909	Reason() string
2910	Key() bool
2911	Cause() error
2912	ErrorName() string
2913} = RouteActionValidationError{}
2914
2915var _RouteAction_ClusterHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
2916
2917var _RouteAction_PrefixRewrite_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
2918
2919var _RouteAction_HostRewrite_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
2920
2921var _RouteAction_AutoHostRewriteHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
2922
2923// Validate checks the field values on RetryPolicy with the rules defined in
2924// the proto definition for this message. If any rules are violated, the first
2925// error encountered is returned, or nil if there are no violations.
2926func (m *RetryPolicy) Validate() error {
2927	return m.validate(false)
2928}
2929
2930// ValidateAll checks the field values on RetryPolicy with the rules defined in
2931// the proto definition for this message. If any rules are violated, the
2932// result is a list of violation errors wrapped in RetryPolicyMultiError, or
2933// nil if none found.
2934func (m *RetryPolicy) ValidateAll() error {
2935	return m.validate(true)
2936}
2937
2938func (m *RetryPolicy) validate(all bool) error {
2939	if m == nil {
2940		return nil
2941	}
2942
2943	var errors []error
2944
2945	// no validation rules for RetryOn
2946
2947	if all {
2948		switch v := interface{}(m.GetNumRetries()).(type) {
2949		case interface{ ValidateAll() error }:
2950			if err := v.ValidateAll(); err != nil {
2951				errors = append(errors, RetryPolicyValidationError{
2952					field:  "NumRetries",
2953					reason: "embedded message failed validation",
2954					cause:  err,
2955				})
2956			}
2957		case interface{ Validate() error }:
2958			if err := v.Validate(); err != nil {
2959				errors = append(errors, RetryPolicyValidationError{
2960					field:  "NumRetries",
2961					reason: "embedded message failed validation",
2962					cause:  err,
2963				})
2964			}
2965		}
2966	} else if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok {
2967		if err := v.Validate(); err != nil {
2968			return RetryPolicyValidationError{
2969				field:  "NumRetries",
2970				reason: "embedded message failed validation",
2971				cause:  err,
2972			}
2973		}
2974	}
2975
2976	if all {
2977		switch v := interface{}(m.GetPerTryTimeout()).(type) {
2978		case interface{ ValidateAll() error }:
2979			if err := v.ValidateAll(); err != nil {
2980				errors = append(errors, RetryPolicyValidationError{
2981					field:  "PerTryTimeout",
2982					reason: "embedded message failed validation",
2983					cause:  err,
2984				})
2985			}
2986		case interface{ Validate() error }:
2987			if err := v.Validate(); err != nil {
2988				errors = append(errors, RetryPolicyValidationError{
2989					field:  "PerTryTimeout",
2990					reason: "embedded message failed validation",
2991					cause:  err,
2992				})
2993			}
2994		}
2995	} else if v, ok := interface{}(m.GetPerTryTimeout()).(interface{ Validate() error }); ok {
2996		if err := v.Validate(); err != nil {
2997			return RetryPolicyValidationError{
2998				field:  "PerTryTimeout",
2999				reason: "embedded message failed validation",
3000				cause:  err,
3001			}
3002		}
3003	}
3004
3005	if all {
3006		switch v := interface{}(m.GetRetryPriority()).(type) {
3007		case interface{ ValidateAll() error }:
3008			if err := v.ValidateAll(); err != nil {
3009				errors = append(errors, RetryPolicyValidationError{
3010					field:  "RetryPriority",
3011					reason: "embedded message failed validation",
3012					cause:  err,
3013				})
3014			}
3015		case interface{ Validate() error }:
3016			if err := v.Validate(); err != nil {
3017				errors = append(errors, RetryPolicyValidationError{
3018					field:  "RetryPriority",
3019					reason: "embedded message failed validation",
3020					cause:  err,
3021				})
3022			}
3023		}
3024	} else if v, ok := interface{}(m.GetRetryPriority()).(interface{ Validate() error }); ok {
3025		if err := v.Validate(); err != nil {
3026			return RetryPolicyValidationError{
3027				field:  "RetryPriority",
3028				reason: "embedded message failed validation",
3029				cause:  err,
3030			}
3031		}
3032	}
3033
3034	for idx, item := range m.GetRetryHostPredicate() {
3035		_, _ = idx, item
3036
3037		if all {
3038			switch v := interface{}(item).(type) {
3039			case interface{ ValidateAll() error }:
3040				if err := v.ValidateAll(); err != nil {
3041					errors = append(errors, RetryPolicyValidationError{
3042						field:  fmt.Sprintf("RetryHostPredicate[%v]", idx),
3043						reason: "embedded message failed validation",
3044						cause:  err,
3045					})
3046				}
3047			case interface{ Validate() error }:
3048				if err := v.Validate(); err != nil {
3049					errors = append(errors, RetryPolicyValidationError{
3050						field:  fmt.Sprintf("RetryHostPredicate[%v]", idx),
3051						reason: "embedded message failed validation",
3052						cause:  err,
3053					})
3054				}
3055			}
3056		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
3057			if err := v.Validate(); err != nil {
3058				return RetryPolicyValidationError{
3059					field:  fmt.Sprintf("RetryHostPredicate[%v]", idx),
3060					reason: "embedded message failed validation",
3061					cause:  err,
3062				}
3063			}
3064		}
3065
3066	}
3067
3068	// no validation rules for HostSelectionRetryMaxAttempts
3069
3070	if all {
3071		switch v := interface{}(m.GetRetryBackOff()).(type) {
3072		case interface{ ValidateAll() error }:
3073			if err := v.ValidateAll(); err != nil {
3074				errors = append(errors, RetryPolicyValidationError{
3075					field:  "RetryBackOff",
3076					reason: "embedded message failed validation",
3077					cause:  err,
3078				})
3079			}
3080		case interface{ Validate() error }:
3081			if err := v.Validate(); err != nil {
3082				errors = append(errors, RetryPolicyValidationError{
3083					field:  "RetryBackOff",
3084					reason: "embedded message failed validation",
3085					cause:  err,
3086				})
3087			}
3088		}
3089	} else if v, ok := interface{}(m.GetRetryBackOff()).(interface{ Validate() error }); ok {
3090		if err := v.Validate(); err != nil {
3091			return RetryPolicyValidationError{
3092				field:  "RetryBackOff",
3093				reason: "embedded message failed validation",
3094				cause:  err,
3095			}
3096		}
3097	}
3098
3099	for idx, item := range m.GetRetriableHeaders() {
3100		_, _ = idx, item
3101
3102		if all {
3103			switch v := interface{}(item).(type) {
3104			case interface{ ValidateAll() error }:
3105				if err := v.ValidateAll(); err != nil {
3106					errors = append(errors, RetryPolicyValidationError{
3107						field:  fmt.Sprintf("RetriableHeaders[%v]", idx),
3108						reason: "embedded message failed validation",
3109						cause:  err,
3110					})
3111				}
3112			case interface{ Validate() error }:
3113				if err := v.Validate(); err != nil {
3114					errors = append(errors, RetryPolicyValidationError{
3115						field:  fmt.Sprintf("RetriableHeaders[%v]", idx),
3116						reason: "embedded message failed validation",
3117						cause:  err,
3118					})
3119				}
3120			}
3121		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
3122			if err := v.Validate(); err != nil {
3123				return RetryPolicyValidationError{
3124					field:  fmt.Sprintf("RetriableHeaders[%v]", idx),
3125					reason: "embedded message failed validation",
3126					cause:  err,
3127				}
3128			}
3129		}
3130
3131	}
3132
3133	for idx, item := range m.GetRetriableRequestHeaders() {
3134		_, _ = idx, item
3135
3136		if all {
3137			switch v := interface{}(item).(type) {
3138			case interface{ ValidateAll() error }:
3139				if err := v.ValidateAll(); err != nil {
3140					errors = append(errors, RetryPolicyValidationError{
3141						field:  fmt.Sprintf("RetriableRequestHeaders[%v]", idx),
3142						reason: "embedded message failed validation",
3143						cause:  err,
3144					})
3145				}
3146			case interface{ Validate() error }:
3147				if err := v.Validate(); err != nil {
3148					errors = append(errors, RetryPolicyValidationError{
3149						field:  fmt.Sprintf("RetriableRequestHeaders[%v]", idx),
3150						reason: "embedded message failed validation",
3151						cause:  err,
3152					})
3153				}
3154			}
3155		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
3156			if err := v.Validate(); err != nil {
3157				return RetryPolicyValidationError{
3158					field:  fmt.Sprintf("RetriableRequestHeaders[%v]", idx),
3159					reason: "embedded message failed validation",
3160					cause:  err,
3161				}
3162			}
3163		}
3164
3165	}
3166
3167	if len(errors) > 0 {
3168		return RetryPolicyMultiError(errors)
3169	}
3170	return nil
3171}
3172
3173// RetryPolicyMultiError is an error wrapping multiple validation errors
3174// returned by RetryPolicy.ValidateAll() if the designated constraints aren't met.
3175type RetryPolicyMultiError []error
3176
3177// Error returns a concatenation of all the error messages it wraps.
3178func (m RetryPolicyMultiError) Error() string {
3179	var msgs []string
3180	for _, err := range m {
3181		msgs = append(msgs, err.Error())
3182	}
3183	return strings.Join(msgs, "; ")
3184}
3185
3186// AllErrors returns a list of validation violation errors.
3187func (m RetryPolicyMultiError) AllErrors() []error { return m }
3188
3189// RetryPolicyValidationError is the validation error returned by
3190// RetryPolicy.Validate if the designated constraints aren't met.
3191type RetryPolicyValidationError struct {
3192	field  string
3193	reason string
3194	cause  error
3195	key    bool
3196}
3197
3198// Field function returns field value.
3199func (e RetryPolicyValidationError) Field() string { return e.field }
3200
3201// Reason function returns reason value.
3202func (e RetryPolicyValidationError) Reason() string { return e.reason }
3203
3204// Cause function returns cause value.
3205func (e RetryPolicyValidationError) Cause() error { return e.cause }
3206
3207// Key function returns key value.
3208func (e RetryPolicyValidationError) Key() bool { return e.key }
3209
3210// ErrorName returns error name.
3211func (e RetryPolicyValidationError) ErrorName() string { return "RetryPolicyValidationError" }
3212
3213// Error satisfies the builtin error interface
3214func (e RetryPolicyValidationError) Error() string {
3215	cause := ""
3216	if e.cause != nil {
3217		cause = fmt.Sprintf(" | caused by: %v", e.cause)
3218	}
3219
3220	key := ""
3221	if e.key {
3222		key = "key for "
3223	}
3224
3225	return fmt.Sprintf(
3226		"invalid %sRetryPolicy.%s: %s%s",
3227		key,
3228		e.field,
3229		e.reason,
3230		cause)
3231}
3232
3233var _ error = RetryPolicyValidationError{}
3234
3235var _ interface {
3236	Field() string
3237	Reason() string
3238	Key() bool
3239	Cause() error
3240	ErrorName() string
3241} = RetryPolicyValidationError{}
3242
3243// Validate checks the field values on HedgePolicy with the rules defined in
3244// the proto definition for this message. If any rules are violated, the first
3245// error encountered is returned, or nil if there are no violations.
3246func (m *HedgePolicy) Validate() error {
3247	return m.validate(false)
3248}
3249
3250// ValidateAll checks the field values on HedgePolicy with the rules defined in
3251// the proto definition for this message. If any rules are violated, the
3252// result is a list of violation errors wrapped in HedgePolicyMultiError, or
3253// nil if none found.
3254func (m *HedgePolicy) ValidateAll() error {
3255	return m.validate(true)
3256}
3257
3258func (m *HedgePolicy) validate(all bool) error {
3259	if m == nil {
3260		return nil
3261	}
3262
3263	var errors []error
3264
3265	if wrapper := m.GetInitialRequests(); wrapper != nil {
3266
3267		if wrapper.GetValue() < 1 {
3268			err := HedgePolicyValidationError{
3269				field:  "InitialRequests",
3270				reason: "value must be greater than or equal to 1",
3271			}
3272			if !all {
3273				return err
3274			}
3275			errors = append(errors, err)
3276		}
3277
3278	}
3279
3280	if all {
3281		switch v := interface{}(m.GetAdditionalRequestChance()).(type) {
3282		case interface{ ValidateAll() error }:
3283			if err := v.ValidateAll(); err != nil {
3284				errors = append(errors, HedgePolicyValidationError{
3285					field:  "AdditionalRequestChance",
3286					reason: "embedded message failed validation",
3287					cause:  err,
3288				})
3289			}
3290		case interface{ Validate() error }:
3291			if err := v.Validate(); err != nil {
3292				errors = append(errors, HedgePolicyValidationError{
3293					field:  "AdditionalRequestChance",
3294					reason: "embedded message failed validation",
3295					cause:  err,
3296				})
3297			}
3298		}
3299	} else if v, ok := interface{}(m.GetAdditionalRequestChance()).(interface{ Validate() error }); ok {
3300		if err := v.Validate(); err != nil {
3301			return HedgePolicyValidationError{
3302				field:  "AdditionalRequestChance",
3303				reason: "embedded message failed validation",
3304				cause:  err,
3305			}
3306		}
3307	}
3308
3309	// no validation rules for HedgeOnPerTryTimeout
3310
3311	if len(errors) > 0 {
3312		return HedgePolicyMultiError(errors)
3313	}
3314	return nil
3315}
3316
3317// HedgePolicyMultiError is an error wrapping multiple validation errors
3318// returned by HedgePolicy.ValidateAll() if the designated constraints aren't met.
3319type HedgePolicyMultiError []error
3320
3321// Error returns a concatenation of all the error messages it wraps.
3322func (m HedgePolicyMultiError) Error() string {
3323	var msgs []string
3324	for _, err := range m {
3325		msgs = append(msgs, err.Error())
3326	}
3327	return strings.Join(msgs, "; ")
3328}
3329
3330// AllErrors returns a list of validation violation errors.
3331func (m HedgePolicyMultiError) AllErrors() []error { return m }
3332
3333// HedgePolicyValidationError is the validation error returned by
3334// HedgePolicy.Validate if the designated constraints aren't met.
3335type HedgePolicyValidationError struct {
3336	field  string
3337	reason string
3338	cause  error
3339	key    bool
3340}
3341
3342// Field function returns field value.
3343func (e HedgePolicyValidationError) Field() string { return e.field }
3344
3345// Reason function returns reason value.
3346func (e HedgePolicyValidationError) Reason() string { return e.reason }
3347
3348// Cause function returns cause value.
3349func (e HedgePolicyValidationError) Cause() error { return e.cause }
3350
3351// Key function returns key value.
3352func (e HedgePolicyValidationError) Key() bool { return e.key }
3353
3354// ErrorName returns error name.
3355func (e HedgePolicyValidationError) ErrorName() string { return "HedgePolicyValidationError" }
3356
3357// Error satisfies the builtin error interface
3358func (e HedgePolicyValidationError) Error() string {
3359	cause := ""
3360	if e.cause != nil {
3361		cause = fmt.Sprintf(" | caused by: %v", e.cause)
3362	}
3363
3364	key := ""
3365	if e.key {
3366		key = "key for "
3367	}
3368
3369	return fmt.Sprintf(
3370		"invalid %sHedgePolicy.%s: %s%s",
3371		key,
3372		e.field,
3373		e.reason,
3374		cause)
3375}
3376
3377var _ error = HedgePolicyValidationError{}
3378
3379var _ interface {
3380	Field() string
3381	Reason() string
3382	Key() bool
3383	Cause() error
3384	ErrorName() string
3385} = HedgePolicyValidationError{}
3386
3387// Validate checks the field values on RedirectAction with the rules defined in
3388// the proto definition for this message. If any rules are violated, the first
3389// error encountered is returned, or nil if there are no violations.
3390func (m *RedirectAction) Validate() error {
3391	return m.validate(false)
3392}
3393
3394// ValidateAll checks the field values on RedirectAction with the rules defined
3395// in the proto definition for this message. If any rules are violated, the
3396// result is a list of violation errors wrapped in RedirectActionMultiError,
3397// or nil if none found.
3398func (m *RedirectAction) ValidateAll() error {
3399	return m.validate(true)
3400}
3401
3402func (m *RedirectAction) validate(all bool) error {
3403	if m == nil {
3404		return nil
3405	}
3406
3407	var errors []error
3408
3409	if !_RedirectAction_HostRedirect_Pattern.MatchString(m.GetHostRedirect()) {
3410		err := RedirectActionValidationError{
3411			field:  "HostRedirect",
3412			reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
3413		}
3414		if !all {
3415			return err
3416		}
3417		errors = append(errors, err)
3418	}
3419
3420	// no validation rules for PortRedirect
3421
3422	if _, ok := RedirectAction_RedirectResponseCode_name[int32(m.GetResponseCode())]; !ok {
3423		err := RedirectActionValidationError{
3424			field:  "ResponseCode",
3425			reason: "value must be one of the defined enum values",
3426		}
3427		if !all {
3428			return err
3429		}
3430		errors = append(errors, err)
3431	}
3432
3433	// no validation rules for StripQuery
3434
3435	switch m.SchemeRewriteSpecifier.(type) {
3436
3437	case *RedirectAction_HttpsRedirect:
3438		// no validation rules for HttpsRedirect
3439
3440	case *RedirectAction_SchemeRedirect:
3441		// no validation rules for SchemeRedirect
3442
3443	}
3444
3445	switch m.PathRewriteSpecifier.(type) {
3446
3447	case *RedirectAction_PathRedirect:
3448
3449		if !_RedirectAction_PathRedirect_Pattern.MatchString(m.GetPathRedirect()) {
3450			err := RedirectActionValidationError{
3451				field:  "PathRedirect",
3452				reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
3453			}
3454			if !all {
3455				return err
3456			}
3457			errors = append(errors, err)
3458		}
3459
3460	case *RedirectAction_PrefixRewrite:
3461
3462		if !_RedirectAction_PrefixRewrite_Pattern.MatchString(m.GetPrefixRewrite()) {
3463			err := RedirectActionValidationError{
3464				field:  "PrefixRewrite",
3465				reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
3466			}
3467			if !all {
3468				return err
3469			}
3470			errors = append(errors, err)
3471		}
3472
3473	}
3474
3475	if len(errors) > 0 {
3476		return RedirectActionMultiError(errors)
3477	}
3478	return nil
3479}
3480
3481// RedirectActionMultiError is an error wrapping multiple validation errors
3482// returned by RedirectAction.ValidateAll() if the designated constraints
3483// aren't met.
3484type RedirectActionMultiError []error
3485
3486// Error returns a concatenation of all the error messages it wraps.
3487func (m RedirectActionMultiError) Error() string {
3488	var msgs []string
3489	for _, err := range m {
3490		msgs = append(msgs, err.Error())
3491	}
3492	return strings.Join(msgs, "; ")
3493}
3494
3495// AllErrors returns a list of validation violation errors.
3496func (m RedirectActionMultiError) AllErrors() []error { return m }
3497
3498// RedirectActionValidationError is the validation error returned by
3499// RedirectAction.Validate if the designated constraints aren't met.
3500type RedirectActionValidationError struct {
3501	field  string
3502	reason string
3503	cause  error
3504	key    bool
3505}
3506
3507// Field function returns field value.
3508func (e RedirectActionValidationError) Field() string { return e.field }
3509
3510// Reason function returns reason value.
3511func (e RedirectActionValidationError) Reason() string { return e.reason }
3512
3513// Cause function returns cause value.
3514func (e RedirectActionValidationError) Cause() error { return e.cause }
3515
3516// Key function returns key value.
3517func (e RedirectActionValidationError) Key() bool { return e.key }
3518
3519// ErrorName returns error name.
3520func (e RedirectActionValidationError) ErrorName() string { return "RedirectActionValidationError" }
3521
3522// Error satisfies the builtin error interface
3523func (e RedirectActionValidationError) Error() string {
3524	cause := ""
3525	if e.cause != nil {
3526		cause = fmt.Sprintf(" | caused by: %v", e.cause)
3527	}
3528
3529	key := ""
3530	if e.key {
3531		key = "key for "
3532	}
3533
3534	return fmt.Sprintf(
3535		"invalid %sRedirectAction.%s: %s%s",
3536		key,
3537		e.field,
3538		e.reason,
3539		cause)
3540}
3541
3542var _ error = RedirectActionValidationError{}
3543
3544var _ interface {
3545	Field() string
3546	Reason() string
3547	Key() bool
3548	Cause() error
3549	ErrorName() string
3550} = RedirectActionValidationError{}
3551
3552var _RedirectAction_HostRedirect_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
3553
3554var _RedirectAction_PathRedirect_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
3555
3556var _RedirectAction_PrefixRewrite_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
3557
3558// Validate checks the field values on DirectResponseAction with the rules
3559// defined in the proto definition for this message. If any rules are
3560// violated, the first error encountered is returned, or nil if there are no violations.
3561func (m *DirectResponseAction) Validate() error {
3562	return m.validate(false)
3563}
3564
3565// ValidateAll checks the field values on DirectResponseAction with the rules
3566// defined in the proto definition for this message. If any rules are
3567// violated, the result is a list of violation errors wrapped in
3568// DirectResponseActionMultiError, or nil if none found.
3569func (m *DirectResponseAction) ValidateAll() error {
3570	return m.validate(true)
3571}
3572
3573func (m *DirectResponseAction) validate(all bool) error {
3574	if m == nil {
3575		return nil
3576	}
3577
3578	var errors []error
3579
3580	if val := m.GetStatus(); val < 100 || val >= 600 {
3581		err := DirectResponseActionValidationError{
3582			field:  "Status",
3583			reason: "value must be inside range [100, 600)",
3584		}
3585		if !all {
3586			return err
3587		}
3588		errors = append(errors, err)
3589	}
3590
3591	if all {
3592		switch v := interface{}(m.GetBody()).(type) {
3593		case interface{ ValidateAll() error }:
3594			if err := v.ValidateAll(); err != nil {
3595				errors = append(errors, DirectResponseActionValidationError{
3596					field:  "Body",
3597					reason: "embedded message failed validation",
3598					cause:  err,
3599				})
3600			}
3601		case interface{ Validate() error }:
3602			if err := v.Validate(); err != nil {
3603				errors = append(errors, DirectResponseActionValidationError{
3604					field:  "Body",
3605					reason: "embedded message failed validation",
3606					cause:  err,
3607				})
3608			}
3609		}
3610	} else if v, ok := interface{}(m.GetBody()).(interface{ Validate() error }); ok {
3611		if err := v.Validate(); err != nil {
3612			return DirectResponseActionValidationError{
3613				field:  "Body",
3614				reason: "embedded message failed validation",
3615				cause:  err,
3616			}
3617		}
3618	}
3619
3620	if len(errors) > 0 {
3621		return DirectResponseActionMultiError(errors)
3622	}
3623	return nil
3624}
3625
3626// DirectResponseActionMultiError is an error wrapping multiple validation
3627// errors returned by DirectResponseAction.ValidateAll() if the designated
3628// constraints aren't met.
3629type DirectResponseActionMultiError []error
3630
3631// Error returns a concatenation of all the error messages it wraps.
3632func (m DirectResponseActionMultiError) Error() string {
3633	var msgs []string
3634	for _, err := range m {
3635		msgs = append(msgs, err.Error())
3636	}
3637	return strings.Join(msgs, "; ")
3638}
3639
3640// AllErrors returns a list of validation violation errors.
3641func (m DirectResponseActionMultiError) AllErrors() []error { return m }
3642
3643// DirectResponseActionValidationError is the validation error returned by
3644// DirectResponseAction.Validate if the designated constraints aren't met.
3645type DirectResponseActionValidationError struct {
3646	field  string
3647	reason string
3648	cause  error
3649	key    bool
3650}
3651
3652// Field function returns field value.
3653func (e DirectResponseActionValidationError) Field() string { return e.field }
3654
3655// Reason function returns reason value.
3656func (e DirectResponseActionValidationError) Reason() string { return e.reason }
3657
3658// Cause function returns cause value.
3659func (e DirectResponseActionValidationError) Cause() error { return e.cause }
3660
3661// Key function returns key value.
3662func (e DirectResponseActionValidationError) Key() bool { return e.key }
3663
3664// ErrorName returns error name.
3665func (e DirectResponseActionValidationError) ErrorName() string {
3666	return "DirectResponseActionValidationError"
3667}
3668
3669// Error satisfies the builtin error interface
3670func (e DirectResponseActionValidationError) Error() string {
3671	cause := ""
3672	if e.cause != nil {
3673		cause = fmt.Sprintf(" | caused by: %v", e.cause)
3674	}
3675
3676	key := ""
3677	if e.key {
3678		key = "key for "
3679	}
3680
3681	return fmt.Sprintf(
3682		"invalid %sDirectResponseAction.%s: %s%s",
3683		key,
3684		e.field,
3685		e.reason,
3686		cause)
3687}
3688
3689var _ error = DirectResponseActionValidationError{}
3690
3691var _ interface {
3692	Field() string
3693	Reason() string
3694	Key() bool
3695	Cause() error
3696	ErrorName() string
3697} = DirectResponseActionValidationError{}
3698
3699// Validate checks the field values on Decorator with the rules defined in the
3700// proto definition for this message. If any rules are violated, the first
3701// error encountered is returned, or nil if there are no violations.
3702func (m *Decorator) Validate() error {
3703	return m.validate(false)
3704}
3705
3706// ValidateAll checks the field values on Decorator with the rules defined in
3707// the proto definition for this message. If any rules are violated, the
3708// result is a list of violation errors wrapped in DecoratorMultiError, or nil
3709// if none found.
3710func (m *Decorator) ValidateAll() error {
3711	return m.validate(true)
3712}
3713
3714func (m *Decorator) validate(all bool) error {
3715	if m == nil {
3716		return nil
3717	}
3718
3719	var errors []error
3720
3721	if len(m.GetOperation()) < 1 {
3722		err := DecoratorValidationError{
3723			field:  "Operation",
3724			reason: "value length must be at least 1 bytes",
3725		}
3726		if !all {
3727			return err
3728		}
3729		errors = append(errors, err)
3730	}
3731
3732	if all {
3733		switch v := interface{}(m.GetPropagate()).(type) {
3734		case interface{ ValidateAll() error }:
3735			if err := v.ValidateAll(); err != nil {
3736				errors = append(errors, DecoratorValidationError{
3737					field:  "Propagate",
3738					reason: "embedded message failed validation",
3739					cause:  err,
3740				})
3741			}
3742		case interface{ Validate() error }:
3743			if err := v.Validate(); err != nil {
3744				errors = append(errors, DecoratorValidationError{
3745					field:  "Propagate",
3746					reason: "embedded message failed validation",
3747					cause:  err,
3748				})
3749			}
3750		}
3751	} else if v, ok := interface{}(m.GetPropagate()).(interface{ Validate() error }); ok {
3752		if err := v.Validate(); err != nil {
3753			return DecoratorValidationError{
3754				field:  "Propagate",
3755				reason: "embedded message failed validation",
3756				cause:  err,
3757			}
3758		}
3759	}
3760
3761	if len(errors) > 0 {
3762		return DecoratorMultiError(errors)
3763	}
3764	return nil
3765}
3766
3767// DecoratorMultiError is an error wrapping multiple validation errors returned
3768// by Decorator.ValidateAll() if the designated constraints aren't met.
3769type DecoratorMultiError []error
3770
3771// Error returns a concatenation of all the error messages it wraps.
3772func (m DecoratorMultiError) Error() string {
3773	var msgs []string
3774	for _, err := range m {
3775		msgs = append(msgs, err.Error())
3776	}
3777	return strings.Join(msgs, "; ")
3778}
3779
3780// AllErrors returns a list of validation violation errors.
3781func (m DecoratorMultiError) AllErrors() []error { return m }
3782
3783// DecoratorValidationError is the validation error returned by
3784// Decorator.Validate if the designated constraints aren't met.
3785type DecoratorValidationError struct {
3786	field  string
3787	reason string
3788	cause  error
3789	key    bool
3790}
3791
3792// Field function returns field value.
3793func (e DecoratorValidationError) Field() string { return e.field }
3794
3795// Reason function returns reason value.
3796func (e DecoratorValidationError) Reason() string { return e.reason }
3797
3798// Cause function returns cause value.
3799func (e DecoratorValidationError) Cause() error { return e.cause }
3800
3801// Key function returns key value.
3802func (e DecoratorValidationError) Key() bool { return e.key }
3803
3804// ErrorName returns error name.
3805func (e DecoratorValidationError) ErrorName() string { return "DecoratorValidationError" }
3806
3807// Error satisfies the builtin error interface
3808func (e DecoratorValidationError) Error() string {
3809	cause := ""
3810	if e.cause != nil {
3811		cause = fmt.Sprintf(" | caused by: %v", e.cause)
3812	}
3813
3814	key := ""
3815	if e.key {
3816		key = "key for "
3817	}
3818
3819	return fmt.Sprintf(
3820		"invalid %sDecorator.%s: %s%s",
3821		key,
3822		e.field,
3823		e.reason,
3824		cause)
3825}
3826
3827var _ error = DecoratorValidationError{}
3828
3829var _ interface {
3830	Field() string
3831	Reason() string
3832	Key() bool
3833	Cause() error
3834	ErrorName() string
3835} = DecoratorValidationError{}
3836
3837// Validate checks the field values on Tracing with the rules defined in the
3838// proto definition for this message. If any rules are violated, the first
3839// error encountered is returned, or nil if there are no violations.
3840func (m *Tracing) Validate() error {
3841	return m.validate(false)
3842}
3843
3844// ValidateAll checks the field values on Tracing with the rules defined in the
3845// proto definition for this message. If any rules are violated, the result is
3846// a list of violation errors wrapped in TracingMultiError, or nil if none found.
3847func (m *Tracing) ValidateAll() error {
3848	return m.validate(true)
3849}
3850
3851func (m *Tracing) validate(all bool) error {
3852	if m == nil {
3853		return nil
3854	}
3855
3856	var errors []error
3857
3858	if all {
3859		switch v := interface{}(m.GetClientSampling()).(type) {
3860		case interface{ ValidateAll() error }:
3861			if err := v.ValidateAll(); err != nil {
3862				errors = append(errors, TracingValidationError{
3863					field:  "ClientSampling",
3864					reason: "embedded message failed validation",
3865					cause:  err,
3866				})
3867			}
3868		case interface{ Validate() error }:
3869			if err := v.Validate(); err != nil {
3870				errors = append(errors, TracingValidationError{
3871					field:  "ClientSampling",
3872					reason: "embedded message failed validation",
3873					cause:  err,
3874				})
3875			}
3876		}
3877	} else if v, ok := interface{}(m.GetClientSampling()).(interface{ Validate() error }); ok {
3878		if err := v.Validate(); err != nil {
3879			return TracingValidationError{
3880				field:  "ClientSampling",
3881				reason: "embedded message failed validation",
3882				cause:  err,
3883			}
3884		}
3885	}
3886
3887	if all {
3888		switch v := interface{}(m.GetRandomSampling()).(type) {
3889		case interface{ ValidateAll() error }:
3890			if err := v.ValidateAll(); err != nil {
3891				errors = append(errors, TracingValidationError{
3892					field:  "RandomSampling",
3893					reason: "embedded message failed validation",
3894					cause:  err,
3895				})
3896			}
3897		case interface{ Validate() error }:
3898			if err := v.Validate(); err != nil {
3899				errors = append(errors, TracingValidationError{
3900					field:  "RandomSampling",
3901					reason: "embedded message failed validation",
3902					cause:  err,
3903				})
3904			}
3905		}
3906	} else if v, ok := interface{}(m.GetRandomSampling()).(interface{ Validate() error }); ok {
3907		if err := v.Validate(); err != nil {
3908			return TracingValidationError{
3909				field:  "RandomSampling",
3910				reason: "embedded message failed validation",
3911				cause:  err,
3912			}
3913		}
3914	}
3915
3916	if all {
3917		switch v := interface{}(m.GetOverallSampling()).(type) {
3918		case interface{ ValidateAll() error }:
3919			if err := v.ValidateAll(); err != nil {
3920				errors = append(errors, TracingValidationError{
3921					field:  "OverallSampling",
3922					reason: "embedded message failed validation",
3923					cause:  err,
3924				})
3925			}
3926		case interface{ Validate() error }:
3927			if err := v.Validate(); err != nil {
3928				errors = append(errors, TracingValidationError{
3929					field:  "OverallSampling",
3930					reason: "embedded message failed validation",
3931					cause:  err,
3932				})
3933			}
3934		}
3935	} else if v, ok := interface{}(m.GetOverallSampling()).(interface{ Validate() error }); ok {
3936		if err := v.Validate(); err != nil {
3937			return TracingValidationError{
3938				field:  "OverallSampling",
3939				reason: "embedded message failed validation",
3940				cause:  err,
3941			}
3942		}
3943	}
3944
3945	for idx, item := range m.GetCustomTags() {
3946		_, _ = idx, item
3947
3948		if all {
3949			switch v := interface{}(item).(type) {
3950			case interface{ ValidateAll() error }:
3951				if err := v.ValidateAll(); err != nil {
3952					errors = append(errors, TracingValidationError{
3953						field:  fmt.Sprintf("CustomTags[%v]", idx),
3954						reason: "embedded message failed validation",
3955						cause:  err,
3956					})
3957				}
3958			case interface{ Validate() error }:
3959				if err := v.Validate(); err != nil {
3960					errors = append(errors, TracingValidationError{
3961						field:  fmt.Sprintf("CustomTags[%v]", idx),
3962						reason: "embedded message failed validation",
3963						cause:  err,
3964					})
3965				}
3966			}
3967		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
3968			if err := v.Validate(); err != nil {
3969				return TracingValidationError{
3970					field:  fmt.Sprintf("CustomTags[%v]", idx),
3971					reason: "embedded message failed validation",
3972					cause:  err,
3973				}
3974			}
3975		}
3976
3977	}
3978
3979	if len(errors) > 0 {
3980		return TracingMultiError(errors)
3981	}
3982	return nil
3983}
3984
3985// TracingMultiError is an error wrapping multiple validation errors returned
3986// by Tracing.ValidateAll() if the designated constraints aren't met.
3987type TracingMultiError []error
3988
3989// Error returns a concatenation of all the error messages it wraps.
3990func (m TracingMultiError) Error() string {
3991	var msgs []string
3992	for _, err := range m {
3993		msgs = append(msgs, err.Error())
3994	}
3995	return strings.Join(msgs, "; ")
3996}
3997
3998// AllErrors returns a list of validation violation errors.
3999func (m TracingMultiError) AllErrors() []error { return m }
4000
4001// TracingValidationError is the validation error returned by Tracing.Validate
4002// if the designated constraints aren't met.
4003type TracingValidationError struct {
4004	field  string
4005	reason string
4006	cause  error
4007	key    bool
4008}
4009
4010// Field function returns field value.
4011func (e TracingValidationError) Field() string { return e.field }
4012
4013// Reason function returns reason value.
4014func (e TracingValidationError) Reason() string { return e.reason }
4015
4016// Cause function returns cause value.
4017func (e TracingValidationError) Cause() error { return e.cause }
4018
4019// Key function returns key value.
4020func (e TracingValidationError) Key() bool { return e.key }
4021
4022// ErrorName returns error name.
4023func (e TracingValidationError) ErrorName() string { return "TracingValidationError" }
4024
4025// Error satisfies the builtin error interface
4026func (e TracingValidationError) Error() string {
4027	cause := ""
4028	if e.cause != nil {
4029		cause = fmt.Sprintf(" | caused by: %v", e.cause)
4030	}
4031
4032	key := ""
4033	if e.key {
4034		key = "key for "
4035	}
4036
4037	return fmt.Sprintf(
4038		"invalid %sTracing.%s: %s%s",
4039		key,
4040		e.field,
4041		e.reason,
4042		cause)
4043}
4044
4045var _ error = TracingValidationError{}
4046
4047var _ interface {
4048	Field() string
4049	Reason() string
4050	Key() bool
4051	Cause() error
4052	ErrorName() string
4053} = TracingValidationError{}
4054
4055// Validate checks the field values on VirtualCluster with the rules defined in
4056// the proto definition for this message. If any rules are violated, the first
4057// error encountered is returned, or nil if there are no violations.
4058func (m *VirtualCluster) Validate() error {
4059	return m.validate(false)
4060}
4061
4062// ValidateAll checks the field values on VirtualCluster with the rules defined
4063// in the proto definition for this message. If any rules are violated, the
4064// result is a list of violation errors wrapped in VirtualClusterMultiError,
4065// or nil if none found.
4066func (m *VirtualCluster) ValidateAll() error {
4067	return m.validate(true)
4068}
4069
4070func (m *VirtualCluster) validate(all bool) error {
4071	if m == nil {
4072		return nil
4073	}
4074
4075	var errors []error
4076
4077	if len(m.GetPattern()) > 1024 {
4078		err := VirtualClusterValidationError{
4079			field:  "Pattern",
4080			reason: "value length must be at most 1024 bytes",
4081		}
4082		if !all {
4083			return err
4084		}
4085		errors = append(errors, err)
4086	}
4087
4088	for idx, item := range m.GetHeaders() {
4089		_, _ = idx, item
4090
4091		if all {
4092			switch v := interface{}(item).(type) {
4093			case interface{ ValidateAll() error }:
4094				if err := v.ValidateAll(); err != nil {
4095					errors = append(errors, VirtualClusterValidationError{
4096						field:  fmt.Sprintf("Headers[%v]", idx),
4097						reason: "embedded message failed validation",
4098						cause:  err,
4099					})
4100				}
4101			case interface{ Validate() error }:
4102				if err := v.Validate(); err != nil {
4103					errors = append(errors, VirtualClusterValidationError{
4104						field:  fmt.Sprintf("Headers[%v]", idx),
4105						reason: "embedded message failed validation",
4106						cause:  err,
4107					})
4108				}
4109			}
4110		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
4111			if err := v.Validate(); err != nil {
4112				return VirtualClusterValidationError{
4113					field:  fmt.Sprintf("Headers[%v]", idx),
4114					reason: "embedded message failed validation",
4115					cause:  err,
4116				}
4117			}
4118		}
4119
4120	}
4121
4122	if len(m.GetName()) < 1 {
4123		err := VirtualClusterValidationError{
4124			field:  "Name",
4125			reason: "value length must be at least 1 bytes",
4126		}
4127		if !all {
4128			return err
4129		}
4130		errors = append(errors, err)
4131	}
4132
4133	// no validation rules for Method
4134
4135	if len(errors) > 0 {
4136		return VirtualClusterMultiError(errors)
4137	}
4138	return nil
4139}
4140
4141// VirtualClusterMultiError is an error wrapping multiple validation errors
4142// returned by VirtualCluster.ValidateAll() if the designated constraints
4143// aren't met.
4144type VirtualClusterMultiError []error
4145
4146// Error returns a concatenation of all the error messages it wraps.
4147func (m VirtualClusterMultiError) Error() string {
4148	var msgs []string
4149	for _, err := range m {
4150		msgs = append(msgs, err.Error())
4151	}
4152	return strings.Join(msgs, "; ")
4153}
4154
4155// AllErrors returns a list of validation violation errors.
4156func (m VirtualClusterMultiError) AllErrors() []error { return m }
4157
4158// VirtualClusterValidationError is the validation error returned by
4159// VirtualCluster.Validate if the designated constraints aren't met.
4160type VirtualClusterValidationError struct {
4161	field  string
4162	reason string
4163	cause  error
4164	key    bool
4165}
4166
4167// Field function returns field value.
4168func (e VirtualClusterValidationError) Field() string { return e.field }
4169
4170// Reason function returns reason value.
4171func (e VirtualClusterValidationError) Reason() string { return e.reason }
4172
4173// Cause function returns cause value.
4174func (e VirtualClusterValidationError) Cause() error { return e.cause }
4175
4176// Key function returns key value.
4177func (e VirtualClusterValidationError) Key() bool { return e.key }
4178
4179// ErrorName returns error name.
4180func (e VirtualClusterValidationError) ErrorName() string { return "VirtualClusterValidationError" }
4181
4182// Error satisfies the builtin error interface
4183func (e VirtualClusterValidationError) Error() string {
4184	cause := ""
4185	if e.cause != nil {
4186		cause = fmt.Sprintf(" | caused by: %v", e.cause)
4187	}
4188
4189	key := ""
4190	if e.key {
4191		key = "key for "
4192	}
4193
4194	return fmt.Sprintf(
4195		"invalid %sVirtualCluster.%s: %s%s",
4196		key,
4197		e.field,
4198		e.reason,
4199		cause)
4200}
4201
4202var _ error = VirtualClusterValidationError{}
4203
4204var _ interface {
4205	Field() string
4206	Reason() string
4207	Key() bool
4208	Cause() error
4209	ErrorName() string
4210} = VirtualClusterValidationError{}
4211
4212// Validate checks the field values on RateLimit with the rules defined in the
4213// proto definition for this message. If any rules are violated, the first
4214// error encountered is returned, or nil if there are no violations.
4215func (m *RateLimit) Validate() error {
4216	return m.validate(false)
4217}
4218
4219// ValidateAll checks the field values on RateLimit with the rules defined in
4220// the proto definition for this message. If any rules are violated, the
4221// result is a list of violation errors wrapped in RateLimitMultiError, or nil
4222// if none found.
4223func (m *RateLimit) ValidateAll() error {
4224	return m.validate(true)
4225}
4226
4227func (m *RateLimit) validate(all bool) error {
4228	if m == nil {
4229		return nil
4230	}
4231
4232	var errors []error
4233
4234	if wrapper := m.GetStage(); wrapper != nil {
4235
4236		if wrapper.GetValue() > 10 {
4237			err := RateLimitValidationError{
4238				field:  "Stage",
4239				reason: "value must be less than or equal to 10",
4240			}
4241			if !all {
4242				return err
4243			}
4244			errors = append(errors, err)
4245		}
4246
4247	}
4248
4249	// no validation rules for DisableKey
4250
4251	if len(m.GetActions()) < 1 {
4252		err := RateLimitValidationError{
4253			field:  "Actions",
4254			reason: "value must contain at least 1 item(s)",
4255		}
4256		if !all {
4257			return err
4258		}
4259		errors = append(errors, err)
4260	}
4261
4262	for idx, item := range m.GetActions() {
4263		_, _ = idx, item
4264
4265		if all {
4266			switch v := interface{}(item).(type) {
4267			case interface{ ValidateAll() error }:
4268				if err := v.ValidateAll(); err != nil {
4269					errors = append(errors, RateLimitValidationError{
4270						field:  fmt.Sprintf("Actions[%v]", idx),
4271						reason: "embedded message failed validation",
4272						cause:  err,
4273					})
4274				}
4275			case interface{ Validate() error }:
4276				if err := v.Validate(); err != nil {
4277					errors = append(errors, RateLimitValidationError{
4278						field:  fmt.Sprintf("Actions[%v]", idx),
4279						reason: "embedded message failed validation",
4280						cause:  err,
4281					})
4282				}
4283			}
4284		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
4285			if err := v.Validate(); err != nil {
4286				return RateLimitValidationError{
4287					field:  fmt.Sprintf("Actions[%v]", idx),
4288					reason: "embedded message failed validation",
4289					cause:  err,
4290				}
4291			}
4292		}
4293
4294	}
4295
4296	if len(errors) > 0 {
4297		return RateLimitMultiError(errors)
4298	}
4299	return nil
4300}
4301
4302// RateLimitMultiError is an error wrapping multiple validation errors returned
4303// by RateLimit.ValidateAll() if the designated constraints aren't met.
4304type RateLimitMultiError []error
4305
4306// Error returns a concatenation of all the error messages it wraps.
4307func (m RateLimitMultiError) Error() string {
4308	var msgs []string
4309	for _, err := range m {
4310		msgs = append(msgs, err.Error())
4311	}
4312	return strings.Join(msgs, "; ")
4313}
4314
4315// AllErrors returns a list of validation violation errors.
4316func (m RateLimitMultiError) AllErrors() []error { return m }
4317
4318// RateLimitValidationError is the validation error returned by
4319// RateLimit.Validate if the designated constraints aren't met.
4320type RateLimitValidationError struct {
4321	field  string
4322	reason string
4323	cause  error
4324	key    bool
4325}
4326
4327// Field function returns field value.
4328func (e RateLimitValidationError) Field() string { return e.field }
4329
4330// Reason function returns reason value.
4331func (e RateLimitValidationError) Reason() string { return e.reason }
4332
4333// Cause function returns cause value.
4334func (e RateLimitValidationError) Cause() error { return e.cause }
4335
4336// Key function returns key value.
4337func (e RateLimitValidationError) Key() bool { return e.key }
4338
4339// ErrorName returns error name.
4340func (e RateLimitValidationError) ErrorName() string { return "RateLimitValidationError" }
4341
4342// Error satisfies the builtin error interface
4343func (e RateLimitValidationError) Error() string {
4344	cause := ""
4345	if e.cause != nil {
4346		cause = fmt.Sprintf(" | caused by: %v", e.cause)
4347	}
4348
4349	key := ""
4350	if e.key {
4351		key = "key for "
4352	}
4353
4354	return fmt.Sprintf(
4355		"invalid %sRateLimit.%s: %s%s",
4356		key,
4357		e.field,
4358		e.reason,
4359		cause)
4360}
4361
4362var _ error = RateLimitValidationError{}
4363
4364var _ interface {
4365	Field() string
4366	Reason() string
4367	Key() bool
4368	Cause() error
4369	ErrorName() string
4370} = RateLimitValidationError{}
4371
4372// Validate checks the field values on HeaderMatcher with the rules defined in
4373// the proto definition for this message. If any rules are violated, the first
4374// error encountered is returned, or nil if there are no violations.
4375func (m *HeaderMatcher) Validate() error {
4376	return m.validate(false)
4377}
4378
4379// ValidateAll checks the field values on HeaderMatcher with the rules defined
4380// in the proto definition for this message. If any rules are violated, the
4381// result is a list of violation errors wrapped in HeaderMatcherMultiError, or
4382// nil if none found.
4383func (m *HeaderMatcher) ValidateAll() error {
4384	return m.validate(true)
4385}
4386
4387func (m *HeaderMatcher) validate(all bool) error {
4388	if m == nil {
4389		return nil
4390	}
4391
4392	var errors []error
4393
4394	if len(m.GetName()) < 1 {
4395		err := HeaderMatcherValidationError{
4396			field:  "Name",
4397			reason: "value length must be at least 1 bytes",
4398		}
4399		if !all {
4400			return err
4401		}
4402		errors = append(errors, err)
4403	}
4404
4405	if !_HeaderMatcher_Name_Pattern.MatchString(m.GetName()) {
4406		err := HeaderMatcherValidationError{
4407			field:  "Name",
4408			reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
4409		}
4410		if !all {
4411			return err
4412		}
4413		errors = append(errors, err)
4414	}
4415
4416	// no validation rules for InvertMatch
4417
4418	switch m.HeaderMatchSpecifier.(type) {
4419
4420	case *HeaderMatcher_ExactMatch:
4421		// no validation rules for ExactMatch
4422
4423	case *HeaderMatcher_RegexMatch:
4424
4425		if len(m.GetRegexMatch()) > 1024 {
4426			err := HeaderMatcherValidationError{
4427				field:  "RegexMatch",
4428				reason: "value length must be at most 1024 bytes",
4429			}
4430			if !all {
4431				return err
4432			}
4433			errors = append(errors, err)
4434		}
4435
4436	case *HeaderMatcher_SafeRegexMatch:
4437
4438		if all {
4439			switch v := interface{}(m.GetSafeRegexMatch()).(type) {
4440			case interface{ ValidateAll() error }:
4441				if err := v.ValidateAll(); err != nil {
4442					errors = append(errors, HeaderMatcherValidationError{
4443						field:  "SafeRegexMatch",
4444						reason: "embedded message failed validation",
4445						cause:  err,
4446					})
4447				}
4448			case interface{ Validate() error }:
4449				if err := v.Validate(); err != nil {
4450					errors = append(errors, HeaderMatcherValidationError{
4451						field:  "SafeRegexMatch",
4452						reason: "embedded message failed validation",
4453						cause:  err,
4454					})
4455				}
4456			}
4457		} else if v, ok := interface{}(m.GetSafeRegexMatch()).(interface{ Validate() error }); ok {
4458			if err := v.Validate(); err != nil {
4459				return HeaderMatcherValidationError{
4460					field:  "SafeRegexMatch",
4461					reason: "embedded message failed validation",
4462					cause:  err,
4463				}
4464			}
4465		}
4466
4467	case *HeaderMatcher_RangeMatch:
4468
4469		if all {
4470			switch v := interface{}(m.GetRangeMatch()).(type) {
4471			case interface{ ValidateAll() error }:
4472				if err := v.ValidateAll(); err != nil {
4473					errors = append(errors, HeaderMatcherValidationError{
4474						field:  "RangeMatch",
4475						reason: "embedded message failed validation",
4476						cause:  err,
4477					})
4478				}
4479			case interface{ Validate() error }:
4480				if err := v.Validate(); err != nil {
4481					errors = append(errors, HeaderMatcherValidationError{
4482						field:  "RangeMatch",
4483						reason: "embedded message failed validation",
4484						cause:  err,
4485					})
4486				}
4487			}
4488		} else if v, ok := interface{}(m.GetRangeMatch()).(interface{ Validate() error }); ok {
4489			if err := v.Validate(); err != nil {
4490				return HeaderMatcherValidationError{
4491					field:  "RangeMatch",
4492					reason: "embedded message failed validation",
4493					cause:  err,
4494				}
4495			}
4496		}
4497
4498	case *HeaderMatcher_PresentMatch:
4499		// no validation rules for PresentMatch
4500
4501	case *HeaderMatcher_PrefixMatch:
4502
4503		if len(m.GetPrefixMatch()) < 1 {
4504			err := HeaderMatcherValidationError{
4505				field:  "PrefixMatch",
4506				reason: "value length must be at least 1 bytes",
4507			}
4508			if !all {
4509				return err
4510			}
4511			errors = append(errors, err)
4512		}
4513
4514	case *HeaderMatcher_SuffixMatch:
4515
4516		if len(m.GetSuffixMatch()) < 1 {
4517			err := HeaderMatcherValidationError{
4518				field:  "SuffixMatch",
4519				reason: "value length must be at least 1 bytes",
4520			}
4521			if !all {
4522				return err
4523			}
4524			errors = append(errors, err)
4525		}
4526
4527	}
4528
4529	if len(errors) > 0 {
4530		return HeaderMatcherMultiError(errors)
4531	}
4532	return nil
4533}
4534
4535// HeaderMatcherMultiError is an error wrapping multiple validation errors
4536// returned by HeaderMatcher.ValidateAll() if the designated constraints
4537// aren't met.
4538type HeaderMatcherMultiError []error
4539
4540// Error returns a concatenation of all the error messages it wraps.
4541func (m HeaderMatcherMultiError) Error() string {
4542	var msgs []string
4543	for _, err := range m {
4544		msgs = append(msgs, err.Error())
4545	}
4546	return strings.Join(msgs, "; ")
4547}
4548
4549// AllErrors returns a list of validation violation errors.
4550func (m HeaderMatcherMultiError) AllErrors() []error { return m }
4551
4552// HeaderMatcherValidationError is the validation error returned by
4553// HeaderMatcher.Validate if the designated constraints aren't met.
4554type HeaderMatcherValidationError struct {
4555	field  string
4556	reason string
4557	cause  error
4558	key    bool
4559}
4560
4561// Field function returns field value.
4562func (e HeaderMatcherValidationError) Field() string { return e.field }
4563
4564// Reason function returns reason value.
4565func (e HeaderMatcherValidationError) Reason() string { return e.reason }
4566
4567// Cause function returns cause value.
4568func (e HeaderMatcherValidationError) Cause() error { return e.cause }
4569
4570// Key function returns key value.
4571func (e HeaderMatcherValidationError) Key() bool { return e.key }
4572
4573// ErrorName returns error name.
4574func (e HeaderMatcherValidationError) ErrorName() string { return "HeaderMatcherValidationError" }
4575
4576// Error satisfies the builtin error interface
4577func (e HeaderMatcherValidationError) Error() string {
4578	cause := ""
4579	if e.cause != nil {
4580		cause = fmt.Sprintf(" | caused by: %v", e.cause)
4581	}
4582
4583	key := ""
4584	if e.key {
4585		key = "key for "
4586	}
4587
4588	return fmt.Sprintf(
4589		"invalid %sHeaderMatcher.%s: %s%s",
4590		key,
4591		e.field,
4592		e.reason,
4593		cause)
4594}
4595
4596var _ error = HeaderMatcherValidationError{}
4597
4598var _ interface {
4599	Field() string
4600	Reason() string
4601	Key() bool
4602	Cause() error
4603	ErrorName() string
4604} = HeaderMatcherValidationError{}
4605
4606var _HeaderMatcher_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
4607
4608// Validate checks the field values on QueryParameterMatcher with the rules
4609// defined in the proto definition for this message. If any rules are
4610// violated, the first error encountered is returned, or nil if there are no violations.
4611func (m *QueryParameterMatcher) Validate() error {
4612	return m.validate(false)
4613}
4614
4615// ValidateAll checks the field values on QueryParameterMatcher with the rules
4616// defined in the proto definition for this message. If any rules are
4617// violated, the result is a list of violation errors wrapped in
4618// QueryParameterMatcherMultiError, or nil if none found.
4619func (m *QueryParameterMatcher) ValidateAll() error {
4620	return m.validate(true)
4621}
4622
4623func (m *QueryParameterMatcher) validate(all bool) error {
4624	if m == nil {
4625		return nil
4626	}
4627
4628	var errors []error
4629
4630	if l := len(m.GetName()); l < 1 || l > 1024 {
4631		err := QueryParameterMatcherValidationError{
4632			field:  "Name",
4633			reason: "value length must be between 1 and 1024 bytes, inclusive",
4634		}
4635		if !all {
4636			return err
4637		}
4638		errors = append(errors, err)
4639	}
4640
4641	// no validation rules for Value
4642
4643	if all {
4644		switch v := interface{}(m.GetRegex()).(type) {
4645		case interface{ ValidateAll() error }:
4646			if err := v.ValidateAll(); err != nil {
4647				errors = append(errors, QueryParameterMatcherValidationError{
4648					field:  "Regex",
4649					reason: "embedded message failed validation",
4650					cause:  err,
4651				})
4652			}
4653		case interface{ Validate() error }:
4654			if err := v.Validate(); err != nil {
4655				errors = append(errors, QueryParameterMatcherValidationError{
4656					field:  "Regex",
4657					reason: "embedded message failed validation",
4658					cause:  err,
4659				})
4660			}
4661		}
4662	} else if v, ok := interface{}(m.GetRegex()).(interface{ Validate() error }); ok {
4663		if err := v.Validate(); err != nil {
4664			return QueryParameterMatcherValidationError{
4665				field:  "Regex",
4666				reason: "embedded message failed validation",
4667				cause:  err,
4668			}
4669		}
4670	}
4671
4672	switch m.QueryParameterMatchSpecifier.(type) {
4673
4674	case *QueryParameterMatcher_StringMatch:
4675
4676		if m.GetStringMatch() == nil {
4677			err := QueryParameterMatcherValidationError{
4678				field:  "StringMatch",
4679				reason: "value is required",
4680			}
4681			if !all {
4682				return err
4683			}
4684			errors = append(errors, err)
4685		}
4686
4687		if all {
4688			switch v := interface{}(m.GetStringMatch()).(type) {
4689			case interface{ ValidateAll() error }:
4690				if err := v.ValidateAll(); err != nil {
4691					errors = append(errors, QueryParameterMatcherValidationError{
4692						field:  "StringMatch",
4693						reason: "embedded message failed validation",
4694						cause:  err,
4695					})
4696				}
4697			case interface{ Validate() error }:
4698				if err := v.Validate(); err != nil {
4699					errors = append(errors, QueryParameterMatcherValidationError{
4700						field:  "StringMatch",
4701						reason: "embedded message failed validation",
4702						cause:  err,
4703					})
4704				}
4705			}
4706		} else if v, ok := interface{}(m.GetStringMatch()).(interface{ Validate() error }); ok {
4707			if err := v.Validate(); err != nil {
4708				return QueryParameterMatcherValidationError{
4709					field:  "StringMatch",
4710					reason: "embedded message failed validation",
4711					cause:  err,
4712				}
4713			}
4714		}
4715
4716	case *QueryParameterMatcher_PresentMatch:
4717		// no validation rules for PresentMatch
4718
4719	}
4720
4721	if len(errors) > 0 {
4722		return QueryParameterMatcherMultiError(errors)
4723	}
4724	return nil
4725}
4726
4727// QueryParameterMatcherMultiError is an error wrapping multiple validation
4728// errors returned by QueryParameterMatcher.ValidateAll() if the designated
4729// constraints aren't met.
4730type QueryParameterMatcherMultiError []error
4731
4732// Error returns a concatenation of all the error messages it wraps.
4733func (m QueryParameterMatcherMultiError) Error() string {
4734	var msgs []string
4735	for _, err := range m {
4736		msgs = append(msgs, err.Error())
4737	}
4738	return strings.Join(msgs, "; ")
4739}
4740
4741// AllErrors returns a list of validation violation errors.
4742func (m QueryParameterMatcherMultiError) AllErrors() []error { return m }
4743
4744// QueryParameterMatcherValidationError is the validation error returned by
4745// QueryParameterMatcher.Validate if the designated constraints aren't met.
4746type QueryParameterMatcherValidationError struct {
4747	field  string
4748	reason string
4749	cause  error
4750	key    bool
4751}
4752
4753// Field function returns field value.
4754func (e QueryParameterMatcherValidationError) Field() string { return e.field }
4755
4756// Reason function returns reason value.
4757func (e QueryParameterMatcherValidationError) Reason() string { return e.reason }
4758
4759// Cause function returns cause value.
4760func (e QueryParameterMatcherValidationError) Cause() error { return e.cause }
4761
4762// Key function returns key value.
4763func (e QueryParameterMatcherValidationError) Key() bool { return e.key }
4764
4765// ErrorName returns error name.
4766func (e QueryParameterMatcherValidationError) ErrorName() string {
4767	return "QueryParameterMatcherValidationError"
4768}
4769
4770// Error satisfies the builtin error interface
4771func (e QueryParameterMatcherValidationError) Error() string {
4772	cause := ""
4773	if e.cause != nil {
4774		cause = fmt.Sprintf(" | caused by: %v", e.cause)
4775	}
4776
4777	key := ""
4778	if e.key {
4779		key = "key for "
4780	}
4781
4782	return fmt.Sprintf(
4783		"invalid %sQueryParameterMatcher.%s: %s%s",
4784		key,
4785		e.field,
4786		e.reason,
4787		cause)
4788}
4789
4790var _ error = QueryParameterMatcherValidationError{}
4791
4792var _ interface {
4793	Field() string
4794	Reason() string
4795	Key() bool
4796	Cause() error
4797	ErrorName() string
4798} = QueryParameterMatcherValidationError{}
4799
4800// Validate checks the field values on WeightedCluster_ClusterWeight with the
4801// rules defined in the proto definition for this message. If any rules are
4802// violated, the first error encountered is returned, or nil if there are no violations.
4803func (m *WeightedCluster_ClusterWeight) Validate() error {
4804	return m.validate(false)
4805}
4806
4807// ValidateAll checks the field values on WeightedCluster_ClusterWeight with
4808// the rules defined in the proto definition for this message. If any rules
4809// are violated, the result is a list of violation errors wrapped in
4810// WeightedCluster_ClusterWeightMultiError, or nil if none found.
4811func (m *WeightedCluster_ClusterWeight) ValidateAll() error {
4812	return m.validate(true)
4813}
4814
4815func (m *WeightedCluster_ClusterWeight) validate(all bool) error {
4816	if m == nil {
4817		return nil
4818	}
4819
4820	var errors []error
4821
4822	if len(m.GetName()) < 1 {
4823		err := WeightedCluster_ClusterWeightValidationError{
4824			field:  "Name",
4825			reason: "value length must be at least 1 bytes",
4826		}
4827		if !all {
4828			return err
4829		}
4830		errors = append(errors, err)
4831	}
4832
4833	if all {
4834		switch v := interface{}(m.GetWeight()).(type) {
4835		case interface{ ValidateAll() error }:
4836			if err := v.ValidateAll(); err != nil {
4837				errors = append(errors, WeightedCluster_ClusterWeightValidationError{
4838					field:  "Weight",
4839					reason: "embedded message failed validation",
4840					cause:  err,
4841				})
4842			}
4843		case interface{ Validate() error }:
4844			if err := v.Validate(); err != nil {
4845				errors = append(errors, WeightedCluster_ClusterWeightValidationError{
4846					field:  "Weight",
4847					reason: "embedded message failed validation",
4848					cause:  err,
4849				})
4850			}
4851		}
4852	} else if v, ok := interface{}(m.GetWeight()).(interface{ Validate() error }); ok {
4853		if err := v.Validate(); err != nil {
4854			return WeightedCluster_ClusterWeightValidationError{
4855				field:  "Weight",
4856				reason: "embedded message failed validation",
4857				cause:  err,
4858			}
4859		}
4860	}
4861
4862	if all {
4863		switch v := interface{}(m.GetMetadataMatch()).(type) {
4864		case interface{ ValidateAll() error }:
4865			if err := v.ValidateAll(); err != nil {
4866				errors = append(errors, WeightedCluster_ClusterWeightValidationError{
4867					field:  "MetadataMatch",
4868					reason: "embedded message failed validation",
4869					cause:  err,
4870				})
4871			}
4872		case interface{ Validate() error }:
4873			if err := v.Validate(); err != nil {
4874				errors = append(errors, WeightedCluster_ClusterWeightValidationError{
4875					field:  "MetadataMatch",
4876					reason: "embedded message failed validation",
4877					cause:  err,
4878				})
4879			}
4880		}
4881	} else if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok {
4882		if err := v.Validate(); err != nil {
4883			return WeightedCluster_ClusterWeightValidationError{
4884				field:  "MetadataMatch",
4885				reason: "embedded message failed validation",
4886				cause:  err,
4887			}
4888		}
4889	}
4890
4891	if len(m.GetRequestHeadersToAdd()) > 1000 {
4892		err := WeightedCluster_ClusterWeightValidationError{
4893			field:  "RequestHeadersToAdd",
4894			reason: "value must contain no more than 1000 item(s)",
4895		}
4896		if !all {
4897			return err
4898		}
4899		errors = append(errors, err)
4900	}
4901
4902	for idx, item := range m.GetRequestHeadersToAdd() {
4903		_, _ = idx, item
4904
4905		if all {
4906			switch v := interface{}(item).(type) {
4907			case interface{ ValidateAll() error }:
4908				if err := v.ValidateAll(); err != nil {
4909					errors = append(errors, WeightedCluster_ClusterWeightValidationError{
4910						field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
4911						reason: "embedded message failed validation",
4912						cause:  err,
4913					})
4914				}
4915			case interface{ Validate() error }:
4916				if err := v.Validate(); err != nil {
4917					errors = append(errors, WeightedCluster_ClusterWeightValidationError{
4918						field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
4919						reason: "embedded message failed validation",
4920						cause:  err,
4921					})
4922				}
4923			}
4924		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
4925			if err := v.Validate(); err != nil {
4926				return WeightedCluster_ClusterWeightValidationError{
4927					field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
4928					reason: "embedded message failed validation",
4929					cause:  err,
4930				}
4931			}
4932		}
4933
4934	}
4935
4936	if len(m.GetResponseHeadersToAdd()) > 1000 {
4937		err := WeightedCluster_ClusterWeightValidationError{
4938			field:  "ResponseHeadersToAdd",
4939			reason: "value must contain no more than 1000 item(s)",
4940		}
4941		if !all {
4942			return err
4943		}
4944		errors = append(errors, err)
4945	}
4946
4947	for idx, item := range m.GetResponseHeadersToAdd() {
4948		_, _ = idx, item
4949
4950		if all {
4951			switch v := interface{}(item).(type) {
4952			case interface{ ValidateAll() error }:
4953				if err := v.ValidateAll(); err != nil {
4954					errors = append(errors, WeightedCluster_ClusterWeightValidationError{
4955						field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
4956						reason: "embedded message failed validation",
4957						cause:  err,
4958					})
4959				}
4960			case interface{ Validate() error }:
4961				if err := v.Validate(); err != nil {
4962					errors = append(errors, WeightedCluster_ClusterWeightValidationError{
4963						field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
4964						reason: "embedded message failed validation",
4965						cause:  err,
4966					})
4967				}
4968			}
4969		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
4970			if err := v.Validate(); err != nil {
4971				return WeightedCluster_ClusterWeightValidationError{
4972					field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
4973					reason: "embedded message failed validation",
4974					cause:  err,
4975				}
4976			}
4977		}
4978
4979	}
4980
4981	{
4982		sorted_keys := make([]string, len(m.GetPerFilterConfig()))
4983		i := 0
4984		for key := range m.GetPerFilterConfig() {
4985			sorted_keys[i] = key
4986			i++
4987		}
4988		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
4989		for _, key := range sorted_keys {
4990			val := m.GetPerFilterConfig()[key]
4991			_ = val
4992
4993			// no validation rules for PerFilterConfig[key]
4994
4995			if all {
4996				switch v := interface{}(val).(type) {
4997				case interface{ ValidateAll() error }:
4998					if err := v.ValidateAll(); err != nil {
4999						errors = append(errors, WeightedCluster_ClusterWeightValidationError{
5000							field:  fmt.Sprintf("PerFilterConfig[%v]", key),
5001							reason: "embedded message failed validation",
5002							cause:  err,
5003						})
5004					}
5005				case interface{ Validate() error }:
5006					if err := v.Validate(); err != nil {
5007						errors = append(errors, WeightedCluster_ClusterWeightValidationError{
5008							field:  fmt.Sprintf("PerFilterConfig[%v]", key),
5009							reason: "embedded message failed validation",
5010							cause:  err,
5011						})
5012					}
5013				}
5014			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
5015				if err := v.Validate(); err != nil {
5016					return WeightedCluster_ClusterWeightValidationError{
5017						field:  fmt.Sprintf("PerFilterConfig[%v]", key),
5018						reason: "embedded message failed validation",
5019						cause:  err,
5020					}
5021				}
5022			}
5023
5024		}
5025	}
5026
5027	{
5028		sorted_keys := make([]string, len(m.GetTypedPerFilterConfig()))
5029		i := 0
5030		for key := range m.GetTypedPerFilterConfig() {
5031			sorted_keys[i] = key
5032			i++
5033		}
5034		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
5035		for _, key := range sorted_keys {
5036			val := m.GetTypedPerFilterConfig()[key]
5037			_ = val
5038
5039			// no validation rules for TypedPerFilterConfig[key]
5040
5041			if all {
5042				switch v := interface{}(val).(type) {
5043				case interface{ ValidateAll() error }:
5044					if err := v.ValidateAll(); err != nil {
5045						errors = append(errors, WeightedCluster_ClusterWeightValidationError{
5046							field:  fmt.Sprintf("TypedPerFilterConfig[%v]", key),
5047							reason: "embedded message failed validation",
5048							cause:  err,
5049						})
5050					}
5051				case interface{ Validate() error }:
5052					if err := v.Validate(); err != nil {
5053						errors = append(errors, WeightedCluster_ClusterWeightValidationError{
5054							field:  fmt.Sprintf("TypedPerFilterConfig[%v]", key),
5055							reason: "embedded message failed validation",
5056							cause:  err,
5057						})
5058					}
5059				}
5060			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
5061				if err := v.Validate(); err != nil {
5062					return WeightedCluster_ClusterWeightValidationError{
5063						field:  fmt.Sprintf("TypedPerFilterConfig[%v]", key),
5064						reason: "embedded message failed validation",
5065						cause:  err,
5066					}
5067				}
5068			}
5069
5070		}
5071	}
5072
5073	if len(errors) > 0 {
5074		return WeightedCluster_ClusterWeightMultiError(errors)
5075	}
5076	return nil
5077}
5078
5079// WeightedCluster_ClusterWeightMultiError is an error wrapping multiple
5080// validation errors returned by WeightedCluster_ClusterWeight.ValidateAll()
5081// if the designated constraints aren't met.
5082type WeightedCluster_ClusterWeightMultiError []error
5083
5084// Error returns a concatenation of all the error messages it wraps.
5085func (m WeightedCluster_ClusterWeightMultiError) Error() string {
5086	var msgs []string
5087	for _, err := range m {
5088		msgs = append(msgs, err.Error())
5089	}
5090	return strings.Join(msgs, "; ")
5091}
5092
5093// AllErrors returns a list of validation violation errors.
5094func (m WeightedCluster_ClusterWeightMultiError) AllErrors() []error { return m }
5095
5096// WeightedCluster_ClusterWeightValidationError is the validation error
5097// returned by WeightedCluster_ClusterWeight.Validate if the designated
5098// constraints aren't met.
5099type WeightedCluster_ClusterWeightValidationError struct {
5100	field  string
5101	reason string
5102	cause  error
5103	key    bool
5104}
5105
5106// Field function returns field value.
5107func (e WeightedCluster_ClusterWeightValidationError) Field() string { return e.field }
5108
5109// Reason function returns reason value.
5110func (e WeightedCluster_ClusterWeightValidationError) Reason() string { return e.reason }
5111
5112// Cause function returns cause value.
5113func (e WeightedCluster_ClusterWeightValidationError) Cause() error { return e.cause }
5114
5115// Key function returns key value.
5116func (e WeightedCluster_ClusterWeightValidationError) Key() bool { return e.key }
5117
5118// ErrorName returns error name.
5119func (e WeightedCluster_ClusterWeightValidationError) ErrorName() string {
5120	return "WeightedCluster_ClusterWeightValidationError"
5121}
5122
5123// Error satisfies the builtin error interface
5124func (e WeightedCluster_ClusterWeightValidationError) Error() string {
5125	cause := ""
5126	if e.cause != nil {
5127		cause = fmt.Sprintf(" | caused by: %v", e.cause)
5128	}
5129
5130	key := ""
5131	if e.key {
5132		key = "key for "
5133	}
5134
5135	return fmt.Sprintf(
5136		"invalid %sWeightedCluster_ClusterWeight.%s: %s%s",
5137		key,
5138		e.field,
5139		e.reason,
5140		cause)
5141}
5142
5143var _ error = WeightedCluster_ClusterWeightValidationError{}
5144
5145var _ interface {
5146	Field() string
5147	Reason() string
5148	Key() bool
5149	Cause() error
5150	ErrorName() string
5151} = WeightedCluster_ClusterWeightValidationError{}
5152
5153// Validate checks the field values on RouteMatch_GrpcRouteMatchOptions with
5154// the rules defined in the proto definition for this message. If any rules
5155// are violated, the first error encountered is returned, or nil if there are
5156// no violations.
5157func (m *RouteMatch_GrpcRouteMatchOptions) Validate() error {
5158	return m.validate(false)
5159}
5160
5161// ValidateAll checks the field values on RouteMatch_GrpcRouteMatchOptions with
5162// the rules defined in the proto definition for this message. If any rules
5163// are violated, the result is a list of violation errors wrapped in
5164// RouteMatch_GrpcRouteMatchOptionsMultiError, or nil if none found.
5165func (m *RouteMatch_GrpcRouteMatchOptions) ValidateAll() error {
5166	return m.validate(true)
5167}
5168
5169func (m *RouteMatch_GrpcRouteMatchOptions) validate(all bool) error {
5170	if m == nil {
5171		return nil
5172	}
5173
5174	var errors []error
5175
5176	if len(errors) > 0 {
5177		return RouteMatch_GrpcRouteMatchOptionsMultiError(errors)
5178	}
5179	return nil
5180}
5181
5182// RouteMatch_GrpcRouteMatchOptionsMultiError is an error wrapping multiple
5183// validation errors returned by
5184// RouteMatch_GrpcRouteMatchOptions.ValidateAll() if the designated
5185// constraints aren't met.
5186type RouteMatch_GrpcRouteMatchOptionsMultiError []error
5187
5188// Error returns a concatenation of all the error messages it wraps.
5189func (m RouteMatch_GrpcRouteMatchOptionsMultiError) Error() string {
5190	var msgs []string
5191	for _, err := range m {
5192		msgs = append(msgs, err.Error())
5193	}
5194	return strings.Join(msgs, "; ")
5195}
5196
5197// AllErrors returns a list of validation violation errors.
5198func (m RouteMatch_GrpcRouteMatchOptionsMultiError) AllErrors() []error { return m }
5199
5200// RouteMatch_GrpcRouteMatchOptionsValidationError is the validation error
5201// returned by RouteMatch_GrpcRouteMatchOptions.Validate if the designated
5202// constraints aren't met.
5203type RouteMatch_GrpcRouteMatchOptionsValidationError struct {
5204	field  string
5205	reason string
5206	cause  error
5207	key    bool
5208}
5209
5210// Field function returns field value.
5211func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Field() string { return e.field }
5212
5213// Reason function returns reason value.
5214func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Reason() string { return e.reason }
5215
5216// Cause function returns cause value.
5217func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Cause() error { return e.cause }
5218
5219// Key function returns key value.
5220func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Key() bool { return e.key }
5221
5222// ErrorName returns error name.
5223func (e RouteMatch_GrpcRouteMatchOptionsValidationError) ErrorName() string {
5224	return "RouteMatch_GrpcRouteMatchOptionsValidationError"
5225}
5226
5227// Error satisfies the builtin error interface
5228func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Error() string {
5229	cause := ""
5230	if e.cause != nil {
5231		cause = fmt.Sprintf(" | caused by: %v", e.cause)
5232	}
5233
5234	key := ""
5235	if e.key {
5236		key = "key for "
5237	}
5238
5239	return fmt.Sprintf(
5240		"invalid %sRouteMatch_GrpcRouteMatchOptions.%s: %s%s",
5241		key,
5242		e.field,
5243		e.reason,
5244		cause)
5245}
5246
5247var _ error = RouteMatch_GrpcRouteMatchOptionsValidationError{}
5248
5249var _ interface {
5250	Field() string
5251	Reason() string
5252	Key() bool
5253	Cause() error
5254	ErrorName() string
5255} = RouteMatch_GrpcRouteMatchOptionsValidationError{}
5256
5257// Validate checks the field values on RouteMatch_TlsContextMatchOptions with
5258// the rules defined in the proto definition for this message. If any rules
5259// are violated, the first error encountered is returned, or nil if there are
5260// no violations.
5261func (m *RouteMatch_TlsContextMatchOptions) Validate() error {
5262	return m.validate(false)
5263}
5264
5265// ValidateAll checks the field values on RouteMatch_TlsContextMatchOptions
5266// with the rules defined in the proto definition for this message. If any
5267// rules are violated, the result is a list of violation errors wrapped in
5268// RouteMatch_TlsContextMatchOptionsMultiError, or nil if none found.
5269func (m *RouteMatch_TlsContextMatchOptions) ValidateAll() error {
5270	return m.validate(true)
5271}
5272
5273func (m *RouteMatch_TlsContextMatchOptions) validate(all bool) error {
5274	if m == nil {
5275		return nil
5276	}
5277
5278	var errors []error
5279
5280	if all {
5281		switch v := interface{}(m.GetPresented()).(type) {
5282		case interface{ ValidateAll() error }:
5283			if err := v.ValidateAll(); err != nil {
5284				errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{
5285					field:  "Presented",
5286					reason: "embedded message failed validation",
5287					cause:  err,
5288				})
5289			}
5290		case interface{ Validate() error }:
5291			if err := v.Validate(); err != nil {
5292				errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{
5293					field:  "Presented",
5294					reason: "embedded message failed validation",
5295					cause:  err,
5296				})
5297			}
5298		}
5299	} else if v, ok := interface{}(m.GetPresented()).(interface{ Validate() error }); ok {
5300		if err := v.Validate(); err != nil {
5301			return RouteMatch_TlsContextMatchOptionsValidationError{
5302				field:  "Presented",
5303				reason: "embedded message failed validation",
5304				cause:  err,
5305			}
5306		}
5307	}
5308
5309	if all {
5310		switch v := interface{}(m.GetValidated()).(type) {
5311		case interface{ ValidateAll() error }:
5312			if err := v.ValidateAll(); err != nil {
5313				errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{
5314					field:  "Validated",
5315					reason: "embedded message failed validation",
5316					cause:  err,
5317				})
5318			}
5319		case interface{ Validate() error }:
5320			if err := v.Validate(); err != nil {
5321				errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{
5322					field:  "Validated",
5323					reason: "embedded message failed validation",
5324					cause:  err,
5325				})
5326			}
5327		}
5328	} else if v, ok := interface{}(m.GetValidated()).(interface{ Validate() error }); ok {
5329		if err := v.Validate(); err != nil {
5330			return RouteMatch_TlsContextMatchOptionsValidationError{
5331				field:  "Validated",
5332				reason: "embedded message failed validation",
5333				cause:  err,
5334			}
5335		}
5336	}
5337
5338	if len(errors) > 0 {
5339		return RouteMatch_TlsContextMatchOptionsMultiError(errors)
5340	}
5341	return nil
5342}
5343
5344// RouteMatch_TlsContextMatchOptionsMultiError is an error wrapping multiple
5345// validation errors returned by
5346// RouteMatch_TlsContextMatchOptions.ValidateAll() if the designated
5347// constraints aren't met.
5348type RouteMatch_TlsContextMatchOptionsMultiError []error
5349
5350// Error returns a concatenation of all the error messages it wraps.
5351func (m RouteMatch_TlsContextMatchOptionsMultiError) Error() string {
5352	var msgs []string
5353	for _, err := range m {
5354		msgs = append(msgs, err.Error())
5355	}
5356	return strings.Join(msgs, "; ")
5357}
5358
5359// AllErrors returns a list of validation violation errors.
5360func (m RouteMatch_TlsContextMatchOptionsMultiError) AllErrors() []error { return m }
5361
5362// RouteMatch_TlsContextMatchOptionsValidationError is the validation error
5363// returned by RouteMatch_TlsContextMatchOptions.Validate if the designated
5364// constraints aren't met.
5365type RouteMatch_TlsContextMatchOptionsValidationError struct {
5366	field  string
5367	reason string
5368	cause  error
5369	key    bool
5370}
5371
5372// Field function returns field value.
5373func (e RouteMatch_TlsContextMatchOptionsValidationError) Field() string { return e.field }
5374
5375// Reason function returns reason value.
5376func (e RouteMatch_TlsContextMatchOptionsValidationError) Reason() string { return e.reason }
5377
5378// Cause function returns cause value.
5379func (e RouteMatch_TlsContextMatchOptionsValidationError) Cause() error { return e.cause }
5380
5381// Key function returns key value.
5382func (e RouteMatch_TlsContextMatchOptionsValidationError) Key() bool { return e.key }
5383
5384// ErrorName returns error name.
5385func (e RouteMatch_TlsContextMatchOptionsValidationError) ErrorName() string {
5386	return "RouteMatch_TlsContextMatchOptionsValidationError"
5387}
5388
5389// Error satisfies the builtin error interface
5390func (e RouteMatch_TlsContextMatchOptionsValidationError) Error() string {
5391	cause := ""
5392	if e.cause != nil {
5393		cause = fmt.Sprintf(" | caused by: %v", e.cause)
5394	}
5395
5396	key := ""
5397	if e.key {
5398		key = "key for "
5399	}
5400
5401	return fmt.Sprintf(
5402		"invalid %sRouteMatch_TlsContextMatchOptions.%s: %s%s",
5403		key,
5404		e.field,
5405		e.reason,
5406		cause)
5407}
5408
5409var _ error = RouteMatch_TlsContextMatchOptionsValidationError{}
5410
5411var _ interface {
5412	Field() string
5413	Reason() string
5414	Key() bool
5415	Cause() error
5416	ErrorName() string
5417} = RouteMatch_TlsContextMatchOptionsValidationError{}
5418
5419// Validate checks the field values on RouteAction_RequestMirrorPolicy with the
5420// rules defined in the proto definition for this message. If any rules are
5421// violated, the first error encountered is returned, or nil if there are no violations.
5422func (m *RouteAction_RequestMirrorPolicy) Validate() error {
5423	return m.validate(false)
5424}
5425
5426// ValidateAll checks the field values on RouteAction_RequestMirrorPolicy with
5427// the rules defined in the proto definition for this message. If any rules
5428// are violated, the result is a list of violation errors wrapped in
5429// RouteAction_RequestMirrorPolicyMultiError, or nil if none found.
5430func (m *RouteAction_RequestMirrorPolicy) ValidateAll() error {
5431	return m.validate(true)
5432}
5433
5434func (m *RouteAction_RequestMirrorPolicy) validate(all bool) error {
5435	if m == nil {
5436		return nil
5437	}
5438
5439	var errors []error
5440
5441	if len(m.GetCluster()) < 1 {
5442		err := RouteAction_RequestMirrorPolicyValidationError{
5443			field:  "Cluster",
5444			reason: "value length must be at least 1 bytes",
5445		}
5446		if !all {
5447			return err
5448		}
5449		errors = append(errors, err)
5450	}
5451
5452	// no validation rules for RuntimeKey
5453
5454	if all {
5455		switch v := interface{}(m.GetRuntimeFraction()).(type) {
5456		case interface{ ValidateAll() error }:
5457			if err := v.ValidateAll(); err != nil {
5458				errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{
5459					field:  "RuntimeFraction",
5460					reason: "embedded message failed validation",
5461					cause:  err,
5462				})
5463			}
5464		case interface{ Validate() error }:
5465			if err := v.Validate(); err != nil {
5466				errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{
5467					field:  "RuntimeFraction",
5468					reason: "embedded message failed validation",
5469					cause:  err,
5470				})
5471			}
5472		}
5473	} else if v, ok := interface{}(m.GetRuntimeFraction()).(interface{ Validate() error }); ok {
5474		if err := v.Validate(); err != nil {
5475			return RouteAction_RequestMirrorPolicyValidationError{
5476				field:  "RuntimeFraction",
5477				reason: "embedded message failed validation",
5478				cause:  err,
5479			}
5480		}
5481	}
5482
5483	if all {
5484		switch v := interface{}(m.GetTraceSampled()).(type) {
5485		case interface{ ValidateAll() error }:
5486			if err := v.ValidateAll(); err != nil {
5487				errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{
5488					field:  "TraceSampled",
5489					reason: "embedded message failed validation",
5490					cause:  err,
5491				})
5492			}
5493		case interface{ Validate() error }:
5494			if err := v.Validate(); err != nil {
5495				errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{
5496					field:  "TraceSampled",
5497					reason: "embedded message failed validation",
5498					cause:  err,
5499				})
5500			}
5501		}
5502	} else if v, ok := interface{}(m.GetTraceSampled()).(interface{ Validate() error }); ok {
5503		if err := v.Validate(); err != nil {
5504			return RouteAction_RequestMirrorPolicyValidationError{
5505				field:  "TraceSampled",
5506				reason: "embedded message failed validation",
5507				cause:  err,
5508			}
5509		}
5510	}
5511
5512	if len(errors) > 0 {
5513		return RouteAction_RequestMirrorPolicyMultiError(errors)
5514	}
5515	return nil
5516}
5517
5518// RouteAction_RequestMirrorPolicyMultiError is an error wrapping multiple
5519// validation errors returned by RouteAction_RequestMirrorPolicy.ValidateAll()
5520// if the designated constraints aren't met.
5521type RouteAction_RequestMirrorPolicyMultiError []error
5522
5523// Error returns a concatenation of all the error messages it wraps.
5524func (m RouteAction_RequestMirrorPolicyMultiError) Error() string {
5525	var msgs []string
5526	for _, err := range m {
5527		msgs = append(msgs, err.Error())
5528	}
5529	return strings.Join(msgs, "; ")
5530}
5531
5532// AllErrors returns a list of validation violation errors.
5533func (m RouteAction_RequestMirrorPolicyMultiError) AllErrors() []error { return m }
5534
5535// RouteAction_RequestMirrorPolicyValidationError is the validation error
5536// returned by RouteAction_RequestMirrorPolicy.Validate if the designated
5537// constraints aren't met.
5538type RouteAction_RequestMirrorPolicyValidationError struct {
5539	field  string
5540	reason string
5541	cause  error
5542	key    bool
5543}
5544
5545// Field function returns field value.
5546func (e RouteAction_RequestMirrorPolicyValidationError) Field() string { return e.field }
5547
5548// Reason function returns reason value.
5549func (e RouteAction_RequestMirrorPolicyValidationError) Reason() string { return e.reason }
5550
5551// Cause function returns cause value.
5552func (e RouteAction_RequestMirrorPolicyValidationError) Cause() error { return e.cause }
5553
5554// Key function returns key value.
5555func (e RouteAction_RequestMirrorPolicyValidationError) Key() bool { return e.key }
5556
5557// ErrorName returns error name.
5558func (e RouteAction_RequestMirrorPolicyValidationError) ErrorName() string {
5559	return "RouteAction_RequestMirrorPolicyValidationError"
5560}
5561
5562// Error satisfies the builtin error interface
5563func (e RouteAction_RequestMirrorPolicyValidationError) Error() string {
5564	cause := ""
5565	if e.cause != nil {
5566		cause = fmt.Sprintf(" | caused by: %v", e.cause)
5567	}
5568
5569	key := ""
5570	if e.key {
5571		key = "key for "
5572	}
5573
5574	return fmt.Sprintf(
5575		"invalid %sRouteAction_RequestMirrorPolicy.%s: %s%s",
5576		key,
5577		e.field,
5578		e.reason,
5579		cause)
5580}
5581
5582var _ error = RouteAction_RequestMirrorPolicyValidationError{}
5583
5584var _ interface {
5585	Field() string
5586	Reason() string
5587	Key() bool
5588	Cause() error
5589	ErrorName() string
5590} = RouteAction_RequestMirrorPolicyValidationError{}
5591
5592// Validate checks the field values on RouteAction_HashPolicy with the rules
5593// defined in the proto definition for this message. If any rules are
5594// violated, the first error encountered is returned, or nil if there are no violations.
5595func (m *RouteAction_HashPolicy) Validate() error {
5596	return m.validate(false)
5597}
5598
5599// ValidateAll checks the field values on RouteAction_HashPolicy with the rules
5600// defined in the proto definition for this message. If any rules are
5601// violated, the result is a list of violation errors wrapped in
5602// RouteAction_HashPolicyMultiError, or nil if none found.
5603func (m *RouteAction_HashPolicy) ValidateAll() error {
5604	return m.validate(true)
5605}
5606
5607func (m *RouteAction_HashPolicy) validate(all bool) error {
5608	if m == nil {
5609		return nil
5610	}
5611
5612	var errors []error
5613
5614	// no validation rules for Terminal
5615
5616	switch m.PolicySpecifier.(type) {
5617
5618	case *RouteAction_HashPolicy_Header_:
5619
5620		if all {
5621			switch v := interface{}(m.GetHeader()).(type) {
5622			case interface{ ValidateAll() error }:
5623				if err := v.ValidateAll(); err != nil {
5624					errors = append(errors, RouteAction_HashPolicyValidationError{
5625						field:  "Header",
5626						reason: "embedded message failed validation",
5627						cause:  err,
5628					})
5629				}
5630			case interface{ Validate() error }:
5631				if err := v.Validate(); err != nil {
5632					errors = append(errors, RouteAction_HashPolicyValidationError{
5633						field:  "Header",
5634						reason: "embedded message failed validation",
5635						cause:  err,
5636					})
5637				}
5638			}
5639		} else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
5640			if err := v.Validate(); err != nil {
5641				return RouteAction_HashPolicyValidationError{
5642					field:  "Header",
5643					reason: "embedded message failed validation",
5644					cause:  err,
5645				}
5646			}
5647		}
5648
5649	case *RouteAction_HashPolicy_Cookie_:
5650
5651		if all {
5652			switch v := interface{}(m.GetCookie()).(type) {
5653			case interface{ ValidateAll() error }:
5654				if err := v.ValidateAll(); err != nil {
5655					errors = append(errors, RouteAction_HashPolicyValidationError{
5656						field:  "Cookie",
5657						reason: "embedded message failed validation",
5658						cause:  err,
5659					})
5660				}
5661			case interface{ Validate() error }:
5662				if err := v.Validate(); err != nil {
5663					errors = append(errors, RouteAction_HashPolicyValidationError{
5664						field:  "Cookie",
5665						reason: "embedded message failed validation",
5666						cause:  err,
5667					})
5668				}
5669			}
5670		} else if v, ok := interface{}(m.GetCookie()).(interface{ Validate() error }); ok {
5671			if err := v.Validate(); err != nil {
5672				return RouteAction_HashPolicyValidationError{
5673					field:  "Cookie",
5674					reason: "embedded message failed validation",
5675					cause:  err,
5676				}
5677			}
5678		}
5679
5680	case *RouteAction_HashPolicy_ConnectionProperties_:
5681
5682		if all {
5683			switch v := interface{}(m.GetConnectionProperties()).(type) {
5684			case interface{ ValidateAll() error }:
5685				if err := v.ValidateAll(); err != nil {
5686					errors = append(errors, RouteAction_HashPolicyValidationError{
5687						field:  "ConnectionProperties",
5688						reason: "embedded message failed validation",
5689						cause:  err,
5690					})
5691				}
5692			case interface{ Validate() error }:
5693				if err := v.Validate(); err != nil {
5694					errors = append(errors, RouteAction_HashPolicyValidationError{
5695						field:  "ConnectionProperties",
5696						reason: "embedded message failed validation",
5697						cause:  err,
5698					})
5699				}
5700			}
5701		} else if v, ok := interface{}(m.GetConnectionProperties()).(interface{ Validate() error }); ok {
5702			if err := v.Validate(); err != nil {
5703				return RouteAction_HashPolicyValidationError{
5704					field:  "ConnectionProperties",
5705					reason: "embedded message failed validation",
5706					cause:  err,
5707				}
5708			}
5709		}
5710
5711	case *RouteAction_HashPolicy_QueryParameter_:
5712
5713		if all {
5714			switch v := interface{}(m.GetQueryParameter()).(type) {
5715			case interface{ ValidateAll() error }:
5716				if err := v.ValidateAll(); err != nil {
5717					errors = append(errors, RouteAction_HashPolicyValidationError{
5718						field:  "QueryParameter",
5719						reason: "embedded message failed validation",
5720						cause:  err,
5721					})
5722				}
5723			case interface{ Validate() error }:
5724				if err := v.Validate(); err != nil {
5725					errors = append(errors, RouteAction_HashPolicyValidationError{
5726						field:  "QueryParameter",
5727						reason: "embedded message failed validation",
5728						cause:  err,
5729					})
5730				}
5731			}
5732		} else if v, ok := interface{}(m.GetQueryParameter()).(interface{ Validate() error }); ok {
5733			if err := v.Validate(); err != nil {
5734				return RouteAction_HashPolicyValidationError{
5735					field:  "QueryParameter",
5736					reason: "embedded message failed validation",
5737					cause:  err,
5738				}
5739			}
5740		}
5741
5742	case *RouteAction_HashPolicy_FilterState_:
5743
5744		if all {
5745			switch v := interface{}(m.GetFilterState()).(type) {
5746			case interface{ ValidateAll() error }:
5747				if err := v.ValidateAll(); err != nil {
5748					errors = append(errors, RouteAction_HashPolicyValidationError{
5749						field:  "FilterState",
5750						reason: "embedded message failed validation",
5751						cause:  err,
5752					})
5753				}
5754			case interface{ Validate() error }:
5755				if err := v.Validate(); err != nil {
5756					errors = append(errors, RouteAction_HashPolicyValidationError{
5757						field:  "FilterState",
5758						reason: "embedded message failed validation",
5759						cause:  err,
5760					})
5761				}
5762			}
5763		} else if v, ok := interface{}(m.GetFilterState()).(interface{ Validate() error }); ok {
5764			if err := v.Validate(); err != nil {
5765				return RouteAction_HashPolicyValidationError{
5766					field:  "FilterState",
5767					reason: "embedded message failed validation",
5768					cause:  err,
5769				}
5770			}
5771		}
5772
5773	default:
5774		err := RouteAction_HashPolicyValidationError{
5775			field:  "PolicySpecifier",
5776			reason: "value is required",
5777		}
5778		if !all {
5779			return err
5780		}
5781		errors = append(errors, err)
5782
5783	}
5784
5785	if len(errors) > 0 {
5786		return RouteAction_HashPolicyMultiError(errors)
5787	}
5788	return nil
5789}
5790
5791// RouteAction_HashPolicyMultiError is an error wrapping multiple validation
5792// errors returned by RouteAction_HashPolicy.ValidateAll() if the designated
5793// constraints aren't met.
5794type RouteAction_HashPolicyMultiError []error
5795
5796// Error returns a concatenation of all the error messages it wraps.
5797func (m RouteAction_HashPolicyMultiError) Error() string {
5798	var msgs []string
5799	for _, err := range m {
5800		msgs = append(msgs, err.Error())
5801	}
5802	return strings.Join(msgs, "; ")
5803}
5804
5805// AllErrors returns a list of validation violation errors.
5806func (m RouteAction_HashPolicyMultiError) AllErrors() []error { return m }
5807
5808// RouteAction_HashPolicyValidationError is the validation error returned by
5809// RouteAction_HashPolicy.Validate if the designated constraints aren't met.
5810type RouteAction_HashPolicyValidationError struct {
5811	field  string
5812	reason string
5813	cause  error
5814	key    bool
5815}
5816
5817// Field function returns field value.
5818func (e RouteAction_HashPolicyValidationError) Field() string { return e.field }
5819
5820// Reason function returns reason value.
5821func (e RouteAction_HashPolicyValidationError) Reason() string { return e.reason }
5822
5823// Cause function returns cause value.
5824func (e RouteAction_HashPolicyValidationError) Cause() error { return e.cause }
5825
5826// Key function returns key value.
5827func (e RouteAction_HashPolicyValidationError) Key() bool { return e.key }
5828
5829// ErrorName returns error name.
5830func (e RouteAction_HashPolicyValidationError) ErrorName() string {
5831	return "RouteAction_HashPolicyValidationError"
5832}
5833
5834// Error satisfies the builtin error interface
5835func (e RouteAction_HashPolicyValidationError) Error() string {
5836	cause := ""
5837	if e.cause != nil {
5838		cause = fmt.Sprintf(" | caused by: %v", e.cause)
5839	}
5840
5841	key := ""
5842	if e.key {
5843		key = "key for "
5844	}
5845
5846	return fmt.Sprintf(
5847		"invalid %sRouteAction_HashPolicy.%s: %s%s",
5848		key,
5849		e.field,
5850		e.reason,
5851		cause)
5852}
5853
5854var _ error = RouteAction_HashPolicyValidationError{}
5855
5856var _ interface {
5857	Field() string
5858	Reason() string
5859	Key() bool
5860	Cause() error
5861	ErrorName() string
5862} = RouteAction_HashPolicyValidationError{}
5863
5864// Validate checks the field values on RouteAction_UpgradeConfig with the rules
5865// defined in the proto definition for this message. If any rules are
5866// violated, the first error encountered is returned, or nil if there are no violations.
5867func (m *RouteAction_UpgradeConfig) Validate() error {
5868	return m.validate(false)
5869}
5870
5871// ValidateAll checks the field values on RouteAction_UpgradeConfig with the
5872// rules defined in the proto definition for this message. If any rules are
5873// violated, the result is a list of violation errors wrapped in
5874// RouteAction_UpgradeConfigMultiError, or nil if none found.
5875func (m *RouteAction_UpgradeConfig) ValidateAll() error {
5876	return m.validate(true)
5877}
5878
5879func (m *RouteAction_UpgradeConfig) validate(all bool) error {
5880	if m == nil {
5881		return nil
5882	}
5883
5884	var errors []error
5885
5886	if !_RouteAction_UpgradeConfig_UpgradeType_Pattern.MatchString(m.GetUpgradeType()) {
5887		err := RouteAction_UpgradeConfigValidationError{
5888			field:  "UpgradeType",
5889			reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
5890		}
5891		if !all {
5892			return err
5893		}
5894		errors = append(errors, err)
5895	}
5896
5897	if all {
5898		switch v := interface{}(m.GetEnabled()).(type) {
5899		case interface{ ValidateAll() error }:
5900			if err := v.ValidateAll(); err != nil {
5901				errors = append(errors, RouteAction_UpgradeConfigValidationError{
5902					field:  "Enabled",
5903					reason: "embedded message failed validation",
5904					cause:  err,
5905				})
5906			}
5907		case interface{ Validate() error }:
5908			if err := v.Validate(); err != nil {
5909				errors = append(errors, RouteAction_UpgradeConfigValidationError{
5910					field:  "Enabled",
5911					reason: "embedded message failed validation",
5912					cause:  err,
5913				})
5914			}
5915		}
5916	} else if v, ok := interface{}(m.GetEnabled()).(interface{ Validate() error }); ok {
5917		if err := v.Validate(); err != nil {
5918			return RouteAction_UpgradeConfigValidationError{
5919				field:  "Enabled",
5920				reason: "embedded message failed validation",
5921				cause:  err,
5922			}
5923		}
5924	}
5925
5926	if len(errors) > 0 {
5927		return RouteAction_UpgradeConfigMultiError(errors)
5928	}
5929	return nil
5930}
5931
5932// RouteAction_UpgradeConfigMultiError is an error wrapping multiple validation
5933// errors returned by RouteAction_UpgradeConfig.ValidateAll() if the
5934// designated constraints aren't met.
5935type RouteAction_UpgradeConfigMultiError []error
5936
5937// Error returns a concatenation of all the error messages it wraps.
5938func (m RouteAction_UpgradeConfigMultiError) Error() string {
5939	var msgs []string
5940	for _, err := range m {
5941		msgs = append(msgs, err.Error())
5942	}
5943	return strings.Join(msgs, "; ")
5944}
5945
5946// AllErrors returns a list of validation violation errors.
5947func (m RouteAction_UpgradeConfigMultiError) AllErrors() []error { return m }
5948
5949// RouteAction_UpgradeConfigValidationError is the validation error returned by
5950// RouteAction_UpgradeConfig.Validate if the designated constraints aren't met.
5951type RouteAction_UpgradeConfigValidationError struct {
5952	field  string
5953	reason string
5954	cause  error
5955	key    bool
5956}
5957
5958// Field function returns field value.
5959func (e RouteAction_UpgradeConfigValidationError) Field() string { return e.field }
5960
5961// Reason function returns reason value.
5962func (e RouteAction_UpgradeConfigValidationError) Reason() string { return e.reason }
5963
5964// Cause function returns cause value.
5965func (e RouteAction_UpgradeConfigValidationError) Cause() error { return e.cause }
5966
5967// Key function returns key value.
5968func (e RouteAction_UpgradeConfigValidationError) Key() bool { return e.key }
5969
5970// ErrorName returns error name.
5971func (e RouteAction_UpgradeConfigValidationError) ErrorName() string {
5972	return "RouteAction_UpgradeConfigValidationError"
5973}
5974
5975// Error satisfies the builtin error interface
5976func (e RouteAction_UpgradeConfigValidationError) Error() string {
5977	cause := ""
5978	if e.cause != nil {
5979		cause = fmt.Sprintf(" | caused by: %v", e.cause)
5980	}
5981
5982	key := ""
5983	if e.key {
5984		key = "key for "
5985	}
5986
5987	return fmt.Sprintf(
5988		"invalid %sRouteAction_UpgradeConfig.%s: %s%s",
5989		key,
5990		e.field,
5991		e.reason,
5992		cause)
5993}
5994
5995var _ error = RouteAction_UpgradeConfigValidationError{}
5996
5997var _ interface {
5998	Field() string
5999	Reason() string
6000	Key() bool
6001	Cause() error
6002	ErrorName() string
6003} = RouteAction_UpgradeConfigValidationError{}
6004
6005var _RouteAction_UpgradeConfig_UpgradeType_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
6006
6007// Validate checks the field values on RouteAction_HashPolicy_Header with the
6008// rules defined in the proto definition for this message. If any rules are
6009// violated, the first error encountered is returned, or nil if there are no violations.
6010func (m *RouteAction_HashPolicy_Header) Validate() error {
6011	return m.validate(false)
6012}
6013
6014// ValidateAll checks the field values on RouteAction_HashPolicy_Header with
6015// the rules defined in the proto definition for this message. If any rules
6016// are violated, the result is a list of violation errors wrapped in
6017// RouteAction_HashPolicy_HeaderMultiError, or nil if none found.
6018func (m *RouteAction_HashPolicy_Header) ValidateAll() error {
6019	return m.validate(true)
6020}
6021
6022func (m *RouteAction_HashPolicy_Header) validate(all bool) error {
6023	if m == nil {
6024		return nil
6025	}
6026
6027	var errors []error
6028
6029	if len(m.GetHeaderName()) < 1 {
6030		err := RouteAction_HashPolicy_HeaderValidationError{
6031			field:  "HeaderName",
6032			reason: "value length must be at least 1 bytes",
6033		}
6034		if !all {
6035			return err
6036		}
6037		errors = append(errors, err)
6038	}
6039
6040	if !_RouteAction_HashPolicy_Header_HeaderName_Pattern.MatchString(m.GetHeaderName()) {
6041		err := RouteAction_HashPolicy_HeaderValidationError{
6042			field:  "HeaderName",
6043			reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
6044		}
6045		if !all {
6046			return err
6047		}
6048		errors = append(errors, err)
6049	}
6050
6051	if len(errors) > 0 {
6052		return RouteAction_HashPolicy_HeaderMultiError(errors)
6053	}
6054	return nil
6055}
6056
6057// RouteAction_HashPolicy_HeaderMultiError is an error wrapping multiple
6058// validation errors returned by RouteAction_HashPolicy_Header.ValidateAll()
6059// if the designated constraints aren't met.
6060type RouteAction_HashPolicy_HeaderMultiError []error
6061
6062// Error returns a concatenation of all the error messages it wraps.
6063func (m RouteAction_HashPolicy_HeaderMultiError) Error() string {
6064	var msgs []string
6065	for _, err := range m {
6066		msgs = append(msgs, err.Error())
6067	}
6068	return strings.Join(msgs, "; ")
6069}
6070
6071// AllErrors returns a list of validation violation errors.
6072func (m RouteAction_HashPolicy_HeaderMultiError) AllErrors() []error { return m }
6073
6074// RouteAction_HashPolicy_HeaderValidationError is the validation error
6075// returned by RouteAction_HashPolicy_Header.Validate if the designated
6076// constraints aren't met.
6077type RouteAction_HashPolicy_HeaderValidationError struct {
6078	field  string
6079	reason string
6080	cause  error
6081	key    bool
6082}
6083
6084// Field function returns field value.
6085func (e RouteAction_HashPolicy_HeaderValidationError) Field() string { return e.field }
6086
6087// Reason function returns reason value.
6088func (e RouteAction_HashPolicy_HeaderValidationError) Reason() string { return e.reason }
6089
6090// Cause function returns cause value.
6091func (e RouteAction_HashPolicy_HeaderValidationError) Cause() error { return e.cause }
6092
6093// Key function returns key value.
6094func (e RouteAction_HashPolicy_HeaderValidationError) Key() bool { return e.key }
6095
6096// ErrorName returns error name.
6097func (e RouteAction_HashPolicy_HeaderValidationError) ErrorName() string {
6098	return "RouteAction_HashPolicy_HeaderValidationError"
6099}
6100
6101// Error satisfies the builtin error interface
6102func (e RouteAction_HashPolicy_HeaderValidationError) Error() string {
6103	cause := ""
6104	if e.cause != nil {
6105		cause = fmt.Sprintf(" | caused by: %v", e.cause)
6106	}
6107
6108	key := ""
6109	if e.key {
6110		key = "key for "
6111	}
6112
6113	return fmt.Sprintf(
6114		"invalid %sRouteAction_HashPolicy_Header.%s: %s%s",
6115		key,
6116		e.field,
6117		e.reason,
6118		cause)
6119}
6120
6121var _ error = RouteAction_HashPolicy_HeaderValidationError{}
6122
6123var _ interface {
6124	Field() string
6125	Reason() string
6126	Key() bool
6127	Cause() error
6128	ErrorName() string
6129} = RouteAction_HashPolicy_HeaderValidationError{}
6130
6131var _RouteAction_HashPolicy_Header_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
6132
6133// Validate checks the field values on RouteAction_HashPolicy_Cookie with the
6134// rules defined in the proto definition for this message. If any rules are
6135// violated, the first error encountered is returned, or nil if there are no violations.
6136func (m *RouteAction_HashPolicy_Cookie) Validate() error {
6137	return m.validate(false)
6138}
6139
6140// ValidateAll checks the field values on RouteAction_HashPolicy_Cookie with
6141// the rules defined in the proto definition for this message. If any rules
6142// are violated, the result is a list of violation errors wrapped in
6143// RouteAction_HashPolicy_CookieMultiError, or nil if none found.
6144func (m *RouteAction_HashPolicy_Cookie) ValidateAll() error {
6145	return m.validate(true)
6146}
6147
6148func (m *RouteAction_HashPolicy_Cookie) validate(all bool) error {
6149	if m == nil {
6150		return nil
6151	}
6152
6153	var errors []error
6154
6155	if len(m.GetName()) < 1 {
6156		err := RouteAction_HashPolicy_CookieValidationError{
6157			field:  "Name",
6158			reason: "value length must be at least 1 bytes",
6159		}
6160		if !all {
6161			return err
6162		}
6163		errors = append(errors, err)
6164	}
6165
6166	if all {
6167		switch v := interface{}(m.GetTtl()).(type) {
6168		case interface{ ValidateAll() error }:
6169			if err := v.ValidateAll(); err != nil {
6170				errors = append(errors, RouteAction_HashPolicy_CookieValidationError{
6171					field:  "Ttl",
6172					reason: "embedded message failed validation",
6173					cause:  err,
6174				})
6175			}
6176		case interface{ Validate() error }:
6177			if err := v.Validate(); err != nil {
6178				errors = append(errors, RouteAction_HashPolicy_CookieValidationError{
6179					field:  "Ttl",
6180					reason: "embedded message failed validation",
6181					cause:  err,
6182				})
6183			}
6184		}
6185	} else if v, ok := interface{}(m.GetTtl()).(interface{ Validate() error }); ok {
6186		if err := v.Validate(); err != nil {
6187			return RouteAction_HashPolicy_CookieValidationError{
6188				field:  "Ttl",
6189				reason: "embedded message failed validation",
6190				cause:  err,
6191			}
6192		}
6193	}
6194
6195	// no validation rules for Path
6196
6197	if len(errors) > 0 {
6198		return RouteAction_HashPolicy_CookieMultiError(errors)
6199	}
6200	return nil
6201}
6202
6203// RouteAction_HashPolicy_CookieMultiError is an error wrapping multiple
6204// validation errors returned by RouteAction_HashPolicy_Cookie.ValidateAll()
6205// if the designated constraints aren't met.
6206type RouteAction_HashPolicy_CookieMultiError []error
6207
6208// Error returns a concatenation of all the error messages it wraps.
6209func (m RouteAction_HashPolicy_CookieMultiError) Error() string {
6210	var msgs []string
6211	for _, err := range m {
6212		msgs = append(msgs, err.Error())
6213	}
6214	return strings.Join(msgs, "; ")
6215}
6216
6217// AllErrors returns a list of validation violation errors.
6218func (m RouteAction_HashPolicy_CookieMultiError) AllErrors() []error { return m }
6219
6220// RouteAction_HashPolicy_CookieValidationError is the validation error
6221// returned by RouteAction_HashPolicy_Cookie.Validate if the designated
6222// constraints aren't met.
6223type RouteAction_HashPolicy_CookieValidationError struct {
6224	field  string
6225	reason string
6226	cause  error
6227	key    bool
6228}
6229
6230// Field function returns field value.
6231func (e RouteAction_HashPolicy_CookieValidationError) Field() string { return e.field }
6232
6233// Reason function returns reason value.
6234func (e RouteAction_HashPolicy_CookieValidationError) Reason() string { return e.reason }
6235
6236// Cause function returns cause value.
6237func (e RouteAction_HashPolicy_CookieValidationError) Cause() error { return e.cause }
6238
6239// Key function returns key value.
6240func (e RouteAction_HashPolicy_CookieValidationError) Key() bool { return e.key }
6241
6242// ErrorName returns error name.
6243func (e RouteAction_HashPolicy_CookieValidationError) ErrorName() string {
6244	return "RouteAction_HashPolicy_CookieValidationError"
6245}
6246
6247// Error satisfies the builtin error interface
6248func (e RouteAction_HashPolicy_CookieValidationError) Error() string {
6249	cause := ""
6250	if e.cause != nil {
6251		cause = fmt.Sprintf(" | caused by: %v", e.cause)
6252	}
6253
6254	key := ""
6255	if e.key {
6256		key = "key for "
6257	}
6258
6259	return fmt.Sprintf(
6260		"invalid %sRouteAction_HashPolicy_Cookie.%s: %s%s",
6261		key,
6262		e.field,
6263		e.reason,
6264		cause)
6265}
6266
6267var _ error = RouteAction_HashPolicy_CookieValidationError{}
6268
6269var _ interface {
6270	Field() string
6271	Reason() string
6272	Key() bool
6273	Cause() error
6274	ErrorName() string
6275} = RouteAction_HashPolicy_CookieValidationError{}
6276
6277// Validate checks the field values on
6278// RouteAction_HashPolicy_ConnectionProperties with the rules defined in the
6279// proto definition for this message. If any rules are violated, the first
6280// error encountered is returned, or nil if there are no violations.
6281func (m *RouteAction_HashPolicy_ConnectionProperties) Validate() error {
6282	return m.validate(false)
6283}
6284
6285// ValidateAll checks the field values on
6286// RouteAction_HashPolicy_ConnectionProperties with the rules defined in the
6287// proto definition for this message. If any rules are violated, the result is
6288// a list of violation errors wrapped in
6289// RouteAction_HashPolicy_ConnectionPropertiesMultiError, or nil if none found.
6290func (m *RouteAction_HashPolicy_ConnectionProperties) ValidateAll() error {
6291	return m.validate(true)
6292}
6293
6294func (m *RouteAction_HashPolicy_ConnectionProperties) validate(all bool) error {
6295	if m == nil {
6296		return nil
6297	}
6298
6299	var errors []error
6300
6301	// no validation rules for SourceIp
6302
6303	if len(errors) > 0 {
6304		return RouteAction_HashPolicy_ConnectionPropertiesMultiError(errors)
6305	}
6306	return nil
6307}
6308
6309// RouteAction_HashPolicy_ConnectionPropertiesMultiError is an error wrapping
6310// multiple validation errors returned by
6311// RouteAction_HashPolicy_ConnectionProperties.ValidateAll() if the designated
6312// constraints aren't met.
6313type RouteAction_HashPolicy_ConnectionPropertiesMultiError []error
6314
6315// Error returns a concatenation of all the error messages it wraps.
6316func (m RouteAction_HashPolicy_ConnectionPropertiesMultiError) Error() string {
6317	var msgs []string
6318	for _, err := range m {
6319		msgs = append(msgs, err.Error())
6320	}
6321	return strings.Join(msgs, "; ")
6322}
6323
6324// AllErrors returns a list of validation violation errors.
6325func (m RouteAction_HashPolicy_ConnectionPropertiesMultiError) AllErrors() []error { return m }
6326
6327// RouteAction_HashPolicy_ConnectionPropertiesValidationError is the validation
6328// error returned by RouteAction_HashPolicy_ConnectionProperties.Validate if
6329// the designated constraints aren't met.
6330type RouteAction_HashPolicy_ConnectionPropertiesValidationError struct {
6331	field  string
6332	reason string
6333	cause  error
6334	key    bool
6335}
6336
6337// Field function returns field value.
6338func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Field() string { return e.field }
6339
6340// Reason function returns reason value.
6341func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Reason() string { return e.reason }
6342
6343// Cause function returns cause value.
6344func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Cause() error { return e.cause }
6345
6346// Key function returns key value.
6347func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Key() bool { return e.key }
6348
6349// ErrorName returns error name.
6350func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) ErrorName() string {
6351	return "RouteAction_HashPolicy_ConnectionPropertiesValidationError"
6352}
6353
6354// Error satisfies the builtin error interface
6355func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Error() string {
6356	cause := ""
6357	if e.cause != nil {
6358		cause = fmt.Sprintf(" | caused by: %v", e.cause)
6359	}
6360
6361	key := ""
6362	if e.key {
6363		key = "key for "
6364	}
6365
6366	return fmt.Sprintf(
6367		"invalid %sRouteAction_HashPolicy_ConnectionProperties.%s: %s%s",
6368		key,
6369		e.field,
6370		e.reason,
6371		cause)
6372}
6373
6374var _ error = RouteAction_HashPolicy_ConnectionPropertiesValidationError{}
6375
6376var _ interface {
6377	Field() string
6378	Reason() string
6379	Key() bool
6380	Cause() error
6381	ErrorName() string
6382} = RouteAction_HashPolicy_ConnectionPropertiesValidationError{}
6383
6384// Validate checks the field values on RouteAction_HashPolicy_QueryParameter
6385// with the rules defined in the proto definition for this message. If any
6386// rules are violated, the first error encountered is returned, or nil if
6387// there are no violations.
6388func (m *RouteAction_HashPolicy_QueryParameter) Validate() error {
6389	return m.validate(false)
6390}
6391
6392// ValidateAll checks the field values on RouteAction_HashPolicy_QueryParameter
6393// with the rules defined in the proto definition for this message. If any
6394// rules are violated, the result is a list of violation errors wrapped in
6395// RouteAction_HashPolicy_QueryParameterMultiError, or nil if none found.
6396func (m *RouteAction_HashPolicy_QueryParameter) ValidateAll() error {
6397	return m.validate(true)
6398}
6399
6400func (m *RouteAction_HashPolicy_QueryParameter) validate(all bool) error {
6401	if m == nil {
6402		return nil
6403	}
6404
6405	var errors []error
6406
6407	if len(m.GetName()) < 1 {
6408		err := RouteAction_HashPolicy_QueryParameterValidationError{
6409			field:  "Name",
6410			reason: "value length must be at least 1 bytes",
6411		}
6412		if !all {
6413			return err
6414		}
6415		errors = append(errors, err)
6416	}
6417
6418	if len(errors) > 0 {
6419		return RouteAction_HashPolicy_QueryParameterMultiError(errors)
6420	}
6421	return nil
6422}
6423
6424// RouteAction_HashPolicy_QueryParameterMultiError is an error wrapping
6425// multiple validation errors returned by
6426// RouteAction_HashPolicy_QueryParameter.ValidateAll() if the designated
6427// constraints aren't met.
6428type RouteAction_HashPolicy_QueryParameterMultiError []error
6429
6430// Error returns a concatenation of all the error messages it wraps.
6431func (m RouteAction_HashPolicy_QueryParameterMultiError) Error() string {
6432	var msgs []string
6433	for _, err := range m {
6434		msgs = append(msgs, err.Error())
6435	}
6436	return strings.Join(msgs, "; ")
6437}
6438
6439// AllErrors returns a list of validation violation errors.
6440func (m RouteAction_HashPolicy_QueryParameterMultiError) AllErrors() []error { return m }
6441
6442// RouteAction_HashPolicy_QueryParameterValidationError is the validation error
6443// returned by RouteAction_HashPolicy_QueryParameter.Validate if the
6444// designated constraints aren't met.
6445type RouteAction_HashPolicy_QueryParameterValidationError struct {
6446	field  string
6447	reason string
6448	cause  error
6449	key    bool
6450}
6451
6452// Field function returns field value.
6453func (e RouteAction_HashPolicy_QueryParameterValidationError) Field() string { return e.field }
6454
6455// Reason function returns reason value.
6456func (e RouteAction_HashPolicy_QueryParameterValidationError) Reason() string { return e.reason }
6457
6458// Cause function returns cause value.
6459func (e RouteAction_HashPolicy_QueryParameterValidationError) Cause() error { return e.cause }
6460
6461// Key function returns key value.
6462func (e RouteAction_HashPolicy_QueryParameterValidationError) Key() bool { return e.key }
6463
6464// ErrorName returns error name.
6465func (e RouteAction_HashPolicy_QueryParameterValidationError) ErrorName() string {
6466	return "RouteAction_HashPolicy_QueryParameterValidationError"
6467}
6468
6469// Error satisfies the builtin error interface
6470func (e RouteAction_HashPolicy_QueryParameterValidationError) Error() string {
6471	cause := ""
6472	if e.cause != nil {
6473		cause = fmt.Sprintf(" | caused by: %v", e.cause)
6474	}
6475
6476	key := ""
6477	if e.key {
6478		key = "key for "
6479	}
6480
6481	return fmt.Sprintf(
6482		"invalid %sRouteAction_HashPolicy_QueryParameter.%s: %s%s",
6483		key,
6484		e.field,
6485		e.reason,
6486		cause)
6487}
6488
6489var _ error = RouteAction_HashPolicy_QueryParameterValidationError{}
6490
6491var _ interface {
6492	Field() string
6493	Reason() string
6494	Key() bool
6495	Cause() error
6496	ErrorName() string
6497} = RouteAction_HashPolicy_QueryParameterValidationError{}
6498
6499// Validate checks the field values on RouteAction_HashPolicy_FilterState with
6500// the rules defined in the proto definition for this message. If any rules
6501// are violated, the first error encountered is returned, or nil if there are
6502// no violations.
6503func (m *RouteAction_HashPolicy_FilterState) Validate() error {
6504	return m.validate(false)
6505}
6506
6507// ValidateAll checks the field values on RouteAction_HashPolicy_FilterState
6508// with the rules defined in the proto definition for this message. If any
6509// rules are violated, the result is a list of violation errors wrapped in
6510// RouteAction_HashPolicy_FilterStateMultiError, or nil if none found.
6511func (m *RouteAction_HashPolicy_FilterState) ValidateAll() error {
6512	return m.validate(true)
6513}
6514
6515func (m *RouteAction_HashPolicy_FilterState) validate(all bool) error {
6516	if m == nil {
6517		return nil
6518	}
6519
6520	var errors []error
6521
6522	if len(m.GetKey()) < 1 {
6523		err := RouteAction_HashPolicy_FilterStateValidationError{
6524			field:  "Key",
6525			reason: "value length must be at least 1 bytes",
6526		}
6527		if !all {
6528			return err
6529		}
6530		errors = append(errors, err)
6531	}
6532
6533	if len(errors) > 0 {
6534		return RouteAction_HashPolicy_FilterStateMultiError(errors)
6535	}
6536	return nil
6537}
6538
6539// RouteAction_HashPolicy_FilterStateMultiError is an error wrapping multiple
6540// validation errors returned by
6541// RouteAction_HashPolicy_FilterState.ValidateAll() if the designated
6542// constraints aren't met.
6543type RouteAction_HashPolicy_FilterStateMultiError []error
6544
6545// Error returns a concatenation of all the error messages it wraps.
6546func (m RouteAction_HashPolicy_FilterStateMultiError) Error() string {
6547	var msgs []string
6548	for _, err := range m {
6549		msgs = append(msgs, err.Error())
6550	}
6551	return strings.Join(msgs, "; ")
6552}
6553
6554// AllErrors returns a list of validation violation errors.
6555func (m RouteAction_HashPolicy_FilterStateMultiError) AllErrors() []error { return m }
6556
6557// RouteAction_HashPolicy_FilterStateValidationError is the validation error
6558// returned by RouteAction_HashPolicy_FilterState.Validate if the designated
6559// constraints aren't met.
6560type RouteAction_HashPolicy_FilterStateValidationError struct {
6561	field  string
6562	reason string
6563	cause  error
6564	key    bool
6565}
6566
6567// Field function returns field value.
6568func (e RouteAction_HashPolicy_FilterStateValidationError) Field() string { return e.field }
6569
6570// Reason function returns reason value.
6571func (e RouteAction_HashPolicy_FilterStateValidationError) Reason() string { return e.reason }
6572
6573// Cause function returns cause value.
6574func (e RouteAction_HashPolicy_FilterStateValidationError) Cause() error { return e.cause }
6575
6576// Key function returns key value.
6577func (e RouteAction_HashPolicy_FilterStateValidationError) Key() bool { return e.key }
6578
6579// ErrorName returns error name.
6580func (e RouteAction_HashPolicy_FilterStateValidationError) ErrorName() string {
6581	return "RouteAction_HashPolicy_FilterStateValidationError"
6582}
6583
6584// Error satisfies the builtin error interface
6585func (e RouteAction_HashPolicy_FilterStateValidationError) Error() string {
6586	cause := ""
6587	if e.cause != nil {
6588		cause = fmt.Sprintf(" | caused by: %v", e.cause)
6589	}
6590
6591	key := ""
6592	if e.key {
6593		key = "key for "
6594	}
6595
6596	return fmt.Sprintf(
6597		"invalid %sRouteAction_HashPolicy_FilterState.%s: %s%s",
6598		key,
6599		e.field,
6600		e.reason,
6601		cause)
6602}
6603
6604var _ error = RouteAction_HashPolicy_FilterStateValidationError{}
6605
6606var _ interface {
6607	Field() string
6608	Reason() string
6609	Key() bool
6610	Cause() error
6611	ErrorName() string
6612} = RouteAction_HashPolicy_FilterStateValidationError{}
6613
6614// Validate checks the field values on RetryPolicy_RetryPriority with the rules
6615// defined in the proto definition for this message. If any rules are
6616// violated, the first error encountered is returned, or nil if there are no violations.
6617func (m *RetryPolicy_RetryPriority) Validate() error {
6618	return m.validate(false)
6619}
6620
6621// ValidateAll checks the field values on RetryPolicy_RetryPriority with the
6622// rules defined in the proto definition for this message. If any rules are
6623// violated, the result is a list of violation errors wrapped in
6624// RetryPolicy_RetryPriorityMultiError, or nil if none found.
6625func (m *RetryPolicy_RetryPriority) ValidateAll() error {
6626	return m.validate(true)
6627}
6628
6629func (m *RetryPolicy_RetryPriority) validate(all bool) error {
6630	if m == nil {
6631		return nil
6632	}
6633
6634	var errors []error
6635
6636	if len(m.GetName()) < 1 {
6637		err := RetryPolicy_RetryPriorityValidationError{
6638			field:  "Name",
6639			reason: "value length must be at least 1 bytes",
6640		}
6641		if !all {
6642			return err
6643		}
6644		errors = append(errors, err)
6645	}
6646
6647	switch m.ConfigType.(type) {
6648
6649	case *RetryPolicy_RetryPriority_Config:
6650
6651		if all {
6652			switch v := interface{}(m.GetConfig()).(type) {
6653			case interface{ ValidateAll() error }:
6654				if err := v.ValidateAll(); err != nil {
6655					errors = append(errors, RetryPolicy_RetryPriorityValidationError{
6656						field:  "Config",
6657						reason: "embedded message failed validation",
6658						cause:  err,
6659					})
6660				}
6661			case interface{ Validate() error }:
6662				if err := v.Validate(); err != nil {
6663					errors = append(errors, RetryPolicy_RetryPriorityValidationError{
6664						field:  "Config",
6665						reason: "embedded message failed validation",
6666						cause:  err,
6667					})
6668				}
6669			}
6670		} else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
6671			if err := v.Validate(); err != nil {
6672				return RetryPolicy_RetryPriorityValidationError{
6673					field:  "Config",
6674					reason: "embedded message failed validation",
6675					cause:  err,
6676				}
6677			}
6678		}
6679
6680	case *RetryPolicy_RetryPriority_TypedConfig:
6681
6682		if all {
6683			switch v := interface{}(m.GetTypedConfig()).(type) {
6684			case interface{ ValidateAll() error }:
6685				if err := v.ValidateAll(); err != nil {
6686					errors = append(errors, RetryPolicy_RetryPriorityValidationError{
6687						field:  "TypedConfig",
6688						reason: "embedded message failed validation",
6689						cause:  err,
6690					})
6691				}
6692			case interface{ Validate() error }:
6693				if err := v.Validate(); err != nil {
6694					errors = append(errors, RetryPolicy_RetryPriorityValidationError{
6695						field:  "TypedConfig",
6696						reason: "embedded message failed validation",
6697						cause:  err,
6698					})
6699				}
6700			}
6701		} else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
6702			if err := v.Validate(); err != nil {
6703				return RetryPolicy_RetryPriorityValidationError{
6704					field:  "TypedConfig",
6705					reason: "embedded message failed validation",
6706					cause:  err,
6707				}
6708			}
6709		}
6710
6711	}
6712
6713	if len(errors) > 0 {
6714		return RetryPolicy_RetryPriorityMultiError(errors)
6715	}
6716	return nil
6717}
6718
6719// RetryPolicy_RetryPriorityMultiError is an error wrapping multiple validation
6720// errors returned by RetryPolicy_RetryPriority.ValidateAll() if the
6721// designated constraints aren't met.
6722type RetryPolicy_RetryPriorityMultiError []error
6723
6724// Error returns a concatenation of all the error messages it wraps.
6725func (m RetryPolicy_RetryPriorityMultiError) Error() string {
6726	var msgs []string
6727	for _, err := range m {
6728		msgs = append(msgs, err.Error())
6729	}
6730	return strings.Join(msgs, "; ")
6731}
6732
6733// AllErrors returns a list of validation violation errors.
6734func (m RetryPolicy_RetryPriorityMultiError) AllErrors() []error { return m }
6735
6736// RetryPolicy_RetryPriorityValidationError is the validation error returned by
6737// RetryPolicy_RetryPriority.Validate if the designated constraints aren't met.
6738type RetryPolicy_RetryPriorityValidationError struct {
6739	field  string
6740	reason string
6741	cause  error
6742	key    bool
6743}
6744
6745// Field function returns field value.
6746func (e RetryPolicy_RetryPriorityValidationError) Field() string { return e.field }
6747
6748// Reason function returns reason value.
6749func (e RetryPolicy_RetryPriorityValidationError) Reason() string { return e.reason }
6750
6751// Cause function returns cause value.
6752func (e RetryPolicy_RetryPriorityValidationError) Cause() error { return e.cause }
6753
6754// Key function returns key value.
6755func (e RetryPolicy_RetryPriorityValidationError) Key() bool { return e.key }
6756
6757// ErrorName returns error name.
6758func (e RetryPolicy_RetryPriorityValidationError) ErrorName() string {
6759	return "RetryPolicy_RetryPriorityValidationError"
6760}
6761
6762// Error satisfies the builtin error interface
6763func (e RetryPolicy_RetryPriorityValidationError) Error() string {
6764	cause := ""
6765	if e.cause != nil {
6766		cause = fmt.Sprintf(" | caused by: %v", e.cause)
6767	}
6768
6769	key := ""
6770	if e.key {
6771		key = "key for "
6772	}
6773
6774	return fmt.Sprintf(
6775		"invalid %sRetryPolicy_RetryPriority.%s: %s%s",
6776		key,
6777		e.field,
6778		e.reason,
6779		cause)
6780}
6781
6782var _ error = RetryPolicy_RetryPriorityValidationError{}
6783
6784var _ interface {
6785	Field() string
6786	Reason() string
6787	Key() bool
6788	Cause() error
6789	ErrorName() string
6790} = RetryPolicy_RetryPriorityValidationError{}
6791
6792// Validate checks the field values on RetryPolicy_RetryHostPredicate with the
6793// rules defined in the proto definition for this message. If any rules are
6794// violated, the first error encountered is returned, or nil if there are no violations.
6795func (m *RetryPolicy_RetryHostPredicate) Validate() error {
6796	return m.validate(false)
6797}
6798
6799// ValidateAll checks the field values on RetryPolicy_RetryHostPredicate with
6800// the rules defined in the proto definition for this message. If any rules
6801// are violated, the result is a list of violation errors wrapped in
6802// RetryPolicy_RetryHostPredicateMultiError, or nil if none found.
6803func (m *RetryPolicy_RetryHostPredicate) ValidateAll() error {
6804	return m.validate(true)
6805}
6806
6807func (m *RetryPolicy_RetryHostPredicate) validate(all bool) error {
6808	if m == nil {
6809		return nil
6810	}
6811
6812	var errors []error
6813
6814	if len(m.GetName()) < 1 {
6815		err := RetryPolicy_RetryHostPredicateValidationError{
6816			field:  "Name",
6817			reason: "value length must be at least 1 bytes",
6818		}
6819		if !all {
6820			return err
6821		}
6822		errors = append(errors, err)
6823	}
6824
6825	switch m.ConfigType.(type) {
6826
6827	case *RetryPolicy_RetryHostPredicate_Config:
6828
6829		if all {
6830			switch v := interface{}(m.GetConfig()).(type) {
6831			case interface{ ValidateAll() error }:
6832				if err := v.ValidateAll(); err != nil {
6833					errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{
6834						field:  "Config",
6835						reason: "embedded message failed validation",
6836						cause:  err,
6837					})
6838				}
6839			case interface{ Validate() error }:
6840				if err := v.Validate(); err != nil {
6841					errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{
6842						field:  "Config",
6843						reason: "embedded message failed validation",
6844						cause:  err,
6845					})
6846				}
6847			}
6848		} else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
6849			if err := v.Validate(); err != nil {
6850				return RetryPolicy_RetryHostPredicateValidationError{
6851					field:  "Config",
6852					reason: "embedded message failed validation",
6853					cause:  err,
6854				}
6855			}
6856		}
6857
6858	case *RetryPolicy_RetryHostPredicate_TypedConfig:
6859
6860		if all {
6861			switch v := interface{}(m.GetTypedConfig()).(type) {
6862			case interface{ ValidateAll() error }:
6863				if err := v.ValidateAll(); err != nil {
6864					errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{
6865						field:  "TypedConfig",
6866						reason: "embedded message failed validation",
6867						cause:  err,
6868					})
6869				}
6870			case interface{ Validate() error }:
6871				if err := v.Validate(); err != nil {
6872					errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{
6873						field:  "TypedConfig",
6874						reason: "embedded message failed validation",
6875						cause:  err,
6876					})
6877				}
6878			}
6879		} else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
6880			if err := v.Validate(); err != nil {
6881				return RetryPolicy_RetryHostPredicateValidationError{
6882					field:  "TypedConfig",
6883					reason: "embedded message failed validation",
6884					cause:  err,
6885				}
6886			}
6887		}
6888
6889	}
6890
6891	if len(errors) > 0 {
6892		return RetryPolicy_RetryHostPredicateMultiError(errors)
6893	}
6894	return nil
6895}
6896
6897// RetryPolicy_RetryHostPredicateMultiError is an error wrapping multiple
6898// validation errors returned by RetryPolicy_RetryHostPredicate.ValidateAll()
6899// if the designated constraints aren't met.
6900type RetryPolicy_RetryHostPredicateMultiError []error
6901
6902// Error returns a concatenation of all the error messages it wraps.
6903func (m RetryPolicy_RetryHostPredicateMultiError) Error() string {
6904	var msgs []string
6905	for _, err := range m {
6906		msgs = append(msgs, err.Error())
6907	}
6908	return strings.Join(msgs, "; ")
6909}
6910
6911// AllErrors returns a list of validation violation errors.
6912func (m RetryPolicy_RetryHostPredicateMultiError) AllErrors() []error { return m }
6913
6914// RetryPolicy_RetryHostPredicateValidationError is the validation error
6915// returned by RetryPolicy_RetryHostPredicate.Validate if the designated
6916// constraints aren't met.
6917type RetryPolicy_RetryHostPredicateValidationError struct {
6918	field  string
6919	reason string
6920	cause  error
6921	key    bool
6922}
6923
6924// Field function returns field value.
6925func (e RetryPolicy_RetryHostPredicateValidationError) Field() string { return e.field }
6926
6927// Reason function returns reason value.
6928func (e RetryPolicy_RetryHostPredicateValidationError) Reason() string { return e.reason }
6929
6930// Cause function returns cause value.
6931func (e RetryPolicy_RetryHostPredicateValidationError) Cause() error { return e.cause }
6932
6933// Key function returns key value.
6934func (e RetryPolicy_RetryHostPredicateValidationError) Key() bool { return e.key }
6935
6936// ErrorName returns error name.
6937func (e RetryPolicy_RetryHostPredicateValidationError) ErrorName() string {
6938	return "RetryPolicy_RetryHostPredicateValidationError"
6939}
6940
6941// Error satisfies the builtin error interface
6942func (e RetryPolicy_RetryHostPredicateValidationError) Error() string {
6943	cause := ""
6944	if e.cause != nil {
6945		cause = fmt.Sprintf(" | caused by: %v", e.cause)
6946	}
6947
6948	key := ""
6949	if e.key {
6950		key = "key for "
6951	}
6952
6953	return fmt.Sprintf(
6954		"invalid %sRetryPolicy_RetryHostPredicate.%s: %s%s",
6955		key,
6956		e.field,
6957		e.reason,
6958		cause)
6959}
6960
6961var _ error = RetryPolicy_RetryHostPredicateValidationError{}
6962
6963var _ interface {
6964	Field() string
6965	Reason() string
6966	Key() bool
6967	Cause() error
6968	ErrorName() string
6969} = RetryPolicy_RetryHostPredicateValidationError{}
6970
6971// Validate checks the field values on RetryPolicy_RetryBackOff with the rules
6972// defined in the proto definition for this message. If any rules are
6973// violated, the first error encountered is returned, or nil if there are no violations.
6974func (m *RetryPolicy_RetryBackOff) Validate() error {
6975	return m.validate(false)
6976}
6977
6978// ValidateAll checks the field values on RetryPolicy_RetryBackOff with the
6979// rules defined in the proto definition for this message. If any rules are
6980// violated, the result is a list of violation errors wrapped in
6981// RetryPolicy_RetryBackOffMultiError, or nil if none found.
6982func (m *RetryPolicy_RetryBackOff) ValidateAll() error {
6983	return m.validate(true)
6984}
6985
6986func (m *RetryPolicy_RetryBackOff) validate(all bool) error {
6987	if m == nil {
6988		return nil
6989	}
6990
6991	var errors []error
6992
6993	if m.GetBaseInterval() == nil {
6994		err := RetryPolicy_RetryBackOffValidationError{
6995			field:  "BaseInterval",
6996			reason: "value is required",
6997		}
6998		if !all {
6999			return err
7000		}
7001		errors = append(errors, err)
7002	}
7003
7004	if d := m.GetBaseInterval(); d != nil {
7005		dur, err := d.AsDuration(), d.CheckValid()
7006		if err != nil {
7007			err = RetryPolicy_RetryBackOffValidationError{
7008				field:  "BaseInterval",
7009				reason: "value is not a valid duration",
7010				cause:  err,
7011			}
7012			if !all {
7013				return err
7014			}
7015			errors = append(errors, err)
7016		} else {
7017
7018			gt := time.Duration(0*time.Second + 0*time.Nanosecond)
7019
7020			if dur <= gt {
7021				err := RetryPolicy_RetryBackOffValidationError{
7022					field:  "BaseInterval",
7023					reason: "value must be greater than 0s",
7024				}
7025				if !all {
7026					return err
7027				}
7028				errors = append(errors, err)
7029			}
7030
7031		}
7032	}
7033
7034	if d := m.GetMaxInterval(); d != nil {
7035		dur, err := d.AsDuration(), d.CheckValid()
7036		if err != nil {
7037			err = RetryPolicy_RetryBackOffValidationError{
7038				field:  "MaxInterval",
7039				reason: "value is not a valid duration",
7040				cause:  err,
7041			}
7042			if !all {
7043				return err
7044			}
7045			errors = append(errors, err)
7046		} else {
7047
7048			gt := time.Duration(0*time.Second + 0*time.Nanosecond)
7049
7050			if dur <= gt {
7051				err := RetryPolicy_RetryBackOffValidationError{
7052					field:  "MaxInterval",
7053					reason: "value must be greater than 0s",
7054				}
7055				if !all {
7056					return err
7057				}
7058				errors = append(errors, err)
7059			}
7060
7061		}
7062	}
7063
7064	if len(errors) > 0 {
7065		return RetryPolicy_RetryBackOffMultiError(errors)
7066	}
7067	return nil
7068}
7069
7070// RetryPolicy_RetryBackOffMultiError is an error wrapping multiple validation
7071// errors returned by RetryPolicy_RetryBackOff.ValidateAll() if the designated
7072// constraints aren't met.
7073type RetryPolicy_RetryBackOffMultiError []error
7074
7075// Error returns a concatenation of all the error messages it wraps.
7076func (m RetryPolicy_RetryBackOffMultiError) Error() string {
7077	var msgs []string
7078	for _, err := range m {
7079		msgs = append(msgs, err.Error())
7080	}
7081	return strings.Join(msgs, "; ")
7082}
7083
7084// AllErrors returns a list of validation violation errors.
7085func (m RetryPolicy_RetryBackOffMultiError) AllErrors() []error { return m }
7086
7087// RetryPolicy_RetryBackOffValidationError is the validation error returned by
7088// RetryPolicy_RetryBackOff.Validate if the designated constraints aren't met.
7089type RetryPolicy_RetryBackOffValidationError struct {
7090	field  string
7091	reason string
7092	cause  error
7093	key    bool
7094}
7095
7096// Field function returns field value.
7097func (e RetryPolicy_RetryBackOffValidationError) Field() string { return e.field }
7098
7099// Reason function returns reason value.
7100func (e RetryPolicy_RetryBackOffValidationError) Reason() string { return e.reason }
7101
7102// Cause function returns cause value.
7103func (e RetryPolicy_RetryBackOffValidationError) Cause() error { return e.cause }
7104
7105// Key function returns key value.
7106func (e RetryPolicy_RetryBackOffValidationError) Key() bool { return e.key }
7107
7108// ErrorName returns error name.
7109func (e RetryPolicy_RetryBackOffValidationError) ErrorName() string {
7110	return "RetryPolicy_RetryBackOffValidationError"
7111}
7112
7113// Error satisfies the builtin error interface
7114func (e RetryPolicy_RetryBackOffValidationError) Error() string {
7115	cause := ""
7116	if e.cause != nil {
7117		cause = fmt.Sprintf(" | caused by: %v", e.cause)
7118	}
7119
7120	key := ""
7121	if e.key {
7122		key = "key for "
7123	}
7124
7125	return fmt.Sprintf(
7126		"invalid %sRetryPolicy_RetryBackOff.%s: %s%s",
7127		key,
7128		e.field,
7129		e.reason,
7130		cause)
7131}
7132
7133var _ error = RetryPolicy_RetryBackOffValidationError{}
7134
7135var _ interface {
7136	Field() string
7137	Reason() string
7138	Key() bool
7139	Cause() error
7140	ErrorName() string
7141} = RetryPolicy_RetryBackOffValidationError{}
7142
7143// Validate checks the field values on RateLimit_Action with the rules defined
7144// in the proto definition for this message. If any rules are violated, the
7145// first error encountered is returned, or nil if there are no violations.
7146func (m *RateLimit_Action) Validate() error {
7147	return m.validate(false)
7148}
7149
7150// ValidateAll checks the field values on RateLimit_Action with the rules
7151// defined in the proto definition for this message. If any rules are
7152// violated, the result is a list of violation errors wrapped in
7153// RateLimit_ActionMultiError, or nil if none found.
7154func (m *RateLimit_Action) ValidateAll() error {
7155	return m.validate(true)
7156}
7157
7158func (m *RateLimit_Action) validate(all bool) error {
7159	if m == nil {
7160		return nil
7161	}
7162
7163	var errors []error
7164
7165	switch m.ActionSpecifier.(type) {
7166
7167	case *RateLimit_Action_SourceCluster_:
7168
7169		if all {
7170			switch v := interface{}(m.GetSourceCluster()).(type) {
7171			case interface{ ValidateAll() error }:
7172				if err := v.ValidateAll(); err != nil {
7173					errors = append(errors, RateLimit_ActionValidationError{
7174						field:  "SourceCluster",
7175						reason: "embedded message failed validation",
7176						cause:  err,
7177					})
7178				}
7179			case interface{ Validate() error }:
7180				if err := v.Validate(); err != nil {
7181					errors = append(errors, RateLimit_ActionValidationError{
7182						field:  "SourceCluster",
7183						reason: "embedded message failed validation",
7184						cause:  err,
7185					})
7186				}
7187			}
7188		} else if v, ok := interface{}(m.GetSourceCluster()).(interface{ Validate() error }); ok {
7189			if err := v.Validate(); err != nil {
7190				return RateLimit_ActionValidationError{
7191					field:  "SourceCluster",
7192					reason: "embedded message failed validation",
7193					cause:  err,
7194				}
7195			}
7196		}
7197
7198	case *RateLimit_Action_DestinationCluster_:
7199
7200		if all {
7201			switch v := interface{}(m.GetDestinationCluster()).(type) {
7202			case interface{ ValidateAll() error }:
7203				if err := v.ValidateAll(); err != nil {
7204					errors = append(errors, RateLimit_ActionValidationError{
7205						field:  "DestinationCluster",
7206						reason: "embedded message failed validation",
7207						cause:  err,
7208					})
7209				}
7210			case interface{ Validate() error }:
7211				if err := v.Validate(); err != nil {
7212					errors = append(errors, RateLimit_ActionValidationError{
7213						field:  "DestinationCluster",
7214						reason: "embedded message failed validation",
7215						cause:  err,
7216					})
7217				}
7218			}
7219		} else if v, ok := interface{}(m.GetDestinationCluster()).(interface{ Validate() error }); ok {
7220			if err := v.Validate(); err != nil {
7221				return RateLimit_ActionValidationError{
7222					field:  "DestinationCluster",
7223					reason: "embedded message failed validation",
7224					cause:  err,
7225				}
7226			}
7227		}
7228
7229	case *RateLimit_Action_RequestHeaders_:
7230
7231		if all {
7232			switch v := interface{}(m.GetRequestHeaders()).(type) {
7233			case interface{ ValidateAll() error }:
7234				if err := v.ValidateAll(); err != nil {
7235					errors = append(errors, RateLimit_ActionValidationError{
7236						field:  "RequestHeaders",
7237						reason: "embedded message failed validation",
7238						cause:  err,
7239					})
7240				}
7241			case interface{ Validate() error }:
7242				if err := v.Validate(); err != nil {
7243					errors = append(errors, RateLimit_ActionValidationError{
7244						field:  "RequestHeaders",
7245						reason: "embedded message failed validation",
7246						cause:  err,
7247					})
7248				}
7249			}
7250		} else if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok {
7251			if err := v.Validate(); err != nil {
7252				return RateLimit_ActionValidationError{
7253					field:  "RequestHeaders",
7254					reason: "embedded message failed validation",
7255					cause:  err,
7256				}
7257			}
7258		}
7259
7260	case *RateLimit_Action_RemoteAddress_:
7261
7262		if all {
7263			switch v := interface{}(m.GetRemoteAddress()).(type) {
7264			case interface{ ValidateAll() error }:
7265				if err := v.ValidateAll(); err != nil {
7266					errors = append(errors, RateLimit_ActionValidationError{
7267						field:  "RemoteAddress",
7268						reason: "embedded message failed validation",
7269						cause:  err,
7270					})
7271				}
7272			case interface{ Validate() error }:
7273				if err := v.Validate(); err != nil {
7274					errors = append(errors, RateLimit_ActionValidationError{
7275						field:  "RemoteAddress",
7276						reason: "embedded message failed validation",
7277						cause:  err,
7278					})
7279				}
7280			}
7281		} else if v, ok := interface{}(m.GetRemoteAddress()).(interface{ Validate() error }); ok {
7282			if err := v.Validate(); err != nil {
7283				return RateLimit_ActionValidationError{
7284					field:  "RemoteAddress",
7285					reason: "embedded message failed validation",
7286					cause:  err,
7287				}
7288			}
7289		}
7290
7291	case *RateLimit_Action_GenericKey_:
7292
7293		if all {
7294			switch v := interface{}(m.GetGenericKey()).(type) {
7295			case interface{ ValidateAll() error }:
7296				if err := v.ValidateAll(); err != nil {
7297					errors = append(errors, RateLimit_ActionValidationError{
7298						field:  "GenericKey",
7299						reason: "embedded message failed validation",
7300						cause:  err,
7301					})
7302				}
7303			case interface{ Validate() error }:
7304				if err := v.Validate(); err != nil {
7305					errors = append(errors, RateLimit_ActionValidationError{
7306						field:  "GenericKey",
7307						reason: "embedded message failed validation",
7308						cause:  err,
7309					})
7310				}
7311			}
7312		} else if v, ok := interface{}(m.GetGenericKey()).(interface{ Validate() error }); ok {
7313			if err := v.Validate(); err != nil {
7314				return RateLimit_ActionValidationError{
7315					field:  "GenericKey",
7316					reason: "embedded message failed validation",
7317					cause:  err,
7318				}
7319			}
7320		}
7321
7322	case *RateLimit_Action_HeaderValueMatch_:
7323
7324		if all {
7325			switch v := interface{}(m.GetHeaderValueMatch()).(type) {
7326			case interface{ ValidateAll() error }:
7327				if err := v.ValidateAll(); err != nil {
7328					errors = append(errors, RateLimit_ActionValidationError{
7329						field:  "HeaderValueMatch",
7330						reason: "embedded message failed validation",
7331						cause:  err,
7332					})
7333				}
7334			case interface{ Validate() error }:
7335				if err := v.Validate(); err != nil {
7336					errors = append(errors, RateLimit_ActionValidationError{
7337						field:  "HeaderValueMatch",
7338						reason: "embedded message failed validation",
7339						cause:  err,
7340					})
7341				}
7342			}
7343		} else if v, ok := interface{}(m.GetHeaderValueMatch()).(interface{ Validate() error }); ok {
7344			if err := v.Validate(); err != nil {
7345				return RateLimit_ActionValidationError{
7346					field:  "HeaderValueMatch",
7347					reason: "embedded message failed validation",
7348					cause:  err,
7349				}
7350			}
7351		}
7352
7353	default:
7354		err := RateLimit_ActionValidationError{
7355			field:  "ActionSpecifier",
7356			reason: "value is required",
7357		}
7358		if !all {
7359			return err
7360		}
7361		errors = append(errors, err)
7362
7363	}
7364
7365	if len(errors) > 0 {
7366		return RateLimit_ActionMultiError(errors)
7367	}
7368	return nil
7369}
7370
7371// RateLimit_ActionMultiError is an error wrapping multiple validation errors
7372// returned by RateLimit_Action.ValidateAll() if the designated constraints
7373// aren't met.
7374type RateLimit_ActionMultiError []error
7375
7376// Error returns a concatenation of all the error messages it wraps.
7377func (m RateLimit_ActionMultiError) Error() string {
7378	var msgs []string
7379	for _, err := range m {
7380		msgs = append(msgs, err.Error())
7381	}
7382	return strings.Join(msgs, "; ")
7383}
7384
7385// AllErrors returns a list of validation violation errors.
7386func (m RateLimit_ActionMultiError) AllErrors() []error { return m }
7387
7388// RateLimit_ActionValidationError is the validation error returned by
7389// RateLimit_Action.Validate if the designated constraints aren't met.
7390type RateLimit_ActionValidationError struct {
7391	field  string
7392	reason string
7393	cause  error
7394	key    bool
7395}
7396
7397// Field function returns field value.
7398func (e RateLimit_ActionValidationError) Field() string { return e.field }
7399
7400// Reason function returns reason value.
7401func (e RateLimit_ActionValidationError) Reason() string { return e.reason }
7402
7403// Cause function returns cause value.
7404func (e RateLimit_ActionValidationError) Cause() error { return e.cause }
7405
7406// Key function returns key value.
7407func (e RateLimit_ActionValidationError) Key() bool { return e.key }
7408
7409// ErrorName returns error name.
7410func (e RateLimit_ActionValidationError) ErrorName() string { return "RateLimit_ActionValidationError" }
7411
7412// Error satisfies the builtin error interface
7413func (e RateLimit_ActionValidationError) Error() string {
7414	cause := ""
7415	if e.cause != nil {
7416		cause = fmt.Sprintf(" | caused by: %v", e.cause)
7417	}
7418
7419	key := ""
7420	if e.key {
7421		key = "key for "
7422	}
7423
7424	return fmt.Sprintf(
7425		"invalid %sRateLimit_Action.%s: %s%s",
7426		key,
7427		e.field,
7428		e.reason,
7429		cause)
7430}
7431
7432var _ error = RateLimit_ActionValidationError{}
7433
7434var _ interface {
7435	Field() string
7436	Reason() string
7437	Key() bool
7438	Cause() error
7439	ErrorName() string
7440} = RateLimit_ActionValidationError{}
7441
7442// Validate checks the field values on RateLimit_Action_SourceCluster with the
7443// rules defined in the proto definition for this message. If any rules are
7444// violated, the first error encountered is returned, or nil if there are no violations.
7445func (m *RateLimit_Action_SourceCluster) Validate() error {
7446	return m.validate(false)
7447}
7448
7449// ValidateAll checks the field values on RateLimit_Action_SourceCluster with
7450// the rules defined in the proto definition for this message. If any rules
7451// are violated, the result is a list of violation errors wrapped in
7452// RateLimit_Action_SourceClusterMultiError, or nil if none found.
7453func (m *RateLimit_Action_SourceCluster) ValidateAll() error {
7454	return m.validate(true)
7455}
7456
7457func (m *RateLimit_Action_SourceCluster) validate(all bool) error {
7458	if m == nil {
7459		return nil
7460	}
7461
7462	var errors []error
7463
7464	if len(errors) > 0 {
7465		return RateLimit_Action_SourceClusterMultiError(errors)
7466	}
7467	return nil
7468}
7469
7470// RateLimit_Action_SourceClusterMultiError is an error wrapping multiple
7471// validation errors returned by RateLimit_Action_SourceCluster.ValidateAll()
7472// if the designated constraints aren't met.
7473type RateLimit_Action_SourceClusterMultiError []error
7474
7475// Error returns a concatenation of all the error messages it wraps.
7476func (m RateLimit_Action_SourceClusterMultiError) Error() string {
7477	var msgs []string
7478	for _, err := range m {
7479		msgs = append(msgs, err.Error())
7480	}
7481	return strings.Join(msgs, "; ")
7482}
7483
7484// AllErrors returns a list of validation violation errors.
7485func (m RateLimit_Action_SourceClusterMultiError) AllErrors() []error { return m }
7486
7487// RateLimit_Action_SourceClusterValidationError is the validation error
7488// returned by RateLimit_Action_SourceCluster.Validate if the designated
7489// constraints aren't met.
7490type RateLimit_Action_SourceClusterValidationError struct {
7491	field  string
7492	reason string
7493	cause  error
7494	key    bool
7495}
7496
7497// Field function returns field value.
7498func (e RateLimit_Action_SourceClusterValidationError) Field() string { return e.field }
7499
7500// Reason function returns reason value.
7501func (e RateLimit_Action_SourceClusterValidationError) Reason() string { return e.reason }
7502
7503// Cause function returns cause value.
7504func (e RateLimit_Action_SourceClusterValidationError) Cause() error { return e.cause }
7505
7506// Key function returns key value.
7507func (e RateLimit_Action_SourceClusterValidationError) Key() bool { return e.key }
7508
7509// ErrorName returns error name.
7510func (e RateLimit_Action_SourceClusterValidationError) ErrorName() string {
7511	return "RateLimit_Action_SourceClusterValidationError"
7512}
7513
7514// Error satisfies the builtin error interface
7515func (e RateLimit_Action_SourceClusterValidationError) Error() string {
7516	cause := ""
7517	if e.cause != nil {
7518		cause = fmt.Sprintf(" | caused by: %v", e.cause)
7519	}
7520
7521	key := ""
7522	if e.key {
7523		key = "key for "
7524	}
7525
7526	return fmt.Sprintf(
7527		"invalid %sRateLimit_Action_SourceCluster.%s: %s%s",
7528		key,
7529		e.field,
7530		e.reason,
7531		cause)
7532}
7533
7534var _ error = RateLimit_Action_SourceClusterValidationError{}
7535
7536var _ interface {
7537	Field() string
7538	Reason() string
7539	Key() bool
7540	Cause() error
7541	ErrorName() string
7542} = RateLimit_Action_SourceClusterValidationError{}
7543
7544// Validate checks the field values on RateLimit_Action_DestinationCluster with
7545// the rules defined in the proto definition for this message. If any rules
7546// are violated, the first error encountered is returned, or nil if there are
7547// no violations.
7548func (m *RateLimit_Action_DestinationCluster) Validate() error {
7549	return m.validate(false)
7550}
7551
7552// ValidateAll checks the field values on RateLimit_Action_DestinationCluster
7553// with the rules defined in the proto definition for this message. If any
7554// rules are violated, the result is a list of violation errors wrapped in
7555// RateLimit_Action_DestinationClusterMultiError, or nil if none found.
7556func (m *RateLimit_Action_DestinationCluster) ValidateAll() error {
7557	return m.validate(true)
7558}
7559
7560func (m *RateLimit_Action_DestinationCluster) validate(all bool) error {
7561	if m == nil {
7562		return nil
7563	}
7564
7565	var errors []error
7566
7567	if len(errors) > 0 {
7568		return RateLimit_Action_DestinationClusterMultiError(errors)
7569	}
7570	return nil
7571}
7572
7573// RateLimit_Action_DestinationClusterMultiError is an error wrapping multiple
7574// validation errors returned by
7575// RateLimit_Action_DestinationCluster.ValidateAll() if the designated
7576// constraints aren't met.
7577type RateLimit_Action_DestinationClusterMultiError []error
7578
7579// Error returns a concatenation of all the error messages it wraps.
7580func (m RateLimit_Action_DestinationClusterMultiError) Error() string {
7581	var msgs []string
7582	for _, err := range m {
7583		msgs = append(msgs, err.Error())
7584	}
7585	return strings.Join(msgs, "; ")
7586}
7587
7588// AllErrors returns a list of validation violation errors.
7589func (m RateLimit_Action_DestinationClusterMultiError) AllErrors() []error { return m }
7590
7591// RateLimit_Action_DestinationClusterValidationError is the validation error
7592// returned by RateLimit_Action_DestinationCluster.Validate if the designated
7593// constraints aren't met.
7594type RateLimit_Action_DestinationClusterValidationError struct {
7595	field  string
7596	reason string
7597	cause  error
7598	key    bool
7599}
7600
7601// Field function returns field value.
7602func (e RateLimit_Action_DestinationClusterValidationError) Field() string { return e.field }
7603
7604// Reason function returns reason value.
7605func (e RateLimit_Action_DestinationClusterValidationError) Reason() string { return e.reason }
7606
7607// Cause function returns cause value.
7608func (e RateLimit_Action_DestinationClusterValidationError) Cause() error { return e.cause }
7609
7610// Key function returns key value.
7611func (e RateLimit_Action_DestinationClusterValidationError) Key() bool { return e.key }
7612
7613// ErrorName returns error name.
7614func (e RateLimit_Action_DestinationClusterValidationError) ErrorName() string {
7615	return "RateLimit_Action_DestinationClusterValidationError"
7616}
7617
7618// Error satisfies the builtin error interface
7619func (e RateLimit_Action_DestinationClusterValidationError) Error() string {
7620	cause := ""
7621	if e.cause != nil {
7622		cause = fmt.Sprintf(" | caused by: %v", e.cause)
7623	}
7624
7625	key := ""
7626	if e.key {
7627		key = "key for "
7628	}
7629
7630	return fmt.Sprintf(
7631		"invalid %sRateLimit_Action_DestinationCluster.%s: %s%s",
7632		key,
7633		e.field,
7634		e.reason,
7635		cause)
7636}
7637
7638var _ error = RateLimit_Action_DestinationClusterValidationError{}
7639
7640var _ interface {
7641	Field() string
7642	Reason() string
7643	Key() bool
7644	Cause() error
7645	ErrorName() string
7646} = RateLimit_Action_DestinationClusterValidationError{}
7647
7648// Validate checks the field values on RateLimit_Action_RequestHeaders with the
7649// rules defined in the proto definition for this message. If any rules are
7650// violated, the first error encountered is returned, or nil if there are no violations.
7651func (m *RateLimit_Action_RequestHeaders) Validate() error {
7652	return m.validate(false)
7653}
7654
7655// ValidateAll checks the field values on RateLimit_Action_RequestHeaders with
7656// the rules defined in the proto definition for this message. If any rules
7657// are violated, the result is a list of violation errors wrapped in
7658// RateLimit_Action_RequestHeadersMultiError, or nil if none found.
7659func (m *RateLimit_Action_RequestHeaders) ValidateAll() error {
7660	return m.validate(true)
7661}
7662
7663func (m *RateLimit_Action_RequestHeaders) validate(all bool) error {
7664	if m == nil {
7665		return nil
7666	}
7667
7668	var errors []error
7669
7670	if len(m.GetHeaderName()) < 1 {
7671		err := RateLimit_Action_RequestHeadersValidationError{
7672			field:  "HeaderName",
7673			reason: "value length must be at least 1 bytes",
7674		}
7675		if !all {
7676			return err
7677		}
7678		errors = append(errors, err)
7679	}
7680
7681	if !_RateLimit_Action_RequestHeaders_HeaderName_Pattern.MatchString(m.GetHeaderName()) {
7682		err := RateLimit_Action_RequestHeadersValidationError{
7683			field:  "HeaderName",
7684			reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
7685		}
7686		if !all {
7687			return err
7688		}
7689		errors = append(errors, err)
7690	}
7691
7692	if len(m.GetDescriptorKey()) < 1 {
7693		err := RateLimit_Action_RequestHeadersValidationError{
7694			field:  "DescriptorKey",
7695			reason: "value length must be at least 1 bytes",
7696		}
7697		if !all {
7698			return err
7699		}
7700		errors = append(errors, err)
7701	}
7702
7703	if len(errors) > 0 {
7704		return RateLimit_Action_RequestHeadersMultiError(errors)
7705	}
7706	return nil
7707}
7708
7709// RateLimit_Action_RequestHeadersMultiError is an error wrapping multiple
7710// validation errors returned by RateLimit_Action_RequestHeaders.ValidateAll()
7711// if the designated constraints aren't met.
7712type RateLimit_Action_RequestHeadersMultiError []error
7713
7714// Error returns a concatenation of all the error messages it wraps.
7715func (m RateLimit_Action_RequestHeadersMultiError) Error() string {
7716	var msgs []string
7717	for _, err := range m {
7718		msgs = append(msgs, err.Error())
7719	}
7720	return strings.Join(msgs, "; ")
7721}
7722
7723// AllErrors returns a list of validation violation errors.
7724func (m RateLimit_Action_RequestHeadersMultiError) AllErrors() []error { return m }
7725
7726// RateLimit_Action_RequestHeadersValidationError is the validation error
7727// returned by RateLimit_Action_RequestHeaders.Validate if the designated
7728// constraints aren't met.
7729type RateLimit_Action_RequestHeadersValidationError struct {
7730	field  string
7731	reason string
7732	cause  error
7733	key    bool
7734}
7735
7736// Field function returns field value.
7737func (e RateLimit_Action_RequestHeadersValidationError) Field() string { return e.field }
7738
7739// Reason function returns reason value.
7740func (e RateLimit_Action_RequestHeadersValidationError) Reason() string { return e.reason }
7741
7742// Cause function returns cause value.
7743func (e RateLimit_Action_RequestHeadersValidationError) Cause() error { return e.cause }
7744
7745// Key function returns key value.
7746func (e RateLimit_Action_RequestHeadersValidationError) Key() bool { return e.key }
7747
7748// ErrorName returns error name.
7749func (e RateLimit_Action_RequestHeadersValidationError) ErrorName() string {
7750	return "RateLimit_Action_RequestHeadersValidationError"
7751}
7752
7753// Error satisfies the builtin error interface
7754func (e RateLimit_Action_RequestHeadersValidationError) Error() string {
7755	cause := ""
7756	if e.cause != nil {
7757		cause = fmt.Sprintf(" | caused by: %v", e.cause)
7758	}
7759
7760	key := ""
7761	if e.key {
7762		key = "key for "
7763	}
7764
7765	return fmt.Sprintf(
7766		"invalid %sRateLimit_Action_RequestHeaders.%s: %s%s",
7767		key,
7768		e.field,
7769		e.reason,
7770		cause)
7771}
7772
7773var _ error = RateLimit_Action_RequestHeadersValidationError{}
7774
7775var _ interface {
7776	Field() string
7777	Reason() string
7778	Key() bool
7779	Cause() error
7780	ErrorName() string
7781} = RateLimit_Action_RequestHeadersValidationError{}
7782
7783var _RateLimit_Action_RequestHeaders_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
7784
7785// Validate checks the field values on RateLimit_Action_RemoteAddress with the
7786// rules defined in the proto definition for this message. If any rules are
7787// violated, the first error encountered is returned, or nil if there are no violations.
7788func (m *RateLimit_Action_RemoteAddress) Validate() error {
7789	return m.validate(false)
7790}
7791
7792// ValidateAll checks the field values on RateLimit_Action_RemoteAddress with
7793// the rules defined in the proto definition for this message. If any rules
7794// are violated, the result is a list of violation errors wrapped in
7795// RateLimit_Action_RemoteAddressMultiError, or nil if none found.
7796func (m *RateLimit_Action_RemoteAddress) ValidateAll() error {
7797	return m.validate(true)
7798}
7799
7800func (m *RateLimit_Action_RemoteAddress) validate(all bool) error {
7801	if m == nil {
7802		return nil
7803	}
7804
7805	var errors []error
7806
7807	if len(errors) > 0 {
7808		return RateLimit_Action_RemoteAddressMultiError(errors)
7809	}
7810	return nil
7811}
7812
7813// RateLimit_Action_RemoteAddressMultiError is an error wrapping multiple
7814// validation errors returned by RateLimit_Action_RemoteAddress.ValidateAll()
7815// if the designated constraints aren't met.
7816type RateLimit_Action_RemoteAddressMultiError []error
7817
7818// Error returns a concatenation of all the error messages it wraps.
7819func (m RateLimit_Action_RemoteAddressMultiError) Error() string {
7820	var msgs []string
7821	for _, err := range m {
7822		msgs = append(msgs, err.Error())
7823	}
7824	return strings.Join(msgs, "; ")
7825}
7826
7827// AllErrors returns a list of validation violation errors.
7828func (m RateLimit_Action_RemoteAddressMultiError) AllErrors() []error { return m }
7829
7830// RateLimit_Action_RemoteAddressValidationError is the validation error
7831// returned by RateLimit_Action_RemoteAddress.Validate if the designated
7832// constraints aren't met.
7833type RateLimit_Action_RemoteAddressValidationError struct {
7834	field  string
7835	reason string
7836	cause  error
7837	key    bool
7838}
7839
7840// Field function returns field value.
7841func (e RateLimit_Action_RemoteAddressValidationError) Field() string { return e.field }
7842
7843// Reason function returns reason value.
7844func (e RateLimit_Action_RemoteAddressValidationError) Reason() string { return e.reason }
7845
7846// Cause function returns cause value.
7847func (e RateLimit_Action_RemoteAddressValidationError) Cause() error { return e.cause }
7848
7849// Key function returns key value.
7850func (e RateLimit_Action_RemoteAddressValidationError) Key() bool { return e.key }
7851
7852// ErrorName returns error name.
7853func (e RateLimit_Action_RemoteAddressValidationError) ErrorName() string {
7854	return "RateLimit_Action_RemoteAddressValidationError"
7855}
7856
7857// Error satisfies the builtin error interface
7858func (e RateLimit_Action_RemoteAddressValidationError) Error() string {
7859	cause := ""
7860	if e.cause != nil {
7861		cause = fmt.Sprintf(" | caused by: %v", e.cause)
7862	}
7863
7864	key := ""
7865	if e.key {
7866		key = "key for "
7867	}
7868
7869	return fmt.Sprintf(
7870		"invalid %sRateLimit_Action_RemoteAddress.%s: %s%s",
7871		key,
7872		e.field,
7873		e.reason,
7874		cause)
7875}
7876
7877var _ error = RateLimit_Action_RemoteAddressValidationError{}
7878
7879var _ interface {
7880	Field() string
7881	Reason() string
7882	Key() bool
7883	Cause() error
7884	ErrorName() string
7885} = RateLimit_Action_RemoteAddressValidationError{}
7886
7887// Validate checks the field values on RateLimit_Action_GenericKey with the
7888// rules defined in the proto definition for this message. If any rules are
7889// violated, the first error encountered is returned, or nil if there are no violations.
7890func (m *RateLimit_Action_GenericKey) Validate() error {
7891	return m.validate(false)
7892}
7893
7894// ValidateAll checks the field values on RateLimit_Action_GenericKey with the
7895// rules defined in the proto definition for this message. If any rules are
7896// violated, the result is a list of violation errors wrapped in
7897// RateLimit_Action_GenericKeyMultiError, or nil if none found.
7898func (m *RateLimit_Action_GenericKey) ValidateAll() error {
7899	return m.validate(true)
7900}
7901
7902func (m *RateLimit_Action_GenericKey) validate(all bool) error {
7903	if m == nil {
7904		return nil
7905	}
7906
7907	var errors []error
7908
7909	if len(m.GetDescriptorValue()) < 1 {
7910		err := RateLimit_Action_GenericKeyValidationError{
7911			field:  "DescriptorValue",
7912			reason: "value length must be at least 1 bytes",
7913		}
7914		if !all {
7915			return err
7916		}
7917		errors = append(errors, err)
7918	}
7919
7920	if len(errors) > 0 {
7921		return RateLimit_Action_GenericKeyMultiError(errors)
7922	}
7923	return nil
7924}
7925
7926// RateLimit_Action_GenericKeyMultiError is an error wrapping multiple
7927// validation errors returned by RateLimit_Action_GenericKey.ValidateAll() if
7928// the designated constraints aren't met.
7929type RateLimit_Action_GenericKeyMultiError []error
7930
7931// Error returns a concatenation of all the error messages it wraps.
7932func (m RateLimit_Action_GenericKeyMultiError) Error() string {
7933	var msgs []string
7934	for _, err := range m {
7935		msgs = append(msgs, err.Error())
7936	}
7937	return strings.Join(msgs, "; ")
7938}
7939
7940// AllErrors returns a list of validation violation errors.
7941func (m RateLimit_Action_GenericKeyMultiError) AllErrors() []error { return m }
7942
7943// RateLimit_Action_GenericKeyValidationError is the validation error returned
7944// by RateLimit_Action_GenericKey.Validate if the designated constraints
7945// aren't met.
7946type RateLimit_Action_GenericKeyValidationError struct {
7947	field  string
7948	reason string
7949	cause  error
7950	key    bool
7951}
7952
7953// Field function returns field value.
7954func (e RateLimit_Action_GenericKeyValidationError) Field() string { return e.field }
7955
7956// Reason function returns reason value.
7957func (e RateLimit_Action_GenericKeyValidationError) Reason() string { return e.reason }
7958
7959// Cause function returns cause value.
7960func (e RateLimit_Action_GenericKeyValidationError) Cause() error { return e.cause }
7961
7962// Key function returns key value.
7963func (e RateLimit_Action_GenericKeyValidationError) Key() bool { return e.key }
7964
7965// ErrorName returns error name.
7966func (e RateLimit_Action_GenericKeyValidationError) ErrorName() string {
7967	return "RateLimit_Action_GenericKeyValidationError"
7968}
7969
7970// Error satisfies the builtin error interface
7971func (e RateLimit_Action_GenericKeyValidationError) Error() string {
7972	cause := ""
7973	if e.cause != nil {
7974		cause = fmt.Sprintf(" | caused by: %v", e.cause)
7975	}
7976
7977	key := ""
7978	if e.key {
7979		key = "key for "
7980	}
7981
7982	return fmt.Sprintf(
7983		"invalid %sRateLimit_Action_GenericKey.%s: %s%s",
7984		key,
7985		e.field,
7986		e.reason,
7987		cause)
7988}
7989
7990var _ error = RateLimit_Action_GenericKeyValidationError{}
7991
7992var _ interface {
7993	Field() string
7994	Reason() string
7995	Key() bool
7996	Cause() error
7997	ErrorName() string
7998} = RateLimit_Action_GenericKeyValidationError{}
7999
8000// Validate checks the field values on RateLimit_Action_HeaderValueMatch with
8001// the rules defined in the proto definition for this message. If any rules
8002// are violated, the first error encountered is returned, or nil if there are
8003// no violations.
8004func (m *RateLimit_Action_HeaderValueMatch) Validate() error {
8005	return m.validate(false)
8006}
8007
8008// ValidateAll checks the field values on RateLimit_Action_HeaderValueMatch
8009// with the rules defined in the proto definition for this message. If any
8010// rules are violated, the result is a list of violation errors wrapped in
8011// RateLimit_Action_HeaderValueMatchMultiError, or nil if none found.
8012func (m *RateLimit_Action_HeaderValueMatch) ValidateAll() error {
8013	return m.validate(true)
8014}
8015
8016func (m *RateLimit_Action_HeaderValueMatch) validate(all bool) error {
8017	if m == nil {
8018		return nil
8019	}
8020
8021	var errors []error
8022
8023	if len(m.GetDescriptorValue()) < 1 {
8024		err := RateLimit_Action_HeaderValueMatchValidationError{
8025			field:  "DescriptorValue",
8026			reason: "value length must be at least 1 bytes",
8027		}
8028		if !all {
8029			return err
8030		}
8031		errors = append(errors, err)
8032	}
8033
8034	if all {
8035		switch v := interface{}(m.GetExpectMatch()).(type) {
8036		case interface{ ValidateAll() error }:
8037			if err := v.ValidateAll(); err != nil {
8038				errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{
8039					field:  "ExpectMatch",
8040					reason: "embedded message failed validation",
8041					cause:  err,
8042				})
8043			}
8044		case interface{ Validate() error }:
8045			if err := v.Validate(); err != nil {
8046				errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{
8047					field:  "ExpectMatch",
8048					reason: "embedded message failed validation",
8049					cause:  err,
8050				})
8051			}
8052		}
8053	} else if v, ok := interface{}(m.GetExpectMatch()).(interface{ Validate() error }); ok {
8054		if err := v.Validate(); err != nil {
8055			return RateLimit_Action_HeaderValueMatchValidationError{
8056				field:  "ExpectMatch",
8057				reason: "embedded message failed validation",
8058				cause:  err,
8059			}
8060		}
8061	}
8062
8063	if len(m.GetHeaders()) < 1 {
8064		err := RateLimit_Action_HeaderValueMatchValidationError{
8065			field:  "Headers",
8066			reason: "value must contain at least 1 item(s)",
8067		}
8068		if !all {
8069			return err
8070		}
8071		errors = append(errors, err)
8072	}
8073
8074	for idx, item := range m.GetHeaders() {
8075		_, _ = idx, item
8076
8077		if all {
8078			switch v := interface{}(item).(type) {
8079			case interface{ ValidateAll() error }:
8080				if err := v.ValidateAll(); err != nil {
8081					errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{
8082						field:  fmt.Sprintf("Headers[%v]", idx),
8083						reason: "embedded message failed validation",
8084						cause:  err,
8085					})
8086				}
8087			case interface{ Validate() error }:
8088				if err := v.Validate(); err != nil {
8089					errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{
8090						field:  fmt.Sprintf("Headers[%v]", idx),
8091						reason: "embedded message failed validation",
8092						cause:  err,
8093					})
8094				}
8095			}
8096		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
8097			if err := v.Validate(); err != nil {
8098				return RateLimit_Action_HeaderValueMatchValidationError{
8099					field:  fmt.Sprintf("Headers[%v]", idx),
8100					reason: "embedded message failed validation",
8101					cause:  err,
8102				}
8103			}
8104		}
8105
8106	}
8107
8108	if len(errors) > 0 {
8109		return RateLimit_Action_HeaderValueMatchMultiError(errors)
8110	}
8111	return nil
8112}
8113
8114// RateLimit_Action_HeaderValueMatchMultiError is an error wrapping multiple
8115// validation errors returned by
8116// RateLimit_Action_HeaderValueMatch.ValidateAll() if the designated
8117// constraints aren't met.
8118type RateLimit_Action_HeaderValueMatchMultiError []error
8119
8120// Error returns a concatenation of all the error messages it wraps.
8121func (m RateLimit_Action_HeaderValueMatchMultiError) Error() string {
8122	var msgs []string
8123	for _, err := range m {
8124		msgs = append(msgs, err.Error())
8125	}
8126	return strings.Join(msgs, "; ")
8127}
8128
8129// AllErrors returns a list of validation violation errors.
8130func (m RateLimit_Action_HeaderValueMatchMultiError) AllErrors() []error { return m }
8131
8132// RateLimit_Action_HeaderValueMatchValidationError is the validation error
8133// returned by RateLimit_Action_HeaderValueMatch.Validate if the designated
8134// constraints aren't met.
8135type RateLimit_Action_HeaderValueMatchValidationError struct {
8136	field  string
8137	reason string
8138	cause  error
8139	key    bool
8140}
8141
8142// Field function returns field value.
8143func (e RateLimit_Action_HeaderValueMatchValidationError) Field() string { return e.field }
8144
8145// Reason function returns reason value.
8146func (e RateLimit_Action_HeaderValueMatchValidationError) Reason() string { return e.reason }
8147
8148// Cause function returns cause value.
8149func (e RateLimit_Action_HeaderValueMatchValidationError) Cause() error { return e.cause }
8150
8151// Key function returns key value.
8152func (e RateLimit_Action_HeaderValueMatchValidationError) Key() bool { return e.key }
8153
8154// ErrorName returns error name.
8155func (e RateLimit_Action_HeaderValueMatchValidationError) ErrorName() string {
8156	return "RateLimit_Action_HeaderValueMatchValidationError"
8157}
8158
8159// Error satisfies the builtin error interface
8160func (e RateLimit_Action_HeaderValueMatchValidationError) Error() string {
8161	cause := ""
8162	if e.cause != nil {
8163		cause = fmt.Sprintf(" | caused by: %v", e.cause)
8164	}
8165
8166	key := ""
8167	if e.key {
8168		key = "key for "
8169	}
8170
8171	return fmt.Sprintf(
8172		"invalid %sRateLimit_Action_HeaderValueMatch.%s: %s%s",
8173		key,
8174		e.field,
8175		e.reason,
8176		cause)
8177}
8178
8179var _ error = RateLimit_Action_HeaderValueMatchValidationError{}
8180
8181var _ interface {
8182	Field() string
8183	Reason() string
8184	Key() bool
8185	Cause() error
8186	ErrorName() string
8187} = RateLimit_Action_HeaderValueMatchValidationError{}
8188