diff --git a/sdk/include/praas/sdk/praas.hpp b/sdk/include/praas/sdk/praas.hpp index 335cc99..74e6314 100644 --- a/sdk/include/praas/sdk/praas.hpp +++ b/sdk/include/praas/sdk/praas.hpp @@ -36,13 +36,17 @@ namespace praas::sdk { ControlPlaneInvocationResult invoke( const std::string& app_name, const std::string& function_name, const std::string& invocation_data, - std::optional process_name = std::nullopt + std::optional process_name = std::nullopt, + std::optional vcpus = std::nullopt, + std::optional memory = std::nullopt ); std::future invoke_async( const std::string& app_name, const std::string& function_name, const std::string& invocation_data, - std::optional process_name = std::nullopt + std::optional process_name = std::nullopt, + std::optional vcpus = std::nullopt, + std::optional memory = std::nullopt ); std::tuple swap_process(const Process& process); diff --git a/sdk/src/praas.cpp b/sdk/src/praas.cpp index 175dc58..db57375 100644 --- a/sdk/src/praas.cpp +++ b/sdk/src/praas.cpp @@ -200,15 +200,22 @@ namespace praas::sdk { ControlPlaneInvocationResult PraaS::invoke( const std::string& app_name, const std::string& function_name, - const std::string& invocation_data, std::optional process_name + const std::string& invocation_data, std::optional process_name, + std::optional vcpus, std::optional memory ) { - return invoke_async(app_name, function_name, invocation_data, std::move(process_name)).get(); + return invoke_async( + app_name, function_name, invocation_data, + std::move(process_name), + std::move(vcpus), + std::move(memory) + ).get(); } std::future PraaS::invoke_async( const std::string& app_name, const std::string& function_name, - const std::string& invocation_data, std::optional process_name + const std::string& invocation_data, std::optional process_name, + std::optional vcpus, std::optional memory ) { // We need a shared_ptr because we cannot move it to the lambda later @@ -223,6 +230,12 @@ namespace praas::sdk { if(process_name.has_value()) { req->setParameter("process_name", process_name.value()); } + if(vcpus.has_value()) { + req->setParameter("vcpus", vcpus.value()); + } + if(memory.has_value()) { + req->setParameter("memory", memory.value()); + } req->setContentTypeCode(drogon::ContentType::CT_APPLICATION_JSON); auto http_client = _get_client();