@@ -240,6 +240,8 @@ export default class Apigw {
240
240
oldState = { } ,
241
241
serviceId,
242
242
isAutoRelease = true ,
243
+ serviceName,
244
+ serviceDesc,
243
245
} = inputs ;
244
246
inputs . protocols = getProtocolString ( inputs . protocols as ( 'http' | 'https' ) [ ] ) ;
245
247
@@ -248,6 +250,27 @@ export default class Apigw {
248
250
249
251
const detail = await this . service . getById ( serviceId ) ;
250
252
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
+
251
274
const apiList : ApiEndpoint [ ] = await this . api . bulkDeploy ( {
252
275
apiList : endpoints ,
253
276
stateList : stateApiList ,
@@ -269,7 +292,7 @@ export default class Apigw {
269
292
const outputs : ApigwDeployOutputs = {
270
293
created : false ,
271
294
serviceId,
272
- serviceName : detail . ServiceName ,
295
+ serviceName : serviceName || detail . ServiceName ,
273
296
subDomain : subDomain ,
274
297
protocols : inputs . protocols ,
275
298
environment : environment ,
@@ -291,7 +314,8 @@ export default class Apigw {
291
314
} ) ) ;
292
315
}
293
316
294
- return this . formatApigwOutputs ( outputs ) ;
317
+ // return this.formatApigwOutputs(outputs);
318
+ return outputs ;
295
319
}
296
320
throw new ApiError ( {
297
321
type : 'API_APIGW_DescribeService' ,
0 commit comments