Debian Codegraph @

envoy/extensions/access_loggers/grpc/v3/als.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/extensions/access_loggers/grpc/v3/als.proto
4
5 package grpcv3
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 v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
23 )
24
25 // ensure the imports are used
26 var (
27 _ = bytes.MinRead
28 _ = errors.New("")
29 _ = fmt.Print
30 _ = utf8.UTFMax
31 _ = (*regexp.Regexp)(nil)
32 _ = (*strings.Reader)(nil)
33 _ = net.IPv4len
34 _ = time.Duration(0)
35 _ = (*url.URL)(nil)
36 _ = (*mail.Address)(nil)
37 _ = anypb.Any{}
38 _ = sort.Sort
39
40 _ = v3.ApiVersion(0)
41 )
42
43 // Validate checks the field values on HttpGrpcAccessLogConfig with the rules
44 // defined in the proto definition for this message. If any rules are
45 // violated, the first error encountered is returned, or nil if there are no violations.
46 func (m *HttpGrpcAccessLogConfig) Validate() error {
47 return m.validate(false)
48 }
49
50 // ValidateAll checks the field values on HttpGrpcAccessLogConfig with the
51 // rules defined in the proto definition for this message. If any rules are
52 // violated, the result is a list of violation errors wrapped in
53 // HttpGrpcAccessLogConfigMultiError, or nil if none found.
54 func (m *HttpGrpcAccessLogConfig) ValidateAll() error {
55 return m.validate(true)
56 }
57
58 func (m *HttpGrpcAccessLogConfig) validate(all bool) error {
59 if m == nil {
60 return nil
61 }
62
63 var errors []error
64
65 if m.GetCommonConfig() == nil {
66 err := HttpGrpcAccessLogConfigValidationError{
67 field: "CommonConfig",
68 reason: "value is required",
69 }
70 if !all {
71 return err
72 }
73 errors = append(errors, err)
74 }
75
76 if all {
77 switch v := interface{}(m.GetCommonConfig()).(type) {
78 case interface{ ValidateAll() error }:
79 if err := v.ValidateAll(); err != nil {
80 errors = append(errors, HttpGrpcAccessLogConfigValidationError{
81 field: "CommonConfig",
82 reason: "embedded message failed validation",
83 cause: err,
84 })
85 }
86 case interface{ Validate() error }:
87 if err := v.Validate(); err != nil {
88 errors = append(errors, HttpGrpcAccessLogConfigValidationError{
89 field: "CommonConfig",
90 reason: "embedded message failed validation",
91 cause: err,
92 })
93 }
94 }
95 } else if v, ok := interface{}(m.GetCommonConfig()).(interface{ Validate() error }); ok {
96 if err := v.Validate(); err != nil {
97 return HttpGrpcAccessLogConfigValidationError{
98 field: "CommonConfig",
99 reason: "embedded message failed validation",
100 cause: err,
101 }
102 }
103 }
104
105 if len(errors) > 0 {
106 return HttpGrpcAccessLogConfigMultiError(errors)
107 }
108
109 return nil
110 }
111
112 // HttpGrpcAccessLogConfigMultiError is an error wrapping multiple validation
113 // errors returned by HttpGrpcAccessLogConfig.ValidateAll() if the designated
114 // constraints aren't met.
115 type HttpGrpcAccessLogConfigMultiError []error
116
117 // Error returns a concatenation of all the error messages it wraps.
118 func (m HttpGrpcAccessLogConfigMultiError) Error() string {
119 var msgs []string
120 for _, err := range m {
121 msgs = append(msgs, err.Error())
122 }
123 return strings.Join(msgs, "; ")
124 }
125
126 // AllErrors returns a list of validation violation errors.
127 func (m HttpGrpcAccessLogConfigMultiError) AllErrors() []error { return m }
128
129 // HttpGrpcAccessLogConfigValidationError is the validation error returned by
130 // HttpGrpcAccessLogConfig.Validate if the designated constraints aren't met.
131 type HttpGrpcAccessLogConfigValidationError struct {
132 field string
133 reason string
134 cause error
135 key bool
136 }
137
138 // Field function returns field value.
139 func (e HttpGrpcAccessLogConfigValidationError) Field() string { return e.field }
140
141 // Reason function returns reason value.
142 func (e HttpGrpcAccessLogConfigValidationError) Reason() string { return e.reason }
143
144 // Cause function returns cause value.
145 func (e HttpGrpcAccessLogConfigValidationError) Cause() error { return e.cause }
146
147 // Key function returns key value.
148 func (e HttpGrpcAccessLogConfigValidationError) Key() bool { return e.key }
149
150 // ErrorName returns error name.
151 func (e HttpGrpcAccessLogConfigValidationError) ErrorName() string {
152 return "HttpGrpcAccessLogConfigValidationError"
153 }
154
155 // Error satisfies the builtin error interface
156 func (e HttpGrpcAccessLogConfigValidationError) Error() string {
157 cause := ""
158 if e.cause != nil {
159 cause = fmt.Sprintf(" | caused by: %v", e.cause)
160 }
161
162 key := ""
163 if e.key {
164 key = "key for "
165 }
166
167 return fmt.Sprintf(
168 "invalid %sHttpGrpcAccessLogConfig.%s: %s%s",
169 key,
170 e.field,
171 e.reason,
172 cause)
173 }
174
175 var _ error = HttpGrpcAccessLogConfigValidationError{}
176
177 var _ interface {
178 Field() string
179 Reason() string
180 Key() bool
181 Cause() error
182 ErrorName() string
183 } = HttpGrpcAccessLogConfigValidationError{}
184
185 // Validate checks the field values on TcpGrpcAccessLogConfig with the rules
186 // defined in the proto definition for this message. If any rules are
187 // violated, the first error encountered is returned, or nil if there are no violations.
188 func (m *TcpGrpcAccessLogConfig) Validate() error {
189 return m.validate(false)
190 }
191
192 // ValidateAll checks the field values on TcpGrpcAccessLogConfig with the rules
193 // defined in the proto definition for this message. If any rules are
194 // violated, the result is a list of violation errors wrapped in
195 // TcpGrpcAccessLogConfigMultiError, or nil if none found.
196 func (m *TcpGrpcAccessLogConfig) ValidateAll() error {
197 return m.validate(true)
198 }
199
200 func (m *TcpGrpcAccessLogConfig) validate(all bool) error {
201 if m == nil {
202 return nil
203 }
204
205 var errors []error
206
207 if m.GetCommonConfig() == nil {
208 err := TcpGrpcAccessLogConfigValidationError{
209 field: "CommonConfig",
210 reason: "value is required",
211 }
212 if !all {
213 return err
214 }
215 errors = append(errors, err)
216 }
217
218 if all {
219 switch v := interface{}(m.GetCommonConfig()).(type) {
220 case interface{ ValidateAll() error }:
221 if err := v.ValidateAll(); err != nil {
222 errors = append(errors, TcpGrpcAccessLogConfigValidationError{
223 field: "CommonConfig",
224 reason: "embedded message failed validation",
225 cause: err,
226 })
227 }
228 case interface{ Validate() error }:
229 if err := v.Validate(); err != nil {
230 errors = append(errors, TcpGrpcAccessLogConfigValidationError{
231 field: "CommonConfig",
232 reason: "embedded message failed validation",
233 cause: err,
234 })
235 }
236 }
237 } else if v, ok := interface{}(m.GetCommonConfig()).(interface{ Validate() error }); ok {
238 if err := v.Validate(); err != nil {
239 return TcpGrpcAccessLogConfigValidationError{
240 field: "CommonConfig",
241 reason: "embedded message failed validation",
242 cause: err,
243 }
244 }
245 }
246
247 if len(errors) > 0 {
248 return TcpGrpcAccessLogConfigMultiError(errors)
249 }
250
251 return nil
252 }
253
254 // TcpGrpcAccessLogConfigMultiError is an error wrapping multiple validation
255 // errors returned by TcpGrpcAccessLogConfig.ValidateAll() if the designated
256 // constraints aren't met.
257 type TcpGrpcAccessLogConfigMultiError []error
258
259 // Error returns a concatenation of all the error messages it wraps.
260 func (m TcpGrpcAccessLogConfigMultiError) Error() string {
261 var msgs []string
262 for _, err := range m {
263 msgs = append(msgs, err.Error())
264 }
265 return strings.Join(msgs, "; ")
266 }
267
268 // AllErrors returns a list of validation violation errors.
269 func (m TcpGrpcAccessLogConfigMultiError) AllErrors() []error { return m }
270
271 // TcpGrpcAccessLogConfigValidationError is the validation error returned by
272 // TcpGrpcAccessLogConfig.Validate if the designated constraints aren't met.
273 type TcpGrpcAccessLogConfigValidationError struct {
274 field string
275 reason string
276 cause error
277 key bool
278 }
279
280 // Field function returns field value.
281 func (e TcpGrpcAccessLogConfigValidationError) Field() string { return e.field }
282
283 // Reason function returns reason value.
284 func (e TcpGrpcAccessLogConfigValidationError) Reason() string { return e.reason }
285
286 // Cause function returns cause value.
287 func (e TcpGrpcAccessLogConfigValidationError) Cause() error { return e.cause }
288
289 // Key function returns key value.
290 func (e TcpGrpcAccessLogConfigValidationError) Key() bool { return e.key }
291
292 // ErrorName returns error name.
293 func (e TcpGrpcAccessLogConfigValidationError) ErrorName() string {
294 return "TcpGrpcAccessLogConfigValidationError"
295 }
296
297 // Error satisfies the builtin error interface
298 func (e TcpGrpcAccessLogConfigValidationError) Error() string {
299 cause := ""
300 if e.cause != nil {
301 cause = fmt.Sprintf(" | caused by: %v", e.cause)
302 }
303
304 key := ""
305 if e.key {
306 key = "key for "
307 }
308
309 return fmt.Sprintf(
310 "invalid %sTcpGrpcAccessLogConfig.%s: %s%s",
311 key,
312 e.field,
313 e.reason,
314 cause)
315 }
316
317 var _ error = TcpGrpcAccessLogConfigValidationError{}
318
319 var _ interface {
320 Field() string
321 Reason() string
322 Key() bool
323 Cause() error
324 ErrorName() string
325 } = TcpGrpcAccessLogConfigValidationError{}
326
327 // Validate checks the field values on CommonGrpcAccessLogConfig with the rules
328 // defined in the proto definition for this message. If any rules are
329 // violated, the first error encountered is returned, or nil if there are no violations.
330 func (m *CommonGrpcAccessLogConfig) Validate() error {
331 return m.validate(false)
332 }
333
334 // ValidateAll checks the field values on CommonGrpcAccessLogConfig with the
335 // rules defined in the proto definition for this message. If any rules are
336 // violated, the result is a list of violation errors wrapped in
337 // CommonGrpcAccessLogConfigMultiError, or nil if none found.
338 func (m *CommonGrpcAccessLogConfig) ValidateAll() error {
339 return m.validate(true)
340 }
341
342 func (m *CommonGrpcAccessLogConfig) validate(all bool) error {
343 if m == nil {
344 return nil
345 }
346
347 var errors []error
348
349 if utf8.RuneCountInString(m.GetLogName()) < 1 {
350 err := CommonGrpcAccessLogConfigValidationError{
351 field: "LogName",
352 reason: "value length must be at least 1 runes",
353 }
354 if !all {
355 return err
356 }
357 errors = append(errors, err)
358 }
359
360 if m.GetGrpcService() == nil {
361 err := CommonGrpcAccessLogConfigValidationError{
362 field: "GrpcService",
363 reason: "value is required",
364 }
365 if !all {
366 return err
367 }
368 errors = append(errors, err)
369 }
370
371 if all {
372 switch v := interface{}(m.GetGrpcService()).(type) {
373 case interface{ ValidateAll() error }:
374 if err := v.ValidateAll(); err != nil {
375 errors = append(errors, CommonGrpcAccessLogConfigValidationError{
376 field: "GrpcService",
377 reason: "embedded message failed validation",
378 cause: err,
379 })
380 }
381 case interface{ Validate() error }:
382 if err := v.Validate(); err != nil {
383 errors = append(errors, CommonGrpcAccessLogConfigValidationError{
384 field: "GrpcService",
385 reason: "embedded message failed validation",
386 cause: err,
387 })
388 }
389 }
390 } else if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok {
391 if err := v.Validate(); err != nil {
392 return CommonGrpcAccessLogConfigValidationError{
393 field: "GrpcService",
394 reason: "embedded message failed validation",
395 cause: err,
396 }
397 }
398 }
399
400 if _, ok := v3.ApiVersion_name[int32(m.GetTransportApiVersion())]; !ok {
401 err := CommonGrpcAccessLogConfigValidationError{
402 field: "TransportApiVersion",
403 reason: "value must be one of the defined enum values",
404 }
405 if !all {
406 return err
407 }
408 errors = append(errors, err)
409 }
410
411 if d := m.GetBufferFlushInterval(); d != nil {
412 dur, err := d.AsDuration(), d.CheckValid()
413 if err != nil {
414 err = CommonGrpcAccessLogConfigValidationError{
415 field: "BufferFlushInterval",
416 reason: "value is not a valid duration",
417 cause: err,
418 }
419 if !all {
420 return err
421 }
422 errors = append(errors, err)
423 } else {
424
425 gt := time.Duration(0*time.Second + 0*time.Nanosecond)
426
427 if dur <= gt {
428 err := CommonGrpcAccessLogConfigValidationError{
429 field: "BufferFlushInterval",
430 reason: "value must be greater than 0s",
431 }
432 if !all {
433 return err
434 }
435 errors = append(errors, err)
436 }
437
438 }
439 }
440
441 if all {
442 switch v := interface{}(m.GetBufferSizeBytes()).(type) {
443 case interface{ ValidateAll() error }:
444 if err := v.ValidateAll(); err != nil {
445 errors = append(errors, CommonGrpcAccessLogConfigValidationError{
446 field: "BufferSizeBytes",
447 reason: "embedded message failed validation",
448 cause: err,
449 })
450 }
451 case interface{ Validate() error }:
452 if err := v.Validate(); err != nil {
453 errors = append(errors, CommonGrpcAccessLogConfigValidationError{
454 field: "BufferSizeBytes",
455 reason: "embedded message failed validation",
456 cause: err,
457 })
458 }
459 }
460 } else if v, ok := interface{}(m.GetBufferSizeBytes()).(interface{ Validate() error }); ok {
461 if err := v.Validate(); err != nil {
462 return CommonGrpcAccessLogConfigValidationError{
463 field: "BufferSizeBytes",
464 reason: "embedded message failed validation",
465 cause: err,
466 }
467 }
468 }
469
470 if all {
471 switch v := interface{}(m.GetGrpcStreamRetryPolicy()).(type) {
472 case interface{ ValidateAll() error }:
473 if err := v.ValidateAll(); err != nil {
474 errors = append(errors, CommonGrpcAccessLogConfigValidationError{
475 field: "GrpcStreamRetryPolicy",
476 reason: "embedded message failed validation",
477 cause: err,
478 })
479 }
480 case interface{ Validate() error }:
481 if err := v.Validate(); err != nil {
482 errors = append(errors, CommonGrpcAccessLogConfigValidationError{
483 field: "GrpcStreamRetryPolicy",
484 reason: "embedded message failed validation",
485 cause: err,
486 })
487 }
488 }
489 } else if v, ok := interface{}(m.GetGrpcStreamRetryPolicy()).(interface{ Validate() error }); ok {
490 if err := v.Validate(); err != nil {
491 return CommonGrpcAccessLogConfigValidationError{
492 field: "GrpcStreamRetryPolicy",
493 reason: "embedded message failed validation",
494 cause: err,
495 }
496 }
497 }
498
499 for idx, item := range m.GetCustomTags() {
500 _, _ = idx, item
501
502 if all {
503 switch v := interface{}(item).(type) {
504 case interface{ ValidateAll() error }:
505 if err := v.ValidateAll(); err != nil {
506 errors = append(errors, CommonGrpcAccessLogConfigValidationError{
507 field: fmt.Sprintf("CustomTags[%v]", idx),
508 reason: "embedded message failed validation",
509 cause: err,
510 })
511 }
512 case interface{ Validate() error }:
513 if err := v.Validate(); err != nil {
514 errors = append(errors, CommonGrpcAccessLogConfigValidationError{
515 field: fmt.Sprintf("CustomTags[%v]", idx),
516 reason: "embedded message failed validation",
517 cause: err,
518 })
519 }
520 }
521 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
522 if err := v.Validate(); err != nil {
523 return CommonGrpcAccessLogConfigValidationError{
524 field: fmt.Sprintf("CustomTags[%v]", idx),
525 reason: "embedded message failed validation",
526 cause: err,
527 }
528 }
529 }
530
531 }
532
533 if len(errors) > 0 {
534 return CommonGrpcAccessLogConfigMultiError(errors)
535 }
536
537 return nil
538 }
539
540 // CommonGrpcAccessLogConfigMultiError is an error wrapping multiple validation
541 // errors returned by CommonGrpcAccessLogConfig.ValidateAll() if the
542 // designated constraints aren't met.
543 type CommonGrpcAccessLogConfigMultiError []error
544
545 // Error returns a concatenation of all the error messages it wraps.
546 func (m CommonGrpcAccessLogConfigMultiError) Error() string {
547 var msgs []string
548 for _, err := range m {
549 msgs = append(msgs, err.Error())
550 }
551 return strings.Join(msgs, "; ")
552 }
553
554 // AllErrors returns a list of validation violation errors.
555 func (m CommonGrpcAccessLogConfigMultiError) AllErrors() []error { return m }
556
557 // CommonGrpcAccessLogConfigValidationError is the validation error returned by
558 // CommonGrpcAccessLogConfig.Validate if the designated constraints aren't met.
559 type CommonGrpcAccessLogConfigValidationError struct {
560 field string
561 reason string
562 cause error
563 key bool
564 }
565
566 // Field function returns field value.
567 func (e CommonGrpcAccessLogConfigValidationError) Field() string { return e.field }
568
569 // Reason function returns reason value.
570 func (e CommonGrpcAccessLogConfigValidationError) Reason() string { return e.reason }
571
572 // Cause function returns cause value.
573 func (e CommonGrpcAccessLogConfigValidationError) Cause() error { return e.cause }
574
575 // Key function returns key value.
576 func (e CommonGrpcAccessLogConfigValidationError) Key() bool { return e.key }
577
578 // ErrorName returns error name.
579 func (e CommonGrpcAccessLogConfigValidationError) ErrorName() string {
580 return "CommonGrpcAccessLogConfigValidationError"
581 }
582
583 // Error satisfies the builtin error interface
584 func (e CommonGrpcAccessLogConfigValidationError) Error() string {
585 cause := ""
586 if e.cause != nil {
587 cause = fmt.Sprintf(" | caused by: %v", e.cause)
588 }
589
590 key := ""
591 if e.key {
592 key = "key for "
593 }
594
595 return fmt.Sprintf(
596 "invalid %sCommonGrpcAccessLogConfig.%s: %s%s",
597 key,
598 e.field,
599 e.reason,
600 cause)
601 }
602
603 var _ error = CommonGrpcAccessLogConfigValidationError{}
604
605 var _ interface {
606 Field() string
607 Reason() string
608 Key() bool
609 Cause() error
610 ErrorName() string
611 } = CommonGrpcAccessLogConfigValidationError{}