diff --git a/localstack-core/localstack/services/lambda_/resource_providers/aws_lambda_function.py b/localstack-core/localstack/services/lambda_/resource_providers/aws_lambda_function.py index f076dd8f1ce93..60b9c36b4c2ac 100644 --- a/localstack-core/localstack/services/lambda_/resource_providers/aws_lambda_function.py +++ b/localstack-core/localstack/services/lambda_/resource_providers/aws_lambda_function.py @@ -272,6 +272,30 @@ def _get_lambda_code_param( return code +def _transform_function_to_model(function): + model_properties = [ + "MemorySize", + "Description", + "TracingConfig", + "Timeout", + "Handler", + "SnapStartResponse", + "Role", + "FileSystemConfigs", + "FunctionName", + "Runtime", + "PackageType", + "LoggingConfig", + "Environment", + "Arn", + "EphemeralStorage", + "Architectures", + ] + response_model = util.select_attributes(function, model_properties) + response_model["Arn"] = function["FunctionArn"] + return response_model + + class LambdaFunctionProvider(ResourceProvider[LambdaFunctionProperties]): TYPE = "AWS::Lambda::Function" # Autogenerated. Don't change SCHEMA = util.get_schema_path(Path(__file__)) # Autogenerated. Don't change @@ -407,7 +431,14 @@ def read( - lambda:GetFunction - lambda:GetFunctionCodeSigningConfig """ - raise NotImplementedError + function_name = request.desired_state["FunctionName"] + lambda_client = request.aws_client_factory.lambda_ + get_fn_response = lambda_client.get_function(FunctionName=function_name) + + return ProgressEvent( + status=OperationStatus.SUCCESS, + resource_model=_transform_function_to_model(get_fn_response["Configuration"]), + ) def delete( self, @@ -521,5 +552,5 @@ def list( functions = request.aws_client_factory.lambda_.list_functions() return ProgressEvent( status=OperationStatus.SUCCESS, - resource_models=[LambdaFunctionProperties(**fn) for fn in functions["Functions"]], + resource_models=[_transform_function_to_model(fn) for fn in functions["Functions"]], ) diff --git a/tests/aws/services/s3/test_s3.py b/tests/aws/services/s3/test_s3.py index 126cb1654d247..9906cd36793a7 100644 --- a/tests/aws/services/s3/test_s3.py +++ b/tests/aws/services/s3/test_s3.py @@ -7488,6 +7488,7 @@ def test_presigned_url_signature_authentication_multi_part( assert response.content == data @pytest.mark.skipif(condition=TEST_S3_IMAGE, reason="Lambda not enabled in S3 image") + @pytest.mark.skip(reason="flaky") @markers.aws.validated def test_presigned_url_v4_x_amz_in_qs( self,