Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async remove() {
console.log(`Removing ${CONFIGS.compFullname} App...`)
const { state } = this
const { regionList = [] } = state
const credentials = this.getCredentials()
const removeHandlers = []
for (let i = 0; i < regionList.length; i++) {
const curRegion = regionList[i]
const curState = state[curRegion]
const scf = new Scf(credentials, curRegion)
const apigw = new Apigw(credentials, curRegion)
const handler = async () => {
await scf.remove({
functionName: curState.functionName,
namespace: curState.namespace
})
// if disable apigw, no need to remove
if (state.apigwDisabled !== true) {
await apigw.remove({
created: curState.created,
environment: curState.environment,
serviceId: curState.serviceId,
apiList: curState.apiList,
customDomains: curState.customDomains
})
}
}
const apigwDeployer = async () => {
const apigw = new Apigw(credentials, curRegion)
const oldState = this.state[curRegion] || {}
const apigwInputs = {
...inputs,
oldState: {
apiList: oldState.apiList || [],
customDomains: oldState.customDomains || []
}
}
// different region deployment has different service id
apigwInputs.serviceId = getServiceId(this, curRegion)
const apigwOutput = await apigw.deploy(deepClone(apigwInputs))
outputs[curRegion] = {
serviceId: apigwOutput.serviceId,
subDomain: apigwOutput.subDomain,
environment: apigwOutput.environment,