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

Commit 3296293

Browse files
committed
remove api version hardcode, use constants
1 parent 2e1ab83 commit 3296293

17 files changed

+26
-24
lines changed

src/APIM_ARMTemplate/apimtemplate/Common/Constants/GlobalConstants.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ internal static class GlobalConstants
1010
public const string CreateDescription = "Create an API Management instance from files";
1111
public const string ExtractName = "extract";
1212
public const string ExtractDescription = "Extract an existing API Management instance";
13+
1314
public const string APIVersion = "2018-06-01-preview";
15+
public const string LinkedAPIVersion = "2018-01-01";
1416

1517
public const string azAccessToken = "account get-access-token --query \"accessToken\" --output json";
1618
public const string azSubscriptionId = "account show --query id -o json";

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/APITemplateCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public async Task<APITemplateResource> CreateAPITemplateResourceAsync(APIConfig
9595
{
9696
name = $"[concat(parameters('ApimServiceName'), '/{api.name}')]",
9797
type = ResourceTypeConstants.API,
98-
apiVersion = "2018-06-01-preview",
98+
apiVersion = GlobalConstants.APIVersion,
9999
properties = new APITemplateProperties(),
100100
// if the template is not linked the depends on for the apiVersionSet needs to be inlined here
101101
dependsOn = new string[] { }

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/APIVersionSetTemplateCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public Template CreateAPIVersionSetTemplate(CreatorConfig creatorConfig)
3232
{
3333
name = $"[concat(parameters('ApimServiceName'), '/{versionSetId}')]",
3434
type = ResourceTypeConstants.APIVersionSet,
35-
apiVersion = "2018-06-01-preview",
35+
apiVersion = GlobalConstants.APIVersion,
3636
properties = new APIVersionSetProperties()
3737
{
3838
displayName = apiVersionSet.displayName,

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/AuthorizationServerTemplateCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public Template CreateAuthorizationServerTemplate(CreatorConfig creatorConfig)
3131
{
3232
name = $"[concat(parameters('ApimServiceName'), '/{authorizationServerTemplateProperties.displayName}')]",
3333
type = ResourceTypeConstants.AuthorizationServer,
34-
apiVersion = "2018-06-01-preview",
34+
apiVersion = GlobalConstants.APIVersion,
3535
properties = authorizationServerTemplateProperties,
3636
dependsOn = new string[] { }
3737
};

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/BackendTemplateCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public Template CreateBackendTemplate(CreatorConfig creatorConfig)
3131
{
3232
name = $"[concat(parameters('ApimServiceName'), '/{backendTemplatePropeties.title}')]",
3333
type = ResourceTypeConstants.Backend,
34-
apiVersion = "2018-06-01-preview",
34+
apiVersion = GlobalConstants.APIVersion,
3535
properties = backendTemplatePropeties,
3636
dependsOn = new string[] { }
3737
};

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/DiagnosticTemplateCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public DiagnosticTemplateResource CreateAPIDiagnosticTemplateResource(APIConfig
1111
{
1212
name = $"[concat(parameters('ApimServiceName'), '/{api.name}/{api.diagnostic.name}')]",
1313
type = ResourceTypeConstants.APIDiagnostic,
14-
apiVersion = "2018-06-01-preview",
14+
apiVersion = GlobalConstants.APIVersion,
1515
properties = new DiagnosticTemplateProperties()
1616
{
1717
alwaysLog = api.diagnostic.alwaysLog,

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/LoggerTemplateCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public Template CreateLoggerTemplate(CreatorConfig creatorConfig)
3131
{
3232
name = $"[concat(parameters('ApimServiceName'), '/{logger.name}')]",
3333
type = ResourceTypeConstants.Logger,
34-
apiVersion = "2018-06-01-preview",
34+
apiVersion = GlobalConstants.APIVersion,
3535
properties = new LoggerTemplateProperties()
3636
{
3737
loggerType = logger.loggerType,

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/MasterTemplateCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public MasterTemplateResource CreateLinkedMasterTemplateResource(string name, st
134134
{
135135
name = name,
136136
type = "Microsoft.Resources/deployments",
137-
apiVersion = "2018-01-01",
137+
apiVersion = GlobalConstants.LinkedAPIVersion,
138138
properties = new MasterTemplateProperties()
139139
{
140140
mode = "Incremental",

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/PolicyTemplateCreator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public PolicyTemplateResource CreateAPIPolicyTemplateResource(APIConfig api, str
2323
{
2424
name = $"[concat(parameters('ApimServiceName'), '/{api.name}/policy')]",
2525
type = ResourceTypeConstants.APIPolicy,
26-
apiVersion = "2018-06-01-preview",
26+
apiVersion = GlobalConstants.APIVersion,
2727
properties = new PolicyTemplateProperties()
2828
{
2929
contentFormat = isUrl ? "rawxml-link" : "rawxml",
@@ -43,7 +43,7 @@ public PolicyTemplateResource CreateOperationPolicyTemplateResource(KeyValuePair
4343
{
4444
name = $"[concat(parameters('ApimServiceName'), '/{apiName}/{policyPair.Key}/policy')]",
4545
type = ResourceTypeConstants.APIOperationPolicy,
46-
apiVersion = "2018-06-01-preview",
46+
apiVersion = GlobalConstants.APIVersion,
4747
properties = new PolicyTemplateProperties()
4848
{
4949
contentFormat = isUrl ? "rawxml-link" : "rawxml",

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/ProductAPITemplateCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public ProductAPITemplateResource CreateProductAPITemplateResource(string produc
1212
{
1313
name = $"[concat(parameters('ApimServiceName'), '/{productID}/{apiName}')]",
1414
type = ResourceTypeConstants.ProductAPI,
15-
apiVersion = "2018-06-01-preview",
15+
apiVersion = GlobalConstants.APIVersion,
1616
properties = new ProductAPITemplateProperties(),
1717
dependsOn = dependsOn
1818
};

0 commit comments

Comments
 (0)