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