@@ -59,9 +59,7 @@ private void GenerateARMTemplate(string apimname, string resourceGroup, string f
59
59
FileWriter fileWriter ;
60
60
APIExtractor apiExtractor = new APIExtractor ( ) ;
61
61
string apis = apiExtractor . GetAPIs ( apimname , resourceGroup ) . Result ;
62
- TemplateCreator templateCreator = new TemplateCreator ( ) ;
63
- Template armTemplate = templateCreator . CreateEmptyTemplate ( ) ;
64
- armTemplate . parameters = new Dictionary < string , TemplateParameterProperties > { { "ApimServiceName" , new TemplateParameterProperties ( ) { type = "string" } } } ;
62
+ Template armTemplate = GenerateEmptyTemplateWithParameters ( ) ;
65
63
66
64
JObject oApi = JObject . Parse ( apis ) ;
67
65
oApi = FormatoApi ( singleApiName , oApi ) ;
@@ -268,9 +266,7 @@ private static JObject FormatoApi(string singleApiName, JObject oApi)
268
266
private void GenerateVersionSetARMTemplate ( string apimname , string resourceGroup , string versionSetName , string fileFolder )
269
267
{
270
268
APIExtractor apiExtractor = new APIExtractor ( ) ;
271
- TemplateCreator templateCreator = new TemplateCreator ( ) ;
272
- Template armTemplate = templateCreator . CreateEmptyTemplate ( ) ;
273
- armTemplate . parameters = new Dictionary < string , TemplateParameterProperties > { { "ApimServiceName" , new TemplateParameterProperties ( ) { type = "string" } } } ;
269
+ Template armTemplate = GenerateEmptyTemplateWithParameters ( ) ;
274
270
275
271
List < TemplateResource > templateResources = new List < TemplateResource > ( ) ;
276
272
@@ -288,12 +284,11 @@ private void GenerateVersionSetARMTemplate(string apimname, string resourceGroup
288
284
FileWriter fileWriter = new FileWriter ( ) ;
289
285
fileWriter . WriteJSONToFile ( armTemplate , filePath ) ;
290
286
}
287
+
291
288
private void GenerateProductsARMTemplate ( string apimname , string resourceGroup , string fileFolder )
292
289
{
293
290
APIExtractor apiExtractor = new APIExtractor ( ) ;
294
- TemplateCreator templateCreator = new TemplateCreator ( ) ;
295
- Template armTemplate = templateCreator . CreateEmptyTemplate ( ) ;
296
- armTemplate . parameters = new Dictionary < string , TemplateParameterProperties > { { "ApimServiceName" , new TemplateParameterProperties ( ) { type = "string" } } } ;
291
+ Template armTemplate = GenerateEmptyTemplateWithParameters ( ) ;
297
292
298
293
List < TemplateResource > templateResources = new List < TemplateResource > ( ) ;
299
294
@@ -327,9 +322,7 @@ private async void GenerateLoggerTemplate(string resourceGroup, string apimname,
327
322
Console . WriteLine ( "Geting loggers from service" ) ;
328
323
LoggerExtractor loggerExtractor = new LoggerExtractor ( ) ;
329
324
PropertyExtractor propertyExtractor = new PropertyExtractor ( ) ;
330
- TemplateCreator templateCreator = new TemplateCreator ( ) ;
331
- Template armTemplate = templateCreator . CreateEmptyTemplate ( ) ;
332
- armTemplate . parameters = new Dictionary < string , TemplateParameterProperties > { { "ApimServiceName" , new TemplateParameterProperties ( ) { type = "string" } } } ;
325
+ Template armTemplate = GenerateEmptyTemplateWithParameters ( ) ;
333
326
334
327
List < TemplateResource > templateResources = new List < TemplateResource > ( ) ;
335
328
@@ -375,5 +368,13 @@ private async void GenerateLoggerTemplate(string resourceGroup, string apimname,
375
368
string filePath = fileFolder + Path . DirectorySeparatorChar + string . Format ( "loggers" , "/" , "-" ) + ".json" ;
376
369
fileWriter . WriteJSONToFile ( armTemplate , filePath ) ;
377
370
}
371
+
372
+ public Template GenerateEmptyTemplateWithParameters ( )
373
+ {
374
+ TemplateCreator templateCreator = new TemplateCreator ( ) ;
375
+ Template armTemplate = templateCreator . CreateEmptyTemplate ( ) ;
376
+ armTemplate . parameters = new Dictionary < string , TemplateParameterProperties > { { "ApimServiceName" , new TemplateParameterProperties ( ) { type = "string" } } } ;
377
+ return armTemplate ;
378
+ }
378
379
}
379
380
}
0 commit comments