Lambda Annotations - make it easier to work with configured api gateways

Open
#1,524 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
aws, csharp
Domain
api, backend

Research direction

Start with Libraries/src/Amazon.Lambda.Annotations/APIGateway/RestApiAttribute.cs and trace how its annotations become events in template.json or template.yaml. Verify how an existing API resource is identified, then confirm that the generated event includes a RestApiId reference to it; add or update focused tests if the repository provides coverage for this generation path.

Written by the indexing model from the issue text.

Description

feature-request module/lambda-client-lib p2 queued
Describe the feature

Add possibility to reference existing APIs on functions through annotations rather than today where manual template changes are needed.

Use Case

When using lambda annotations with multiple functions under the same gateway (for auth purposes, certificates, domains etc) it's tiresome and possibly error-prone to manually handle template changes.

Proposed Solution

On the lambda functions, add functionality to reference an existing API. An example usage could look like this:

 [LambdaFunction(Name = "UpdateStatus")]
 [RestApi(LambdaHttpMethod.Post, "/{x}/{y}/endpoint-path", "OrdersApiGateway")]
public APIGatewayProxyResponse Execute() {
}

where the new addition is to the "RestApi" path, where a new parameter (RestApiId) is configurable. In the example the value "OrdersApiGateway" is used.

This will then in the template.json|yaml add

{
    "....": "....",
    "RestApiId": {
        "Ref": "OrdersApiGateway"
    }
}

to the events part of the template which should be a reference to a resource in the template which has the API Gateway configured.


If the usage looks OK it will be added to REST API attribute here
https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.Annotations/APIGateway/RestApiAttribute.cs

Other Information

No response

Acknowledgements
  • I may be able to implement this feature request
  • This feature might incur a breaking change
AWS .NET SDK and/or Package version used

Amazon.Lambda.Annotations

Targeted .NET Platform

.NET 6

Operating System and version

MacOS Ventura

Dominant language
C#
Stars
1.7k
Forks
503
Avg merge
1d 18h
Merged PRs (30d)
21

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/aws-lambda-dotnet

All issues in aws/aws-lambda-dotnet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.