nvflare.fuel.hci.client.api_spec module

class AdminAPISpec[source]

Bases: ABC

abstract check_command(command: str) CommandInfo[source]

Checks the specified command for processing info. The command could be a client command or a server command.

Parameters:

command – command to be checked

Returns: command processing info

abstract do_command(command: str)[source]

Executes a command. The command could be a client command or a server command.

Parameters:

command – The command to be executed.

abstract is_ready() bool[source]

Whether the API is ready for executing commands.

abstract server_execute(command: str, reply_processor=None, cmd_ctx=None)[source]

Executes a command on server side.

Parameters:
  • command – The command to be executed.

  • reply_processor – processor to process reply from server

  • cmd_ctx – command context

class AdminConfigKey[source]

Bases: object

ADMIN = 'admin'
AUTHENTICATE_MSG_TIMEOUT = 'authenticate_msg_timeout'
CA_CERT = 'ca_cert'
CLIENT_CERT = 'client_cert'
CLIENT_KEY = 'client_key'
CLI_HISTORY_SIZE = 'cli_history_size'
CONNECTION_SCHEME = 'scheme'
CONNECTION_SECURITY = 'connection_security'
DOWNLOAD_DIR = 'download_dir'
FILE_DOWNLOAD_PROGRESS_TIMEOUT = 'file_download_progress_timeout'
HOST = 'host'
IDENTITY = 'identity'
IDLE_TIMEOUT = 'idle_timeout'
LOGIN_TIMEOUT = 'login_timeout'
PORT = 'port'
PROJECT_NAME = 'project_name'
PROMPT = 'prompt'
SERVER_IDENTITY = 'server_identity'
UID_SOURCE = 'uid_source'
UPLOAD_DIR = 'upload_dir'
USERNAME = 'username'
WITH_DEBUG = 'with_debug'
WITH_FILE_TRANSFER = 'with_file_transfer'
class ApiPocValue[source]

Bases: object

ADMIN = 'admin'
class CommandContext[source]

Bases: SimpleContext

A simple context containing a props dictionary of key value pairs and convenience methods.

get_api()[source]
get_command()[source]
get_command_args()[source]
get_command_entry()[source]
get_command_headers()[source]
get_command_name()[source]
get_command_props()[source]
get_command_result()[source]
get_custom_props()[source]
get_json_processor()[source]
get_meta()[source]
get_reply_processor()[source]
get_requester()[source]
set_api(api)[source]
set_command(command)[source]
set_command_args(cmd_args)[source]
set_command_entry(entry)[source]
set_command_headers(value)[source]
set_command_props(value)[source]
set_command_result(result)[source]
set_custom_props(value)[source]
set_json_processor(processor)[source]
set_meta(meta)[source]
set_reply_processor(processor)[source]
set_requester(r)[source]
class CommandCtxKey[source]

Bases: object

API = 'api'
CMD = 'cmd'
CMD_ARGS = 'cmd_args'
CMD_ENTRY = 'cmd_entry'
CMD_HEADERS = 'cmd_headers'
CMD_PROPS = 'cmd_props'
CUSTOM_PROPS = 'custom_props'
JSON_PROCESSOR = 'json_processor'
META = 'meta'
REPLY_PROCESSOR = 'reply_processor'
REQUESTER = 'requester'
RESULT = 'result'
class CommandInfo(value)[source]

Bases: Enum

An enumeration.

AMBIGUOUS = 2
CONFIRM_AUTH = 4
CONFIRM_USER_NAME = 5
CONFIRM_YN = 3
OK = 0
UNKNOWN = 1
class HCIRequester[source]

Bases: ABC

abstract send_request(api, conn, cmd_ctx)[source]
class ReplyProcessor[source]

Bases: object

A base class for parsing server’s response.

process_bytes(ctx: CommandContext)[source]
process_dict(ctx: CommandContext, data: dict)[source]
process_error(ctx: CommandContext, err: str)[source]
process_shutdown(ctx: CommandContext, msg: str)[source]
process_string(ctx: CommandContext, item: str)[source]
process_success(ctx: CommandContext, item: str)[source]
process_table(ctx: CommandContext, table: Table)[source]
process_token(ctx: CommandContext, token: str)[source]
protocol_error(ctx: CommandContext, err: str)[source]
reply_done(ctx: CommandContext)[source]
reply_start(ctx: CommandContext, reply_json)[source]
class UidSource[source]

Bases: object

CERT = 'cert'
GUEST = 'guest'
USER_INPUT = 'user_input'