Skip to content

Commit

Permalink
removed unneeded props and attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Francis <colifran@amazon.com>
  • Loading branch information
colifran committed Dec 7, 2023
1 parent a4130a2 commit efdef2e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
17 changes: 0 additions & 17 deletions packages/aws-cdk-lib/handler-framework/lib/cdk-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export interface CdkHandlerProps {
* Runtimes that are compatible with the source code.
*/
readonly compatibleRuntimes: Runtime[];

/**
* The name of the method within your code that Lambda calls to execute your function.
*/
readonly entrypoint: string;
}

/**
Expand All @@ -32,31 +27,19 @@ export class CdkHandler extends Construct {
*/
private static readonly DEFAULT_RUNTIME = Runtime.NODEJS_LATEST;

/**
* The source code loaded from a local disk path.
*/
public readonly codeDirectory: string;

/**
* The source code of your Lambda function.
*/
public readonly code: Code;

/**
* The name of the method within your code that Lambda calls to execute your function.
*/
public readonly entrypoint: string;

/**
* The latest runtime that is compatible with the source code.
*/
public readonly runtime: Runtime;

public constructor(scope: Construct, id: string, props: CdkHandlerProps) {
super(scope, id);
this.codeDirectory = props.codeDirectory;
this.code = Code.fromAsset(props.codeDirectory);
this.entrypoint = props.entrypoint;
this.runtime = RuntimeDeterminer.determineLatestRuntime(CdkHandler.DEFAULT_RUNTIME, props.compatibleRuntimes);
}
}
32 changes: 0 additions & 32 deletions packages/aws-cdk-lib/handler-framework/test/cdk-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,17 @@ describe('cdk handler', () => {
codeDirectory = path.join(__dirname, 'test-handler');
});

test('code directory property is correctly set', () => {
// GIVEN
const stack = new Stack();

// WHEN
const handler = new CdkHandler(stack, 'CdkHandler', {
codeDirectory,
entrypoint: 'index.handler',
compatibleRuntimes: [Runtime.NODEJS_LATEST],
});

// THEN
expect(handler.codeDirectory).toEqual(codeDirectory);
});

test('runtime property is correctly set', () => {
// GIVEN
const stack = new Stack();

// WHEN
const handler = new CdkHandler(stack, 'CdkHandler', {
codeDirectory,
entrypoint: 'index.handler',
compatibleRuntimes: [Runtime.NODEJS_16_X, Runtime.NODEJS_LATEST, Runtime.PYTHON_3_12],
});

// THEN
expect(handler.runtime.runtimeEquals(Runtime.NODEJS_LATEST)).toBe(true);
});

test('entrypoint property is set correctly for non-default entrypoint', () => {
// GIVEN
const stack = new Stack();
const entrypoint = 'index.onEventHandler';

// WHEN
const handler = new CdkHandler(stack, 'CdkHandler', {
codeDirectory,
entrypoint,
compatibleRuntimes: [Runtime.NODEJS_LATEST],
});

// THEN
expect(handler.entrypoint).toEqual(entrypoint);
});
});

0 comments on commit efdef2e

Please sign in to comment.