Debian Codegraph @

envoy/service/auth/v2/attribute_context.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/service/auth/v2/attribute_context.proto
4
5 package authv2
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 AttributeContext 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 *AttributeContext) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on AttributeContext 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 // AttributeContextMultiError, or nil if none found.
50 func (m *AttributeContext) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *AttributeContext) 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.GetSource()).(type) {
63 case interface{ ValidateAll() error }:
64 if err := v.ValidateAll(); err != nil {
65 errors = append(errors, AttributeContextValidationError{
66 field: "Source",
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, AttributeContextValidationError{
74 field: "Source",
75 reason: "embedded message failed validation",
76 cause: err,
77 })
78 }
79 }
80 } else if v, ok := interface{}(m.GetSource()).(interface{ Validate() error }); ok {
81 if err := v.Validate(); err != nil {
82 return AttributeContextValidationError{
83 field: "Source",
84 reason: "embedded message failed validation",
85 cause: err,
86 }
87 }
88 }
89
90 if all {
91 switch v := interface{}(m.GetDestination()).(type) {
92 case interface{ ValidateAll() error }:
93 if err := v.ValidateAll(); err != nil {
94 errors = append(errors, AttributeContextValidationError{
95 field: "Destination",
96 reason: "embedded message failed validation",
97 cause: err,
98 })
99 }
100 case interface{ Validate() error }:
101 if err := v.Validate(); err != nil {
102 errors = append(errors, AttributeContextValidationError{
103 field: "Destination",
104 reason: "embedded message failed validation",
105 cause: err,
106 })
107 }
108 }
109 } else if v, ok := interface{}(m.GetDestination()).(interface{ Validate() error }); ok {
110 if err := v.Validate(); err != nil {
111 return AttributeContextValidationError{
112 field: "Destination",
113 reason: "embedded message failed validation",
114 cause: err,
115 }
116 }
117 }
118
119 if all {
120 switch v := interface{}(m.GetRequest()).(type) {
121 case interface{ ValidateAll() error }:
122 if err := v.ValidateAll(); err != nil {
123 errors = append(errors, AttributeContextValidationError{
124 field: "Request",
125 reason: "embedded message failed validation",
126 cause: err,
127 })
128 }
129 case interface{ Validate() error }:
130 if err := v.Validate(); err != nil {
131 errors = append(errors, AttributeContextValidationError{
132 field: "Request",
133 reason: "embedded message failed validation",
134 cause: err,
135 })
136 }
137 }
138 } else if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok {
139 if err := v.Validate(); err != nil {
140 return AttributeContextValidationError{
141 field: "Request",
142 reason: "embedded message failed validation",
143 cause: err,
144 }
145 }
146 }
147
148 // no validation rules for ContextExtensions
149
150 if all {
151 switch v := interface{}(m.GetMetadataContext()).(type) {
152 case interface{ ValidateAll() error }:
153 if err := v.ValidateAll(); err != nil {
154 errors = append(errors, AttributeContextValidationError{
155 field: "MetadataContext",
156 reason: "embedded message failed validation",
157 cause: err,
158 })
159 }
160 case interface{ Validate() error }:
161 if err := v.Validate(); err != nil {
162 errors = append(errors, AttributeContextValidationError{
163 field: "MetadataContext",
164 reason: "embedded message failed validation",
165 cause: err,
166 })
167 }
168 }
169 } else if v, ok := interface{}(m.GetMetadataContext()).(interface{ Validate() error }); ok {
170 if err := v.Validate(); err != nil {
171 return AttributeContextValidationError{
172 field: "MetadataContext",
173 reason: "embedded message failed validation",
174 cause: err,
175 }
176 }
177 }
178
179 if len(errors) > 0 {
180 return AttributeContextMultiError(errors)
181 }
182
183 return nil
184 }
185
186 // AttributeContextMultiError is an error wrapping multiple validation errors
187 // returned by AttributeContext.ValidateAll() if the designated constraints
188 // aren't met.
189 type AttributeContextMultiError []error
190
191 // Error returns a concatenation of all the error messages it wraps.
192 func (m AttributeContextMultiError) Error() string {
193 var msgs []string
194 for _, err := range m {
195 msgs = append(msgs, err.Error())
196 }
197 return strings.Join(msgs, "; ")
198 }
199
200 // AllErrors returns a list of validation violation errors.
201 func (m AttributeContextMultiError) AllErrors() []error { return m }
202
203 // AttributeContextValidationError is the validation error returned by
204 // AttributeContext.Validate if the designated constraints aren't met.
205 type AttributeContextValidationError struct {
206 field string
207 reason string
208 cause error
209 key bool
210 }
211
212 // Field function returns field value.
213 func (e AttributeContextValidationError) Field() string { return e.field }
214
215 // Reason function returns reason value.
216 func (e AttributeContextValidationError) Reason() string { return e.reason }
217
218 // Cause function returns cause value.
219 func (e AttributeContextValidationError) Cause() error { return e.cause }
220
221 // Key function returns key value.
222 func (e AttributeContextValidationError) Key() bool { return e.key }
223
224 // ErrorName returns error name.
225 func (e AttributeContextValidationError) ErrorName() string { return "AttributeContextValidationError" }
226
227 // Error satisfies the builtin error interface
228 func (e AttributeContextValidationError) Error() string {
229 cause := ""
230 if e.cause != nil {
231 cause = fmt.Sprintf(" | caused by: %v", e.cause)
232 }
233
234 key := ""
235 if e.key {
236 key = "key for "
237 }
238
239 return fmt.Sprintf(
240 "invalid %sAttributeContext.%s: %s%s",
241 key,
242 e.field,
243 e.reason,
244 cause)
245 }
246
247 var _ error = AttributeContextValidationError{}
248
249 var _ interface {
250 Field() string
251 Reason() string
252 Key() bool
253 Cause() error
254 ErrorName() string
255 } = AttributeContextValidationError{}
256
257 // Validate checks the field values on AttributeContext_Peer with the rules
258 // defined in the proto definition for this message. If any rules are
259 // violated, the first error encountered is returned, or nil if there are no violations.
260 func (m *AttributeContext_Peer) Validate() error {
261 return m.validate(false)
262 }
263
264 // ValidateAll checks the field values on AttributeContext_Peer with the rules
265 // defined in the proto definition for this message. If any rules are
266 // violated, the result is a list of violation errors wrapped in
267 // AttributeContext_PeerMultiError, or nil if none found.
268 func (m *AttributeContext_Peer) ValidateAll() error {
269 return m.validate(true)
270 }
271
272 func (m *AttributeContext_Peer) validate(all bool) error {
273 if m == nil {
274 return nil
275 }
276
277 var errors []error
278
279 if all {
280 switch v := interface{}(m.GetAddress()).(type) {
281 case interface{ ValidateAll() error }:
282 if err := v.ValidateAll(); err != nil {
283 errors = append(errors, AttributeContext_PeerValidationError{
284 field: "Address",
285 reason: "embedded message failed validation",
286 cause: err,
287 })
288 }
289 case interface{ Validate() error }:
290 if err := v.Validate(); err != nil {
291 errors = append(errors, AttributeContext_PeerValidationError{
292 field: "Address",
293 reason: "embedded message failed validation",
294 cause: err,
295 })
296 }
297 }
298 } else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
299 if err := v.Validate(); err != nil {
300 return AttributeContext_PeerValidationError{
301 field: "Address",
302 reason: "embedded message failed validation",
303 cause: err,
304 }
305 }
306 }
307
308 // no validation rules for Service
309
310 // no validation rules for Labels
311
312 // no validation rules for Principal
313
314 // no validation rules for Certificate
315
316 if len(errors) > 0 {
317 return AttributeContext_PeerMultiError(errors)
318 }
319
320 return nil
321 }
322
323 // AttributeContext_PeerMultiError is an error wrapping multiple validation
324 // errors returned by AttributeContext_Peer.ValidateAll() if the designated
325 // constraints aren't met.
326 type AttributeContext_PeerMultiError []error
327
328 // Error returns a concatenation of all the error messages it wraps.
329 func (m AttributeContext_PeerMultiError) Error() string {
330 var msgs []string
331 for _, err := range m {
332 msgs = append(msgs, err.Error())
333 }
334 return strings.Join(msgs, "; ")
335 }
336
337 // AllErrors returns a list of validation violation errors.
338 func (m AttributeContext_PeerMultiError) AllErrors() []error { return m }
339
340 // AttributeContext_PeerValidationError is the validation error returned by
341 // AttributeContext_Peer.Validate if the designated constraints aren't met.
342 type AttributeContext_PeerValidationError struct {
343 field string
344 reason string
345 cause error
346 key bool
347 }
348
349 // Field function returns field value.
350 func (e AttributeContext_PeerValidationError) Field() string { return e.field }
351
352 // Reason function returns reason value.
353 func (e AttributeContext_PeerValidationError) Reason() string { return e.reason }
354
355 // Cause function returns cause value.
356 func (e AttributeContext_PeerValidationError) Cause() error { return e.cause }
357
358 // Key function returns key value.
359 func (e AttributeContext_PeerValidationError) Key() bool { return e.key }
360
361 // ErrorName returns error name.
362 func (e AttributeContext_PeerValidationError) ErrorName() string {
363 return "AttributeContext_PeerValidationError"
364 }
365
366 // Error satisfies the builtin error interface
367 func (e AttributeContext_PeerValidationError) Error() string {
368 cause := ""
369 if e.cause != nil {
370 cause = fmt.Sprintf(" | caused by: %v", e.cause)
371 }
372
373 key := ""
374 if e.key {
375 key = "key for "
376 }
377
378 return fmt.Sprintf(
379 "invalid %sAttributeContext_Peer.%s: %s%s",
380 key,
381 e.field,
382 e.reason,
383 cause)
384 }
385
386 var _ error = AttributeContext_PeerValidationError{}
387
388 var _ interface {
389 Field() string
390 Reason() string
391 Key() bool
392 Cause() error
393 ErrorName() string
394 } = AttributeContext_PeerValidationError{}
395
396 // Validate checks the field values on AttributeContext_Request with the rules
397 // defined in the proto definition for this message. If any rules are
398 // violated, the first error encountered is returned, or nil if there are no violations.
399 func (m *AttributeContext_Request) Validate() error {
400 return m.validate(false)
401 }
402
403 // ValidateAll checks the field values on AttributeContext_Request with the
404 // rules defined in the proto definition for this message. If any rules are
405 // violated, the result is a list of violation errors wrapped in
406 // AttributeContext_RequestMultiError, or nil if none found.
407 func (m *AttributeContext_Request) ValidateAll() error {
408 return m.validate(true)
409 }
410
411 func (m *AttributeContext_Request) validate(all bool) error {
412 if m == nil {
413 return nil
414 }
415
416 var errors []error
417
418 if all {
419 switch v := interface{}(m.GetTime()).(type) {
420 case interface{ ValidateAll() error }:
421 if err := v.ValidateAll(); err != nil {
422 errors = append(errors, AttributeContext_RequestValidationError{
423 field: "Time",
424 reason: "embedded message failed validation",
425 cause: err,
426 })
427 }
428 case interface{ Validate() error }:
429 if err := v.Validate(); err != nil {
430 errors = append(errors, AttributeContext_RequestValidationError{
431 field: "Time",
432 reason: "embedded message failed validation",
433 cause: err,
434 })
435 }
436 }
437 } else if v, ok := interface{}(m.GetTime()).(interface{ Validate() error }); ok {
438 if err := v.Validate(); err != nil {
439 return AttributeContext_RequestValidationError{
440 field: "Time",
441 reason: "embedded message failed validation",
442 cause: err,
443 }
444 }
445 }
446
447 if all {
448 switch v := interface{}(m.GetHttp()).(type) {
449 case interface{ ValidateAll() error }:
450 if err := v.ValidateAll(); err != nil {
451 errors = append(errors, AttributeContext_RequestValidationError{
452 field: "Http",
453 reason: "embedded message failed validation",
454 cause: err,
455 })
456 }
457 case interface{ Validate() error }:
458 if err := v.Validate(); err != nil {
459 errors = append(errors, AttributeContext_RequestValidationError{
460 field: "Http",
461 reason: "embedded message failed validation",
462 cause: err,
463 })
464 }
465 }
466 } else if v, ok := interface{}(m.GetHttp()).(interface{ Validate() error }); ok {
467 if err := v.Validate(); err != nil {
468 return AttributeContext_RequestValidationError{
469 field: "Http",
470 reason: "embedded message failed validation",
471 cause: err,
472 }
473 }
474 }
475
476 if len(errors) > 0 {
477 return AttributeContext_RequestMultiError(errors)
478 }
479
480 return nil
481 }
482
483 // AttributeContext_RequestMultiError is an error wrapping multiple validation
484 // errors returned by AttributeContext_Request.ValidateAll() if the designated
485 // constraints aren't met.
486 type AttributeContext_RequestMultiError []error
487
488 // Error returns a concatenation of all the error messages it wraps.
489 func (m AttributeContext_RequestMultiError) Error() string {
490 var msgs []string
491 for _, err := range m {
492 msgs = append(msgs, err.Error())
493 }
494 return strings.Join(msgs, "; ")
495 }
496
497 // AllErrors returns a list of validation violation errors.
498 func (m AttributeContext_RequestMultiError) AllErrors() []error { return m }
499
500 // AttributeContext_RequestValidationError is the validation error returned by
501 // AttributeContext_Request.Validate if the designated constraints aren't met.
502 type AttributeContext_RequestValidationError struct {
503 field string
504 reason string
505 cause error
506 key bool
507 }
508
509 // Field function returns field value.
510 func (e AttributeContext_RequestValidationError) Field() string { return e.field }
511
512 // Reason function returns reason value.
513 func (e AttributeContext_RequestValidationError) Reason() string { return e.reason }
514
515 // Cause function returns cause value.
516 func (e AttributeContext_RequestValidationError) Cause() error { return e.cause }
517
518 // Key function returns key value.
519 func (e AttributeContext_RequestValidationError) Key() bool { return e.key }
520
521 // ErrorName returns error name.
522 func (e AttributeContext_RequestValidationError) ErrorName() string {
523 return "AttributeContext_RequestValidationError"
524 }
525
526 // Error satisfies the builtin error interface
527 func (e AttributeContext_RequestValidationError) Error() string {
528 cause := ""
529 if e.cause != nil {
530 cause = fmt.Sprintf(" | caused by: %v", e.cause)
531 }
532
533 key := ""
534 if e.key {
535 key = "key for "
536 }
537
538 return fmt.Sprintf(
539 "invalid %sAttributeContext_Request.%s: %s%s",
540 key,
541 e.field,
542 e.reason,
543 cause)
544 }
545
546 var _ error = AttributeContext_RequestValidationError{}
547
548 var _ interface {
549 Field() string
550 Reason() string
551 Key() bool
552 Cause() error
553 ErrorName() string
554 } = AttributeContext_RequestValidationError{}
555
556 // Validate checks the field values on AttributeContext_HttpRequest with the
557 // rules defined in the proto definition for this message. If any rules are
558 // violated, the first error encountered is returned, or nil if there are no violations.
559 func (m *AttributeContext_HttpRequest) Validate() error {
560 return m.validate(false)
561 }
562
563 // ValidateAll checks the field values on AttributeContext_HttpRequest with the
564 // rules defined in the proto definition for this message. If any rules are
565 // violated, the result is a list of violation errors wrapped in
566 // AttributeContext_HttpRequestMultiError, or nil if none found.
567 func (m *AttributeContext_HttpRequest) ValidateAll() error {
568 return m.validate(true)
569 }
570
571 func (m *AttributeContext_HttpRequest) validate(all bool) error {
572 if m == nil {
573 return nil
574 }
575
576 var errors []error
577
578 // no validation rules for Id
579
580 // no validation rules for Method
581
582 // no validation rules for Headers
583
584 // no validation rules for Path
585
586 // no validation rules for Host
587
588 // no validation rules for Scheme
589
590 // no validation rules for Query
591
592 // no validation rules for Fragment
593
594 // no validation rules for Size
595
596 // no validation rules for Protocol
597
598 // no validation rules for Body
599
600 if len(errors) > 0 {
601 return AttributeContext_HttpRequestMultiError(errors)
602 }
603
604 return nil
605 }
606
607 // AttributeContext_HttpRequestMultiError is an error wrapping multiple
608 // validation errors returned by AttributeContext_HttpRequest.ValidateAll() if
609 // the designated constraints aren't met.
610 type AttributeContext_HttpRequestMultiError []error
611
612 // Error returns a concatenation of all the error messages it wraps.
613 func (m AttributeContext_HttpRequestMultiError) Error() string {
614 var msgs []string
615 for _, err := range m {
616 msgs = append(msgs, err.Error())
617 }
618 return strings.Join(msgs, "; ")
619 }
620
621 // AllErrors returns a list of validation violation errors.
622 func (m AttributeContext_HttpRequestMultiError) AllErrors() []error { return m }
623
624 // AttributeContext_HttpRequestValidationError is the validation error returned
625 // by AttributeContext_HttpRequest.Validate if the designated constraints
626 // aren't met.
627 type AttributeContext_HttpRequestValidationError struct {
628 field string
629 reason string
630 cause error
631 key bool
632 }
633
634 // Field function returns field value.
635 func (e AttributeContext_HttpRequestValidationError) Field() string { return e.field }
636
637 // Reason function returns reason value.
638 func (e AttributeContext_HttpRequestValidationError) Reason() string { return e.reason }
639
640 // Cause function returns cause value.
641 func (e AttributeContext_HttpRequestValidationError) Cause() error { return e.cause }
642
643 // Key function returns key value.
644 func (e AttributeContext_HttpRequestValidationError) Key() bool { return e.key }
645
646 // ErrorName returns error name.
647 func (e AttributeContext_HttpRequestValidationError) ErrorName() string {
648 return "AttributeContext_HttpRequestValidationError"
649 }
650
651 // Error satisfies the builtin error interface
652 func (e AttributeContext_HttpRequestValidationError) Error() string {
653 cause := ""
654 if e.cause != nil {
655 cause = fmt.Sprintf(" | caused by: %v", e.cause)
656 }
657
658 key := ""
659 if e.key {
660 key = "key for "
661 }
662
663 return fmt.Sprintf(
664 "invalid %sAttributeContext_HttpRequest.%s: %s%s",
665 key,
666 e.field,
667 e.reason,
668 cause)
669 }
670
671 var _ error = AttributeContext_HttpRequestValidationError{}
672
673 var _ interface {
674 Field() string
675 Reason() string
676 Key() bool
677 Cause() error
678 ErrorName() string
679 } = AttributeContext_HttpRequestValidationError{}