From 88a6fce2514350538952c0aec2fc67c21dfafb7c Mon Sep 17 00:00:00 2001 From: Malhar Khimsaria <96malhar@gmail.com> Date: Fri, 17 Nov 2023 17:44:03 -0800 Subject: [PATCH 1/4] chore: update .snk file for strong naming --- buildtools/build.proj | 2 +- buildtools/common.props | 4 ++-- buildtools/local-development.snk | Bin 596 -> 0 bytes buildtools/public.snk | Bin 0 -> 596 bytes 4 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 buildtools/local-development.snk create mode 100644 buildtools/public.snk diff --git a/buildtools/build.proj b/buildtools/build.proj index e7552c3e0..a8edf292d 100644 --- a/buildtools/build.proj +++ b/buildtools/build.proj @@ -9,7 +9,7 @@ dotnet pack --no-build -c $(Configuration) -o $(MSBuildThisFileDirectory)/../Deployment/nuget-packages dotnet pack --no-build -o $(MSBuildThisFileDirectory)/../Deployment/nuget-packages true - $(MSBuildThisFileDirectory)local-development.snk + $(MSBuildThisFileDirectory)/public.snk --updateVersions false diff --git a/buildtools/common.props b/buildtools/common.props index de3a3260e..f0c4b9113 100644 --- a/buildtools/common.props +++ b/buildtools/common.props @@ -1,8 +1,8 @@ - $(MSBuildThisFileDirectory)local-development.snk - false + $(MSBuildThisFileDirectory)/public.snk + true Amazon Web Services diff --git a/buildtools/local-development.snk b/buildtools/local-development.snk deleted file mode 100644 index be0ad9c5930ece51dbbbe0747b6ef61162b261b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096|Y^q}s+m;-#cLLTpcEz~M)?rnA(Tm=n zxn{dCq(myaC#0pUrLPsqdw28r_Jivjqb%3x(e2B-8e;w-Pyy8k!b5)rD=Ab9dJ*lt z$KT;C;0!nU=L~*@phZE2jHGL_SP+?b0U_>yL31l|6zrQ^NIvmA9k$i@YH|F)6x^>j zeI_9tbhMxmF6L`Ve;(0Wb_^uJ4IyYQ$|443<=Y2#k%xBCmjE6b)%NKdazC+Mwd7C3 zkx2V4bjIHHf&A9DW>t9bDP2S1AZ?<9ZY^&ZwRon-c^ix#{~83~F|_M&CDe6a$5S

