-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandler.cpp
More file actions
27 lines (22 loc) · 941 Bytes
/
handler.cpp
File metadata and controls
27 lines (22 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <aws/lambda-runtime/runtime.h>
#include <iostream>
#include <boost/json/src.hpp>
#include "src/auth/include/OauthManager.h"
using namespace aws::lambda_runtime;
static invocation_response my_handler(invocation_request const& req) {
webutil::OauthManager oauth_manager;
std::string json_string = req.payload;
auto value = boost::json::parse(json_string, boost::json::error_code{});
auto target = value.at("queryStringParameters").at("code");
std::cerr << target.as_string() << std::endl;
if (req.payload.length() > 42) {
return invocation_response::failure("error message here"/*error_message*/,
"error type here" /*error_type*/);
}
return invocation_response::success("json payload here" /*payload*/,
"application/json" /*MIME type*/);
}
int main() {
run_handler(my_handler);
return 0;
}