go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/cv/internal/prjmanager/prjpb/events.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: go.chromium.org/luci/cv/internal/prjmanager/prjpb/events.proto 3 4 package prjpb 5 6 import ( 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 run "go.chromium.org/luci/cv/internal/run" 22 ) 23 24 // ensure the imports are used 25 var ( 26 _ = bytes.MinRead 27 _ = errors.New("") 28 _ = fmt.Print 29 _ = utf8.UTFMax 30 _ = (*regexp.Regexp)(nil) 31 _ = (*strings.Reader)(nil) 32 _ = net.IPv4len 33 _ = time.Duration(0) 34 _ = (*url.URL)(nil) 35 _ = (*mail.Address)(nil) 36 _ = anypb.Any{} 37 _ = sort.Sort 38 39 _ = run.Status(0) 40 ) 41 42 // Validate checks the field values on Event with the rules defined in the 43 // proto definition for this message. If any rules are violated, the first 44 // error encountered is returned, or nil if there are no violations. 45 func (m *Event) Validate() error { 46 return m.validate(false) 47 } 48 49 // ValidateAll checks the field values on Event with the rules defined in the 50 // proto definition for this message. If any rules are violated, the result is 51 // a list of violation errors wrapped in EventMultiError, or nil if none found. 52 func (m *Event) ValidateAll() error { 53 return m.validate(true) 54 } 55 56 func (m *Event) validate(all bool) error { 57 if m == nil { 58 return nil 59 } 60 61 var errors []error 62 63 switch v := m.Event.(type) { 64 case *Event_NewConfig: 65 if v == nil { 66 err := EventValidationError{ 67 field: "Event", 68 reason: "oneof value cannot be a typed-nil", 69 } 70 if !all { 71 return err 72 } 73 errors = append(errors, err) 74 } 75 76 if all { 77 switch v := interface{}(m.GetNewConfig()).(type) { 78 case interface{ ValidateAll() error }: 79 if err := v.ValidateAll(); err != nil { 80 errors = append(errors, EventValidationError{ 81 field: "NewConfig", 82 reason: "embedded message failed validation", 83 cause: err, 84 }) 85 } 86 case interface{ Validate() error }: 87 if err := v.Validate(); err != nil { 88 errors = append(errors, EventValidationError{ 89 field: "NewConfig", 90 reason: "embedded message failed validation", 91 cause: err, 92 }) 93 } 94 } 95 } else if v, ok := interface{}(m.GetNewConfig()).(interface{ Validate() error }); ok { 96 if err := v.Validate(); err != nil { 97 return EventValidationError{ 98 field: "NewConfig", 99 reason: "embedded message failed validation", 100 cause: err, 101 } 102 } 103 } 104 105 case *Event_Poke: 106 if v == nil { 107 err := EventValidationError{ 108 field: "Event", 109 reason: "oneof value cannot be a typed-nil", 110 } 111 if !all { 112 return err 113 } 114 errors = append(errors, err) 115 } 116 117 if all { 118 switch v := interface{}(m.GetPoke()).(type) { 119 case interface{ ValidateAll() error }: 120 if err := v.ValidateAll(); err != nil { 121 errors = append(errors, EventValidationError{ 122 field: "Poke", 123 reason: "embedded message failed validation", 124 cause: err, 125 }) 126 } 127 case interface{ Validate() error }: 128 if err := v.Validate(); err != nil { 129 errors = append(errors, EventValidationError{ 130 field: "Poke", 131 reason: "embedded message failed validation", 132 cause: err, 133 }) 134 } 135 } 136 } else if v, ok := interface{}(m.GetPoke()).(interface{ Validate() error }); ok { 137 if err := v.Validate(); err != nil { 138 return EventValidationError{ 139 field: "Poke", 140 reason: "embedded message failed validation", 141 cause: err, 142 } 143 } 144 } 145 146 case *Event_ClsUpdated: 147 if v == nil { 148 err := EventValidationError{ 149 field: "Event", 150 reason: "oneof value cannot be a typed-nil", 151 } 152 if !all { 153 return err 154 } 155 errors = append(errors, err) 156 } 157 158 if all { 159 switch v := interface{}(m.GetClsUpdated()).(type) { 160 case interface{ ValidateAll() error }: 161 if err := v.ValidateAll(); err != nil { 162 errors = append(errors, EventValidationError{ 163 field: "ClsUpdated", 164 reason: "embedded message failed validation", 165 cause: err, 166 }) 167 } 168 case interface{ Validate() error }: 169 if err := v.Validate(); err != nil { 170 errors = append(errors, EventValidationError{ 171 field: "ClsUpdated", 172 reason: "embedded message failed validation", 173 cause: err, 174 }) 175 } 176 } 177 } else if v, ok := interface{}(m.GetClsUpdated()).(interface{ Validate() error }); ok { 178 if err := v.Validate(); err != nil { 179 return EventValidationError{ 180 field: "ClsUpdated", 181 reason: "embedded message failed validation", 182 cause: err, 183 } 184 } 185 } 186 187 case *Event_RunCreated: 188 if v == nil { 189 err := EventValidationError{ 190 field: "Event", 191 reason: "oneof value cannot be a typed-nil", 192 } 193 if !all { 194 return err 195 } 196 errors = append(errors, err) 197 } 198 199 if all { 200 switch v := interface{}(m.GetRunCreated()).(type) { 201 case interface{ ValidateAll() error }: 202 if err := v.ValidateAll(); err != nil { 203 errors = append(errors, EventValidationError{ 204 field: "RunCreated", 205 reason: "embedded message failed validation", 206 cause: err, 207 }) 208 } 209 case interface{ Validate() error }: 210 if err := v.Validate(); err != nil { 211 errors = append(errors, EventValidationError{ 212 field: "RunCreated", 213 reason: "embedded message failed validation", 214 cause: err, 215 }) 216 } 217 } 218 } else if v, ok := interface{}(m.GetRunCreated()).(interface{ Validate() error }); ok { 219 if err := v.Validate(); err != nil { 220 return EventValidationError{ 221 field: "RunCreated", 222 reason: "embedded message failed validation", 223 cause: err, 224 } 225 } 226 } 227 228 case *Event_RunFinished: 229 if v == nil { 230 err := EventValidationError{ 231 field: "Event", 232 reason: "oneof value cannot be a typed-nil", 233 } 234 if !all { 235 return err 236 } 237 errors = append(errors, err) 238 } 239 240 if all { 241 switch v := interface{}(m.GetRunFinished()).(type) { 242 case interface{ ValidateAll() error }: 243 if err := v.ValidateAll(); err != nil { 244 errors = append(errors, EventValidationError{ 245 field: "RunFinished", 246 reason: "embedded message failed validation", 247 cause: err, 248 }) 249 } 250 case interface{ Validate() error }: 251 if err := v.Validate(); err != nil { 252 errors = append(errors, EventValidationError{ 253 field: "RunFinished", 254 reason: "embedded message failed validation", 255 cause: err, 256 }) 257 } 258 } 259 } else if v, ok := interface{}(m.GetRunFinished()).(interface{ Validate() error }); ok { 260 if err := v.Validate(); err != nil { 261 return EventValidationError{ 262 field: "RunFinished", 263 reason: "embedded message failed validation", 264 cause: err, 265 } 266 } 267 } 268 269 case *Event_PurgeCompleted: 270 if v == nil { 271 err := EventValidationError{ 272 field: "Event", 273 reason: "oneof value cannot be a typed-nil", 274 } 275 if !all { 276 return err 277 } 278 errors = append(errors, err) 279 } 280 281 if all { 282 switch v := interface{}(m.GetPurgeCompleted()).(type) { 283 case interface{ ValidateAll() error }: 284 if err := v.ValidateAll(); err != nil { 285 errors = append(errors, EventValidationError{ 286 field: "PurgeCompleted", 287 reason: "embedded message failed validation", 288 cause: err, 289 }) 290 } 291 case interface{ Validate() error }: 292 if err := v.Validate(); err != nil { 293 errors = append(errors, EventValidationError{ 294 field: "PurgeCompleted", 295 reason: "embedded message failed validation", 296 cause: err, 297 }) 298 } 299 } 300 } else if v, ok := interface{}(m.GetPurgeCompleted()).(interface{ Validate() error }); ok { 301 if err := v.Validate(); err != nil { 302 return EventValidationError{ 303 field: "PurgeCompleted", 304 reason: "embedded message failed validation", 305 cause: err, 306 } 307 } 308 } 309 310 case *Event_TriggeringClDepsCompleted: 311 if v == nil { 312 err := EventValidationError{ 313 field: "Event", 314 reason: "oneof value cannot be a typed-nil", 315 } 316 if !all { 317 return err 318 } 319 errors = append(errors, err) 320 } 321 322 if all { 323 switch v := interface{}(m.GetTriggeringClDepsCompleted()).(type) { 324 case interface{ ValidateAll() error }: 325 if err := v.ValidateAll(); err != nil { 326 errors = append(errors, EventValidationError{ 327 field: "TriggeringClDepsCompleted", 328 reason: "embedded message failed validation", 329 cause: err, 330 }) 331 } 332 case interface{ Validate() error }: 333 if err := v.Validate(); err != nil { 334 errors = append(errors, EventValidationError{ 335 field: "TriggeringClDepsCompleted", 336 reason: "embedded message failed validation", 337 cause: err, 338 }) 339 } 340 } 341 } else if v, ok := interface{}(m.GetTriggeringClDepsCompleted()).(interface{ Validate() error }); ok { 342 if err := v.Validate(); err != nil { 343 return EventValidationError{ 344 field: "TriggeringClDepsCompleted", 345 reason: "embedded message failed validation", 346 cause: err, 347 } 348 } 349 } 350 351 default: 352 _ = v // ensures v is used 353 } 354 355 if len(errors) > 0 { 356 return EventMultiError(errors) 357 } 358 359 return nil 360 } 361 362 // EventMultiError is an error wrapping multiple validation errors returned by 363 // Event.ValidateAll() if the designated constraints aren't met. 364 type EventMultiError []error 365 366 // Error returns a concatenation of all the error messages it wraps. 367 func (m EventMultiError) Error() string { 368 var msgs []string 369 for _, err := range m { 370 msgs = append(msgs, err.Error()) 371 } 372 return strings.Join(msgs, "; ") 373 } 374 375 // AllErrors returns a list of validation violation errors. 376 func (m EventMultiError) AllErrors() []error { return m } 377 378 // EventValidationError is the validation error returned by Event.Validate if 379 // the designated constraints aren't met. 380 type EventValidationError struct { 381 field string 382 reason string 383 cause error 384 key bool 385 } 386 387 // Field function returns field value. 388 func (e EventValidationError) Field() string { return e.field } 389 390 // Reason function returns reason value. 391 func (e EventValidationError) Reason() string { return e.reason } 392 393 // Cause function returns cause value. 394 func (e EventValidationError) Cause() error { return e.cause } 395 396 // Key function returns key value. 397 func (e EventValidationError) Key() bool { return e.key } 398 399 // ErrorName returns error name. 400 func (e EventValidationError) ErrorName() string { return "EventValidationError" } 401 402 // Error satisfies the builtin error interface 403 func (e EventValidationError) Error() string { 404 cause := "" 405 if e.cause != nil { 406 cause = fmt.Sprintf(" | caused by: %v", e.cause) 407 } 408 409 key := "" 410 if e.key { 411 key = "key for " 412 } 413 414 return fmt.Sprintf( 415 "invalid %sEvent.%s: %s%s", 416 key, 417 e.field, 418 e.reason, 419 cause) 420 } 421 422 var _ error = EventValidationError{} 423 424 var _ interface { 425 Field() string 426 Reason() string 427 Key() bool 428 Cause() error 429 ErrorName() string 430 } = EventValidationError{} 431 432 // Validate checks the field values on NewConfig with the rules defined in the 433 // proto definition for this message. If any rules are violated, the first 434 // error encountered is returned, or nil if there are no violations. 435 func (m *NewConfig) Validate() error { 436 return m.validate(false) 437 } 438 439 // ValidateAll checks the field values on NewConfig with the rules defined in 440 // the proto definition for this message. If any rules are violated, the 441 // result is a list of violation errors wrapped in NewConfigMultiError, or nil 442 // if none found. 443 func (m *NewConfig) ValidateAll() error { 444 return m.validate(true) 445 } 446 447 func (m *NewConfig) validate(all bool) error { 448 if m == nil { 449 return nil 450 } 451 452 var errors []error 453 454 if len(errors) > 0 { 455 return NewConfigMultiError(errors) 456 } 457 458 return nil 459 } 460 461 // NewConfigMultiError is an error wrapping multiple validation errors returned 462 // by NewConfig.ValidateAll() if the designated constraints aren't met. 463 type NewConfigMultiError []error 464 465 // Error returns a concatenation of all the error messages it wraps. 466 func (m NewConfigMultiError) Error() string { 467 var msgs []string 468 for _, err := range m { 469 msgs = append(msgs, err.Error()) 470 } 471 return strings.Join(msgs, "; ") 472 } 473 474 // AllErrors returns a list of validation violation errors. 475 func (m NewConfigMultiError) AllErrors() []error { return m } 476 477 // NewConfigValidationError is the validation error returned by 478 // NewConfig.Validate if the designated constraints aren't met. 479 type NewConfigValidationError struct { 480 field string 481 reason string 482 cause error 483 key bool 484 } 485 486 // Field function returns field value. 487 func (e NewConfigValidationError) Field() string { return e.field } 488 489 // Reason function returns reason value. 490 func (e NewConfigValidationError) Reason() string { return e.reason } 491 492 // Cause function returns cause value. 493 func (e NewConfigValidationError) Cause() error { return e.cause } 494 495 // Key function returns key value. 496 func (e NewConfigValidationError) Key() bool { return e.key } 497 498 // ErrorName returns error name. 499 func (e NewConfigValidationError) ErrorName() string { return "NewConfigValidationError" } 500 501 // Error satisfies the builtin error interface 502 func (e NewConfigValidationError) Error() string { 503 cause := "" 504 if e.cause != nil { 505 cause = fmt.Sprintf(" | caused by: %v", e.cause) 506 } 507 508 key := "" 509 if e.key { 510 key = "key for " 511 } 512 513 return fmt.Sprintf( 514 "invalid %sNewConfig.%s: %s%s", 515 key, 516 e.field, 517 e.reason, 518 cause) 519 } 520 521 var _ error = NewConfigValidationError{} 522 523 var _ interface { 524 Field() string 525 Reason() string 526 Key() bool 527 Cause() error 528 ErrorName() string 529 } = NewConfigValidationError{} 530 531 // Validate checks the field values on Poke with the rules defined in the proto 532 // definition for this message. If any rules are violated, the first error 533 // encountered is returned, or nil if there are no violations. 534 func (m *Poke) Validate() error { 535 return m.validate(false) 536 } 537 538 // ValidateAll checks the field values on Poke with the rules defined in the 539 // proto definition for this message. If any rules are violated, the result is 540 // a list of violation errors wrapped in PokeMultiError, or nil if none found. 541 func (m *Poke) ValidateAll() error { 542 return m.validate(true) 543 } 544 545 func (m *Poke) validate(all bool) error { 546 if m == nil { 547 return nil 548 } 549 550 var errors []error 551 552 if len(errors) > 0 { 553 return PokeMultiError(errors) 554 } 555 556 return nil 557 } 558 559 // PokeMultiError is an error wrapping multiple validation errors returned by 560 // Poke.ValidateAll() if the designated constraints aren't met. 561 type PokeMultiError []error 562 563 // Error returns a concatenation of all the error messages it wraps. 564 func (m PokeMultiError) Error() string { 565 var msgs []string 566 for _, err := range m { 567 msgs = append(msgs, err.Error()) 568 } 569 return strings.Join(msgs, "; ") 570 } 571 572 // AllErrors returns a list of validation violation errors. 573 func (m PokeMultiError) AllErrors() []error { return m } 574 575 // PokeValidationError is the validation error returned by Poke.Validate if the 576 // designated constraints aren't met. 577 type PokeValidationError struct { 578 field string 579 reason string 580 cause error 581 key bool 582 } 583 584 // Field function returns field value. 585 func (e PokeValidationError) Field() string { return e.field } 586 587 // Reason function returns reason value. 588 func (e PokeValidationError) Reason() string { return e.reason } 589 590 // Cause function returns cause value. 591 func (e PokeValidationError) Cause() error { return e.cause } 592 593 // Key function returns key value. 594 func (e PokeValidationError) Key() bool { return e.key } 595 596 // ErrorName returns error name. 597 func (e PokeValidationError) ErrorName() string { return "PokeValidationError" } 598 599 // Error satisfies the builtin error interface 600 func (e PokeValidationError) Error() string { 601 cause := "" 602 if e.cause != nil { 603 cause = fmt.Sprintf(" | caused by: %v", e.cause) 604 } 605 606 key := "" 607 if e.key { 608 key = "key for " 609 } 610 611 return fmt.Sprintf( 612 "invalid %sPoke.%s: %s%s", 613 key, 614 e.field, 615 e.reason, 616 cause) 617 } 618 619 var _ error = PokeValidationError{} 620 621 var _ interface { 622 Field() string 623 Reason() string 624 Key() bool 625 Cause() error 626 ErrorName() string 627 } = PokeValidationError{} 628 629 // Validate checks the field values on RunCreated with the rules defined in the 630 // proto definition for this message. If any rules are violated, the first 631 // error encountered is returned, or nil if there are no violations. 632 func (m *RunCreated) Validate() error { 633 return m.validate(false) 634 } 635 636 // ValidateAll checks the field values on RunCreated with the rules defined in 637 // the proto definition for this message. If any rules are violated, the 638 // result is a list of violation errors wrapped in RunCreatedMultiError, or 639 // nil if none found. 640 func (m *RunCreated) ValidateAll() error { 641 return m.validate(true) 642 } 643 644 func (m *RunCreated) validate(all bool) error { 645 if m == nil { 646 return nil 647 } 648 649 var errors []error 650 651 // no validation rules for RunId 652 653 if len(errors) > 0 { 654 return RunCreatedMultiError(errors) 655 } 656 657 return nil 658 } 659 660 // RunCreatedMultiError is an error wrapping multiple validation errors 661 // returned by RunCreated.ValidateAll() if the designated constraints aren't met. 662 type RunCreatedMultiError []error 663 664 // Error returns a concatenation of all the error messages it wraps. 665 func (m RunCreatedMultiError) Error() string { 666 var msgs []string 667 for _, err := range m { 668 msgs = append(msgs, err.Error()) 669 } 670 return strings.Join(msgs, "; ") 671 } 672 673 // AllErrors returns a list of validation violation errors. 674 func (m RunCreatedMultiError) AllErrors() []error { return m } 675 676 // RunCreatedValidationError is the validation error returned by 677 // RunCreated.Validate if the designated constraints aren't met. 678 type RunCreatedValidationError struct { 679 field string 680 reason string 681 cause error 682 key bool 683 } 684 685 // Field function returns field value. 686 func (e RunCreatedValidationError) Field() string { return e.field } 687 688 // Reason function returns reason value. 689 func (e RunCreatedValidationError) Reason() string { return e.reason } 690 691 // Cause function returns cause value. 692 func (e RunCreatedValidationError) Cause() error { return e.cause } 693 694 // Key function returns key value. 695 func (e RunCreatedValidationError) Key() bool { return e.key } 696 697 // ErrorName returns error name. 698 func (e RunCreatedValidationError) ErrorName() string { return "RunCreatedValidationError" } 699 700 // Error satisfies the builtin error interface 701 func (e RunCreatedValidationError) Error() string { 702 cause := "" 703 if e.cause != nil { 704 cause = fmt.Sprintf(" | caused by: %v", e.cause) 705 } 706 707 key := "" 708 if e.key { 709 key = "key for " 710 } 711 712 return fmt.Sprintf( 713 "invalid %sRunCreated.%s: %s%s", 714 key, 715 e.field, 716 e.reason, 717 cause) 718 } 719 720 var _ error = RunCreatedValidationError{} 721 722 var _ interface { 723 Field() string 724 Reason() string 725 Key() bool 726 Cause() error 727 ErrorName() string 728 } = RunCreatedValidationError{} 729 730 // Validate checks the field values on RunFinished with the rules defined in 731 // the proto definition for this message. If any rules are violated, the first 732 // error encountered is returned, or nil if there are no violations. 733 func (m *RunFinished) Validate() error { 734 return m.validate(false) 735 } 736 737 // ValidateAll checks the field values on RunFinished with the rules defined in 738 // the proto definition for this message. If any rules are violated, the 739 // result is a list of violation errors wrapped in RunFinishedMultiError, or 740 // nil if none found. 741 func (m *RunFinished) ValidateAll() error { 742 return m.validate(true) 743 } 744 745 func (m *RunFinished) validate(all bool) error { 746 if m == nil { 747 return nil 748 } 749 750 var errors []error 751 752 // no validation rules for RunId 753 754 // no validation rules for Status 755 756 if len(errors) > 0 { 757 return RunFinishedMultiError(errors) 758 } 759 760 return nil 761 } 762 763 // RunFinishedMultiError is an error wrapping multiple validation errors 764 // returned by RunFinished.ValidateAll() if the designated constraints aren't met. 765 type RunFinishedMultiError []error 766 767 // Error returns a concatenation of all the error messages it wraps. 768 func (m RunFinishedMultiError) Error() string { 769 var msgs []string 770 for _, err := range m { 771 msgs = append(msgs, err.Error()) 772 } 773 return strings.Join(msgs, "; ") 774 } 775 776 // AllErrors returns a list of validation violation errors. 777 func (m RunFinishedMultiError) AllErrors() []error { return m } 778 779 // RunFinishedValidationError is the validation error returned by 780 // RunFinished.Validate if the designated constraints aren't met. 781 type RunFinishedValidationError struct { 782 field string 783 reason string 784 cause error 785 key bool 786 } 787 788 // Field function returns field value. 789 func (e RunFinishedValidationError) Field() string { return e.field } 790 791 // Reason function returns reason value. 792 func (e RunFinishedValidationError) Reason() string { return e.reason } 793 794 // Cause function returns cause value. 795 func (e RunFinishedValidationError) Cause() error { return e.cause } 796 797 // Key function returns key value. 798 func (e RunFinishedValidationError) Key() bool { return e.key } 799 800 // ErrorName returns error name. 801 func (e RunFinishedValidationError) ErrorName() string { return "RunFinishedValidationError" } 802 803 // Error satisfies the builtin error interface 804 func (e RunFinishedValidationError) Error() string { 805 cause := "" 806 if e.cause != nil { 807 cause = fmt.Sprintf(" | caused by: %v", e.cause) 808 } 809 810 key := "" 811 if e.key { 812 key = "key for " 813 } 814 815 return fmt.Sprintf( 816 "invalid %sRunFinished.%s: %s%s", 817 key, 818 e.field, 819 e.reason, 820 cause) 821 } 822 823 var _ error = RunFinishedValidationError{} 824 825 var _ interface { 826 Field() string 827 Reason() string 828 Key() bool 829 Cause() error 830 ErrorName() string 831 } = RunFinishedValidationError{} 832 833 // Validate checks the field values on PurgeCompleted with the rules defined in 834 // the proto definition for this message. If any rules are violated, the first 835 // error encountered is returned, or nil if there are no violations. 836 func (m *PurgeCompleted) Validate() error { 837 return m.validate(false) 838 } 839 840 // ValidateAll checks the field values on PurgeCompleted with the rules defined 841 // in the proto definition for this message. If any rules are violated, the 842 // result is a list of violation errors wrapped in PurgeCompletedMultiError, 843 // or nil if none found. 844 func (m *PurgeCompleted) ValidateAll() error { 845 return m.validate(true) 846 } 847 848 func (m *PurgeCompleted) validate(all bool) error { 849 if m == nil { 850 return nil 851 } 852 853 var errors []error 854 855 // no validation rules for OperationId 856 857 // no validation rules for Clid 858 859 if len(errors) > 0 { 860 return PurgeCompletedMultiError(errors) 861 } 862 863 return nil 864 } 865 866 // PurgeCompletedMultiError is an error wrapping multiple validation errors 867 // returned by PurgeCompleted.ValidateAll() if the designated constraints 868 // aren't met. 869 type PurgeCompletedMultiError []error 870 871 // Error returns a concatenation of all the error messages it wraps. 872 func (m PurgeCompletedMultiError) Error() string { 873 var msgs []string 874 for _, err := range m { 875 msgs = append(msgs, err.Error()) 876 } 877 return strings.Join(msgs, "; ") 878 } 879 880 // AllErrors returns a list of validation violation errors. 881 func (m PurgeCompletedMultiError) AllErrors() []error { return m } 882 883 // PurgeCompletedValidationError is the validation error returned by 884 // PurgeCompleted.Validate if the designated constraints aren't met. 885 type PurgeCompletedValidationError struct { 886 field string 887 reason string 888 cause error 889 key bool 890 } 891 892 // Field function returns field value. 893 func (e PurgeCompletedValidationError) Field() string { return e.field } 894 895 // Reason function returns reason value. 896 func (e PurgeCompletedValidationError) Reason() string { return e.reason } 897 898 // Cause function returns cause value. 899 func (e PurgeCompletedValidationError) Cause() error { return e.cause } 900 901 // Key function returns key value. 902 func (e PurgeCompletedValidationError) Key() bool { return e.key } 903 904 // ErrorName returns error name. 905 func (e PurgeCompletedValidationError) ErrorName() string { return "PurgeCompletedValidationError" } 906 907 // Error satisfies the builtin error interface 908 func (e PurgeCompletedValidationError) Error() string { 909 cause := "" 910 if e.cause != nil { 911 cause = fmt.Sprintf(" | caused by: %v", e.cause) 912 } 913 914 key := "" 915 if e.key { 916 key = "key for " 917 } 918 919 return fmt.Sprintf( 920 "invalid %sPurgeCompleted.%s: %s%s", 921 key, 922 e.field, 923 e.reason, 924 cause) 925 } 926 927 var _ error = PurgeCompletedValidationError{} 928 929 var _ interface { 930 Field() string 931 Reason() string 932 Key() bool 933 Cause() error 934 ErrorName() string 935 } = PurgeCompletedValidationError{} 936 937 // Validate checks the field values on TriggeringCLDepsCompleted with the rules 938 // defined in the proto definition for this message. If any rules are 939 // violated, the first error encountered is returned, or nil if there are no violations. 940 func (m *TriggeringCLDepsCompleted) Validate() error { 941 return m.validate(false) 942 } 943 944 // ValidateAll checks the field values on TriggeringCLDepsCompleted with the 945 // rules defined in the proto definition for this message. If any rules are 946 // violated, the result is a list of violation errors wrapped in 947 // TriggeringCLDepsCompletedMultiError, or nil if none found. 948 func (m *TriggeringCLDepsCompleted) ValidateAll() error { 949 return m.validate(true) 950 } 951 952 func (m *TriggeringCLDepsCompleted) validate(all bool) error { 953 if m == nil { 954 return nil 955 } 956 957 var errors []error 958 959 // no validation rules for OperationId 960 961 // no validation rules for Origin 962 963 for idx, item := range m.GetFailed() { 964 _, _ = idx, item 965 966 if all { 967 switch v := interface{}(item).(type) { 968 case interface{ ValidateAll() error }: 969 if err := v.ValidateAll(); err != nil { 970 errors = append(errors, TriggeringCLDepsCompletedValidationError{ 971 field: fmt.Sprintf("Failed[%v]", idx), 972 reason: "embedded message failed validation", 973 cause: err, 974 }) 975 } 976 case interface{ Validate() error }: 977 if err := v.Validate(); err != nil { 978 errors = append(errors, TriggeringCLDepsCompletedValidationError{ 979 field: fmt.Sprintf("Failed[%v]", idx), 980 reason: "embedded message failed validation", 981 cause: err, 982 }) 983 } 984 } 985 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 986 if err := v.Validate(); err != nil { 987 return TriggeringCLDepsCompletedValidationError{ 988 field: fmt.Sprintf("Failed[%v]", idx), 989 reason: "embedded message failed validation", 990 cause: err, 991 } 992 } 993 } 994 995 } 996 997 if len(errors) > 0 { 998 return TriggeringCLDepsCompletedMultiError(errors) 999 } 1000 1001 return nil 1002 } 1003 1004 // TriggeringCLDepsCompletedMultiError is an error wrapping multiple validation 1005 // errors returned by TriggeringCLDepsCompleted.ValidateAll() if the 1006 // designated constraints aren't met. 1007 type TriggeringCLDepsCompletedMultiError []error 1008 1009 // Error returns a concatenation of all the error messages it wraps. 1010 func (m TriggeringCLDepsCompletedMultiError) Error() string { 1011 var msgs []string 1012 for _, err := range m { 1013 msgs = append(msgs, err.Error()) 1014 } 1015 return strings.Join(msgs, "; ") 1016 } 1017 1018 // AllErrors returns a list of validation violation errors. 1019 func (m TriggeringCLDepsCompletedMultiError) AllErrors() []error { return m } 1020 1021 // TriggeringCLDepsCompletedValidationError is the validation error returned by 1022 // TriggeringCLDepsCompleted.Validate if the designated constraints aren't met. 1023 type TriggeringCLDepsCompletedValidationError struct { 1024 field string 1025 reason string 1026 cause error 1027 key bool 1028 } 1029 1030 // Field function returns field value. 1031 func (e TriggeringCLDepsCompletedValidationError) Field() string { return e.field } 1032 1033 // Reason function returns reason value. 1034 func (e TriggeringCLDepsCompletedValidationError) Reason() string { return e.reason } 1035 1036 // Cause function returns cause value. 1037 func (e TriggeringCLDepsCompletedValidationError) Cause() error { return e.cause } 1038 1039 // Key function returns key value. 1040 func (e TriggeringCLDepsCompletedValidationError) Key() bool { return e.key } 1041 1042 // ErrorName returns error name. 1043 func (e TriggeringCLDepsCompletedValidationError) ErrorName() string { 1044 return "TriggeringCLDepsCompletedValidationError" 1045 } 1046 1047 // Error satisfies the builtin error interface 1048 func (e TriggeringCLDepsCompletedValidationError) Error() string { 1049 cause := "" 1050 if e.cause != nil { 1051 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1052 } 1053 1054 key := "" 1055 if e.key { 1056 key = "key for " 1057 } 1058 1059 return fmt.Sprintf( 1060 "invalid %sTriggeringCLDepsCompleted.%s: %s%s", 1061 key, 1062 e.field, 1063 e.reason, 1064 cause) 1065 } 1066 1067 var _ error = TriggeringCLDepsCompletedValidationError{} 1068 1069 var _ interface { 1070 Field() string 1071 Reason() string 1072 Key() bool 1073 Cause() error 1074 ErrorName() string 1075 } = TriggeringCLDepsCompletedValidationError{}