MCPcopy Create free account
hub / github.com/apache/mesos / quota

Method quota

src/master/http.cpp:2098–2133  ·  view source on GitHub ↗

Deprecated in favor of v1 UPDATE_QUOTA and GET_QUOTA.

Source from the content-addressed store, hash-verified

2096
2097// Deprecated in favor of v1 UPDATE_QUOTA and GET_QUOTA.
2098Future<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
2136string Master::Http::WEIGHTS_HELP()

Callers 4

TESTFunction · 0.80
initializeMethod · 0.80
foreachFunction · 0.80
hierarchical.cppFile · 0.80

Calls 9

ForbiddenClass · 0.85
redirectFunction · 0.85
MethodNotAllowedClass · 0.85
electedMethod · 0.80
isSomeMethod · 0.45
isNoneMethod · 0.45
statusMethod · 0.45
setMethod · 0.45
removeMethod · 0.45

Tested by 1

TESTFunction · 0.64