| 1148 | |
| 1149 | |
| 1150 | Future<Response> Http::setLoggingLevel( |
| 1151 | const mesos::agent::Call& call, |
| 1152 | ContentType /*contentType*/, |
| 1153 | const Option<Principal>& principal) const |
| 1154 | { |
| 1155 | CHECK_EQ(mesos::agent::Call::SET_LOGGING_LEVEL, call.type()); |
| 1156 | CHECK(call.has_set_logging_level()); |
| 1157 | |
| 1158 | uint32_t level = call.set_logging_level().level(); |
| 1159 | Duration duration = |
| 1160 | Nanoseconds(call.set_logging_level().duration().nanoseconds()); |
| 1161 | |
| 1162 | LOG(INFO) << "Processing SET_LOGGING_LEVEL call for level " << level; |
| 1163 | |
| 1164 | return ObjectApprovers::create(slave->authorizer, principal, {SET_LOG_LEVEL}) |
| 1165 | .then([level, duration]( |
| 1166 | const Owned<ObjectApprovers>& approvers) -> Future<Response> { |
| 1167 | if (!approvers->approved<SET_LOG_LEVEL>()) { |
| 1168 | return Forbidden(); |
| 1169 | } |
| 1170 | |
| 1171 | return dispatch(process::logging(), &Logging::set_level, level, duration) |
| 1172 | .then([]() -> Response { |
| 1173 | return OK(); |
| 1174 | }); |
| 1175 | }); |
| 1176 | } |
| 1177 | |
| 1178 | |
| 1179 | Future<Response> Http::listFiles( |