Package: b-lambda-layer-common
B.LambdaLayerCommonDEPRECATION WARNING !!!This library no longer supports lambda layers and eventually will be moved to another repository.
It is a simple python library of common methods to develop in AWS environment.
Create your own lambda layer usingand specify this library as a dependency. Example given below.fromb_cfn_lambda_layer.lambda_layerimportLambdaLayerlayer=LambdaLayer(...,dependencies={'b-lambda_layer_common':PackageVersion.from_string_version('4.0.0'),})DescriptionThis is a simple python library, that contains various useful methods that will make infrastructure development
much easier.RemarksBiomapasaims to modernise life-science industry by sharing its IT knowledge with other companies and the community.
This is an open source library intended to be used by anyone.
Improvements and pull requests are welcome.Related technologyPython3DockerAWS CDKAWS LambdaAssumptionsThis project assumes you have good knowledge in AWS.Good Python skills and basis of OOP.Useful sourcesNone.InstallBefore installing this library, ensure you have these tools setup:Python / PipTo install this project from source run:pip install .Or you can install it from a PyPi repository:pip install b-lambda_layer_commonUsage & ExamplesMain modules:api_gatewayContains various functionalities related to API Gateway service and integrations.cacheContains caching mechanisms for lambda functions.eventsContains functionality that supports event-driven architectures.exceptionsContains advanced exception handling and propagation between lambda function chains.ssmContains SSM parameter store handling logic.utilContains random fun stuff ;)validationVarious value validations for python.ws_api_gatewayContains various functionalities related to API Gateway websocket service and integrations.TestingThis package has unit tests based onpytest.
To run tests simply run:pytest --cov=b_lambda_layer_common b_lambda_layer_common_test/unit --cov-fail-under=80ContributionFound a bug? Want to add or suggest a new feature?
Contributions of any kind are gladly welcome.
You may contact us directly, create a pull-request or an issue in github platform.
Lets modernize the world together.Release history4.4.0Add decoratorremove_headerremoving desired headers from API Gateway integration lambda event.4.3.0ImproveValueValidatorby addingnot_contains_whitespacemethod.MakeValueValidatorPresetsmore flexible.4.2.2MakeMalformedPermissionErorrinherit straight fromHttpException.4.2.1Typehint fixes.4.2.0Add more customBExceptionexceptions.420 hehe...4.1.0Add ability to specify custom exception when performing value validation.4.0.0Deprecate lambda layer functionality. Now this is a simple python lib with common AWS-related functionality.
Usehttps://github.com/Biomapas/B.CfnLambdaLayerto create lambda layers.RemoveDynamoDb&PynamoDbfunctionality from this code. It has been moved and improved.
Find everything here:https://github.com/Biomapas/B.DynamoDbCommon.3.3.0Allow access of the value within validators.3.2.0Add epic validation!AddValueValidatorfor basic validation.AddValueValidatorPresetfor convenient validation.3.1.0Extract api key from lambda event.Extract body from lambda event.3.0.1Extend boto3 step-functions call timeout to maximum lambda execution time (15 minutes).3.0.0Use the newest base layerB.CfnLambdaLayerwhich uses new asset bundling mechanism (Dockerfile).2.4.0Add Boto3 client validation under SfnCall function.2.3.4Add functionality to pass Boto3 client to SfnCall function for multithreding support.2.3.3Fix api empty dict serialization.2.3.2Improve parsing of JWT claims from API Gateway authorizer output.2.3.1If you want to usecryptographymodule, you must use Python 3.8.Add explanations for Python 3.8 versions.Fix supported layer python versions.2.3.0Add Fernet encryption PynamoDB attribute.2.2.1Fix KmsAttribute by introducing base64 encode/decode.2.2.0Add field validator in util directory. Simple string validation.Add KMS attribute for PynamoDB.2.1.2Add a list bytes batching utility.2.0.6Handle errors when raising ValueError in SfnCall class.2.0.4Simple return JSON of an output if SfnCall raised ValueError.2.0.1Include .txt files.2.0.0Complete refactor.Fix ugly if/else imports.Run unit tests inside lambda functions.Use b_cfn_lambda_layer dependency.Write more unit and integration tests.Add README documentation.1.20.0Add validation when bundling with Docker.1.19.0General testing improvements.Add Layer V2 integration tests.1.18.0Add V2 Layer class to enable installation of dependencies.1.16.0Add response method to return any type.Addtext/htmlandtext/plainheaders.Add missingfieldsparameter support toNeighbourEndpointclass.1.15.1Improve function return value handling forInMemoryDataCacheclass.1.15.0Add in-memory data caching functionality.1.14.0Addfieldsparameter support toHttpEndpointclass.1.11.1Update DoNotUpdate class to be usable as a type.1.11.0Add WebSocket Api Gateway message class to form consistent messages.1.10.2Allow for changing HttpEndpoint behavior.1.10.1Add ability to specify if to fail to errors.Try to read from env event bus name.1.10.0Add factory to emit EventBridge events.1.9.5Make the code a little more robust and less error prone.1.9.4Assets input may contain garbage files too, hence, apply
cleanup commands directly on asset outputs folder.1.9.3Add builds badge.1.9.2Remove leftover code.Update requirements.1.9.1Delete unnecessary files which result in different asset hash.Calculate hash when bundling.1.9.0Add CSV headers.1.8.3Ensure everything works with a robust integration test.1.8.2Improve Boto3Version class.1.8.1Fix bug when boto3 version is specified project files
are not copied.1.8.0Change asset bundling to asset docker bundling if additional
dependencies are specified.Add ability to install boto3 library.Add more unit tests.Add integration tests to deploy and test the Layer in AWS.1.7.0Simplify SSM parameters functionality.Add robust SSM parameter tests.1.6.2Do not serialize returned ssm parameters.1.6.1Add more logging for better visibility.1.6.0SSM should_refresh function should be public.1.5.1Add logging on ssm error decorator.1.5.0Force using error_class to error_classes.1.4.0Add functionality to fetch and cache SSM parameters.Add OS type parameters.1.3.0Add media Response and wav/mpeg headers.1.2.0Add DoNotUpdate class, useful when checking what parameters to update and what not.1.1.3Implement retrying logic to HttpCall.1.1.2Make sure test coverage is at least 80%.Add CI/CD pipeline.Add more encodings to decode responses.1.1.1Add urllib3 dependency.1.1.0Add DynamoDBEncoder that subclasses DecimalEncoder and additionally encodes sets as lists.1.0.3Modify call_to_json function by checking whether the response contains body.1.0.2Add exception logging for failed imports.1.0.1Expose http_endpoint on NeigbourEndpoint class.1.0.0Release version with major braking changes.Consistent naming for imports.Unit tests to cover all functions and classes.Add neighbour endpoint.General code improvements and cleanup.0.0.16Fix logging imports.Add logging of exception tracebacks to exception_middleware.Add logging about HTTP requests.Set request scheme for parent API Gateway urls depending on current protocol.0.0.15Add a CognitoAccessToken for parsing access token information provided by the API Gateway using Cognito authorizer.0.0.14Add a LoggingManager for setting up logging configuration0.0.13Add custom JSON encoder with support for decimal.Decimal encoding0.0.12Implement API Gateway body parsing.0.0.11Fix imports.0.0.10Implement exceptions.0.0.9Fix api gateway url.0.0.8Add xml to dict converter utility. No dependencies.0.0.7Fix imports.0.0.6Add ability to check whether singleton was initialized.0.0.5Remove description.0.0.4Do not create an extra stack.0.0.3Add safe initialization.0.0.2Add Layer class and Singleton.0.0.1Initial build.