ps/Modules/Cole.PowerShell.Developer/Public/Get-AwsStandardDynamicParameters.ps1
2023-05-30 22:51:22 -07:00

41 lines
1.8 KiB
PowerShell

function Get-AwsStandardDynamicParameters {
[Cmdletbinding()]
param(
[Parameter(Mandatory=$false)]
[string]$RegionParameterName = "Region",
[Parameter(Mandatory=$false)]
[switch]$RegionParameterRequired,
[Parameter(Mandatory=$false)]
[string]$RegionParameterSetName = "__AllParameterSets",
[Parameter(Mandatory=$false)]
[string]$ProfileParameterName = "Profile",
[Parameter(Mandatory=$false)]
[switch]$ProfileParameterRequired,
[Parameter(Mandatory=$false)]
[string]$ProfileParameterSetName = "__AllParameterSets"
)
$runtimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$regionRuntimeParameter = Get-DynamicAwsRegionParameter -GeneratedParameterName $RegionParameterName `
-ParameterSetName $RegionParameterSetName `
-IsMandatoryParameter:$RegionParameterRequired
$profileRuntimeParameter = Get-DynamicAwsProfilesParameter -GeneratedParameterName $ProfileParameterName `
-ParameterSetName $ProfileParameterSetName `
-IsMandatoryParameter:$ProfileParameterRequired
# The Dynamic params functions return dictionaries so they can be used independently if needed
# We will add both returned values to a new Dictionary and return it for use by the calling function
$runtimeParameterDictionary.Add($RegionParameterName, $($regionRuntimeParameter.Values[0]))
$runtimeParameterDictionary.Add($ProfileParameterName, $($profileRuntimeParameter.Values[0]))
return $runtimeParameterDictionary
}