Skip to content
Merged
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
31 changes: 30 additions & 1 deletion Libraries/src/Amazon.Lambda.Annotations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,35 @@ public class Functions
}
```

## Using References To Other Resources and Parameters in the template

To use a reference to a Resource or Parameter in the template, prefix the value with `@`. Example shows using CloudFormation template Parameter named `LambdaRoleParameter` for the role of the Lambda function.
```csharp
public class Functions
{
[LambdaFunction( Role="@LambdaRoleParameter")]
[RestApi("/plus/{x}/{y}")]
public int Plus(int x, int y)
{
return x + y;
}
}
```

and place in your template:

```

"Parameters": {
"LambdaExecutionRole": {
"Type": "String"
}
},

```

The above two examples when used together will the use the value of LambdaRoleParameter as the role during deployment.

## Source Generator

To bridge the gap from Lambda Annotations programming model to the normal programming model a .NET source generator is included in this package.
Expand Down Expand Up @@ -104,7 +133,7 @@ public class Functions


[LambdaFunction]
[HttpApi(HttpMethod.Put, HttpApiVersion.V2, "/process/{name}")]
[HttpApi(LambdaHttpMethod.Put, "/process/{name}", Version = HttpApiVersion.V2)]
public async Task Process([FromServices] ITracker tracker, string name, [FromBody] string data)
{
tracker.Record();
Expand Down