CDK Ast Lambda Rest Api - Lambda Package
Project description
CDK Ast Lambda Rest API - Lambda Packge (CALRA)
A library for AWS API Gateway/Lambda Proxy Integration
CALRA allows simplified resource creation for AWS Lambda functions and Rest API resources by using decorators and setting a builder with default, common or custom values for IAM Roles, Runtimes, Timeouts, Layers, Environment values, etc.
This module provides the definition of decorators that are used within lambda handlers to add special configuration options for your Lambda Function.
Installation
calra_lambda
is available from PyPI as calra-lambda
:
pip install calra-lambda
You can as well rely on the calra-example repository to get started. To take full advantage of this package, installation of calra-cdk is recommended.
Add decorators to your Lambda Handler
The decorators defined within this package are:
- GET, POST, PUT, DELETE, ANY are explicitly required for every handler and need to be defined with a custom path for your REST Endpoint.
- timeout will accept an integer value that will be transformed to duration in terms of seconds for a Lambda Function.
- memory_size will accept an integer value to specify the memory that will be assigned to each instance of your Lambda Function.
- name and description assign a custom string value passed as parameter to your Lambda Function's name and description.
- runtime, role, vpc. Each decorator receives a name string as identifier for a custom value defined for your stack using the calra-cdk module.
- environment, layer and security_group decorators can receive multi arguments or a list with the names of custom environment/layers/security_groups defined for your stack using the calra-cdk module.
from calra_lambda import *
import json
@GET('/dogs')
@runtime('python3.11')
@name('LBD-DOGS-GET')
@memory_size(256)
def lambda_handler(event, context):
response = {
'statusCode': 200,
'body': json.dumps({
'message': 'Hello World from /dogs!'
})
}
return response
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file calra_lambda-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: calra_lambda-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 631741dc7bc6ed2813a12a11c9c58f71f3fabf6d324360a07e3b201bdb6a7098 |
|
MD5 | 6baa3dc2a7f3f8f93a3185519de32e04 |
|
BLAKE2b-256 | bdca19e0dcfdbf320a4b6f151d23bad6aa4bf48dbbea58337215a88b7e19bfdb |