Skip to content

Commit

Permalink
909859: Update aws lambda github samples.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sri-hari-haran-g committed Sep 25, 2024
1 parent 2f9cd39 commit 5d622a8
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="26.2.5" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand All @@ -13,6 +13,11 @@
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.1" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="22.1.39" />
<PackageReference Include="Syncfusion.Pdf.Imaging.Net.Core" Version="*" />
</ItemGroup>
<ItemGroup>
<None Update="Data\Input.pdf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
21 changes: 10 additions & 11 deletions Getting Started/AWS/AWSLambdaProject/AWSLambdaProject/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,25 @@ public string FunctionHandler(string input, ILambdaContext context)
PdfGrid pdfGrid = new PdfGrid();
//Add values to the list.
List<object> data = new List<object>();
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<object> 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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Original file line number Diff line number Diff line change
@@ -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": "[email protected]",
"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"
}

0 comments on commit 5d622a8

Please sign in to comment.