go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/cv/api/v0/run.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: go.chromium.org/luci/cv/api/v0/run.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 Run with the rules defined in the proto 39 // definition for this message. If any rules are violated, the first error 40 // encountered is returned, or nil if there are no violations. 41 func (m *Run) Validate() error { 42 return m.validate(false) 43 } 44 45 // ValidateAll checks the field values on Run 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 RunMultiError, or nil if none found. 48 func (m *Run) ValidateAll() error { 49 return m.validate(true) 50 } 51 52 func (m *Run) validate(all bool) error { 53 if m == nil { 54 return nil 55 } 56 57 var errors []error 58 59 // no validation rules for Id 60 61 // no validation rules for Status 62 63 // no validation rules for Eversion 64 65 // no validation rules for Mode 66 67 if all { 68 switch v := interface{}(m.GetCreateTime()).(type) { 69 case interface{ ValidateAll() error }: 70 if err := v.ValidateAll(); err != nil { 71 errors = append(errors, RunValidationError{ 72 field: "CreateTime", 73 reason: "embedded message failed validation", 74 cause: err, 75 }) 76 } 77 case interface{ Validate() error }: 78 if err := v.Validate(); err != nil { 79 errors = append(errors, RunValidationError{ 80 field: "CreateTime", 81 reason: "embedded message failed validation", 82 cause: err, 83 }) 84 } 85 } 86 } else if v, ok := interface{}(m.GetCreateTime()).(interface{ Validate() error }); ok { 87 if err := v.Validate(); err != nil { 88 return RunValidationError{ 89 field: "CreateTime", 90 reason: "embedded message failed validation", 91 cause: err, 92 } 93 } 94 } 95 96 if all { 97 switch v := interface{}(m.GetStartTime()).(type) { 98 case interface{ ValidateAll() error }: 99 if err := v.ValidateAll(); err != nil { 100 errors = append(errors, RunValidationError{ 101 field: "StartTime", 102 reason: "embedded message failed validation", 103 cause: err, 104 }) 105 } 106 case interface{ Validate() error }: 107 if err := v.Validate(); err != nil { 108 errors = append(errors, RunValidationError{ 109 field: "StartTime", 110 reason: "embedded message failed validation", 111 cause: err, 112 }) 113 } 114 } 115 } else if v, ok := interface{}(m.GetStartTime()).(interface{ Validate() error }); ok { 116 if err := v.Validate(); err != nil { 117 return RunValidationError{ 118 field: "StartTime", 119 reason: "embedded message failed validation", 120 cause: err, 121 } 122 } 123 } 124 125 if all { 126 switch v := interface{}(m.GetUpdateTime()).(type) { 127 case interface{ ValidateAll() error }: 128 if err := v.ValidateAll(); err != nil { 129 errors = append(errors, RunValidationError{ 130 field: "UpdateTime", 131 reason: "embedded message failed validation", 132 cause: err, 133 }) 134 } 135 case interface{ Validate() error }: 136 if err := v.Validate(); err != nil { 137 errors = append(errors, RunValidationError{ 138 field: "UpdateTime", 139 reason: "embedded message failed validation", 140 cause: err, 141 }) 142 } 143 } 144 } else if v, ok := interface{}(m.GetUpdateTime()).(interface{ Validate() error }); ok { 145 if err := v.Validate(); err != nil { 146 return RunValidationError{ 147 field: "UpdateTime", 148 reason: "embedded message failed validation", 149 cause: err, 150 } 151 } 152 } 153 154 if all { 155 switch v := interface{}(m.GetEndTime()).(type) { 156 case interface{ ValidateAll() error }: 157 if err := v.ValidateAll(); err != nil { 158 errors = append(errors, RunValidationError{ 159 field: "EndTime", 160 reason: "embedded message failed validation", 161 cause: err, 162 }) 163 } 164 case interface{ Validate() error }: 165 if err := v.Validate(); err != nil { 166 errors = append(errors, RunValidationError{ 167 field: "EndTime", 168 reason: "embedded message failed validation", 169 cause: err, 170 }) 171 } 172 } 173 } else if v, ok := interface{}(m.GetEndTime()).(interface{ Validate() error }); ok { 174 if err := v.Validate(); err != nil { 175 return RunValidationError{ 176 field: "EndTime", 177 reason: "embedded message failed validation", 178 cause: err, 179 } 180 } 181 } 182 183 // no validation rules for Owner 184 185 // no validation rules for CreatedBy 186 187 // no validation rules for BilledTo 188 189 for idx, item := range m.GetCls() { 190 _, _ = idx, item 191 192 if all { 193 switch v := interface{}(item).(type) { 194 case interface{ ValidateAll() error }: 195 if err := v.ValidateAll(); err != nil { 196 errors = append(errors, RunValidationError{ 197 field: fmt.Sprintf("Cls[%v]", idx), 198 reason: "embedded message failed validation", 199 cause: err, 200 }) 201 } 202 case interface{ Validate() error }: 203 if err := v.Validate(); err != nil { 204 errors = append(errors, RunValidationError{ 205 field: fmt.Sprintf("Cls[%v]", idx), 206 reason: "embedded message failed validation", 207 cause: err, 208 }) 209 } 210 } 211 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 212 if err := v.Validate(); err != nil { 213 return RunValidationError{ 214 field: fmt.Sprintf("Cls[%v]", idx), 215 reason: "embedded message failed validation", 216 cause: err, 217 } 218 } 219 } 220 221 } 222 223 for idx, item := range m.GetTryjobs() { 224 _, _ = idx, item 225 226 if all { 227 switch v := interface{}(item).(type) { 228 case interface{ ValidateAll() error }: 229 if err := v.ValidateAll(); err != nil { 230 errors = append(errors, RunValidationError{ 231 field: fmt.Sprintf("Tryjobs[%v]", idx), 232 reason: "embedded message failed validation", 233 cause: err, 234 }) 235 } 236 case interface{ Validate() error }: 237 if err := v.Validate(); err != nil { 238 errors = append(errors, RunValidationError{ 239 field: fmt.Sprintf("Tryjobs[%v]", idx), 240 reason: "embedded message failed validation", 241 cause: err, 242 }) 243 } 244 } 245 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 246 if err := v.Validate(); err != nil { 247 return RunValidationError{ 248 field: fmt.Sprintf("Tryjobs[%v]", idx), 249 reason: "embedded message failed validation", 250 cause: err, 251 } 252 } 253 } 254 255 } 256 257 for idx, item := range m.GetTryjobInvocations() { 258 _, _ = idx, item 259 260 if all { 261 switch v := interface{}(item).(type) { 262 case interface{ ValidateAll() error }: 263 if err := v.ValidateAll(); err != nil { 264 errors = append(errors, RunValidationError{ 265 field: fmt.Sprintf("TryjobInvocations[%v]", idx), 266 reason: "embedded message failed validation", 267 cause: err, 268 }) 269 } 270 case interface{ Validate() error }: 271 if err := v.Validate(); err != nil { 272 errors = append(errors, RunValidationError{ 273 field: fmt.Sprintf("TryjobInvocations[%v]", idx), 274 reason: "embedded message failed validation", 275 cause: err, 276 }) 277 } 278 } 279 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 280 if err := v.Validate(); err != nil { 281 return RunValidationError{ 282 field: fmt.Sprintf("TryjobInvocations[%v]", idx), 283 reason: "embedded message failed validation", 284 cause: err, 285 } 286 } 287 } 288 289 } 290 291 if all { 292 switch v := interface{}(m.GetSubmission()).(type) { 293 case interface{ ValidateAll() error }: 294 if err := v.ValidateAll(); err != nil { 295 errors = append(errors, RunValidationError{ 296 field: "Submission", 297 reason: "embedded message failed validation", 298 cause: err, 299 }) 300 } 301 case interface{ Validate() error }: 302 if err := v.Validate(); err != nil { 303 errors = append(errors, RunValidationError{ 304 field: "Submission", 305 reason: "embedded message failed validation", 306 cause: err, 307 }) 308 } 309 } 310 } else if v, ok := interface{}(m.GetSubmission()).(interface{ Validate() error }); ok { 311 if err := v.Validate(); err != nil { 312 return RunValidationError{ 313 field: "Submission", 314 reason: "embedded message failed validation", 315 cause: err, 316 } 317 } 318 } 319 320 if len(errors) > 0 { 321 return RunMultiError(errors) 322 } 323 324 return nil 325 } 326 327 // RunMultiError is an error wrapping multiple validation errors returned by 328 // Run.ValidateAll() if the designated constraints aren't met. 329 type RunMultiError []error 330 331 // Error returns a concatenation of all the error messages it wraps. 332 func (m RunMultiError) Error() string { 333 var msgs []string 334 for _, err := range m { 335 msgs = append(msgs, err.Error()) 336 } 337 return strings.Join(msgs, "; ") 338 } 339 340 // AllErrors returns a list of validation violation errors. 341 func (m RunMultiError) AllErrors() []error { return m } 342 343 // RunValidationError is the validation error returned by Run.Validate if the 344 // designated constraints aren't met. 345 type RunValidationError struct { 346 field string 347 reason string 348 cause error 349 key bool 350 } 351 352 // Field function returns field value. 353 func (e RunValidationError) Field() string { return e.field } 354 355 // Reason function returns reason value. 356 func (e RunValidationError) Reason() string { return e.reason } 357 358 // Cause function returns cause value. 359 func (e RunValidationError) Cause() error { return e.cause } 360 361 // Key function returns key value. 362 func (e RunValidationError) Key() bool { return e.key } 363 364 // ErrorName returns error name. 365 func (e RunValidationError) ErrorName() string { return "RunValidationError" } 366 367 // Error satisfies the builtin error interface 368 func (e RunValidationError) Error() string { 369 cause := "" 370 if e.cause != nil { 371 cause = fmt.Sprintf(" | caused by: %v", e.cause) 372 } 373 374 key := "" 375 if e.key { 376 key = "key for " 377 } 378 379 return fmt.Sprintf( 380 "invalid %sRun.%s: %s%s", 381 key, 382 e.field, 383 e.reason, 384 cause) 385 } 386 387 var _ error = RunValidationError{} 388 389 var _ interface { 390 Field() string 391 Reason() string 392 Key() bool 393 Cause() error 394 ErrorName() string 395 } = RunValidationError{} 396 397 // Validate checks the field values on GerritChange with the rules defined in 398 // the proto definition for this message. If any rules are violated, the first 399 // error encountered is returned, or nil if there are no violations. 400 func (m *GerritChange) Validate() error { 401 return m.validate(false) 402 } 403 404 // ValidateAll checks the field values on GerritChange with the rules defined 405 // in the proto definition for this message. If any rules are violated, the 406 // result is a list of violation errors wrapped in GerritChangeMultiError, or 407 // nil if none found. 408 func (m *GerritChange) ValidateAll() error { 409 return m.validate(true) 410 } 411 412 func (m *GerritChange) validate(all bool) error { 413 if m == nil { 414 return nil 415 } 416 417 var errors []error 418 419 // no validation rules for Host 420 421 // no validation rules for Change 422 423 // no validation rules for Patchset 424 425 if len(errors) > 0 { 426 return GerritChangeMultiError(errors) 427 } 428 429 return nil 430 } 431 432 // GerritChangeMultiError is an error wrapping multiple validation errors 433 // returned by GerritChange.ValidateAll() if the designated constraints aren't met. 434 type GerritChangeMultiError []error 435 436 // Error returns a concatenation of all the error messages it wraps. 437 func (m GerritChangeMultiError) Error() string { 438 var msgs []string 439 for _, err := range m { 440 msgs = append(msgs, err.Error()) 441 } 442 return strings.Join(msgs, "; ") 443 } 444 445 // AllErrors returns a list of validation violation errors. 446 func (m GerritChangeMultiError) AllErrors() []error { return m } 447 448 // GerritChangeValidationError is the validation error returned by 449 // GerritChange.Validate if the designated constraints aren't met. 450 type GerritChangeValidationError struct { 451 field string 452 reason string 453 cause error 454 key bool 455 } 456 457 // Field function returns field value. 458 func (e GerritChangeValidationError) Field() string { return e.field } 459 460 // Reason function returns reason value. 461 func (e GerritChangeValidationError) Reason() string { return e.reason } 462 463 // Cause function returns cause value. 464 func (e GerritChangeValidationError) Cause() error { return e.cause } 465 466 // Key function returns key value. 467 func (e GerritChangeValidationError) Key() bool { return e.key } 468 469 // ErrorName returns error name. 470 func (e GerritChangeValidationError) ErrorName() string { return "GerritChangeValidationError" } 471 472 // Error satisfies the builtin error interface 473 func (e GerritChangeValidationError) Error() string { 474 cause := "" 475 if e.cause != nil { 476 cause = fmt.Sprintf(" | caused by: %v", e.cause) 477 } 478 479 key := "" 480 if e.key { 481 key = "key for " 482 } 483 484 return fmt.Sprintf( 485 "invalid %sGerritChange.%s: %s%s", 486 key, 487 e.field, 488 e.reason, 489 cause) 490 } 491 492 var _ error = GerritChangeValidationError{} 493 494 var _ interface { 495 Field() string 496 Reason() string 497 Key() bool 498 Cause() error 499 ErrorName() string 500 } = GerritChangeValidationError{} 501 502 // Validate checks the field values on Run_Submission with the rules defined in 503 // the proto definition for this message. If any rules are violated, the first 504 // error encountered is returned, or nil if there are no violations. 505 func (m *Run_Submission) Validate() error { 506 return m.validate(false) 507 } 508 509 // ValidateAll checks the field values on Run_Submission with the rules defined 510 // in the proto definition for this message. If any rules are violated, the 511 // result is a list of violation errors wrapped in Run_SubmissionMultiError, 512 // or nil if none found. 513 func (m *Run_Submission) ValidateAll() error { 514 return m.validate(true) 515 } 516 517 func (m *Run_Submission) validate(all bool) error { 518 if m == nil { 519 return nil 520 } 521 522 var errors []error 523 524 if len(errors) > 0 { 525 return Run_SubmissionMultiError(errors) 526 } 527 528 return nil 529 } 530 531 // Run_SubmissionMultiError is an error wrapping multiple validation errors 532 // returned by Run_Submission.ValidateAll() if the designated constraints 533 // aren't met. 534 type Run_SubmissionMultiError []error 535 536 // Error returns a concatenation of all the error messages it wraps. 537 func (m Run_SubmissionMultiError) Error() string { 538 var msgs []string 539 for _, err := range m { 540 msgs = append(msgs, err.Error()) 541 } 542 return strings.Join(msgs, "; ") 543 } 544 545 // AllErrors returns a list of validation violation errors. 546 func (m Run_SubmissionMultiError) AllErrors() []error { return m } 547 548 // Run_SubmissionValidationError is the validation error returned by 549 // Run_Submission.Validate if the designated constraints aren't met. 550 type Run_SubmissionValidationError struct { 551 field string 552 reason string 553 cause error 554 key bool 555 } 556 557 // Field function returns field value. 558 func (e Run_SubmissionValidationError) Field() string { return e.field } 559 560 // Reason function returns reason value. 561 func (e Run_SubmissionValidationError) Reason() string { return e.reason } 562 563 // Cause function returns cause value. 564 func (e Run_SubmissionValidationError) Cause() error { return e.cause } 565 566 // Key function returns key value. 567 func (e Run_SubmissionValidationError) Key() bool { return e.key } 568 569 // ErrorName returns error name. 570 func (e Run_SubmissionValidationError) ErrorName() string { return "Run_SubmissionValidationError" } 571 572 // Error satisfies the builtin error interface 573 func (e Run_SubmissionValidationError) Error() string { 574 cause := "" 575 if e.cause != nil { 576 cause = fmt.Sprintf(" | caused by: %v", e.cause) 577 } 578 579 key := "" 580 if e.key { 581 key = "key for " 582 } 583 584 return fmt.Sprintf( 585 "invalid %sRun_Submission.%s: %s%s", 586 key, 587 e.field, 588 e.reason, 589 cause) 590 } 591 592 var _ error = Run_SubmissionValidationError{} 593 594 var _ interface { 595 Field() string 596 Reason() string 597 Key() bool 598 Cause() error 599 ErrorName() string 600 } = Run_SubmissionValidationError{}