Skip to content

Instantly share code, notes, and snippets.

@liorksh

liorksh/Lambda Stream Handler Secret

Last active May 18, 2018
Embed
What would you like to do?
Lambda input stream
public APIGatewayProxyResponse StreamHandler(Stream input, ILambdaContext context)
{
string inputString = string.Empty;
LambdaLogger.Log("started 'FunctionHandler' method");
if (input != null)
{
StreamReader streamReader = new StreamReader(input);
inputString = streamReader.ReadToEnd();
if (inputString.IndexOf("name") > 0)
{
inputString = inputString.Substring(inputString.IndexOf("name"), 6);
}
}
inputString = "received the following string: " + inputString;
var response = new APIGatewayProxyResponse
{
StatusCode = (int)HttpStatusCode.OK,
Body = inputString + DateTime.Now.ToString("hh:mm:ss"),
Headers = new Dictionary<string, string> { { "Content-Type", "text/plain" } }
};
return response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.