ps/Modules/Alkami.PowerShell.Common/Public/Get-ValidatedRuntimeParameter.ps1

31 lines
918 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Get-ValidatedRuntimeParameter {
<#
.SYNOPSIS
Allows for validating runtime parameter to ensure consistency.
.PARAMETER Runtime
Appropriate values are core, dotnetcore, framework, legacy
.OUTPUTS
dotnetcore, framework, as appropriate
.NOTES
Used in Alkami.Installer.Service, Alkami.Installer.Migrations to validate the runtime value
Used in Get-PackageMetadataV2 to validate the runtime value
#>
[CmdletBinding()]
[OutputType([string])]
param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$Runtime
)
$logLead = Get-LogLeadName
switch ($Runtime) {
{ "framework","legacy" -eq $_ } { return "framework" }
{ "dotnetcore","core" -eq $_ } { return "dotnetcore" }
default { throw "$logLead : [$_] is not allowed as a valid runtime. Please consult with SRE for adding additional runtimes." }
}
}