Comments (4)
@MiYanni sounds good
from azure-powershell-common.
@number213 I also just checked. That function, Normalize-Location
, is only called in that single test you mentioned. I'd opt to just remove it if it is causing confusion.
Instead, you can do this for your test:
$location.ToLower() -replace '[^a-z0-9]'
Since Get-Location
is used for testing, if the service returns westus
when the test expects West US
, that should be flagged as a failure. We don't want to change it to hide potential issues. Basically, Get-Location
is unaware of what format, Name or DisplayName, is being used for the location.
However, I do agree that there could be an improvement here. Also, I didn't even know we had a location cmdlet until I just found this: http://www.sqlservercentral.com/blogs/bradleyschacht/2018/05/22/azure-powershell-list-data-center-locations/
from azure-powershell-common.
Basically, Get-Location is unaware of what format, Name or DisplayName, is being used for the location.
Is it possible for Get-Location to remember what format prefferedLocation is, do agnostic search and return location in the same format the user passed it? Something like
param([string]$providerNamespace, [string]$resourceType, [string]$preferredLocation)
$isDisplayName = $preferredLocation.IndexOf(" ") -ne -1;
# ...
$location = $resourceTypes.Locations | Where-Object { (Normalize-Location $_) -eq (Normalize-Location $preferredLocation) }
if ($location -eq $null)
{
# ...
}
elseif($isDisplayName)
{
return $location
}
else
{
return $location.ToLower() -replace '[^a-z0-9]'
}
That's my concert, Get-Location
doesn't work with Name
format
PS C:\Users\v-anevse> Get-Location "Microsoft.Network" "ExpressRouteCircuits" "centraluseuap"
East US
PS C:\Users\v-anevse> Get-Location "Microsoft.Network" "ExpressRouteCircuits" "Central US EUAP"
Central US EUAP
from azure-powershell-common.
@number213 I'd rather add a switch paramter to Get-Location
, such as -UseCanonical
, which you specify when you want the all lowercase, no spaces version of the location. So, using your example:
PS C:\Users\v-anevse> Get-Location "Microsoft.Network" "ExpressRouteCircuits" "centraluseuap" -UseCanonical
centraluseuap
PS C:\Users\v-anevse> Get-Location "Microsoft.Network" "ExpressRouteCircuits" "Central US EUAP"
Central US EUAP
That way, current implementations are not broken/changed. And, you can get the functionality you want (explicitly) out of it. How does that sound?
from azure-powershell-common.
Related Issues (11)
- AzureSubscriptionExtensions.GetId throws null reference exception HOT 2
- Remove devdiv pipeline from CI
- CONTRIBUTING.md is copy of azure-powershell
- Command fails when multiple sessions executing at the same time
- Import-Module PowerShellGet error: Cannot find a variable with the name 'AmsiContext' HOT 2
- AzureEnvironment.cs has reference to invalid domain name discover.azure.com
- This repo is missing important files
- Remove unused tools
- Some breaking change attributes with version doesn't show version info in message
- Fix CmdletOutputBreakingChangeAttribute not printing out the properties that are deprecating. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-powershell-common.