-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserverless.js
More file actions
34 lines (27 loc) · 869 Bytes
/
Copy pathserverless.js
File metadata and controls
34 lines (27 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { Component } = require('@serverless/core')
const { getClients, deployLayer, removeLayer } = require('./utils')
class AwsLambdaLayer extends Component {
async deploy(inputs = {}) {
inputs.region = inputs.region || 'us-east-1'
const clients = getClients(this.credentials.aws, inputs.region)
await deployLayer(this, inputs, clients)
return {
name: this.state.name,
region: this.state.region,
version: this.state.version,
arn: this.state.arn,
arnVersion: this.state.versionArn
}
}
async remove() {
if (!this.state.name) {
// eslint-disable-next-line
console.log(`State is empty. Nothing to remove.`)
}
const clients = getClients(this.credentials.aws, this.state.region)
await removeLayer(this, clients)
this.state = {}
return {}
}
}
module.exports = AwsLambdaLayer