@@ -15,30 +15,30 @@ namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Commands.Applica
15
15
{
16
16
public class CreateApplicationCommand : CommandLineApplicationBase
17
17
{
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 ;
25
25
26
26
public CreateApplicationCommand ( ) : base ( )
27
27
{
28
28
}
29
29
30
30
protected override void SetupApplicationAndCommands ( )
31
31
{
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 ) ;
42
42
}
43
43
44
44
protected override async Task < int > ExecuteCommand ( )
@@ -50,35 +50,35 @@ protected override async Task<int> ExecuteCommand()
50
50
51
51
GlobalConstants . CommandStartDateTime = DateTime . Now . ToString ( "MMyyyydd hh mm ss" ) ;
52
52
53
- CreatorConfig creatorConfig = await fileReader . ConvertConfigYAMLToCreatorConfigAsync ( this . configFile . Value ( ) ) ;
53
+ CreatorConfig creatorConfig = await fileReader . ConvertConfigYAMLToCreatorConfigAsync ( _configFile . Value ( ) ) ;
54
54
55
- if ( this . apimNameValue != null && ! string . IsNullOrEmpty ( this . apimNameValue . Value ( ) ) )
55
+ if ( _apimNameValue != null && ! string . IsNullOrEmpty ( _apimNameValue . Value ( ) ) )
56
56
{
57
- creatorConfig . apimServiceName = this . apimNameValue . Value ( ) ;
57
+ creatorConfig . apimServiceName = _apimNameValue . Value ( ) ;
58
58
}
59
59
60
60
AppInsightsUpdater appInsightsUpdater = new AppInsightsUpdater ( ) ;
61
- appInsightsUpdater . UpdateAppInsightNameAndInstrumentationKey ( creatorConfig , this . appInsightsInstrumentationKey , this . appInsightsName ) ;
61
+ appInsightsUpdater . UpdateAppInsightNameAndInstrumentationKey ( creatorConfig , _appInsightsInstrumentationKey , _appInsightsName ) ;
62
62
63
63
// Overwrite named values from build pipeline
64
64
NamedValuesUpdater namedValuesUpdater = new NamedValuesUpdater ( ) ;
65
- namedValuesUpdater . UpdateNamedValueInstances ( creatorConfig , this . namedValueKeys ) ;
65
+ namedValuesUpdater . UpdateNamedValueInstances ( creatorConfig , _namedValueKeys ) ;
66
66
67
67
// validate creator config
68
68
CreatorConfigurationValidator creatorConfigurationValidator = new CreatorConfigurationValidator ( this ) ;
69
69
70
70
//if preferredAPIsForDeployment passed as parameter
71
- if ( this . preferredAPIsForDeployment != null && ! string . IsNullOrEmpty ( this . preferredAPIsForDeployment . Value ( ) ) )
71
+ if ( _preferredAPIsForDeployment != null && ! string . IsNullOrEmpty ( _preferredAPIsForDeployment . Value ( ) ) )
72
72
{
73
73
considerAllApiForDeployments = false ;
74
- preferredApis = this . preferredAPIsForDeployment . Value ( ) . Split ( "," ) ;
74
+ preferredApis = _preferredAPIsForDeployment . Value ( ) . Split ( "," ) ;
75
75
}
76
76
77
77
//if backendurlfile passed as parameter
78
- if ( this . backendUrlConfigFile != null && ! string . IsNullOrEmpty ( this . backendUrlConfigFile . Value ( ) ) )
78
+ if ( _backendUrlConfigFile != null && ! string . IsNullOrEmpty ( _backendUrlConfigFile . Value ( ) ) )
79
79
{
80
80
CreatorApiBackendUrlUpdater creatorApiBackendUrlUpdater = new CreatorApiBackendUrlUpdater ( ) ;
81
- creatorConfig = creatorApiBackendUrlUpdater . UpdateBackendServiceUrl ( this . backendUrlConfigFile . Value ( ) , creatorConfig ) ;
81
+ creatorConfig = creatorApiBackendUrlUpdater . UpdateBackendServiceUrl ( _backendUrlConfigFile . Value ( ) , creatorConfig ) ;
82
82
}
83
83
84
84
bool isValidCreatorConfig = creatorConfigurationValidator . ValidateCreatorConfig ( creatorConfig ) ;
@@ -161,7 +161,7 @@ protected override async Task<int> ExecuteCommand()
161
161
apiInformation . Add ( new LinkedMasterTemplateAPIInformation ( )
162
162
{
163
163
name = api . name ,
164
- isSplit = apiTemplateCreator . IsSplitAPI ( api ) ,
164
+ isSplit = apiTemplateCreator . isSplitAPI ( api ) ,
165
165
dependsOnGlobalServicePolicies = creatorConfig . policy != null ,
166
166
dependsOnVersionSets = api . apiVersionSetId != null ,
167
167
dependsOnVersion = masterTemplateCreator . GetDependsOnPreviousApiVersion ( api , apiVersions ) ,
@@ -194,7 +194,7 @@ protected override async Task<int> ExecuteCommand()
194
194
APITemplateResource apiResource = apiTemplate . resources . FirstOrDefault ( resource => resource . type == ResourceTypeConstants . API ) as APITemplateResource ;
195
195
APIConfig providedAPIConfiguration = creatorConfig . apis . FirstOrDefault ( api => string . Compare ( apiResource . name , APITemplateCreator . MakeResourceName ( api ) , true ) == 0 ) ;
196
196
// 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 ) ;
198
198
FileWriter . WriteJSONToFile ( apiTemplate , string . Concat ( creatorConfig . outputLocation , apiFileName ) ) ;
199
199
}
200
200
if ( globalServicePolicyTemplate != null )
0 commit comments