Debian Codegraph @

envoy/service/auth/v3/external_auth.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/service/auth/v3/external_auth.proto
4
5 package authv3
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 CheckRequest with the rules defined in
40 // the proto definition for this message. If any rules are violated, the first
41 // error encountered is returned, or nil if there are no violations.
42 func (m *CheckRequest) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on CheckRequest with the rules defined
47 // in the proto definition for this message. If any rules are violated, the
48 // result is a list of violation errors wrapped in CheckRequestMultiError, or
49 // nil if none found.
50 func (m *CheckRequest) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *CheckRequest) 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.GetAttributes()).(type) {
63 case interface{ ValidateAll() error }:
64 if err := v.ValidateAll(); err != nil {
65 errors = append(errors, CheckRequestValidationError{
66 field: "Attributes",
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, CheckRequestValidationError{
74 field: "Attributes",
75 reason: "embedded message failed validation",
76 cause: err,
77 })
78 }
79 }
80 } else if v, ok := interface{}(m.GetAttributes()).(interface{ Validate() error }); ok {
81 if err := v.Validate(); err != nil {
82 return CheckRequestValidationError{
83 field: "Attributes",
84 reason: "embedded message failed validation",
85 cause: err,
86 }
87 }
88 }
89
90 if len(errors) > 0 {
91 return CheckRequestMultiError(errors)
92 }
93
94 return nil
95 }
96
97 // CheckRequestMultiError is an error wrapping multiple validation errors
98 // returned by CheckRequest.ValidateAll() if the designated constraints aren't met.
99 type CheckRequestMultiError []error
100
101 // Error returns a concatenation of all the error messages it wraps.
102 func (m CheckRequestMultiError) Error() string {
103 var msgs []string
104 for _, err := range m {
105 msgs = append(msgs, err.Error())
106 }
107 return strings.Join(msgs, "; ")
108 }
109
110 // AllErrors returns a list of validation violation errors.
111 func (m CheckRequestMultiError) AllErrors() []error { return m }
112
113 // CheckRequestValidationError is the validation error returned by
114 // CheckRequest.Validate if the designated constraints aren't met.
115 type CheckRequestValidationError struct {
116 field string
117 reason string
118 cause error
119 key bool
120 }
121
122 // Field function returns field value.
123 func (e CheckRequestValidationError) Field() string { return e.field }
124
125 // Reason function returns reason value.
126 func (e CheckRequestValidationError) Reason() string { return e.reason }
127
128 // Cause function returns cause value.
129 func (e CheckRequestValidationError) Cause() error { return e.cause }
130
131 // Key function returns key value.
132 func (e CheckRequestValidationError) Key() bool { return e.key }
133
134 // ErrorName returns error name.
135 func (e CheckRequestValidationError) ErrorName() string { return "CheckRequestValidationError" }
136
137 // Error satisfies the builtin error interface
138 func (e CheckRequestValidationError) Error() string {
139 cause := ""
140 if e.cause != nil {
141 cause = fmt.Sprintf(" | caused by: %v", e.cause)
142 }
143
144 key := ""
145 if e.key {
146 key = "key for "
147 }
148
149 return fmt.Sprintf(
150 "invalid %sCheckRequest.%s: %s%s",
151 key,
152 e.field,
153 e.reason,
154 cause)
155 }
156
157 var _ error = CheckRequestValidationError{}
158
159 var _ interface {
160 Field() string
161 Reason() string
162 Key() bool
163 Cause() error
164 ErrorName() string
165 } = CheckRequestValidationError{}
166
167 // Validate checks the field values on DeniedHttpResponse with the rules
168 // defined in the proto definition for this message. If any rules are
169 // violated, the first error encountered is returned, or nil if there are no violations.
170 func (m *DeniedHttpResponse) Validate() error {
171 return m.validate(false)
172 }
173
174 // ValidateAll checks the field values on DeniedHttpResponse with the rules
175 // defined in the proto definition for this message. If any rules are
176 // violated, the result is a list of violation errors wrapped in
177 // DeniedHttpResponseMultiError, or nil if none found.
178 func (m *DeniedHttpResponse) ValidateAll() error {
179 return m.validate(true)
180 }
181
182 func (m *DeniedHttpResponse) validate(all bool) error {
183 if m == nil {
184 return nil
185 }
186
187 var errors []error
188
189 if all {
190 switch v := interface{}(m.GetStatus()).(type) {
191 case interface{ ValidateAll() error }:
192 if err := v.ValidateAll(); err != nil {
193 errors = append(errors, DeniedHttpResponseValidationError{
194 field: "Status",
195 reason: "embedded message failed validation",
196 cause: err,
197 })
198 }
199 case interface{ Validate() error }:
200 if err := v.Validate(); err != nil {
201 errors = append(errors, DeniedHttpResponseValidationError{
202 field: "Status",
203 reason: "embedded message failed validation",
204 cause: err,
205 })
206 }
207 }
208 } else if v, ok := interface{}(m.GetStatus()).(interface{ Validate() error }); ok {
209 if err := v.Validate(); err != nil {
210 return DeniedHttpResponseValidationError{
211 field: "Status",
212 reason: "embedded message failed validation",
213 cause: err,
214 }
215 }
216 }
217
218 for idx, item := range m.GetHeaders() {
219 _, _ = idx, item
220
221 if all {
222 switch v := interface{}(item).(type) {
223 case interface{ ValidateAll() error }:
224 if err := v.ValidateAll(); err != nil {
225 errors = append(errors, DeniedHttpResponseValidationError{
226 field: fmt.Sprintf("Headers[%v]", idx),
227 reason: "embedded message failed validation",
228 cause: err,
229 })
230 }
231 case interface{ Validate() error }:
232 if err := v.Validate(); err != nil {
233 errors = append(errors, DeniedHttpResponseValidationError{
234 field: fmt.Sprintf("Headers[%v]", idx),
235 reason: "embedded message failed validation",
236 cause: err,
237 })
238 }
239 }
240 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
241 if err := v.Validate(); err != nil {
242 return DeniedHttpResponseValidationError{
243 field: fmt.Sprintf("Headers[%v]", idx),
244 reason: "embedded message failed validation",
245 cause: err,
246 }
247 }
248 }
249
250 }
251
252 // no validation rules for Body
253
254 if len(errors) > 0 {
255 return DeniedHttpResponseMultiError(errors)
256 }
257
258 return nil
259 }
260
261 // DeniedHttpResponseMultiError is an error wrapping multiple validation errors
262 // returned by DeniedHttpResponse.ValidateAll() if the designated constraints
263 // aren't met.
264 type DeniedHttpResponseMultiError []error
265
266 // Error returns a concatenation of all the error messages it wraps.
267 func (m DeniedHttpResponseMultiError) Error() string {
268 var msgs []string
269 for _, err := range m {
270 msgs = append(msgs, err.Error())
271 }
272 return strings.Join(msgs, "; ")
273 }
274
275 // AllErrors returns a list of validation violation errors.
276 func (m DeniedHttpResponseMultiError) AllErrors() []error { return m }
277
278 // DeniedHttpResponseValidationError is the validation error returned by
279 // DeniedHttpResponse.Validate if the designated constraints aren't met.
280 type DeniedHttpResponseValidationError struct {
281 field string
282 reason string
283 cause error
284 key bool
285 }
286
287 // Field function returns field value.
288 func (e DeniedHttpResponseValidationError) Field() string { return e.field }
289
290 // Reason function returns reason value.
291 func (e DeniedHttpResponseValidationError) Reason() string { return e.reason }
292
293 // Cause function returns cause value.
294 func (e DeniedHttpResponseValidationError) Cause() error { return e.cause }
295
296 // Key function returns key value.
297 func (e DeniedHttpResponseValidationError) Key() bool { return e.key }
298
299 // ErrorName returns error name.
300 func (e DeniedHttpResponseValidationError) ErrorName() string {
301 return "DeniedHttpResponseValidationError"
302 }
303
304 // Error satisfies the builtin error interface
305 func (e DeniedHttpResponseValidationError) Error() string {
306 cause := ""
307 if e.cause != nil {
308 cause = fmt.Sprintf(" | caused by: %v", e.cause)
309 }
310
311 key := ""
312 if e.key {
313 key = "key for "
314 }
315
316 return fmt.Sprintf(
317 "invalid %sDeniedHttpResponse.%s: %s%s",
318 key,
319 e.field,
320 e.reason,
321 cause)
322 }
323
324 var _ error = DeniedHttpResponseValidationError{}
325
326 var _ interface {
327 Field() string
328 Reason() string
329 Key() bool
330 Cause() error
331 ErrorName() string
332 } = DeniedHttpResponseValidationError{}
333
334 // Validate checks the field values on OkHttpResponse with the rules defined in
335 // the proto definition for this message. If any rules are violated, the first
336 // error encountered is returned, or nil if there are no violations.
337 func (m *OkHttpResponse) Validate() error {
338 return m.validate(false)
339 }
340
341 // ValidateAll checks the field values on OkHttpResponse with the rules defined
342 // in the proto definition for this message. If any rules are violated, the
343 // result is a list of violation errors wrapped in OkHttpResponseMultiError,
344 // or nil if none found.
345 func (m *OkHttpResponse) ValidateAll() error {
346 return m.validate(true)
347 }
348
349 func (m *OkHttpResponse) validate(all bool) error {
350 if m == nil {
351 return nil
352 }
353
354 var errors []error
355
356 for idx, item := range m.GetHeaders() {
357 _, _ = idx, item
358
359 if all {
360 switch v := interface{}(item).(type) {
361 case interface{ ValidateAll() error }:
362 if err := v.ValidateAll(); err != nil {
363 errors = append(errors, OkHttpResponseValidationError{
364 field: fmt.Sprintf("Headers[%v]", idx),
365 reason: "embedded message failed validation",
366 cause: err,
367 })
368 }
369 case interface{ Validate() error }:
370 if err := v.Validate(); err != nil {
371 errors = append(errors, OkHttpResponseValidationError{
372 field: fmt.Sprintf("Headers[%v]", idx),
373 reason: "embedded message failed validation",
374 cause: err,
375 })
376 }
377 }
378 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
379 if err := v.Validate(); err != nil {
380 return OkHttpResponseValidationError{
381 field: fmt.Sprintf("Headers[%v]", idx),
382 reason: "embedded message failed validation",
383 cause: err,
384 }
385 }
386 }
387
388 }
389
390 if all {
391 switch v := interface{}(m.GetDynamicMetadata()).(type) {
392 case interface{ ValidateAll() error }:
393 if err := v.ValidateAll(); err != nil {
394 errors = append(errors, OkHttpResponseValidationError{
395 field: "DynamicMetadata",
396 reason: "embedded message failed validation",
397 cause: err,
398 })
399 }
400 case interface{ Validate() error }:
401 if err := v.Validate(); err != nil {
402 errors = append(errors, OkHttpResponseValidationError{
403 field: "DynamicMetadata",
404 reason: "embedded message failed validation",
405 cause: err,
406 })
407 }
408 }
409 } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok {
410 if err := v.Validate(); err != nil {
411 return OkHttpResponseValidationError{
412 field: "DynamicMetadata",
413 reason: "embedded message failed validation",
414 cause: err,
415 }
416 }
417 }
418
419 for idx, item := range m.GetResponseHeadersToAdd() {
420 _, _ = idx, item
421
422 if all {
423 switch v := interface{}(item).(type) {
424 case interface{ ValidateAll() error }:
425 if err := v.ValidateAll(); err != nil {
426 errors = append(errors, OkHttpResponseValidationError{
427 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
428 reason: "embedded message failed validation",
429 cause: err,
430 })
431 }
432 case interface{ Validate() error }:
433 if err := v.Validate(); err != nil {
434 errors = append(errors, OkHttpResponseValidationError{
435 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
436 reason: "embedded message failed validation",
437 cause: err,
438 })
439 }
440 }
441 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
442 if err := v.Validate(); err != nil {
443 return OkHttpResponseValidationError{
444 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
445 reason: "embedded message failed validation",
446 cause: err,
447 }
448 }
449 }
450
451 }
452
453 for idx, item := range m.GetQueryParametersToSet() {
454 _, _ = idx, item
455
456 if all {
457 switch v := interface{}(item).(type) {
458 case interface{ ValidateAll() error }:
459 if err := v.ValidateAll(); err != nil {
460 errors = append(errors, OkHttpResponseValidationError{
461 field: fmt.Sprintf("QueryParametersToSet[%v]", idx),
462 reason: "embedded message failed validation",
463 cause: err,
464 })
465 }
466 case interface{ Validate() error }:
467 if err := v.Validate(); err != nil {
468 errors = append(errors, OkHttpResponseValidationError{
469 field: fmt.Sprintf("QueryParametersToSet[%v]", idx),
470 reason: "embedded message failed validation",
471 cause: err,
472 })
473 }
474 }
475 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
476 if err := v.Validate(); err != nil {
477 return OkHttpResponseValidationError{
478 field: fmt.Sprintf("QueryParametersToSet[%v]", idx),
479 reason: "embedded message failed validation",
480 cause: err,
481 }
482 }
483 }
484
485 }
486
487 if len(errors) > 0 {
488 return OkHttpResponseMultiError(errors)
489 }
490
491 return nil
492 }
493
494 // OkHttpResponseMultiError is an error wrapping multiple validation errors
495 // returned by OkHttpResponse.ValidateAll() if the designated constraints
496 // aren't met.
497 type OkHttpResponseMultiError []error
498
499 // Error returns a concatenation of all the error messages it wraps.
500 func (m OkHttpResponseMultiError) Error() string {
501 var msgs []string
502 for _, err := range m {
503 msgs = append(msgs, err.Error())
504 }
505 return strings.Join(msgs, "; ")
506 }
507
508 // AllErrors returns a list of validation violation errors.
509 func (m OkHttpResponseMultiError) AllErrors() []error { return m }
510
511 // OkHttpResponseValidationError is the validation error returned by
512 // OkHttpResponse.Validate if the designated constraints aren't met.
513 type OkHttpResponseValidationError struct {
514 field string
515 reason string
516 cause error
517 key bool
518 }
519
520 // Field function returns field value.
521 func (e OkHttpResponseValidationError) Field() string { return e.field }
522
523 // Reason function returns reason value.
524 func (e OkHttpResponseValidationError) Reason() string { return e.reason }
525
526 // Cause function returns cause value.
527 func (e OkHttpResponseValidationError) Cause() error { return e.cause }
528
529 // Key function returns key value.
530 func (e OkHttpResponseValidationError) Key() bool { return e.key }
531
532 // ErrorName returns error name.
533 func (e OkHttpResponseValidationError) ErrorName() string { return "OkHttpResponseValidationError" }
534
535 // Error satisfies the builtin error interface
536 func (e OkHttpResponseValidationError) Error() string {
537 cause := ""
538 if e.cause != nil {
539 cause = fmt.Sprintf(" | caused by: %v", e.cause)
540 }
541
542 key := ""
543 if e.key {
544 key = "key for "
545 }
546
547 return fmt.Sprintf(
548 "invalid %sOkHttpResponse.%s: %s%s",
549 key,
550 e.field,
551 e.reason,
552 cause)
553 }
554
555 var _ error = OkHttpResponseValidationError{}
556
557 var _ interface {
558 Field() string
559 Reason() string
560 Key() bool
561 Cause() error
562 ErrorName() string
563 } = OkHttpResponseValidationError{}
564
565 // Validate checks the field values on CheckResponse with the rules defined in
566 // the proto definition for this message. If any rules are violated, the first
567 // error encountered is returned, or nil if there are no violations.
568 func (m *CheckResponse) Validate() error {
569 return m.validate(false)
570 }
571
572 // ValidateAll checks the field values on CheckResponse with the rules defined
573 // in the proto definition for this message. If any rules are violated, the
574 // result is a list of violation errors wrapped in CheckResponseMultiError, or
575 // nil if none found.
576 func (m *CheckResponse) ValidateAll() error {
577 return m.validate(true)
578 }
579
580 func (m *CheckResponse) validate(all bool) error {
581 if m == nil {
582 return nil
583 }
584
585 var errors []error
586
587 if all {
588 switch v := interface{}(m.GetStatus()).(type) {
589 case interface{ ValidateAll() error }:
590 if err := v.ValidateAll(); err != nil {
591 errors = append(errors, CheckResponseValidationError{
592 field: "Status",
593 reason: "embedded message failed validation",
594 cause: err,
595 })
596 }
597 case interface{ Validate() error }:
598 if err := v.Validate(); err != nil {
599 errors = append(errors, CheckResponseValidationError{
600 field: "Status",
601 reason: "embedded message failed validation",
602 cause: err,
603 })
604 }
605 }
606 } else if v, ok := interface{}(m.GetStatus()).(interface{ Validate() error }); ok {
607 if err := v.Validate(); err != nil {
608 return CheckResponseValidationError{
609 field: "Status",
610 reason: "embedded message failed validation",
611 cause: err,
612 }
613 }
614 }
615
616 if all {
617 switch v := interface{}(m.GetDynamicMetadata()).(type) {
618 case interface{ ValidateAll() error }:
619 if err := v.ValidateAll(); err != nil {
620 errors = append(errors, CheckResponseValidationError{
621 field: "DynamicMetadata",
622 reason: "embedded message failed validation",
623 cause: err,
624 })
625 }
626 case interface{ Validate() error }:
627 if err := v.Validate(); err != nil {
628 errors = append(errors, CheckResponseValidationError{
629 field: "DynamicMetadata",
630 reason: "embedded message failed validation",
631 cause: err,
632 })
633 }
634 }
635 } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok {
636 if err := v.Validate(); err != nil {
637 return CheckResponseValidationError{
638 field: "DynamicMetadata",
639 reason: "embedded message failed validation",
640 cause: err,
641 }
642 }
643 }
644
645 switch v := m.HttpResponse.(type) {
646 case *CheckResponse_DeniedResponse:
647 if v == nil {
648 err := CheckResponseValidationError{
649 field: "HttpResponse",
650 reason: "oneof value cannot be a typed-nil",
651 }
652 if !all {
653 return err
654 }
655 errors = append(errors, err)
656 }
657
658 if all {
659 switch v := interface{}(m.GetDeniedResponse()).(type) {
660 case interface{ ValidateAll() error }:
661 if err := v.ValidateAll(); err != nil {
662 errors = append(errors, CheckResponseValidationError{
663 field: "DeniedResponse",
664 reason: "embedded message failed validation",
665 cause: err,
666 })
667 }
668 case interface{ Validate() error }:
669 if err := v.Validate(); err != nil {
670 errors = append(errors, CheckResponseValidationError{
671 field: "DeniedResponse",
672 reason: "embedded message failed validation",
673 cause: err,
674 })
675 }
676 }
677 } else if v, ok := interface{}(m.GetDeniedResponse()).(interface{ Validate() error }); ok {
678 if err := v.Validate(); err != nil {
679 return CheckResponseValidationError{
680 field: "DeniedResponse",
681 reason: "embedded message failed validation",
682 cause: err,
683 }
684 }
685 }
686
687 case *CheckResponse_OkResponse:
688 if v == nil {
689 err := CheckResponseValidationError{
690 field: "HttpResponse",
691 reason: "oneof value cannot be a typed-nil",
692 }
693 if !all {
694 return err
695 }
696 errors = append(errors, err)
697 }
698
699 if all {
700 switch v := interface{}(m.GetOkResponse()).(type) {
701 case interface{ ValidateAll() error }:
702 if err := v.ValidateAll(); err != nil {
703 errors = append(errors, CheckResponseValidationError{
704 field: "OkResponse",
705 reason: "embedded message failed validation",
706 cause: err,
707 })
708 }
709 case interface{ Validate() error }:
710 if err := v.Validate(); err != nil {
711 errors = append(errors, CheckResponseValidationError{
712 field: "OkResponse",
713 reason: "embedded message failed validation",
714 cause: err,
715 })
716 }
717 }
718 } else if v, ok := interface{}(m.GetOkResponse()).(interface{ Validate() error }); ok {
719 if err := v.Validate(); err != nil {
720 return CheckResponseValidationError{
721 field: "OkResponse",
722 reason: "embedded message failed validation",
723 cause: err,
724 }
725 }
726 }
727
728 default:
729 _ = v // ensures v is used
730 }
731
732 if len(errors) > 0 {
733 return CheckResponseMultiError(errors)
734 }
735
736 return nil
737 }
738
739 // CheckResponseMultiError is an error wrapping multiple validation errors
740 // returned by CheckResponse.ValidateAll() if the designated constraints
741 // aren't met.
742 type CheckResponseMultiError []error
743
744 // Error returns a concatenation of all the error messages it wraps.
745 func (m CheckResponseMultiError) Error() string {
746 var msgs []string
747 for _, err := range m {
748 msgs = append(msgs, err.Error())
749 }
750 return strings.Join(msgs, "; ")
751 }
752
753 // AllErrors returns a list of validation violation errors.
754 func (m CheckResponseMultiError) AllErrors() []error { return m }
755
756 // CheckResponseValidationError is the validation error returned by
757 // CheckResponse.Validate if the designated constraints aren't met.
758 type CheckResponseValidationError struct {
759 field string
760 reason string
761 cause error
762 key bool
763 }
764
765 // Field function returns field value.
766 func (e CheckResponseValidationError) Field() string { return e.field }
767
768 // Reason function returns reason value.
769 func (e CheckResponseValidationError) Reason() string { return e.reason }
770
771 // Cause function returns cause value.
772 func (e CheckResponseValidationError) Cause() error { return e.cause }
773
774 // Key function returns key value.
775 func (e CheckResponseValidationError) Key() bool { return e.key }
776
777 // ErrorName returns error name.
778 func (e CheckResponseValidationError) ErrorName() string { return "CheckResponseValidationError" }
779
780 // Error satisfies the builtin error interface
781 func (e CheckResponseValidationError) Error() string {
782 cause := ""
783 if e.cause != nil {
784 cause = fmt.Sprintf(" | caused by: %v", e.cause)
785 }
786
787 key := ""
788 if e.key {
789 key = "key for "
790 }
791
792 return fmt.Sprintf(
793 "invalid %sCheckResponse.%s: %s%s",
794 key,
795 e.field,
796 e.reason,
797 cause)
798 }
799
800 var _ error = CheckResponseValidationError{}
801
802 var _ interface {
803 Field() string
804 Reason() string
805 Key() bool
806 Cause() error
807 ErrorName() string
808 } = CheckResponseValidationError{}