Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions src/modules/apigw/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ export default class Apigw {
oldState = {},
serviceId,
isAutoRelease = true,
serviceName,
serviceDesc,
} = inputs;
inputs.protocols = getProtocolString(inputs.protocols as ('http' | 'https')[]);

Expand All @@ -248,6 +250,27 @@ export default class Apigw {

const detail = await this.service.getById(serviceId);
if (detail) {
// 如果 serviceName,serviceDesc,protocols任意字段更新了,则更新服务
if (
!(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,
};
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,
Expand All @@ -269,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,
Expand All @@ -291,7 +314,8 @@ export default class Apigw {
}));
}

return this.formatApigwOutputs(outputs);
// return this.formatApigwOutputs(outputs);
return outputs;
}
throw new ApiError({
type: 'API_APIGW_DescribeService',
Expand Down