1// Code generated by protoc-gen-validate. DO NOT EDIT.
2// source: envoy/config/endpoint/v3/endpoint_components.proto
3
4package envoy_config_endpoint_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	"github.com/golang/protobuf/ptypes"
19
20	v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
21)
22
23// ensure the imports are used
24var (
25	_ = bytes.MinRead
26	_ = errors.New("")
27	_ = fmt.Print
28	_ = utf8.UTFMax
29	_ = (*regexp.Regexp)(nil)
30	_ = (*strings.Reader)(nil)
31	_ = net.IPv4len
32	_ = time.Duration(0)
33	_ = (*url.URL)(nil)
34	_ = (*mail.Address)(nil)
35	_ = ptypes.DynamicAny{}
36
37	_ = v3.HealthStatus(0)
38)
39
40// define the regex for a UUID once up-front
41var _endpoint_components_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
42
43// Validate checks the field values on Endpoint with the rules defined in the
44// proto definition for this message. If any rules are violated, an error is returned.
45func (m *Endpoint) Validate() error {
46	if m == nil {
47		return nil
48	}
49
50	if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
51		if err := v.Validate(); err != nil {
52			return EndpointValidationError{
53				field:  "Address",
54				reason: "embedded message failed validation",
55				cause:  err,
56			}
57		}
58	}
59
60	if v, ok := interface{}(m.GetHealthCheckConfig()).(interface{ Validate() error }); ok {
61		if err := v.Validate(); err != nil {
62			return EndpointValidationError{
63				field:  "HealthCheckConfig",
64				reason: "embedded message failed validation",
65				cause:  err,
66			}
67		}
68	}
69
70	return nil
71}
72
73// EndpointValidationError is the validation error returned by
74// Endpoint.Validate if the designated constraints aren't met.
75type EndpointValidationError struct {
76	field  string
77	reason string
78	cause  error
79	key    bool
80}
81
82// Field function returns field value.
83func (e EndpointValidationError) Field() string { return e.field }
84
85// Reason function returns reason value.
86func (e EndpointValidationError) Reason() string { return e.reason }
87
88// Cause function returns cause value.
89func (e EndpointValidationError) Cause() error { return e.cause }
90
91// Key function returns key value.
92func (e EndpointValidationError) Key() bool { return e.key }
93
94// ErrorName returns error name.
95func (e EndpointValidationError) ErrorName() string { return "EndpointValidationError" }
96
97// Error satisfies the builtin error interface
98func (e EndpointValidationError) Error() string {
99	cause := ""
100	if e.cause != nil {
101		cause = fmt.Sprintf(" | caused by: %v", e.cause)
102	}
103
104	key := ""
105	if e.key {
106		key = "key for "
107	}
108
109	return fmt.Sprintf(
110		"invalid %sEndpoint.%s: %s%s",
111		key,
112		e.field,
113		e.reason,
114		cause)
115}
116
117var _ error = EndpointValidationError{}
118
119var _ interface {
120	Field() string
121	Reason() string
122	Key() bool
123	Cause() error
124	ErrorName() string
125} = EndpointValidationError{}
126
127// Validate checks the field values on LbEndpoint with the rules defined in the
128// proto definition for this message. If any rules are violated, an error is returned.
129func (m *LbEndpoint) Validate() error {
130	if m == nil {
131		return nil
132	}
133
134	// no validation rules for HealthStatus
135
136	if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
137		if err := v.Validate(); err != nil {
138			return LbEndpointValidationError{
139				field:  "Metadata",
140				reason: "embedded message failed validation",
141				cause:  err,
142			}
143		}
144	}
145
146	if wrapper := m.GetLoadBalancingWeight(); wrapper != nil {
147
148		if wrapper.GetValue() < 1 {
149			return LbEndpointValidationError{
150				field:  "LoadBalancingWeight",
151				reason: "value must be greater than or equal to 1",
152			}
153		}
154
155	}
156
157	switch m.HostIdentifier.(type) {
158
159	case *LbEndpoint_Endpoint:
160
161		if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok {
162			if err := v.Validate(); err != nil {
163				return LbEndpointValidationError{
164					field:  "Endpoint",
165					reason: "embedded message failed validation",
166					cause:  err,
167				}
168			}
169		}
170
171	case *LbEndpoint_EndpointName:
172		// no validation rules for EndpointName
173
174	}
175
176	return nil
177}
178
179// LbEndpointValidationError is the validation error returned by
180// LbEndpoint.Validate if the designated constraints aren't met.
181type LbEndpointValidationError struct {
182	field  string
183	reason string
184	cause  error
185	key    bool
186}
187
188// Field function returns field value.
189func (e LbEndpointValidationError) Field() string { return e.field }
190
191// Reason function returns reason value.
192func (e LbEndpointValidationError) Reason() string { return e.reason }
193
194// Cause function returns cause value.
195func (e LbEndpointValidationError) Cause() error { return e.cause }
196
197// Key function returns key value.
198func (e LbEndpointValidationError) Key() bool { return e.key }
199
200// ErrorName returns error name.
201func (e LbEndpointValidationError) ErrorName() string { return "LbEndpointValidationError" }
202
203// Error satisfies the builtin error interface
204func (e LbEndpointValidationError) Error() string {
205	cause := ""
206	if e.cause != nil {
207		cause = fmt.Sprintf(" | caused by: %v", e.cause)
208	}
209
210	key := ""
211	if e.key {
212		key = "key for "
213	}
214
215	return fmt.Sprintf(
216		"invalid %sLbEndpoint.%s: %s%s",
217		key,
218		e.field,
219		e.reason,
220		cause)
221}
222
223var _ error = LbEndpointValidationError{}
224
225var _ interface {
226	Field() string
227	Reason() string
228	Key() bool
229	Cause() error
230	ErrorName() string
231} = LbEndpointValidationError{}
232
233// Validate checks the field values on LocalityLbEndpoints with the rules
234// defined in the proto definition for this message. If any rules are
235// violated, an error is returned.
236func (m *LocalityLbEndpoints) Validate() error {
237	if m == nil {
238		return nil
239	}
240
241	if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok {
242		if err := v.Validate(); err != nil {
243			return LocalityLbEndpointsValidationError{
244				field:  "Locality",
245				reason: "embedded message failed validation",
246				cause:  err,
247			}
248		}
249	}
250
251	for idx, item := range m.GetLbEndpoints() {
252		_, _ = idx, item
253
254		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
255			if err := v.Validate(); err != nil {
256				return LocalityLbEndpointsValidationError{
257					field:  fmt.Sprintf("LbEndpoints[%v]", idx),
258					reason: "embedded message failed validation",
259					cause:  err,
260				}
261			}
262		}
263
264	}
265
266	if wrapper := m.GetLoadBalancingWeight(); wrapper != nil {
267
268		if wrapper.GetValue() < 1 {
269			return LocalityLbEndpointsValidationError{
270				field:  "LoadBalancingWeight",
271				reason: "value must be greater than or equal to 1",
272			}
273		}
274
275	}
276
277	if m.GetPriority() > 128 {
278		return LocalityLbEndpointsValidationError{
279			field:  "Priority",
280			reason: "value must be less than or equal to 128",
281		}
282	}
283
284	if v, ok := interface{}(m.GetProximity()).(interface{ Validate() error }); ok {
285		if err := v.Validate(); err != nil {
286			return LocalityLbEndpointsValidationError{
287				field:  "Proximity",
288				reason: "embedded message failed validation",
289				cause:  err,
290			}
291		}
292	}
293
294	return nil
295}
296
297// LocalityLbEndpointsValidationError is the validation error returned by
298// LocalityLbEndpoints.Validate if the designated constraints aren't met.
299type LocalityLbEndpointsValidationError struct {
300	field  string
301	reason string
302	cause  error
303	key    bool
304}
305
306// Field function returns field value.
307func (e LocalityLbEndpointsValidationError) Field() string { return e.field }
308
309// Reason function returns reason value.
310func (e LocalityLbEndpointsValidationError) Reason() string { return e.reason }
311
312// Cause function returns cause value.
313func (e LocalityLbEndpointsValidationError) Cause() error { return e.cause }
314
315// Key function returns key value.
316func (e LocalityLbEndpointsValidationError) Key() bool { return e.key }
317
318// ErrorName returns error name.
319func (e LocalityLbEndpointsValidationError) ErrorName() string {
320	return "LocalityLbEndpointsValidationError"
321}
322
323// Error satisfies the builtin error interface
324func (e LocalityLbEndpointsValidationError) Error() string {
325	cause := ""
326	if e.cause != nil {
327		cause = fmt.Sprintf(" | caused by: %v", e.cause)
328	}
329
330	key := ""
331	if e.key {
332		key = "key for "
333	}
334
335	return fmt.Sprintf(
336		"invalid %sLocalityLbEndpoints.%s: %s%s",
337		key,
338		e.field,
339		e.reason,
340		cause)
341}
342
343var _ error = LocalityLbEndpointsValidationError{}
344
345var _ interface {
346	Field() string
347	Reason() string
348	Key() bool
349	Cause() error
350	ErrorName() string
351} = LocalityLbEndpointsValidationError{}
352
353// Validate checks the field values on Endpoint_HealthCheckConfig with the
354// rules defined in the proto definition for this message. If any rules are
355// violated, an error is returned.
356func (m *Endpoint_HealthCheckConfig) Validate() error {
357	if m == nil {
358		return nil
359	}
360
361	if m.GetPortValue() > 65535 {
362		return Endpoint_HealthCheckConfigValidationError{
363			field:  "PortValue",
364			reason: "value must be less than or equal to 65535",
365		}
366	}
367
368	return nil
369}
370
371// Endpoint_HealthCheckConfigValidationError is the validation error returned
372// by Endpoint_HealthCheckConfig.Validate if the designated constraints aren't met.
373type Endpoint_HealthCheckConfigValidationError struct {
374	field  string
375	reason string
376	cause  error
377	key    bool
378}
379
380// Field function returns field value.
381func (e Endpoint_HealthCheckConfigValidationError) Field() string { return e.field }
382
383// Reason function returns reason value.
384func (e Endpoint_HealthCheckConfigValidationError) Reason() string { return e.reason }
385
386// Cause function returns cause value.
387func (e Endpoint_HealthCheckConfigValidationError) Cause() error { return e.cause }
388
389// Key function returns key value.
390func (e Endpoint_HealthCheckConfigValidationError) Key() bool { return e.key }
391
392// ErrorName returns error name.
393func (e Endpoint_HealthCheckConfigValidationError) ErrorName() string {
394	return "Endpoint_HealthCheckConfigValidationError"
395}
396
397// Error satisfies the builtin error interface
398func (e Endpoint_HealthCheckConfigValidationError) Error() string {
399	cause := ""
400	if e.cause != nil {
401		cause = fmt.Sprintf(" | caused by: %v", e.cause)
402	}
403
404	key := ""
405	if e.key {
406		key = "key for "
407	}
408
409	return fmt.Sprintf(
410		"invalid %sEndpoint_HealthCheckConfig.%s: %s%s",
411		key,
412		e.field,
413		e.reason,
414		cause)
415}
416
417var _ error = Endpoint_HealthCheckConfigValidationError{}
418
419var _ interface {
420	Field() string
421	Reason() string
422	Key() bool
423	Cause() error
424	ErrorName() string
425} = Endpoint_HealthCheckConfigValidationError{}
426