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

Commit 7c2782b

Browse files
authored
Refactoring merge PR (#649)
* Code architecture refactoring and fixing project structure (#612) Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * Added .editorconfig and fixed style according to it (#621) * added .editorconfig and fixed style according to it * add issue link to TODO for creator executor Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * PolicyExtractor refactoring & testing (#625) * Initial extractorExecutor parameters\configuration refactoring + tests setup * codestyle fixes. created apiclients and separated API + extraction for policy extractor * review updates * explicit variable for fixing dotnet build error CS0815 * fix IO.DirectoryNotFoundException in tests * rename `ToParameterize` properties * move template creator to Common\Templates\Abstractions * rename templateCreator to templateGeneratorBase and make it a parent for all creators\extractors Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * add DI to application (#631) * add DI to application * cleared entry pointed, deleted reflection, get rid of comman-line library dependencies in business logic code * review +build fix Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * product-apis extractor refactoring (#636) * product apis refactoring * launchsettings.json rollback * rename service api products extractor * global renaming, fix PR review * rename product-apis response and properties Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * order resources section fields of generated templates (#637) * order resources section fields of generated templates * fix comment Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * refactor product extractor, fix logging, rework api-clients (#639) * refactor product extractor, fix logging, rework api-clients * rename predefined parameter * parameter order fix * rollback launch settings. json * ignore changes in launch settings json * make template builder as an injectable service * exclude template builder extensions * removed explicit discard Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * fix typos in paths (#640) Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * implement groups extractor (#641) * implement groups extractor * [review] duplicated code removal, cleaning tests, fixing namings Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * ApiVersionSet, AuthorizationServer extractors refactoring (#643) Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * make templates generic & refactor api-extractor (#644) * make templates generic + refactor api-extractor * runtime bugs fixes * PR review Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * serialization fixes after refactoring + entry point descriptions added (#645) * serialization fixes * provide fully-described outputs and fulfill rdocumentation * fix required options for commands * fix spaces Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com> * fix refactoring breaking changes (checked manually) * remove public pipelines Co-authored-by: Dmitrii Korolev <dmkorolev@microsoft.com>
1 parent f82486e commit 7c2782b

File tree

346 files changed

+12868
-5494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

346 files changed

+12868
-5494
lines changed

.editorconfig

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
2+
root = true
3+
4+
# Don't use tabs for indentation.
5+
[*]
6+
indent_style = space
7+
# (Please don't specify an indent_size here; that has too many unintended consequences.)
8+
9+
[*.cs]
10+
indent_size = 4
11+
charset = utf-8-bom
12+
13+
file_header_template =--------------------------------------------------------------------------\n <copyright file="{fileName}" company="Microsoft">\n Copyright (c) Microsoft Corporation. All rights reserved.\n </copyright>\n--------------------------------------------------------------------------
14+
15+
# use this. for all instance member access
16+
dotnet_style_qualification_for_field = true:error
17+
dotnet_style_qualification_for_property = true:error
18+
dotnet_style_qualification_for_method = true:error
19+
dotnet_style_qualification_for_event = true:error
20+
21+
# Sort using and Import directives with System.* appearing first
22+
dotnet_sort_system_directives_first = true
23+
dotnet_separate_import_directive_groups = false
24+
25+
# don't specify private/internal if it's default
26+
dotnet_style_require_accessibility_modifiers = omit_if_default:error
27+
28+
# Reusable naming style definitions
29+
dotnet_naming_style.camel_case.capitalization = camel_case
30+
dotnet_naming_style.pascal_case.capitalization = pascal_case
31+
32+
# Constants are PascalCase
33+
dotnet_naming_rule.constants_should_be_pascal_case.severity = error
34+
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
35+
dotnet_naming_rule.constants_should_be_pascal_case.style = pascal_case
36+
37+
dotnet_naming_symbols.constants.applicable_kinds = field, local
38+
dotnet_naming_symbols.constants.required_modifiers = const
39+
40+
# Static fields are PascalCase
41+
dotnet_naming_rule.static_fields_should_be_pascal_case.severity = error
42+
dotnet_naming_rule.static_fields_should_be_pascal_case.symbols = static_fields
43+
dotnet_naming_rule.static_fields_should_be_pascal_case.style = pascal_case
44+
45+
dotnet_naming_symbols.static_fields.applicable_kinds = field
46+
dotnet_naming_symbols.static_fields.applicable_accessibilities = *
47+
dotnet_naming_symbols.static_fields.required_modifiers = static
48+
49+
# Private instance private fields are camelCase
50+
dotnet_naming_rule.private_instance_fields_should_be_camel_case.severity = error
51+
dotnet_naming_rule.private_instance_fields_should_be_camel_case.symbols = private_instance_fields
52+
dotnet_naming_rule.private_instance_fields_should_be_camel_case.style = camel_case
53+
54+
dotnet_naming_symbols.private_instance_fields.applicable_kinds = field
55+
dotnet_naming_symbols.private_instance_fields.applicable_accessibilities = private
56+
57+
# Locals and parameters are camelCase
58+
dotnet_naming_rule.locals_should_be_camel_case.severity = error
59+
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
60+
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case
61+
62+
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
63+
64+
# Local functions are PascalCase
65+
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = error
66+
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
67+
dotnet_naming_rule.local_functions_should_be_pascal_case.style = pascal_case
68+
69+
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
70+
71+
# All public and internal members are PascalCase
72+
dotnet_naming_rule.public_members_should_be_pascal_case.severity = error
73+
dotnet_naming_rule.public_members_should_be_pascal_case.symbols = public_members
74+
dotnet_naming_rule.public_members_should_be_pascal_case.style = pascal_case
75+
76+
dotnet_naming_symbols.public_members.applicable_kinds = property, method, field, event, delegate
77+
dotnet_naming_symbols.public_members.applicable_accessibilities = public, internal
78+
79+
# let's not take responsibility for DotNetty problems (is external repo)
80+
[Proxy/DotNetty/**.cs]
81+
dotnet_analyzer_diagnostic.severity = none # disables most external analyzers
82+
dotnet_diagnostic.CS0628.severity = none # protected member in sealed class
83+
dotnet_diagnostic.CS0108.severity = none # hides inherited member, no "new"
84+
dotnet_diagnostic.CS1570.severity = none # xml comments: badly formed xml
85+
dotnet_diagnostic.CS1573.severity = none # xml comments: missing a parameter
86+
dotnet_diagnostic.CS1574.severity = none # xml comments: bad cref
87+
dotnet_diagnostic.CS1711.severity = none # xml comments: bad type param
88+
dotnet_diagnostic.CS4014.severity = none # awaitable call not awaited

.gitignore

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@ nupkg/
1212
!.vscode/launch.json
1313
!.vscode/extensions.json
1414

15+
# Rider
16+
## User specific
17+
**/.idea/**/workspace.xml
18+
**/.idea/**/tasks.xml
19+
**/.idea/shelf/*
20+
**/.idea/dictionaries
21+
**/.idea/httpRequests/
22+
23+
## Sensitive or high-churn files
24+
**/.idea/**/dataSources/
25+
**/.idea/**/dataSources.ids
26+
**/.idea/**/dataSources.xml
27+
**/.idea/**/dataSources.local.xml
28+
**/.idea/**/sqlDataSources.xml
29+
**/.idea/**/dynamic.xml
30+
31+
## Rider auto-generates .iml files, and contentModel.xml
32+
**/.idea/**/*.iml
33+
**/.idea/**/contentModel.xml
34+
**/.idea/**/modules.xml
35+
1536
# User-specific files
1637
*.suo
1738
*.user
@@ -35,4 +56,5 @@ msbuild.err
3556
msbuild.wrn
3657

3758
# Visual Studio 2015
38-
.vs/
59+
.vs/
60+
src/**/*launchSettings.json

src/APIM_ARMTemplate/apimtemplate/apimtemplate.sln renamed to Microsoft.Azure.Management.ApiManagement.sln

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.28307.136
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.32112.339
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "apimtemplate", "apimtemplate.csproj", "{B5183465-2BC1-4206-9C9F-5AC9615AC941}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArmTemplates", "src\ArmTemplates\ArmTemplates.csproj", "{B5183465-2BC1-4206-9C9F-5AC9615AC941}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "apimtemplate.test", "..\apimtemplate.test\apimtemplate.test.csproj", "{7D0C17F8-C0F5-4678-A75F-EB1BE94E3A46}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArmTemplates.Tests", "tests\ArmTemplates.Tests\ArmTemplates.Tests.csproj", "{7D0C17F8-C0F5-4678-A75F-EB1BE94E3A46}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A8FCD0FA-2908-4EE5-B9DE-C0F6E0661C8D}"
11+
EndProject
12+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{583B0ECD-81D1-4091-B158-2651468CBB51}"
913
EndProject
1014
Global
1115
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -25,6 +29,10 @@ Global
2529
GlobalSection(SolutionProperties) = preSolution
2630
HideSolutionNode = FALSE
2731
EndGlobalSection
32+
GlobalSection(NestedProjects) = preSolution
33+
{B5183465-2BC1-4206-9C9F-5AC9615AC941} = {A8FCD0FA-2908-4EE5-B9DE-C0F6E0661C8D}
34+
{7D0C17F8-C0F5-4678-A75F-EB1BE94E3A46} = {583B0ECD-81D1-4091-B158-2651468CBB51}
35+
EndGlobalSection
2836
GlobalSection(ExtensibilityGlobals) = postSolution
2937
SolutionGuid = {86622F7B-B2EB-4FC7-9164-36F06B2F8B1D}
3038
EndGlobalSection

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ APIs have become mundane. They have become the de facto standard for connecting
66

77
With the strategic value of APIs, a continuous integration (CI) and continuous deployment (CD) pipeline has become an important aspect of API development. It allows organizations to automate deployment of API changes without error-prone manual steps, detect issues earlier, and ultimately deliver value to end users faster.
88

9-
This repository provides [guidance](./README.md), [examples](./example/), and [tools](./src/APIM_ARMTemplate/README.md) to help you achieve API DevOps with Azure API Management.
9+
This repository provides [guidance](./README.md), [examples](./example/), and [tools](./src/README.md) to help you achieve API DevOps with Azure API Management.
1010

1111
## The Problem
1212

@@ -39,9 +39,9 @@ API developers will fork the publisher repository to a developer repository and
3939

4040
We realize there are two challenges for API developers when working with Resource Manager templates:
4141

42-
* 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.
42+
* 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/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.
4343

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 [**Extractor**](./src/APIM_ARMTemplate/README.md#extractor) to help them generate templates by extracting configurations from their exisitng API Management instances.
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 [**Extractor**](./src/README.md#extractor) to help them generate templates by extracting configurations from their exisitng API Management instances.
4545

4646
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 [Github Actions](https://github.com/Azure/apimanagement-devops-samples), [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. An example using Azure DevOps can be find [here](docs/AzDO-Example.md)
4747

docs/AzDO-Example.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Where:
7676

7777
**RESOURCE-GROUP-NAME:** Resource group where the DEV-APIM-NAME is hosted.
7878

79-
***For more information on how to run the application and parameters, [go to this page](https://github.com/Azure/azure-api-management-devops-resource-kit/blob/master/src/APIM_ARMTemplate/README.md#extractor).***
79+
***For more information on how to run the application and parameters, [go to this page](https://github.com/Azure/azure-api-management-devops-resource-kit/blob/master/src/README.md#extractor).***
8080

8181
After executing the command above, you will see something similar to this:
8282

example/demo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ In order to run the creator on this example:
44

55
```bash
66
mkdir Output
7-
dotnet run --project ../../src/APIM_ARMTemplate/apimtemplate create --configFile Input/valid.yml
7+
dotnet run --project ../../src/ARMTemplates create --configFile Input/valid.yml
88
```
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)