in packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js [28:134]
constructor(scope, id, props) {
super(scope, id, props);
// Python Runtime
// Layers
new PythonLayerVersion(this, 'PythonLayerVersion', {
compatibleRuntimes: [
Runtime.PYTHON_3_12,
],
entry: './src/python/Layer',
});
new LayerVersion(this, 'LayerVersion', {
compatibleRuntimes: [
Runtime.PYTHON_3_12,
],
code: Code.fromAsset('./src/python/Layer'),
});
new LayerVersion(this, 'BundledLayerVersionPythonRuntime', {
compatibleRuntimes: [
Runtime.PYTHON_3_12,
],
code: Code.fromAsset('./src/python/Layer', {
bundling: {
command: [
'/bin/sh',
'-c',
'rm -rf /tmp/asset-input && mkdir /tmp/asset-input && cp * /tmp/asset-input && cd /tmp/asset-input && pip install -r requirements.txt -t . && mkdir /asset-output/python && cp -R /tmp/asset-input/* /asset-output/python',
],
image: Runtime.PYTHON_3_12.bundlingImage,
user: 'root',
}
}),
});
// ZIP package type Functions
new PythonFunction(this, 'PythonFunction', {
entry: './src/python/Function',
index: 'app.py',
handler: 'lambda_handler',
runtime: Runtime.PYTHON_3_12,
functionName: 'pythonFunc',
logRetention: RetentionDays.THREE_MONTHS,
});
new Function(this, 'FunctionPythonRuntime', {
runtime: Runtime.PYTHON_3_12,
code: Code.fromAsset('./src/python/Function'),
handler: 'app.lambda_handler',
});
new Function(this, 'BundledFunctionPythonRuntime', {
runtime: Runtime.PYTHON_3_12,
code: Code.fromAsset('./src/python/Function/', {
bundling: {
command: [
'/bin/sh',
'-c',
'rm -rf /tmp/asset-input && mkdir /tmp/asset-input && cp * /tmp/asset-input && cd /tmp/asset-input && pip install -r requirements.txt -t . && cp -R /tmp/asset-input/* /asset-output',
],
image: Runtime.PYTHON_3_12.bundlingImage,
user: 'root',
}
}),
handler: 'app.lambda_handler',
});
// NodeJs Runtime
new NodejsFunction(this, 'NodejsFunction', {
entry: path.join(__dirname, '../src/nodejs/NodeJsFunctionConstruct/app.ts'),
depsLockFilePath: path.join(__dirname, '../src/nodejs/NodeJsFunctionConstruct/package-lock.json'),
bundling: {
forceDockerBundling: true,
},
handler: 'lambdaHandler',
});
// Go Runtime
new GoFunction(this, 'GoFunction', {
entry: './src/go/GoFunctionConstruct',
bundling: {
forcedDockerBundling: true,
// Only use Google proxy in the CI tests, as it is blocked on workstations
goProxies: isRunningOnCi ? [GoFunction.GOOGLE_GOPROXY, 'direct'] : undefined,
},
});
// Image Package Type Functions
new DockerImageFunction(this, 'DockerImageFunction', {
code: DockerImageCode.fromImageAsset('./src/docker/DockerImageFunctionConstruct', {
file: 'Dockerfile',
}),
});
// Spec Rest Api
new SpecRestApi(this, 'SpecRestAPI', {
apiDefinition: ApiDefinition.fromAsset('./src/rest-api-definition.yaml'),
});
// Role to be used as credentials for the Spec rest APi
// it is used inside the spec rest api definition file
new Role(this, 'SpecRestApiRole', {
assumedBy: new ServicePrincipal('apigateway.amazonaws.com'),
roleName: 'SpecRestApiRole',
}).addToPolicy(new PolicyStatement({
actions: ['lambda:InvokeFunction'],
resources: ['*'],
}));
// Nested Stack
new NestedStack1(this, 'NestedStack', {});
}