From b9a50817ff8a8e0da0fa063a0322a9ef37fc2fe2 Mon Sep 17 00:00:00 2001 From: Peter Woodworth <44349620+peterwoodworth@users.noreply.github.com> Date: Mon, 28 Mar 2022 19:13:08 -0700 Subject: [PATCH] docs(lambda): remove references to deprecated addVersion() (#19601) fixes #19594 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-applicationautoscaling/README.md | 2 +- packages/@aws-cdk/aws-codedeploy/README.md | 4 ++-- packages/@aws-cdk/aws-codepipeline-actions/README.md | 2 +- packages/@aws-cdk/aws-lambda/lib/alias.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/@aws-cdk/aws-applicationautoscaling/README.md b/packages/@aws-cdk/aws-applicationautoscaling/README.md index 0870212d274a9..9697a9d27badc 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/README.md +++ b/packages/@aws-cdk/aws-applicationautoscaling/README.md @@ -222,7 +222,7 @@ const handler = new lambda.Function(this, 'MyFunction', { reservedConcurrentExecutions: 2, }); -const fnVer = handler.addVersion('CDKLambdaVersion', undefined, 'demo alias', 10); +const fnVer = handler.currentVersion; const target = new appscaling.ScalableTarget(this, 'ScalableTarget', { serviceNamespace: appscaling.ServiceNamespace.LAMBDA, diff --git a/packages/@aws-cdk/aws-codedeploy/README.md b/packages/@aws-cdk/aws-codedeploy/README.md index 9b6aa5cda5d8d..2608c706022ea 100644 --- a/packages/@aws-cdk/aws-codedeploy/README.md +++ b/packages/@aws-cdk/aws-codedeploy/README.md @@ -207,7 +207,7 @@ To create a new CodeDeploy Deployment Group that deploys to a Lambda function: ```ts declare const myApplication: codedeploy.LambdaApplication; declare const func: lambda.Function; -const version = func.addVersion('1'); +const version = func.currentVersion; const version1Alias = new lambda.Alias(this, 'alias', { aliasName: 'prod', version, @@ -222,7 +222,7 @@ const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDep In order to deploy a new version of this function: -1. Increment the version, e.g. `const version = func.addVersion('2')`. +1. Reference the version with the latest changes `const version = func.currentVersion`. 2. Re-deploy the stack (this will trigger a deployment). 3. Monitor the CodeDeploy deployment as traffic shifts between the versions. diff --git a/packages/@aws-cdk/aws-codepipeline-actions/README.md b/packages/@aws-cdk/aws-codepipeline-actions/README.md index 7169f72f2cddd..c616cecd2302e 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/README.md +++ b/packages/@aws-cdk/aws-codepipeline-actions/README.md @@ -765,7 +765,7 @@ const func = new lambda.Function(this, 'Lambda', { runtime: lambda.Runtime.NODEJS_12_X, }); // used to make sure each CDK synthesis produces a different Version -const version = func.addVersion('NewVersion'); +const version = func.currentVersion; const alias = new lambda.Alias(this, 'LambdaAlias', { aliasName: 'Prod', version, diff --git a/packages/@aws-cdk/aws-lambda/lib/alias.ts b/packages/@aws-cdk/aws-lambda/lib/alias.ts index 36fdbdfcc2eaf..be92b4a3dde8f 100644 --- a/packages/@aws-cdk/aws-lambda/lib/alias.ts +++ b/packages/@aws-cdk/aws-lambda/lib/alias.ts @@ -75,7 +75,7 @@ export interface AliasProps extends AliasOptions { /** * Function version this alias refers to * - * Use lambda.addVersion() to obtain a new lambda version to refer to. + * Use lambda.currentVersion to reference a version with your latest changes. */ readonly version: IVersion; }