Skip to content

Commit 13ee9b6

Browse files
committed
chore: Update README.md to outline support for JSON and YAML CloudFormation templates
1 parent c313f67 commit 13ee9b6

File tree

1 file changed

+41
-1
lines changed
  • Libraries/src/Amazon.Lambda.Annotations

1 file changed

+41
-1
lines changed

Libraries/src/Amazon.Lambda.Annotations/README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,47 @@ The above two examples when used together will the use the value of LambdaRolePa
8787
To bridge the gap from Lambda Annotations programming model to the normal programming model a .NET source generator is included in this package.
8888
After adding the attributes to your .NET code the source generator will generate the translation code between the 2 programming models. It will also
8989
keep in sync the generated information including a new function handler string into the CloudFormation template. The usage of source
90-
generator is transparent to the user.
90+
generator is transparent to the user. The source generator supports syncing of both JSON and YAML CloudFormation templates.
91+
```csharp
92+
[LambdaFunction(Name = "Plus")]
93+
[RestApi(LambdaHttpMethod.Get, "/plus/{x}/{y}")]
94+
public int Plus(int x, int y)
95+
{
96+
return x + y;
97+
}
98+
```
99+
The source generator adds the following entry in the CloudFormation template corresponding to the above Lambda function:
100+
```json
101+
"Plus": {
102+
"Type": "AWS::Serverless::Function",
103+
"Metadata": {
104+
"Tool": "Amazon.Lambda.Annotations",
105+
"SyncedEvents": [
106+
"RootGet"
107+
]
108+
},
109+
"Properties": {
110+
"Runtime": "dotnet6",
111+
"CodeUri": ".",
112+
"MemorySize": 256,
113+
"Timeout": 30,
114+
"Policies": [
115+
"AWSLambdaBasicExecutionRole"
116+
],
117+
"PackageType": "Zip",
118+
"Handler": "TestServerlessApp::TestServerlessApp.Functions_Plus_Generated::Plus",
119+
"Events": {
120+
"RootGet": {
121+
"Type": "Api",
122+
"Properties": {
123+
"Path": "/plus/{x}/{y}",
124+
"Method": "GET"
125+
}
126+
}
127+
}
128+
}
129+
}
130+
```
91131

92132
To see the code that is generated by the source generator turn the verbosity to detailed when executing a build. From the command this
93133
is done by using the `--verbosity` switch.

0 commit comments

Comments
 (0)