ps/Modules/Alkami.PowerShell.ServiceFabric/Public/Format-AlkamiEnvironmentName.ps1
2023-05-30 22:51:22 -07:00

30 lines
906 B
PowerShell

function Format-AlkamiEnvironmentName {
<#
.SYNOPSIS
Returns the unique name of the environment with redundant pod/host information stripped out.
.PARAMETER name
The full name of the environment.
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[Alias("n")]
[string]$name
)
# Get rid of redundant words.
$wordsToRemove = @("aws","armor","pod","production","prod","staging","stage","lane","qa","sandbox","team","development","develop","dev","regression","integration");
foreach($word in $wordsToRemove) {
$name = ($name -replace "\b$word\b","");
}
# Replace dots with dashes, because ApplicationTypeName's don't like dashes.
$name = $name.Replace(".","_");
# Get rid of excess whitespace on the edges, and any spaces in the middle.
$name = $name.Trim();
$name = $name.Replace(" ","");
return $name;
}