4.6.1. Dashboards and discovery cycles

API for working with dashboards and discovery lifecycle.

axonius_api_client.api.system.dashboard.human_key(key)[source]

Pass.

class axonius_api_client.api.system.dashboard.DiscoverPhase(raw)[source]

Bases: axonius_api_client.data.BaseData

Pass.

Parameters

raw (dict) –

raw: dict
__str__()[source]

Pass.

__repr__()[source]

Pass.

to_str_properties()[source]

Pass.

Return type

typing.List[str]

to_str_progress()[source]

Pass.

Return type

typing.List[str]

to_dict()[source]

Pass.

property name

Pass.

Return type

str

property human_name

Pass.

Return type

str

property is_done

Pass.

Return type

bool

property progress

Pass.

Return type

typing.Dict[str, typing.List[str]]

property name_map

Pass.

Return type

dict

__init__(raw)

Initialize self. See help(type(self)) for accurate signature.

Parameters

raw (dict) –

classmethod get_fields()

Get a list of fields defined for current this dataclass object.

Return type

typing.List[dataclasses.Field]

class axonius_api_client.api.system.dashboard.DiscoverData(raw, adapters)[source]

Bases: axonius_api_client.data.BaseData

Pass.

Parameters
raw: dict
adapters: List[dict]
__str__()[source]

Pass.

__repr__()[source]

Pass.

to_str_properties()[source]

Pass.

Return type

typing.List[str]

to_str_progress()[source]

Pass.

Return type

typing.List[str]

to_str_phases()[source]

Pass.

Return type

typing.List[str]

to_dict(dt_obj=False)[source]

Pass.

Parameters

dt_obj (bool) –

Return type

dict

property last_run_finish_date

Pass.

Return type

typing.Optional[datetime.datetime]

property last_run_start_date

Pass.

Return type

typing.Optional[datetime.datetime]

property last_run_duration_in_minutes

Pass.

Return type

typing.Optional[float]

property last_run_minutes_ago

Pass.

Return type

typing.Optional[float]

property next_run_starts_in_minutes

Pass.

Return type

float

property next_run_start_date

Pass.

Return type

datetime.datetime

property correlation_stage

Pass.

Return type

str

property is_correlation_finished

Pass.

Return type

bool

property is_running

Pass.

Return type

bool

property status

Pass.

Return type

str

property progress

Pass.

Return type

typing.List[dict]

property phases

Pass.

Return type

typing.List[axonius_api_client.api.system.dashboard.DiscoverPhase]

next_run_within_minutes(value)[source]

Pass.

Parameters

value (int) –

Return type

bool

__init__(raw, adapters)

Initialize self. See help(type(self)) for accurate signature.

Parameters
classmethod get_fields()

Get a list of fields defined for current this dataclass object.

Return type

typing.List[dataclasses.Field]

class axonius_api_client.api.system.dashboard.Dashboard(auth, **kwargs)[source]

Bases: axonius_api_client.api.mixins.ModelMixins

API for working with dashboards and discovery lifecycle.

Examples

  • Get discover lifecycle metadata: get()

  • See if a lifecycle is currently running: is_running()

  • Start a discover lifecycle: start()

  • Stop a discover lifecycle: stop()

Parameters

auth (axonius_api_client.auth.models.Model) –

get()[source]

Get lifecycle metadata.

Examples

Create a client using axonius_api_client.connect.Connect

>>> data = client.dashboard.get()
>>> data.next_run_starts_in_minutes
551
>>> data.is_running
False
Return type

axonius_api_client.api.system.dashboard.DiscoverData

property is_running

Check if discovery cycle is running.

Examples

Create a client using axonius_api_client.connect.Connect

>>> data = client.dashboard.is_running
False
Return type

bool

start()[source]

Start a discovery cycle if one is not running.

Examples

Create a client using axonius_api_client.connect.Connect

>>> data = client.dashboard.start()
>>> data['is_running']
True
>>> j(data['phases_pending'])
[
  "Fetch_Devices",
  "Fetch_Scanners",
  "Clean_Devices",
  "Pre_Correlation",
  "Run_Correlations",
  "Post_Correlation",
  "Run_Queries",
  "Save_Historical"
]
>>> j(data['phases_done'])
[]
Return type

axonius_api_client.api.system.dashboard.DiscoverData

stop()[source]

Stop a discovery cycle if one is running.

Examples

Create a client using axonius_api_client.connect.Connect

>>> data = client.dashboard.start()
>>> data['is_running']
True
Return type

axonius_api_client.api.system.dashboard.DiscoverData

_get()[source]

Direct API method to get discovery cycle metadata.

Return type

dict

_start()[source]

Direct API method to start a discovery cycle.

Return type

str

_stop()[source]

Direct API method to stop a discovery cycle.

Return type

str

property router

Router for this API model.

Return type

axonius_api_client.api.routers.Router

_init(**kwargs)[source]

Post init method for subclasses to use for extra setup.

__init__(auth, **kwargs)

Mixins for API Models.

Parameters
__repr__()

Show info for this model object.

Return type

str

__str__()

Show info for this model object.

Return type

str

_build_err_msg(response, error=None, exc=None)

Build an error message from a response.

Parameters
Return type

str

_check_response_code(response, error_status=True)

Check the status code of a response.

Parameters
  • responserequests.Response object to check

  • error_status (bool) – throw exc if response status code is bad

Raises

ResponseNotOk – if response has a status code that is an error and error_status is True

_check_response_json(response, error_json_bad_status=True, error_json_invalid=True, uses_api_response=False)

Check the text body of a response is JSON.

Parameters
Raises
  • JsonInvalid – if error_json_invalid is True and response has invalid json

  • JsonError – if error_json_bad_status is True and response is a json dict that has a non-empty error key or a status key that == error

Return type

typing.Any

request(path, method='get', raw=False, is_json=True, empty_ok=False, error_status=True, error_json_bad_status=True, error_json_invalid=True, **kwargs)

Send a REST API request.

Parameters
  • path (str) – path to use in request

  • method (str) – method to use in request

  • raw (bool) – return the raw response object

  • is_json (bool) – return the response as deserialized json or just return the text body

  • error_status (bool) – throw error if response has a bad status code

  • error_json_bad_status (bool) – throw error if json response has non-empty error key

  • error_json_invalid (bool) – throw error if response can not be deserialized into json

  • **kwargs – Passed to axonius_api_client.http.Http.__call__()

  • empty_ok (bool) –

Return type

typing.Any

Returns

requests.Response or str or dict or int or list