aws / aws/aws-lambda-dotnet

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

Open
#1,524 1 comment 0 reactions 0 assignees View on GitHub
feature-request module/lambda-client-lib p2 queued
Dominant language
C#
Stars
1.7k
Forks
503
Avg merge
1d 5h
Merged PRs (30d)
18

Description

### 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:
```c#
[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
```json
{
"....": "....",
"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

- [X] 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.