@@ -110,18 +110,6 @@ export default class ServiceEntity {
110
110
serviceDesc = 'Created By Serverless Framework' ,
111
111
} = serviceConf ;
112
112
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
- }
125
113
let detail : Detail ;
126
114
127
115
let outputs : ApigwCreateOrUpdateServiceOutputs = {
@@ -142,14 +130,26 @@ export default class ServiceEntity {
142
130
if ( detail ) {
143
131
detail . InnerSubDomain = detail . InternalSubDomain ;
144
132
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任意字段更新了,则更新服务
145
148
if (
146
149
! (
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
153
153
)
154
154
) {
155
155
const apiInputs = {
@@ -161,21 +161,6 @@ export default class ServiceEntity {
161
161
netTypes : netTypes ,
162
162
} ;
163
163
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
- }
179
164
}
180
165
}
181
166
}
0 commit comments