aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 78 forks source link

Enable common parameters; Apply common parameters to function #127

Closed juneb closed 4 years ago

juneb commented 4 years ago

Description

Added CmdletBinding attribute to the script and the function. This is a best practice that makes the script and the function behave like PowerShell cmdlets. Among the many benefits, the script and function now support PowerShell common parameters.

Motivation and Context

Without these changes, users can't use the WarningAction parameter to suppress the warning in the function. This is really annoying because it appears even when the Import-Module command completely specifies an AWSPowerShell module variant.

Also, the warning is incomprehensible to most users (what is a "monolithic variant?"), so it's not helpful. I'll file a PR to fix the warning, but this is a good start.

Testing

Local test that used several common parameters and verified that they were effective in the function.

Screenshots (if appropriate)

Types of changes

Checklist

License

matteo-prosperi commented 4 years ago

Hi, thanks for your PR. I will look into this before our next release.

juneb commented 4 years ago

According to @austoonz , the WarningPreference preference variable will suppress this warning, but because we implemented it through ScriptsToProcess, the WarningAction common parameter cannot suppress the message. I'll cancel this PR and look for other ways to improve this experience.