| 500 | |
| 501 | |
| 502 | Option<Error> validateCheckStatusInfo(const CheckStatusInfo& checkStatusInfo) |
| 503 | { |
| 504 | if (!checkStatusInfo.has_type()) { |
| 505 | return Error("CheckStatusInfo must specify 'type'"); |
| 506 | } |
| 507 | |
| 508 | switch (checkStatusInfo.type()) { |
| 509 | case CheckInfo::COMMAND: { |
| 510 | if (!checkStatusInfo.has_command()) { |
| 511 | return Error( |
| 512 | "Expecting 'command' to be set for COMMAND check's status"); |
| 513 | } |
| 514 | break; |
| 515 | } |
| 516 | case CheckInfo::HTTP: { |
| 517 | if (!checkStatusInfo.has_http()) { |
| 518 | return Error("Expecting 'http' to be set for HTTP check's status"); |
| 519 | } |
| 520 | break; |
| 521 | } |
| 522 | case CheckInfo::TCP: { |
| 523 | if (!checkStatusInfo.has_tcp()) { |
| 524 | return Error("Expecting 'tcp' to be set for TCP check's status"); |
| 525 | } |
| 526 | break; |
| 527 | } |
| 528 | case CheckInfo::UNKNOWN: { |
| 529 | return Error( |
| 530 | "'" + CheckInfo::Type_Name(checkStatusInfo.type()) + "'" |
| 531 | " is not a valid check's status type"); |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | return None(); |
| 536 | } |
| 537 | |
| 538 | Option<Error> validateExecutorCall(const mesos::executor::Call& call) |
| 539 | { |