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

Commit dec0c2e

Browse files
authored
Revert "Added .editorconfig and fixed style according to it (#621)" (#628)
This reverts commit 5b27513.
1 parent af868f5 commit dec0c2e

File tree

53 files changed

+612
-684
lines changed

Some content is hidden

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

53 files changed

+612
-684
lines changed

.editorconfig

Lines changed: 0 additions & 88 deletions
This file was deleted.

src/ArmTemplates/Commands/Abstractions/CommandLineApplicationBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ public abstract class CommandLineApplicationBase : CommandLineApplication
77
{
88
protected CommandLineApplicationBase()
99
{
10-
this.SetupApplicationAndCommands();
10+
SetupApplicationAndCommands();
1111

1212
this.HelpOption();
1313

14-
this.OnExecute(async () => await this.ExecuteCommand());
14+
OnExecute(async () => await ExecuteCommand());
1515
}
1616

1717
protected abstract void SetupApplicationAndCommands();

src/ArmTemplates/Commands/Applications/CreateApplicationCommand.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,30 @@ namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Commands.Applica
1515
{
1616
public class CreateApplicationCommand : CommandLineApplicationBase
1717
{
18-
CommandOption appInsightsInstrumentationKey;
19-
CommandOption appInsightsName;
20-
CommandOption namedValueKeys;
21-
CommandOption apimNameValue;
22-
CommandOption configFile;
23-
CommandOption backendUrlConfigFile;
24-
CommandOption preferredAPIsForDeployment;
18+
private CommandOption _appInsightsInstrumentationKey;
19+
private CommandOption _appInsightsName;
20+
private CommandOption _namedValueKeys;
21+
private CommandOption _apimNameValue;
22+
private CommandOption _configFile;
23+
private CommandOption _backendUrlConfigFile;
24+
private CommandOption _preferredAPIsForDeployment;
2525

2626
public CreateApplicationCommand() : base()
2727
{
2828
}
2929

3030
protected override void SetupApplicationAndCommands()
3131
{
32-
this.Name = GlobalConstants.CreateName;
33-
this.Description = GlobalConstants.CreateDescription;
34-
35-
this.appInsightsInstrumentationKey = this.Option("--appInsightsInstrumentationKey <appInsightsInstrumentationKey>", "AppInsights intrumentationkey", CommandOptionType.SingleValue);
36-
this.appInsightsName = this.Option("--appInsightsName <appInsightsName>", "AppInsights Name", CommandOptionType.SingleValue);
37-
this.namedValueKeys = this.Option("--namedValues <namedValues>", "Named Values", CommandOptionType.SingleValue);
38-
this.apimNameValue = this.Option("--apimNameValue <apimNameValue>", "Apim Name Value", CommandOptionType.SingleValue);
39-
this.configFile = this.Option("--configFile <configFile>", "Config YAML file location", CommandOptionType.SingleValue).IsRequired();
40-
this.backendUrlConfigFile = this.Option("--backendurlconfigFile <backendurlconfigFile>", "backend url json file location", CommandOptionType.SingleValue);
41-
this.preferredAPIsForDeployment = this.Option("--preferredAPIsForDeployment <preferredAPIsForDeployment>", "create ARM templates for the given APIs Name(comma separated) else leave this parameter blank then by default all api's will be considered", CommandOptionType.SingleValue);
32+
Name = GlobalConstants.CreateName;
33+
Description = GlobalConstants.CreateDescription;
34+
35+
_appInsightsInstrumentationKey = Option("--appInsightsInstrumentationKey <appInsightsInstrumentationKey>", "AppInsights intrumentationkey", CommandOptionType.SingleValue);
36+
_appInsightsName = Option("--appInsightsName <appInsightsName>", "AppInsights Name", CommandOptionType.SingleValue);
37+
_namedValueKeys = Option("--namedValues <namedValues>", "Named Values", CommandOptionType.SingleValue);
38+
_apimNameValue = Option("--apimNameValue <apimNameValue>", "Apim Name Value", CommandOptionType.SingleValue);
39+
_configFile = Option("--configFile <configFile>", "Config YAML file location", CommandOptionType.SingleValue).IsRequired();
40+
_backendUrlConfigFile = Option("--backendurlconfigFile <backendurlconfigFile>", "backend url json file location", CommandOptionType.SingleValue);
41+
_preferredAPIsForDeployment = Option("--preferredAPIsForDeployment <preferredAPIsForDeployment>", "create ARM templates for the given APIs Name(comma separated) else leave this parameter blank then by default all api's will be considered", CommandOptionType.SingleValue);
4242
}
4343

4444
protected override async Task<int> ExecuteCommand()
@@ -50,35 +50,35 @@ protected override async Task<int> ExecuteCommand()
5050

5151
GlobalConstants.CommandStartDateTime = DateTime.Now.ToString("MMyyyydd hh mm ss");
5252

53-
CreatorConfig creatorConfig = await fileReader.ConvertConfigYAMLToCreatorConfigAsync(this.configFile.Value());
53+
CreatorConfig creatorConfig = await fileReader.ConvertConfigYAMLToCreatorConfigAsync(_configFile.Value());
5454

55-
if (this.apimNameValue != null && !string.IsNullOrEmpty(this.apimNameValue.Value()))
55+
if (_apimNameValue != null && !string.IsNullOrEmpty(_apimNameValue.Value()))
5656
{
57-
creatorConfig.apimServiceName = this.apimNameValue.Value();
57+
creatorConfig.apimServiceName = _apimNameValue.Value();
5858
}
5959

6060
AppInsightsUpdater appInsightsUpdater = new AppInsightsUpdater();
61-
appInsightsUpdater.UpdateAppInsightNameAndInstrumentationKey(creatorConfig, this.appInsightsInstrumentationKey, this.appInsightsName);
61+
appInsightsUpdater.UpdateAppInsightNameAndInstrumentationKey(creatorConfig, _appInsightsInstrumentationKey, _appInsightsName);
6262

6363
// Overwrite named values from build pipeline
6464
NamedValuesUpdater namedValuesUpdater = new NamedValuesUpdater();
65-
namedValuesUpdater.UpdateNamedValueInstances(creatorConfig, this.namedValueKeys);
65+
namedValuesUpdater.UpdateNamedValueInstances(creatorConfig, _namedValueKeys);
6666

6767
// validate creator config
6868
CreatorConfigurationValidator creatorConfigurationValidator = new CreatorConfigurationValidator(this);
6969

7070
//if preferredAPIsForDeployment passed as parameter
71-
if (this.preferredAPIsForDeployment != null && !string.IsNullOrEmpty(this.preferredAPIsForDeployment.Value()))
71+
if (_preferredAPIsForDeployment != null && !string.IsNullOrEmpty(_preferredAPIsForDeployment.Value()))
7272
{
7373
considerAllApiForDeployments = false;
74-
preferredApis = this.preferredAPIsForDeployment.Value().Split(",");
74+
preferredApis = _preferredAPIsForDeployment.Value().Split(",");
7575
}
7676

7777
//if backendurlfile passed as parameter
78-
if (this.backendUrlConfigFile != null && !string.IsNullOrEmpty(this.backendUrlConfigFile.Value()))
78+
if (_backendUrlConfigFile != null && !string.IsNullOrEmpty(_backendUrlConfigFile.Value()))
7979
{
8080
CreatorApiBackendUrlUpdater creatorApiBackendUrlUpdater = new CreatorApiBackendUrlUpdater();
81-
creatorConfig = creatorApiBackendUrlUpdater.UpdateBackendServiceUrl(this.backendUrlConfigFile.Value(), creatorConfig);
81+
creatorConfig = creatorApiBackendUrlUpdater.UpdateBackendServiceUrl(_backendUrlConfigFile.Value(), creatorConfig);
8282
}
8383

8484
bool isValidCreatorConfig = creatorConfigurationValidator.ValidateCreatorConfig(creatorConfig);
@@ -161,7 +161,7 @@ protected override async Task<int> ExecuteCommand()
161161
apiInformation.Add(new LinkedMasterTemplateAPIInformation()
162162
{
163163
name = api.name,
164-
isSplit = apiTemplateCreator.IsSplitAPI(api),
164+
isSplit = apiTemplateCreator.isSplitAPI(api),
165165
dependsOnGlobalServicePolicies = creatorConfig.policy != null,
166166
dependsOnVersionSets = api.apiVersionSetId != null,
167167
dependsOnVersion = masterTemplateCreator.GetDependsOnPreviousApiVersion(api, apiVersions),
@@ -194,7 +194,7 @@ protected override async Task<int> ExecuteCommand()
194194
APITemplateResource apiResource = apiTemplate.resources.FirstOrDefault(resource => resource.type == ResourceTypeConstants.API) as APITemplateResource;
195195
APIConfig providedAPIConfiguration = creatorConfig.apis.FirstOrDefault(api => string.Compare(apiResource.name, APITemplateCreator.MakeResourceName(api), true) == 0);
196196
// if the api version is not null the api is split into multiple templates. If the template is split and the content value has been set, then the template is for a subsequent api
197-
string apiFileName = FileNameGenerator.GenerateCreatorAPIFileName(providedAPIConfiguration.name, apiTemplateCreator.IsSplitAPI(providedAPIConfiguration), apiResource.properties.value != null);
197+
string apiFileName = FileNameGenerator.GenerateCreatorAPIFileName(providedAPIConfiguration.name, apiTemplateCreator.isSplitAPI(providedAPIConfiguration), apiResource.properties.value != null);
198198
FileWriter.WriteJSONToFile(apiTemplate, string.Concat(creatorConfig.outputLocation, apiFileName));
199199
}
200200
if (globalServicePolicyTemplate != null)

src/ArmTemplates/Commands/Applications/ExtractApplicationCommand.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,36 @@ namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Commands.Applica
1414
{
1515
public class ExtractApplicationCommand : CommandLineApplicationBase
1616
{
17-
ExtractorConfig extractorConfig;
17+
private ExtractorConfig _extractorConfig;
1818

1919
public ExtractApplicationCommand() : base()
2020
{
2121
}
2222

2323
protected override void SetupApplicationAndCommands()
2424
{
25-
this.Name = GlobalConstants.ExtractName;
26-
this.Description = GlobalConstants.ExtractDescription;
25+
Name = GlobalConstants.ExtractName;
26+
Description = GlobalConstants.ExtractDescription;
2727

28-
var extractorConfigFilePathOption = this.Option("--extractorConfig <extractorConfig>", "Config file of the extractor", CommandOptionType.SingleValue);
29-
this.AddExtractorConfigPropertiesToCommandLineOptions();
28+
var extractorConfigFilePathOption = Option("--extractorConfig <extractorConfig>", "Config file of the extractor", CommandOptionType.SingleValue);
29+
AddExtractorConfigPropertiesToCommandLineOptions();
3030

3131
if (extractorConfigFilePathOption.HasValue())
3232
{
3333
var fileReader = new FileReader();
34-
this.extractorConfig = fileReader.ConvertConfigJsonToExtractorConfig(extractorConfigFilePathOption.Value());
34+
_extractorConfig = fileReader.ConvertConfigJsonToExtractorConfig(extractorConfigFilePathOption.Value());
3535
}
3636

37-
this.UpdateExtractorConfigFromAdditionalArguments();
37+
UpdateExtractorConfigFromAdditionalArguments();
3838
}
3939

4040
protected override async Task<int> ExecuteCommand()
4141
{
4242
try
4343
{
44-
this.extractorConfig.Validate();
44+
_extractorConfig.Validate();
4545

46-
var extractorExecutor = new ExtractorExecutor(this.extractorConfig);
46+
var extractorExecutor = new ExtractorExecutor(_extractorConfig);
4747
await extractorExecutor.ExecuteGenerationBasedOnExtractorConfiguration();
4848

4949
Logger.LogInformation("Templates written to output location");
@@ -61,22 +61,22 @@ protected override async Task<int> ExecuteCommand()
6161
}
6262
}
6363

64-
void AddExtractorConfigPropertiesToCommandLineOptions()
64+
private void AddExtractorConfigPropertiesToCommandLineOptions()
6565
{
6666
foreach (var propertyInfo in typeof(ExtractorConfig).GetProperties())
6767
{
6868
var description = Attribute.IsDefined(propertyInfo, typeof(DescriptionAttribute)) ? (Attribute.GetCustomAttribute(propertyInfo, typeof(DescriptionAttribute)) as DescriptionAttribute).Description : string.Empty;
6969

70-
this.Option($"--{propertyInfo.Name} <{propertyInfo.Name}>", description, CommandOptionType.SingleValue);
70+
Option($"--{propertyInfo.Name} <{propertyInfo.Name}>", description, CommandOptionType.SingleValue);
7171
}
7272
}
7373

74-
void UpdateExtractorConfigFromAdditionalArguments()
74+
private void UpdateExtractorConfigFromAdditionalArguments()
7575
{
7676
var extractorConfigType = typeof(ExtractorConfig);
77-
foreach (var option in this.Options.Where(o => o.HasValue()))
77+
foreach (var option in Options.Where(o => o.HasValue()))
7878
{
79-
extractorConfigType.GetProperty(option.LongName)?.SetValue(this.extractorConfig, option.Value());
79+
extractorConfigType.GetProperty(option.LongName)?.SetValue(_extractorConfig, option.Value());
8080
}
8181
}
8282
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Commands.Executors
22
{
3-
class CreatorExecutor
3+
internal class CreatorExecutor
44
{
5-
// TODO refactor creatorApplicationCommand like ExtractorExecutor
6-
// Issue: https://github.com/Azure/azure-api-management-devops-resource-kit/issues/623
75
}
86
}

0 commit comments

Comments
 (0)