//////////////////////////// 来电者Lambda函数:/// /////////////////////////
df <- structure(list(Groups = c("G1", "G1", "G1", "G1", "G2", "G2",
"G2"), Name = c("A", "A", "B", "B", "A", "C", "C"), Category =
c("cat1", "cat2", "cat3", "cat3", "cat4", "cat2", "cat2"), value =
c(20L, 1L, 21L, 23L, 32L, 23L, 21L)), class = "data.frame", row.names =
c(NA, -7L))
//////////////////////////// Callee Lambda函数:/// /////////////////////////
var AWS = require('aws-sdk');
AWS.config.region = 'us-west-2';
var lambda = new AWS.Lambda();
exports.handler = function(event, context) {
var data = {
message : event.message
}
var datapayload = JSON.stringify(data);
var params = {
FunctionName: 'Translator', // the lambda function we are going to invoke
InvocationType: 'RequestResponse',
LogType: 'None',
Payload: datapayload
};
var pullResults;
lambda.invoke(params, function(err, data) {
if (err) {
//context.fail(err);
prompt(err);
} else {
pullResults = JSON.parse(data.Payload);
console.log(pullResults.name);
// prompt(pullResults.isWinner);
//context.succeed(data.Payload);
}
})
const response = {
statusCode: 200,
body: JSON.stringify("12"),
};
return response;
};