1// Code generated by protoc-gen-validate. DO NOT EDIT.
2// source: envoy/extensions/filters/network/redis_proxy/v3/redis_proxy.proto
3
4package envoy_extensions_filters_network_redis_proxy_v3
5
6import (
7	"bytes"
8	"errors"
9	"fmt"
10	"net"
11	"net/mail"
12	"net/url"
13	"regexp"
14	"strings"
15	"time"
16	"unicode/utf8"
17
18	"google.golang.org/protobuf/types/known/anypb"
19)
20
21// ensure the imports are used
22var (
23	_ = bytes.MinRead
24	_ = errors.New("")
25	_ = fmt.Print
26	_ = utf8.UTFMax
27	_ = (*regexp.Regexp)(nil)
28	_ = (*strings.Reader)(nil)
29	_ = net.IPv4len
30	_ = time.Duration(0)
31	_ = (*url.URL)(nil)
32	_ = (*mail.Address)(nil)
33	_ = anypb.Any{}
34)
35
36// Validate checks the field values on RedisProxy with the rules defined in the
37// proto definition for this message. If any rules are violated, an error is returned.
38func (m *RedisProxy) Validate() error {
39	if m == nil {
40		return nil
41	}
42
43	if utf8.RuneCountInString(m.GetStatPrefix()) < 1 {
44		return RedisProxyValidationError{
45			field:  "StatPrefix",
46			reason: "value length must be at least 1 runes",
47		}
48	}
49
50	if m.GetSettings() == nil {
51		return RedisProxyValidationError{
52			field:  "Settings",
53			reason: "value is required",
54		}
55	}
56
57	if v, ok := interface{}(m.GetSettings()).(interface{ Validate() error }); ok {
58		if err := v.Validate(); err != nil {
59			return RedisProxyValidationError{
60				field:  "Settings",
61				reason: "embedded message failed validation",
62				cause:  err,
63			}
64		}
65	}
66
67	// no validation rules for LatencyInMicros
68
69	if v, ok := interface{}(m.GetPrefixRoutes()).(interface{ Validate() error }); ok {
70		if err := v.Validate(); err != nil {
71			return RedisProxyValidationError{
72				field:  "PrefixRoutes",
73				reason: "embedded message failed validation",
74				cause:  err,
75			}
76		}
77	}
78
79	if v, ok := interface{}(m.GetDownstreamAuthPassword()).(interface{ Validate() error }); ok {
80		if err := v.Validate(); err != nil {
81			return RedisProxyValidationError{
82				field:  "DownstreamAuthPassword",
83				reason: "embedded message failed validation",
84				cause:  err,
85			}
86		}
87	}
88
89	for idx, item := range m.GetFaults() {
90		_, _ = idx, item
91
92		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
93			if err := v.Validate(); err != nil {
94				return RedisProxyValidationError{
95					field:  fmt.Sprintf("Faults[%v]", idx),
96					reason: "embedded message failed validation",
97					cause:  err,
98				}
99			}
100		}
101
102	}
103
104	if v, ok := interface{}(m.GetDownstreamAuthUsername()).(interface{ Validate() error }); ok {
105		if err := v.Validate(); err != nil {
106			return RedisProxyValidationError{
107				field:  "DownstreamAuthUsername",
108				reason: "embedded message failed validation",
109				cause:  err,
110			}
111		}
112	}
113
114	// no validation rules for HiddenEnvoyDeprecatedCluster
115
116	return nil
117}
118
119// RedisProxyValidationError is the validation error returned by
120// RedisProxy.Validate if the designated constraints aren't met.
121type RedisProxyValidationError struct {
122	field  string
123	reason string
124	cause  error
125	key    bool
126}
127
128// Field function returns field value.
129func (e RedisProxyValidationError) Field() string { return e.field }
130
131// Reason function returns reason value.
132func (e RedisProxyValidationError) Reason() string { return e.reason }
133
134// Cause function returns cause value.
135func (e RedisProxyValidationError) Cause() error { return e.cause }
136
137// Key function returns key value.
138func (e RedisProxyValidationError) Key() bool { return e.key }
139
140// ErrorName returns error name.
141func (e RedisProxyValidationError) ErrorName() string { return "RedisProxyValidationError" }
142
143// Error satisfies the builtin error interface
144func (e RedisProxyValidationError) Error() string {
145	cause := ""
146	if e.cause != nil {
147		cause = fmt.Sprintf(" | caused by: %v", e.cause)
148	}
149
150	key := ""
151	if e.key {
152		key = "key for "
153	}
154
155	return fmt.Sprintf(
156		"invalid %sRedisProxy.%s: %s%s",
157		key,
158		e.field,
159		e.reason,
160		cause)
161}
162
163var _ error = RedisProxyValidationError{}
164
165var _ interface {
166	Field() string
167	Reason() string
168	Key() bool
169	Cause() error
170	ErrorName() string
171} = RedisProxyValidationError{}
172
173// Validate checks the field values on RedisProtocolOptions with the rules
174// defined in the proto definition for this message. If any rules are
175// violated, an error is returned.
176func (m *RedisProtocolOptions) Validate() error {
177	if m == nil {
178		return nil
179	}
180
181	if v, ok := interface{}(m.GetAuthPassword()).(interface{ Validate() error }); ok {
182		if err := v.Validate(); err != nil {
183			return RedisProtocolOptionsValidationError{
184				field:  "AuthPassword",
185				reason: "embedded message failed validation",
186				cause:  err,
187			}
188		}
189	}
190
191	if v, ok := interface{}(m.GetAuthUsername()).(interface{ Validate() error }); ok {
192		if err := v.Validate(); err != nil {
193			return RedisProtocolOptionsValidationError{
194				field:  "AuthUsername",
195				reason: "embedded message failed validation",
196				cause:  err,
197			}
198		}
199	}
200
201	return nil
202}
203
204// RedisProtocolOptionsValidationError is the validation error returned by
205// RedisProtocolOptions.Validate if the designated constraints aren't met.
206type RedisProtocolOptionsValidationError struct {
207	field  string
208	reason string
209	cause  error
210	key    bool
211}
212
213// Field function returns field value.
214func (e RedisProtocolOptionsValidationError) Field() string { return e.field }
215
216// Reason function returns reason value.
217func (e RedisProtocolOptionsValidationError) Reason() string { return e.reason }
218
219// Cause function returns cause value.
220func (e RedisProtocolOptionsValidationError) Cause() error { return e.cause }
221
222// Key function returns key value.
223func (e RedisProtocolOptionsValidationError) Key() bool { return e.key }
224
225// ErrorName returns error name.
226func (e RedisProtocolOptionsValidationError) ErrorName() string {
227	return "RedisProtocolOptionsValidationError"
228}
229
230// Error satisfies the builtin error interface
231func (e RedisProtocolOptionsValidationError) Error() string {
232	cause := ""
233	if e.cause != nil {
234		cause = fmt.Sprintf(" | caused by: %v", e.cause)
235	}
236
237	key := ""
238	if e.key {
239		key = "key for "
240	}
241
242	return fmt.Sprintf(
243		"invalid %sRedisProtocolOptions.%s: %s%s",
244		key,
245		e.field,
246		e.reason,
247		cause)
248}
249
250var _ error = RedisProtocolOptionsValidationError{}
251
252var _ interface {
253	Field() string
254	Reason() string
255	Key() bool
256	Cause() error
257	ErrorName() string
258} = RedisProtocolOptionsValidationError{}
259
260// Validate checks the field values on RedisProxy_ConnPoolSettings with the
261// rules defined in the proto definition for this message. If any rules are
262// violated, an error is returned.
263func (m *RedisProxy_ConnPoolSettings) Validate() error {
264	if m == nil {
265		return nil
266	}
267
268	if m.GetOpTimeout() == nil {
269		return RedisProxy_ConnPoolSettingsValidationError{
270			field:  "OpTimeout",
271			reason: "value is required",
272		}
273	}
274
275	// no validation rules for EnableHashtagging
276
277	// no validation rules for EnableRedirection
278
279	// no validation rules for MaxBufferSizeBeforeFlush
280
281	if v, ok := interface{}(m.GetBufferFlushTimeout()).(interface{ Validate() error }); ok {
282		if err := v.Validate(); err != nil {
283			return RedisProxy_ConnPoolSettingsValidationError{
284				field:  "BufferFlushTimeout",
285				reason: "embedded message failed validation",
286				cause:  err,
287			}
288		}
289	}
290
291	if v, ok := interface{}(m.GetMaxUpstreamUnknownConnections()).(interface{ Validate() error }); ok {
292		if err := v.Validate(); err != nil {
293			return RedisProxy_ConnPoolSettingsValidationError{
294				field:  "MaxUpstreamUnknownConnections",
295				reason: "embedded message failed validation",
296				cause:  err,
297			}
298		}
299	}
300
301	// no validation rules for EnableCommandStats
302
303	if _, ok := RedisProxy_ConnPoolSettings_ReadPolicy_name[int32(m.GetReadPolicy())]; !ok {
304		return RedisProxy_ConnPoolSettingsValidationError{
305			field:  "ReadPolicy",
306			reason: "value must be one of the defined enum values",
307		}
308	}
309
310	return nil
311}
312
313// RedisProxy_ConnPoolSettingsValidationError is the validation error returned
314// by RedisProxy_ConnPoolSettings.Validate if the designated constraints
315// aren't met.
316type RedisProxy_ConnPoolSettingsValidationError struct {
317	field  string
318	reason string
319	cause  error
320	key    bool
321}
322
323// Field function returns field value.
324func (e RedisProxy_ConnPoolSettingsValidationError) Field() string { return e.field }
325
326// Reason function returns reason value.
327func (e RedisProxy_ConnPoolSettingsValidationError) Reason() string { return e.reason }
328
329// Cause function returns cause value.
330func (e RedisProxy_ConnPoolSettingsValidationError) Cause() error { return e.cause }
331
332// Key function returns key value.
333func (e RedisProxy_ConnPoolSettingsValidationError) Key() bool { return e.key }
334
335// ErrorName returns error name.
336func (e RedisProxy_ConnPoolSettingsValidationError) ErrorName() string {
337	return "RedisProxy_ConnPoolSettingsValidationError"
338}
339
340// Error satisfies the builtin error interface
341func (e RedisProxy_ConnPoolSettingsValidationError) Error() string {
342	cause := ""
343	if e.cause != nil {
344		cause = fmt.Sprintf(" | caused by: %v", e.cause)
345	}
346
347	key := ""
348	if e.key {
349		key = "key for "
350	}
351
352	return fmt.Sprintf(
353		"invalid %sRedisProxy_ConnPoolSettings.%s: %s%s",
354		key,
355		e.field,
356		e.reason,
357		cause)
358}
359
360var _ error = RedisProxy_ConnPoolSettingsValidationError{}
361
362var _ interface {
363	Field() string
364	Reason() string
365	Key() bool
366	Cause() error
367	ErrorName() string
368} = RedisProxy_ConnPoolSettingsValidationError{}
369
370// Validate checks the field values on RedisProxy_PrefixRoutes with the rules
371// defined in the proto definition for this message. If any rules are
372// violated, an error is returned.
373func (m *RedisProxy_PrefixRoutes) Validate() error {
374	if m == nil {
375		return nil
376	}
377
378	for idx, item := range m.GetRoutes() {
379		_, _ = idx, item
380
381		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
382			if err := v.Validate(); err != nil {
383				return RedisProxy_PrefixRoutesValidationError{
384					field:  fmt.Sprintf("Routes[%v]", idx),
385					reason: "embedded message failed validation",
386					cause:  err,
387				}
388			}
389		}
390
391	}
392
393	// no validation rules for CaseInsensitive
394
395	if v, ok := interface{}(m.GetCatchAllRoute()).(interface{ Validate() error }); ok {
396		if err := v.Validate(); err != nil {
397			return RedisProxy_PrefixRoutesValidationError{
398				field:  "CatchAllRoute",
399				reason: "embedded message failed validation",
400				cause:  err,
401			}
402		}
403	}
404
405	// no validation rules for HiddenEnvoyDeprecatedCatchAllCluster
406
407	return nil
408}
409
410// RedisProxy_PrefixRoutesValidationError is the validation error returned by
411// RedisProxy_PrefixRoutes.Validate if the designated constraints aren't met.
412type RedisProxy_PrefixRoutesValidationError struct {
413	field  string
414	reason string
415	cause  error
416	key    bool
417}
418
419// Field function returns field value.
420func (e RedisProxy_PrefixRoutesValidationError) Field() string { return e.field }
421
422// Reason function returns reason value.
423func (e RedisProxy_PrefixRoutesValidationError) Reason() string { return e.reason }
424
425// Cause function returns cause value.
426func (e RedisProxy_PrefixRoutesValidationError) Cause() error { return e.cause }
427
428// Key function returns key value.
429func (e RedisProxy_PrefixRoutesValidationError) Key() bool { return e.key }
430
431// ErrorName returns error name.
432func (e RedisProxy_PrefixRoutesValidationError) ErrorName() string {
433	return "RedisProxy_PrefixRoutesValidationError"
434}
435
436// Error satisfies the builtin error interface
437func (e RedisProxy_PrefixRoutesValidationError) Error() string {
438	cause := ""
439	if e.cause != nil {
440		cause = fmt.Sprintf(" | caused by: %v", e.cause)
441	}
442
443	key := ""
444	if e.key {
445		key = "key for "
446	}
447
448	return fmt.Sprintf(
449		"invalid %sRedisProxy_PrefixRoutes.%s: %s%s",
450		key,
451		e.field,
452		e.reason,
453		cause)
454}
455
456var _ error = RedisProxy_PrefixRoutesValidationError{}
457
458var _ interface {
459	Field() string
460	Reason() string
461	Key() bool
462	Cause() error
463	ErrorName() string
464} = RedisProxy_PrefixRoutesValidationError{}
465
466// Validate checks the field values on RedisProxy_RedisFault with the rules
467// defined in the proto definition for this message. If any rules are
468// violated, an error is returned.
469func (m *RedisProxy_RedisFault) Validate() error {
470	if m == nil {
471		return nil
472	}
473
474	if _, ok := RedisProxy_RedisFault_RedisFaultType_name[int32(m.GetFaultType())]; !ok {
475		return RedisProxy_RedisFaultValidationError{
476			field:  "FaultType",
477			reason: "value must be one of the defined enum values",
478		}
479	}
480
481	if m.GetFaultEnabled() == nil {
482		return RedisProxy_RedisFaultValidationError{
483			field:  "FaultEnabled",
484			reason: "value is required",
485		}
486	}
487
488	if v, ok := interface{}(m.GetFaultEnabled()).(interface{ Validate() error }); ok {
489		if err := v.Validate(); err != nil {
490			return RedisProxy_RedisFaultValidationError{
491				field:  "FaultEnabled",
492				reason: "embedded message failed validation",
493				cause:  err,
494			}
495		}
496	}
497
498	if v, ok := interface{}(m.GetDelay()).(interface{ Validate() error }); ok {
499		if err := v.Validate(); err != nil {
500			return RedisProxy_RedisFaultValidationError{
501				field:  "Delay",
502				reason: "embedded message failed validation",
503				cause:  err,
504			}
505		}
506	}
507
508	return nil
509}
510
511// RedisProxy_RedisFaultValidationError is the validation error returned by
512// RedisProxy_RedisFault.Validate if the designated constraints aren't met.
513type RedisProxy_RedisFaultValidationError struct {
514	field  string
515	reason string
516	cause  error
517	key    bool
518}
519
520// Field function returns field value.
521func (e RedisProxy_RedisFaultValidationError) Field() string { return e.field }
522
523// Reason function returns reason value.
524func (e RedisProxy_RedisFaultValidationError) Reason() string { return e.reason }
525
526// Cause function returns cause value.
527func (e RedisProxy_RedisFaultValidationError) Cause() error { return e.cause }
528
529// Key function returns key value.
530func (e RedisProxy_RedisFaultValidationError) Key() bool { return e.key }
531
532// ErrorName returns error name.
533func (e RedisProxy_RedisFaultValidationError) ErrorName() string {
534	return "RedisProxy_RedisFaultValidationError"
535}
536
537// Error satisfies the builtin error interface
538func (e RedisProxy_RedisFaultValidationError) Error() string {
539	cause := ""
540	if e.cause != nil {
541		cause = fmt.Sprintf(" | caused by: %v", e.cause)
542	}
543
544	key := ""
545	if e.key {
546		key = "key for "
547	}
548
549	return fmt.Sprintf(
550		"invalid %sRedisProxy_RedisFault.%s: %s%s",
551		key,
552		e.field,
553		e.reason,
554		cause)
555}
556
557var _ error = RedisProxy_RedisFaultValidationError{}
558
559var _ interface {
560	Field() string
561	Reason() string
562	Key() bool
563	Cause() error
564	ErrorName() string
565} = RedisProxy_RedisFaultValidationError{}
566
567// Validate checks the field values on RedisProxy_PrefixRoutes_Route with the
568// rules defined in the proto definition for this message. If any rules are
569// violated, an error is returned.
570func (m *RedisProxy_PrefixRoutes_Route) Validate() error {
571	if m == nil {
572		return nil
573	}
574
575	if len(m.GetPrefix()) > 1000 {
576		return RedisProxy_PrefixRoutes_RouteValidationError{
577			field:  "Prefix",
578			reason: "value length must be at most 1000 bytes",
579		}
580	}
581
582	// no validation rules for RemovePrefix
583
584	if utf8.RuneCountInString(m.GetCluster()) < 1 {
585		return RedisProxy_PrefixRoutes_RouteValidationError{
586			field:  "Cluster",
587			reason: "value length must be at least 1 runes",
588		}
589	}
590
591	for idx, item := range m.GetRequestMirrorPolicy() {
592		_, _ = idx, item
593
594		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
595			if err := v.Validate(); err != nil {
596				return RedisProxy_PrefixRoutes_RouteValidationError{
597					field:  fmt.Sprintf("RequestMirrorPolicy[%v]", idx),
598					reason: "embedded message failed validation",
599					cause:  err,
600				}
601			}
602		}
603
604	}
605
606	return nil
607}
608
609// RedisProxy_PrefixRoutes_RouteValidationError is the validation error
610// returned by RedisProxy_PrefixRoutes_Route.Validate if the designated
611// constraints aren't met.
612type RedisProxy_PrefixRoutes_RouteValidationError struct {
613	field  string
614	reason string
615	cause  error
616	key    bool
617}
618
619// Field function returns field value.
620func (e RedisProxy_PrefixRoutes_RouteValidationError) Field() string { return e.field }
621
622// Reason function returns reason value.
623func (e RedisProxy_PrefixRoutes_RouteValidationError) Reason() string { return e.reason }
624
625// Cause function returns cause value.
626func (e RedisProxy_PrefixRoutes_RouteValidationError) Cause() error { return e.cause }
627
628// Key function returns key value.
629func (e RedisProxy_PrefixRoutes_RouteValidationError) Key() bool { return e.key }
630
631// ErrorName returns error name.
632func (e RedisProxy_PrefixRoutes_RouteValidationError) ErrorName() string {
633	return "RedisProxy_PrefixRoutes_RouteValidationError"
634}
635
636// Error satisfies the builtin error interface
637func (e RedisProxy_PrefixRoutes_RouteValidationError) Error() string {
638	cause := ""
639	if e.cause != nil {
640		cause = fmt.Sprintf(" | caused by: %v", e.cause)
641	}
642
643	key := ""
644	if e.key {
645		key = "key for "
646	}
647
648	return fmt.Sprintf(
649		"invalid %sRedisProxy_PrefixRoutes_Route.%s: %s%s",
650		key,
651		e.field,
652		e.reason,
653		cause)
654}
655
656var _ error = RedisProxy_PrefixRoutes_RouteValidationError{}
657
658var _ interface {
659	Field() string
660	Reason() string
661	Key() bool
662	Cause() error
663	ErrorName() string
664} = RedisProxy_PrefixRoutes_RouteValidationError{}
665
666// Validate checks the field values on
667// RedisProxy_PrefixRoutes_Route_RequestMirrorPolicy with the rules defined in
668// the proto definition for this message. If any rules are violated, an error
669// is returned.
670func (m *RedisProxy_PrefixRoutes_Route_RequestMirrorPolicy) Validate() error {
671	if m == nil {
672		return nil
673	}
674
675	if utf8.RuneCountInString(m.GetCluster()) < 1 {
676		return RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError{
677			field:  "Cluster",
678			reason: "value length must be at least 1 runes",
679		}
680	}
681
682	if v, ok := interface{}(m.GetRuntimeFraction()).(interface{ Validate() error }); ok {
683		if err := v.Validate(); err != nil {
684			return RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError{
685				field:  "RuntimeFraction",
686				reason: "embedded message failed validation",
687				cause:  err,
688			}
689		}
690	}
691
692	// no validation rules for ExcludeReadCommands
693
694	return nil
695}
696
697// RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError is the
698// validation error returned by
699// RedisProxy_PrefixRoutes_Route_RequestMirrorPolicy.Validate if the
700// designated constraints aren't met.
701type RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError struct {
702	field  string
703	reason string
704	cause  error
705	key    bool
706}
707
708// Field function returns field value.
709func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) Field() string {
710	return e.field
711}
712
713// Reason function returns reason value.
714func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) Reason() string {
715	return e.reason
716}
717
718// Cause function returns cause value.
719func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) Cause() error {
720	return e.cause
721}
722
723// Key function returns key value.
724func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) Key() bool { return e.key }
725
726// ErrorName returns error name.
727func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) ErrorName() string {
728	return "RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError"
729}
730
731// Error satisfies the builtin error interface
732func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) Error() string {
733	cause := ""
734	if e.cause != nil {
735		cause = fmt.Sprintf(" | caused by: %v", e.cause)
736	}
737
738	key := ""
739	if e.key {
740		key = "key for "
741	}
742
743	return fmt.Sprintf(
744		"invalid %sRedisProxy_PrefixRoutes_Route_RequestMirrorPolicy.%s: %s%s",
745		key,
746		e.field,
747		e.reason,
748		cause)
749}
750
751var _ error = RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError{}
752
753var _ interface {
754	Field() string
755	Reason() string
756	Key() bool
757	Cause() error
758	ErrorName() string
759} = RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError{}
760