Functions/Public/Assert-RequiredObjectProperty.ps1
function Assert-RequiredObjectProperty { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [ValidateNotNull()] [Array] $requiredProperties, [Parameter(Mandatory = $true)] [ValidateNotNull()] [Object] $object ) foreach ($propertyNm in $requiredProperties) { $propertyValue = $object[$propertyNm] if ($null -eq $propertyValue -or "" -eq $propertyValue.ToString()) { Throw [System.Management.Automation.ValidationMetadataException] ` "Required object property '$propertyNm' has either a NULL or empty value" } } } class ValidateRequiredObjectPropertiesAttribute : System.Management.Automation.ValidateArgumentsAttribute { [Array] $RequiredProperties = @() ValidateRequiredObjectPropertiesAttribute([Array] $RequiredProperties) { $this.RequiredProperties = $RequiredProperties; } [void] Validate([object] $Arguments, [System.Management.Automation.EngineIntrinsics] $EngineIntrinsics) { Assert-ObjectProperty -requiredProperties $this.RequiredProperties -object $Arguments } } # SIG # Begin signature block # MIIaxgYJKoZIhvcNAQcCoIIatzCCGrMCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDvjbwasmipNLQT # JTA0gzs1Zd/YLWiTadqrgYFUvCMtg6CCCqMwggUwMIIEGKADAgECAhAECRgbX9W7 # ZnVTQ7VvlVAIMA0GCSqGSIb3DQEBCwUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQK # EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNV # BAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0xMzEwMjIxMjAwMDBa # Fw0yODEwMjIxMjAwMDBaMHIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2Vy # dCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xMTAvBgNVBAMTK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