Skip to content

Commit

Permalink
add helper for nodejs lambda function
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvictor committed Apr 8, 2024
1 parent c405b47 commit a58e699
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aws_packages"
version = "0.0.10"
version = "0.0.12"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
21 changes: 21 additions & 0 deletions aws_packages/infra/common_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,27 @@ def _create_python_lambda_function(
)
return _lambda_function

def _create_node_lambda_function(
self,
identifier: str,
source: str,
lambda_layers: list,
envs: dict,
function_handler: str,
):
_lambda_function = lambda_.Function(
self,
identifier,
function_name=identifier,
code=lambda_.Code.from_asset(path.join(source)),
handler=function_handler,
runtime=lambda_.Runtime.NODEJS_20_X,
timeout=Duration.seconds(300),
layers=lambda_layers,
environment=envs,
)
return _lambda_function

def _create_api_gw(self, identifier: str, handler_function):
api_gateway_resource = apigw.LambdaRestApi(
self,
Expand Down

0 comments on commit a58e699

Please sign in to comment.