B z9C9-B9(P5_;uB9KyhnmCd08T6X2O1aLVj{0^AAnyJR47&@JF;;V^>uuS9&}S*7;eo zpAXoHrS}~W`144rh)W{qqhOR)7)>&#>lUuDMXH1M)T`19ztdQCXIMMCO zaAE0ll?kB%s_Hx-UslVXh>dp{hgKgs5hui?Oa<0wQC|4IIkHB<*$nxWDUgAbw~Kck*Sl&N!X8%4 i`jVcY0>&(sFjkgE)1jCOSOFO0j#Xsox7y zuG{A&Cq>(Gbk!#x*PI^+_Gs+-j;gg{Z>MV9fgL=L#aLOe(49NLs7~zAx``hviZ8`c zLCwrJ!Ua83NgibiN112CVkcskc>wL(@g*+MiX;>83MliSbt-`%KLgCS_JrFvH5jxl zika3W+aJWDM^0Rw((O=;e0`yFr!?>?ClfBFG4^-4)==RJ>spg`dl>MGa#*em5~QP0 zIF&MBa}%pD1i-g=;q2y&!|MkZ-)1;T5#lDRBvi>r_;_o(_ac z!D@NH2lYG=;?G04G7CgFPhj!xQ5h;j-mGpkl}T(XKpvAtc=-y$fomO zAD@iAxuf~JKKc}bL9MjjLKErlH{_mgTfh`PI`IKh=99+F0?V&=vDBuRCc8-J#xGtsqzW4!)gYmQaW%Osj~9Q)>&5_#_Dc literal 0 HcmV?d00001 From 2eb29ad5de3910677040b14c53f1e3f79f611453 Mon Sep 17 00:00:00 2001 From: Norm Johanson Date: Fri, 8 Dec 2023 10:08:41 -0800 Subject: [PATCH 2/4] Add smoke test to Lambda OCI images for TZData being available. (#1636) --- .../ImageFunction.SmokeTests/ImageFunctionTests.cs | 2 ++ .../SmokeTests/test/ImageFunction/Function.cs | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction.SmokeTests/ImageFunctionTests.cs b/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction.SmokeTests/ImageFunctionTests.cs index 1991729e9..15687be32 100644 --- a/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction.SmokeTests/ImageFunctionTests.cs +++ b/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction.SmokeTests/ImageFunctionTests.cs @@ -71,6 +71,7 @@ public ImageFunctionTests() [InlineData("ImageFunction::ImageFunction.Function::Ping", "ping", "pong")] [InlineData("ImageFunction::ImageFunction.Function::HttpsWorksAsync", "", "SUCCESS")] [InlineData("ImageFunction::ImageFunction.Function::VerifyLambdaContext", "", "SUCCESS")] + [InlineData("ImageFunction::ImageFunction.Function::VerifyTzData", "", "SUCCESS")] public async Task SuccessfulTests(string handler, string input, string expectedResponse) { await UpdateHandlerAsync(handler); @@ -170,6 +171,7 @@ await _lambdaClient.CreateFunctionAsync(new CreateFunctionRequest MemorySize = 512, Role = _executionRoleArn, PackageType = PackageType.Image, + Timeout = 30, Architectures = new List {GetArchitecture()} }); break; diff --git a/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs b/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs index ab280d0a8..128876e7d 100644 --- a/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs +++ b/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs @@ -116,6 +116,18 @@ public string VerifyLambdaContext(ILambdaContext lambdaContext) return GetResponse(true); } + // .NET on Linux uses the tzdata system package to get time zone information. + // If TzData is not installed/available in the Linux environment the + // TimeZoneInfo.GetSystemTimeZones() will return an empty collection. + // For futher information: https://github.com/aws/aws-lambda-dotnet/issues/1620 + public string VerifyTzData(ILambdaContext lambdaContext) + { + AssertTrue(TimeZoneInfo.GetSystemTimeZones().Count > 0, "No time zones were found"); + AssertNotNull(TimeZoneInfo.FindSystemTimeZoneById("Europe/London"), "Failed to find Europe/London timezone"); + + return SuccessResult; + } + #endregion #region Private methods From f1c00fdc2b6c794e4dc222ca0143c0b74d107ffb Mon Sep 17 00:00:00 2001 From: Thomas Carlier Date: Mon, 11 Dec 2023 09:07:36 +1000 Subject: [PATCH 3/4] Typos and minor refactoring --- .../APIGateway/HttpResults.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpResults.cs b/Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpResults.cs index f2c713ece..a8224a32c 100644 --- a/Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpResults.cs +++ b/Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpResults.cs @@ -3,7 +3,6 @@ using System.IO; using System.Linq; using System.Net; -using Amazon.Lambda.Core; #if NET6_0_OR_GREATER using System.Buffers; using System.Text.Json; @@ -21,7 +20,7 @@ namespace Amazon.Lambda.Annotations.APIGateway { ///

- /// The options used by the IHttpResult to serialize into the required format for the event source of the Lambda funtion. + /// The options used by the IHttpResult to serialize into the required format for the event source of the Lambda function. /// public class HttpResultSerializationOptions { @@ -55,7 +54,7 @@ public enum ProtocolVersion { /// /// The API Gateway protocol used as the event source. - /// RestApi -> RestApiAttrbute + /// RestApi -> RestApiAttribute /// HttpApi -> HttpApiAttribute /// public ProtocolFormat Format { get; set; } @@ -272,11 +271,11 @@ public static IHttpResult Ok(object body = null) /// Creates an IHttpResult for redirect responses. /// /// - /// This method uses the same logic for determing the the Http status code as the Microsoft.AspNetCore.Http.TypedResults.Redirect uses. + /// This method uses the same logic for determining the the Http status code as the Microsoft.AspNetCore.Http.TypedResults.Redirect uses. /// https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.typedresults.redirect /// /// The URI to redirect to. The value will be set in the location header. - /// Whether the redirect should be a permanet (301) or temporary (302) redirect. + /// Whether the redirect should be a permanent (301) or temporary (302) redirect. /// Whether the request method should be preserved. If set to true use 308 for permanent or 307 for temporary redirects. /// public static IHttpResult Redirect(string uri, bool permanent = false, bool preserveMethod = false) @@ -317,7 +316,8 @@ public static IHttpResult Redirect(string uri, bool permanent = false, bool pres public static IHttpResult ServiceUnavailable(int? delaySeconds = null) { var result = new HttpResults(HttpStatusCode.ServiceUnavailable); - if (delaySeconds != null && delaySeconds > 0) + + if (delaySeconds > 0) { result.AddHeader("Retry-After", delaySeconds.ToString()); } @@ -488,7 +488,7 @@ private static IDictionary ConvertToV2MultiValueHeaders(IDiction // See comment at the top about .NET Standard 2.0 #if !NETSTANDARD2_0 - // Class representing the V1 API Gateway response. Very similiar to Amazon.Lambda.APIGatewayEvents.APIGatewayProxyResponse but this library can + // Class representing the V1 API Gateway response. Similar to Amazon.Lambda.APIGatewayEvents.APIGatewayProxyResponse but this library can // not take a dependency on Amazon.Lambda.APIGatewayEvents so it has to have its own version. internal class APIGatewayV1Response { @@ -505,7 +505,7 @@ internal class APIGatewayV1Response public bool IsBase64Encoded { get; set; } } - // Class representing the V2 API Gateway response. Very similiar to Amazon.Lambda.APIGatewayEvents.APIGatewayHttpApiV2ProxyResponse but this library can + // Class representing the V2 API Gateway response. Similar to Amazon.Lambda.APIGatewayEvents.APIGatewayHttpApiV2ProxyResponse but this library can // not take a dependency on Amazon.Lambda.APIGatewayEvents so it has to have its own version. internal class APIGatewayV2Response { From 7e12efe384d63ad0b99df1012c9f1c916c40bef2 Mon Sep 17 00:00:00 2001 From: Thomas Carlier Date: Mon, 11 Dec 2023 12:55:28 +1000 Subject: [PATCH 4/4] Fix typo --- .../Diagnostics/DiagnosticDescriptors.cs | 6 +++--- .../Amazon.Lambda.Annotations.SourceGenerator/Generator.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs b/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs index a9df6f53b..07bf8ecb2 100644 --- a/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs +++ b/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs @@ -74,9 +74,9 @@ public static class DiagnosticDescriptors DiagnosticSeverity.Error, isEnabledByDefault: true); - public static readonly DiagnosticDescriptor UnsupportedMethodParamaterType = new DiagnosticDescriptor(id: "AWSLambda0109", - title: "Unsupported Method Paramater Type", - messageFormat: "Unsupported query paramter '{0}' of type '{1}' encountered. Only primitive .NET types and their corresponding enumerables can be used as query parameters.", + public static readonly DiagnosticDescriptor UnsupportedMethodParameterType = new DiagnosticDescriptor(id: "AWSLambda0109", + title: "Unsupported Method Parameter Type", + messageFormat: "Unsupported query parameter '{0}' of type '{1}' encountered. Only primitive .NET types and their corresponding enumerable can be used as query parameters.", category: "AWSLambdaCSharpGenerator", DiagnosticSeverity.Error, isEnabledByDefault: true); diff --git a/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Generator.cs b/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Generator.cs index e502f1530..74dd4dee0 100644 --- a/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Generator.cs +++ b/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Generator.cs @@ -200,7 +200,7 @@ public void Execute(GeneratorExecutionContext context) continue; } - if (!AreLambdaMethodParamatersValid(lambdaMethod, model, diagnosticReporter)) + if (!AreLambdaMethodParametersValid(lambdaMethod, model, diagnosticReporter)) { foundFatalError = true; continue; @@ -384,7 +384,7 @@ public void Initialize(GeneratorInitializationContext context) context.RegisterForSyntaxNotifications(() => new SyntaxReceiver(_fileManager, _directoryManager)); } - private bool AreLambdaMethodParamatersValid(MethodDeclarationSyntax declarationSyntax, LambdaFunctionModel model, DiagnosticReporter diagnosticReporter) + private bool AreLambdaMethodParametersValid(MethodDeclarationSyntax declarationSyntax, LambdaFunctionModel model, DiagnosticReporter diagnosticReporter) { var isValid = true; foreach (var parameter in model.LambdaMethod.Parameters) @@ -398,7 +398,7 @@ private bool AreLambdaMethodParamatersValid(MethodDeclarationSyntax declarationS if (!parameter.Type.IsPrimitiveType() && !parameter.Type.IsPrimitiveEnumerableType()) { isValid = false; - diagnosticReporter.Report(Diagnostic.Create(DiagnosticDescriptors.UnsupportedMethodParamaterType, + diagnosticReporter.Report(Diagnostic.Create(DiagnosticDescriptors.UnsupportedMethodParameterType, Location.Create(declarationSyntax.SyntaxTree, declarationSyntax.Span), parameterKey, parameter.Type.FullName)); }