Created
November 1, 2017 02:13
-
-
Save kmkale/2a4d0cdbbff6ca0231ef7408f7e17d1f to your computer and use it in GitHub Desktop.
invokeLambda Function for aws-process-default-sg-security-rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Invokes the given lambda function with received invoke_params | |
* @param {Object} invoke_params object with region and VPC arrays | |
* @param {String} functionName Name of the Lambda function to invoke | |
*/ | |
function invokeLambda(invoke_params, functionName, callback) { | |
console.log("invokeLambda received invoke_params: " + JSON.stringify(invoke_params)); | |
console.log("invokeLambda received functionName: " + functionName); | |
var params = { | |
FunctionName: functionName, | |
InvocationType: "Event", | |
Payload: JSON.stringify(invoke_params) | |
}; | |
lambda.invoke(params, function(err, data) { | |
if (err) { | |
console.log("Error in invokeLambda " + JSON.stringify(err)); | |
callback(err); | |
} else { | |
console.log("in invokeLambda got data: " + data); | |
callback(null, data); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment