Skip to content

Commit

Permalink
feat(lambda): add nodejs10x runtime and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robertd committed May 15, 2019
1 parent e4e24ab commit 383241e
Show file tree
Hide file tree
Showing 43 changed files with 102 additions and 101 deletions.
2 changes: 1 addition & 1 deletion design/code-asset-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const resource = new serverless.CfnFunction(this, 'Func', {
bucket: asset.s3BucketName,
key: asset.s3ObjectKey
},
runtime: 'nodejs8.10',
runtime: 'nodejs10.x',
handler: 'index.handler'
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs10.x"
},
"DependsOn": [
"BooksHandlerServiceRole5B6A8847"
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ class BookStack extends cdk.Stack {
super(scope, id);

const booksHandler = new apigw.LambdaIntegration(new lambda.Function(this, 'BooksHandler', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${echoHandlerCode}`)
}));

const bookHandler = new apigw.LambdaIntegration(new lambda.Function(this, 'BookHandler', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${echoHandlerCode}`)
}));

const hello = new apigw.LambdaIntegration(new lambda.Function(this, 'Hello', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${helloCode}`)
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs10.x"
},
"DependsOn": [
"MyHandlerServiceRoleFFA06653"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Test extends cdk.Stack {
});

const handler = new lambda.Function(this, 'MyHandler', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
code: lambda.Code.inline(`exports.handler = ${handlerCode}`),
handler: 'index.handler',
});
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-apigateway/test/test.lambda-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export = {
const handler = new lambda.Function(stack, 'handler', {
handler: 'index.handler',
code: lambda.Code.inline('boom'),
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
});

// WHEN
Expand Down Expand Up @@ -78,7 +78,7 @@ export = {
const handler = new lambda.Function(stack, 'handler', {
handler: 'index.handler',
code: lambda.Code.inline('boom'),
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
});
const alias = new lambda.Alias(stack, 'alias', {
aliasName: 'my-alias',
Expand Down Expand Up @@ -145,7 +145,7 @@ export = {
const handler = new lambda.Function(stack, 'handler', {
handler: 'index.handler',
code: lambda.Code.inline('boom'),
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
});

// WHEN
Expand Down Expand Up @@ -184,7 +184,7 @@ export = {
const handler = new lambda.Function(stack, 'handler', {
handler: 'index.handler',
code: lambda.Code.inline('boom'),
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
});

test.throws(() => new apigw.LambdaRestApi(stack, 'lambda-rest-api', {
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-apigateway/test/test.lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export = {
// GIVEN
const stack = new cdk.Stack();
const fn = new lambda.Function(stack, 'Handler', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
code: lambda.Code.inline('foo'),
handler: 'index.handler'
});
Expand Down Expand Up @@ -106,7 +106,7 @@ export = {
// GIVEN
const stack = new cdk.Stack();
const fn = new lambda.Function(stack, 'Handler', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
code: lambda.Code.inline('foo'),
handler: 'index.handler'
});
Expand All @@ -132,7 +132,7 @@ export = {
const api = new apigateway.RestApi(stack, 'test-api');

const handler = new lambda.Function(stack, 'MyFunc', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
handler: 'index.handler',
code: lambda.Code.inline(``)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const lambdaCode = lambda.Code.cfnParameters();
new lambda.Function(lambdaStack, 'Lambda', {
code: lambdaCode,
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS810,
runtime: lambda.Runtime.NodeJS10x,
});
// other resources that your Lambda needs, added to the lambdaStack...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs10.x"
},
"DependsOn": [
"LambdaFunServiceRoleDefaultPolicy217FED83",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const lambdaFun = new lambda.Function(stack, 'LambdaFun', {
};
`),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
});
const lambdaStage = pipeline.addStage({ name: 'Lambda' });
lambdaStage.addAction(new cpactions.LambdaInvokeAction({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export = {
const lambdaFun = new lambda.Function(stack, 'Function', {
code: new lambda.InlineCode('bla'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS43,
runtime: lambda.Runtime.NodeJS10x,
});

const pipeline = new codepipeline.Pipeline(stack, 'Pipeline');
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-cognito/test/test.user-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
});

// WHEN
Expand Down Expand Up @@ -56,7 +56,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
});

// WHEN
Expand Down Expand Up @@ -93,7 +93,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
});

// WHEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"Arn"
]
},
"Runtime": "nodejs8.10",
"Runtime": "nodejs10.x",
"Description": "Lambda to make DynamoDB a global table",
"Timeout": 300
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs10.x"
},
"DependsOn": [
"MyFuncServiceRole54065130"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const app = new cdk.App();
const stack = new cdk.Stack(app, 'lambda-events');

const fn = new lambda.Function(stack, 'MyFunc', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${handler.toString()}`)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"Arn"
]
},
"Runtime": "nodejs8.10"
"Runtime": "nodejs10.x"
},
"DependsOn": [
"FServiceRoleDefaultPolicy17A19BFA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"Arn"
]
},
"Runtime": "nodejs8.10"
"Runtime": "nodejs10.x"
},
"DependsOn": [
"FServiceRoleDefaultPolicy17A19BFA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"Arn"
]
},
"Runtime": "nodejs8.10"
"Runtime": "nodejs10.x"
},
"DependsOn": [
"FServiceRole3AC82EE1"
Expand Down Expand Up @@ -203,7 +203,7 @@
"Arn"
]
},
"Runtime": "nodejs8.10",
"Runtime": "nodejs10.x",
"Timeout": 300
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"Arn"
]
},
"Runtime": "nodejs8.10"
"Runtime": "nodejs10.x"
},
"DependsOn": [
"FServiceRole3AC82EE1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"Arn"
]
},
"Runtime": "nodejs8.10"
"Runtime": "nodejs10.x"
},
"DependsOn": [
"FServiceRoleDefaultPolicy17A19BFA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class TestFunction extends lambda.Function {
super(scope, id, {
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${handler.toString()}`),
runtime: lambda.Runtime.NodeJS810
runtime: lambda.Runtime.NodeJS10x
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda/lib/log-retention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class LogRetention extends cdk.Construct {
// Custom resource provider
const provider = new SingletonFunction(this, 'Provider', {
code: Code.asset(path.join(__dirname, 'log-retention-provider')),
runtime: Runtime.NodeJS810,
runtime: Runtime.NodeJS10x,
handler: 'index.handler',
uuid: 'aae0aa3c-5b4d-4f87-b02d-85b201efdd8a',
lambdaPurpose: 'LogRetention',
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-lambda/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class Runtime {
public static readonly NodeJS43 = new Runtime('nodejs4.3', RuntimeFamily.NodeJS, { supportsInlineCode: true });
public static readonly NodeJS610 = new Runtime('nodejs6.10', RuntimeFamily.NodeJS, { supportsInlineCode: true });
public static readonly NodeJS810 = new Runtime('nodejs8.10', RuntimeFamily.NodeJS, { supportsInlineCode: true });
public static readonly NodeJS10x = new Runtime('nodejs10.x', RuntimeFamily.NodeJS, { supportsInlineCode: true });
public static readonly Python27 = new Runtime('python2.7', RuntimeFamily.Python, { supportsInlineCode: true });
public static readonly Python36 = new Runtime('python3.6', RuntimeFamily.Python, { supportsInlineCode: true });
public static readonly Python37 = new Runtime('python3.7', RuntimeFamily.Python, { supportsInlineCode: true });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const bucketA = new s3.Bucket(stack, 'MyBucket', {
});

const fn = new lambda.Function(stack, 'MyFunction', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${handler.toString()}`)
});
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda/test/integ.lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const stack = new cdk.Stack(app, 'aws-cdk-lambda-1');
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS10x,
});

fn.addToRolePolicy(new iam.PolicyStatement().addAllResources().addAction('*'));
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const awsAccountId = stack.accountId;
/// !show
const layer = new lambda.LayerVersion(stack, 'MyLayer', {
code: lambda.Code.directory(path.join(__dirname, 'layer-code')),
compatibleRuntimes: [lambda.Runtime.NodeJS810],
compatibleRuntimes: [lambda.Runtime.NodeJS10x],
license: 'Apache-2.0',
description: 'A layer to test the L2 construct',
});
Expand All @@ -26,7 +26,7 @@ layer.addPermission('remote-account-grant', { accountId: awsAccountId });
new lambda.Function(stack, 'MyLayeredLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS810,
runtime: lambda.Runtime.NodeJS10x,
layers: [layer],
});
/// !hide
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-lambda/test/integ.log-retention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ const stack = new cdk.Stack(app, 'aws-cdk-lambda-log-retention');
new lambda.Function(stack, 'OneWeek', {
code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS810,
runtime: lambda.Runtime.NodeJS10x,
logRetentionDays: logs.RetentionDays.OneWeek
});

new lambda.Function(stack, 'OneMonth', {
code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS810,
runtime: lambda.Runtime.NodeJS10x,
logRetentionDays: logs.RetentionDays.OneMonth
});

new lambda.Function(stack, 'OneYear', {
code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS810,
runtime: lambda.Runtime.NodeJS10x,
logRetentionDays: logs.RetentionDays.OneYear
});

Expand Down
Loading

0 comments on commit 383241e

Please sign in to comment.