Skip to content

Commit e9c2a81

Browse files
authored
Merge pull request #4 from bennettsf/lambda-handling
Remove lambda template option
2 parents 2fd05fa + 21a3141 commit e9c2a81

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

packages/rest-api-construct/src/construct.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
ExistingDirectory,
66
ExistingLambda,
77
NewFromCode,
8-
NewFromTemplate,
98
RestApiConstructProps,
109
} from './types.js';
1110

@@ -30,8 +29,7 @@ export class RestApiConstruct extends Construct {
3029
const { path, routes, lambdaEntry } = pathConfig;
3130
const source = lambdaEntry.source;
3231

33-
// Determine Lambda code source - either ExistingDirectory, NewFromCode, NewFromTemplate,
34-
// or ExistingLambda (function already exists in aws and does not need to be constructed)
32+
// Determine Lambda code source - either ExistingDirectory, NewFromCode, or ExistingLambda (function already exists in aws and does not need to be constructed)
3533
let code: lambda.AssetCode | lambda.InlineCode =
3634
lambda.Code.fromInline('');
3735
if ('path' in source) {
@@ -40,14 +38,6 @@ export class RestApiConstruct extends Construct {
4038
} else if ('code' in source) {
4139
const src = source as NewFromCode;
4240
code = lambda.Code.fromInline(src.code);
43-
} else if ('template' in source) {
44-
//TODO: Expand supported templates later
45-
const src = source as NewFromTemplate;
46-
if (src.template === 'Hello World') {
47-
code = lambda.Code.fromInline(
48-
"exports.handler = () => { console.log('Hello World'); };",
49-
);
50-
}
5141
}
5242
//if none of these are true, it's a ExistingLambda type, handled below
5343

packages/rest-api-construct/src/types.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import * as lamb from 'aws-cdk-lib/aws-lambda';
22

3-
//defines 4 potential sources for Lambda function
3+
//defines 3 potential sources for Lambda function
44
export type ExistingDirectory = { path: string };
55
export type ExistingLambda = { id: string; name: string };
66
export type NewFromCode = { code: string };
7-
export type NewFromTemplate = { template: string };
87

98
//adds runtime to the source
109
type LambdaSource = {
1110
runtime: lamb.Runtime;
12-
source: ExistingDirectory | ExistingLambda | NewFromCode | NewFromTemplate;
11+
source: ExistingDirectory | ExistingLambda | NewFromCode;
1312
};
1413

1514
export type RestApiConstructProps = {

0 commit comments

Comments
 (0)