The document provides instructions and guidelines on how to board local context feature for parameters.
## Local context attribute
Local context attribute is an abstraction of the definition for local context. We use this class to define how the argument supports local context.
There are 3 properties of local context attribute.
- **name**
`name` is the argument name used in local context. Usually we just use the name which defined in the function signature, for example, `resource_group_name`.
- **scopes**
`scopes` is an array of strings. It defines where this local context value can be referenced. The value could be a command group or a command, for example, `['vm', 'network']`. If one argument can be referenced in all the commands, you can define it as `['all']`. `scopes` is meaningful only when `SET` is in actions.
- **actions**
`actions` is an array of [`LocalContextAction`](#Local context action). It defines whether set the command parameter value to local context or get value from local context. We can define both `GET` and `SET` action for one argument.
## Local context action
Local context action is defined as an enum type. The available values are `GET` and `SET`.
- **GET**
Used for retrieving value from local context.
- **SET**
Used for saving value to local context.
## Parameters which support `all` scope by default
We define local context attribute for some command parameters by default. Commands whose function signature has the same argument name will support local context by default.
As `resource_group_name` is defined in the signature, it will automatically support local context.
## Suggestions
- Only enable local context feature for resource dependency parameters.
- Do not define `GET` action for `name` parameter in `create` and `delete` command.
- Define `SET` action only in `create` command.
## Examples
In order to create a webapp, a user needs to prepare an appservice plan first. Previously the user needed to run below commands to complete this scenario:
The user has to input resource group name 3 times and plan name 2 times for this scenario. To reduce these duplicate type in, we need to enable local context feature for these parameters as below: