using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Amazon.Lambda.Core; using Amazon.Lambda.SNSEvents; // Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. [assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] namespace BlueprintBaseName._1 { public class Function { /// /// Default constructor. This constructor is used by Lambda to construct the instance. When invoked in a Lambda environment /// the AWS credentials will come from the IAM role associated with the function and the AWS region will be set to the /// region the Lambda function is executed in. /// public Function() { } /// /// This method is called for every Lambda invocation. This method takes in an SNS event object and can be used /// to respond to SNS messages. /// /// /// /// public async Task FunctionHandler(SNSEvent evnt, ILambdaContext context) { foreach(var record in evnt.Records) { await ProcessRecordAsync(record, context); } } private async Task ProcessRecordAsync(SNSEvent.SNSRecord record, ILambdaContext context) { context.Logger.LogLine($"Processed record {record.Sns.Message}"); // TODO: Do interesting work based on the new message await Task.CompletedTask; } } }