Skip to content

Commit b92193e

Browse files
committed
catalog runtime data
1 parent d001b3d commit b92193e

6 files changed

Lines changed: 141 additions & 80 deletions

File tree

src/constants.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import { DatadogAppSecMode } from "./interfaces";
10-
import { lambdaLayerCatalog } from "./layer-catalog";
10+
import { layerRuntimeCatalog } from "./layer-runtime-catalog";
1111

1212
export const LAYER_PREFIX = "DatadogLayer";
1313
export const EXTENSION_LAYER_PREFIX = "DatadogExtension";
@@ -38,7 +38,6 @@ const runtimeTypeLookup: { [key: string]: RuntimeType } = {
3838
JAVA: RuntimeType.JAVA,
3939
RUBY: RuntimeType.RUBY,
4040
CUSTOM: RuntimeType.CUSTOM,
41-
UNSUPPORTED: RuntimeType.UNSUPPORTED,
4241
};
4342

4443
export const DatadogLambdaDefaultProps = {
@@ -70,15 +69,13 @@ export enum TagKeys {
7069
}
7170

7271
export const runtimeLookup: { [key: string]: RuntimeType } = Object.fromEntries(
73-
lambdaLayerCatalog.runtimes.flatMap((runtime) =>
72+
layerRuntimeCatalog.flatMap((runtime) =>
7473
"runtimeType" in runtime ? [[runtime.runtime, runtimeTypeLookup[runtime.runtimeType]]] : [],
7574
),
7675
);
7776

78-
export const runtimeToLayerName: { [key: string]: string } = Object.fromEntries(
79-
lambdaLayerCatalog.runtimes.flatMap((runtime) =>
80-
"layerName" in runtime ? [[runtime.runtime, runtime.layerName]] : [],
81-
),
77+
export const runtimeToLayerName: { [key: string]: { x86_64: string; arm64: string } } = Object.fromEntries(
78+
layerRuntimeCatalog.flatMap((runtime) => ("layerNames" in runtime ? [[runtime.runtime, runtime.layerNames]] : [])),
8279
);
8380

8481
export const govCloudRegions: ReadonlyArray<string> = ["us-gov-east-1", "us-gov-west-1"];

src/layer-catalog.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/layer-runtime-catalog.ts

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/*
2+
* Unless explicitly stated otherwise all files in this repository are licensed
3+
* under the Apache License Version 2.0.
4+
*
5+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
6+
* Copyright 2026 Datadog, Inc.
7+
*/
8+
9+
/*
10+
* DO NOT EDIT: This file is autogenerated.
11+
*/
12+
13+
export const layerRuntimeCatalog = [
14+
{
15+
runtime: "dotnet6",
16+
runtimeType: "DOTNET",
17+
layerNames: { x86_64: "dd-trace-dotnet", arm64: "dd-trace-dotnet-ARM" },
18+
},
19+
{
20+
runtime: "dotnet8",
21+
runtimeType: "DOTNET",
22+
layerNames: { x86_64: "dd-trace-dotnet", arm64: "dd-trace-dotnet-ARM" },
23+
},
24+
{
25+
runtime: "dotnet10",
26+
runtimeType: "DOTNET",
27+
layerNames: { x86_64: "dd-trace-dotnet", arm64: "dd-trace-dotnet-ARM" },
28+
},
29+
{
30+
runtime: "nodejs12.x",
31+
runtimeType: "NODE",
32+
layerNames: { x86_64: "Datadog-Node12-x", arm64: "Datadog-Node12-x-ARM" },
33+
},
34+
{
35+
runtime: "nodejs14.x",
36+
runtimeType: "NODE",
37+
layerNames: { x86_64: "Datadog-Node14-x", arm64: "Datadog-Node14-x-ARM" },
38+
},
39+
{
40+
runtime: "nodejs16.x",
41+
runtimeType: "NODE",
42+
layerNames: { x86_64: "Datadog-Node16-x", arm64: "Datadog-Node16-x-ARM" },
43+
},
44+
{
45+
runtime: "nodejs18.x",
46+
runtimeType: "NODE",
47+
layerNames: { x86_64: "Datadog-Node18-x", arm64: "Datadog-Node18-x-ARM" },
48+
},
49+
{
50+
runtime: "nodejs20.x",
51+
runtimeType: "NODE",
52+
layerNames: { x86_64: "Datadog-Node20-x", arm64: "Datadog-Node20-x-ARM" },
53+
},
54+
{
55+
runtime: "nodejs22.x",
56+
runtimeType: "NODE",
57+
layerNames: { x86_64: "Datadog-Node22-x", arm64: "Datadog-Node22-x-ARM" },
58+
},
59+
{
60+
runtime: "nodejs24.x",
61+
runtimeType: "NODE",
62+
layerNames: { x86_64: "Datadog-Node24-x", arm64: "Datadog-Node24-x-ARM" },
63+
},
64+
{
65+
runtime: "python3.6",
66+
runtimeType: "PYTHON",
67+
layerNames: { x86_64: "Datadog-Python36", arm64: "Datadog-Python36-ARM" },
68+
},
69+
{
70+
runtime: "python3.7",
71+
runtimeType: "PYTHON",
72+
layerNames: { x86_64: "Datadog-Python37", arm64: "Datadog-Python37-ARM" },
73+
},
74+
{
75+
runtime: "python3.8",
76+
runtimeType: "PYTHON",
77+
layerNames: { x86_64: "Datadog-Python38", arm64: "Datadog-Python38-ARM" },
78+
},
79+
{
80+
runtime: "python3.9",
81+
runtimeType: "PYTHON",
82+
layerNames: { x86_64: "Datadog-Python39", arm64: "Datadog-Python39-ARM" },
83+
},
84+
{
85+
runtime: "python3.10",
86+
runtimeType: "PYTHON",
87+
layerNames: { x86_64: "Datadog-Python310", arm64: "Datadog-Python310-ARM" },
88+
},
89+
{
90+
runtime: "python3.11",
91+
runtimeType: "PYTHON",
92+
layerNames: { x86_64: "Datadog-Python311", arm64: "Datadog-Python311-ARM" },
93+
},
94+
{
95+
runtime: "python3.12",
96+
runtimeType: "PYTHON",
97+
layerNames: { x86_64: "Datadog-Python312", arm64: "Datadog-Python312-ARM" },
98+
},
99+
{
100+
runtime: "python3.13",
101+
runtimeType: "PYTHON",
102+
layerNames: { x86_64: "Datadog-Python313", arm64: "Datadog-Python313-ARM" },
103+
},
104+
{
105+
runtime: "python3.14",
106+
runtimeType: "PYTHON",
107+
layerNames: { x86_64: "Datadog-Python314", arm64: "Datadog-Python314-ARM" },
108+
},
109+
{ runtime: "java8.al2", runtimeType: "JAVA", layerNames: { x86_64: "dd-trace-java", arm64: "dd-trace-java-ARM" } },
110+
{ runtime: "java11", runtimeType: "JAVA", layerNames: { x86_64: "dd-trace-java", arm64: "dd-trace-java-ARM" } },
111+
{ runtime: "java17", runtimeType: "JAVA", layerNames: { x86_64: "dd-trace-java", arm64: "dd-trace-java-ARM" } },
112+
{ runtime: "java21", runtimeType: "JAVA", layerNames: { x86_64: "dd-trace-java", arm64: "dd-trace-java-ARM" } },
113+
{ runtime: "java25", runtimeType: "JAVA", layerNames: { x86_64: "dd-trace-java", arm64: "dd-trace-java-ARM" } },
114+
{ runtime: "provided", runtimeType: "CUSTOM" },
115+
{ runtime: "provided.al2", runtimeType: "CUSTOM" },
116+
{ runtime: "provided.al2023", runtimeType: "CUSTOM" },
117+
{ runtime: "ruby3.2", runtimeType: "RUBY" },
118+
{ runtime: "ruby3.3", runtimeType: "RUBY" },
119+
{ runtime: "ruby3.4", runtimeType: "RUBY" },
120+
{ runtime: "ruby4.0", runtimeType: "RUBY" },
121+
{ runtime: "ruby32", layerNames: { x86_64: "Datadog-Ruby3-2", arm64: "Datadog-Ruby3-2-ARM" } },
122+
{ runtime: "ruby33", layerNames: { x86_64: "Datadog-Ruby3-3", arm64: "Datadog-Ruby3-3-ARM" } },
123+
{ runtime: "ruby34", layerNames: { x86_64: "Datadog-Ruby3-4", arm64: "Datadog-Ruby3-4-ARM" } },
124+
{ runtime: "ruby40", layerNames: { x86_64: "Datadog-Ruby4-0", arm64: "Datadog-Ruby4-0-ARM" } },
125+
] as const;

src/layer-versions.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66
* Copyright 2026 Datadog, Inc.
77
*/
88

9-
import { lambdaLayerCatalog } from "./layer-catalog";
10-
11-
/**
9+
/*
1210
* Default Datadog Lambda layer versions bundled with this construct. These are
1311
* used when a corresponding `*LayerVersion`/`*LayerArn` prop is not provided.
1412
* Exposed as a class so the values are available in all jsii languages.
13+
*
14+
* DO NOT EDIT: This file is autogenerated.
1515
*/
16+
1617
export class DatadogDefaultLayerVersions {
17-
public static readonly NODE = lambdaLayerCatalog.defaultLayerVersions.node;
18-
public static readonly PYTHON = lambdaLayerCatalog.defaultLayerVersions.python;
19-
public static readonly JAVA = lambdaLayerCatalog.defaultLayerVersions.java;
20-
public static readonly DOTNET = lambdaLayerCatalog.defaultLayerVersions.dotnet;
21-
public static readonly RUBY = lambdaLayerCatalog.defaultLayerVersions.ruby;
22-
public static readonly EXTENSION = lambdaLayerCatalog.defaultLayerVersions.extension;
18+
public static readonly NODE = 142;
19+
public static readonly PYTHON = 127;
20+
public static readonly JAVA = 27;
21+
public static readonly DOTNET = 25;
22+
public static readonly RUBY = 30;
23+
public static readonly EXTENSION = 99;
2324
}

src/layer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,7 @@ export function getLambdaLayerArn(
292292
isArm: boolean,
293293
accountId?: string,
294294
): string {
295-
const baseLayerName = runtimeToLayerName[runtime];
296-
const layerName = isArm ? `${baseLayerName}-ARM` : baseLayerName;
295+
const layerName = runtimeToLayerName[runtime]?.[isArm ? "arm64" : "x86_64"];
297296
const partition = getAWSPartitionFromRegion(region);
298297
// TODO: edge case where gov cloud is the region, but they are using a token so we can't resolve it.
299298
const isGovCloud = govCloudRegions.includes(region);

test/layer.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,13 +704,11 @@ describe("applyLayers", () => {
704704
runtime: lambda.Runtime.NODEJS_18_X,
705705
code: lambda.Code.fromAsset("test"),
706706
handler: "hello.handler",
707-
architecture: Architecture.X86_64,
708707
});
709708
const hello2 = new lambda.Function(stack, "PythonHandler", {
710709
runtime: lambda.Runtime.PYTHON_3_8,
711710
code: lambda.Code.fromAsset("test/lambda"),
712711
handler: "example-lambda.handler",
713-
architecture: Architecture.ARM_64,
714712
});
715713
const errors1 = applyLayers(stack, stack.region, hello1);
716714
const errors2 = applyLayers(stack, stack.region, hello2);
@@ -721,7 +719,7 @@ describe("applyLayers", () => {
721719
});
722720
Template.fromStack(stack).hasResourceProperties("AWS::Lambda::Function", {
723721
Layers: Match.arrayWith([
724-
`arn:aws:lambda:us-west-2:${DD_ACCOUNT_ID}:layer:Datadog-Python38-ARM:${DatadogDefaultLayerVersions.PYTHON}`,
722+
`arn:aws:lambda:us-west-2:${DD_ACCOUNT_ID}:layer:Datadog-Python38:${DatadogDefaultLayerVersions.PYTHON}`,
725723
]),
726724
});
727725
expect(errors1).toEqual([]);

0 commit comments

Comments
 (0)