From 73d5befc0c28e6f965dcbb273e5e20894ef79793 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Thu, 14 Feb 2019 15:28:37 +0100 Subject: [PATCH] fix(lambda): Add 'provided' runtime (#1764) Provided runtime can be used for custom runtimes. Fixes #1761. --- packages/@aws-cdk/aws-lambda/lib/runtime.ts | 4 +++- packages/@aws-cdk/aws-lambda/test/test.lambda.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-lambda/lib/runtime.ts b/packages/@aws-cdk/aws-lambda/lib/runtime.ts index e5a4ab552996c..2de0a98e9bcaf 100644 --- a/packages/@aws-cdk/aws-lambda/lib/runtime.ts +++ b/packages/@aws-cdk/aws-lambda/lib/runtime.ts @@ -12,7 +12,8 @@ export enum RuntimeFamily { Python, DotNetCore, Go, - Ruby + Ruby, + Other } /** @@ -38,6 +39,7 @@ export class Runtime { public static readonly DotNetCore21 = new Runtime('dotnetcore2.1', RuntimeFamily.DotNetCore); public static readonly Go1x = new Runtime('go1.x', RuntimeFamily.Go); public static readonly Ruby25 = new Runtime('ruby2.5', RuntimeFamily.Ruby, { supportsInlineCode: true }); + public static readonly Provided = new Runtime('provided', RuntimeFamily.Other); /** * The name of this runtime, as expected by the Lambda resource. diff --git a/packages/@aws-cdk/aws-lambda/test/test.lambda.ts b/packages/@aws-cdk/aws-lambda/test/test.lambda.ts index c1df96c06148d..a64ca64d23e24 100644 --- a/packages/@aws-cdk/aws-lambda/test/test.lambda.ts +++ b/packages/@aws-cdk/aws-lambda/test/test.lambda.ts @@ -1286,6 +1286,15 @@ export = { // THEN test.deepEqual(bindCount, 2); + test.done(); + }, + + 'Provided Runtime returns the right values'(test: Test) { + const rt = lambda.Runtime.Provided; + + test.equal(rt.name, 'provided'); + test.equal(rt.supportsInlineCode, false); + test.done(); } };