11'use strict' ;
22
33module . exports = {
4+ generateLogicalId ( name , suffix = '' ) {
5+ return `${ this . provider . naming . getNormalizedFunctionName ( name ) } ${ suffix } ` ;
6+ } ,
7+
48 getStateMachineLogicalId ( stateMachineName , stateMachine ) {
59 const custom = stateMachine ? stateMachine . id || stateMachine . name : null ;
6-
710 if ( custom ) {
8- return ` ${ this . provider . naming . getNormalizedFunctionName ( custom ) } ` ;
11+ return this . generateLogicalId ( custom ) ;
912 }
10-
11- return `${ this . provider . naming
12- . getNormalizedFunctionName ( stateMachineName ) } StepFunctionsStateMachine`;
13+ return this . generateLogicalId ( stateMachineName , 'StepFunctionsStateMachine' ) ;
1314 } ,
1415
1516 getStateMachineOutputLogicalId ( stateMachineName , stateMachine ) {
1617 const custom = stateMachine ? stateMachine . id || stateMachine . name : null ;
17-
1818 if ( custom ) {
19- return ` ${ this . provider . naming . getNormalizedFunctionName ( custom ) } Arn` ;
19+ return this . generateLogicalId ( custom , ' Arn' ) ;
2020 }
21-
22- return `${ this . provider . naming
23- . getNormalizedFunctionName ( stateMachineName ) } StepFunctionsStateMachineArn`;
21+ return this . generateLogicalId ( stateMachineName , 'StepFunctionsStateMachineArn' ) ;
2422 } ,
2523
2624 getActivityLogicalId ( activityName ) {
27- return `${ this . provider . naming
28- . getNormalizedFunctionName ( activityName ) } StepFunctionsActivity`;
25+ return this . generateLogicalId ( activityName , 'StepFunctionsActivity' ) ;
2926 } ,
3027
3128 getActivityOutputLogicalId ( activityName ) {
32- return `${ this . provider . naming
33- . getNormalizedFunctionName ( activityName ) } StepFunctionsActivityArn`;
29+ return this . generateLogicalId ( activityName , 'StepFunctionsActivityArn' ) ;
3430 } ,
3531
3632 getStateMachinePolicyName ( ) {
@@ -59,20 +55,15 @@ module.exports = {
5955 } ,
6056
6157 getScheduleLogicalId ( stateMachineName , scheduleIndex ) {
62- return `${ this . provider . naming
63- . getNormalizedFunctionName ( stateMachineName ) } StepFunctionsEventsRuleSchedule${ scheduleIndex } `;
58+ return this . generateLogicalId ( stateMachineName , `StepFunctionsEventsRuleSchedule${ scheduleIndex } ` ) ;
6459 } ,
6560
6661 getSchedulerScheduleLogicalId ( stateMachineName , scheduleIndex ) {
67- return `${ this . provider . naming . getNormalizedFunctionName (
68- stateMachineName ,
69- ) } StepFunctionsSchedulerSchedule${ scheduleIndex } `;
62+ return this . generateLogicalId ( stateMachineName , `StepFunctionsSchedulerSchedule${ scheduleIndex } ` ) ;
7063 } ,
7164
7265 getScheduleToStepFunctionsIamRoleLogicalId ( stateMachineName ) {
73- return `${ this . provider . naming . getNormalizedFunctionName (
74- stateMachineName ,
75- ) } ScheduleToStepFunctionsRole`;
66+ return this . generateLogicalId ( stateMachineName , 'ScheduleToStepFunctionsRole' ) ;
7667 } ,
7768
7869 getSchedulePolicyName ( stateMachineName ) {
@@ -91,8 +82,7 @@ module.exports = {
9182 } ,
9283
9384 getCloudWatchEventLogicalId ( stateMachineName , cloudWatchIndex ) {
94- return `${ this . provider . naming
95- . getNormalizedFunctionName ( stateMachineName ) } EventsRuleCloudWatchEvent${ cloudWatchIndex } `;
85+ return this . generateLogicalId ( stateMachineName , `EventsRuleCloudWatchEvent${ cloudWatchIndex } ` ) ;
9686 } ,
9787
9888 getCloudWatchEventPolicyName ( stateMachineName ) {
@@ -106,8 +96,6 @@ module.exports = {
10696 } ,
10797
10898 getCloudWatchEventToStepFunctionsIamRoleLogicalId ( stateMachineName ) {
109- return `${ this . provider . naming . getNormalizedFunctionName (
110- stateMachineName ,
111- ) } EventToStepFunctionsRole`;
99+ return this . generateLogicalId ( stateMachineName , 'EventToStepFunctionsRole' ) ;
112100 } ,
113101} ;
0 commit comments