nvflare.fuel.hci.client.api module¶
- class AdminAPI(user_name: str, service_finder: ServiceFinder, ca_cert: str = '', client_cert: str = '', client_key: str = '', upload_dir: str = '', download_dir: str = '', cmd_modules: List | None = None, insecure: bool = False, debug: bool = False, session_timeout_interval=None, session_status_check_interval=None, auto_login_delay: int = 5, auto_login_max_tries: int = 15, event_handlers=None)[source]¶
Bases:
AdminAPISpec
API to keep certs, keys and connection information and to execute admin commands through do_command.
- Parameters:
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
upload_dir – File transfer upload directory. Folders uploaded to the server to be deployed must be here. Folder must already exist and be accessible.
download_dir – File transfer download directory. Can be same as upload_dir. Folder must already exist and be accessible.
cmd_modules – command modules to load and register. Note that FileTransferModule is initialized here with upload_dir and download_dir if cmd_modules is None.
service_finder – used to obtain the primary service provider to set the host and port of the active server
user_name – Username to authenticate with FL server
insecure – Whether to enable secure mode with secure communication.
debug – Whether to print debug messages, which can help with diagnosing problems. False by default.
session_timeout_interval – if specified, automatically close the session after inactive for this long, unit is second
session_status_check_interval – how often to check session status with server, unit is second
auto_login_max_tries – maximum number of tries to auto-login.
- check_command(command: str) CommandInfo [source]¶
Checks the specified command for processing info
- Parameters:
command – command to be checked
Returns: command processing info
- do_command(command)[source]¶
A convenient method to call commands using string.
- Parameters:
command (str) – command
- Returns:
Object containing status and details (or direct response from server, which originally was just time and data)
- fire_event(event_type: str, ctx: EventContext)[source]¶
- login(username: str)[source]¶
Login using certification files and retrieve server side commands.
- Parameters:
username – Username
- Returns:
A dict of status and details
- login_with_insecure(username: str, poc_key: str)[source]¶
Login using key without certificates (POC has been updated so this should not be used for POC anymore).
- Parameters:
username – Username
poc_key – key used for insecure admin login
- Returns:
A dict of login status and details