azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Get-AzNetappFilesPool Parameter sets (AccountObject and Name)

Open KlutzyBubbles opened this issue 1 year ago • 5 comments

Description

Why can the Name parameter not be used with AccountObject parameter?

I understand the solution currently would be to separate ResourceGroupName and AccountName from the account object

or pipe into Where-Object and check for name.

but seeing as in the code it already separates the required information it would just be easier to allow name to work for both inputs, unless i'm missing something obvious

This can also be asked with Get-AzNetAppFilesVolume

Script or Debug output

No response

Environment data

No response

Module versions

Az.NetAppFiles Version 0.10.0

Error output

No response

KlutzyBubbles avatar Sep 12 '22 06:09 KlutzyBubbles

@KlutzyBubbles , if parameter set -AccountObject supports -Name, information seems duplicated. If you can provide/construct AccountObject, could you explain why you still need -Name?

dingmeng-xue avatar Sep 12 '22 08:09 dingmeng-xue

@dingmeng-xue

I dont construct the AccountObject so was just wondering why the command doesnt deconstruct it to use with name instead of requiring me to deconstruct it and input it when the deconstruction already happens in the command

That is the best i can explain it, if it still doesnt make sense then there is no point continuing further

KlutzyBubbles avatar Sep 12 '22 08:09 KlutzyBubbles

If my understanding is correct, the parameter sets are for different purposes but results should be the same. If AccountObject is available such as fetched by Get-AzNetAppFilesAccount, user can use that object directly rather than deconstructing it to account name and rg name. But if user know its account name and resource group name, user can use Get-AzNetappFilesPool -ResourceGroupName <> -AccountName <> directly to get the list of file pools in that account.

The deconstruction should not happen in latter case. It's the convention of Azure PowerShell module. If implementation is different or contains redundant calls, we should look into it.

dingmeng-xue avatar Sep 12 '22 09:09 dingmeng-xue

If my understanding is correct, the parameter sets are for different purposes but results should be the same. If AccountObject is available such as fetched by Get-AzNetAppFilesAccount, user can use that object directly rather than deconstructing it to account name and rg name. But if user know its account name and resource group name, user can use Get-AzNetappFilesPool -ResourceGroupName <> -AccountName <> directly to get the list of file pools in that account.

The deconstruction should not happen in latter case. It's the convention of Azure PowerShell module. If implementation is different or contains redundant calls, we should look into it.

I re read my question and realised i forgot quite an important detail, i am only trying to get one pool in an account not all of them, which can be done by deconstructing the AccountObject and using name but not with inputting the object directly.

KlutzyBubbles avatar Sep 12 '22 10:09 KlutzyBubbles

I got your point. There is no rule to cmdlet design for that case. But it's true it will be convenient if it supports optional parameter name.

dingmeng-xue avatar Sep 12 '22 13:09 dingmeng-xue