Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 84a3287

Browse files
authored
Merge pull request #152 from Azure/odaibert/products
Odaibert/products
2 parents 6e1cdfc + 1423fc7 commit 84a3287

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ API developers will fork the publisher repository to a developer repository and
4040
We realize there are two challenges for API developers when working with Resource Manager templates:
4141

4242
* First, API developers often work with [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification) and may not be familiar with Resource Manager schemas. Authoring templates manually might be an error-prone task. Therefore, we created a utility tool called [**Creator**](./src/APIM_ARMTemplate/README.md#Creator) to automate the creation of API templates based on an Open API Specification file. Optionally, developers can supply API Management policies for an API in XML format. Basically, the tool inserts the Open API specification and policies into a Resource Manager template in the proper format. With this tool, API developers can continue focusing on the formats and artifacts they are familiar with.
43-
* Second, for customers who have already been using API Management, another challenge is how to extract existing configurations into Resource Manager templates. For those customers, We have created another tool called [**Extrator**](./src/APIM_ARMTemplate/README.md#Extractor) to help them generate templates by extracting configurations from their exisitng API Management instances.
43+
44+
* Second, for customers who have already been using API Management, another challenge is how to extract existing configurations into Resource Manager templates. For those customers, We have created another tool called [**Extrator**](./src/APIM_ARMTemplate/README.md#extractor) to help them generate templates by extracting configurations from their exisitng API Management instances.
4445

4546
Once API developers have finished developing and testing an API, and have generated the API template, they can submit a pull request to merge the changes to the publisher repository. API publishers can validate the pull request and make sure the changes are safe and compliant. For example, they can check if only HTTPS is allowed to communicate with the API. Most of these validations can be automated as a step in the CI/CD pipeline. Once the changes are approved and merged successfully, API publishers can choose to deploy them to the Production instance either on schedule or on demand. The deployment of the templates can be automated using [Azure Pipeline](https://docs.microsoft.com/en-us/azure/devops/pipelines/?view=azure-devops), [PowerShell](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-deploy), [Azure CLI](Azure-cli-example.md) or other tools.
4647

src/APIM_ARMTemplate/apimtemplate/Commands/Extract.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ private void GenerateARMTemplate(string apimname, string resourceGroup, string f
270270

271271
if (singleApiName != null)
272272
{
273+
GenerateProductsARMTemplate(apimname, resourceGroup, fileFolder);
273274
fileWriter = new FileWriter();
274275
fileWriter.WriteJSONToFile(armTemplate, @fileFolder + Path.DirectorySeparatorChar + apimname + "-" + oApiName + "-template.json");
275276
templateResources = new List<TemplateResource>();
@@ -347,7 +348,13 @@ private void GenerateProductsARMTemplate(string apimname, string resourceGroup,
347348

348349
string productDetails = apiExtractor.GetProductDetails(apimname, resourceGroup, productName).Result;
349350

350-
ProductsDetailsTemplateResource productsDetailsResource = JsonConvert.DeserializeObject<ProductsDetailsTemplateResource>(productDetails);
351+
var settings = new JsonSerializerSettings
352+
{
353+
NullValueHandling = NullValueHandling.Ignore,
354+
MissingMemberHandling = MissingMemberHandling.Ignore
355+
};
356+
357+
ProductsDetailsTemplateResource productsDetailsResource = JsonConvert.DeserializeObject<ProductsDetailsTemplateResource>(productDetails, settings);
351358
productsDetailsResource.name = $"[concat(parameters('ApimServiceName'), '/{productName}')]";
352359
productsDetailsResource.apiVersion = "2018-06-01-preview";
353360

0 commit comments

Comments
 (0)