File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,10 @@ class ServerlessStepFunctions {
6565 shortcut : 's' ,
6666 required : true ,
6767 } ,
68+ data : {
69+ usage : 'String data to be passed as an event to your step function' ,
70+ shortcut : 'd' ,
71+ }
6872 } ,
6973 } ,
7074 } ,
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ module.exports = {
2121 ]
2222 }
2323 ` ;
24+
25+ this . serverless . cli . log ( `Start to deploy ${ this . options . state } step function...` ) ;
2426 BbPromise . bind ( this )
2527 . then ( this . yamlParse )
2628 . then ( this . getStateMachineArn )
@@ -163,10 +165,13 @@ module.exports = {
163165 } ,
164166 this . options . stage ,
165167 this . options . region )
166- . then ( ( ) => BbPromise . resolve ( ) )
167- . catch ( ( error ) => {
168- console . log ( error )
168+ . then ( ( ) => {
169+ this . serverless . cli . consoleLog ( '' ) ;
170+ this . serverless . cli . log ( `Finish to deploy ${ this . options . state } step function` ) ;
171+ return BbPromise . resolve ( )
172+ } ) . catch ( ( error ) => {
169173 if ( error . message . match ( / S t a t e M a c h i n e i s b e i n g d e l e t e d / ) ) {
174+ this . serverless . cli . printDot ( ) ;
170175 setTimeout ( this . createStateMachine . bind ( this ) , 5000 ) ;
171176 } else {
172177 throw new this . serverless . classes . Error ( error . message ) ;
Original file line number Diff line number Diff line change @@ -12,10 +12,13 @@ module.exports = {
1212 } ,
1313
1414 startExecution ( ) {
15+ this . serverless . cli . log ( `Start function ${ this . options . state } ...` ) ;
16+
1517 return this . provider . request ( 'StepFunctions' ,
1618 'startExecution' ,
1719 {
1820 stateMachineArn : this . stateMachineArn ,
21+ input : this . options . data
1922 } ,
2023 this . options . stage ,
2124 this . options . region )
@@ -36,11 +39,12 @@ module.exports = {
3639 this . options . stage ,
3740 this . options . region )
3841 . then ( ( result ) => {
39-
4042 if ( result . status === 'RUNNING' ) {
43+ this . serverless . cli . printDot ( ) ;
4144 setTimeout ( this . describeExecution . bind ( this ) , 5000 ) ;
4245 } else {
43-
46+ this . serverless . cli . consoleLog ( '' ) ;
47+ this . serverless . cli . consoleLog ( result ) ;
4448 }
4549 return BbPromise . resolve ( ) ;
4650 } ) . catch ( ( error ) => {
Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ module.exports = {
55 remove ( ) {
66 BbPromise . bind ( this )
77 . then ( this . getStateMachineArn )
8- . then ( this . deleteStateMachine ) ;
8+ . then ( this . deleteStateMachine )
9+ . then ( ( ) => {
10+ this . serverless . cli . log ( `Remove ${ this . options . state } ` ) ;
11+ return BbPromise . resolve ( ) ;
12+ } ) ;
913
1014 return BbPromise . resolve ( ) ;
1115 } ,
You can’t perform that action at this time.
0 commit comments