Skip to content

Commit 421626b

Browse files
committed
Add empty component implementation
1 parent 9baabdc commit 421626b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

serverless.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const { isEmpty, mergeDeepRight } = require('ramda')
2+
const { Component } = require('@serverless/core')
3+
4+
const defaults = {
5+
foo: 'bar'
6+
}
7+
8+
class KubernetesNamespace extends Component {
9+
async default(inputs = {}) {
10+
const config = mergeDeepRight(defaults, inputs)
11+
12+
this.state = config
13+
await this.save()
14+
return this.state
15+
}
16+
17+
async remove(inputs = {}) {
18+
let config = mergeDeepRight(defaults, inputs)
19+
if (isEmpty(config)) {
20+
config = this.state
21+
}
22+
23+
this.state = {}
24+
await this.save()
25+
return {}
26+
}
27+
}
28+
29+
module.exports = KubernetesNamespace

0 commit comments

Comments
 (0)