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 {
574
574
return apiDetail ;
575
575
}
576
576
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
+
577
586
async createOrUpdateApi ( { serviceId, endpoint, environment, created } ) {
578
587
// compatibility for secret auth config depends on auth & usagePlan
579
588
const authType = endpoint . auth ? 'SECRET' : endpoint . authType || 'NONE' ;
@@ -615,11 +624,18 @@ class Apigw {
615
624
616
625
this . marshalApiInput ( endpoint , apiInputs ) ;
617
626
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
+ }
623
639
624
640
if ( apiDetail ) {
625
641
console . log ( `Api method ${ endpoint . method } , path ${ endpoint . path } already exist` ) ;
You can’t perform that action at this time.
0 commit comments