nvflare.fuel.hci.client.api module¶
- class AdminAPI(host=None, port=None, ca_cert: str = '', client_cert: str = '', client_key: str = '', upload_dir: str = '', download_dir: str = '', server_cn=None, cmd_modules: Optional[List] = None, overseer_agent: Optional[OverseerAgent] = None, auto_login: bool = False, user_name: Optional[str] = None, poc: bool = False, debug: bool = False)[source]¶
Bases:
AdminAPISpec
Underlying API to keep certs, keys and connection information and to execute admin commands through do_command.
- Parameters
host – cn provisioned for the server, with this fully qualified domain name resolving to the IP of the FL server. This may be set by the OverseerAgent.
port – port provisioned as admin_port for FL admin communication, by default provisioned as 8003, must be int if provided. This may be set by the OverseerAgent.
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.
server_cn – server cn (only used for validating server cn)
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.
overseer_agent – initialized OverseerAgent to obtain the primary service provider to set the host and port of the active server
auto_login – Whether to use stored credentials to automatically log in (required to be True with OverseerAgent to provide high availability)
user_name – Username to authenticate with FL server
poc – Whether to enable poc mode for using the proof of concept example without secure communication.
debug – Whether to print debug messages, which can help with diagnosing problems. False by default.
- 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)
- 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_poc(username: str, poc_key: str)[source]¶
Login using key for proof of concept example.
- Parameters
username – Username
poc_key – key used for proof of concept admin login
- Returns
A dict of login status and details