Skip to content

Commit 7581965

Browse files
committed
remove command
1 parent aa5c414 commit 7581965

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

index.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22
const BbPromise = require('bluebird');
33
const deploy = require('./lib/deploy');
4+
const remove = require('./lib/remove');
45

56
class ServerlessStepFunctions {
67
constructor(serverless, options) {
@@ -10,7 +11,8 @@ class ServerlessStepFunctions {
1011

1112
Object.assign(
1213
this,
13-
deploy
14+
deploy,
15+
remove
1416
);
1517

1618
this.commands = {
@@ -31,11 +33,30 @@ class ServerlessStepFunctions {
3133
},
3234
},
3335
},
36+
remove: {
37+
commands: {
38+
stepf: {
39+
usage: 'Remove Step functions',
40+
lifecycleEvents: [
41+
'remove',
42+
],
43+
options: {
44+
statemachine: {
45+
usage: 'Name of the State Machine',
46+
shortcut: 'sm',
47+
required: true,
48+
},
49+
},
50+
},
51+
},
52+
},
3453
};
3554

3655
this.hooks = {
3756
'deploy:stepf:deploy': () => BbPromise.bind(this)
3857
.then(this.deploy),
58+
'remove:stepf:remove': () => BbPromise.bind(this)
59+
.then(this.remove),
3960
};
4061
}
4162
}

lib/remove.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
const BbPromise = require('bluebird');
3+
4+
module.exports = {
5+
remove() {
6+
BbPromise.bind(this)
7+
.then(this.getStateMachineArn)
8+
.then(this.deleteStateMachine);
9+
10+
return BbPromise.resolve();
11+
},
12+
};

0 commit comments

Comments
 (0)