Debian Codegraph @

envoy/service/tap/v2alpha/tap.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/service/tap/v2alpha/tap.proto
4
5 package v2alpha
6
7 import (
8 "bytes"
9 "errors"
10 "fmt"
11 "net"
12 "net/mail"
13 "net/url"
14 "regexp"
15 "sort"
16 "strings"
17 "time"
18 "unicode/utf8"
19
20 "google.golang.org/protobuf/types/known/anypb"
21 )
22
23 // ensure the imports are used
24 var (
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 _ = anypb.Any{}
36 _ = sort.Sort
37 )
38
39 // Validate checks the field values on StreamTapsRequest with the rules defined
40 // in the proto definition for this message. If any rules are violated, the
41 // first error encountered is returned, or nil if there are no violations.
42 func (m *StreamTapsRequest) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on StreamTapsRequest with the rules
47 // defined in the proto definition for this message. If any rules are
48 // violated, the result is a list of violation errors wrapped in
49 // StreamTapsRequestMultiError, or nil if none found.
50 func (m *StreamTapsRequest) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *StreamTapsRequest) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 if all {
62 switch v := interface{}(m.GetIdentifier()).(type) {
63 case interface{ ValidateAll() error }:
64 if err := v.ValidateAll(); err != nil {
65 errors = append(errors, StreamTapsRequestValidationError{
66 field: "Identifier",
67 reason: "embedded message failed validation",
68 cause: err,
69 })
70 }
71 case interface{ Validate() error }:
72 if err := v.Validate(); err != nil {
73 errors = append(errors, StreamTapsRequestValidationError{
74 field: "Identifier",
75 reason: "embedded message failed validation",
76 cause: err,
77 })
78 }
79 }
80 } else if v, ok := interface{}(m.GetIdentifier()).(interface{ Validate() error }); ok {
81 if err := v.Validate(); err != nil {
82 return StreamTapsRequestValidationError{
83 field: "Identifier",
84 reason: "embedded message failed validation",
85 cause: err,
86 }
87 }
88 }
89
90 // no validation rules for TraceId
91
92 if all {
93 switch v := interface{}(m.GetTrace()).(type) {
94 case interface{ ValidateAll() error }:
95 if err := v.ValidateAll(); err != nil {
96 errors = append(errors, StreamTapsRequestValidationError{
97 field: "Trace",
98 reason: "embedded message failed validation",
99 cause: err,
100 })
101 }
102 case interface{ Validate() error }:
103 if err := v.Validate(); err != nil {
104 errors = append(errors, StreamTapsRequestValidationError{
105 field: "Trace",
106 reason: "embedded message failed validation",
107 cause: err,
108 })
109 }
110 }
111 } else if v, ok := interface{}(m.GetTrace()).(interface{ Validate() error }); ok {
112 if err := v.Validate(); err != nil {
113 return StreamTapsRequestValidationError{
114 field: "Trace",
115 reason: "embedded message failed validation",
116 cause: err,
117 }
118 }
119 }
120
121 if len(errors) > 0 {
122 return StreamTapsRequestMultiError(errors)
123 }
124
125 return nil
126 }
127
128 // StreamTapsRequestMultiError is an error wrapping multiple validation errors
129 // returned by StreamTapsRequest.ValidateAll() if the designated constraints
130 // aren't met.
131 type StreamTapsRequestMultiError []error
132
133 // Error returns a concatenation of all the error messages it wraps.
134 func (m StreamTapsRequestMultiError) Error() string {
135 var msgs []string
136 for _, err := range m {
137 msgs = append(msgs, err.Error())
138 }
139 return strings.Join(msgs, "; ")
140 }
141
142 // AllErrors returns a list of validation violation errors.
143 func (m StreamTapsRequestMultiError) AllErrors() []error { return m }
144
145 // StreamTapsRequestValidationError is the validation error returned by
146 // StreamTapsRequest.Validate if the designated constraints aren't met.
147 type StreamTapsRequestValidationError struct {
148 field string
149 reason string
150 cause error
151 key bool
152 }
153
154 // Field function returns field value.
155 func (e StreamTapsRequestValidationError) Field() string { return e.field }
156
157 // Reason function returns reason value.
158 func (e StreamTapsRequestValidationError) Reason() string { return e.reason }
159
160 // Cause function returns cause value.
161 func (e StreamTapsRequestValidationError) Cause() error { return e.cause }
162
163 // Key function returns key value.
164 func (e StreamTapsRequestValidationError) Key() bool { return e.key }
165
166 // ErrorName returns error name.
167 func (e StreamTapsRequestValidationError) ErrorName() string {
168 return "StreamTapsRequestValidationError"
169 }
170
171 // Error satisfies the builtin error interface
172 func (e StreamTapsRequestValidationError) Error() string {
173 cause := ""
174 if e.cause != nil {
175 cause = fmt.Sprintf(" | caused by: %v", e.cause)
176 }
177
178 key := ""
179 if e.key {
180 key = "key for "
181 }
182
183 return fmt.Sprintf(
184 "invalid %sStreamTapsRequest.%s: %s%s",
185 key,
186 e.field,
187 e.reason,
188 cause)
189 }
190
191 var _ error = StreamTapsRequestValidationError{}
192
193 var _ interface {
194 Field() string
195 Reason() string
196 Key() bool
197 Cause() error
198 ErrorName() string
199 } = StreamTapsRequestValidationError{}
200
201 // Validate checks the field values on StreamTapsResponse with the rules
202 // defined in the proto definition for this message. If any rules are
203 // violated, the first error encountered is returned, or nil if there are no violations.
204 func (m *StreamTapsResponse) Validate() error {
205 return m.validate(false)
206 }
207
208 // ValidateAll checks the field values on StreamTapsResponse with the rules
209 // defined in the proto definition for this message. If any rules are
210 // violated, the result is a list of violation errors wrapped in
211 // StreamTapsResponseMultiError, or nil if none found.
212 func (m *StreamTapsResponse) ValidateAll() error {
213 return m.validate(true)
214 }
215
216 func (m *StreamTapsResponse) validate(all bool) error {
217 if m == nil {
218 return nil
219 }
220
221 var errors []error
222
223 if len(errors) > 0 {
224 return StreamTapsResponseMultiError(errors)
225 }
226
227 return nil
228 }
229
230 // StreamTapsResponseMultiError is an error wrapping multiple validation errors
231 // returned by StreamTapsResponse.ValidateAll() if the designated constraints
232 // aren't met.
233 type StreamTapsResponseMultiError []error
234
235 // Error returns a concatenation of all the error messages it wraps.
236 func (m StreamTapsResponseMultiError) Error() string {
237 var msgs []string
238 for _, err := range m {
239 msgs = append(msgs, err.Error())
240 }
241 return strings.Join(msgs, "; ")
242 }
243
244 // AllErrors returns a list of validation violation errors.
245 func (m StreamTapsResponseMultiError) AllErrors() []error { return m }
246
247 // StreamTapsResponseValidationError is the validation error returned by
248 // StreamTapsResponse.Validate if the designated constraints aren't met.
249 type StreamTapsResponseValidationError struct {
250 field string
251 reason string
252 cause error
253 key bool
254 }
255
256 // Field function returns field value.
257 func (e StreamTapsResponseValidationError) Field() string { return e.field }
258
259 // Reason function returns reason value.
260 func (e StreamTapsResponseValidationError) Reason() string { return e.reason }
261
262 // Cause function returns cause value.
263 func (e StreamTapsResponseValidationError) Cause() error { return e.cause }
264
265 // Key function returns key value.
266 func (e StreamTapsResponseValidationError) Key() bool { return e.key }
267
268 // ErrorName returns error name.
269 func (e StreamTapsResponseValidationError) ErrorName() string {
270 return "StreamTapsResponseValidationError"
271 }
272
273 // Error satisfies the builtin error interface
274 func (e StreamTapsResponseValidationError) Error() string {
275 cause := ""
276 if e.cause != nil {
277 cause = fmt.Sprintf(" | caused by: %v", e.cause)
278 }
279
280 key := ""
281 if e.key {
282 key = "key for "
283 }
284
285 return fmt.Sprintf(
286 "invalid %sStreamTapsResponse.%s: %s%s",
287 key,
288 e.field,
289 e.reason,
290 cause)
291 }
292
293 var _ error = StreamTapsResponseValidationError{}
294
295 var _ interface {
296 Field() string
297 Reason() string
298 Key() bool
299 Cause() error
300 ErrorName() string
301 } = StreamTapsResponseValidationError{}
302
303 // Validate checks the field values on StreamTapsRequest_Identifier with the
304 // rules defined in the proto definition for this message. If any rules are
305 // violated, the first error encountered is returned, or nil if there are no violations.
306 func (m *StreamTapsRequest_Identifier) Validate() error {
307 return m.validate(false)
308 }
309
310 // ValidateAll checks the field values on StreamTapsRequest_Identifier with the
311 // rules defined in the proto definition for this message. If any rules are
312 // violated, the result is a list of violation errors wrapped in
313 // StreamTapsRequest_IdentifierMultiError, or nil if none found.
314 func (m *StreamTapsRequest_Identifier) ValidateAll() error {
315 return m.validate(true)
316 }
317
318 func (m *StreamTapsRequest_Identifier) validate(all bool) error {
319 if m == nil {
320 return nil
321 }
322
323 var errors []error
324
325 if m.GetNode() == nil {
326 err := StreamTapsRequest_IdentifierValidationError{
327 field: "Node",
328 reason: "value is required",
329 }
330 if !all {
331 return err
332 }
333 errors = append(errors, err)
334 }
335
336 if all {
337 switch v := interface{}(m.GetNode()).(type) {
338 case interface{ ValidateAll() error }:
339 if err := v.ValidateAll(); err != nil {
340 errors = append(errors, StreamTapsRequest_IdentifierValidationError{
341 field: "Node",
342 reason: "embedded message failed validation",
343 cause: err,
344 })
345 }
346 case interface{ Validate() error }:
347 if err := v.Validate(); err != nil {
348 errors = append(errors, StreamTapsRequest_IdentifierValidationError{
349 field: "Node",
350 reason: "embedded message failed validation",
351 cause: err,
352 })
353 }
354 }
355 } else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
356 if err := v.Validate(); err != nil {
357 return StreamTapsRequest_IdentifierValidationError{
358 field: "Node",
359 reason: "embedded message failed validation",
360 cause: err,
361 }
362 }
363 }
364
365 // no validation rules for TapId
366
367 if len(errors) > 0 {
368 return StreamTapsRequest_IdentifierMultiError(errors)
369 }
370
371 return nil
372 }
373
374 // StreamTapsRequest_IdentifierMultiError is an error wrapping multiple
375 // validation errors returned by StreamTapsRequest_Identifier.ValidateAll() if
376 // the designated constraints aren't met.
377 type StreamTapsRequest_IdentifierMultiError []error
378
379 // Error returns a concatenation of all the error messages it wraps.
380 func (m StreamTapsRequest_IdentifierMultiError) Error() string {
381 var msgs []string
382 for _, err := range m {
383 msgs = append(msgs, err.Error())
384 }
385 return strings.Join(msgs, "; ")
386 }
387
388 // AllErrors returns a list of validation violation errors.
389 func (m StreamTapsRequest_IdentifierMultiError) AllErrors() []error { return m }
390
391 // StreamTapsRequest_IdentifierValidationError is the validation error returned
392 // by StreamTapsRequest_Identifier.Validate if the designated constraints
393 // aren't met.
394 type StreamTapsRequest_IdentifierValidationError struct {
395 field string
396 reason string
397 cause error
398 key bool
399 }
400
401 // Field function returns field value.
402 func (e StreamTapsRequest_IdentifierValidationError) Field() string { return e.field }
403
404 // Reason function returns reason value.
405 func (e StreamTapsRequest_IdentifierValidationError) Reason() string { return e.reason }
406
407 // Cause function returns cause value.
408 func (e StreamTapsRequest_IdentifierValidationError) Cause() error { return e.cause }
409
410 // Key function returns key value.
411 func (e StreamTapsRequest_IdentifierValidationError) Key() bool { return e.key }
412
413 // ErrorName returns error name.
414 func (e StreamTapsRequest_IdentifierValidationError) ErrorName() string {
415 return "StreamTapsRequest_IdentifierValidationError"
416 }
417
418 // Error satisfies the builtin error interface
419 func (e StreamTapsRequest_IdentifierValidationError) Error() string {
420 cause := ""
421 if e.cause != nil {
422 cause = fmt.Sprintf(" | caused by: %v", e.cause)
423 }
424
425 key := ""
426 if e.key {
427 key = "key for "
428 }
429
430 return fmt.Sprintf(
431 "invalid %sStreamTapsRequest_Identifier.%s: %s%s",
432 key,
433 e.field,
434 e.reason,
435 cause)
436 }
437
438 var _ error = StreamTapsRequest_IdentifierValidationError{}
439
440 var _ interface {
441 Field() string
442 Reason() string
443 Key() bool
444 Cause() error
445 ErrorName() string
446 } = StreamTapsRequest_IdentifierValidationError{}