@@ -232,7 +232,7 @@ def __init__(self, feature_name: str, handlers_dir: Path) -> None:
232
232
self .account_id = self .session .client ("sts" ).get_caller_identity ()["Account" ]
233
233
self .region = self .session .region_name
234
234
235
- def create_lambda_functions (self , function_props : Optional [Dict ] = None ):
235
+ def create_lambda_functions (self , function_props : Optional [Dict ] = None ) -> Dict [ str , Function ] :
236
236
"""Create Lambda functions available under handlers_dir
237
237
238
238
It creates CloudFormation Outputs for every function found in PascalCase. For example,
@@ -244,6 +244,11 @@ def create_lambda_functions(self, function_props: Optional[Dict] = None):
244
244
function_props: Optional[Dict]
245
245
CDK Lambda FunctionProps as dictionary to override defaults
246
246
247
+ Returns
248
+ -------
249
+ output: Dict[str, Function]
250
+ A dict with PascalCased function names and the corresponding CDK Function object
251
+
247
252
Examples
248
253
--------
249
254
@@ -265,6 +270,8 @@ def create_lambda_functions(self, function_props: Optional[Dict] = None):
265
270
source = Code .from_asset (f"{ self .handlers_dir } " )
266
271
props_override = function_props or {}
267
272
273
+ output : Dict [str , Function ] = {}
274
+
268
275
for fn in handlers :
269
276
fn_name = fn .stem
270
277
function_settings = {
@@ -299,6 +306,10 @@ def create_lambda_functions(self, function_props: Optional[Dict] = None):
299
306
name = fn_name_pascal_case , value = function_python .function_name , arn = function_python .function_arn
300
307
)
301
308
309
+ output [fn_name_pascal_case ] = function_python
310
+
311
+ return output
312
+
302
313
def deploy (self ) -> Dict [str , str ]:
303
314
"""Creates CloudFormation Stack and return stack outputs as dict
304
315
0 commit comments