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

Commit 18cea0d

Browse files
authored
Not include named value template (#465)
* Not include named value template * small fix
1 parent 81a9a90 commit 18cea0d

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/APIM_ARMTemplate/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ You have two choices when specifying your settings:
382382
| paramApiLoggerId | No | Set to "true" will parameterize all logger ids in all apis (within api templates) |
383383
| paramLogResourceId | No | Set to "true" will parameterize all loggers' resource ids (within logger template)|
384384
| serviceBaseUrl | No | Specify the base url where you want to run your extractor |
385+
| notIncludeNamedValue | No | Set to "true" will not generate Named Value Templates|
385386

386387
#### Note
387388
* Can not use "splitAPIs" and "apiName" at the same time, since using "apiName" only extract one API

src/APIM_ARMTemplate/apimtemplate/Extractor/EntityExtractors/PropertyExtractor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ public async Task<string> GetPropertyDetailsAsync(string ApiManagementName, stri
3131

3232
public async Task<Template> GenerateNamedValuesTemplateAsync(string singleApiName, List<TemplateResource> apiTemplateResources, Extractor exc)
3333
{
34+
if (exc.notIncludeNamedValue == true)
35+
{
36+
Console.WriteLine("------------------------------------------");
37+
Console.WriteLine("Skipping extracting named values from service");
38+
return GenerateEmptyPropertyTemplateWithParameters(exc);
39+
}
40+
3441
Console.WriteLine("------------------------------------------");
3542
Console.WriteLine("Extracting named values from service");
3643
Template armTemplate = GenerateEmptyPropertyTemplateWithParameters(exc);

src/APIM_ARMTemplate/apimtemplate/Extractor/Models/ExtractorConfiguration.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public class ExtractorConfig
4646
public string paramLogResourceId { get; set; }
4747
[Description("Specify the the base url for calling api management")]
4848
public string serviceBaseUrl { get; set; }
49+
[Description("Should not include named values template")]
50+
public string notIncludeNamedValue { get; set; }
51+
4952
public void Validate()
5053
{
5154
if (string.IsNullOrEmpty(sourceApimName)) throw new ArgumentException("Missing parameter <sourceApimName>.");
@@ -104,6 +107,7 @@ public class Extractor
104107
public bool paramNamedValue { get; private set; }
105108
public bool paramApiLoggerId { get; private set; }
106109
public bool paramLogResourceId { get; private set; }
110+
public bool notIncludeNamedValue { get; private set; }
107111

108112
public Extractor(ExtractorConfig exc, string dirName)
109113
{
@@ -123,6 +127,7 @@ public Extractor(ExtractorConfig exc, string dirName)
123127
this.paramNamedValue = exc.paramNamedValue != null && exc.paramNamedValue.Equals("true");
124128
this.paramApiLoggerId = exc.paramApiLoggerId != null && exc.paramApiLoggerId.Equals("true");
125129
this.paramLogResourceId = exc.paramLogResourceId != null && exc.paramLogResourceId.Equals("true");
130+
this.notIncludeNamedValue = exc.notIncludeNamedValue != null && exc.notIncludeNamedValue.Equals("true");
126131
}
127132

128133
public Extractor(ExtractorConfig exc) : this(exc, exc.fileFolder)

0 commit comments

Comments
 (0)