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
239 stars 79 forks source link

Pipe Output from Get-AWSService to Install-AWSToolsModule for ease of use #325

Closed ccharland closed 9 months ago

ccharland commented 1 year ago

Describe the feature

I want to pipe the output from Get-AWSService directly to Install-AWSToolsModule

As of version 4.1.350, this is the output:

PS C:\Program Files\PowerShell\Modules> Get-AWSService -Service EFS | Install-AWSToolsModule -Scope AllUsers
Exception: The Name parameter must contain only AWS.Tools modules.`

Converting the output from Get-AWSService is ugly but works.

PS C:\Program Files\PowerShell\Modules> Get-AWSService -Service EFS |Select-Object @{Name="Name";Expression={$_.ModuleName}} |Install-AWSToolsModule -Scope AllUsers

Confirm
Are you sure you want to perform this action?
Performing the operation "Install-AWSToolsModule" on target "AWS Tools version 4.1.350.0".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): a
Installing module AWS.Tools.ElasticFileSystem version 4.1.350.0
PS C:\Program Files\PowerShell\Modules>

Use Case

I discovered the Get-AWSService cmdlet when I reviewed this page

It's logical that you should be able to pipe the output of Get-AWSService to Install-AWSToolsModule or Install-Module, given the description on the page.

Proposed Solution

Change the output of Get-AWSService from a PsCustomObject to a named object type, such as used by other AWS PowerShell modules.

PS C:\Program Files\PowerShell\Modules> (Get-AWSService)[0].GetType()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     False    PSCustomObject                           System.Object

PS C:\Program Files\PowerShell\Modules> (Get-S3Bucket)[0].GetType()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     False    S3Bucket                                 System.Object

Other Information

No response

Acknowledgements

AWS Tools for PowerShell version used

ModuleType Version    PreRelease Name   
---------- -------    ---------- ----                
Binary     4.1.350               AWS.Tools.Common
Script     1.0.2.4               AWS.Tools.Installer    

PowerShell version used

Name                           Value
----                           -----
PSVersion                      7.3.4
PSEdition                      Core
GitCommitId                    7.3.4
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Operating System and version

Windows Server 2019 (AWS Workspace)

ashishdhingra commented 1 year ago

Needs review with the team.

afroz429 commented 9 months ago

Thanks for creating the feature request. The latest version of AWS.Tools.Installer module (1.0.2.5) supports installing tools modules by piping the output of Get-AWSService to Install-AWSToolsModule. e.g Get-AWSService -Service EFS | Install-AWSToolsModule

github-actions[bot] commented 9 months ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.