Closed juneb closed 3 years ago
Which version of AWS.Tools and Powershell are you using? AWS.Tools 4.0.4.0 works as expected:
-KeyId's param is not in the brackets
...> gcm -sy Get-KMSResourceTag
Get-KMSResourceTag [-KeyId] <string> [-Limit <int>] [-Marker <string>] [-Select <string>] [-PassThru] [-NoAutoIteration] [-EndpointUrl <string>] [-Region <Object>] [-AccessKey <string>] [-SecretKey <string>] [-SessionToken <string>] [-ProfileName <string>] [-ProfileLocation <string>] [-Credential <AWSCredentials>] [-NetworkCredential <pscredential>]
```[<CommonParameters>]
I'm using AWSPowerShell.NetCore version 4.0.4.0.
PS C:\ps-test> gcm Get-KMSGrantList -sy
Get-KMSGrantList [[-KeyId] <string>] [-Limit <int>] [-Marker <string>] [-Select <string>] [-PassThru] [-NoAutoIteration] [-EndpointUrl <string>] [-Region <Object>] [-AccessKey <string>] [-SecretKey <string>] [-SessionToken <string>] [-ProfileName <string>] [-ProfileLocation <string>] [-Credential <AWSCredentials>] [-NetworkCredential <pscredential>] [<CommonParameters>]
PS C:\ps-test> gmo -Name *AWS*
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 4.0.4.0 AWSPowerShell.NetCore {Add-AASScalableTarget, Add-ACMCertificateTag, Ad…
@juneb @klaytaybai
It definitely reproduces, at least on .NetCore. I'm looking into what's going on.
Get-Help
for version 4+ or AWSPowerShell, AWSPowerShell.NetCore and AWS.Tools reports parameters that are declared as required by the AWS Services. This shows up as [-KeyId] <string>
instead of [[-KeyId] <string>]
in the syntax view as well as in the table for the parameter when using Get-Help /Full
.
Get-Command -Syntax
instead shows whether the cmdlet is actually enforced as required by the module. Only AWS.Tools enforces required parameters as described in https://github.com/aws/aws-tools-for-powershell/issues/67. So the parameter will show up as [[-KeyId] <string>]
for AWSPowerShell and AWSPowerShell.NetCore. But will show up as [-KeyId] <string>
for AWS.Tools.
This behavior is as expected.
Thanks for explaining, Matteo, but the values that the command displays are false and it's a poor experience for our customers. We should fix it.
BTW, I tend to use Get-Command for a quick syntax, because Get-Help for this module takes so long to display.
PS C:\ps-test> Measure-Command {Get-Help New-KMSKey -full}
Days : 0
Hours : 0
Minutes : 0
Seconds : 48
Milliseconds : 608
Ticks : 486080040
TotalDays : 0.000562592638888889
TotalHours : 0.0135022233333333
TotalMinutes : 0.8101334
TotalSeconds : 48.608004
TotalMilliseconds : 48608.004
Hi @juneb,
Good afternoon.
I was going through issue backlog and came across this one. As per input from @matteo-prosperi, the behavior is as expected. Please advise if we could close this issue.
Thanks, Ashish
This issue has not recieved a response in 2 weeks. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.
In Get-Help and Get-Command (-full, -syntax), the syntax diagram for AWSPowerShell functions shows all parameters as optional, even when they are mandatory. This is a poor customer experience.
Expected Behavior
If a function has mandatory parameters, they should not be enclosed is square brackets in the syntax diagram.
If you're describing a bug, tell us what should happen. If you're suggesting a change/improvement, tell us how it should work.
Current Behavior
For example: PS C:\ps-test> gcm -sy Get-KMSResourceTag
Get-KMSResourceTag [[-KeyId]] [-Limit ] [-Marker ] [-Select ] [-PassThru] [-NoAutoIteration] [-EndpointUrl ] [-Region
This diagram shows that the KeyId parameter is optional and positional. Instead, it is mandatory and positional.
PS C:> Get-KMSResourceTag Get-KMSResourceTag: 1 validation error detected: Value null at 'keyId' failed to satisfy constraint: Member must not be null
If describing a bug, tell us what happens instead of the expected behavior. Include full errors, uncaught exceptions, stack traces, and relevant logs. If service responses are relevant, please include Fiddler-captured wirelogs. If suggesting a change/improvement, explain the difference from current behavior.
Possible Solution
Not required, but suggest a fix/reason for the bug, or ideas how to implement the addition or change.
Steps to Reproduce (for bugs)
Provide a self-contained, concise snippet of code that can be inserted into a PowerShell session to replicate the bug. Including business logic or unrelated code makes diagnosis more difficult.
Context
How has this issue affected you? What are you trying to accomplish? Providing context helps us come up with a solution that is most useful in the real world.
Your Environment
Include as many relevant details about the environment where the bug was discovered.
Get-AWSPowerShellVersion
:$PSVersionTable.OS
:$PSVersionTable.PSEdition
: