@@ -130,7 +130,7 @@ public async Task<Template> GenerateAPIsARMTemplate(string apimname, string reso
130
130
string apiDetails = await GetAPIDetails ( apimname , resourceGroup , apiName ) ;
131
131
132
132
Console . WriteLine ( "------------------------------------------" ) ;
133
- Console . WriteLine ( "Getting operations from {0} API:" , apiName ) ;
133
+ Console . WriteLine ( "Extracting resources from {0} API:" , apiName ) ;
134
134
135
135
// convert returned api to template resource class
136
136
JObject oApiDetails = JObject . Parse ( apiDetails ) ;
@@ -147,7 +147,7 @@ public async Task<Template> GenerateAPIsARMTemplate(string apimname, string reso
147
147
apiResource . dependsOn = new string [ ] { } ;
148
148
149
149
string versionSetName = apiResource . properties . apiVersionSetId ;
150
- int versionSetPosition = versionSetName . IndexOf ( "api-version-sets /" ) ;
150
+ int versionSetPosition = versionSetName . IndexOf ( "apiVersionSets /" ) ;
151
151
152
152
versionSetName = versionSetName . Substring ( versionSetPosition , ( versionSetName . Length - versionSetPosition ) ) ;
153
153
apiResource . properties . apiVersionSetId = $ "[concat(resourceId('Microsoft.ApiManagement/service', parameters('ApimServiceName')), '/{ versionSetName } ')]";
@@ -221,7 +221,7 @@ public async Task<Template> GenerateAPIsARMTemplate(string apimname, string reso
221
221
try
222
222
{
223
223
string operationPolicy = await GetOperationPolicy ( apimname , resourceGroup , oApiName , operationName ) ;
224
- Console . WriteLine ( $ " - Policy found to { operationName } operation") ;
224
+ Console . WriteLine ( $ " - Operation policy found for { operationName } operation") ;
225
225
PolicyTemplateResource operationPolicyResource = JsonConvert . DeserializeObject < PolicyTemplateResource > ( operationPolicy ) ;
226
226
operationPolicyResource . name = $ "[concat(parameters('ApimServiceName'), '/{ oApiName } /{ operationResourceName } /policy')]";
227
227
operationPolicyResource . apiVersion = GlobalConstants . APIVersion ;
@@ -230,20 +230,16 @@ public async Task<Template> GenerateAPIsARMTemplate(string apimname, string reso
230
230
231
231
templateResources . Add ( operationPolicyResource ) ;
232
232
}
233
- catch ( Exception )
234
- {
235
- Console . WriteLine ( $ " - No policy found for { operationName } operation") ;
236
- }
233
+ catch ( Exception ) { }
237
234
}
238
235
#endregion
239
236
240
237
#region API Policies
241
238
// add api policy resource to api template
242
239
try
243
240
{
244
- Console . WriteLine ( "Getting API Policy from {0} API: " , apiName ) ;
245
241
string apiPolicies = await GetAPIPolicies ( apimname , resourceGroup , apiName ) ;
246
- Console . WriteLine ( "API Policy found! " ) ;
242
+ Console . WriteLine ( "API policy found" ) ;
247
243
PolicyTemplateResource apiPoliciesResource = JsonConvert . DeserializeObject < PolicyTemplateResource > ( apiPolicies ) ;
248
244
249
245
apiPoliciesResource . apiVersion = GlobalConstants . APIVersion ;
@@ -252,26 +248,21 @@ public async Task<Template> GenerateAPIsARMTemplate(string apimname, string reso
252
248
253
249
templateResources . Add ( apiPoliciesResource ) ;
254
250
}
255
- catch ( Exception )
256
- {
257
- Console . WriteLine ( "No API policy!" ) ;
258
- }
251
+ catch ( Exception ) { }
259
252
#endregion
260
253
261
254
// add product api associations to template
262
255
#region API Products
263
256
try
264
257
{
265
- Console . WriteLine ( "Getting API Products from {0} API: " , apiName ) ;
266
-
267
258
// pull product api associations
268
259
string apiProducts = await GetAPIProducts ( apimname , resourceGroup , apiName ) ;
269
260
JObject oApiProducts = JObject . Parse ( apiProducts ) ;
270
261
271
262
foreach ( var item in oApiProducts [ "value" ] )
272
263
{
273
264
string apiProductName = ( ( JValue ) item [ "name" ] ) . Value . ToString ( ) ;
274
- Console . WriteLine ( $ " -- { apiProductName } Product found to { oApiName } API" ) ;
265
+ Console . WriteLine ( "'{0}' Product association found" , apiProductName ) ;
275
266
276
267
// convert returned api product associations to template resource class
277
268
ProductAPITemplateResource productAPIResource = JsonConvert . DeserializeObject < ProductAPITemplateResource > ( apiProducts ) ;
@@ -284,16 +275,11 @@ public async Task<Template> GenerateAPIsARMTemplate(string apimname, string reso
284
275
templateResources . Add ( productAPIResource ) ;
285
276
}
286
277
}
287
- catch ( Exception )
288
- {
289
- Console . WriteLine ( "No API products!" ) ;
290
- }
278
+ catch ( Exception ) { }
291
279
#endregion
292
280
293
281
#region Diagnostics
294
282
// add diagnostics to template
295
- Console . WriteLine ( "------------------------------------------" ) ;
296
- Console . WriteLine ( "Getting diagnostics from {0} API:" , apiName ) ;
297
283
// pull diagnostics for api
298
284
string diagnostics = await GetAPIDiagnostics ( apimname , resourceGroup , apiName ) ;
299
285
JObject oDiagnostics = JObject . Parse ( diagnostics ) ;
@@ -350,8 +336,6 @@ public static JObject FormatoApi(string singleApiName, JObject oApi)
350
336
351
337
public async Task < List < TemplateResource > > GenerateSchemasARMTemplate ( string apimServiceName , string apiName , string resourceGroup , string fileFolder )
352
338
{
353
- Console . WriteLine ( "------------------------------------------" ) ;
354
- Console . WriteLine ( "Getting operation schemas from service" ) ;
355
339
List < TemplateResource > templateResources = new List < TemplateResource > ( ) ;
356
340
357
341
// pull all schemas from service
@@ -361,7 +345,7 @@ public async Task<List<TemplateResource>> GenerateSchemasARMTemplate(string apim
361
345
foreach ( var item in oSchemas [ "value" ] )
362
346
{
363
347
string schemaName = ( ( JValue ) item [ "name" ] ) . Value . ToString ( ) ;
364
- Console . WriteLine ( "'{0}' Schema found" , schemaName ) ;
348
+ Console . WriteLine ( "'{0}' Operation schema found" , schemaName ) ;
365
349
366
350
string schemaDetails = await GetAPISchemaDetails ( apimServiceName , resourceGroup , apiName , schemaName ) ;
367
351
0 commit comments