From 5d622a89395647a25387e6582c9126f732a668ad Mon Sep 17 00:00:00 2001 From: Srihariharan Date: Wed, 25 Sep 2024 15:22:19 +0530 Subject: [PATCH] 909859: Update aws lambda github samples. --- .../Create_PDF_AWS_Elastic_Beanstalk.csproj | 2 +- .../AWSLambdaProject/AWSLambdaProject.csproj | 9 ++++- .../AWSLambdaProject/Function.cs | 21 +++++----- .../Properties/launchSettings.json | 4 +- .../aws-lambda-tools-defaults.json | 39 ++++++++++++------- 5 files changed, 45 insertions(+), 30 deletions(-) diff --git a/Getting Started/AWS/AWSElasticBeanstalk/Create_PDF_AWS_Elastic_Beanstalk/Create_PDF_AWS_Elastic_Beanstalk.csproj b/Getting Started/AWS/AWSElasticBeanstalk/Create_PDF_AWS_Elastic_Beanstalk/Create_PDF_AWS_Elastic_Beanstalk.csproj index f6f734a7..b6acd446 100644 --- a/Getting Started/AWS/AWSElasticBeanstalk/Create_PDF_AWS_Elastic_Beanstalk/Create_PDF_AWS_Elastic_Beanstalk.csproj +++ b/Getting Started/AWS/AWSElasticBeanstalk/Create_PDF_AWS_Elastic_Beanstalk/Create_PDF_AWS_Elastic_Beanstalk.csproj @@ -7,7 +7,7 @@ - + diff --git a/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/AWSLambdaProject.csproj b/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/AWSLambdaProject.csproj index c1f65ac8..b1021685 100644 --- a/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/AWSLambdaProject.csproj +++ b/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/AWSLambdaProject.csproj @@ -1,6 +1,6 @@ - net6.0 + net8.0 enable enable true @@ -13,6 +13,11 @@ - + + + + + PreserveNewest + \ No newline at end of file diff --git a/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/Function.cs b/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/Function.cs index a8a9452c..bc0b34dc 100644 --- a/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/Function.cs +++ b/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/Function.cs @@ -36,26 +36,25 @@ public string FunctionHandler(string input, ILambdaContext context) PdfGrid pdfGrid = new PdfGrid(); //Add values to the list. List data = new List(); - Object row1 = new { Product_ID = "1001", Product_Name = "Bicycle", Price = "10,000" }; - Object row2 = new { Product_ID = "1002", Product_Name = "Head Light", Price = "3,000" }; - Object row3 = new { Product_ID = "1003", Product_Name = "Break wire", Price = "1,500" }; - data.Add(row1); - data.Add(row2); - data.Add(row3); - //Add list to IEnumerable. - IEnumerable dataTable = data; - + data.Add(new { Product_ID = "1001", Product_Name = "Bicycle", Price = "10,000" }); + data.Add(new { Product_ID = "1002", Product_Name = "Head Light", Price = "3,000" }); + data.Add(new { Product_ID = "1003", Product_Name = "Break wire", Price = "1,500" }); + //Assign data source. - pdfGrid.DataSource = dataTable; + pdfGrid.DataSource = data; + //Apply built-in table style. pdfGrid.ApplyBuiltinStyle(PdfGridBuiltinStyle.GridTable4Accent3); + //Draw the grid to the page of PDF document. pdfGrid.Draw(graphics, new RectangleF(40, 400, page.Size.Width - 80, 0)); + //Save the document into stream. MemoryStream memoryStream = new MemoryStream(); - //Save and Close the PDF Document. document.Save(memoryStream); + //Close the document. document.Close(true); + //return the stream as base64 string return Convert.ToBase64String(memoryStream.ToArray()); } diff --git a/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/Properties/launchSettings.json b/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/Properties/launchSettings.json index a82d4042..c1fabf8f 100644 --- a/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/Properties/launchSettings.json +++ b/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/Properties/launchSettings.json @@ -3,8 +3,8 @@ "Mock Lambda Test Tool": { "commandName": "Executable", "commandLineArgs": "--port 5050", - "workingDirectory": ".\\bin\\$(Configuration)\\net6.0", - "executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-6.0.exe" + "workingDirectory": ".\\bin\\$(Configuration)\\net8.0", + "executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-8.0.exe" } } } \ No newline at end of file diff --git a/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/aws-lambda-tools-defaults.json b/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/aws-lambda-tools-defaults.json index 72907880..8bc44a4d 100644 --- a/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/aws-lambda-tools-defaults.json +++ b/Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/aws-lambda-tools-defaults.json @@ -1,16 +1,27 @@ + { - "Information": [ - "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", - "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", - "dotnet lambda help", - "All the command line options for the Lambda command can be specified in this file." - ], - "profile": "sameerkhan.n@syncfusion.com", - "region": "us-east-1", - "configuration": "Release", - "function-architecture": "x86_64", - "function-runtime": "dotnet6", - "function-memory-size": 256, - "function-timeout": 30, - "function-handler": "AWSLambdaProject::AWSLambdaProject.Function::FunctionHandler" + "Information" : [ + "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", + "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", + "dotnet lambda help", + "All the command line options for the Lambda command can be specified in this file." + ], + "profile" : "AWS_sample", + "region" : "us-east-1", + "configuration" : "Release", + "function-architecture" : "x86_64", + "function-runtime" : "dotnet8", + "function-memory-size" : 3008, + "function-timeout" : 900, + "function-handler" : "AWSLambdaProject::AWSLambdaProject.Function::FunctionHandler", + "framework" : "net8.0", + "function-description" : "", + "package-type" : "Zip", + "function-subnets" : "", + "function-security-groups" : "", + "tracing-mode" : "PassThrough", + "environment-variables" : "", + "image-tag" : "", + "function-name" : "Lambda-90351", + "function-role" : "arn:aws:iam::142887710098:role/service-role/Lambda-90351-role-15s5pd3j" } \ No newline at end of file