Anatomy of the Axonius Python API Client

Intended Audience: Command Line Interface Users and Python Programmers who wish to gain a greater understanding of the Axonius Python API Client.

Purpose: To describe the Axonius Python API Client, the layers that it consists of, and the rationale behind each layer.

Introduction

The Axonius Python API Client was created with the intention of providing a powerful, interactive, programmatic, and straightforward interface with the Axonius platform. It is a Python package that allows users to interact with the Axonius platform from Python and/or a command line interface on Windows, MacOS, and Linux. This package is an optional component that may be installed on a machine of your choosing with the only requirement being that the machine has connectivity to an Axonius core instance.

 

It provides CRUD operations for all objects in the Axonius platform (including adapter connections, saved queries, enforcement sets, system settings, and more) as well as a diverse set of functions which assist in the processing of data into any number of output formats.

Layers of Abstraction

In order to conceptualize the anatomy of the Axonius Python API Client, we consider each level of abstraction as a Layer, with each progressive layer adding more functionality, workflow encapsulation, data enhancement, and data transformation.

Through these layers of abstraction, the Axonius Python API Client is able to provide a stable programmatic means of interacting with Axonius. For further information, please refer to the documentation section at the end of this article.

 

Layer 1 - Axonius REST API 

SUMMARY

The Axonius REST API provides the endpoint through which all programmatic commands may be sent into the Axonius platform. The Axonius REST API specifies how users may interact with the data stored within Axonius and enables users to perform CRUD operations in addition to retrieving asset data.

DETAILS

  1. Provides endpoints for working with the Axonius platform.
  2. Specifies the schemas for all input and output data of all endpoints in the Axonius REST API.
  3. Enables users to perform CRUD operations across various object types including System Users, System Roles, Saved Queries, Enforcement Sets, Dashboards, and more.
  4. Enables users to retrieve asset data with selected fields.

 

Layer 2 - Axonius Python API Client - Private methods

SUMMARY

The private methods that make up Layer 2 serve as the direct interface between the Axonius Python API Client and the Axonius REST API, directly returning responses from the Axonius REST API. This layer is subject to change as versions change.

DETAILS

  1. Python methods created to directly interface with a corresponding endpoint in the Axonius REST API.
  2. Returns the RAW responses from the Axonius REST API endpoint without any transformation or enhancement.
  3. Does not have a type signature that will remain consistent between any version.

 

Layer 3 - Axonius Python API Client - Data Classes

SUMMARY

The Data Classes within the Axonius Python API Client specify the data structure for all requests and responses for both the public and private methods within the Axonius Python API Client. This layer remains consistent until a new major version of the Axonius Python API Client is released.

DETAILS

  1. Standardized schemas created to specify the request and response models for the private and public methods in the Axonius Python API client. 
  2. These schemas have type signatures and will remain consistent until a new major version of the Axonius Python API Client is released.

 

Layer 4 - Axonius Python API Client - Public methods

SUMMARY

The public methods within the Axonius Python API Client serve as the user-facing portion of the client and provide various transformation and enhancement functions to assist in their use cases. This layer remains consistent until a new major version of the Axonius Python API Client is released.

DETAILS

  1. Standardized exterior facing methods that are intended for users of the Axonius Python API Client. 
  2. Provides usability improvements for working with the corresponding private methods in the Axonius Python API Client.
  3. Provide workflow encapsulation for various use cases including: validation of supplied values, paging of queries to assist mass object retrieval, cross correlation using multiple calls.
  4. Uses a type signature inline with the data models in layer 3, remaining consistent until a  new major version of the Axonius Python API Client is released.
  5. Provides data transformation and enhancement functions in addition to access to CRUD operations.
  6. Provides functionality for exporting asset data in a variety of formats including csv, json, table, xml and xlsx.

 

Layer 5 - Axonius Python API Client - CLI

SUMMARY

The CLI within the Axonius Python API Client further extends the functionality of the Public methods, providing users with a standardised command line interface. The layer remains consistent until a major version of the Axonius Python API Client is released.

DETAILS

  1. Provide Command line functionality to access functions and workflows exposed in layer 4, mimicking the same functionality in a command line environment.
  2. Organized into a hierarchical structure consisting of “groups” and “commands”, with  each group having its own set of commands, and each command having their own set of export formats and arguments.
  3. Follows standard command line concepts for information messages (including STDERR and STDOUT) and follows the GNU standard for arguments.
  4. Uses a type signature inline with the data models in layer 3, remaining consistent until a  new major version of the Axonius Python API Client is released.

 

Further Documentation

Axonius API Client GH Site: https://github.com/Axonius/axonius_api_client 

Axonius API Doc Site: https://axonius-api-client.readthedocs.io/en/latest/index.html

CLI Doc Link: https://axonius-api-client.readthedocs.io/en/latest/main/usage_cli/usage_cli.html 

Py Doc Link: https://axonius-api-client.readthedocs.io/en/latest/main/usage_api/usage_api.html

 

Key Terms

  1. Type Signature: The input arguments and the input and output definitions for a function, method, or Axonius REST API endpoint
  2. REST API: The API embedded in the Axonius Platform that provides endpoints for interfacing with the product.
  3. Python API Client: The open-source Python module that interacts with the Axonius REST API.
  4. Private methods: Methods available in the Axonius Python API Client that are not meant for use by end-users.
  5. Public methods: Methods available in the Axonius Python API Client that are for use by end-users.
  6. Command Line Interface (CLI): Commands available in the axonshell binary provided by the Axonius Python API Client that are for use by end-users.
  7. CRUD: Create, Read, Update, and Delete operations related to data objects.

 

 

1

Comments

0 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

New post