Skip to content

Commit 437557d

Browse files
author
Maddie Clayton
authored
Update azure-powershell-design-guidelines.md
1 parent b52f64d commit 437557d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

documentation/development-docs/azure-powershell-design-guidelines.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
- [ResourceId](#resourceid)
4141
- [InputObject](#inputobject)
4242
- [AsJob Parameter](#asjob-parameter)
43+
- [Argument Completers](#argument-completers)
4344

4445
## Expected Patterns for Standard Cmdlets
4546

@@ -291,6 +292,22 @@ using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
291292
public string ResourceGroupName { get; set; }
292293
```
293294

295+
### Resource Name Completer
296+
297+
For any parameter that takes a resource name, the `ResourceNameCompleter` should be applied as an attribute. This will allow the user to tab through all resource names for the ResourceType in the current subscription. This completer will filter based upon the current parent resources provided (for instance, if ResourceGroupName is provided, only the resources in that particular resource group will be returned). For this completer, please provide the ResourceType as the first argument, followed by the parameter name for all parent resources starting at the top level.
298+
299+
```cs
300+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
301+
...
302+
[Parameter(Mandatory = false, HelpMessage = "The parent server name")]
303+
[ResourceNameCompleter("Microsoft.Sql/servers", nameof(ResourceGroupName))]
304+
public string ServerName { get; set; }
305+
306+
[Parameter(Mandatory = false, HelpMessage = "The database name")]
307+
[ResourceNameCompleter("Microsoft.Sql/servers/databases", nameof(ResourceGroupName), nameof(ServerName))]
308+
public string Name { get; set; }
309+
```
310+
294311
### Location Completer
295312

296313
For any parameter that takes a location, the `LocationCompleter` should be applied as an attribute. In order to use the `LocationCompleter`, you must input as an argument all of the Providers/ResourceTypes used by the cmdlet. The user will then be able to tab through locations that are valid for all of the Providers/ResourceTypes specified.

0 commit comments

Comments
 (0)