nvflare.fuel.hci.client.cli module¶
- class AdminClient(prompt: str = '> ', credential_type: CredentialType = CredentialType.PASSWORD, ca_cert=None, client_cert=None, client_key=None, upload_dir='', download_dir='', cmd_modules: List | None = None, service_finder: ServiceFinder | None = None, session_timeout_interval=900, debug: bool = False, username: str = '', handlers=None, cli_history_dir: str = '/home/docs/.nvflare', cli_history_size: int = 1000)[source]¶
Bases:
Cmd
,EventHandler
Admin command prompt for submitting admin commands to the server through the CLI.
- Parameters:
prompt – prompt to use for the command prompt
ca_cert – path to CA Cert file, by default provisioned rootCA.pem
client_cert – path to admin client Cert file, by default provisioned as client.crt
client_key – path to admin client Key file, by default provisioned as client.key
credential_type – what type of credential to use
cmd_modules – command modules to load and register
service_finder – used to obtain the primary service provider to set the host and port of the active server
debug – whether to print debug messages. False by default.
cli_history_size – the maximum number of commands to save in the cli history file. Defaults to 1000.
Instantiate a line-oriented interpreter framework.
The optional argument ‘completekey’ is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used.
- cmdloop(intro=None)[source]¶
Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument. Overriding what is in cmd.Cmd to handle exiting client on Ctrl+D (EOF).
- complete(text, state)[source]¶
Return the next possible completion for ‘text’.
If a command has not been entered, then complete against command list. Otherwise try to call complete_<command> to get list of completions.
- default(line)[source]¶
Called on an input line when the command prefix is not recognized.
If this method is not overridden, it prints an error message and returns.
- do_bye(arg)[source]¶
Exit from the client.
If the arg is not logout, in other words, the user is issuing the bye command to shut down the client, or it is called by inputting the EOF character, a message will display that the admin client is shutting down.
- emptyline()[source]¶
Called when an empty line is entered in response to the prompt.
If this method is not overridden, it repeats the last nonempty command entered.
- handle_event(event_type: str, ctx: EventContext)[source]¶