Created
March 14, 2021 23:42
-
-
Save russau/9cb231039f3d066b3ae49f03f67a3104 to your computer and use it in GitHub Desktop.
.NET debugging lambda
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Amazon.Lambda.Core; | |
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. | |
//[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] | |
namespace Debugging | |
{ | |
public class Function | |
{ | |
/// <summary> | |
/// A simple function that takes a string and does a ToUpper | |
/// </summary> | |
/// <param name="input"></param> | |
/// <param name="context"></param> | |
/// <returns></returns> | |
public Stream FunctionHandler(System.IO.Stream input, ILambdaContext context) | |
{ | |
string result; | |
using (var memoryStream = new MemoryStream()) | |
{ | |
input.CopyTo(memoryStream); | |
byte[] arr = memoryStream.ToArray(); | |
result = BitConverter.ToString(arr); | |
} | |
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(result)); | |
return ms; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment