1// Code generated by protoc-gen-validate. DO NOT EDIT.
2// source: envoy/config/core/v3/config_source.proto
3
4package envoy_config_core_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 ApiConfigSource with the rules defined
37// in the proto definition for this message. If any rules are violated, an
38// error is returned.
39func (m *ApiConfigSource) Validate() error {
40	if m == nil {
41		return nil
42	}
43
44	if _, ok := ApiConfigSource_ApiType_name[int32(m.GetApiType())]; !ok {
45		return ApiConfigSourceValidationError{
46			field:  "ApiType",
47			reason: "value must be one of the defined enum values",
48		}
49	}
50
51	if _, ok := ApiVersion_name[int32(m.GetTransportApiVersion())]; !ok {
52		return ApiConfigSourceValidationError{
53			field:  "TransportApiVersion",
54			reason: "value must be one of the defined enum values",
55		}
56	}
57
58	for idx, item := range m.GetGrpcServices() {
59		_, _ = idx, item
60
61		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
62			if err := v.Validate(); err != nil {
63				return ApiConfigSourceValidationError{
64					field:  fmt.Sprintf("GrpcServices[%v]", idx),
65					reason: "embedded message failed validation",
66					cause:  err,
67				}
68			}
69		}
70
71	}
72
73	if v, ok := interface{}(m.GetRefreshDelay()).(interface{ Validate() error }); ok {
74		if err := v.Validate(); err != nil {
75			return ApiConfigSourceValidationError{
76				field:  "RefreshDelay",
77				reason: "embedded message failed validation",
78				cause:  err,
79			}
80		}
81	}
82
83	if d := m.GetRequestTimeout(); d != nil {
84		dur, err := d.AsDuration(), d.CheckValid()
85		if err != nil {
86			return ApiConfigSourceValidationError{
87				field:  "RequestTimeout",
88				reason: "value is not a valid duration",
89				cause:  err,
90			}
91		}
92
93		gt := time.Duration(0*time.Second + 0*time.Nanosecond)
94
95		if dur <= gt {
96			return ApiConfigSourceValidationError{
97				field:  "RequestTimeout",
98				reason: "value must be greater than 0s",
99			}
100		}
101
102	}
103
104	if v, ok := interface{}(m.GetRateLimitSettings()).(interface{ Validate() error }); ok {
105		if err := v.Validate(); err != nil {
106			return ApiConfigSourceValidationError{
107				field:  "RateLimitSettings",
108				reason: "embedded message failed validation",
109				cause:  err,
110			}
111		}
112	}
113
114	// no validation rules for SetNodeOnFirstMessageOnly
115
116	return nil
117}
118
119// ApiConfigSourceValidationError is the validation error returned by
120// ApiConfigSource.Validate if the designated constraints aren't met.
121type ApiConfigSourceValidationError struct {
122	field  string
123	reason string
124	cause  error
125	key    bool
126}
127
128// Field function returns field value.
129func (e ApiConfigSourceValidationError) Field() string { return e.field }
130
131// Reason function returns reason value.
132func (e ApiConfigSourceValidationError) Reason() string { return e.reason }
133
134// Cause function returns cause value.
135func (e ApiConfigSourceValidationError) Cause() error { return e.cause }
136
137// Key function returns key value.
138func (e ApiConfigSourceValidationError) Key() bool { return e.key }
139
140// ErrorName returns error name.
141func (e ApiConfigSourceValidationError) ErrorName() string { return "ApiConfigSourceValidationError" }
142
143// Error satisfies the builtin error interface
144func (e ApiConfigSourceValidationError) 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 %sApiConfigSource.%s: %s%s",
157		key,
158		e.field,
159		e.reason,
160		cause)
161}
162
163var _ error = ApiConfigSourceValidationError{}
164
165var _ interface {
166	Field() string
167	Reason() string
168	Key() bool
169	Cause() error
170	ErrorName() string
171} = ApiConfigSourceValidationError{}
172
173// Validate checks the field values on AggregatedConfigSource with the rules
174// defined in the proto definition for this message. If any rules are
175// violated, an error is returned.
176func (m *AggregatedConfigSource) Validate() error {
177	if m == nil {
178		return nil
179	}
180
181	return nil
182}
183
184// AggregatedConfigSourceValidationError is the validation error returned by
185// AggregatedConfigSource.Validate if the designated constraints aren't met.
186type AggregatedConfigSourceValidationError struct {
187	field  string
188	reason string
189	cause  error
190	key    bool
191}
192
193// Field function returns field value.
194func (e AggregatedConfigSourceValidationError) Field() string { return e.field }
195
196// Reason function returns reason value.
197func (e AggregatedConfigSourceValidationError) Reason() string { return e.reason }
198
199// Cause function returns cause value.
200func (e AggregatedConfigSourceValidationError) Cause() error { return e.cause }
201
202// Key function returns key value.
203func (e AggregatedConfigSourceValidationError) Key() bool { return e.key }
204
205// ErrorName returns error name.
206func (e AggregatedConfigSourceValidationError) ErrorName() string {
207	return "AggregatedConfigSourceValidationError"
208}
209
210// Error satisfies the builtin error interface
211func (e AggregatedConfigSourceValidationError) Error() string {
212	cause := ""
213	if e.cause != nil {
214		cause = fmt.Sprintf(" | caused by: %v", e.cause)
215	}
216
217	key := ""
218	if e.key {
219		key = "key for "
220	}
221
222	return fmt.Sprintf(
223		"invalid %sAggregatedConfigSource.%s: %s%s",
224		key,
225		e.field,
226		e.reason,
227		cause)
228}
229
230var _ error = AggregatedConfigSourceValidationError{}
231
232var _ interface {
233	Field() string
234	Reason() string
235	Key() bool
236	Cause() error
237	ErrorName() string
238} = AggregatedConfigSourceValidationError{}
239
240// Validate checks the field values on SelfConfigSource with the rules defined
241// in the proto definition for this message. If any rules are violated, an
242// error is returned.
243func (m *SelfConfigSource) Validate() error {
244	if m == nil {
245		return nil
246	}
247
248	if _, ok := ApiVersion_name[int32(m.GetTransportApiVersion())]; !ok {
249		return SelfConfigSourceValidationError{
250			field:  "TransportApiVersion",
251			reason: "value must be one of the defined enum values",
252		}
253	}
254
255	return nil
256}
257
258// SelfConfigSourceValidationError is the validation error returned by
259// SelfConfigSource.Validate if the designated constraints aren't met.
260type SelfConfigSourceValidationError struct {
261	field  string
262	reason string
263	cause  error
264	key    bool
265}
266
267// Field function returns field value.
268func (e SelfConfigSourceValidationError) Field() string { return e.field }
269
270// Reason function returns reason value.
271func (e SelfConfigSourceValidationError) Reason() string { return e.reason }
272
273// Cause function returns cause value.
274func (e SelfConfigSourceValidationError) Cause() error { return e.cause }
275
276// Key function returns key value.
277func (e SelfConfigSourceValidationError) Key() bool { return e.key }
278
279// ErrorName returns error name.
280func (e SelfConfigSourceValidationError) ErrorName() string { return "SelfConfigSourceValidationError" }
281
282// Error satisfies the builtin error interface
283func (e SelfConfigSourceValidationError) Error() string {
284	cause := ""
285	if e.cause != nil {
286		cause = fmt.Sprintf(" | caused by: %v", e.cause)
287	}
288
289	key := ""
290	if e.key {
291		key = "key for "
292	}
293
294	return fmt.Sprintf(
295		"invalid %sSelfConfigSource.%s: %s%s",
296		key,
297		e.field,
298		e.reason,
299		cause)
300}
301
302var _ error = SelfConfigSourceValidationError{}
303
304var _ interface {
305	Field() string
306	Reason() string
307	Key() bool
308	Cause() error
309	ErrorName() string
310} = SelfConfigSourceValidationError{}
311
312// Validate checks the field values on RateLimitSettings with the rules defined
313// in the proto definition for this message. If any rules are violated, an
314// error is returned.
315func (m *RateLimitSettings) Validate() error {
316	if m == nil {
317		return nil
318	}
319
320	if v, ok := interface{}(m.GetMaxTokens()).(interface{ Validate() error }); ok {
321		if err := v.Validate(); err != nil {
322			return RateLimitSettingsValidationError{
323				field:  "MaxTokens",
324				reason: "embedded message failed validation",
325				cause:  err,
326			}
327		}
328	}
329
330	if wrapper := m.GetFillRate(); wrapper != nil {
331
332		if wrapper.GetValue() <= 0 {
333			return RateLimitSettingsValidationError{
334				field:  "FillRate",
335				reason: "value must be greater than 0",
336			}
337		}
338
339	}
340
341	return nil
342}
343
344// RateLimitSettingsValidationError is the validation error returned by
345// RateLimitSettings.Validate if the designated constraints aren't met.
346type RateLimitSettingsValidationError struct {
347	field  string
348	reason string
349	cause  error
350	key    bool
351}
352
353// Field function returns field value.
354func (e RateLimitSettingsValidationError) Field() string { return e.field }
355
356// Reason function returns reason value.
357func (e RateLimitSettingsValidationError) Reason() string { return e.reason }
358
359// Cause function returns cause value.
360func (e RateLimitSettingsValidationError) Cause() error { return e.cause }
361
362// Key function returns key value.
363func (e RateLimitSettingsValidationError) Key() bool { return e.key }
364
365// ErrorName returns error name.
366func (e RateLimitSettingsValidationError) ErrorName() string {
367	return "RateLimitSettingsValidationError"
368}
369
370// Error satisfies the builtin error interface
371func (e RateLimitSettingsValidationError) Error() string {
372	cause := ""
373	if e.cause != nil {
374		cause = fmt.Sprintf(" | caused by: %v", e.cause)
375	}
376
377	key := ""
378	if e.key {
379		key = "key for "
380	}
381
382	return fmt.Sprintf(
383		"invalid %sRateLimitSettings.%s: %s%s",
384		key,
385		e.field,
386		e.reason,
387		cause)
388}
389
390var _ error = RateLimitSettingsValidationError{}
391
392var _ interface {
393	Field() string
394	Reason() string
395	Key() bool
396	Cause() error
397	ErrorName() string
398} = RateLimitSettingsValidationError{}
399
400// Validate checks the field values on ConfigSource with the rules defined in
401// the proto definition for this message. If any rules are violated, an error
402// is returned.
403func (m *ConfigSource) Validate() error {
404	if m == nil {
405		return nil
406	}
407
408	for idx, item := range m.GetAuthorities() {
409		_, _ = idx, item
410
411		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
412			if err := v.Validate(); err != nil {
413				return ConfigSourceValidationError{
414					field:  fmt.Sprintf("Authorities[%v]", idx),
415					reason: "embedded message failed validation",
416					cause:  err,
417				}
418			}
419		}
420
421	}
422
423	if v, ok := interface{}(m.GetInitialFetchTimeout()).(interface{ Validate() error }); ok {
424		if err := v.Validate(); err != nil {
425			return ConfigSourceValidationError{
426				field:  "InitialFetchTimeout",
427				reason: "embedded message failed validation",
428				cause:  err,
429			}
430		}
431	}
432
433	if _, ok := ApiVersion_name[int32(m.GetResourceApiVersion())]; !ok {
434		return ConfigSourceValidationError{
435			field:  "ResourceApiVersion",
436			reason: "value must be one of the defined enum values",
437		}
438	}
439
440	switch m.ConfigSourceSpecifier.(type) {
441
442	case *ConfigSource_Path:
443		// no validation rules for Path
444
445	case *ConfigSource_ApiConfigSource:
446
447		if v, ok := interface{}(m.GetApiConfigSource()).(interface{ Validate() error }); ok {
448			if err := v.Validate(); err != nil {
449				return ConfigSourceValidationError{
450					field:  "ApiConfigSource",
451					reason: "embedded message failed validation",
452					cause:  err,
453				}
454			}
455		}
456
457	case *ConfigSource_Ads:
458
459		if v, ok := interface{}(m.GetAds()).(interface{ Validate() error }); ok {
460			if err := v.Validate(); err != nil {
461				return ConfigSourceValidationError{
462					field:  "Ads",
463					reason: "embedded message failed validation",
464					cause:  err,
465				}
466			}
467		}
468
469	case *ConfigSource_Self:
470
471		if v, ok := interface{}(m.GetSelf()).(interface{ Validate() error }); ok {
472			if err := v.Validate(); err != nil {
473				return ConfigSourceValidationError{
474					field:  "Self",
475					reason: "embedded message failed validation",
476					cause:  err,
477				}
478			}
479		}
480
481	default:
482		return ConfigSourceValidationError{
483			field:  "ConfigSourceSpecifier",
484			reason: "value is required",
485		}
486
487	}
488
489	return nil
490}
491
492// ConfigSourceValidationError is the validation error returned by
493// ConfigSource.Validate if the designated constraints aren't met.
494type ConfigSourceValidationError struct {
495	field  string
496	reason string
497	cause  error
498	key    bool
499}
500
501// Field function returns field value.
502func (e ConfigSourceValidationError) Field() string { return e.field }
503
504// Reason function returns reason value.
505func (e ConfigSourceValidationError) Reason() string { return e.reason }
506
507// Cause function returns cause value.
508func (e ConfigSourceValidationError) Cause() error { return e.cause }
509
510// Key function returns key value.
511func (e ConfigSourceValidationError) Key() bool { return e.key }
512
513// ErrorName returns error name.
514func (e ConfigSourceValidationError) ErrorName() string { return "ConfigSourceValidationError" }
515
516// Error satisfies the builtin error interface
517func (e ConfigSourceValidationError) Error() string {
518	cause := ""
519	if e.cause != nil {
520		cause = fmt.Sprintf(" | caused by: %v", e.cause)
521	}
522
523	key := ""
524	if e.key {
525		key = "key for "
526	}
527
528	return fmt.Sprintf(
529		"invalid %sConfigSource.%s: %s%s",
530		key,
531		e.field,
532		e.reason,
533		cause)
534}
535
536var _ error = ConfigSourceValidationError{}
537
538var _ interface {
539	Field() string
540	Reason() string
541	Key() bool
542	Cause() error
543	ErrorName() string
544} = ConfigSourceValidationError{}
545