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

Method attachContainerInput

src/slave/http.cpp:3974–4025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3972
3973
3974Future<Response> Http::attachContainerInput(
3975 const mesos::agent::Call& call,
3976 Owned<Reader<mesos::agent::Call>>&& decoder,
3977 const RequestMediaTypes& mediaTypes,
3978 const Option<Principal>& principal) const
3979{
3980 CHECK_EQ(mesos::agent::Call::ATTACH_CONTAINER_INPUT, call.type());
3981 CHECK(call.has_attach_container_input());
3982
3983 if (call.attach_container_input().type() !=
3984 mesos::agent::Call::AttachContainerInput::CONTAINER_ID) {
3985 return BadRequest(
3986 "Expecting 'attach_container_input.type' to be CONTAINER_ID");
3987 }
3988
3989 CHECK(call.attach_container_input().has_container_id());
3990
3991 LOG(INFO) << "Processing ATTACH_CONTAINER_INPUT call for container '"
3992 << call.attach_container_input().container_id() << "'";
3993
3994 return ObjectApprovers::create(
3995 slave->authorizer,
3996 principal,
3997 {ATTACH_CONTAINER_INPUT})
3998 .then(defer(
3999 slave->self(),
4000 [this, call, decoder, mediaTypes](
4001 const Owned<ObjectApprovers>& approvers) -> Future<Response> {
4002 const ContainerID& containerId =
4003 call.attach_container_input().container_id();
4004
4005 Executor* executor = slave->getExecutor(containerId);
4006 if (executor == nullptr) {
4007 return NotFound(
4008 "Container " + stringify(containerId) + " cannot be found");
4009 }
4010
4011 Framework* framework = slave->getFramework(executor->frameworkId);
4012 CHECK_NOTNULL(framework);
4013
4014 if (!approvers->approved<ATTACH_CONTAINER_INPUT>(
4015 executor->info,
4016 framework->info)) {
4017 return Forbidden();
4018 }
4019
4020 Owned<Reader<mesos::agent::Call>> decoder_ = decoder;
4021
4022 return _attachContainerInput(
4023 call, std::move(decoder_), mediaTypes);
4024 }));
4025}
4026
4027
4028Future<Response> Http::addResourceProviderConfig(

Callers

nothing calls this directly

Calls 11

BadRequestClass · 0.85
deferFunction · 0.85
NotFoundClass · 0.85
ForbiddenClass · 0.85
typeMethod · 0.80
getExecutorMethod · 0.80
createFunction · 0.50
stringifyFunction · 0.50
thenMethod · 0.45
selfMethod · 0.45
getFrameworkMethod · 0.45

Tested by

no test coverage detected