-
Notifications
You must be signed in to change notification settings - Fork 52
Standard commands
Standard commands can be specified entirely by their swagger definition. The swagger definition can be used to generate the python function. It is sufficient to add just a mapping for the command syntax for a standard command.
For more information about the differences between standard and custom commands, see the related documentation.
All standard commands are located in the src/sfctl/commands.py
file.
Tests for custom commands are in their corresponding file under
src/sfctl/tests
.
To define a new standard command, add an additional command
under the
command group corresponding to your command. For example, here is the mapping
for sfctl cluster health
. Mappings are inside the commands.py
file:
with CommandSuperGroup(__name__, self, client_func_path,
client_factory=client_create) as super_group:
with super_group.group('cluster') as group:
group.command('health', 'get_cluster_health')
Here, the Python SDK client contains a function called get_cluster_health
that gets mapped to the CLI syntax sfctl cluster health
.
Once the command has a mapping in commands.py
, be sure to include tests for the command. If adding new tests, the tests should be added as functions that include the
phrase test
at the start of the function name.
All of the unit tests are under the src/sfctl/tests
folder.
- Development
- How-To
- Details
- Service Fabric Developers