Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainMuller committed Jul 2, 2018
1 parent 5dc5e31 commit 4b86514
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions packages/@aws-cdk/lambda/lib/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
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 class LambdaRuntime {
public static readonly NodeJS = new LambdaRuntime('nodejs', true) as InlinableJavascriptLambdaRuntime;
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', true) as InlinableJavascriptLambdaRuntime;
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', true) as InlinableJavascriptLambdaRuntime;
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', true) as InlinableLambdaRuntime;
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', true) as InlinableLambdaRuntime;
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');
Expand All @@ -23,9 +31,9 @@ export class LambdaRuntime {
/** Whether the ``ZipFile`` (aka inline code) property can be used with this runtime. */
public readonly supportsInlineCode: boolean;

constructor(name: string, supportsInlineCode: boolean = false) {
constructor(name: string, props: LambdaRuntimeProps = {}) {
this.name = name;
this.supportsInlineCode = supportsInlineCode;
this.supportsInlineCode = !!props.supportsInlineCode;
}

public toString(): string {
Expand All @@ -45,7 +53,5 @@ export interface InlinableLambdaRuntime {
/**
* A ``LambdaRuntime`` that can be used for inlining JavaScript.
*/
export interface InlinableJavascriptLambdaRuntime extends InlinableLambdaRuntime {
readonly name: string;
readonly supportsInlineCode: true;
}
// tslint:disable-next-line:no-empty-interface this is a marker to allow type-safe declarations
export interface InlinableJavascriptLambdaRuntime extends InlinableLambdaRuntime {}

0 comments on commit 4b86514

Please sign in to comment.