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

Method updateResourceProviderConfig

src/slave/http.cpp:4072–4116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4070
4071
4072Future<Response> Http::updateResourceProviderConfig(
4073 const mesos::agent::Call& call,
4074 const Option<Principal>& principal) const
4075{
4076 CHECK_EQ(mesos::agent::Call::UPDATE_RESOURCE_PROVIDER_CONFIG, call.type());
4077 CHECK(call.has_update_resource_provider_config());
4078
4079 const ResourceProviderInfo& info =
4080 call.update_resource_provider_config().info();
4081
4082 LOG(INFO)
4083 << "Processing UPDATE_RESOURCE_PROVIDER_CONFIG call with"
4084 << " type '" << info.type() << "' and name '" << info.name() << "'";
4085
4086 return ObjectApprovers::create(
4087 slave->authorizer,
4088 principal,
4089 {MODIFY_RESOURCE_PROVIDER_CONFIG})
4090 .then(defer(
4091 slave->self(),
4092 [=](const Owned<ObjectApprovers>& approvers) -> Future<Response> {
4093 if (!approvers->approved<MODIFY_RESOURCE_PROVIDER_CONFIG>()) {
4094 return Forbidden();
4095 }
4096
4097 Option<Error> error = LocalResourceProvider::validate(info);
4098 if (error.isSome()) {
4099 return BadRequest(
4100 "Failed to validate resource provider config with type '" +
4101 info.type() + "' and name '" + info.name() + "': " +
4102 error->message);
4103 }
4104
4105 return slave->localResourceProviderDaemon->update(info)
4106 .then([info](bool updated) -> Response {
4107 if (!updated) {
4108 return Conflict(
4109 "Resource provider with type '" + info.type() +
4110 "' and name '" + info.name() + "' does not exist");
4111 }
4112
4113 return OK();
4114 });
4115 }));
4116}
4117
4118
4119Future<Response> Http::removeResourceProviderConfig(

Callers

nothing calls this directly

Calls 14

deferFunction · 0.85
ForbiddenClass · 0.85
BadRequestClass · 0.85
ConflictClass · 0.85
OKClass · 0.85
typeMethod · 0.80
infoMethod · 0.80
validateFunction · 0.70
createFunction · 0.50
nameMethod · 0.45
thenMethod · 0.45
selfMethod · 0.45

Tested by

no test coverage detected