From 929ca005ea1d585372a453ead9e8606bd7b2ff06 Mon Sep 17 00:00:00 2001 From: rongxwang Date: Mon, 10 Jan 2022 20:40:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91,=E5=AE=8C=E6=88=90=E6=97=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/apigw/index.ts | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/modules/apigw/index.ts b/src/modules/apigw/index.ts index fe79ab21..a694e47f 100644 --- a/src/modules/apigw/index.ts +++ b/src/modules/apigw/index.ts @@ -240,6 +240,9 @@ export default class Apigw { oldState = {}, serviceId, isAutoRelease = true, + serviceName = '', + serviceDesc, + protocols, } = inputs; inputs.protocols = getProtocolString(inputs.protocols as ('http' | 'https')[]); @@ -248,6 +251,32 @@ export default class Apigw { const detail = await this.service.getById(serviceId); if (detail) { + // 如果 serviceName,serviceDesc,protocols任意字段更新了,则更新服务 + if ( + !( + serviceName === detail.ServiceName && + serviceDesc === detail.ServiceDesc && + protocols === detail.Protocol + ) + ) { + const apiInputs = { + Action: 'ModifyService' as const, + serviceId, + serviceDesc: serviceDesc || detail.ServiceDesc || undefined, + serviceName: serviceName || detail.ServiceName || undefined, + // protocol: protocols, + // netTypes: netTypes, + }; + if (!serviceName) { + delete apiInputs.serviceName; + } + if (!serviceDesc) { + delete apiInputs.serviceDesc; + } + + await this.request(apiInputs); + } + const apiList: ApiEndpoint[] = await this.api.bulkDeploy({ apiList: endpoints, stateList: stateApiList, @@ -291,7 +320,8 @@ export default class Apigw { })); } - return this.formatApigwOutputs(outputs); + // return this.formatApigwOutputs(outputs); + return outputs; } throw new ApiError({ type: 'API_APIGW_DescribeService', From 53f4568da1a6d245a0317e5f1f080951c8336c9c Mon Sep 17 00:00:00 2001 From: rongxwang Date: Mon, 10 Jan 2022 21:33:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91,=E5=85=BC=E5=AE=B9=E8=80=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/apigw/index.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/modules/apigw/index.ts b/src/modules/apigw/index.ts index a694e47f..578479a6 100644 --- a/src/modules/apigw/index.ts +++ b/src/modules/apigw/index.ts @@ -240,9 +240,8 @@ export default class Apigw { oldState = {}, serviceId, isAutoRelease = true, - serviceName = '', + serviceName, serviceDesc, - protocols, } = inputs; inputs.protocols = getProtocolString(inputs.protocols as ('http' | 'https')[]); @@ -253,19 +252,14 @@ export default class Apigw { if (detail) { // 如果 serviceName,serviceDesc,protocols任意字段更新了,则更新服务 if ( - !( - serviceName === detail.ServiceName && - serviceDesc === detail.ServiceDesc && - protocols === detail.Protocol - ) + !(serviceName === detail.ServiceName && serviceDesc === detail.ServiceDesc) && + !(serviceName === undefined && serviceDesc === undefined) ) { const apiInputs = { Action: 'ModifyService' as const, serviceId, serviceDesc: serviceDesc || detail.ServiceDesc || undefined, serviceName: serviceName || detail.ServiceName || undefined, - // protocol: protocols, - // netTypes: netTypes, }; if (!serviceName) { delete apiInputs.serviceName; From 94f0b944f074417ca642a213bc9f6282f12d34df Mon Sep 17 00:00:00 2001 From: rongxwang Date: Tue, 11 Jan 2022 15:09:42 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9output=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E6=9C=8D=E5=8A=A1=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/apigw/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/apigw/index.ts b/src/modules/apigw/index.ts index 578479a6..e213ef6e 100644 --- a/src/modules/apigw/index.ts +++ b/src/modules/apigw/index.ts @@ -292,7 +292,7 @@ export default class Apigw { const outputs: ApigwDeployOutputs = { created: false, serviceId, - serviceName: detail.ServiceName, + serviceName: serviceName || detail.ServiceName, subDomain: subDomain, protocols: inputs.protocols, environment: environment,