Has anyone looked at extending https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/powershell.ps1 to provide helper functions to be able to limit a parameter to a set of choices, set parameter as required etc similar to whats available on the linux side of the house? I’m noticing my code for managing parameters is unnecessarily lengthily and could be abstracted out fairly easily.
Not dug into it but this is a good idea I think.
Need to strike a balance of course as anything in there is going to get added to every module.
Okay I can put together a couple functions and submit a pull request for comment
Thought about it myself, great if you can jump on it.
We already have the “failifempty” param validation, but validation that the param actually contains valid values would be a great addition.
Also (similar to parameterset in PowerShell) we should consider implementing some kind of logic to validate that (“if foo, then also bar is required. if baz then all is good”). If you catch my meaning. That could come later tho.