Open gsa-hub opened 2 years ago
Well, setting the param like this seems to work:
[parameter(Mandatory = $false,Position = 1)]
[ArgumentCompleter(
{
param($Command, $Parameter, $WordToComplete, $CommandAst, $FakeBoundParams)
$possibleValues = [Google.Apis.Admin.Reports.reports_v1.ActivitiesResource+ListRequest+ApplicationNameEnum].GetEnumNames()
$possibleValues | Where-Object {$_ -like "$WordToComplete*"}
}
)]
[ValidateScript({[Google.Apis.Admin.Reports.reports_v1.ActivitiesResource+ListRequest+ApplicationNameEnum].GetEnumnames()})]
[String]
$ApplicationName = "Admin",
It looks like those 4 missing values are only there in the version of the library that's used in PSCore, the net45 library doesn't have them. I'd say you're fine to leave the help text as is, and update the parameter as above, and then if the library changes, it will still be supported without needing to manually add the new values to the parameter list.
I know someday @scrthq would like to drop support for anything below PS 5.1 which would take care of the library inconsistency, but that's a future thing.
This looks good to me. Just to be clear, you pulled from this list right? I see the REST API has more options but they're not in that list.
I did play around with the .Net just a bit:
So first, it looks like the 4 missing values from the API reference are supported by the library, ContextAwareAccess, Chrome, DataStudio, and Keep.
Second, since I figured out how to get all the possible values out of the enumeration, I think it might be possible use that to validate dynamically (either putting
[Google.Apis.Admin.Reports.reports_v1.ActivitiesResource+ListRequest+ApplicationNameEnum].GetEnumNames()
as theValidateSet
or usingValidateScript
. I might play with that a bit, but you're welcome to as well if you're still interested.