Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo #1638

Merged
merged 4 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -170,6 +171,7 @@ await _lambdaClient.CreateFunctionAsync(new CreateFunctionRequest
MemorySize = 512,
Role = _executionRoleArn,
PackageType = PackageType.Image,
Timeout = 30,
Architectures = new List<string> {GetArchitecture()}
});
break;
Expand Down
12 changes: 12 additions & 0 deletions LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public void Execute(GeneratorExecutionContext context)
continue;
}

if (!AreLambdaMethodParamatersValid(lambdaMethod, model, diagnosticReporter))
if (!AreLambdaMethodParametersValid(lambdaMethod, model, diagnosticReporter))
{
foundFatalError = true;
continue;
Expand Down Expand Up @@ -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)
Expand All @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,7 +20,7 @@
namespace Amazon.Lambda.Annotations.APIGateway
{
/// <summary>
/// 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.
/// </summary>
public class HttpResultSerializationOptions
{
Expand Down Expand Up @@ -55,7 +54,7 @@ public enum ProtocolVersion {

/// <summary>
/// The API Gateway protocol used as the event source.
/// RestApi -> RestApiAttrbute
/// RestApi -> RestApiAttribute
/// HttpApi -> HttpApiAttribute
/// </summary>
public ProtocolFormat Format { get; set; }
Expand Down Expand Up @@ -272,11 +271,11 @@ public static IHttpResult Ok(object body = null)
/// Creates an IHttpResult for redirect responses.
/// </summary>
/// <remarks>
/// 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
/// </remarks>
/// <param name="uri">The URI to redirect to. The value will be set in the location header.</param>
/// <param name="permanent">Whether the redirect should be a permanet (301) or temporary (302) redirect.</param>
/// <param name="permanent">Whether the redirect should be a permanent (301) or temporary (302) redirect.</param>
/// <param name="preserveMethod">Whether the request method should be preserved. If set to true use 308 for permanent or 307 for temporary redirects.</param>
/// <returns></returns>
public static IHttpResult Redirect(string uri, bool permanent = false, bool preserveMethod = false)
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -488,7 +488,7 @@ private static IDictionary<string, string> 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
{
Expand All @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion buildtools/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackCommand>dotnet pack --no-build -c $(Configuration) -o $(MSBuildThisFileDirectory)/../Deployment/nuget-packages</PackCommand>
<PackWithConfigurationCommand>dotnet pack --no-build -o $(MSBuildThisFileDirectory)/../Deployment/nuget-packages</PackWithConfigurationCommand>
<SignAssembly Condition=" '$(SignAssembly)' == '' ">true</SignAssembly>
<AssemblyOriginatorKeyFile Condition=" '$(AssemblyOriginatorKeyFile)' == '' ">$(MSBuildThisFileDirectory)local-development.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)/public.snk</AssemblyOriginatorKeyFile>
<BlueprintPackagerArguments Condition="'$(UpdateBlueprintPackageVersions)'=='true'">--updateVersions</BlueprintPackagerArguments>
<Cicd Condition="'$(Cicd)' == ''">false</Cicd>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions buildtools/common.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>

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

<Authors>Amazon Web Services</Authors>

Expand Down
Binary file removed buildtools/local-development.snk
Binary file not shown.
Binary file added buildtools/public.snk
Binary file not shown.
Loading