Skip to content

Commit 397df02

Browse files
authored
Merge pull request #1638 from t0mll/diagnostic-descriptor-cleanup
Fix typo
2 parents c3239d6 + 7e12efe commit 397df02

File tree

9 files changed

+31
-17
lines changed

9 files changed

+31
-17
lines changed

LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction.SmokeTests/ImageFunctionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public ImageFunctionTests()
7171
[InlineData("ImageFunction::ImageFunction.Function::Ping", "ping", "pong")]
7272
[InlineData("ImageFunction::ImageFunction.Function::HttpsWorksAsync", "", "SUCCESS")]
7373
[InlineData("ImageFunction::ImageFunction.Function::VerifyLambdaContext", "", "SUCCESS")]
74+
[InlineData("ImageFunction::ImageFunction.Function::VerifyTzData", "", "SUCCESS")]
7475
public async Task SuccessfulTests(string handler, string input, string expectedResponse)
7576
{
7677
await UpdateHandlerAsync(handler);
@@ -170,6 +171,7 @@ await _lambdaClient.CreateFunctionAsync(new CreateFunctionRequest
170171
MemorySize = 512,
171172
Role = _executionRoleArn,
172173
PackageType = PackageType.Image,
174+
Timeout = 30,
173175
Architectures = new List<string> {GetArchitecture()}
174176
});
175177
break;

LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ public string VerifyLambdaContext(ILambdaContext lambdaContext)
116116
return GetResponse(true);
117117
}
118118

119+
// .NET on Linux uses the tzdata system package to get time zone information.
120+
// If TzData is not installed/available in the Linux environment the
121+
// TimeZoneInfo.GetSystemTimeZones() will return an empty collection.
122+
// For futher information: https://github.com/aws/aws-lambda-dotnet/issues/1620
123+
public string VerifyTzData(ILambdaContext lambdaContext)
124+
{
125+
AssertTrue(TimeZoneInfo.GetSystemTimeZones().Count > 0, "No time zones were found");
126+
AssertNotNull(TimeZoneInfo.FindSystemTimeZoneById("Europe/London"), "Failed to find Europe/London timezone");
127+
128+
return SuccessResult;
129+
}
130+
119131
#endregion
120132

121133
#region Private methods

Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ public static class DiagnosticDescriptors
7474
DiagnosticSeverity.Error,
7575
isEnabledByDefault: true);
7676

77-
public static readonly DiagnosticDescriptor UnsupportedMethodParamaterType = new DiagnosticDescriptor(id: "AWSLambda0109",
78-
title: "Unsupported Method Paramater Type",
79-
messageFormat: "Unsupported query paramter '{0}' of type '{1}' encountered. Only primitive .NET types and their corresponding enumerables can be used as query parameters.",
77+
public static readonly DiagnosticDescriptor UnsupportedMethodParameterType = new DiagnosticDescriptor(id: "AWSLambda0109",
78+
title: "Unsupported Method Parameter Type",
79+
messageFormat: "Unsupported query parameter '{0}' of type '{1}' encountered. Only primitive .NET types and their corresponding enumerable can be used as query parameters.",
8080
category: "AWSLambdaCSharpGenerator",
8181
DiagnosticSeverity.Error,
8282
isEnabledByDefault: true);

Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Generator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void Execute(GeneratorExecutionContext context)
200200
continue;
201201
}
202202

203-
if (!AreLambdaMethodParamatersValid(lambdaMethod, model, diagnosticReporter))
203+
if (!AreLambdaMethodParametersValid(lambdaMethod, model, diagnosticReporter))
204204
{
205205
foundFatalError = true;
206206
continue;
@@ -384,7 +384,7 @@ public void Initialize(GeneratorInitializationContext context)
384384
context.RegisterForSyntaxNotifications(() => new SyntaxReceiver(_fileManager, _directoryManager));
385385
}
386386

