| 34 | } |
| 35 | |
| 36 | int 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 */ |
| 56 | unsigned char awslogo_png[] = { // NOLINT |
nothing calls this directly
no test coverage detected