41 lines
1.8 KiB
PowerShell
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
|
|
} |