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 3, 2024
1 parent 25ae0d9 commit f2f5d06
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 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)
10 changes: 5 additions & 5 deletions examples/python-stack/cdk_python/cdk_python_stack.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from constructs import Construct
from datadog_cdk_constructs_v2 import Datadog, DatadogProps
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 = Datadog(
datadog = DatadogLambda(
self,
"Datadog",
dotnet_layer_version=15,
Expand All @@ -22,6 +22,6 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
site="datadoghq.com",
)

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

0 comments on commit f2f5d06

Please sign in to comment.