Skip to content

Commit

Permalink
feat: Support both Lambda APIs in the example Python stack
Browse files Browse the repository at this point in the history
  • Loading branch information
lym953 committed Oct 2, 2024
1 parent 72cd399 commit 3eb3fc1
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/python-stack/app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env python3
from aws_cdk import App
from cdk_python.cdk_python_stack import CdkPythonStack
from cdk_python.cdk_python_lambda_old_api_stack import CdkPythonLambdaOldApiStack

app = App()
CdkPythonStack(app, "CdkPythonStack")
CdkPythonLambdaOldApiStack(app, "CdkPythonLambdaOldApiStack")

app.synth()
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from constructs import Construct
from datadog_cdk_constructs_v2 import Datadog, DatadogProps
import os
from cdk_python.cdk_python_stack_base import CdkPythonStackBase

class CdkPythonLambdaOldApiStack(CdkPythonStackBase):
def __init__(self, scope: Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)

datadog = Datadog(
self,
"Datadog",
dotnet_layer_version=15,
node_layer_version=107,
python_layer_version=89,
extension_layer_version=55,
add_layers=True,
api_key=os.getenv("DD_API_KEY"),
enable_datadog_tracing=True,
enable_datadog_asm=True,
flush_metrics_to_logs=True,
site="datadoghq.com",
)

# Ensure DatadogProps can be imported properly
props = DatadogProps()
datadog.add_lambda_functions(self.lambdaFunctions)
27 changes: 27 additions & 0 deletions examples/python-stack/cdk_python/cdk_python_stack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from constructs import Construct
from datadog_cdk_constructs_v2 import DatadogLambda, DatadogLambdaProps
import os
from cdk_python.cdk_python_stack_base import CdkPythonStackBase

class CdkPythonStack(CdkPythonStackBase):
def __init__(self, scope: Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)

datadog = DatadogLambda(
self,
"Datadog",
dotnet_layer_version=15,
node_layer_version=107,
python_layer_version=89,
extension_layer_version=55,
add_layers=True,
api_key=os.getenv("DD_API_KEY"),
enable_datadog_tracing=True,
enable_datadog_asm=True,
flush_metrics_to_logs=True,
site="datadoghq.com",
)

# Ensure DatadogLambdaProps can be imported properly
props = DatadogLambdaProps()
datadog.add_lambda_functions(self.lambdaFunctions)

0 comments on commit 3eb3fc1

Please sign in to comment.