5.2.3. enforcements

API models package.

class axonius_api_client.api.enforcements.Enforcements(auth: axonius_api_client.auth.Model, **kwargs)[source]

Bases: axonius_api_client.api.mixins.ModelMixins, axonius_api_client.api.mixins.PagingMixinsObject

API model for working with enforcement center.

Notes

The REST API will need to be updated to allow more power in this library. Until then, this class should be considered BETA.

delete(rows: List[dict]) → str[source]

Delete an enforcement by name.

router

Router for this API model.

Returns:REST API route defs
Return type:routers.Router
_delete(ids: List[str]) → str[source]

Delete objects by internal axonius IDs.

Parameters:ids (list of str) – internal_axon_ids of devices to process
_create(name: str, main: dict, success: Optional[List[dict]] = None, failure: Optional[List[dict]] = None, post: Optional[List[dict]] = None, triggers: Optional[List[dict]] = None) → str[source]

Create an enforcement set.

Parameters:
  • name (str) – name of enforcement to create
  • main (dict) – main action
  • success (list of dict, optional) – success actions
  • failure (list of dict, optional) – failure actions
  • post (list of dict, optional) – post actions
  • triggers (list of dict, optional) – saved query trigger

Notes

This will get a public create method once the REST API server has been updated to expose /enforcements/actions, /api/enforcements/actions/saved, and others.

Returns:ID of created enforcement set.
Return type:str
_get(query: Optional[str] = None, row_start: int = 0, page_size: int = 0) → dict[source]

Get a page for a given query.

class axonius_api_client.api.enforcements.RunAction(auth: axonius_api_client.auth.Model, **kwargs)[source]

Bases: axonius_api_client.api.mixins.ModelMixins

Child API model for working with actions.

Notes

The REST API will need to be updated to allow more power in this library. Until then, this class should be considered BETA.

router

Router for this API model.

Returns:REST API route defs
Return type:routers.Router
_get() → List[str][source]

Direct API method to get all actions.

Returns:all actions known to system
Return type:list of str
_deploy(action_name: str, ids: List[str], file_uuid: str, file_name: str, params: Optional[str] = None) → dict[source]

Deploy an action.

Parameters:
  • name (str) – name of action to deploy
  • ids (list of str) – internal_axon_ids of devices to process
  • uuid (str) – UUID of binary to use in deployment
  • filename (str) – filename of binary to use in deployment
  • params (str, optional) – parameters to pass to action
Returns:

response from deploying action

Return type:

object

_shell(action_name: str, ids: List[str], command: str) → dict[source]

Run an action.

Parameters:
  • action_name (str) – name of action to run
  • ids (list of str) – internal_axon_ids of devices to process
  • command (str) – command to run
Returns:

response from running action

Return type:

object

_upload_file(name: str, content: IO, content_type: Optional[str] = None, headers: Optional[dict] = None)[source]

Upload a file to the system for use in deployment.

Parameters:
  • binary (io.BytesIO) – binary bits of file to upload
  • filename (str) – name of file to upload
Returns:

UUID of uploaded file.

Return type:

str