Skip to content

Commit

Permalink
reverted lambda runtime deprecated flag
Browse files Browse the repository at this point in the history
Signed-off-by: Francis <colifran@amazon.com>
  • Loading branch information
colifran committed Dec 14, 2023
1 parent 4d25941 commit e8f5a3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 85 deletions.
79 changes: 15 additions & 64 deletions packages/aws-cdk-lib/aws-lambda/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ export interface LambdaRuntimeProps {
* @default false
*/
readonly supportsSnapStart?: boolean;

/**
* Whether this runtime is deprecated.
* @default false
*/
readonly isDeprecated?: boolean;
}

export enum RuntimeFamily {
Expand All @@ -62,64 +56,43 @@ export class Runtime {
* The NodeJS runtime (nodejs)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
*/
public static readonly NODEJS = new Runtime('nodejs', RuntimeFamily.NODEJS, {
supportsInlineCode: true,
isDeprecated: true,
});
public static readonly NODEJS = new Runtime('nodejs', RuntimeFamily.NODEJS, { supportsInlineCode: true });

/**
* The NodeJS 4.3 runtime (nodejs4.3)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
*/
public static readonly NODEJS_4_3 = new Runtime('nodejs4.3', RuntimeFamily.NODEJS, {
supportsInlineCode: true,
isDeprecated: true,
});
public static readonly NODEJS_4_3 = new Runtime('nodejs4.3', RuntimeFamily.NODEJS, { supportsInlineCode: true });

/**
* The NodeJS 6.10 runtime (nodejs6.10)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
*/
public static readonly NODEJS_6_10 = new Runtime('nodejs6.10', RuntimeFamily.NODEJS, {
supportsInlineCode: true,
isDeprecated: true,
});
public static readonly NODEJS_6_10 = new Runtime('nodejs6.10', RuntimeFamily.NODEJS, { supportsInlineCode: true });

/**
* The NodeJS 8.10 runtime (nodejs8.10)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
*/
public static readonly NODEJS_8_10 = new Runtime('nodejs8.10', RuntimeFamily.NODEJS, {
supportsInlineCode: true,
isDeprecated: true,
});
public static readonly NODEJS_8_10 = new Runtime('nodejs8.10', RuntimeFamily.NODEJS, { supportsInlineCode: true });

/**
* The NodeJS 10.x runtime (nodejs10.x)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
*/
public static readonly NODEJS_10_X = new Runtime('nodejs10.x', RuntimeFamily.NODEJS, {
supportsInlineCode: true,
isDeprecated: true,
});
public static readonly NODEJS_10_X = new Runtime('nodejs10.x', RuntimeFamily.NODEJS, { supportsInlineCode: true });

/**
* The NodeJS 12.x runtime (nodejs12.x)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
*/
public static readonly NODEJS_12_X = new Runtime('nodejs12.x', RuntimeFamily.NODEJS, {
supportsInlineCode: true,
isDeprecated: true,
});
public static readonly NODEJS_12_X = new Runtime('nodejs12.x', RuntimeFamily.NODEJS, { supportsInlineCode: true });

/**
* The NodeJS 14.x runtime (nodejs14.x)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
*/
public static readonly NODEJS_14_X = new Runtime('nodejs14.x', RuntimeFamily.NODEJS, {
supportsInlineCode: true,
isDeprecated: true,
});
public static readonly NODEJS_14_X = new Runtime('nodejs14.x', RuntimeFamily.NODEJS, { supportsInlineCode: true });

/**
* The NodeJS 16.x runtime (nodejs16.x)
Expand All @@ -146,10 +119,7 @@ export class Runtime {
* The Python 2.7 runtime (python2.7)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
*/
public static readonly PYTHON_2_7 = new Runtime('python2.7', RuntimeFamily.PYTHON, {
supportsInlineCode: true,
isDeprecated: true,
});
public static readonly PYTHON_2_7 = new Runtime('python2.7', RuntimeFamily.PYTHON, { supportsInlineCode: true });

/**
* The Python 3.6 runtime (python3.6) (not recommended)
Expand All @@ -161,7 +131,6 @@ export class Runtime {
public static readonly PYTHON_3_6 = new Runtime('python3.6', RuntimeFamily.PYTHON, {
supportsInlineCode: true,
supportsCodeGuruProfiling: true,
isDeprecated: true,
});

/**
Expand Down Expand Up @@ -259,49 +228,37 @@ export class Runtime {
* The .NET Core 1.0 runtime (dotnetcore1.0)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET Core runtime.
*/
public static readonly DOTNET_CORE_1 = new Runtime('dotnetcore1.0', RuntimeFamily.DOTNET_CORE, {
isDeprecated: true,
});
public static readonly DOTNET_CORE_1 = new Runtime('dotnetcore1.0', RuntimeFamily.DOTNET_CORE);

/**
* The .NET Core 2.0 runtime (dotnetcore2.0)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET Core runtime.
*/
public static readonly DOTNET_CORE_2 = new Runtime('dotnetcore2.0', RuntimeFamily.DOTNET_CORE, {
isDeprecated: true,
});
public static readonly DOTNET_CORE_2 = new Runtime('dotnetcore2.0', RuntimeFamily.DOTNET_CORE);

/**
* The .NET Core 2.1 runtime (dotnetcore2.1)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET Core runtime.
*/
public static readonly DOTNET_CORE_2_1 = new Runtime('dotnetcore2.1', RuntimeFamily.DOTNET_CORE, {
isDeprecated: true,
});
public static readonly DOTNET_CORE_2_1 = new Runtime('dotnetcore2.1', RuntimeFamily.DOTNET_CORE);

/**
* The .NET Core 3.1 runtime (dotnetcore3.1)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET Core runtime.
*/
public static readonly DOTNET_CORE_3_1 = new Runtime('dotnetcore3.1', RuntimeFamily.DOTNET_CORE, {
isDeprecated: true,
});
public static readonly DOTNET_CORE_3_1 = new Runtime('dotnetcore3.1', RuntimeFamily.DOTNET_CORE);

/**
* The Go 1.x runtime (go1.x)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the PROVIDED_AL2023 runtime.
*/
public static readonly GO_1_X = new Runtime('go1.x', RuntimeFamily.GO, {
isDeprecated: true,
});
public static readonly GO_1_X = new Runtime('go1.x', RuntimeFamily.GO);

/**
* The Ruby 2.5 runtime (ruby2.5)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Ruby runtime.
*/
public static readonly RUBY_2_5 = new Runtime('ruby2.5', RuntimeFamily.RUBY, {
isDeprecated: true,
});
public static readonly RUBY_2_5 = new Runtime('ruby2.5', RuntimeFamily.RUBY);

/**
* The Ruby 2.7 runtime (ruby2.7)
Expand All @@ -317,7 +274,7 @@ export class Runtime {
* The custom provided runtime (provided)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest provided.al2023 runtime.
*/
public static readonly PROVIDED = new Runtime('provided', RuntimeFamily.OTHER, { isDeprecated: true });
public static readonly PROVIDED = new Runtime('provided', RuntimeFamily.OTHER);

/**
* The custom provided runtime with Amazon Linux 2 (provided.al2)
Expand Down Expand Up @@ -376,17 +333,11 @@ export class Runtime {
*/
public readonly isVariable: boolean;

/**
* Whether or not this runtime is deprecated.
*/
public readonly isDeprecated: boolean;

constructor(name: string, family?: RuntimeFamily, props: LambdaRuntimeProps = {}) {
this.name = name;
this.supportsInlineCode = !!props.supportsInlineCode;
this.family = family;
this.isVariable = !!props.isVariable;
this.isDeprecated = props.isDeprecated ?? false;

const imageName = props.bundlingDockerImage ?? `public.ecr.aws/sam/build-${name}`;
this.bundlingDockerImage = DockerImage.fromRegistry(imageName);
Expand Down
21 changes: 0 additions & 21 deletions packages/aws-cdk-lib/aws-lambda/test/runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,4 @@ describe('runtime', () => {
// THEN
expect(runtime.bundlingDockerImage.image).toEqual('my-docker-image');
});

test.each([
[lambda.Runtime.PYTHON_2_7],
[lambda.Runtime.PYTHON_3_6],
[lambda.Runtime.NODEJS],
[lambda.Runtime.NODEJS_4_3],
[lambda.Runtime.NODEJS_6_10],
[lambda.Runtime.NODEJS_8_10],
[lambda.Runtime.NODEJS_10_X],
[lambda.Runtime.NODEJS_12_X],
[lambda.Runtime.NODEJS_14_X],
[lambda.Runtime.DOTNET_CORE_1],
[lambda.Runtime.DOTNET_CORE_2],
[lambda.Runtime.DOTNET_CORE_2_1],
[lambda.Runtime.DOTNET_CORE_3_1],
[lambda.Runtime.GO_1_X],
[lambda.Runtime.RUBY_2_5],
[lambda.Runtime.PROVIDED],
])('%s is deprecated', (runtime) => {
expect(runtime.isDeprecated).toEqual(true);
});
});

0 comments on commit e8f5a3a

Please sign in to comment.