Enhance configuration data validation and add new utility functions
- Added validation for empty values in Assert-ConfigurationDataParameter. - Introduced Assert-ConfigurationDataSecretReference for secret reference validation. - Implemented Test-ConfigurationDataExpressionParentheses to validate expression syntax. - Added Test-ConfigurationDataMissingReferenceError to check for missing parameter or variable definitions. - Updated Invoke-ConfigurationDataExpression to handle new validation logic. - Revised Readme.md to reflect changes in secret reference handling.
This commit is contained in:
@@ -48,11 +48,15 @@ function Assert-ConfigurationDataParameterType {
|
||||
if(($Value -isnot [string]) -and ($Value -isnot [System.Security.SecureString]) -and (-not (Test-ConfigurationDataMap -Value $Value))){
|
||||
throw "Parameter [$Name] expects type [secureString], but received [$($Value.GetType().Name)]."
|
||||
}
|
||||
|
||||
Assert-ConfigurationDataSecretReference -Name $Name -TypeName "securestring" -Value $Value
|
||||
}
|
||||
"credential" {
|
||||
if(($Value -isnot [System.Management.Automation.PSCredential]) -and (-not (Test-ConfigurationDataMap -Value $Value))){
|
||||
throw "Parameter [$Name] expects type [credential], but received [$($Value.GetType().Name)]."
|
||||
}
|
||||
|
||||
Assert-ConfigurationDataSecretReference -Name $Name -TypeName "credential" -Value $Value
|
||||
}
|
||||
default {
|
||||
throw "Parameter [$Name] uses unsupported type [$TypeName]."
|
||||
|
||||
Reference in New Issue
Block a user