@@ -240,6 +240,8 @@ export default class Apigw {
240240 oldState = { } ,
241241 serviceId,
242242 isAutoRelease = true ,
243+ serviceName,
244+ serviceDesc,
243245 } = inputs ;
244246 inputs . protocols = getProtocolString ( inputs . protocols as ( 'http' | 'https' ) [ ] ) ;
245247
@@ -248,6 +250,27 @@ export default class Apigw {
248250
249251 const detail = await this . service . getById ( serviceId ) ;
250252 if ( detail ) {
253+ // 如果 serviceName,serviceDesc,protocols任意字段更新了,则更新服务
254+ if (
255+ ! ( serviceName === detail . ServiceName && serviceDesc === detail . ServiceDesc ) &&
256+ ! ( serviceName === undefined && serviceDesc === undefined )
257+ ) {
258+ const apiInputs = {
259+ Action : 'ModifyService' as const ,
260+ serviceId,
261+ serviceDesc : serviceDesc || detail . ServiceDesc || undefined ,
262+ serviceName : serviceName || detail . ServiceName || undefined ,
263+ } ;
264+ if ( ! serviceName ) {
265+ delete apiInputs . serviceName ;
266+ }
267+ if ( ! serviceDesc ) {
268+ delete apiInputs . serviceDesc ;
269+ }
270+
271+ await this . request ( apiInputs ) ;
272+ }
273+
251274 const apiList : ApiEndpoint [ ] = await this . api . bulkDeploy ( {
252275 apiList : endpoints ,
253276 stateList : stateApiList ,
@@ -269,7 +292,7 @@ export default class Apigw {
269292 const outputs : ApigwDeployOutputs = {
270293 created : false ,
271294 serviceId,
272- serviceName : detail . ServiceName ,
295+ serviceName : serviceName || detail . ServiceName ,
273296 subDomain : subDomain ,
274297 protocols : inputs . protocols ,
275298 environment : environment ,
@@ -291,7 +314,8 @@ export default class Apigw {
291314 } ) ) ;
292315 }
293316
294- return this . formatApigwOutputs ( outputs ) ;
317+ // return this.formatApigwOutputs(outputs);
318+ return outputs ;
295319 }
296320 throw new ApiError ( {
297321 type : 'API_APIGW_DescribeService' ,
0 commit comments