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 {
671671 * in the same account and region as the stack you are importing it into.
672672 */
673673 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 } ) ;
686675 }
687676
688677 /**
Original file line number Diff line number Diff line change @@ -397,30 +397,6 @@ describe('function', () => {
397397 expect ( imported . functionName ) . toEqual ( 'ProcessKinesisRecords' ) ;
398398 } ) ;
399399
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-
424400 test ( 'Function.fromFunctionName' , ( ) => {
425401 // GIVEN
426402 const stack = new cdk . Stack ( ) ;
Original file line number Diff line number Diff line change @@ -15,9 +15,6 @@ describe('lambda version', () => {
1515 // WHEN
1616 const version = lambda . Version . fromVersionArn ( stack , 'Version' , 'arn:aws:lambda:region:account-id:function:function-name:version' ) ;
1717
18- expect ( version . version ) . toStrictEqual ( 'version' ) ;
19- expect ( version . lambda . functionArn ) . toStrictEqual ( 'arn:aws:lambda:region:account-id:function:function-name' ) ;
20-
2118 new cdk . CfnOutput ( stack , 'ARN' , { value : version . functionArn } ) ;
2219 new cdk . CfnOutput ( stack , 'Name' , { value : version . functionName } ) ;
2320
You can’t perform that action at this time.
0 commit comments