45 lines
1.1 KiB
PowerShell
45 lines
1.1 KiB
PowerShell
function Assert-ValidAWSProfileName {
|
|
<#
|
|
.SYNOPSIS
|
|
Used to verify that the provided name matches one of the expected AWS Profile Names commonly in use
|
|
#>
|
|
[CmdletBinding()]
|
|
[OutputType([void])]
|
|
param (
|
|
[Parameter(Mandatory = $true)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[string]$ProfileName,
|
|
[switch]$ArgumentValidationScript
|
|
)
|
|
|
|
$logLead = (Get-LogLeadName)
|
|
|
|
$ExpectedProfileNames = @(
|
|
'temp-mp',
|
|
'temp-prod',
|
|
'temp-sandbox',
|
|
'temp-dev',
|
|
'temp-qa',
|
|
'temp-corp',
|
|
'temp-transit',
|
|
'temp-transitnp',
|
|
'temp-security',
|
|
'MP',
|
|
'Prod',
|
|
'Sandbox',
|
|
'Dev',
|
|
'Qa',
|
|
'Corp',
|
|
'Transit',
|
|
'TransitNP',
|
|
'Security'
|
|
)
|
|
|
|
if ($ExpectedProfileNames -notcontains $ProfileName) {
|
|
throw "$logLead : Profile name [$ProfileName] doesn't match one of the expected options. Did you mean one of [$($ExpectedProfileNames -join ',')]?"
|
|
}
|
|
|
|
if ($ArgumentValidationScript) {
|
|
return $true
|
|
}
|
|
} |