File tree Expand file tree Collapse file tree 1 file changed +41
-1
lines changed
Libraries/src/Amazon.Lambda.Annotations Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,47 @@ The above two examples when used together will the use the value of LambdaRolePa
87
87
To bridge the gap from Lambda Annotations programming model to the normal programming model a .NET source generator is included in this package.
88
88
After adding the attributes to your .NET code the source generator will generate the translation code between the 2 programming models. It will also
89
89
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
+ ```
91
131
92
132
To see the code that is generated by the source generator turn the verbosity to detailed when executing a build. From the command this
93
133
is done by using the ` --verbosity ` switch.
You can’t perform that action at this time.
0 commit comments