From 77295c5288f7e43f3b76a737c8cd80cee5579a82 Mon Sep 17 00:00:00 2001 From: Daniel Kanev Date: Tue, 31 Oct 2023 15:34:40 +0000 Subject: [PATCH 1/3] Added region short name to the execution context --- src/Abstractions/ExecutionContext/BaseExecutionContext.cs | 7 +++++++ src/Abstractions/ExecutionContext/IExecutionContext.cs | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/Abstractions/ExecutionContext/BaseExecutionContext.cs b/src/Abstractions/ExecutionContext/BaseExecutionContext.cs index 1da02b8b..f6756acd 100644 --- a/src/Abstractions/ExecutionContext/BaseExecutionContext.cs +++ b/src/Abstractions/ExecutionContext/BaseExecutionContext.cs @@ -18,6 +18,9 @@ public class BaseExecutionContext : IExecutionContext // Defined by Azure https://whatazurewebsiteenvironmentvariablesareavailable.azurewebsites.net/ internal const string RegionNameVariableName = "REGION_NAME"; + // Set as an environment varialbe (e.g. through ARM template deployment) + internal const string RegionShortNameVariableName = "REGION_SHORT_NAME"; + // We define them internal const string ClusterNameVariableName = "CLUSTER_NAME"; internal const string SliceNameVariableName = "SLICE_NAME"; @@ -42,6 +45,7 @@ public BaseExecutionContext(IHostEnvironment? hostEnvironment = null) ClusterIpAddress = GetIpAddress(MachineName); RegionName = GetVariable(RegionNameVariableName) ?? DefaultEmptyValue; + RegionShortName = GetVariable(RegionShortNameVariableName) ?? DefaultEmptyValue; DeploymentSlice = GetVariable(SliceNameVariableName) ?? DefaultEmptyValue; if (hostEnvironment != null) @@ -103,6 +107,9 @@ public BaseExecutionContext(IHostEnvironment? hostEnvironment = null) /// public string RegionName { get; protected set; } + /// + public string RegionShortName { get; protected set; } + /// public string ServiceName { get; protected set; } diff --git a/src/Abstractions/ExecutionContext/IExecutionContext.cs b/src/Abstractions/ExecutionContext/IExecutionContext.cs index fc18b01d..16344af3 100644 --- a/src/Abstractions/ExecutionContext/IExecutionContext.cs +++ b/src/Abstractions/ExecutionContext/IExecutionContext.cs @@ -68,6 +68,11 @@ public interface IExecutionContext /// string RegionName { get; } + /// + /// The short Azure region name + /// + string RegionShortName { get; } + /// /// The service name /// From 6b284fd0ba4c770891d5215b9fa9ad9ef87a7454 Mon Sep 17 00:00:00 2001 From: Daniel Kanev Date: Tue, 31 Oct 2023 15:58:07 +0000 Subject: [PATCH 2/3] Addressed CR feedback --- src/Abstractions/ExecutionContext/BaseExecutionContext.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Abstractions/ExecutionContext/BaseExecutionContext.cs b/src/Abstractions/ExecutionContext/BaseExecutionContext.cs index f6756acd..9bb874ec 100644 --- a/src/Abstractions/ExecutionContext/BaseExecutionContext.cs +++ b/src/Abstractions/ExecutionContext/BaseExecutionContext.cs @@ -18,10 +18,8 @@ public class BaseExecutionContext : IExecutionContext // Defined by Azure https://whatazurewebsiteenvironmentvariablesareavailable.azurewebsites.net/ internal const string RegionNameVariableName = "REGION_NAME"; - // Set as an environment varialbe (e.g. through ARM template deployment) - internal const string RegionShortNameVariableName = "REGION_SHORT_NAME"; - // We define them + internal const string RegionShortNameVariableName = "REGION_SHORT_NAME"; internal const string ClusterNameVariableName = "CLUSTER_NAME"; internal const string SliceNameVariableName = "SLICE_NAME"; internal const string AspNetCoreEnviromentVariableName = "ASPNETCORE_ENVIRONMENT"; From 9ca02d591344d7062016b7c1bf2dbd759e099db0 Mon Sep 17 00:00:00 2001 From: Daniel Kanev Date: Tue, 31 Oct 2023 16:00:53 +0000 Subject: [PATCH 3/3] Addressed CR feedback --- src/Abstractions/ExecutionContext/BaseExecutionContext.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Abstractions/ExecutionContext/BaseExecutionContext.cs b/src/Abstractions/ExecutionContext/BaseExecutionContext.cs index 9bb874ec..2b568c4a 100644 --- a/src/Abstractions/ExecutionContext/BaseExecutionContext.cs +++ b/src/Abstractions/ExecutionContext/BaseExecutionContext.cs @@ -15,10 +15,8 @@ namespace Microsoft.Omex.Extensions.Abstractions.ExecutionContext /// public class BaseExecutionContext : IExecutionContext { - // Defined by Azure https://whatazurewebsiteenvironmentvariablesareavailable.azurewebsites.net/ + // Set as an environment variable (e.g. through ARM template deployment) internal const string RegionNameVariableName = "REGION_NAME"; - - // We define them internal const string RegionShortNameVariableName = "REGION_SHORT_NAME"; internal const string ClusterNameVariableName = "CLUSTER_NAME"; internal const string SliceNameVariableName = "SLICE_NAME";