gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/go-control-plane/envoy/config/common/matcher/v3/matcher.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/config/common/matcher/v3/matcher.proto 3 4 package envoy_config_common_matcher_v3 5 6 import ( 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 "google.golang.org/protobuf/types/known/anypb" 19 ) 20 21 // ensure the imports are used 22 var ( 23 _ = bytes.MinRead 24 _ = errors.New("") 25 _ = fmt.Print 26 _ = utf8.UTFMax 27 _ = (*regexp.Regexp)(nil) 28 _ = (*strings.Reader)(nil) 29 _ = net.IPv4len 30 _ = time.Duration(0) 31 _ = (*url.URL)(nil) 32 _ = (*mail.Address)(nil) 33 _ = anypb.Any{} 34 ) 35 36 // Validate checks the field values on Matcher with the rules defined in the 37 // proto definition for this message. If any rules are violated, an error is returned. 38 func (m *Matcher) Validate() error { 39 if m == nil { 40 return nil 41 } 42 43 if v, ok := interface{}(m.GetOnNoMatch()).(interface{ Validate() error }); ok { 44 if err := v.Validate(); err != nil { 45 return MatcherValidationError{ 46 field: "OnNoMatch", 47 reason: "embedded message failed validation", 48 cause: err, 49 } 50 } 51 } 52 53 switch m.MatcherType.(type) { 54 55 case *Matcher_MatcherList_: 56 57 if v, ok := interface{}(m.GetMatcherList()).(interface{ Validate() error }); ok { 58 if err := v.Validate(); err != nil { 59 return MatcherValidationError{ 60 field: "MatcherList", 61 reason: "embedded message failed validation", 62 cause: err, 63 } 64 } 65 } 66 67 case *Matcher_MatcherTree_: 68 69 if v, ok := interface{}(m.GetMatcherTree()).(interface{ Validate() error }); ok { 70 if err := v.Validate(); err != nil { 71 return MatcherValidationError{ 72 field: "MatcherTree", 73 reason: "embedded message failed validation", 74 cause: err, 75 } 76 } 77 } 78 79 default: 80 return MatcherValidationError{ 81 field: "MatcherType", 82 reason: "value is required", 83 } 84 85 } 86 87 return nil 88 } 89 90 // MatcherValidationError is the validation error returned by Matcher.Validate 91 // if the designated constraints aren't met. 92 type MatcherValidationError struct { 93 field string 94 reason string 95 cause error 96 key bool 97 } 98 99 // Field function returns field value. 100 func (e MatcherValidationError) Field() string { return e.field } 101 102 // Reason function returns reason value. 103 func (e MatcherValidationError) Reason() string { return e.reason } 104 105 // Cause function returns cause value. 106 func (e MatcherValidationError) Cause() error { return e.cause } 107 108 // Key function returns key value. 109 func (e MatcherValidationError) Key() bool { return e.key } 110 111 // ErrorName returns error name. 112 func (e MatcherValidationError) ErrorName() string { return "MatcherValidationError" } 113 114 // Error satisfies the builtin error interface 115 func (e MatcherValidationError) Error() string { 116 cause := "" 117 if e.cause != nil { 118 cause = fmt.Sprintf(" | caused by: %v", e.cause) 119 } 120 121 key := "" 122 if e.key { 123 key = "key for " 124 } 125 126 return fmt.Sprintf( 127 "invalid %sMatcher.%s: %s%s", 128 key, 129 e.field, 130 e.reason, 131 cause) 132 } 133 134 var _ error = MatcherValidationError{} 135 136 var _ interface { 137 Field() string 138 Reason() string 139 Key() bool 140 Cause() error 141 ErrorName() string 142 } = MatcherValidationError{} 143 144 // Validate checks the field values on MatchPredicate with the rules defined in 145 // the proto definition for this message. If any rules are violated, an error 146 // is returned. 147 func (m *MatchPredicate) Validate() error { 148 if m == nil { 149 return nil 150 } 151 152 switch m.Rule.(type) { 153 154 case *MatchPredicate_OrMatch: 155 156 if v, ok := interface{}(m.GetOrMatch()).(interface{ Validate() error }); ok { 157 if err := v.Validate(); err != nil { 158 return MatchPredicateValidationError{ 159 field: "OrMatch", 160 reason: "embedded message failed validation", 161 cause: err, 162 } 163 } 164 } 165 166 case *MatchPredicate_AndMatch: 167 168 if v, ok := interface{}(m.GetAndMatch()).(interface{ Validate() error }); ok { 169 if err := v.Validate(); err != nil { 170 return MatchPredicateValidationError{ 171 field: "AndMatch", 172 reason: "embedded message failed validation", 173 cause: err, 174 } 175 } 176 } 177 178 case *MatchPredicate_NotMatch: 179 180 if v, ok := interface{}(m.GetNotMatch()).(interface{ Validate() error }); ok { 181 if err := v.Validate(); err != nil { 182 return MatchPredicateValidationError{ 183 field: "NotMatch", 184 reason: "embedded message failed validation", 185 cause: err, 186 } 187 } 188 } 189 190 case *MatchPredicate_AnyMatch: 191 192 if m.GetAnyMatch() != true { 193 return MatchPredicateValidationError{ 194 field: "AnyMatch", 195 reason: "value must equal true", 196 } 197 } 198 199 case *MatchPredicate_HttpRequestHeadersMatch: 200 201 if v, ok := interface{}(m.GetHttpRequestHeadersMatch()).(interface{ Validate() error }); ok { 202 if err := v.Validate(); err != nil { 203 return MatchPredicateValidationError{ 204 field: "HttpRequestHeadersMatch", 205 reason: "embedded message failed validation", 206 cause: err, 207 } 208 } 209 } 210 211 case *MatchPredicate_HttpRequestTrailersMatch: 212 213 if v, ok := interface{}(m.GetHttpRequestTrailersMatch()).(interface{ Validate() error }); ok { 214 if err := v.Validate(); err != nil { 215 return MatchPredicateValidationError{ 216 field: "HttpRequestTrailersMatch", 217 reason: "embedded message failed validation", 218 cause: err, 219 } 220 } 221 } 222 223 case *MatchPredicate_HttpResponseHeadersMatch: 224 225 if v, ok := interface{}(m.GetHttpResponseHeadersMatch()).(interface{ Validate() error }); ok { 226 if err := v.Validate(); err != nil { 227 return MatchPredicateValidationError{ 228 field: "HttpResponseHeadersMatch", 229 reason: "embedded message failed validation", 230 cause: err, 231 } 232 } 233 } 234 235 case *MatchPredicate_HttpResponseTrailersMatch: 236 237 if v, ok := interface{}(m.GetHttpResponseTrailersMatch()).(interface{ Validate() error }); ok { 238 if err := v.Validate(); err != nil { 239 return MatchPredicateValidationError{ 240 field: "HttpResponseTrailersMatch", 241 reason: "embedded message failed validation", 242 cause: err, 243 } 244 } 245 } 246 247 case *MatchPredicate_HttpRequestGenericBodyMatch: 248 249 if v, ok := interface{}(m.GetHttpRequestGenericBodyMatch()).(interface{ Validate() error }); ok { 250 if err := v.Validate(); err != nil { 251 return MatchPredicateValidationError{ 252 field: "HttpRequestGenericBodyMatch", 253 reason: "embedded message failed validation", 254 cause: err, 255 } 256 } 257 } 258 259 case *MatchPredicate_HttpResponseGenericBodyMatch: 260 261 if v, ok := interface{}(m.GetHttpResponseGenericBodyMatch()).(interface{ Validate() error }); ok { 262 if err := v.Validate(); err != nil { 263 return MatchPredicateValidationError{ 264 field: "HttpResponseGenericBodyMatch", 265 reason: "embedded message failed validation", 266 cause: err, 267 } 268 } 269 } 270 271 default: 272 return MatchPredicateValidationError{ 273 field: "Rule", 274 reason: "value is required", 275 } 276 277 } 278 279 return nil 280 } 281 282 // MatchPredicateValidationError is the validation error returned by 283 // MatchPredicate.Validate if the designated constraints aren't met. 284 type MatchPredicateValidationError struct { 285 field string 286 reason string 287 cause error 288 key bool 289 } 290 291 // Field function returns field value. 292 func (e MatchPredicateValidationError) Field() string { return e.field } 293 294 // Reason function returns reason value. 295 func (e MatchPredicateValidationError) Reason() string { return e.reason } 296 297 // Cause function returns cause value. 298 func (e MatchPredicateValidationError) Cause() error { return e.cause } 299 300 // Key function returns key value. 301 func (e MatchPredicateValidationError) Key() bool { return e.key } 302 303 // ErrorName returns error name. 304 func (e MatchPredicateValidationError) ErrorName() string { return "MatchPredicateValidationError" } 305 306 // Error satisfies the builtin error interface 307 func (e MatchPredicateValidationError) Error() string { 308 cause := "" 309 if e.cause != nil { 310 cause = fmt.Sprintf(" | caused by: %v", e.cause) 311 } 312 313 key := "" 314 if e.key { 315 key = "key for " 316 } 317 318 return fmt.Sprintf( 319 "invalid %sMatchPredicate.%s: %s%s", 320 key, 321 e.field, 322 e.reason, 323 cause) 324 } 325 326 var _ error = MatchPredicateValidationError{} 327 328 var _ interface { 329 Field() string 330 Reason() string 331 Key() bool 332 Cause() error 333 ErrorName() string 334 } = MatchPredicateValidationError{} 335 336 // Validate checks the field values on HttpHeadersMatch with the rules defined 337 // in the proto definition for this message. If any rules are violated, an 338 // error is returned. 339 func (m *HttpHeadersMatch) Validate() error { 340 if m == nil { 341 return nil 342 } 343 344 for idx, item := range m.GetHeaders() { 345 _, _ = idx, item 346 347 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 348 if err := v.Validate(); err != nil { 349 return HttpHeadersMatchValidationError{ 350 field: fmt.Sprintf("Headers[%v]", idx), 351 reason: "embedded message failed validation", 352 cause: err, 353 } 354 } 355 } 356 357 } 358 359 return nil 360 } 361 362 // HttpHeadersMatchValidationError is the validation error returned by 363 // HttpHeadersMatch.Validate if the designated constraints aren't met. 364 type HttpHeadersMatchValidationError struct { 365 field string 366 reason string 367 cause error 368 key bool 369 } 370 371 // Field function returns field value. 372 func (e HttpHeadersMatchValidationError) Field() string { return e.field } 373 374 // Reason function returns reason value. 375 func (e HttpHeadersMatchValidationError) Reason() string { return e.reason } 376 377 // Cause function returns cause value. 378 func (e HttpHeadersMatchValidationError) Cause() error { return e.cause } 379 380 // Key function returns key value. 381 func (e HttpHeadersMatchValidationError) Key() bool { return e.key } 382 383 // ErrorName returns error name. 384 func (e HttpHeadersMatchValidationError) ErrorName() string { return "HttpHeadersMatchValidationError" } 385 386 // Error satisfies the builtin error interface 387 func (e HttpHeadersMatchValidationError) Error() string { 388 cause := "" 389 if e.cause != nil { 390 cause = fmt.Sprintf(" | caused by: %v", e.cause) 391 } 392 393 key := "" 394 if e.key { 395 key = "key for " 396 } 397 398 return fmt.Sprintf( 399 "invalid %sHttpHeadersMatch.%s: %s%s", 400 key, 401 e.field, 402 e.reason, 403 cause) 404 } 405 406 var _ error = HttpHeadersMatchValidationError{} 407 408 var _ interface { 409 Field() string 410 Reason() string 411 Key() bool 412 Cause() error 413 ErrorName() string 414 } = HttpHeadersMatchValidationError{} 415 416 // Validate checks the field values on HttpGenericBodyMatch with the rules 417 // defined in the proto definition for this message. If any rules are 418 // violated, an error is returned. 419 func (m *HttpGenericBodyMatch) Validate() error { 420 if m == nil { 421 return nil 422 } 423 424 // no validation rules for BytesLimit 425 426 if len(m.GetPatterns()) < 1 { 427 return HttpGenericBodyMatchValidationError{ 428 field: "Patterns", 429 reason: "value must contain at least 1 item(s)", 430 } 431 } 432 433 for idx, item := range m.GetPatterns() { 434 _, _ = idx, item 435 436 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 437 if err := v.Validate(); err != nil { 438 return HttpGenericBodyMatchValidationError{ 439 field: fmt.Sprintf("Patterns[%v]", idx), 440 reason: "embedded message failed validation", 441 cause: err, 442 } 443 } 444 } 445 446 } 447 448 return nil 449 } 450 451 // HttpGenericBodyMatchValidationError is the validation error returned by 452 // HttpGenericBodyMatch.Validate if the designated constraints aren't met. 453 type HttpGenericBodyMatchValidationError struct { 454 field string 455 reason string 456 cause error 457 key bool 458 } 459 460 // Field function returns field value. 461 func (e HttpGenericBodyMatchValidationError) Field() string { return e.field } 462 463 // Reason function returns reason value. 464 func (e HttpGenericBodyMatchValidationError) Reason() string { return e.reason } 465 466 // Cause function returns cause value. 467 func (e HttpGenericBodyMatchValidationError) Cause() error { return e.cause } 468 469 // Key function returns key value. 470 func (e HttpGenericBodyMatchValidationError) Key() bool { return e.key } 471 472 // ErrorName returns error name. 473 func (e HttpGenericBodyMatchValidationError) ErrorName() string { 474 return "HttpGenericBodyMatchValidationError" 475 } 476 477 // Error satisfies the builtin error interface 478 func (e HttpGenericBodyMatchValidationError) Error() string { 479 cause := "" 480 if e.cause != nil { 481 cause = fmt.Sprintf(" | caused by: %v", e.cause) 482 } 483 484 key := "" 485 if e.key { 486 key = "key for " 487 } 488 489 return fmt.Sprintf( 490 "invalid %sHttpGenericBodyMatch.%s: %s%s", 491 key, 492 e.field, 493 e.reason, 494 cause) 495 } 496 497 var _ error = HttpGenericBodyMatchValidationError{} 498 499 var _ interface { 500 Field() string 501 Reason() string 502 Key() bool 503 Cause() error 504 ErrorName() string 505 } = HttpGenericBodyMatchValidationError{} 506 507 // Validate checks the field values on Matcher_OnMatch with the rules defined 508 // in the proto definition for this message. If any rules are violated, an 509 // error is returned. 510 func (m *Matcher_OnMatch) Validate() error { 511 if m == nil { 512 return nil 513 } 514 515 switch m.OnMatch.(type) { 516 517 case *Matcher_OnMatch_Matcher: 518 519 if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok { 520 if err := v.Validate(); err != nil { 521 return Matcher_OnMatchValidationError{ 522 field: "Matcher", 523 reason: "embedded message failed validation", 524 cause: err, 525 } 526 } 527 } 528 529 case *Matcher_OnMatch_Action: 530 531 if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok { 532 if err := v.Validate(); err != nil { 533 return Matcher_OnMatchValidationError{ 534 field: "Action", 535 reason: "embedded message failed validation", 536 cause: err, 537 } 538 } 539 } 540 541 default: 542 return Matcher_OnMatchValidationError{ 543 field: "OnMatch", 544 reason: "value is required", 545 } 546 547 } 548 549 return nil 550 } 551 552 // Matcher_OnMatchValidationError is the validation error returned by 553 // Matcher_OnMatch.Validate if the designated constraints aren't met. 554 type Matcher_OnMatchValidationError struct { 555 field string 556 reason string 557 cause error 558 key bool 559 } 560 561 // Field function returns field value. 562 func (e Matcher_OnMatchValidationError) Field() string { return e.field } 563 564 // Reason function returns reason value. 565 func (e Matcher_OnMatchValidationError) Reason() string { return e.reason } 566 567 // Cause function returns cause value. 568 func (e Matcher_OnMatchValidationError) Cause() error { return e.cause } 569 570 // Key function returns key value. 571 func (e Matcher_OnMatchValidationError) Key() bool { return e.key } 572 573 // ErrorName returns error name. 574 func (e Matcher_OnMatchValidationError) ErrorName() string { return "Matcher_OnMatchValidationError" } 575 576 // Error satisfies the builtin error interface 577 func (e Matcher_OnMatchValidationError) Error() string { 578 cause := "" 579 if e.cause != nil { 580 cause = fmt.Sprintf(" | caused by: %v", e.cause) 581 } 582 583 key := "" 584 if e.key { 585 key = "key for " 586 } 587 588 return fmt.Sprintf( 589 "invalid %sMatcher_OnMatch.%s: %s%s", 590 key, 591 e.field, 592 e.reason, 593 cause) 594 } 595 596 var _ error = Matcher_OnMatchValidationError{} 597 598 var _ interface { 599 Field() string 600 Reason() string 601 Key() bool 602 Cause() error 603 ErrorName() string 604 } = Matcher_OnMatchValidationError{} 605 606 // Validate checks the field values on Matcher_MatcherList with the rules 607 // defined in the proto definition for this message. If any rules are 608 // violated, an error is returned. 609 func (m *Matcher_MatcherList) Validate() error { 610 if m == nil { 611 return nil 612 } 613 614 if len(m.GetMatchers()) < 1 { 615 return Matcher_MatcherListValidationError{ 616 field: "Matchers", 617 reason: "value must contain at least 1 item(s)", 618 } 619 } 620 621 for idx, item := range m.GetMatchers() { 622 _, _ = idx, item 623 624 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 625 if err := v.Validate(); err != nil { 626 return Matcher_MatcherListValidationError{ 627 field: fmt.Sprintf("Matchers[%v]", idx), 628 reason: "embedded message failed validation", 629 cause: err, 630 } 631 } 632 } 633 634 } 635 636 return nil 637 } 638 639 // Matcher_MatcherListValidationError is the validation error returned by 640 // Matcher_MatcherList.Validate if the designated constraints aren't met. 641 type Matcher_MatcherListValidationError struct { 642 field string 643 reason string 644 cause error 645 key bool 646 } 647 648 // Field function returns field value. 649 func (e Matcher_MatcherListValidationError) Field() string { return e.field } 650 651 // Reason function returns reason value. 652 func (e Matcher_MatcherListValidationError) Reason() string { return e.reason } 653 654 // Cause function returns cause value. 655 func (e Matcher_MatcherListValidationError) Cause() error { return e.cause } 656 657 // Key function returns key value. 658 func (e Matcher_MatcherListValidationError) Key() bool { return e.key } 659 660 // ErrorName returns error name. 661 func (e Matcher_MatcherListValidationError) ErrorName() string { 662 return "Matcher_MatcherListValidationError" 663 } 664 665 // Error satisfies the builtin error interface 666 func (e Matcher_MatcherListValidationError) Error() string { 667 cause := "" 668 if e.cause != nil { 669 cause = fmt.Sprintf(" | caused by: %v", e.cause) 670 } 671 672 key := "" 673 if e.key { 674 key = "key for " 675 } 676 677 return fmt.Sprintf( 678 "invalid %sMatcher_MatcherList.%s: %s%s", 679 key, 680 e.field, 681 e.reason, 682 cause) 683 } 684 685 var _ error = Matcher_MatcherListValidationError{} 686 687 var _ interface { 688 Field() string 689 Reason() string 690 Key() bool 691 Cause() error 692 ErrorName() string 693 } = Matcher_MatcherListValidationError{} 694 695 // Validate checks the field values on Matcher_MatcherTree with the rules 696 // defined in the proto definition for this message. If any rules are 697 // violated, an error is returned. 698 func (m *Matcher_MatcherTree) Validate() error { 699 if m == nil { 700 return nil 701 } 702 703 if m.GetInput() == nil { 704 return Matcher_MatcherTreeValidationError{ 705 field: "Input", 706 reason: "value is required", 707 } 708 } 709 710 if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok { 711 if err := v.Validate(); err != nil { 712 return Matcher_MatcherTreeValidationError{ 713 field: "Input", 714 reason: "embedded message failed validation", 715 cause: err, 716 } 717 } 718 } 719 720 switch m.TreeType.(type) { 721 722 case *Matcher_MatcherTree_ExactMatchMap: 723 724 if v, ok := interface{}(m.GetExactMatchMap()).(interface{ Validate() error }); ok { 725 if err := v.Validate(); err != nil { 726 return Matcher_MatcherTreeValidationError{ 727 field: "ExactMatchMap", 728 reason: "embedded message failed validation", 729 cause: err, 730 } 731 } 732 } 733 734 case *Matcher_MatcherTree_PrefixMatchMap: 735 736 if v, ok := interface{}(m.GetPrefixMatchMap()).(interface{ Validate() error }); ok { 737 if err := v.Validate(); err != nil { 738 return Matcher_MatcherTreeValidationError{ 739 field: "PrefixMatchMap", 740 reason: "embedded message failed validation", 741 cause: err, 742 } 743 } 744 } 745 746 case *Matcher_MatcherTree_CustomMatch: 747 748 if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok { 749 if err := v.Validate(); err != nil { 750 return Matcher_MatcherTreeValidationError{ 751 field: "CustomMatch", 752 reason: "embedded message failed validation", 753 cause: err, 754 } 755 } 756 } 757 758 default: 759 return Matcher_MatcherTreeValidationError{ 760 field: "TreeType", 761 reason: "value is required", 762 } 763 764 } 765 766 return nil 767 } 768 769 // Matcher_MatcherTreeValidationError is the validation error returned by 770 // Matcher_MatcherTree.Validate if the designated constraints aren't met. 771 type Matcher_MatcherTreeValidationError struct { 772 field string 773 reason string 774 cause error 775 key bool 776 } 777 778 // Field function returns field value. 779 func (e Matcher_MatcherTreeValidationError) Field() string { return e.field } 780 781 // Reason function returns reason value. 782 func (e Matcher_MatcherTreeValidationError) Reason() string { return e.reason } 783 784 // Cause function returns cause value. 785 func (e Matcher_MatcherTreeValidationError) Cause() error { return e.cause } 786 787 // Key function returns key value. 788 func (e Matcher_MatcherTreeValidationError) Key() bool { return e.key } 789 790 // ErrorName returns error name. 791 func (e Matcher_MatcherTreeValidationError) ErrorName() string { 792 return "Matcher_MatcherTreeValidationError" 793 } 794 795 // Error satisfies the builtin error interface 796 func (e Matcher_MatcherTreeValidationError) Error() string { 797 cause := "" 798 if e.cause != nil { 799 cause = fmt.Sprintf(" | caused by: %v", e.cause) 800 } 801 802 key := "" 803 if e.key { 804 key = "key for " 805 } 806 807 return fmt.Sprintf( 808 "invalid %sMatcher_MatcherTree.%s: %s%s", 809 key, 810 e.field, 811 e.reason, 812 cause) 813 } 814 815 var _ error = Matcher_MatcherTreeValidationError{} 816 817 var _ interface { 818 Field() string 819 Reason() string 820 Key() bool 821 Cause() error 822 ErrorName() string 823 } = Matcher_MatcherTreeValidationError{} 824 825 // Validate checks the field values on Matcher_MatcherList_Predicate with the 826 // rules defined in the proto definition for this message. If any rules are 827 // violated, an error is returned. 828 func (m *Matcher_MatcherList_Predicate) Validate() error { 829 if m == nil { 830 return nil 831 } 832 833 switch m.MatchType.(type) { 834 835 case *Matcher_MatcherList_Predicate_SinglePredicate_: 836 837 if v, ok := interface{}(m.GetSinglePredicate()).(interface{ Validate() error }); ok { 838 if err := v.Validate(); err != nil { 839 return Matcher_MatcherList_PredicateValidationError{ 840 field: "SinglePredicate", 841 reason: "embedded message failed validation", 842 cause: err, 843 } 844 } 845 } 846 847 case *Matcher_MatcherList_Predicate_OrMatcher: 848 849 if v, ok := interface{}(m.GetOrMatcher()).(interface{ Validate() error }); ok { 850 if err := v.Validate(); err != nil { 851 return Matcher_MatcherList_PredicateValidationError{ 852 field: "OrMatcher", 853 reason: "embedded message failed validation", 854 cause: err, 855 } 856 } 857 } 858 859 case *Matcher_MatcherList_Predicate_AndMatcher: 860 861 if v, ok := interface{}(m.GetAndMatcher()).(interface{ Validate() error }); ok { 862 if err := v.Validate(); err != nil { 863 return Matcher_MatcherList_PredicateValidationError{ 864 field: "AndMatcher", 865 reason: "embedded message failed validation", 866 cause: err, 867 } 868 } 869 } 870 871 case *Matcher_MatcherList_Predicate_NotMatcher: 872 873 if v, ok := interface{}(m.GetNotMatcher()).(interface{ Validate() error }); ok { 874 if err := v.Validate(); err != nil { 875 return Matcher_MatcherList_PredicateValidationError{ 876 field: "NotMatcher", 877 reason: "embedded message failed validation", 878 cause: err, 879 } 880 } 881 } 882 883 default: 884 return Matcher_MatcherList_PredicateValidationError{ 885 field: "MatchType", 886 reason: "value is required", 887 } 888 889 } 890 891 return nil 892 } 893 894 // Matcher_MatcherList_PredicateValidationError is the validation error 895 // returned by Matcher_MatcherList_Predicate.Validate if the designated 896 // constraints aren't met. 897 type Matcher_MatcherList_PredicateValidationError struct { 898 field string 899 reason string 900 cause error 901 key bool 902 } 903 904 // Field function returns field value. 905 func (e Matcher_MatcherList_PredicateValidationError) Field() string { return e.field } 906 907 // Reason function returns reason value. 908 func (e Matcher_MatcherList_PredicateValidationError) Reason() string { return e.reason } 909 910 // Cause function returns cause value. 911 func (e Matcher_MatcherList_PredicateValidationError) Cause() error { return e.cause } 912 913 // Key function returns key value. 914 func (e Matcher_MatcherList_PredicateValidationError) Key() bool { return e.key } 915 916 // ErrorName returns error name. 917 func (e Matcher_MatcherList_PredicateValidationError) ErrorName() string { 918 return "Matcher_MatcherList_PredicateValidationError" 919 } 920 921 // Error satisfies the builtin error interface 922 func (e Matcher_MatcherList_PredicateValidationError) Error() string { 923 cause := "" 924 if e.cause != nil { 925 cause = fmt.Sprintf(" | caused by: %v", e.cause) 926 } 927 928 key := "" 929 if e.key { 930 key = "key for " 931 } 932 933 return fmt.Sprintf( 934 "invalid %sMatcher_MatcherList_Predicate.%s: %s%s", 935 key, 936 e.field, 937 e.reason, 938 cause) 939 } 940 941 var _ error = Matcher_MatcherList_PredicateValidationError{} 942 943 var _ interface { 944 Field() string 945 Reason() string 946 Key() bool 947 Cause() error 948 ErrorName() string 949 } = Matcher_MatcherList_PredicateValidationError{} 950 951 // Validate checks the field values on Matcher_MatcherList_FieldMatcher with 952 // the rules defined in the proto definition for this message. If any rules 953 // are violated, an error is returned. 954 func (m *Matcher_MatcherList_FieldMatcher) Validate() error { 955 if m == nil { 956 return nil 957 } 958 959 if m.GetPredicate() == nil { 960 return Matcher_MatcherList_FieldMatcherValidationError{ 961 field: "Predicate", 962 reason: "value is required", 963 } 964 } 965 966 if v, ok := interface{}(m.GetPredicate()).(interface{ Validate() error }); ok { 967 if err := v.Validate(); err != nil { 968 return Matcher_MatcherList_FieldMatcherValidationError{ 969 field: "Predicate", 970 reason: "embedded message failed validation", 971 cause: err, 972 } 973 } 974 } 975 976 if m.GetOnMatch() == nil { 977 return Matcher_MatcherList_FieldMatcherValidationError{ 978 field: "OnMatch", 979 reason: "value is required", 980 } 981 } 982 983 if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok { 984 if err := v.Validate(); err != nil { 985 return Matcher_MatcherList_FieldMatcherValidationError{ 986 field: "OnMatch", 987 reason: "embedded message failed validation", 988 cause: err, 989 } 990 } 991 } 992 993 return nil 994 } 995 996 // Matcher_MatcherList_FieldMatcherValidationError is the validation error 997 // returned by Matcher_MatcherList_FieldMatcher.Validate if the designated 998 // constraints aren't met. 999 type Matcher_MatcherList_FieldMatcherValidationError struct { 1000 field string 1001 reason string 1002 cause error 1003 key bool 1004 } 1005 1006 // Field function returns field value. 1007 func (e Matcher_MatcherList_FieldMatcherValidationError) Field() string { return e.field } 1008 1009 // Reason function returns reason value. 1010 func (e Matcher_MatcherList_FieldMatcherValidationError) Reason() string { return e.reason } 1011 1012 // Cause function returns cause value. 1013 func (e Matcher_MatcherList_FieldMatcherValidationError) Cause() error { return e.cause } 1014 1015 // Key function returns key value. 1016 func (e Matcher_MatcherList_FieldMatcherValidationError) Key() bool { return e.key } 1017 1018 // ErrorName returns error name. 1019 func (e Matcher_MatcherList_FieldMatcherValidationError) ErrorName() string { 1020 return "Matcher_MatcherList_FieldMatcherValidationError" 1021 } 1022 1023 // Error satisfies the builtin error interface 1024 func (e Matcher_MatcherList_FieldMatcherValidationError) Error() string { 1025 cause := "" 1026 if e.cause != nil { 1027 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1028 } 1029 1030 key := "" 1031 if e.key { 1032 key = "key for " 1033 } 1034 1035 return fmt.Sprintf( 1036 "invalid %sMatcher_MatcherList_FieldMatcher.%s: %s%s", 1037 key, 1038 e.field, 1039 e.reason, 1040 cause) 1041 } 1042 1043 var _ error = Matcher_MatcherList_FieldMatcherValidationError{} 1044 1045 var _ interface { 1046 Field() string 1047 Reason() string 1048 Key() bool 1049 Cause() error 1050 ErrorName() string 1051 } = Matcher_MatcherList_FieldMatcherValidationError{} 1052 1053 // Validate checks the field values on 1054 // Matcher_MatcherList_Predicate_SinglePredicate with the rules defined in the 1055 // proto definition for this message. If any rules are violated, an error is returned. 1056 func (m *Matcher_MatcherList_Predicate_SinglePredicate) Validate() error { 1057 if m == nil { 1058 return nil 1059 } 1060 1061 if m.GetInput() == nil { 1062 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{ 1063 field: "Input", 1064 reason: "value is required", 1065 } 1066 } 1067 1068 if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok { 1069 if err := v.Validate(); err != nil { 1070 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{ 1071 field: "Input", 1072 reason: "embedded message failed validation", 1073 cause: err, 1074 } 1075 } 1076 } 1077 1078 switch m.Matcher.(type) { 1079 1080 case *Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch: 1081 1082 if v, ok := interface{}(m.GetValueMatch()).(interface{ Validate() error }); ok { 1083 if err := v.Validate(); err != nil { 1084 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{ 1085 field: "ValueMatch", 1086 reason: "embedded message failed validation", 1087 cause: err, 1088 } 1089 } 1090 } 1091 1092 case *Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch: 1093 1094 if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok { 1095 if err := v.Validate(); err != nil { 1096 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{ 1097 field: "CustomMatch", 1098 reason: "embedded message failed validation", 1099 cause: err, 1100 } 1101 } 1102 } 1103 1104 default: 1105 return Matcher_MatcherList_Predicate_SinglePredicateValidationError{ 1106 field: "Matcher", 1107 reason: "value is required", 1108 } 1109 1110 } 1111 1112 return nil 1113 } 1114 1115 // Matcher_MatcherList_Predicate_SinglePredicateValidationError is the 1116 // validation error returned by 1117 // Matcher_MatcherList_Predicate_SinglePredicate.Validate if the designated 1118 // constraints aren't met. 1119 type Matcher_MatcherList_Predicate_SinglePredicateValidationError struct { 1120 field string 1121 reason string 1122 cause error 1123 key bool 1124 } 1125 1126 // Field function returns field value. 1127 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Field() string { return e.field } 1128 1129 // Reason function returns reason value. 1130 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Reason() string { 1131 return e.reason 1132 } 1133 1134 // Cause function returns cause value. 1135 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Cause() error { return e.cause } 1136 1137 // Key function returns key value. 1138 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Key() bool { return e.key } 1139 1140 // ErrorName returns error name. 1141 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) ErrorName() string { 1142 return "Matcher_MatcherList_Predicate_SinglePredicateValidationError" 1143 } 1144 1145 // Error satisfies the builtin error interface 1146 func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Error() string { 1147 cause := "" 1148 if e.cause != nil { 1149 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1150 } 1151 1152 key := "" 1153 if e.key { 1154 key = "key for " 1155 } 1156 1157 return fmt.Sprintf( 1158 "invalid %sMatcher_MatcherList_Predicate_SinglePredicate.%s: %s%s", 1159 key, 1160 e.field, 1161 e.reason, 1162 cause) 1163 } 1164 1165 var _ error = Matcher_MatcherList_Predicate_SinglePredicateValidationError{} 1166 1167 var _ interface { 1168 Field() string 1169 Reason() string 1170 Key() bool 1171 Cause() error 1172 ErrorName() string 1173 } = Matcher_MatcherList_Predicate_SinglePredicateValidationError{} 1174 1175 // Validate checks the field values on 1176 // Matcher_MatcherList_Predicate_PredicateList with the rules defined in the 1177 // proto definition for this message. If any rules are violated, an error is returned. 1178 func (m *Matcher_MatcherList_Predicate_PredicateList) Validate() error { 1179 if m == nil { 1180 return nil 1181 } 1182 1183 if len(m.GetPredicate()) < 2 { 1184 return Matcher_MatcherList_Predicate_PredicateListValidationError{ 1185 field: "Predicate", 1186 reason: "value must contain at least 2 item(s)", 1187 } 1188 } 1189 1190 for idx, item := range m.GetPredicate() { 1191 _, _ = idx, item 1192 1193 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 1194 if err := v.Validate(); err != nil { 1195 return Matcher_MatcherList_Predicate_PredicateListValidationError{ 1196 field: fmt.Sprintf("Predicate[%v]", idx), 1197 reason: "embedded message failed validation", 1198 cause: err, 1199 } 1200 } 1201 } 1202 1203 } 1204 1205 return nil 1206 } 1207 1208 // Matcher_MatcherList_Predicate_PredicateListValidationError is the validation 1209 // error returned by Matcher_MatcherList_Predicate_PredicateList.Validate if 1210 // the designated constraints aren't met. 1211 type Matcher_MatcherList_Predicate_PredicateListValidationError struct { 1212 field string 1213 reason string 1214 cause error 1215 key bool 1216 } 1217 1218 // Field function returns field value. 1219 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Field() string { return e.field } 1220 1221 // Reason function returns reason value. 1222 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Reason() string { return e.reason } 1223 1224 // Cause function returns cause value. 1225 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Cause() error { return e.cause } 1226 1227 // Key function returns key value. 1228 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Key() bool { return e.key } 1229 1230 // ErrorName returns error name. 1231 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) ErrorName() string { 1232 return "Matcher_MatcherList_Predicate_PredicateListValidationError" 1233 } 1234 1235 // Error satisfies the builtin error interface 1236 func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Error() string { 1237 cause := "" 1238 if e.cause != nil { 1239 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1240 } 1241 1242 key := "" 1243 if e.key { 1244 key = "key for " 1245 } 1246 1247 return fmt.Sprintf( 1248 "invalid %sMatcher_MatcherList_Predicate_PredicateList.%s: %s%s", 1249 key, 1250 e.field, 1251 e.reason, 1252 cause) 1253 } 1254 1255 var _ error = Matcher_MatcherList_Predicate_PredicateListValidationError{} 1256 1257 var _ interface { 1258 Field() string 1259 Reason() string 1260 Key() bool 1261 Cause() error 1262 ErrorName() string 1263 } = Matcher_MatcherList_Predicate_PredicateListValidationError{} 1264 1265 // Validate checks the field values on Matcher_MatcherTree_MatchMap with the 1266 // rules defined in the proto definition for this message. If any rules are 1267 // violated, an error is returned. 1268 func (m *Matcher_MatcherTree_MatchMap) Validate() error { 1269 if m == nil { 1270 return nil 1271 } 1272 1273 if len(m.GetMap()) < 1 { 1274 return Matcher_MatcherTree_MatchMapValidationError{ 1275 field: "Map", 1276 reason: "value must contain at least 1 pair(s)", 1277 } 1278 } 1279 1280 for key, val := range m.GetMap() { 1281 _ = val 1282 1283 // no validation rules for Map[key] 1284 1285 if v, ok := interface{}(val).(interface{ Validate() error }); ok { 1286 if err := v.Validate(); err != nil { 1287 return Matcher_MatcherTree_MatchMapValidationError{ 1288 field: fmt.Sprintf("Map[%v]", key), 1289 reason: "embedded message failed validation", 1290 cause: err, 1291 } 1292 } 1293 } 1294 1295 } 1296 1297 return nil 1298 } 1299 1300 // Matcher_MatcherTree_MatchMapValidationError is the validation error returned 1301 // by Matcher_MatcherTree_MatchMap.Validate if the designated constraints 1302 // aren't met. 1303 type Matcher_MatcherTree_MatchMapValidationError struct { 1304 field string 1305 reason string 1306 cause error 1307 key bool 1308 } 1309 1310 // Field function returns field value. 1311 func (e Matcher_MatcherTree_MatchMapValidationError) Field() string { return e.field } 1312 1313 // Reason function returns reason value. 1314 func (e Matcher_MatcherTree_MatchMapValidationError) Reason() string { return e.reason } 1315 1316 // Cause function returns cause value. 1317 func (e Matcher_MatcherTree_MatchMapValidationError) Cause() error { return e.cause } 1318 1319 // Key function returns key value. 1320 func (e Matcher_MatcherTree_MatchMapValidationError) Key() bool { return e.key } 1321 1322 // ErrorName returns error name. 1323 func (e Matcher_MatcherTree_MatchMapValidationError) ErrorName() string { 1324 return "Matcher_MatcherTree_MatchMapValidationError" 1325 } 1326 1327 // Error satisfies the builtin error interface 1328 func (e Matcher_MatcherTree_MatchMapValidationError) Error() string { 1329 cause := "" 1330 if e.cause != nil { 1331 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1332 } 1333 1334 key := "" 1335 if e.key { 1336 key = "key for " 1337 } 1338 1339 return fmt.Sprintf( 1340 "invalid %sMatcher_MatcherTree_MatchMap.%s: %s%s", 1341 key, 1342 e.field, 1343 e.reason, 1344 cause) 1345 } 1346 1347 var _ error = Matcher_MatcherTree_MatchMapValidationError{} 1348 1349 var _ interface { 1350 Field() string 1351 Reason() string 1352 Key() bool 1353 Cause() error 1354 ErrorName() string 1355 } = Matcher_MatcherTree_MatchMapValidationError{} 1356 1357 // Validate checks the field values on MatchPredicate_MatchSet with the rules 1358 // defined in the proto definition for this message. If any rules are 1359 // violated, an error is returned. 1360 func (m *MatchPredicate_MatchSet) Validate() error { 1361 if m == nil { 1362 return nil 1363 } 1364 1365 if len(m.GetRules()) < 2 { 1366 return MatchPredicate_MatchSetValidationError{ 1367 field: "Rules", 1368 reason: "value must contain at least 2 item(s)", 1369 } 1370 } 1371 1372 for idx, item := range m.GetRules() { 1373 _, _ = idx, item 1374 1375 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 1376 if err := v.Validate(); err != nil { 1377 return MatchPredicate_MatchSetValidationError{ 1378 field: fmt.Sprintf("Rules[%v]", idx), 1379 reason: "embedded message failed validation", 1380 cause: err, 1381 } 1382 } 1383 } 1384 1385 } 1386 1387 return nil 1388 } 1389 1390 // MatchPredicate_MatchSetValidationError is the validation error returned by 1391 // MatchPredicate_MatchSet.Validate if the designated constraints aren't met. 1392 type MatchPredicate_MatchSetValidationError struct { 1393 field string 1394 reason string 1395 cause error 1396 key bool 1397 } 1398 1399 // Field function returns field value. 1400 func (e MatchPredicate_MatchSetValidationError) Field() string { return e.field } 1401 1402 // Reason function returns reason value. 1403 func (e MatchPredicate_MatchSetValidationError) Reason() string { return e.reason } 1404 1405 // Cause function returns cause value. 1406 func (e MatchPredicate_MatchSetValidationError) Cause() error { return e.cause } 1407 1408 // Key function returns key value. 1409 func (e MatchPredicate_MatchSetValidationError) Key() bool { return e.key } 1410 1411 // ErrorName returns error name. 1412 func (e MatchPredicate_MatchSetValidationError) ErrorName() string { 1413 return "MatchPredicate_MatchSetValidationError" 1414 } 1415 1416 // Error satisfies the builtin error interface 1417 func (e MatchPredicate_MatchSetValidationError) Error() string { 1418 cause := "" 1419 if e.cause != nil { 1420 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1421 } 1422 1423 key := "" 1424 if e.key { 1425 key = "key for " 1426 } 1427 1428 return fmt.Sprintf( 1429 "invalid %sMatchPredicate_MatchSet.%s: %s%s", 1430 key, 1431 e.field, 1432 e.reason, 1433 cause) 1434 } 1435 1436 var _ error = MatchPredicate_MatchSetValidationError{} 1437 1438 var _ interface { 1439 Field() string 1440 Reason() string 1441 Key() bool 1442 Cause() error 1443 ErrorName() string 1444 } = MatchPredicate_MatchSetValidationError{} 1445 1446 // Validate checks the field values on HttpGenericBodyMatch_GenericTextMatch 1447 // with the rules defined in the proto definition for this message. If any 1448 // rules are violated, an error is returned. 1449 func (m *HttpGenericBodyMatch_GenericTextMatch) Validate() error { 1450 if m == nil { 1451 return nil 1452 } 1453 1454 switch m.Rule.(type) { 1455 1456 case *HttpGenericBodyMatch_GenericTextMatch_StringMatch: 1457 1458 if utf8.RuneCountInString(m.GetStringMatch()) < 1 { 1459 return HttpGenericBodyMatch_GenericTextMatchValidationError{ 1460 field: "StringMatch", 1461 reason: "value length must be at least 1 runes", 1462 } 1463 } 1464 1465 case *HttpGenericBodyMatch_GenericTextMatch_BinaryMatch: 1466 1467 if len(m.GetBinaryMatch()) < 1 { 1468 return HttpGenericBodyMatch_GenericTextMatchValidationError{ 1469 field: "BinaryMatch", 1470 reason: "value length must be at least 1 bytes", 1471 } 1472 } 1473 1474 default: 1475 return HttpGenericBodyMatch_GenericTextMatchValidationError{ 1476 field: "Rule", 1477 reason: "value is required", 1478 } 1479 1480 } 1481 1482 return nil 1483 } 1484 1485 // HttpGenericBodyMatch_GenericTextMatchValidationError is the validation error 1486 // returned by HttpGenericBodyMatch_GenericTextMatch.Validate if the 1487 // designated constraints aren't met. 1488 type HttpGenericBodyMatch_GenericTextMatchValidationError struct { 1489 field string 1490 reason string 1491 cause error 1492 key bool 1493 } 1494 1495 // Field function returns field value. 1496 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Field() string { return e.field } 1497 1498 // Reason function returns reason value. 1499 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Reason() string { return e.reason } 1500 1501 // Cause function returns cause value. 1502 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Cause() error { return e.cause } 1503 1504 // Key function returns key value. 1505 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Key() bool { return e.key } 1506 1507 // ErrorName returns error name. 1508 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) ErrorName() string { 1509 return "HttpGenericBodyMatch_GenericTextMatchValidationError" 1510 } 1511 1512 // Error satisfies the builtin error interface 1513 func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Error() string { 1514 cause := "" 1515 if e.cause != nil { 1516 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1517 } 1518 1519 key := "" 1520 if e.key { 1521 key = "key for " 1522 } 1523 1524 return fmt.Sprintf( 1525 "invalid %sHttpGenericBodyMatch_GenericTextMatch.%s: %s%s", 1526 key, 1527 e.field, 1528 e.reason, 1529 cause) 1530 } 1531 1532 var _ error = HttpGenericBodyMatch_GenericTextMatchValidationError{} 1533 1534 var _ interface { 1535 Field() string 1536 Reason() string 1537 Key() bool 1538 Cause() error 1539 ErrorName() string 1540 } = HttpGenericBodyMatch_GenericTextMatchValidationError{}