MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / main

Function main

tests/resources/lambda_function.cpp:36–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36int main(int argc, char* argv[])
37{
38 std::unordered_map<std::string, std::function<invocation_response(invocation_request const&)>> handlers;
39 handlers.emplace("echo_success", echo_success);
40 handlers.emplace("echo_failure", echo_failure);
41 handlers.emplace("binary_response", binary_response);
42 handlers.emplace("crash_backtrace", crash_backtrace);
43
44 // Read the handler from the environment variable
45 const char* handler_name = std::getenv("_HANDLER");
46 auto it = handlers.find(handler_name == nullptr ? "" : handler_name);
47 if (it == handlers.end()) {
48 aws::logging::log_error("lambda_fun", "Handler %s not found. Exiting.", argv[1]);
49 return -2;
50 }
51 run_handler(it->second);
52 return 0;
53}
54
55/* clang-format off */
56unsigned char awslogo_png[] = { // NOLINT

Callers

nothing calls this directly

Calls 3

log_errorFunction · 0.85
run_handlerFunction · 0.85
endMethod · 0.45

Tested by

no test coverage detected