Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 1x 1x 1x | var AWS = require('aws-sdk');
/**
*
*/
function LambdaService() {
this.lambda = new AWS.Lambda();
}
/**
*
* @param {*} functionName
* @param {*} payload
* @param {*} clientContext
* @param {*} invocationType
* @param {*} qualifier
* @param {*} callback
*/
LambdaService.prototype.lambdaInvoker = function (functionName, payload, clientContext, invocationType, qualifier, callback) {
this.functionName = functionName;
this.payload = payload;
this.clientContext = clientContext;
this.invocationType = invocationType;
this.qualifier = qualifier;
this.params = {
FunctionName: this.functionName, /* required */
InvocationType: ((this.invocationType) ? this.invocationType : "Event"), // Event | RequestResponse | DryRun,
LogType: "None", //|| Tail
Payload: this.payload
};
if(this.clientContext){
this.params[`ClientContext`] = this.clientContext;
}
if(this.qualifier) {
this.params[`Qualifier`] = this.qualifier;
}
this.lambda.invoke(this.params, (err, data) => {
return callback(err, data);
});
};
module.exports = exports = LambdaService; |