ps/Modules/Cole.PowerShell.Developer/Public/Assert-ValidAWSProfileName.ps1

45 lines
1.1 KiB
PowerShell
Raw Permalink Normal View History

2023-05-30 22:51:22 -07:00
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
}
}