File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -574,6 +574,15 @@ class Apigw {
574574 return apiDetail ;
575575 }
576576
577+ async getApiById ( { serviceId, apiId } ) {
578+ const apiDetail = await this . request ( {
579+ Action : 'DescribeApi' ,
580+ serviceId : serviceId ,
581+ apiId : apiId ,
582+ } ) ;
583+ return apiDetail ;
584+ }
585+
577586 async createOrUpdateApi ( { serviceId, endpoint, environment, created } ) {
578587 // compatibility for secret auth config depends on auth & usagePlan
579588 const authType = endpoint . auth ? 'SECRET' : endpoint . authType || 'NONE' ;
@@ -615,11 +624,18 @@ class Apigw {
615624
616625 this . marshalApiInput ( endpoint , apiInputs ) ;
617626
618- let apiDetail = await this . getApiByPathAndMethod ( {
619- serviceId,
620- path : endpoint . path ,
621- method : endpoint . method ,
622- } ) ;
627+ let apiDetail = null ;
628+ if ( endpoint . apiId ) {
629+ apiDetail = await this . getApiById ( { serviceId, apiId : endpoint . apiId } ) ;
630+ }
631+
632+ if ( ! apiDetail ) {
633+ apiDetail = await this . getApiByPathAndMethod ( {
634+ serviceId,
635+ path : endpoint . path ,
636+ method : endpoint . method ,
637+ } ) ;
638+ }
623639
624640 if ( apiDetail ) {
625641 console . log ( `Api method ${ endpoint . method } , path ${ endpoint . path } already exist` ) ;
You can’t perform that action at this time.
0 commit comments