private void GenerateVersionSetARMTemplate(string apimname, string resourceGroup, string versionSetName, string fileFolder) { APIExtractor apiExtractor = new APIExtractor(); Template armTemplate = GenerateEmptyTemplateWithParameters(); List <TemplateResource> templateResources = new List <TemplateResource>(); string versionSet = apiExtractor.GetAPIVersionSet(apimname, resourceGroup, versionSetName).Result; APIVersionSetTemplateResource versionSetResource = JsonConvert.DeserializeObject <APIVersionSetTemplateResource>(versionSet); string filePath = fileFolder + Path.DirectorySeparatorChar + string.Format(versionSetResource.name, "/", "-") + ".json"; versionSetResource.name = $"[concat(parameters('ApimServiceName'), '/{versionSetResource.name}')]"; versionSetResource.apiVersion = "2018-06-01-preview"; templateResources.Add(versionSetResource); armTemplate.resources = templateResources.ToArray(); FileWriter fileWriter = new FileWriter(); fileWriter.WriteJSONToFile(armTemplate, filePath); }
private void GenerateVersionSetARMTemplate(string apimname, string resourceGroup, string versionSetName, string fileFolder) { APIExtractor apiExtractor = new APIExtractor(); Template armTemplate = new Template() { schema = "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", contentVersion = "1.0.0.0", parameters = new Dictionary <string, TemplateParameterProperties> { { "ApimServiceName", new TemplateParameterProperties() { type = "string" } } }, variables = { }, resources = { }, outputs = { } }; List <TemplateResource> templateResources = new List <TemplateResource>(); string versionSet = apiExtractor.GetAPIVersionSet(apimname, resourceGroup, versionSetName).Result; APIVersionSetTemplateResource versionSetResource = JsonConvert.DeserializeObject <APIVersionSetTemplateResource>(versionSet); string filePath = fileFolder + Path.DirectorySeparatorChar + string.Format(versionSetResource.name, "/", "-") + ".json"; versionSetResource.name = $"[concat(parameters('ApimServiceName'), '/{versionSetResource.name}')]"; versionSetResource.apiVersion = "2018-06-01-preview"; templateResources.Add(versionSetResource); armTemplate.resources = templateResources.ToArray(); FileWriter fileWriter = new FileWriter(); fileWriter.WriteJSONToFile(armTemplate, filePath); }