@@ -110,18 +110,6 @@ export default class ServiceEntity {
110110 serviceDesc = 'Created By Serverless Framework' ,
111111 } = serviceConf ;
112112
113- interface Detail {
114- InnerSubDomain : string ;
115- InternalSubDomain : string ;
116- OuterSubDomain : string ;
117-
118- ServiceId : string ;
119-
120- // FIXME: 小写?
121- ServiceName : string ;
122- ServiceDesc : string ;
123- Protocol : string ;
124- }
125113 let detail : Detail ;
126114
127115 let outputs : ApigwCreateOrUpdateServiceOutputs = {
@@ -142,14 +130,26 @@ export default class ServiceEntity {
142130 if ( detail ) {
143131 detail . InnerSubDomain = detail . InternalSubDomain ;
144132 exist = true ;
133+ outputs . serviceId = detail ! . ServiceId ;
134+ outputs . subDomain =
135+ detail ! . OuterSubDomain && detail ! . InnerSubDomain
136+ ? [ detail ! . OuterSubDomain , detail ! . InnerSubDomain ]
137+ : detail ! . OuterSubDomain || detail ! . InnerSubDomain ;
138+
139+ if ( serviceConf . usagePlan ) {
140+ outputs . usagePlan = await this . usagePlan . bind ( {
141+ serviceId : detail ! . ServiceId ,
142+ environment,
143+ usagePlanConfig : serviceConf . usagePlan ,
144+ authConfig : serviceConf . auth ,
145+ } ) ;
146+ }
147+ // 如果 serviceName,serviceDesc,protocols任意字段更新了,则更新服务
145148 if (
146149 ! (
147- // FIXME: 小写?
148- (
149- serviceName === detail . ServiceName &&
150- serviceDesc === detail . ServiceDesc &&
151- protocols === detail . Protocol
152- )
150+ serviceName === detail . ServiceName &&
151+ serviceDesc === detail . ServiceDesc &&
152+ protocols === detail . Protocol
153153 )
154154 ) {
155155 const apiInputs = {
@@ -161,21 +161,6 @@ export default class ServiceEntity {
161161 netTypes : netTypes ,
162162 } ;
163163 await this . request ( apiInputs ) ;
164-
165- outputs . serviceId = detail ! . ServiceId ;
166- outputs . subDomain =
167- detail ! . OuterSubDomain && detail ! . InnerSubDomain
168- ? [ detail ! . OuterSubDomain , detail ! . InnerSubDomain ]
169- : detail ! . OuterSubDomain || detail ! . InnerSubDomain ;
170-
171- if ( serviceConf . usagePlan ) {
172- outputs . usagePlan = await this . usagePlan . bind ( {
173- serviceId : detail ! . ServiceId ,
174- environment,
175- usagePlanConfig : serviceConf . usagePlan ,
176- authConfig : serviceConf . auth ,
177- } ) ;
178- }
179164 }
180165 }
181166 }
0 commit comments