| 1668 | |
| 1669 | |
| 1670 | Future<Response> Master::Http::setLoggingLevel( |
| 1671 | const mesos::master::Call& call, |
| 1672 | const Option<Principal>& principal, |
| 1673 | ContentType /*contentType*/) const |
| 1674 | { |
| 1675 | CHECK_EQ(mesos::master::Call::SET_LOGGING_LEVEL, call.type()); |
| 1676 | CHECK(call.has_set_logging_level()); |
| 1677 | |
| 1678 | uint32_t level = call.set_logging_level().level(); |
| 1679 | Duration duration = |
| 1680 | Nanoseconds(call.set_logging_level().duration().nanoseconds()); |
| 1681 | |
| 1682 | return ObjectApprovers::create(master->authorizer, principal, {SET_LOG_LEVEL}) |
| 1683 | .then([level, duration](const Owned<ObjectApprovers>& approvers) |
| 1684 | -> Future<Response> { |
| 1685 | if (!approvers->approved<SET_LOG_LEVEL>()) { |
| 1686 | return Forbidden(); |
| 1687 | } |
| 1688 | |
| 1689 | return dispatch(process::logging(), &Logging::set_level, level, duration) |
| 1690 | .then([]() -> Response { |
| 1691 | return OK(); |
| 1692 | }); |
| 1693 | }); |
| 1694 | } |
| 1695 | |
| 1696 | |
| 1697 | Future<Response> Master::Http::getMaster( |