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 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_bytes_receiver()[source]
get_bytes_sender()[source]
get_command()[source]
get_command_args()[source]
get_command_entry()[source]
get_command_name()[source]
get_command_result()[source]
get_custom_props()[source]
get_json_processor()[source]
get_meta()[source]
get_reply_processor()[source]
set_api(api)[source]
set_bytes_receiver(r)[source]
set_bytes_sender(s)[source]
set_command(command)[source]
set_command_args(cmd_args)[source]
set_command_entry(entry)[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]
class CommandCtxKey[source]

Bases: object

API = 'api'
BYTES_RECEIVER = 'bytes_receiver'
BYTES_SENDER = 'bytes_sender'
CMD = 'cmd'
CMD_ARGS = 'cmd_args'
CMD_ENTRY = 'cmd_entry'
CUSTOM_PROPS = 'custom_props'
JSON_PROCESSOR = 'json_processor'
META = 'meta'
REPLY_PROCESSOR = 'reply_processor'
RESULT = 'result'
class CommandInfo(value)[source]

Bases: Enum

An enumeration.

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

Bases: ABC

abstract receive(sock)[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 SendBytesToServer[source]

Bases: ABC

abstract send(sock, meta: str)[source]
class ServiceFinder[source]

Bases: ABC

get_command_module() CommandModule[source]
set_secure_context(ca_cert_path: str, cert_path: str, private_key_path: str)[source]
abstract start(service_address_changed_cb)[source]
abstract stop()[source]
service_address_changed_cb_signature(host: str, port: int, ssid: str)[source]