File tree Expand file tree Collapse file tree 3 files changed +1
-39
lines changed
packages/aws-cdk-lib/aws-lambda Expand file tree Collapse file tree 3 files changed +1
-39
lines changed Original file line number Diff line number Diff line change @@ -671,18 +671,7 @@ export class Function extends FunctionBase {
671
671
* in the same account and region as the stack you are importing it into.
672
672
*/
673
673
public static fromFunctionArn ( scope : Construct , id : string , functionArn : string ) : IFunction {
674
- /**
675
- * If the functionArn has a trailing version or alias (more than 7 parts when split by ":",
676
- * we trim off the trailing version/alias to retrieve the real functionArn.
677
- * See lambda resource ARN format here: https://docs.aws.amazon.com/lambda/latest/dg/lambda-api-permissions-ref.html
678
- */
679
- const parts = functionArn . split ( ':' ) ;
680
- if ( parts . length > 7 ) {
681
- const _functionArn = parts . slice ( 0 , 7 ) . join ( ':' ) ;
682
- return Function . fromFunctionAttributes ( scope , id , { functionArn : _functionArn } ) ;
683
- } else {
684
- return Function . fromFunctionAttributes ( scope , id , { functionArn } ) ;
685
- }
674
+ return Function . fromFunctionAttributes ( scope , id , { functionArn } ) ;
686
675
}
687
676
688
677
/**
Original file line number Diff line number Diff line change @@ -397,30 +397,6 @@ describe('function', () => {
397
397
expect ( imported . functionName ) . toEqual ( 'ProcessKinesisRecords' ) ;
398
398
} ) ;
399
399
400
- test ( 'fromFunctionArn with verionArn as the input' , ( ) => {
401
- // GIVEN
402
- const stack2 = new cdk . Stack ( ) ;
403
-
404
- // WHEN
405
- const imported = lambda . Function . fromFunctionArn ( stack2 , 'Imported' , 'arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords:1' ) ;
406
-
407
- // THEN
408
- expect ( imported . functionArn ) . toEqual ( 'arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords' ) ;
409
- expect ( imported . functionName ) . toEqual ( 'ProcessKinesisRecords' ) ;
410
- } ) ;
411
-
412
- test ( 'fromFunctionArn with trailing alias as the input' , ( ) => {
413
- // GIVEN
414
- const stack2 = new cdk . Stack ( ) ;
415
-
416
- // WHEN
417
- const imported = lambda . Function . fromFunctionArn ( stack2 , 'Imported' , 'arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords:TEST' ) ;
418
-
419
- // THEN
420
- expect ( imported . functionArn ) . toEqual ( 'arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords' ) ;
421
- expect ( imported . functionName ) . toEqual ( 'ProcessKinesisRecords' ) ;
422
- } ) ;
423
-
424
400
test ( 'Function.fromFunctionName' , ( ) => {
425
401
// GIVEN
426
402
const stack = new cdk . Stack ( ) ;
Original file line number Diff line number Diff line change @@ -15,9 +15,6 @@ describe('lambda version', () => {
15
15
// WHEN
16
16
const version = lambda . Version . fromVersionArn ( stack , 'Version' , 'arn:aws:lambda:region:account-id:function:function-name:version' ) ;
17
17
18
- expect ( version . version ) . toStrictEqual ( 'version' ) ;
19
- expect ( version . lambda . functionArn ) . toStrictEqual ( 'arn:aws:lambda:region:account-id:function:function-name' ) ;
20
-
21
18
new cdk . CfnOutput ( stack , 'ARN' , { value : version . functionArn } ) ;
22
19
new cdk . CfnOutput ( stack , 'Name' , { value : version . functionName } ) ;
23
20
You can’t perform that action at this time.
0 commit comments