@@ -272,6 +272,30 @@ def _get_lambda_code_param(
272
272
return code
273
273
274
274
275
+ def _transform_function_to_model (function ):
276
+ model_properties = [
277
+ "MemorySize" ,
278
+ "Description" ,
279
+ "TracingConfig" ,
280
+ "Timeout" ,
281
+ "Handler" ,
282
+ "SnapStartResponse" ,
283
+ "Role" ,
284
+ "FileSystemConfigs" ,
285
+ "FunctionName" ,
286
+ "Runtime" ,
287
+ "PackageType" ,
288
+ "LoggingConfig" ,
289
+ "Environment" ,
290
+ "Arn" ,
291
+ "EphemeralStorage" ,
292
+ "Architectures" ,
293
+ ]
294
+ response_model = util .select_attributes (function , model_properties )
295
+ response_model ["Arn" ] = function ["FunctionArn" ]
296
+ return response_model
297
+
298
+
275
299
class LambdaFunctionProvider (ResourceProvider [LambdaFunctionProperties ]):
276
300
TYPE = "AWS::Lambda::Function" # Autogenerated. Don't change
277
301
SCHEMA = util .get_schema_path (Path (__file__ )) # Autogenerated. Don't change
@@ -407,7 +431,14 @@ def read(
407
431
- lambda:GetFunction
408
432
- lambda:GetFunctionCodeSigningConfig
409
433
"""
410
- raise NotImplementedError
434
+ function_name = request .desired_state ["FunctionName" ]
435
+ lambda_client = request .aws_client_factory .lambda_
436
+ get_fn_response = lambda_client .get_function (FunctionName = function_name )
437
+
438
+ return ProgressEvent (
439
+ status = OperationStatus .SUCCESS ,
440
+ resource_model = _transform_function_to_model (get_fn_response ["Configuration" ]),
441
+ )
411
442
412
443
def delete (
413
444
self ,
@@ -521,5 +552,5 @@ def list(
521
552
functions = request .aws_client_factory .lambda_ .list_functions ()
522
553
return ProgressEvent (
523
554
status = OperationStatus .SUCCESS ,
524
- resource_models = [LambdaFunctionProperties ( ** fn ) for fn in functions ["Functions" ]],
555
+ resource_models = [_transform_function_to_model ( fn ) for fn in functions ["Functions" ]],
525
556
)
0 commit comments