387-
private bool AreLambdaMethodParamatersValid(MethodDeclarationSyntax declarationSyntax, LambdaFunctionModel model, DiagnosticReporter diagnosticReporter)
387+
private bool AreLambdaMethodParametersValid(MethodDeclarationSyntax declarationSyntax, LambdaFunctionModel model, DiagnosticReporter diagnosticReporter)
388388
{
389389
var isValid = true;
390390
foreach (var parameter in model.LambdaMethod.Parameters)
@@ -398,7 +398,7 @@ private bool AreLambdaMethodParamatersValid(MethodDeclarationSyntax declarationS
398398
if (!parameter.Type.IsPrimitiveType() && !parameter.Type.IsPrimitiveEnumerableType())
399399
{
400400
isValid = false;
401-
diagnosticReporter.Report(Diagnostic.Create(DiagnosticDescriptors.UnsupportedMethodParamaterType,
401+
diagnosticReporter.Report(Diagnostic.Create(DiagnosticDescriptors.UnsupportedMethodParameterType,
402402
Location.Create(declarationSyntax.SyntaxTree, declarationSyntax.Span),
403403
parameterKey, parameter.Type.FullName));
404404
}

Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpResults.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.IO;
44
using System.Linq;
55
using System.Net;
6-
using Amazon.Lambda.Core;
76
#if NET6_0_OR_GREATER
87
using System.Buffers;
98
using System.Text.Json;
@@ -21,7 +20,7 @@
2120
namespace Amazon.Lambda.Annotations.APIGateway
2221
{
2322
/// <summary>
24-
/// The options used by the IHttpResult to serialize into the required format for the event source of the Lambda funtion.
23+
/// The options used by the IHttpResult to serialize into the required format for the event source of the Lambda function.
2524
/// </summary>
2625
public class HttpResultSerializationOptions
2726
{
@@ -55,7 +54,7 @@ public enum ProtocolVersion {
5554

5655
/// <summary>
5756
/// The API Gateway protocol used as the event source.
58-
/// RestApi -> RestApiAttrbute
57+
/// RestApi -> RestApiAttribute
5958
/// HttpApi -> HttpApiAttribute
6059
/// </summary>
6160
public ProtocolFormat Format { get; set; }
@@ -272,11 +271,11 @@ public static IHttpResult Ok(object body = null)
272271
/// Creates an IHttpResult for redirect responses.
273272
/// </summary>
274273
/// <remarks>
275-
/// This method uses the same logic for determing the the Http status code as the Microsoft.AspNetCore.Http.TypedResults.Redirect uses.
274+
/// This method uses the same logic for determining the the Http status code as the Microsoft.AspNetCore.Http.TypedResults.Redirect uses.
276275
/// https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.typedresults.redirect
277276
/// </remarks>
278277
/// <param name="uri">The URI to redirect to. The value will be set in the location header.</param>
279-
/// <param name="permanent">Whether the redirect should be a permanet (301) or temporary (302) redirect.</param>
278+
/// <param name="permanent">Whether the redirect should be a permanent (301) or temporary (302) redirect.</param>
280279
/// <param name="preserveMethod">Whether the request method should be preserved. If set to true use 308 for permanent or 307 for temporary redirects.</param>
281280
/// <returns></returns>
282281
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
317316
public static IHttpResult ServiceUnavailable(int? delaySeconds = null)
318317
{
319318
var result = new HttpResults(HttpStatusCode.ServiceUnavailable);
320-
if (delaySeconds != null && delaySeconds > 0)
319+
320+
if (delaySeconds > 0)
321321
{
322322
result.AddHeader("Retry-After", delaySeconds.ToString());
323323
}
@@ -488,7 +488,7 @@ private static IDictionary<string, string> ConvertToV2MultiValueHeaders(IDiction
488488

489489
// See comment at the top about .NET Standard 2.0
490490
#if !NETSTANDARD2_0
491-
// Class representing the V1 API Gateway response. Very similiar to Amazon.Lambda.APIGatewayEvents.APIGatewayProxyResponse but this library can
491+
// Class representing the V1 API Gateway response. Similar to Amazon.Lambda.APIGatewayEvents.APIGatewayProxyResponse but this library can
492492
// not take a dependency on Amazon.Lambda.APIGatewayEvents so it has to have its own version.
493493
internal class APIGatewayV1Response
494494
{
@@ -505,7 +505,7 @@ internal class APIGatewayV1Response
505505
public bool IsBase64Encoded { get; set; }
506506
}
507507

508-
// Class representing the V2 API Gateway response. Very similiar to Amazon.Lambda.APIGatewayEvents.APIGatewayHttpApiV2ProxyResponse but this library can
508+
// Class representing the V2 API Gateway response. Similar to Amazon.Lambda.APIGatewayEvents.APIGatewayHttpApiV2ProxyResponse but this library can
509509
// not take a dependency on Amazon.Lambda.APIGatewayEvents so it has to have its own version.
510510
internal class APIGatewayV2Response
511511
{

buildtools/build.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PackCommand>dotnet pack --no-build -c $(Configuration) -o $(MSBuildThisFileDirectory)/../Deployment/nuget-packages</PackCommand>
1010
<PackWithConfigurationCommand>dotnet pack --no-build -o $(MSBuildThisFileDirectory)/../Deployment/nuget-packages</PackWithConfigurationCommand>
1111
<SignAssembly Condition=" '$(SignAssembly)' == '' ">true</SignAssembly>
12-
<AssemblyOriginatorKeyFile Condition=" '$(AssemblyOriginatorKeyFile)' == '' ">$(MSBuildThisFileDirectory)local-development.snk</AssemblyOriginatorKeyFile>
12+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)/public.snk</AssemblyOriginatorKeyFile>
1313
<BlueprintPackagerArguments Condition="'$(UpdateBlueprintPackageVersions)'=='true'">--updateVersions</BlueprintPackagerArguments>
1414
<Cicd Condition="'$(Cicd)' == ''">false</Cicd>
1515
</PropertyGroup>

buildtools/common.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project>
22

33
<PropertyGroup>
4-
<AssemblyOriginatorKeyFile Condition=" '$(AssemblyOriginatorKeyFile)' == '' ">$(MSBuildThisFileDirectory)local-development.snk</AssemblyOriginatorKeyFile>
5-
<SignAssembly>false</SignAssembly>
4+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)/public.snk</AssemblyOriginatorKeyFile>
5+
<SignAssembly>true</SignAssembly>
66

77
<Authors>Amazon Web Services</Authors>
88

buildtools/local-development.snk

-596 Bytes
Binary file not shown.

buildtools/public.snk

596 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)