Skip to content

Commit 1a5105d

Browse files
authored
Merge pull request Azure#2832 from TianoMS/tiano-d2
Include environment name in the key of Api-Version cache.
2 parents 14d43b9 + e2b385d commit 1a5105d

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/ApiVersionHelper.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal static Task<string> DetermineApiVersion(AzureContext context, string re
5959
/// <param name="pre">When specified, indicates if pre-release API versions should be considered.</param>
6060
internal static Task<string> DetermineApiVersion(AzureContext context, string providerNamespace, string resourceType, CancellationToken cancellationToken, bool? pre = null, Dictionary<string, string> cmdletHeaderValues = null)
6161
{
62-
var cacheKey = ApiVersionCache.GetCacheKey(providerNamespace: providerNamespace, resourceType: resourceType);
62+
var cacheKey = ApiVersionCache.GetCacheKey(context.Environment.Name, providerNamespace: providerNamespace, resourceType: resourceType);
6363
var apiVersions = ApiVersionCache.Instance
6464
.AddOrGetExisting(cacheKey: cacheKey, getFreshData: () => ApiVersionHelper.GetApiVersionsForResourceType(
6565
context,
@@ -206,11 +206,12 @@ private void SetCacheItem(string cacheKey, string[] data, DateTimeOffset absolut
206206
/// <summary>
207207
/// Gets the cache key.
208208
/// </summary>
209+
/// <param name="environmentName">The environment name.</param>
209210
/// <param name="providerNamespace">The provider namespace.</param>
210211
/// <param name="resourceType">The resource type.</param>
211-
internal static string GetCacheKey(string providerNamespace, string resourceType)
212+
internal static string GetCacheKey(string environmentName, string providerNamespace, string resourceType)
212213
{
213-
return string.Format("{0}/{1}", providerNamespace.CoalesceString(), resourceType.CoalesceString()).ToUpperInvariant();
214+
return string.Format("{0}/{1}/{2}", environmentName.CoalesceEnumerable(), providerNamespace.CoalesceString(), resourceType.CoalesceString()).ToUpperInvariant();
214215
}
215216
}
216217
}

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Locations/GetAzureLocationCmdlet.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public class GetAzureLocationCmdlet: ResourceManagerCmdletBase
3434
/// </summary>
3535
public override void ExecuteCmdlet()
3636
{
37-
WriteWarning("The output object type of this cmdlet will be modified in a future release.");
38-
3937
var allLocations = this.SubscriptionSdkClient.ListLocations(DefaultContext.Subscription.Id.ToString());
4038
var providers = this.ResourceManagerSdkClient.ListResourceProviders(providerName: null, listAvailable: true);
4139
var providerLocations = ConstructResourceProviderLocations(allLocations, providers);

0 commit comments

Comments
 (0)