Enhance configuration data handling with new reference resolution functions, dummy secret support, and update module version to 1.1.0
This commit is contained in:
39
Private/Get-ConfigurationDataObjectPropertyValue.ps1
Normal file
39
Private/Get-ConfigurationDataObjectPropertyValue.ps1
Normal file
@@ -0,0 +1,39 @@
|
||||
function Get-ConfigurationDataObjectPropertyValue {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[AllowNull()]
|
||||
$Value,
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]
|
||||
$Property,
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]
|
||||
$Path = ""
|
||||
)
|
||||
|
||||
if([string]::IsNullOrWhiteSpace($Property)){
|
||||
throw "Configuration data reference property must not be empty."
|
||||
}
|
||||
|
||||
if($null -eq $Value){
|
||||
throw "Configuration data reference property [$Property] was requested from a null value at path [$Path]."
|
||||
}
|
||||
|
||||
if($Value -is [System.Collections.IDictionary]){
|
||||
if(-not $Value.Contains($Property)){
|
||||
throw "Configuration data reference property [$Property] was not found at path [$Path]."
|
||||
}
|
||||
|
||||
return $Value[$Property]
|
||||
}
|
||||
|
||||
$ObjectProperty = $Value.PSObject.Properties[$Property]
|
||||
if($null -eq $ObjectProperty){
|
||||
throw "Configuration data reference property [$Property] was not found at path [$Path]."
|
||||
}
|
||||
|
||||
return $ObjectProperty.Value
|
||||
}
|
||||
Reference in New Issue
Block a user