nvflare.fuel.hci.reg module

class CommandEntry(scope, name, desc, usage, handler, authz_func, visible, confirm, client_cmd)[source]

Bases: object

Contains information about a command. This is registered in Scope within CommandRegister.

Parameters:
  • scope – scope for this command

  • name – command name

  • desc – command description text

  • usage – string to show usage of the command

  • handler – function to call for executing the command

  • authz_func – authorization function to run to get a tuple of (valid, authz_ctx) in AuthzFilter

  • visible – whether the command is visible or not

  • confirm – whether the command needs confirmation to execute

full_command_name() str[source]
class CommandModule[source]

Bases: object

Base class containing CommandModuleSpec.

close()[source]
generate_module_spec(server_cmd_spec: CommandSpec)[source]
get_spec() CommandModuleSpec[source]
class CommandModuleSpec(name: str, cmd_specs: List[CommandSpec], conn_props: dict | None = None)[source]

Bases: object

Specification for a command module containing a list of commands in the form of CommandSpec.

Parameters:
  • name – becomes the scope name of the commands in cmd_specs when registered in CommandRegister

  • cmd_specs – list of CommandSpec objects with

  • conn_props – conn properties declared by the module

class CommandRegister(app_ctx)[source]

Bases: object

Object containing the commands in scopes once they have been registered.

ServerCommandRegister is derived from this class and calls the handler of the command through process_command and _do_command. This is also used to register commands for the admin client.

Parameters:

app_ctx – app context

add_command(scope_name, cmd_name, desc, usage, handler, authz_func, visible, confirm, client_cmd=None, map_client_cmd=False)[source]
finalize(add_cmd_func=None)[source]
get_command_entries(cmd_name: str)[source]
register_module(module: CommandModule, include_invisible=True)[source]
register_module_spec(module_spec: CommandModuleSpec, include_invisible=True)[source]
class CommandSpec(name: str, description: str, usage: str, handler_func, authz_func=None, visible=True, confirm=None, client_cmd=None, enabled=True, scope_name='')[source]

Bases: object

Specification of a command within a CommandModuleSpec to register into CommandRegister as a CommandEntry.

Parameters:
  • name – command name

  • description – command description text

  • usage – string to show usage of the command

  • handler_func – function to call for executing the command.

  • authz_func – called to preprocess the command by AuthzFilter.

  • visible – whether the command is visible or not

  • confirm – whether the command needs confirmation to execute

valid_confirms = ['none', 'yesno', 'auth']