@@ -23,6 +23,15 @@ class Apigw {
2323 }
2424 }
2525
26+ async deleteRequest ( inputs ) {
27+ inputs . Region = this . region
28+ try {
29+ await this . apigwClient . request ( inputs )
30+ } catch ( e ) {
31+ console . log ( e )
32+ }
33+ }
34+
2635 async createOrUpdateService ( serviceConf ) {
2736 const {
2837 serviceId,
@@ -570,7 +579,7 @@ class Apigw {
570579 // 1.1 unbind secrete ids
571580 const { secrets } = curApi . usagePlan
572581 if ( secrets && secrets . secretIds ) {
573- await this . request ( {
582+ await this . deleteRequest ( {
574583 Action : 'UnBindSecretIds' ,
575584 secretIds : secrets . secretIds ,
576585 usagePlanId : curApi . usagePlan . usagePlanId
@@ -581,11 +590,11 @@ class Apigw {
581590 if ( curApi . usagePlan . secrets . created === true ) {
582591 for ( let sIdx = 0 ; sIdx < secrets . secretIds . length ; sIdx ++ ) {
583592 const secretId = secrets . secretIds [ sIdx ]
584- await this . request ( {
593+ await this . deleteRequest ( {
585594 Action : 'DisableApiKey' ,
586595 secretId
587596 } )
588- await this . request ( {
597+ await this . deleteRequest ( {
589598 Action : 'DeleteApiKey' ,
590599 secretId
591600 } )
@@ -595,7 +604,7 @@ class Apigw {
595604 }
596605
597606 // 1.2 unbind environment
598- await this . request ( {
607+ await this . deleteRequest ( {
599608 Action : 'UnBindEnvironment' ,
600609 serviceId,
601610 usagePlanIds : [ curApi . usagePlan . usagePlanId ] ,
@@ -612,7 +621,7 @@ class Apigw {
612621 console . log (
613622 `Removing any previously deployed usage plan ids ${ curApi . usagePlan . usagePlanId } `
614623 )
615- await this . request ( {
624+ await this . deleteRequest ( {
616625 Action : 'DeleteUsagePlan' ,
617626 usagePlanId : curApi . usagePlan . usagePlanId
618627 } )
@@ -622,7 +631,7 @@ class Apigw {
622631 // 2. delete only apis created by serverless framework
623632 if ( curApi . apiId && curApi . created === true ) {
624633 console . log ( `Removing api: ${ curApi . apiId } ` )
625- await this . request ( {
634+ await this . deleteRequest ( {
626635 Action : 'DeleteApi' ,
627636 apiId : curApi . apiId ,
628637 serviceId
@@ -636,7 +645,7 @@ class Apigw {
636645 const curDomain = customDomains [ i ]
637646 if ( curDomain . subDomain && curDomain . created === true ) {
638647 console . log ( `Unbinding custom domain: ${ curDomain . subDomain } ` )
639- await this . request ( {
648+ await this . deleteRequest ( {
640649 Action : 'UnBindSubDomain' ,
641650 serviceId,
642651 subDomain : curDomain . subDomain
@@ -647,7 +656,7 @@ class Apigw {
647656
648657 // 3. unrelease service
649658 console . log ( `Unreleasing service: ${ serviceId } , environment: ${ environment } ` )
650- await this . request ( {
659+ await this . deleteRequest ( {
651660 Action : 'UnReleaseService' ,
652661 serviceId,
653662 environmentName : environment ,
@@ -657,7 +666,7 @@ class Apigw {
657666 if ( created === true ) {
658667 // delete service
659668 console . log ( `Removing service: ${ serviceId } ` )
660- await this . request ( {
669+ await this . deleteRequest ( {
661670 Action : 'DeleteService' ,
662671 serviceId
663672 } )
0 commit comments