NGPIris.hci package¶
Submodules¶
NGPIris.hci.exceptions module¶
NGPIris.hci.hci module¶
- class NGPIris.hci.hci.HCIHandler(credentials_path: str, use_ssl: bool = False)[source]¶
Bases:
object
- list_index_names() list[str] [source]¶
Retrieve a list of all index names.
- Returns:
A list of index names
- Return type:
list[str]
- look_up_index(index_name: str) dict [source]¶
Look up index information in the form of a dictionary by submitting the index name. Will return an empty dictionary if no index was found.
- Parameters:
index_name (str) – The index name
- Returns:
A dictionary containing information about an index
- Return type:
dict
- raw_query(query_dict: dict[str, str]) dict [source]¶
Make query to an HCI index, with a dictionary
- Parameters:
query_dict (dict[str, str]) – Dictionary consisting of the query
- Returns:
Dictionary containing the raw query
- Return type:
dict
- raw_query_from_JSON(query_path: str) dict [source]¶
Make query to an HCI index, with prewritten query in a JSON file
- Parameters:
query_path (str) – Path to the JSON file
- Returns:
Dictionary containing the raw query
- Return type:
dict
- request_token() None [source]¶
Request a token from the HCI, which is stored in the HCIHandler object. The token is used for every operation that needs to send a request to HCI.
- Raises:
VPNConnectionError – If there was a problem when requesting a token, a runtime error will be raised
NGPIris.hci.helpers module¶
- NGPIris.hci.helpers.get_index_response(address: str, api_port: str, token: str, use_ssl: bool) Response [source]¶
Retrieve the index response given the address, API port and token.
- Parameters:
address (str) – The address where request is to be made
api_port (str) – The API port at the given address
token (str) – The HCI token
use_ssl (bool) – Boolean choice of using SSL
- Returns:
A response containing information about the index
- Return type:
requests.Response
- NGPIris.hci.helpers.get_query_response(query_dict: dict[str, str], address: str, api_port: str, token: str, use_ssl: bool, path_extension: str = '') Response [source]¶
Retrieve the query response given the address, API port and token.
- Parameters:
query_dict (dict[str, str]) – The query dictionary
address (str) – The address where request is to be made
api_port (str) – The API port at the given address
token (str) – The HCI token
use_ssl (bool) – Boolean choice of using SSL
path_extension (str, optional) – possibly extend the request URL. Used for example when making SQL requests. Defaults to “”
- Returns:
A response containing information about the query
- Return type:
requests.Response