Skip to content

Commit

Permalink
Merge branch 'dev' into feature/structured-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
normj committed Sep 4, 2024
2 parents 1a38727 + 5d4e18b commit bd3209a
Show file tree
Hide file tree
Showing 157 changed files with 4,014 additions and 798 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/aws-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

name: AWS CI

on:
workflow_dispatch:
pull_request:
branches:
- main
- dev
- 'feature/**'

permissions:
id-token: write

jobs:
run-ci:
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 #v4
with:
role-to-assume: ${{ secrets.CI_MAIN_TESTING_ACCOUNT_ROLE_ARN }}
role-duration-seconds: 7200
aws-region: us-west-2
- name: Invoke Load Balancer Lambda
id: lambda
shell: pwsh
run: |
aws lambda invoke response.json --function-name "${{ secrets.CI_TESTING_LOAD_BALANCER_LAMBDA_NAME }}" --cli-binary-format raw-in-base64-out --payload '{"Roles": "${{ secrets.CI_TEST_RUNNER_ACCOUNT_ROLES }}", "ProjectName": "${{ secrets.CI_TESTING_CODE_BUILD_PROJECT_NAME }}", "Branch": "${{ github.sha }}"}'
$roleArn=$(cat ./response.json)
"roleArn=$($roleArn -replace '"', '')" >> $env:GITHUB_OUTPUT
- name: Configure Test Runner Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 #v4
with:
role-to-assume: ${{ steps.lambda.outputs.roleArn }}
role-duration-seconds: 7200
aws-region: us-west-2
- name: Run Tests on AWS
id: codebuild
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: ${{ secrets.CI_TESTING_CODE_BUILD_PROJECT_NAME }}
- name: CodeBuild Link
shell: pwsh
run: |
$buildId = "${{ steps.codebuild.outputs.aws-build-id }}"
echo $buildId
88 changes: 0 additions & 88 deletions .github/workflows/source-generator-ci.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Annotations" Version="1.3.0" />
<PackageReference Include="Amazon.Lambda.Annotations" Version="1.5.0" />
<PackageReference Include="Amazon.Lambda.Core" Version="2.2.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.1" />
<PackageReference Include="Amazon.Lambda.SQSEvents" Version="2.2.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Amazon.Lambda.Annotations;
using Amazon.Lambda.Annotations.APIGateway;
using Amazon.Lambda.Annotations.SQS;
using Amazon.Lambda.Core;
using Amazon.Lambda.SQSEvents;
using AWS.Messaging;
Expand Down Expand Up @@ -56,6 +56,7 @@ public async Task Sender([FromServices] IMessagePublisher publisher, GreetingMes
/// <param name="context">Lambda execution context</param>
/// <returns>Set of messages whose handler invocations failed, only these will be reprocessed</returns>
[LambdaFunction(Policies = "AWSLambdaSQSQueueExecutionRole")]
[SQSEvent("@MessageProcessingFrameworkDemoQueue", ResourceName = "SQSEvent")]
public async Task<SQSBatchResponse> Handler(SQSEvent evnt, ILambdaContext context)
{
// Pass the SQSEvent into the framework
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Transform": "AWS::Serverless-2016-10-31",
"Description": "AWS Message Processing Framework for .NET Template. This template is partially managed by Amazon.Lambda.Annotations (v1.2.0.0).",
"Description": "AWS Message Processing Framework for .NET Template. This template is partially managed by Amazon.Lambda.Annotations (v1.5.0.0).",
"Resources": {
"MessageProcessingFrameworkDemoQueue": {
"Type": "AWS::SQS::Queue"
},
"BlueprintBaseName._1FunctionsHandlerGenerated": {
"Type": "AWS::Serverless::Function",
"Metadata": {
"Tool": "Amazon.Lambda.Annotations"
"Tool": "Amazon.Lambda.Annotations",
"SyncedEvents": [
"SQSEvent"
],
"SyncedEventProperties": {
"SQSEvent": [
"Queue.Fn::GetAtt",
"FunctionResponseTypes"
]
}
},
"Properties": {
"Runtime": "dotnet8",
Expand Down
2 changes: 1 addition & 1 deletion Blueprints/BlueprintDefinitions/vs2022/template.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Amazon.Lambda.Templates</id>
<version>7.1.1</version>
<version>7.2.0</version>
<authors>Amazon Web Services</authors>
<tags>AWS Amazon Lambda</tags>
<description>AWS Lambda templates for Microsoft Template Engine accessible with the dotnet CLI's new command</description>
Expand Down
4 changes: 2 additions & 2 deletions LambdaRuntimeDockerfiles/Images/net6/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Based on Docker image from: https://github.com/dotnet/dotnet-docker/

ARG ASPNET_VERSION=6.0.29
ARG ASPNET_SHA512=6dc21e1a8dd597df9c1135065f7350bbde9cc040c3079ec7850b0e5f254051b883c6c6e0056682d2963ec74dadff8eb32d82c13b35c9088f3d7c055d3d3f0863
ARG ASPNET_VERSION=6.0.33
ARG ASPNET_SHA512=12b34fe1d0a679ff63db4bf002a2988194d9e64d0e107d128c247821dd939a86eced0fe453c0638d3742dac3a32e533792c26299400fb4fd5566b75177e66875

ARG LAMBDA_RUNTIME_NAME=dotnet6
ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2
Expand Down
4 changes: 2 additions & 2 deletions LambdaRuntimeDockerfiles/Images/net6/arm64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Based on Docker image from: https://github.com/dotnet/dotnet-docker/

ARG ASPNET_VERSION=6.0.29
ARG ASPNET_SHA512=6e4a504f37ba4bf7d0316d2a3077c5088962c8b8445b659fa05844697bd11427afabacb6fee34094aa4313dd6dca70c862c1c68b30731b12b4451bd59067bc8f
ARG ASPNET_VERSION=6.0.33
ARG ASPNET_SHA512=7a60a77a306070a3b94db1acfa73938b6880cd079bdac3e5cab174a47af467b9208e9f41d8e12e080831d528151cdaa5b660bea5aa6fe537ec144543c0fffd95

ARG ICU_VERSION=68.1
ARG ICU_MD5=6a99b541ea01f271257b121a4433c7c0
Expand Down
4 changes: 2 additions & 2 deletions LambdaRuntimeDockerfiles/Images/net7/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Based on Docker image from: https://github.com/dotnet/dotnet-docker/

ARG ASPNET_VERSION=7.0.18
ARG ASPNET_SHA512=d2c3af93b9b8280c4e519f052f443e0504ccf7a04b3eef60500b2e3a8874a60a3a545ca936f8433887bfa6388106c19283c5a6a2c78ffdc19889bde3edbefbda
ARG ASPNET_VERSION=7.0.20
ARG ASPNET_SHA512=62ed9743972043a72e48d5aa2f7fdf3483cf684a32b051315004d1c778e9712bf66e5e7a97a5a53993fa8e92daf5bacaf2cdb3eae44bb9a9e25532b9a80f4f70

ARG LAMBDA_RUNTIME_NAME=dotnet7
ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2
Expand Down
4 changes: 2 additions & 2 deletions LambdaRuntimeDockerfiles/Images/net7/arm64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Based on Docker image from: https://github.com/dotnet/dotnet-docker/

ARG ASPNET_VERSION=7.0.18
ARG ASPNET_SHA512=62bc42a8d094be8253be90acba02253c27afb1eb6b06976c3adea74f967f522bf7938eaed25c824d6e36a9fb71f7248ba315cc67577a3c7fb73b0d3d7a41ecac
ARG ASPNET_VERSION=7.0.20
ARG ASPNET_SHA512=dfb1c1bef4d826defd3d995599a5c03e1bf1a64c65d98b675d6c05dbb7380d98233953e68d53fc5ebec60ad4ef75417073fb1fb3256a0176bb964f0e01161f6c

ARG ICU_VERSION=68.1
ARG ICU_MD5=6a99b541ea01f271257b121a4433c7c0
Expand Down
4 changes: 2 additions & 2 deletions LambdaRuntimeDockerfiles/Images/net8/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Based on Docker image from: https://github.com/dotnet/dotnet-docker/

ARG ASPNET_VERSION=8.0.4
ARG ASPNET_SHA512=8ab281977116bf59a672afe5463bce4433378cc8a67d332c564a012939b7dbdd8756df82a115a5ab93f8186c22700a6dc0272b99a0f484db837da96820c78e79
ARG ASPNET_VERSION=8.0.8
ARG ASPNET_SHA512=d6c0cc2aac79fbacbf81b597f286763599f66278c17ddb448ce0b93d499bad8f88777d425854e68602945ab18af8a61f1ee59d431d5503006137f86113faa8b2

ARG LAMBDA_RUNTIME_NAME=dotnet8
ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2023
Expand Down
4 changes: 2 additions & 2 deletions LambdaRuntimeDockerfiles/Images/net8/arm64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Based on Docker image from: https://github.com/dotnet/dotnet-docker/

ARG ASPNET_VERSION=8.0.4
ARG ASPNET_SHA512=0b0b3dffe678211afcaeca5d7e381f2218f156421c79dd06e083b1abd92ceb2b5c04c8a159b7d67b866393b8169de826ede70240226e0164451b329b7d46b570
ARG ASPNET_VERSION=8.0.8
ARG ASPNET_SHA512=c3dc9d71fca0a48eda96074cbcef4c9a265c1c4e10cbff38614dd74d79443ae9d1ccd10714764cd041291f81d83c0ed1c307abf89249ab4b6f58a5de952fcffd

ARG LAMBDA_RUNTIME_NAME=dotnet8
ARG AMAZON_LINUX=public.ecr.aws/lambda/provided:al2023
Expand Down
1 change: 1 addition & 0 deletions Libraries/Amazon.Lambda.Annotations.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"src\\Amazon.Lambda.Annotations\\Amazon.Lambda.Annotations.csproj",
"src\\Amazon.Lambda.Core\\Amazon.Lambda.Core.csproj",
"src\\Amazon.Lambda.RuntimeSupport\\Amazon.Lambda.RuntimeSupport.csproj",
"src\\Amazon.Lambda.SQSEvents\\Amazon.Lambda.SQSEvents.csproj",
"src\\Amazon.Lambda.Serialization.SystemTextJson\\Amazon.Lambda.Serialization.SystemTextJson.csproj",
"test\\Amazon.Lambda.Annotations.SourceGenerators.Tests\\Amazon.Lambda.Annotations.SourceGenerators.Tests.csproj",
"test\\TestExecutableServerlessApp\\TestExecutableServerlessApp.csproj",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public class IAMPolicyStatement
[System.Text.Json.Serialization.JsonPropertyName("Resource")]
#endif
public HashSet<string> Resource { get; set; }

/// <summary>
/// Gets or sets the conditions for when a policy is in effect.
/// https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html
/// </summary>
#if NETCOREAPP3_1_OR_GREATER
[System.Text.Json.Serialization.JsonPropertyName("Condition")]
#endif
public IDictionary<string, IDictionary<string, object>> Condition { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net8.0</TargetFrameworks>
<Description>Amazon Lambda .NET Core support - API Gateway package.</Description>
<AssemblyTitle>Amazon.Lambda.APIGatewayEvents</AssemblyTitle>
<VersionPrefix>2.7.0</VersionPrefix>
<VersionPrefix>2.7.1</VersionPrefix>
<AssemblyName>Amazon.Lambda.APIGatewayEvents</AssemblyName>
<PackageId>Amazon.Lambda.APIGatewayEvents</PackageId>
<PackageTags>AWS;Amazon;Lambda</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyVersion>1.3.1</AssemblyVersion>
<AssemblyVersion>1.5.0</AssemblyVersion>
<TargetFramework>netstandard2.0</TargetFramework>

<!--This assembly needs to access internal methods inside the Amazon.Lambda.Annotations assembly.
Both these assemblies need to be strongly signed for the InternalsVisibleTo attribute to take effect.-->
<AssemblyOriginatorKeyFile>..\..\..\buildtools\public.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

<!-- This is required to allow copying all the dependencies to bin directory which can be copied after to nuget package based on nuspec -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
; Shipped analyzer releases
; https://github.com/dotnet/roslyn-analyzers/blob/master/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

## Release 1.5.0
### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
AWSLambda0115 | AWSLambdaCSharpGenerator | Error | Invalid Usage of API Parameters
AWSLambda0116 | AWSLambdaCSharpGenerator | Error | Invalid SQSEventAttribute encountered
AWSLambda0117 | AWSLambdaCSharpGenerator | Error | Invalid Lambda Method Signature

## Release 1.1.0
### New Rules

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static class DiagnosticDescriptors
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static readonly DiagnosticDescriptor ExecutableWithNoFunctions = new DiagnosticDescriptor(id: "AWSLambda0113",
title: "Executable output with no LambdaFunction annotations",
messageFormat: "Your project is configured to output an executable and generate a static Main method, but you have not configured any methods with the 'LambdaFunction' attribute",
Expand All @@ -117,5 +117,26 @@ public static class DiagnosticDescriptors
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static readonly DiagnosticDescriptor ApiParametersOnNonApiFunction = new DiagnosticDescriptor(id: "AWSLambda0115",
title: "Invalid Usage of API Parameters",
messageFormat: "The Lambda function parameters are annotated with HTTP API attributes but the Lambda function itself is not annotated with an HTTP API attribute",
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static readonly DiagnosticDescriptor InvalidSqsEventAttribute = new DiagnosticDescriptor(id: "AWSLambda0116",
title: "Invalid SQSEventAttribute",
messageFormat: "Invalid SQSEventAttribute encountered: {0}",
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static readonly DiagnosticDescriptor InvalidLambdaMethodSignature = new DiagnosticDescriptor(id: "AWSLambda0117",
title: "Invalid Lambda Method Signature",
messageFormat: "Invalid Lambda method signature encountered: {0}",
category: "AWSLambdaCSharpGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);
}
}
Loading

0 comments on commit bd3209a

Please sign in to comment.