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 funcDeployer = async (curRegion) => {
const code = await uploadCodeToCos(this, appId, credentials, inputs, curRegion)
const scf = new Scf(credentials, curRegion)
const tempInputs = {
...inputs,
code
}
const scfOutput = await scf.deploy(deepClone(tempInputs))
outputs[curRegion] = {
functionName: scfOutput.FunctionName,
runtime: scfOutput.Runtime,
namespace: scfOutput.Namespace
}
this.state[curRegion] = {
...(this.state[curRegion] ? this.state[curRegion] : {}),
...outputs[curRegion]
}