-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Node8.10 Lambda runtime (#187)
Also, re-model LambdaRuntime as a class to allow customers to use runtimes that are not yet part of the modelled list, optionally with support for inline code. The `InlinableLambdaRuntime` class is mostly provided to allow for a strictly typed interface in `InlineJavaScriptLambda`. Fixes #188 Fixes #203
- Loading branch information
1 parent
507f778
commit f7a5c3b
Showing
4 changed files
with
60 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,57 @@ | ||
export interface LambdaRuntimeProps { | ||
/** | ||
* Whether the ``ZipFile`` (aka inline code) property can be used with this runtime. | ||
* @default false | ||
*/ | ||
readonly supportsInlineCode?: boolean; | ||
} | ||
|
||
/** | ||
* Lambda function runtime environment. | ||
*/ | ||
export enum LambdaRuntime { | ||
NodeJS = 'nodejs', | ||
NodeJS43 = 'nodejs4.3', | ||
NodeJS43Edge = 'nodejs4.3-edge', | ||
NodeJS610 = 'nodejs6.10', | ||
Java8 = 'java8', | ||
Python27 = 'python2.7', | ||
Python36 = 'python3.6', | ||
DotNetCore1 = 'dotnetcore1.0', | ||
DotNetCore2 = 'dotnetcore2.0', | ||
Go1x = 'go1.x' | ||
export class LambdaRuntime { | ||
public static readonly NodeJS = new LambdaRuntime('nodejs', { supportsInlineCode: true }) as InlinableJavascriptLambdaRuntime; | ||
// Using ``as InlinableLambdaRuntime`` because that calss cannot be defined just yet | ||
public static readonly NodeJS43 = new LambdaRuntime('nodejs4.3', { supportsInlineCode: true }) as InlinableJavascriptLambdaRuntime; | ||
public static readonly NodeJS43Edge = new LambdaRuntime('nodejs4.3-edge'); | ||
// Using ``as InlinableLambdaRuntime`` because that calss cannot be defined just yet | ||
public static readonly NodeJS610 = new LambdaRuntime('nodejs6.10', { supportsInlineCode: true }) as InlinableJavascriptLambdaRuntime; | ||
public static readonly NodeJS810 = new LambdaRuntime('nodejs8.10'); | ||
public static readonly Java8 = new LambdaRuntime('java8'); | ||
// Using ``as InlinableLambdaRuntime`` because that calss cannot be defined just yet | ||
public static readonly Python27 = new LambdaRuntime('python2.7', { supportsInlineCode: true }) as InlinableLambdaRuntime; | ||
// Using ``as InlinableLambdaRuntime`` because that calss cannot be defined just yet | ||
public static readonly Python36 = new LambdaRuntime('python3.6', { supportsInlineCode: true }) as InlinableLambdaRuntime; | ||
public static readonly DotNetCore1 = new LambdaRuntime('dotnetcore1.0'); | ||
public static readonly DotNetCore2 = new LambdaRuntime('dotnetcore2.0'); | ||
public static readonly Go1x = new LambdaRuntime('go1.x'); | ||
|
||
/** The name of this runtime, as expected by the Lambda resource. */ | ||
public readonly name: string; | ||
/** Whether the ``ZipFile`` (aka inline code) property can be used with this runtime. */ | ||
public readonly supportsInlineCode: boolean; | ||
|
||
constructor(name: string, props: LambdaRuntimeProps = {}) { | ||
this.name = name; | ||
this.supportsInlineCode = !!props.supportsInlineCode; | ||
} | ||
|
||
public toString(): string { | ||
return this.name; | ||
} | ||
} | ||
|
||
/** | ||
* A ``LambdaRuntime`` that can be used in conjunction with the ``ZipFile`` | ||
* property of the ``AWS::Lambda::Function`` resource. | ||
*/ | ||
export interface InlinableLambdaRuntime { | ||
readonly name: string; | ||
readonly supportsInlineCode: true; | ||
} | ||
|
||
/** | ||
* A ``LambdaRuntime`` that can be used for inlining JavaScript. | ||
*/ | ||
// tslint:disable-next-line:no-empty-interface this is a marker to allow type-safe declarations | ||
export interface InlinableJavascriptLambdaRuntime extends InlinableLambdaRuntime {} |