1// Code generated by protoc-gen-validate. DO NOT EDIT. 2// source: envoy/api/v2/core/base.proto 3 4package envoy_api_v2_core 5 6import ( 7 "bytes" 8 "errors" 9 "fmt" 10 "net" 11 "net/mail" 12 "net/url" 13 "regexp" 14 "sort" 15 "strings" 16 "time" 17 "unicode/utf8" 18 19 "google.golang.org/protobuf/types/known/anypb" 20) 21 22// ensure the imports are used 23var ( 24 _ = bytes.MinRead 25 _ = errors.New("") 26 _ = fmt.Print 27 _ = utf8.UTFMax 28 _ = (*regexp.Regexp)(nil) 29 _ = (*strings.Reader)(nil) 30 _ = net.IPv4len 31 _ = time.Duration(0) 32 _ = (*url.URL)(nil) 33 _ = (*mail.Address)(nil) 34 _ = anypb.Any{} 35 _ = sort.Sort 36) 37 38// Validate checks the field values on Locality with the rules defined in the 39// proto definition for this message. If any rules are violated, the first 40// error encountered is returned, or nil if there are no violations. 41func (m *Locality) Validate() error { 42 return m.validate(false) 43} 44 45// ValidateAll checks the field values on Locality with the rules defined in 46// the proto definition for this message. If any rules are violated, the 47// result is a list of violation errors wrapped in LocalityMultiError, or nil 48// if none found. 49func (m *Locality) ValidateAll() error { 50 return m.validate(true) 51} 52 53func (m *Locality) validate(all bool) error { 54 if m == nil { 55 return nil 56 } 57 58 var errors []error 59 60 // no validation rules for Region 61 62 // no validation rules for Zone 63 64 // no validation rules for SubZone 65 66 if len(errors) > 0 { 67 return LocalityMultiError(errors) 68 } 69 return nil 70} 71 72// LocalityMultiError is an error wrapping multiple validation errors returned 73// by Locality.ValidateAll() if the designated constraints aren't met. 74type LocalityMultiError []error 75 76// Error returns a concatenation of all the error messages it wraps. 77func (m LocalityMultiError) Error() string { 78 var msgs []string 79 for _, err := range m { 80 msgs = append(msgs, err.Error()) 81 } 82 return strings.Join(msgs, "; ") 83} 84 85// AllErrors returns a list of validation violation errors. 86func (m LocalityMultiError) AllErrors() []error { return m } 87 88// LocalityValidationError is the validation error returned by 89// Locality.Validate if the designated constraints aren't met. 90type LocalityValidationError struct { 91 field string 92 reason string 93 cause error 94 key bool 95} 96 97// Field function returns field value. 98func (e LocalityValidationError) Field() string { return e.field } 99 100// Reason function returns reason value. 101func (e LocalityValidationError) Reason() string { return e.reason } 102 103// Cause function returns cause value. 104func (e LocalityValidationError) Cause() error { return e.cause } 105 106// Key function returns key value. 107func (e LocalityValidationError) Key() bool { return e.key } 108 109// ErrorName returns error name. 110func (e LocalityValidationError) ErrorName() string { return "LocalityValidationError" } 111 112// Error satisfies the builtin error interface 113func (e LocalityValidationError) Error() string { 114 cause := "" 115 if e.cause != nil { 116 cause = fmt.Sprintf(" | caused by: %v", e.cause) 117 } 118 119 key := "" 120 if e.key { 121 key = "key for " 122 } 123 124 return fmt.Sprintf( 125 "invalid %sLocality.%s: %s%s", 126 key, 127 e.field, 128 e.reason, 129 cause) 130} 131 132var _ error = LocalityValidationError{} 133 134var _ interface { 135 Field() string 136 Reason() string 137 Key() bool 138 Cause() error 139 ErrorName() string 140} = LocalityValidationError{} 141 142// Validate checks the field values on BuildVersion with the rules defined in 143// the proto definition for this message. If any rules are violated, the first 144// error encountered is returned, or nil if there are no violations. 145func (m *BuildVersion) Validate() error { 146 return m.validate(false) 147} 148 149// ValidateAll checks the field values on BuildVersion with the rules defined 150// in the proto definition for this message. If any rules are violated, the 151// result is a list of violation errors wrapped in BuildVersionMultiError, or 152// nil if none found. 153func (m *BuildVersion) ValidateAll() error { 154 return m.validate(true) 155} 156 157func (m *BuildVersion) validate(all bool) error { 158 if m == nil { 159 return nil 160 } 161 162 var errors []error 163 164 if all { 165 switch v := interface{}(m.GetVersion()).(type) { 166 case interface{ ValidateAll() error }: 167 if err := v.ValidateAll(); err != nil { 168 errors = append(errors, BuildVersionValidationError{ 169 field: "Version", 170 reason: "embedded message failed validation", 171 cause: err, 172 }) 173 } 174 case interface{ Validate() error }: 175 if err := v.Validate(); err != nil { 176 errors = append(errors, BuildVersionValidationError{ 177 field: "Version", 178 reason: "embedded message failed validation", 179 cause: err, 180 }) 181 } 182 } 183 } else if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok { 184 if err := v.Validate(); err != nil { 185 return BuildVersionValidationError{ 186 field: "Version", 187 reason: "embedded message failed validation", 188 cause: err, 189 } 190 } 191 } 192 193 if all { 194 switch v := interface{}(m.GetMetadata()).(type) { 195 case interface{ ValidateAll() error }: 196 if err := v.ValidateAll(); err != nil { 197 errors = append(errors, BuildVersionValidationError{ 198 field: "Metadata", 199 reason: "embedded message failed validation", 200 cause: err, 201 }) 202 } 203 case interface{ Validate() error }: 204 if err := v.Validate(); err != nil { 205 errors = append(errors, BuildVersionValidationError{ 206 field: "Metadata", 207 reason: "embedded message failed validation", 208 cause: err, 209 }) 210 } 211 } 212 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { 213 if err := v.Validate(); err != nil { 214 return BuildVersionValidationError{ 215 field: "Metadata", 216 reason: "embedded message failed validation", 217 cause: err, 218 } 219 } 220 } 221 222 if len(errors) > 0 { 223 return BuildVersionMultiError(errors) 224 } 225 return nil 226} 227 228// BuildVersionMultiError is an error wrapping multiple validation errors 229// returned by BuildVersion.ValidateAll() if the designated constraints aren't met. 230type BuildVersionMultiError []error 231 232// Error returns a concatenation of all the error messages it wraps. 233func (m BuildVersionMultiError) Error() string { 234 var msgs []string 235 for _, err := range m { 236 msgs = append(msgs, err.Error()) 237 } 238 return strings.Join(msgs, "; ") 239} 240 241// AllErrors returns a list of validation violation errors. 242func (m BuildVersionMultiError) AllErrors() []error { return m } 243 244// BuildVersionValidationError is the validation error returned by 245// BuildVersion.Validate if the designated constraints aren't met. 246type BuildVersionValidationError struct { 247 field string 248 reason string 249 cause error 250 key bool 251} 252 253// Field function returns field value. 254func (e BuildVersionValidationError) Field() string { return e.field } 255 256// Reason function returns reason value. 257func (e BuildVersionValidationError) Reason() string { return e.reason } 258 259// Cause function returns cause value. 260func (e BuildVersionValidationError) Cause() error { return e.cause } 261 262// Key function returns key value. 263func (e BuildVersionValidationError) Key() bool { return e.key } 264 265// ErrorName returns error name. 266func (e BuildVersionValidationError) ErrorName() string { return "BuildVersionValidationError" } 267 268// Error satisfies the builtin error interface 269func (e BuildVersionValidationError) Error() string { 270 cause := "" 271 if e.cause != nil { 272 cause = fmt.Sprintf(" | caused by: %v", e.cause) 273 } 274 275 key := "" 276 if e.key { 277 key = "key for " 278 } 279 280 return fmt.Sprintf( 281 "invalid %sBuildVersion.%s: %s%s", 282 key, 283 e.field, 284 e.reason, 285 cause) 286} 287 288var _ error = BuildVersionValidationError{} 289 290var _ interface { 291 Field() string 292 Reason() string 293 Key() bool 294 Cause() error 295 ErrorName() string 296} = BuildVersionValidationError{} 297 298// Validate checks the field values on Extension with the rules defined in the 299// proto definition for this message. If any rules are violated, the first 300// error encountered is returned, or nil if there are no violations. 301func (m *Extension) Validate() error { 302 return m.validate(false) 303} 304 305// ValidateAll checks the field values on Extension with the rules defined in 306// the proto definition for this message. If any rules are violated, the 307// result is a list of violation errors wrapped in ExtensionMultiError, or nil 308// if none found. 309func (m *Extension) ValidateAll() error { 310 return m.validate(true) 311} 312 313func (m *Extension) validate(all bool) error { 314 if m == nil { 315 return nil 316 } 317 318 var errors []error 319 320 // no validation rules for Name 321 322 // no validation rules for Category 323 324 // no validation rules for TypeDescriptor 325 326 if all { 327 switch v := interface{}(m.GetVersion()).(type) { 328 case interface{ ValidateAll() error }: 329 if err := v.ValidateAll(); err != nil { 330 errors = append(errors, ExtensionValidationError{ 331 field: "Version", 332 reason: "embedded message failed validation", 333 cause: err, 334 }) 335 } 336 case interface{ Validate() error }: 337 if err := v.Validate(); err != nil { 338 errors = append(errors, ExtensionValidationError{ 339 field: "Version", 340 reason: "embedded message failed validation", 341 cause: err, 342 }) 343 } 344 } 345 } else if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok { 346 if err := v.Validate(); err != nil { 347 return ExtensionValidationError{ 348 field: "Version", 349 reason: "embedded message failed validation", 350 cause: err, 351 } 352 } 353 } 354 355 // no validation rules for Disabled 356 357 if len(errors) > 0 { 358 return ExtensionMultiError(errors) 359 } 360 return nil 361} 362 363// ExtensionMultiError is an error wrapping multiple validation errors returned 364// by Extension.ValidateAll() if the designated constraints aren't met. 365type ExtensionMultiError []error 366 367// Error returns a concatenation of all the error messages it wraps. 368func (m ExtensionMultiError) Error() string { 369 var msgs []string 370 for _, err := range m { 371 msgs = append(msgs, err.Error()) 372 } 373 return strings.Join(msgs, "; ") 374} 375 376// AllErrors returns a list of validation violation errors. 377func (m ExtensionMultiError) AllErrors() []error { return m } 378 379// ExtensionValidationError is the validation error returned by 380// Extension.Validate if the designated constraints aren't met. 381type ExtensionValidationError struct { 382 field string 383 reason string 384 cause error 385 key bool 386} 387 388// Field function returns field value. 389func (e ExtensionValidationError) Field() string { return e.field } 390 391// Reason function returns reason value. 392func (e ExtensionValidationError) Reason() string { return e.reason } 393 394// Cause function returns cause value. 395func (e ExtensionValidationError) Cause() error { return e.cause } 396 397// Key function returns key value. 398func (e ExtensionValidationError) Key() bool { return e.key } 399 400// ErrorName returns error name. 401func (e ExtensionValidationError) ErrorName() string { return "ExtensionValidationError" } 402 403// Error satisfies the builtin error interface 404func (e ExtensionValidationError) Error() string { 405 cause := "" 406 if e.cause != nil { 407 cause = fmt.Sprintf(" | caused by: %v", e.cause) 408 } 409 410 key := "" 411 if e.key { 412 key = "key for " 413 } 414 415 return fmt.Sprintf( 416 "invalid %sExtension.%s: %s%s", 417 key, 418 e.field, 419 e.reason, 420 cause) 421} 422 423var _ error = ExtensionValidationError{} 424 425var _ interface { 426 Field() string 427 Reason() string 428 Key() bool 429 Cause() error 430 ErrorName() string 431} = ExtensionValidationError{} 432 433// Validate checks the field values on Node with the rules defined in the proto 434// definition for this message. If any rules are violated, the first error 435// encountered is returned, or nil if there are no violations. 436func (m *Node) Validate() error { 437 return m.validate(false) 438} 439 440// ValidateAll checks the field values on Node with the rules defined in the 441// proto definition for this message. If any rules are violated, the result is 442// a list of violation errors wrapped in NodeMultiError, or nil if none found. 443func (m *Node) ValidateAll() error { 444 return m.validate(true) 445} 446 447func (m *Node) validate(all bool) error { 448 if m == nil { 449 return nil 450 } 451 452 var errors []error 453 454 // no validation rules for Id 455 456 // no validation rules for Cluster 457 458 if all { 459 switch v := interface{}(m.GetMetadata()).(type) { 460 case interface{ ValidateAll() error }: 461 if err := v.ValidateAll(); err != nil { 462 errors = append(errors, NodeValidationError{ 463 field: "Metadata", 464 reason: "embedded message failed validation", 465 cause: err, 466 }) 467 } 468 case interface{ Validate() error }: 469 if err := v.Validate(); err != nil { 470 errors = append(errors, NodeValidationError{ 471 field: "Metadata", 472 reason: "embedded message failed validation", 473 cause: err, 474 }) 475 } 476 } 477 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { 478 if err := v.Validate(); err != nil { 479 return NodeValidationError{ 480 field: "Metadata", 481 reason: "embedded message failed validation", 482 cause: err, 483 } 484 } 485 } 486 487 if all { 488 switch v := interface{}(m.GetLocality()).(type) { 489 case interface{ ValidateAll() error }: 490 if err := v.ValidateAll(); err != nil { 491 errors = append(errors, NodeValidationError{ 492 field: "Locality", 493 reason: "embedded message failed validation", 494 cause: err, 495 }) 496 } 497 case interface{ Validate() error }: 498 if err := v.Validate(); err != nil { 499 errors = append(errors, NodeValidationError{ 500 field: "Locality", 501 reason: "embedded message failed validation", 502 cause: err, 503 }) 504 } 505 } 506 } else if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { 507 if err := v.Validate(); err != nil { 508 return NodeValidationError{ 509 field: "Locality", 510 reason: "embedded message failed validation", 511 cause: err, 512 } 513 } 514 } 515 516 // no validation rules for BuildVersion 517 518 // no validation rules for UserAgentName 519 520 for idx, item := range m.GetExtensions() { 521 _, _ = idx, item 522 523 if all { 524 switch v := interface{}(item).(type) { 525 case interface{ ValidateAll() error }: 526 if err := v.ValidateAll(); err != nil { 527 errors = append(errors, NodeValidationError{ 528 field: fmt.Sprintf("Extensions[%v]", idx), 529 reason: "embedded message failed validation", 530 cause: err, 531 }) 532 } 533 case interface{ Validate() error }: 534 if err := v.Validate(); err != nil { 535 errors = append(errors, NodeValidationError{ 536 field: fmt.Sprintf("Extensions[%v]", idx), 537 reason: "embedded message failed validation", 538 cause: err, 539 }) 540 } 541 } 542 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 543 if err := v.Validate(); err != nil { 544 return NodeValidationError{ 545 field: fmt.Sprintf("Extensions[%v]", idx), 546 reason: "embedded message failed validation", 547 cause: err, 548 } 549 } 550 } 551 552 } 553 554 for idx, item := range m.GetListeningAddresses() { 555 _, _ = idx, item 556 557 if all { 558 switch v := interface{}(item).(type) { 559 case interface{ ValidateAll() error }: 560 if err := v.ValidateAll(); err != nil { 561 errors = append(errors, NodeValidationError{ 562 field: fmt.Sprintf("ListeningAddresses[%v]", idx), 563 reason: "embedded message failed validation", 564 cause: err, 565 }) 566 } 567 case interface{ Validate() error }: 568 if err := v.Validate(); err != nil { 569 errors = append(errors, NodeValidationError{ 570 field: fmt.Sprintf("ListeningAddresses[%v]", idx), 571 reason: "embedded message failed validation", 572 cause: err, 573 }) 574 } 575 } 576 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 577 if err := v.Validate(); err != nil { 578 return NodeValidationError{ 579 field: fmt.Sprintf("ListeningAddresses[%v]", idx), 580 reason: "embedded message failed validation", 581 cause: err, 582 } 583 } 584 } 585 586 } 587 588 switch m.UserAgentVersionType.(type) { 589 590 case *Node_UserAgentVersion: 591 // no validation rules for UserAgentVersion 592 593 case *Node_UserAgentBuildVersion: 594 595 if all { 596 switch v := interface{}(m.GetUserAgentBuildVersion()).(type) { 597 case interface{ ValidateAll() error }: 598 if err := v.ValidateAll(); err != nil { 599 errors = append(errors, NodeValidationError{ 600 field: "UserAgentBuildVersion", 601 reason: "embedded message failed validation", 602 cause: err, 603 }) 604 } 605 case interface{ Validate() error }: 606 if err := v.Validate(); err != nil { 607 errors = append(errors, NodeValidationError{ 608 field: "UserAgentBuildVersion", 609 reason: "embedded message failed validation", 610 cause: err, 611 }) 612 } 613 } 614 } else if v, ok := interface{}(m.GetUserAgentBuildVersion()).(interface{ Validate() error }); ok { 615 if err := v.Validate(); err != nil { 616 return NodeValidationError{ 617 field: "UserAgentBuildVersion", 618 reason: "embedded message failed validation", 619 cause: err, 620 } 621 } 622 } 623 624 } 625 626 if len(errors) > 0 { 627 return NodeMultiError(errors) 628 } 629 return nil 630} 631 632// NodeMultiError is an error wrapping multiple validation errors returned by 633// Node.ValidateAll() if the designated constraints aren't met. 634type NodeMultiError []error 635 636// Error returns a concatenation of all the error messages it wraps. 637func (m NodeMultiError) Error() string { 638 var msgs []string 639 for _, err := range m { 640 msgs = append(msgs, err.Error()) 641 } 642 return strings.Join(msgs, "; ") 643} 644 645// AllErrors returns a list of validation violation errors. 646func (m NodeMultiError) AllErrors() []error { return m } 647 648// NodeValidationError is the validation error returned by Node.Validate if the 649// designated constraints aren't met. 650type NodeValidationError struct { 651 field string 652 reason string 653 cause error 654 key bool 655} 656 657// Field function returns field value. 658func (e NodeValidationError) Field() string { return e.field } 659 660// Reason function returns reason value. 661func (e NodeValidationError) Reason() string { return e.reason } 662 663// Cause function returns cause value. 664func (e NodeValidationError) Cause() error { return e.cause } 665 666// Key function returns key value. 667func (e NodeValidationError) Key() bool { return e.key } 668 669// ErrorName returns error name. 670func (e NodeValidationError) ErrorName() string { return "NodeValidationError" } 671 672// Error satisfies the builtin error interface 673func (e NodeValidationError) Error() string { 674 cause := "" 675 if e.cause != nil { 676 cause = fmt.Sprintf(" | caused by: %v", e.cause) 677 } 678 679 key := "" 680 if e.key { 681 key = "key for " 682 } 683 684 return fmt.Sprintf( 685 "invalid %sNode.%s: %s%s", 686 key, 687 e.field, 688 e.reason, 689 cause) 690} 691 692var _ error = NodeValidationError{} 693 694var _ interface { 695 Field() string 696 Reason() string 697 Key() bool 698 Cause() error 699 ErrorName() string 700} = NodeValidationError{} 701 702// Validate checks the field values on Metadata with the rules defined in the 703// proto definition for this message. If any rules are violated, the first 704// error encountered is returned, or nil if there are no violations. 705func (m *Metadata) Validate() error { 706 return m.validate(false) 707} 708 709// ValidateAll checks the field values on Metadata with the rules defined in 710// the proto definition for this message. If any rules are violated, the 711// result is a list of violation errors wrapped in MetadataMultiError, or nil 712// if none found. 713func (m *Metadata) ValidateAll() error { 714 return m.validate(true) 715} 716 717func (m *Metadata) validate(all bool) error { 718 if m == nil { 719 return nil 720 } 721 722 var errors []error 723 724 { 725 sorted_keys := make([]string, len(m.GetFilterMetadata())) 726 i := 0 727 for key := range m.GetFilterMetadata() { 728 sorted_keys[i] = key 729 i++ 730 } 731 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) 732 for _, key := range sorted_keys { 733 val := m.GetFilterMetadata()[key] 734 _ = val 735 736 // no validation rules for FilterMetadata[key] 737 738 if all { 739 switch v := interface{}(val).(type) { 740 case interface{ ValidateAll() error }: 741 if err := v.ValidateAll(); err != nil { 742 errors = append(errors, MetadataValidationError{ 743 field: fmt.Sprintf("FilterMetadata[%v]", key), 744 reason: "embedded message failed validation", 745 cause: err, 746 }) 747 } 748 case interface{ Validate() error }: 749 if err := v.Validate(); err != nil { 750 errors = append(errors, MetadataValidationError{ 751 field: fmt.Sprintf("FilterMetadata[%v]", key), 752 reason: "embedded message failed validation", 753 cause: err, 754 }) 755 } 756 } 757 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { 758 if err := v.Validate(); err != nil { 759 return MetadataValidationError{ 760 field: fmt.Sprintf("FilterMetadata[%v]", key), 761 reason: "embedded message failed validation", 762 cause: err, 763 } 764 } 765 } 766 767 } 768 } 769 770 if len(errors) > 0 { 771 return MetadataMultiError(errors) 772 } 773 return nil 774} 775 776// MetadataMultiError is an error wrapping multiple validation errors returned 777// by Metadata.ValidateAll() if the designated constraints aren't met. 778type MetadataMultiError []error 779 780// Error returns a concatenation of all the error messages it wraps. 781func (m MetadataMultiError) Error() string { 782 var msgs []string 783 for _, err := range m { 784 msgs = append(msgs, err.Error()) 785 } 786 return strings.Join(msgs, "; ") 787} 788 789// AllErrors returns a list of validation violation errors. 790func (m MetadataMultiError) AllErrors() []error { return m } 791 792// MetadataValidationError is the validation error returned by 793// Metadata.Validate if the designated constraints aren't met. 794type MetadataValidationError struct { 795 field string 796 reason string 797 cause error 798 key bool 799} 800 801// Field function returns field value. 802func (e MetadataValidationError) Field() string { return e.field } 803 804// Reason function returns reason value. 805func (e MetadataValidationError) Reason() string { return e.reason } 806 807// Cause function returns cause value. 808func (e MetadataValidationError) Cause() error { return e.cause } 809 810// Key function returns key value. 811func (e MetadataValidationError) Key() bool { return e.key } 812 813// ErrorName returns error name. 814func (e MetadataValidationError) ErrorName() string { return "MetadataValidationError" } 815 816// Error satisfies the builtin error interface 817func (e MetadataValidationError) Error() string { 818 cause := "" 819 if e.cause != nil { 820 cause = fmt.Sprintf(" | caused by: %v", e.cause) 821 } 822 823 key := "" 824 if e.key { 825 key = "key for " 826 } 827 828 return fmt.Sprintf( 829 "invalid %sMetadata.%s: %s%s", 830 key, 831 e.field, 832 e.reason, 833 cause) 834} 835 836var _ error = MetadataValidationError{} 837 838var _ interface { 839 Field() string 840 Reason() string 841 Key() bool 842 Cause() error 843 ErrorName() string 844} = MetadataValidationError{} 845 846// Validate checks the field values on RuntimeUInt32 with the rules defined in 847// the proto definition for this message. If any rules are violated, the first 848// error encountered is returned, or nil if there are no violations. 849func (m *RuntimeUInt32) Validate() error { 850 return m.validate(false) 851} 852 853// ValidateAll checks the field values on RuntimeUInt32 with the rules defined 854// in the proto definition for this message. If any rules are violated, the 855// result is a list of violation errors wrapped in RuntimeUInt32MultiError, or 856// nil if none found. 857func (m *RuntimeUInt32) ValidateAll() error { 858 return m.validate(true) 859} 860 861func (m *RuntimeUInt32) validate(all bool) error { 862 if m == nil { 863 return nil 864 } 865 866 var errors []error 867 868 // no validation rules for DefaultValue 869 870 if len(m.GetRuntimeKey()) < 1 { 871 err := RuntimeUInt32ValidationError{ 872 field: "RuntimeKey", 873 reason: "value length must be at least 1 bytes", 874 } 875 if !all { 876 return err 877 } 878 errors = append(errors, err) 879 } 880 881 if len(errors) > 0 { 882 return RuntimeUInt32MultiError(errors) 883 } 884 return nil 885} 886 887// RuntimeUInt32MultiError is an error wrapping multiple validation errors 888// returned by RuntimeUInt32.ValidateAll() if the designated constraints 889// aren't met. 890type RuntimeUInt32MultiError []error 891 892// Error returns a concatenation of all the error messages it wraps. 893func (m RuntimeUInt32MultiError) Error() string { 894 var msgs []string 895 for _, err := range m { 896 msgs = append(msgs, err.Error()) 897 } 898 return strings.Join(msgs, "; ") 899} 900 901// AllErrors returns a list of validation violation errors. 902func (m RuntimeUInt32MultiError) AllErrors() []error { return m } 903 904// RuntimeUInt32ValidationError is the validation error returned by 905// RuntimeUInt32.Validate if the designated constraints aren't met. 906type RuntimeUInt32ValidationError struct { 907 field string 908 reason string 909 cause error 910 key bool 911} 912 913// Field function returns field value. 914func (e RuntimeUInt32ValidationError) Field() string { return e.field } 915 916// Reason function returns reason value. 917func (e RuntimeUInt32ValidationError) Reason() string { return e.reason } 918 919// Cause function returns cause value. 920func (e RuntimeUInt32ValidationError) Cause() error { return e.cause } 921 922// Key function returns key value. 923func (e RuntimeUInt32ValidationError) Key() bool { return e.key } 924 925// ErrorName returns error name. 926func (e RuntimeUInt32ValidationError) ErrorName() string { return "RuntimeUInt32ValidationError" } 927 928// Error satisfies the builtin error interface 929func (e RuntimeUInt32ValidationError) Error() string { 930 cause := "" 931 if e.cause != nil { 932 cause = fmt.Sprintf(" | caused by: %v", e.cause) 933 } 934 935 key := "" 936 if e.key { 937 key = "key for " 938 } 939 940 return fmt.Sprintf( 941 "invalid %sRuntimeUInt32.%s: %s%s", 942 key, 943 e.field, 944 e.reason, 945 cause) 946} 947 948var _ error = RuntimeUInt32ValidationError{} 949 950var _ interface { 951 Field() string 952 Reason() string 953 Key() bool 954 Cause() error 955 ErrorName() string 956} = RuntimeUInt32ValidationError{} 957 958// Validate checks the field values on RuntimeDouble with the rules defined in 959// the proto definition for this message. If any rules are violated, the first 960// error encountered is returned, or nil if there are no violations. 961func (m *RuntimeDouble) Validate() error { 962 return m.validate(false) 963} 964 965// ValidateAll checks the field values on RuntimeDouble with the rules defined 966// in the proto definition for this message. If any rules are violated, the 967// result is a list of violation errors wrapped in RuntimeDoubleMultiError, or 968// nil if none found. 969func (m *RuntimeDouble) ValidateAll() error { 970 return m.validate(true) 971} 972 973func (m *RuntimeDouble) validate(all bool) error { 974 if m == nil { 975 return nil 976 } 977 978 var errors []error 979 980 // no validation rules for DefaultValue 981 982 if len(m.GetRuntimeKey()) < 1 { 983 err := RuntimeDoubleValidationError{ 984 field: "RuntimeKey", 985 reason: "value length must be at least 1 bytes", 986 } 987 if !all { 988 return err 989 } 990 errors = append(errors, err) 991 } 992 993 if len(errors) > 0 { 994 return RuntimeDoubleMultiError(errors) 995 } 996 return nil 997} 998 999// RuntimeDoubleMultiError is an error wrapping multiple validation errors 1000// returned by RuntimeDouble.ValidateAll() if the designated constraints 1001// aren't met. 1002type RuntimeDoubleMultiError []error 1003 1004// Error returns a concatenation of all the error messages it wraps. 1005func (m RuntimeDoubleMultiError) Error() string { 1006 var msgs []string 1007 for _, err := range m { 1008 msgs = append(msgs, err.Error()) 1009 } 1010 return strings.Join(msgs, "; ") 1011} 1012 1013// AllErrors returns a list of validation violation errors. 1014func (m RuntimeDoubleMultiError) AllErrors() []error { return m } 1015 1016// RuntimeDoubleValidationError is the validation error returned by 1017// RuntimeDouble.Validate if the designated constraints aren't met. 1018type RuntimeDoubleValidationError struct { 1019 field string 1020 reason string 1021 cause error 1022 key bool 1023} 1024 1025// Field function returns field value. 1026func (e RuntimeDoubleValidationError) Field() string { return e.field } 1027 1028// Reason function returns reason value. 1029func (e RuntimeDoubleValidationError) Reason() string { return e.reason } 1030 1031// Cause function returns cause value. 1032func (e RuntimeDoubleValidationError) Cause() error { return e.cause } 1033 1034// Key function returns key value. 1035func (e RuntimeDoubleValidationError) Key() bool { return e.key } 1036 1037// ErrorName returns error name. 1038func (e RuntimeDoubleValidationError) ErrorName() string { return "RuntimeDoubleValidationError" } 1039 1040// Error satisfies the builtin error interface 1041func (e RuntimeDoubleValidationError) Error() string { 1042 cause := "" 1043 if e.cause != nil { 1044 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1045 } 1046 1047 key := "" 1048 if e.key { 1049 key = "key for " 1050 } 1051 1052 return fmt.Sprintf( 1053 "invalid %sRuntimeDouble.%s: %s%s", 1054 key, 1055 e.field, 1056 e.reason, 1057 cause) 1058} 1059 1060var _ error = RuntimeDoubleValidationError{} 1061 1062var _ interface { 1063 Field() string 1064 Reason() string 1065 Key() bool 1066 Cause() error 1067 ErrorName() string 1068} = RuntimeDoubleValidationError{} 1069 1070// Validate checks the field values on RuntimeFeatureFlag with the rules 1071// defined in the proto definition for this message. If any rules are 1072// violated, the first error encountered is returned, or nil if there are no violations. 1073func (m *RuntimeFeatureFlag) Validate() error { 1074 return m.validate(false) 1075} 1076 1077// ValidateAll checks the field values on RuntimeFeatureFlag with the rules 1078// defined in the proto definition for this message. If any rules are 1079// violated, the result is a list of violation errors wrapped in 1080// RuntimeFeatureFlagMultiError, or nil if none found. 1081func (m *RuntimeFeatureFlag) ValidateAll() error { 1082 return m.validate(true) 1083} 1084 1085func (m *RuntimeFeatureFlag) validate(all bool) error { 1086 if m == nil { 1087 return nil 1088 } 1089 1090 var errors []error 1091 1092 if m.GetDefaultValue() == nil { 1093 err := RuntimeFeatureFlagValidationError{ 1094 field: "DefaultValue", 1095 reason: "value is required", 1096 } 1097 if !all { 1098 return err 1099 } 1100 errors = append(errors, err) 1101 } 1102 1103 if all { 1104 switch v := interface{}(m.GetDefaultValue()).(type) { 1105 case interface{ ValidateAll() error }: 1106 if err := v.ValidateAll(); err != nil { 1107 errors = append(errors, RuntimeFeatureFlagValidationError{ 1108 field: "DefaultValue", 1109 reason: "embedded message failed validation", 1110 cause: err, 1111 }) 1112 } 1113 case interface{ Validate() error }: 1114 if err := v.Validate(); err != nil { 1115 errors = append(errors, RuntimeFeatureFlagValidationError{ 1116 field: "DefaultValue", 1117 reason: "embedded message failed validation", 1118 cause: err, 1119 }) 1120 } 1121 } 1122 } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok { 1123 if err := v.Validate(); err != nil { 1124 return RuntimeFeatureFlagValidationError{ 1125 field: "DefaultValue", 1126 reason: "embedded message failed validation", 1127 cause: err, 1128 } 1129 } 1130 } 1131 1132 if len(m.GetRuntimeKey()) < 1 { 1133 err := RuntimeFeatureFlagValidationError{ 1134 field: "RuntimeKey", 1135 reason: "value length must be at least 1 bytes", 1136 } 1137 if !all { 1138 return err 1139 } 1140 errors = append(errors, err) 1141 } 1142 1143 if len(errors) > 0 { 1144 return RuntimeFeatureFlagMultiError(errors) 1145 } 1146 return nil 1147} 1148 1149// RuntimeFeatureFlagMultiError is an error wrapping multiple validation errors 1150// returned by RuntimeFeatureFlag.ValidateAll() if the designated constraints 1151// aren't met. 1152type RuntimeFeatureFlagMultiError []error 1153 1154// Error returns a concatenation of all the error messages it wraps. 1155func (m RuntimeFeatureFlagMultiError) Error() string { 1156 var msgs []string 1157 for _, err := range m { 1158 msgs = append(msgs, err.Error()) 1159 } 1160 return strings.Join(msgs, "; ") 1161} 1162 1163// AllErrors returns a list of validation violation errors. 1164func (m RuntimeFeatureFlagMultiError) AllErrors() []error { return m } 1165 1166// RuntimeFeatureFlagValidationError is the validation error returned by 1167// RuntimeFeatureFlag.Validate if the designated constraints aren't met. 1168type RuntimeFeatureFlagValidationError struct { 1169 field string 1170 reason string 1171 cause error 1172 key bool 1173} 1174 1175// Field function returns field value. 1176func (e RuntimeFeatureFlagValidationError) Field() string { return e.field } 1177 1178// Reason function returns reason value. 1179func (e RuntimeFeatureFlagValidationError) Reason() string { return e.reason } 1180 1181// Cause function returns cause value. 1182func (e RuntimeFeatureFlagValidationError) Cause() error { return e.cause } 1183 1184// Key function returns key value. 1185func (e RuntimeFeatureFlagValidationError) Key() bool { return e.key } 1186 1187// ErrorName returns error name. 1188func (e RuntimeFeatureFlagValidationError) ErrorName() string { 1189 return "RuntimeFeatureFlagValidationError" 1190} 1191 1192// Error satisfies the builtin error interface 1193func (e RuntimeFeatureFlagValidationError) Error() string { 1194 cause := "" 1195 if e.cause != nil { 1196 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1197 } 1198 1199 key := "" 1200 if e.key { 1201 key = "key for " 1202 } 1203 1204 return fmt.Sprintf( 1205 "invalid %sRuntimeFeatureFlag.%s: %s%s", 1206 key, 1207 e.field, 1208 e.reason, 1209 cause) 1210} 1211 1212var _ error = RuntimeFeatureFlagValidationError{} 1213 1214var _ interface { 1215 Field() string 1216 Reason() string 1217 Key() bool 1218 Cause() error 1219 ErrorName() string 1220} = RuntimeFeatureFlagValidationError{} 1221 1222// Validate checks the field values on HeaderValue with the rules defined in 1223// the proto definition for this message. If any rules are violated, the first 1224// error encountered is returned, or nil if there are no violations. 1225func (m *HeaderValue) Validate() error { 1226 return m.validate(false) 1227} 1228 1229// ValidateAll checks the field values on HeaderValue with the rules defined in 1230// the proto definition for this message. If any rules are violated, the 1231// result is a list of violation errors wrapped in HeaderValueMultiError, or 1232// nil if none found. 1233func (m *HeaderValue) ValidateAll() error { 1234 return m.validate(true) 1235} 1236 1237func (m *HeaderValue) validate(all bool) error { 1238 if m == nil { 1239 return nil 1240 } 1241 1242 var errors []error 1243 1244 if l := len(m.GetKey()); l < 1 || l > 16384 { 1245 err := HeaderValueValidationError{ 1246 field: "Key", 1247 reason: "value length must be between 1 and 16384 bytes, inclusive", 1248 } 1249 if !all { 1250 return err 1251 } 1252 errors = append(errors, err) 1253 } 1254 1255 if !_HeaderValue_Key_Pattern.MatchString(m.GetKey()) { 1256 err := HeaderValueValidationError{ 1257 field: "Key", 1258 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 1259 } 1260 if !all { 1261 return err 1262 } 1263 errors = append(errors, err) 1264 } 1265 1266 if len(m.GetValue()) > 16384 { 1267 err := HeaderValueValidationError{ 1268 field: "Value", 1269 reason: "value length must be at most 16384 bytes", 1270 } 1271 if !all { 1272 return err 1273 } 1274 errors = append(errors, err) 1275 } 1276 1277 if !_HeaderValue_Value_Pattern.MatchString(m.GetValue()) { 1278 err := HeaderValueValidationError{ 1279 field: "Value", 1280 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 1281 } 1282 if !all { 1283 return err 1284 } 1285 errors = append(errors, err) 1286 } 1287 1288 if len(errors) > 0 { 1289 return HeaderValueMultiError(errors) 1290 } 1291 return nil 1292} 1293 1294// HeaderValueMultiError is an error wrapping multiple validation errors 1295// returned by HeaderValue.ValidateAll() if the designated constraints aren't met. 1296type HeaderValueMultiError []error 1297 1298// Error returns a concatenation of all the error messages it wraps. 1299func (m HeaderValueMultiError) Error() string { 1300 var msgs []string 1301 for _, err := range m { 1302 msgs = append(msgs, err.Error()) 1303 } 1304 return strings.Join(msgs, "; ") 1305} 1306 1307// AllErrors returns a list of validation violation errors. 1308func (m HeaderValueMultiError) AllErrors() []error { return m } 1309 1310// HeaderValueValidationError is the validation error returned by 1311// HeaderValue.Validate if the designated constraints aren't met. 1312type HeaderValueValidationError struct { 1313 field string 1314 reason string 1315 cause error 1316 key bool 1317} 1318 1319// Field function returns field value. 1320func (e HeaderValueValidationError) Field() string { return e.field } 1321 1322// Reason function returns reason value. 1323func (e HeaderValueValidationError) Reason() string { return e.reason } 1324 1325// Cause function returns cause value. 1326func (e HeaderValueValidationError) Cause() error { return e.cause } 1327 1328// Key function returns key value. 1329func (e HeaderValueValidationError) Key() bool { return e.key } 1330 1331// ErrorName returns error name. 1332func (e HeaderValueValidationError) ErrorName() string { return "HeaderValueValidationError" } 1333 1334// Error satisfies the builtin error interface 1335func (e HeaderValueValidationError) Error() string { 1336 cause := "" 1337 if e.cause != nil { 1338 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1339 } 1340 1341 key := "" 1342 if e.key { 1343 key = "key for " 1344 } 1345 1346 return fmt.Sprintf( 1347 "invalid %sHeaderValue.%s: %s%s", 1348 key, 1349 e.field, 1350 e.reason, 1351 cause) 1352} 1353 1354var _ error = HeaderValueValidationError{} 1355 1356var _ interface { 1357 Field() string 1358 Reason() string 1359 Key() bool 1360 Cause() error 1361 ErrorName() string 1362} = HeaderValueValidationError{} 1363 1364var _HeaderValue_Key_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 1365 1366var _HeaderValue_Value_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 1367 1368// Validate checks the field values on HeaderValueOption with the rules defined 1369// in the proto definition for this message. If any rules are violated, the 1370// first error encountered is returned, or nil if there are no violations. 1371func (m *HeaderValueOption) Validate() error { 1372 return m.validate(false) 1373} 1374 1375// ValidateAll checks the field values on HeaderValueOption with the rules 1376// defined in the proto definition for this message. If any rules are 1377// violated, the result is a list of violation errors wrapped in 1378// HeaderValueOptionMultiError, or nil if none found. 1379func (m *HeaderValueOption) ValidateAll() error { 1380 return m.validate(true) 1381} 1382 1383func (m *HeaderValueOption) validate(all bool) error { 1384 if m == nil { 1385 return nil 1386 } 1387 1388 var errors []error 1389 1390 if m.GetHeader() == nil { 1391 err := HeaderValueOptionValidationError{ 1392 field: "Header", 1393 reason: "value is required", 1394 } 1395 if !all { 1396 return err 1397 } 1398 errors = append(errors, err) 1399 } 1400 1401 if all { 1402 switch v := interface{}(m.GetHeader()).(type) { 1403 case interface{ ValidateAll() error }: 1404 if err := v.ValidateAll(); err != nil { 1405 errors = append(errors, HeaderValueOptionValidationError{ 1406 field: "Header", 1407 reason: "embedded message failed validation", 1408 cause: err, 1409 }) 1410 } 1411 case interface{ Validate() error }: 1412 if err := v.Validate(); err != nil { 1413 errors = append(errors, HeaderValueOptionValidationError{ 1414 field: "Header", 1415 reason: "embedded message failed validation", 1416 cause: err, 1417 }) 1418 } 1419 } 1420 } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok { 1421 if err := v.Validate(); err != nil { 1422 return HeaderValueOptionValidationError{ 1423 field: "Header", 1424 reason: "embedded message failed validation", 1425 cause: err, 1426 } 1427 } 1428 } 1429 1430 if all { 1431 switch v := interface{}(m.GetAppend()).(type) { 1432 case interface{ ValidateAll() error }: 1433 if err := v.ValidateAll(); err != nil { 1434 errors = append(errors, HeaderValueOptionValidationError{ 1435 field: "Append", 1436 reason: "embedded message failed validation", 1437 cause: err, 1438 }) 1439 } 1440 case interface{ Validate() error }: 1441 if err := v.Validate(); err != nil { 1442 errors = append(errors, HeaderValueOptionValidationError{ 1443 field: "Append", 1444 reason: "embedded message failed validation", 1445 cause: err, 1446 }) 1447 } 1448 } 1449 } else if v, ok := interface{}(m.GetAppend()).(interface{ Validate() error }); ok { 1450 if err := v.Validate(); err != nil { 1451 return HeaderValueOptionValidationError{ 1452 field: "Append", 1453 reason: "embedded message failed validation", 1454 cause: err, 1455 } 1456 } 1457 } 1458 1459 if len(errors) > 0 { 1460 return HeaderValueOptionMultiError(errors) 1461 } 1462 return nil 1463} 1464 1465// HeaderValueOptionMultiError is an error wrapping multiple validation errors 1466// returned by HeaderValueOption.ValidateAll() if the designated constraints 1467// aren't met. 1468type HeaderValueOptionMultiError []error 1469 1470// Error returns a concatenation of all the error messages it wraps. 1471func (m HeaderValueOptionMultiError) Error() string { 1472 var msgs []string 1473 for _, err := range m { 1474 msgs = append(msgs, err.Error()) 1475 } 1476 return strings.Join(msgs, "; ") 1477} 1478 1479// AllErrors returns a list of validation violation errors. 1480func (m HeaderValueOptionMultiError) AllErrors() []error { return m } 1481 1482// HeaderValueOptionValidationError is the validation error returned by 1483// HeaderValueOption.Validate if the designated constraints aren't met. 1484type HeaderValueOptionValidationError struct { 1485 field string 1486 reason string 1487 cause error 1488 key bool 1489} 1490 1491// Field function returns field value. 1492func (e HeaderValueOptionValidationError) Field() string { return e.field } 1493 1494// Reason function returns reason value. 1495func (e HeaderValueOptionValidationError) Reason() string { return e.reason } 1496 1497// Cause function returns cause value. 1498func (e HeaderValueOptionValidationError) Cause() error { return e.cause } 1499 1500// Key function returns key value. 1501func (e HeaderValueOptionValidationError) Key() bool { return e.key } 1502 1503// ErrorName returns error name. 1504func (e HeaderValueOptionValidationError) ErrorName() string { 1505 return "HeaderValueOptionValidationError" 1506} 1507 1508// Error satisfies the builtin error interface 1509func (e HeaderValueOptionValidationError) Error() string { 1510 cause := "" 1511 if e.cause != nil { 1512 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1513 } 1514 1515 key := "" 1516 if e.key { 1517 key = "key for " 1518 } 1519 1520 return fmt.Sprintf( 1521 "invalid %sHeaderValueOption.%s: %s%s", 1522 key, 1523 e.field, 1524 e.reason, 1525 cause) 1526} 1527 1528var _ error = HeaderValueOptionValidationError{} 1529 1530var _ interface { 1531 Field() string 1532 Reason() string 1533 Key() bool 1534 Cause() error 1535 ErrorName() string 1536} = HeaderValueOptionValidationError{} 1537 1538// Validate checks the field values on HeaderMap with the rules defined in the 1539// proto definition for this message. If any rules are violated, the first 1540// error encountered is returned, or nil if there are no violations. 1541func (m *HeaderMap) Validate() error { 1542 return m.validate(false) 1543} 1544 1545// ValidateAll checks the field values on HeaderMap with the rules defined in 1546// the proto definition for this message. If any rules are violated, the 1547// result is a list of violation errors wrapped in HeaderMapMultiError, or nil 1548// if none found. 1549func (m *HeaderMap) ValidateAll() error { 1550 return m.validate(true) 1551} 1552 1553func (m *HeaderMap) validate(all bool) error { 1554 if m == nil { 1555 return nil 1556 } 1557 1558 var errors []error 1559 1560 for idx, item := range m.GetHeaders() { 1561 _, _ = idx, item 1562 1563 if all { 1564 switch v := interface{}(item).(type) { 1565 case interface{ ValidateAll() error }: 1566 if err := v.ValidateAll(); err != nil { 1567 errors = append(errors, HeaderMapValidationError{ 1568 field: fmt.Sprintf("Headers[%v]", idx), 1569 reason: "embedded message failed validation", 1570 cause: err, 1571 }) 1572 } 1573 case interface{ Validate() error }: 1574 if err := v.Validate(); err != nil { 1575 errors = append(errors, HeaderMapValidationError{ 1576 field: fmt.Sprintf("Headers[%v]", idx), 1577 reason: "embedded message failed validation", 1578 cause: err, 1579 }) 1580 } 1581 } 1582 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 1583 if err := v.Validate(); err != nil { 1584 return HeaderMapValidationError{ 1585 field: fmt.Sprintf("Headers[%v]", idx), 1586 reason: "embedded message failed validation", 1587 cause: err, 1588 } 1589 } 1590 } 1591 1592 } 1593 1594 if len(errors) > 0 { 1595 return HeaderMapMultiError(errors) 1596 } 1597 return nil 1598} 1599 1600// HeaderMapMultiError is an error wrapping multiple validation errors returned 1601// by HeaderMap.ValidateAll() if the designated constraints aren't met. 1602type HeaderMapMultiError []error 1603 1604// Error returns a concatenation of all the error messages it wraps. 1605func (m HeaderMapMultiError) Error() string { 1606 var msgs []string 1607 for _, err := range m { 1608 msgs = append(msgs, err.Error()) 1609 } 1610 return strings.Join(msgs, "; ") 1611} 1612 1613// AllErrors returns a list of validation violation errors. 1614func (m HeaderMapMultiError) AllErrors() []error { return m } 1615 1616// HeaderMapValidationError is the validation error returned by 1617// HeaderMap.Validate if the designated constraints aren't met. 1618type HeaderMapValidationError struct { 1619 field string 1620 reason string 1621 cause error 1622 key bool 1623} 1624 1625// Field function returns field value. 1626func (e HeaderMapValidationError) Field() string { return e.field } 1627 1628// Reason function returns reason value. 1629func (e HeaderMapValidationError) Reason() string { return e.reason } 1630 1631// Cause function returns cause value. 1632func (e HeaderMapValidationError) Cause() error { return e.cause } 1633 1634// Key function returns key value. 1635func (e HeaderMapValidationError) Key() bool { return e.key } 1636 1637// ErrorName returns error name. 1638func (e HeaderMapValidationError) ErrorName() string { return "HeaderMapValidationError" } 1639 1640// Error satisfies the builtin error interface 1641func (e HeaderMapValidationError) Error() string { 1642 cause := "" 1643 if e.cause != nil { 1644 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1645 } 1646 1647 key := "" 1648 if e.key { 1649 key = "key for " 1650 } 1651 1652 return fmt.Sprintf( 1653 "invalid %sHeaderMap.%s: %s%s", 1654 key, 1655 e.field, 1656 e.reason, 1657 cause) 1658} 1659 1660var _ error = HeaderMapValidationError{} 1661 1662var _ interface { 1663 Field() string 1664 Reason() string 1665 Key() bool 1666 Cause() error 1667 ErrorName() string 1668} = HeaderMapValidationError{} 1669 1670// Validate checks the field values on DataSource with the rules defined in the 1671// proto definition for this message. If any rules are violated, the first 1672// error encountered is returned, or nil if there are no violations. 1673func (m *DataSource) Validate() error { 1674 return m.validate(false) 1675} 1676 1677// ValidateAll checks the field values on DataSource with the rules defined in 1678// the proto definition for this message. If any rules are violated, the 1679// result is a list of violation errors wrapped in DataSourceMultiError, or 1680// nil if none found. 1681func (m *DataSource) ValidateAll() error { 1682 return m.validate(true) 1683} 1684 1685func (m *DataSource) validate(all bool) error { 1686 if m == nil { 1687 return nil 1688 } 1689 1690 var errors []error 1691 1692 switch m.Specifier.(type) { 1693 1694 case *DataSource_Filename: 1695 1696 if len(m.GetFilename()) < 1 { 1697 err := DataSourceValidationError{ 1698 field: "Filename", 1699 reason: "value length must be at least 1 bytes", 1700 } 1701 if !all { 1702 return err 1703 } 1704 errors = append(errors, err) 1705 } 1706 1707 case *DataSource_InlineBytes: 1708 1709 if len(m.GetInlineBytes()) < 1 { 1710 err := DataSourceValidationError{ 1711 field: "InlineBytes", 1712 reason: "value length must be at least 1 bytes", 1713 } 1714 if !all { 1715 return err 1716 } 1717 errors = append(errors, err) 1718 } 1719 1720 case *DataSource_InlineString: 1721 1722 if len(m.GetInlineString()) < 1 { 1723 err := DataSourceValidationError{ 1724 field: "InlineString", 1725 reason: "value length must be at least 1 bytes", 1726 } 1727 if !all { 1728 return err 1729 } 1730 errors = append(errors, err) 1731 } 1732 1733 default: 1734 err := DataSourceValidationError{ 1735 field: "Specifier", 1736 reason: "value is required", 1737 } 1738 if !all { 1739 return err 1740 } 1741 errors = append(errors, err) 1742 1743 } 1744 1745 if len(errors) > 0 { 1746 return DataSourceMultiError(errors) 1747 } 1748 return nil 1749} 1750 1751// DataSourceMultiError is an error wrapping multiple validation errors 1752// returned by DataSource.ValidateAll() if the designated constraints aren't met. 1753type DataSourceMultiError []error 1754 1755// Error returns a concatenation of all the error messages it wraps. 1756func (m DataSourceMultiError) Error() string { 1757 var msgs []string 1758 for _, err := range m { 1759 msgs = append(msgs, err.Error()) 1760 } 1761 return strings.Join(msgs, "; ") 1762} 1763 1764// AllErrors returns a list of validation violation errors. 1765func (m DataSourceMultiError) AllErrors() []error { return m } 1766 1767// DataSourceValidationError is the validation error returned by 1768// DataSource.Validate if the designated constraints aren't met. 1769type DataSourceValidationError struct { 1770 field string 1771 reason string 1772 cause error 1773 key bool 1774} 1775 1776// Field function returns field value. 1777func (e DataSourceValidationError) Field() string { return e.field } 1778 1779// Reason function returns reason value. 1780func (e DataSourceValidationError) Reason() string { return e.reason } 1781 1782// Cause function returns cause value. 1783func (e DataSourceValidationError) Cause() error { return e.cause } 1784 1785// Key function returns key value. 1786func (e DataSourceValidationError) Key() bool { return e.key } 1787 1788// ErrorName returns error name. 1789func (e DataSourceValidationError) ErrorName() string { return "DataSourceValidationError" } 1790 1791// Error satisfies the builtin error interface 1792func (e DataSourceValidationError) Error() string { 1793 cause := "" 1794 if e.cause != nil { 1795 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1796 } 1797 1798 key := "" 1799 if e.key { 1800 key = "key for " 1801 } 1802 1803 return fmt.Sprintf( 1804 "invalid %sDataSource.%s: %s%s", 1805 key, 1806 e.field, 1807 e.reason, 1808 cause) 1809} 1810 1811var _ error = DataSourceValidationError{} 1812 1813var _ interface { 1814 Field() string 1815 Reason() string 1816 Key() bool 1817 Cause() error 1818 ErrorName() string 1819} = DataSourceValidationError{} 1820 1821// Validate checks the field values on RetryPolicy with the rules defined in 1822// the proto definition for this message. If any rules are violated, the first 1823// error encountered is returned, or nil if there are no violations. 1824func (m *RetryPolicy) Validate() error { 1825 return m.validate(false) 1826} 1827 1828// ValidateAll checks the field values on RetryPolicy with the rules defined in 1829// the proto definition for this message. If any rules are violated, the 1830// result is a list of violation errors wrapped in RetryPolicyMultiError, or 1831// nil if none found. 1832func (m *RetryPolicy) ValidateAll() error { 1833 return m.validate(true) 1834} 1835 1836func (m *RetryPolicy) validate(all bool) error { 1837 if m == nil { 1838 return nil 1839 } 1840 1841 var errors []error 1842 1843 if all { 1844 switch v := interface{}(m.GetRetryBackOff()).(type) { 1845 case interface{ ValidateAll() error }: 1846 if err := v.ValidateAll(); err != nil { 1847 errors = append(errors, RetryPolicyValidationError{ 1848 field: "RetryBackOff", 1849 reason: "embedded message failed validation", 1850 cause: err, 1851 }) 1852 } 1853 case interface{ Validate() error }: 1854 if err := v.Validate(); err != nil { 1855 errors = append(errors, RetryPolicyValidationError{ 1856 field: "RetryBackOff", 1857 reason: "embedded message failed validation", 1858 cause: err, 1859 }) 1860 } 1861 } 1862 } else if v, ok := interface{}(m.GetRetryBackOff()).(interface{ Validate() error }); ok { 1863 if err := v.Validate(); err != nil { 1864 return RetryPolicyValidationError{ 1865 field: "RetryBackOff", 1866 reason: "embedded message failed validation", 1867 cause: err, 1868 } 1869 } 1870 } 1871 1872 if all { 1873 switch v := interface{}(m.GetNumRetries()).(type) { 1874 case interface{ ValidateAll() error }: 1875 if err := v.ValidateAll(); err != nil { 1876 errors = append(errors, RetryPolicyValidationError{ 1877 field: "NumRetries", 1878 reason: "embedded message failed validation", 1879 cause: err, 1880 }) 1881 } 1882 case interface{ Validate() error }: 1883 if err := v.Validate(); err != nil { 1884 errors = append(errors, RetryPolicyValidationError{ 1885 field: "NumRetries", 1886 reason: "embedded message failed validation", 1887 cause: err, 1888 }) 1889 } 1890 } 1891 } else if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok { 1892 if err := v.Validate(); err != nil { 1893 return RetryPolicyValidationError{ 1894 field: "NumRetries", 1895 reason: "embedded message failed validation", 1896 cause: err, 1897 } 1898 } 1899 } 1900 1901 if len(errors) > 0 { 1902 return RetryPolicyMultiError(errors) 1903 } 1904 return nil 1905} 1906 1907// RetryPolicyMultiError is an error wrapping multiple validation errors 1908// returned by RetryPolicy.ValidateAll() if the designated constraints aren't met. 1909type RetryPolicyMultiError []error 1910 1911// Error returns a concatenation of all the error messages it wraps. 1912func (m RetryPolicyMultiError) Error() string { 1913 var msgs []string 1914 for _, err := range m { 1915 msgs = append(msgs, err.Error()) 1916 } 1917 return strings.Join(msgs, "; ") 1918} 1919 1920// AllErrors returns a list of validation violation errors. 1921func (m RetryPolicyMultiError) AllErrors() []error { return m } 1922 1923// RetryPolicyValidationError is the validation error returned by 1924// RetryPolicy.Validate if the designated constraints aren't met. 1925type RetryPolicyValidationError struct { 1926 field string 1927 reason string 1928 cause error 1929 key bool 1930} 1931 1932// Field function returns field value. 1933func (e RetryPolicyValidationError) Field() string { return e.field } 1934 1935// Reason function returns reason value. 1936func (e RetryPolicyValidationError) Reason() string { return e.reason } 1937 1938// Cause function returns cause value. 1939func (e RetryPolicyValidationError) Cause() error { return e.cause } 1940 1941// Key function returns key value. 1942func (e RetryPolicyValidationError) Key() bool { return e.key } 1943 1944// ErrorName returns error name. 1945func (e RetryPolicyValidationError) ErrorName() string { return "RetryPolicyValidationError" } 1946 1947// Error satisfies the builtin error interface 1948func (e RetryPolicyValidationError) Error() string { 1949 cause := "" 1950 if e.cause != nil { 1951 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1952 } 1953 1954 key := "" 1955 if e.key { 1956 key = "key for " 1957 } 1958 1959 return fmt.Sprintf( 1960 "invalid %sRetryPolicy.%s: %s%s", 1961 key, 1962 e.field, 1963 e.reason, 1964 cause) 1965} 1966 1967var _ error = RetryPolicyValidationError{} 1968 1969var _ interface { 1970 Field() string 1971 Reason() string 1972 Key() bool 1973 Cause() error 1974 ErrorName() string 1975} = RetryPolicyValidationError{} 1976 1977// Validate checks the field values on RemoteDataSource with the rules defined 1978// in the proto definition for this message. If any rules are violated, the 1979// first error encountered is returned, or nil if there are no violations. 1980func (m *RemoteDataSource) Validate() error { 1981 return m.validate(false) 1982} 1983 1984// ValidateAll checks the field values on RemoteDataSource with the rules 1985// defined in the proto definition for this message. If any rules are 1986// violated, the result is a list of violation errors wrapped in 1987// RemoteDataSourceMultiError, or nil if none found. 1988func (m *RemoteDataSource) ValidateAll() error { 1989 return m.validate(true) 1990} 1991 1992func (m *RemoteDataSource) validate(all bool) error { 1993 if m == nil { 1994 return nil 1995 } 1996 1997 var errors []error 1998 1999 if m.GetHttpUri() == nil { 2000 err := RemoteDataSourceValidationError{ 2001 field: "HttpUri", 2002 reason: "value is required", 2003 } 2004 if !all { 2005 return err 2006 } 2007 errors = append(errors, err) 2008 } 2009 2010 if all { 2011 switch v := interface{}(m.GetHttpUri()).(type) { 2012 case interface{ ValidateAll() error }: 2013 if err := v.ValidateAll(); err != nil { 2014 errors = append(errors, RemoteDataSourceValidationError{ 2015 field: "HttpUri", 2016 reason: "embedded message failed validation", 2017 cause: err, 2018 }) 2019 } 2020 case interface{ Validate() error }: 2021 if err := v.Validate(); err != nil { 2022 errors = append(errors, RemoteDataSourceValidationError{ 2023 field: "HttpUri", 2024 reason: "embedded message failed validation", 2025 cause: err, 2026 }) 2027 } 2028 } 2029 } else if v, ok := interface{}(m.GetHttpUri()).(interface{ Validate() error }); ok { 2030 if err := v.Validate(); err != nil { 2031 return RemoteDataSourceValidationError{ 2032 field: "HttpUri", 2033 reason: "embedded message failed validation", 2034 cause: err, 2035 } 2036 } 2037 } 2038 2039 if len(m.GetSha256()) < 1 { 2040 err := RemoteDataSourceValidationError{ 2041 field: "Sha256", 2042 reason: "value length must be at least 1 bytes", 2043 } 2044 if !all { 2045 return err 2046 } 2047 errors = append(errors, err) 2048 } 2049 2050 if all { 2051 switch v := interface{}(m.GetRetryPolicy()).(type) { 2052 case interface{ ValidateAll() error }: 2053 if err := v.ValidateAll(); err != nil { 2054 errors = append(errors, RemoteDataSourceValidationError{ 2055 field: "RetryPolicy", 2056 reason: "embedded message failed validation", 2057 cause: err, 2058 }) 2059 } 2060 case interface{ Validate() error }: 2061 if err := v.Validate(); err != nil { 2062 errors = append(errors, RemoteDataSourceValidationError{ 2063 field: "RetryPolicy", 2064 reason: "embedded message failed validation", 2065 cause: err, 2066 }) 2067 } 2068 } 2069 } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok { 2070 if err := v.Validate(); err != nil { 2071 return RemoteDataSourceValidationError{ 2072 field: "RetryPolicy", 2073 reason: "embedded message failed validation", 2074 cause: err, 2075 } 2076 } 2077 } 2078 2079 if len(errors) > 0 { 2080 return RemoteDataSourceMultiError(errors) 2081 } 2082 return nil 2083} 2084 2085// RemoteDataSourceMultiError is an error wrapping multiple validation errors 2086// returned by RemoteDataSource.ValidateAll() if the designated constraints 2087// aren't met. 2088type RemoteDataSourceMultiError []error 2089 2090// Error returns a concatenation of all the error messages it wraps. 2091func (m RemoteDataSourceMultiError) Error() string { 2092 var msgs []string 2093 for _, err := range m { 2094 msgs = append(msgs, err.Error()) 2095 } 2096 return strings.Join(msgs, "; ") 2097} 2098 2099// AllErrors returns a list of validation violation errors. 2100func (m RemoteDataSourceMultiError) AllErrors() []error { return m } 2101 2102// RemoteDataSourceValidationError is the validation error returned by 2103// RemoteDataSource.Validate if the designated constraints aren't met. 2104type RemoteDataSourceValidationError struct { 2105 field string 2106 reason string 2107 cause error 2108 key bool 2109} 2110 2111// Field function returns field value. 2112func (e RemoteDataSourceValidationError) Field() string { return e.field } 2113 2114// Reason function returns reason value. 2115func (e RemoteDataSourceValidationError) Reason() string { return e.reason } 2116 2117// Cause function returns cause value. 2118func (e RemoteDataSourceValidationError) Cause() error { return e.cause } 2119 2120// Key function returns key value. 2121func (e RemoteDataSourceValidationError) Key() bool { return e.key } 2122 2123// ErrorName returns error name. 2124func (e RemoteDataSourceValidationError) ErrorName() string { return "RemoteDataSourceValidationError" } 2125 2126// Error satisfies the builtin error interface 2127func (e RemoteDataSourceValidationError) Error() string { 2128 cause := "" 2129 if e.cause != nil { 2130 cause = fmt.Sprintf(" | caused by: %v", e.cause) 2131 } 2132 2133 key := "" 2134 if e.key { 2135 key = "key for " 2136 } 2137 2138 return fmt.Sprintf( 2139 "invalid %sRemoteDataSource.%s: %s%s", 2140 key, 2141 e.field, 2142 e.reason, 2143 cause) 2144} 2145 2146var _ error = RemoteDataSourceValidationError{} 2147 2148var _ interface { 2149 Field() string 2150 Reason() string 2151 Key() bool 2152 Cause() error 2153 ErrorName() string 2154} = RemoteDataSourceValidationError{} 2155 2156// Validate checks the field values on AsyncDataSource with the rules defined 2157// in the proto definition for this message. If any rules are violated, the 2158// first error encountered is returned, or nil if there are no violations. 2159func (m *AsyncDataSource) Validate() error { 2160 return m.validate(false) 2161} 2162 2163// ValidateAll checks the field values on AsyncDataSource with the rules 2164// defined in the proto definition for this message. If any rules are 2165// violated, the result is a list of violation errors wrapped in 2166// AsyncDataSourceMultiError, or nil if none found. 2167func (m *AsyncDataSource) ValidateAll() error { 2168 return m.validate(true) 2169} 2170 2171func (m *AsyncDataSource) validate(all bool) error { 2172 if m == nil { 2173 return nil 2174 } 2175 2176 var errors []error 2177 2178 switch m.Specifier.(type) { 2179 2180 case *AsyncDataSource_Local: 2181 2182 if all { 2183 switch v := interface{}(m.GetLocal()).(type) { 2184 case interface{ ValidateAll() error }: 2185 if err := v.ValidateAll(); err != nil { 2186 errors = append(errors, AsyncDataSourceValidationError{ 2187 field: "Local", 2188 reason: "embedded message failed validation", 2189 cause: err, 2190 }) 2191 } 2192 case interface{ Validate() error }: 2193 if err := v.Validate(); err != nil { 2194 errors = append(errors, AsyncDataSourceValidationError{ 2195 field: "Local", 2196 reason: "embedded message failed validation", 2197 cause: err, 2198 }) 2199 } 2200 } 2201 } else if v, ok := interface{}(m.GetLocal()).(interface{ Validate() error }); ok { 2202 if err := v.Validate(); err != nil { 2203 return AsyncDataSourceValidationError{ 2204 field: "Local", 2205 reason: "embedded message failed validation", 2206 cause: err, 2207 } 2208 } 2209 } 2210 2211 case *AsyncDataSource_Remote: 2212 2213 if all { 2214 switch v := interface{}(m.GetRemote()).(type) { 2215 case interface{ ValidateAll() error }: 2216 if err := v.ValidateAll(); err != nil { 2217 errors = append(errors, AsyncDataSourceValidationError{ 2218 field: "Remote", 2219 reason: "embedded message failed validation", 2220 cause: err, 2221 }) 2222 } 2223 case interface{ Validate() error }: 2224 if err := v.Validate(); err != nil { 2225 errors = append(errors, AsyncDataSourceValidationError{ 2226 field: "Remote", 2227 reason: "embedded message failed validation", 2228 cause: err, 2229 }) 2230 } 2231 } 2232 } else if v, ok := interface{}(m.GetRemote()).(interface{ Validate() error }); ok { 2233 if err := v.Validate(); err != nil { 2234 return AsyncDataSourceValidationError{ 2235 field: "Remote", 2236 reason: "embedded message failed validation", 2237 cause: err, 2238 } 2239 } 2240 } 2241 2242 default: 2243 err := AsyncDataSourceValidationError{ 2244 field: "Specifier", 2245 reason: "value is required", 2246 } 2247 if !all { 2248 return err 2249 } 2250 errors = append(errors, err) 2251 2252 } 2253 2254 if len(errors) > 0 { 2255 return AsyncDataSourceMultiError(errors) 2256 } 2257 return nil 2258} 2259 2260// AsyncDataSourceMultiError is an error wrapping multiple validation errors 2261// returned by AsyncDataSource.ValidateAll() if the designated constraints 2262// aren't met. 2263type AsyncDataSourceMultiError []error 2264 2265// Error returns a concatenation of all the error messages it wraps. 2266func (m AsyncDataSourceMultiError) Error() string { 2267 var msgs []string 2268 for _, err := range m { 2269 msgs = append(msgs, err.Error()) 2270 } 2271 return strings.Join(msgs, "; ") 2272} 2273 2274// AllErrors returns a list of validation violation errors. 2275func (m AsyncDataSourceMultiError) AllErrors() []error { return m } 2276 2277// AsyncDataSourceValidationError is the validation error returned by 2278// AsyncDataSource.Validate if the designated constraints aren't met. 2279type AsyncDataSourceValidationError struct { 2280 field string 2281 reason string 2282 cause error 2283 key bool 2284} 2285 2286// Field function returns field value. 2287func (e AsyncDataSourceValidationError) Field() string { return e.field } 2288 2289// Reason function returns reason value. 2290func (e AsyncDataSourceValidationError) Reason() string { return e.reason } 2291 2292// Cause function returns cause value. 2293func (e AsyncDataSourceValidationError) Cause() error { return e.cause } 2294 2295// Key function returns key value. 2296func (e AsyncDataSourceValidationError) Key() bool { return e.key } 2297 2298// ErrorName returns error name. 2299func (e AsyncDataSourceValidationError) ErrorName() string { return "AsyncDataSourceValidationError" } 2300 2301// Error satisfies the builtin error interface 2302func (e AsyncDataSourceValidationError) Error() string { 2303 cause := "" 2304 if e.cause != nil { 2305 cause = fmt.Sprintf(" | caused by: %v", e.cause) 2306 } 2307 2308 key := "" 2309 if e.key { 2310 key = "key for " 2311 } 2312 2313 return fmt.Sprintf( 2314 "invalid %sAsyncDataSource.%s: %s%s", 2315 key, 2316 e.field, 2317 e.reason, 2318 cause) 2319} 2320 2321var _ error = AsyncDataSourceValidationError{} 2322 2323var _ interface { 2324 Field() string 2325 Reason() string 2326 Key() bool 2327 Cause() error 2328 ErrorName() string 2329} = AsyncDataSourceValidationError{} 2330 2331// Validate checks the field values on TransportSocket with the rules defined 2332// in the proto definition for this message. If any rules are violated, the 2333// first error encountered is returned, or nil if there are no violations. 2334func (m *TransportSocket) Validate() error { 2335 return m.validate(false) 2336} 2337 2338// ValidateAll checks the field values on TransportSocket with the rules 2339// defined in the proto definition for this message. If any rules are 2340// violated, the result is a list of violation errors wrapped in 2341// TransportSocketMultiError, or nil if none found. 2342func (m *TransportSocket) ValidateAll() error { 2343 return m.validate(true) 2344} 2345 2346func (m *TransportSocket) validate(all bool) error { 2347 if m == nil { 2348 return nil 2349 } 2350 2351 var errors []error 2352 2353 if len(m.GetName()) < 1 { 2354 err := TransportSocketValidationError{ 2355 field: "Name", 2356 reason: "value length must be at least 1 bytes", 2357 } 2358 if !all { 2359 return err 2360 } 2361 errors = append(errors, err) 2362 } 2363 2364 switch m.ConfigType.(type) { 2365 2366 case *TransportSocket_Config: 2367 2368 if all { 2369 switch v := interface{}(m.GetConfig()).(type) { 2370 case interface{ ValidateAll() error }: 2371 if err := v.ValidateAll(); err != nil { 2372 errors = append(errors, TransportSocketValidationError{ 2373 field: "Config", 2374 reason: "embedded message failed validation", 2375 cause: err, 2376 }) 2377 } 2378 case interface{ Validate() error }: 2379 if err := v.Validate(); err != nil { 2380 errors = append(errors, TransportSocketValidationError{ 2381 field: "Config", 2382 reason: "embedded message failed validation", 2383 cause: err, 2384 }) 2385 } 2386 } 2387 } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { 2388 if err := v.Validate(); err != nil { 2389 return TransportSocketValidationError{ 2390 field: "Config", 2391 reason: "embedded message failed validation", 2392 cause: err, 2393 } 2394 } 2395 } 2396 2397 case *TransportSocket_TypedConfig: 2398 2399 if all { 2400 switch v := interface{}(m.GetTypedConfig()).(type) { 2401 case interface{ ValidateAll() error }: 2402 if err := v.ValidateAll(); err != nil { 2403 errors = append(errors, TransportSocketValidationError{ 2404 field: "TypedConfig", 2405 reason: "embedded message failed validation", 2406 cause: err, 2407 }) 2408 } 2409 case interface{ Validate() error }: 2410 if err := v.Validate(); err != nil { 2411 errors = append(errors, TransportSocketValidationError{ 2412 field: "TypedConfig", 2413 reason: "embedded message failed validation", 2414 cause: err, 2415 }) 2416 } 2417 } 2418 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { 2419 if err := v.Validate(); err != nil { 2420 return TransportSocketValidationError{ 2421 field: "TypedConfig", 2422 reason: "embedded message failed validation", 2423 cause: err, 2424 } 2425 } 2426 } 2427 2428 } 2429 2430 if len(errors) > 0 { 2431 return TransportSocketMultiError(errors) 2432 } 2433 return nil 2434} 2435 2436// TransportSocketMultiError is an error wrapping multiple validation errors 2437// returned by TransportSocket.ValidateAll() if the designated constraints 2438// aren't met. 2439type TransportSocketMultiError []error 2440 2441// Error returns a concatenation of all the error messages it wraps. 2442func (m TransportSocketMultiError) Error() string { 2443 var msgs []string 2444 for _, err := range m { 2445 msgs = append(msgs, err.Error()) 2446 } 2447 return strings.Join(msgs, "; ") 2448} 2449 2450// AllErrors returns a list of validation violation errors. 2451func (m TransportSocketMultiError) AllErrors() []error { return m } 2452 2453// TransportSocketValidationError is the validation error returned by 2454// TransportSocket.Validate if the designated constraints aren't met. 2455type TransportSocketValidationError struct { 2456 field string 2457 reason string 2458 cause error 2459 key bool 2460} 2461 2462// Field function returns field value. 2463func (e TransportSocketValidationError) Field() string { return e.field } 2464 2465// Reason function returns reason value. 2466func (e TransportSocketValidationError) Reason() string { return e.reason } 2467 2468// Cause function returns cause value. 2469func (e TransportSocketValidationError) Cause() error { return e.cause } 2470 2471// Key function returns key value. 2472func (e TransportSocketValidationError) Key() bool { return e.key } 2473 2474// ErrorName returns error name. 2475func (e TransportSocketValidationError) ErrorName() string { return "TransportSocketValidationError" } 2476 2477// Error satisfies the builtin error interface 2478func (e TransportSocketValidationError) Error() string { 2479 cause := "" 2480 if e.cause != nil { 2481 cause = fmt.Sprintf(" | caused by: %v", e.cause) 2482 } 2483 2484 key := "" 2485 if e.key { 2486 key = "key for " 2487 } 2488 2489 return fmt.Sprintf( 2490 "invalid %sTransportSocket.%s: %s%s", 2491 key, 2492 e.field, 2493 e.reason, 2494 cause) 2495} 2496 2497var _ error = TransportSocketValidationError{} 2498 2499var _ interface { 2500 Field() string 2501 Reason() string 2502 Key() bool 2503 Cause() error 2504 ErrorName() string 2505} = TransportSocketValidationError{} 2506 2507// Validate checks the field values on RuntimeFractionalPercent with the rules 2508// defined in the proto definition for this message. If any rules are 2509// violated, the first error encountered is returned, or nil if there are no violations. 2510func (m *RuntimeFractionalPercent) Validate() error { 2511 return m.validate(false) 2512} 2513 2514// ValidateAll checks the field values on RuntimeFractionalPercent with the 2515// rules defined in the proto definition for this message. If any rules are 2516// violated, the result is a list of violation errors wrapped in 2517// RuntimeFractionalPercentMultiError, or nil if none found. 2518func (m *RuntimeFractionalPercent) ValidateAll() error { 2519 return m.validate(true) 2520} 2521 2522func (m *RuntimeFractionalPercent) validate(all bool) error { 2523 if m == nil { 2524 return nil 2525 } 2526 2527 var errors []error 2528 2529 if m.GetDefaultValue() == nil { 2530 err := RuntimeFractionalPercentValidationError{ 2531 field: "DefaultValue", 2532 reason: "value is required", 2533 } 2534 if !all { 2535 return err 2536 } 2537 errors = append(errors, err) 2538 } 2539 2540 if all { 2541 switch v := interface{}(m.GetDefaultValue()).(type) { 2542 case interface{ ValidateAll() error }: 2543 if err := v.ValidateAll(); err != nil { 2544 errors = append(errors, RuntimeFractionalPercentValidationError{ 2545 field: "DefaultValue", 2546 reason: "embedded message failed validation", 2547 cause: err, 2548 }) 2549 } 2550 case interface{ Validate() error }: 2551 if err := v.Validate(); err != nil { 2552 errors = append(errors, RuntimeFractionalPercentValidationError{ 2553 field: "DefaultValue", 2554 reason: "embedded message failed validation", 2555 cause: err, 2556 }) 2557 } 2558 } 2559 } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok { 2560 if err := v.Validate(); err != nil { 2561 return RuntimeFractionalPercentValidationError{ 2562 field: "DefaultValue", 2563 reason: "embedded message failed validation", 2564 cause: err, 2565 } 2566 } 2567 } 2568 2569 // no validation rules for RuntimeKey 2570 2571 if len(errors) > 0 { 2572 return RuntimeFractionalPercentMultiError(errors) 2573 } 2574 return nil 2575} 2576 2577// RuntimeFractionalPercentMultiError is an error wrapping multiple validation 2578// errors returned by RuntimeFractionalPercent.ValidateAll() if the designated 2579// constraints aren't met. 2580type RuntimeFractionalPercentMultiError []error 2581 2582// Error returns a concatenation of all the error messages it wraps. 2583func (m RuntimeFractionalPercentMultiError) Error() string { 2584 var msgs []string 2585 for _, err := range m { 2586 msgs = append(msgs, err.Error()) 2587 } 2588 return strings.Join(msgs, "; ") 2589} 2590 2591// AllErrors returns a list of validation violation errors. 2592func (m RuntimeFractionalPercentMultiError) AllErrors() []error { return m } 2593 2594// RuntimeFractionalPercentValidationError is the validation error returned by 2595// RuntimeFractionalPercent.Validate if the designated constraints aren't met. 2596type RuntimeFractionalPercentValidationError struct { 2597 field string 2598 reason string 2599 cause error 2600 key bool 2601} 2602 2603// Field function returns field value. 2604func (e RuntimeFractionalPercentValidationError) Field() string { return e.field } 2605 2606// Reason function returns reason value. 2607func (e RuntimeFractionalPercentValidationError) Reason() string { return e.reason } 2608 2609// Cause function returns cause value. 2610func (e RuntimeFractionalPercentValidationError) Cause() error { return e.cause } 2611 2612// Key function returns key value. 2613func (e RuntimeFractionalPercentValidationError) Key() bool { return e.key } 2614 2615// ErrorName returns error name. 2616func (e RuntimeFractionalPercentValidationError) ErrorName() string { 2617 return "RuntimeFractionalPercentValidationError" 2618} 2619 2620// Error satisfies the builtin error interface 2621func (e RuntimeFractionalPercentValidationError) Error() string { 2622 cause := "" 2623 if e.cause != nil { 2624 cause = fmt.Sprintf(" | caused by: %v", e.cause) 2625 } 2626 2627 key := "" 2628 if e.key { 2629 key = "key for " 2630 } 2631 2632 return fmt.Sprintf( 2633 "invalid %sRuntimeFractionalPercent.%s: %s%s", 2634 key, 2635 e.field, 2636 e.reason, 2637 cause) 2638} 2639 2640var _ error = RuntimeFractionalPercentValidationError{} 2641 2642var _ interface { 2643 Field() string 2644 Reason() string 2645 Key() bool 2646 Cause() error 2647 ErrorName() string 2648} = RuntimeFractionalPercentValidationError{} 2649 2650// Validate checks the field values on ControlPlane with the rules defined in 2651// the proto definition for this message. If any rules are violated, the first 2652// error encountered is returned, or nil if there are no violations. 2653func (m *ControlPlane) Validate() error { 2654 return m.validate(false) 2655} 2656 2657// ValidateAll checks the field values on ControlPlane with the rules defined 2658// in the proto definition for this message. If any rules are violated, the 2659// result is a list of violation errors wrapped in ControlPlaneMultiError, or 2660// nil if none found. 2661func (m *ControlPlane) ValidateAll() error { 2662 return m.validate(true) 2663} 2664 2665func (m *ControlPlane) validate(all bool) error { 2666 if m == nil { 2667 return nil 2668 } 2669 2670 var errors []error 2671 2672 // no validation rules for Identifier 2673 2674 if len(errors) > 0 { 2675 return ControlPlaneMultiError(errors) 2676 } 2677 return nil 2678} 2679 2680// ControlPlaneMultiError is an error wrapping multiple validation errors 2681// returned by ControlPlane.ValidateAll() if the designated constraints aren't met. 2682type ControlPlaneMultiError []error 2683 2684// Error returns a concatenation of all the error messages it wraps. 2685func (m ControlPlaneMultiError) Error() string { 2686 var msgs []string 2687 for _, err := range m { 2688 msgs = append(msgs, err.Error()) 2689 } 2690 return strings.Join(msgs, "; ") 2691} 2692 2693// AllErrors returns a list of validation violation errors. 2694func (m ControlPlaneMultiError) AllErrors() []error { return m } 2695 2696// ControlPlaneValidationError is the validation error returned by 2697// ControlPlane.Validate if the designated constraints aren't met. 2698type ControlPlaneValidationError struct { 2699 field string 2700 reason string 2701 cause error 2702 key bool 2703} 2704 2705// Field function returns field value. 2706func (e ControlPlaneValidationError) Field() string { return e.field } 2707 2708// Reason function returns reason value. 2709func (e ControlPlaneValidationError) Reason() string { return e.reason } 2710 2711// Cause function returns cause value. 2712func (e ControlPlaneValidationError) Cause() error { return e.cause } 2713 2714// Key function returns key value. 2715func (e ControlPlaneValidationError) Key() bool { return e.key } 2716 2717// ErrorName returns error name. 2718func (e ControlPlaneValidationError) ErrorName() string { return "ControlPlaneValidationError" } 2719 2720// Error satisfies the builtin error interface 2721func (e ControlPlaneValidationError) Error() string { 2722 cause := "" 2723 if e.cause != nil { 2724 cause = fmt.Sprintf(" | caused by: %v", e.cause) 2725 } 2726 2727 key := "" 2728 if e.key { 2729 key = "key for " 2730 } 2731 2732 return fmt.Sprintf( 2733 "invalid %sControlPlane.%s: %s%s", 2734 key, 2735 e.field, 2736 e.reason, 2737 cause) 2738} 2739 2740var _ error = ControlPlaneValidationError{} 2741 2742var _ interface { 2743 Field() string 2744 Reason() string 2745 Key() bool 2746 Cause() error 2747 ErrorName() string 2748} = ControlPlaneValidationError{} 2749