Deprecated in favor of v1 UPDATE_QUOTA and GET_QUOTA.
| 2096 | |
| 2097 | // Deprecated in favor of v1 UPDATE_QUOTA and GET_QUOTA. |
| 2098 | Future<Response> Master::Http::quota( |
| 2099 | const Request& request, |
| 2100 | const Option<Principal>& principal) const |
| 2101 | { |
| 2102 | // TODO(greggomann): Remove this check once the `Principal` type is used in |
| 2103 | // `ReservationInfo`, `DiskInfo`, and within the master's `principals` map. |
| 2104 | // See MESOS-7202. |
| 2105 | if (principal.isSome() && principal->value.isNone()) { |
| 2106 | return Forbidden( |
| 2107 | "The request's authenticated principal contains claims, but no value " |
| 2108 | "string. The master currently requires that principals have a value"); |
| 2109 | } |
| 2110 | |
| 2111 | // When current master is not the leader, redirect to the leading master. |
| 2112 | if (!master->elected()) { |
| 2113 | return redirect(request); |
| 2114 | } |
| 2115 | |
| 2116 | // Dispatch based on HTTP method to separate `QuotaHandler`. |
| 2117 | if (request.method == "GET") { |
| 2118 | return quotaHandler.status(request, principal); |
| 2119 | } |
| 2120 | |
| 2121 | if (request.method == "POST") { |
| 2122 | return quotaHandler.set(request, principal); |
| 2123 | } |
| 2124 | |
| 2125 | if (request.method == "DELETE") { |
| 2126 | return quotaHandler.remove(request, principal); |
| 2127 | } |
| 2128 | |
| 2129 | // TODO(joerg84): Add update logic for PUT requests |
| 2130 | // once Quota supports updates. |
| 2131 | |
| 2132 | return MethodNotAllowed({"GET", "POST", "DELETE"}, request.method); |
| 2133 | } |
| 2134 | |
| 2135 | |
| 2136 | string Master::Http::WEIGHTS_HELP() |