5.2.1. adapters

API models package.

class axonius_api_client.api.adapters.Adapters(auth, **kwargs)[source]

Bases: axonius_api_client.api.mixins.ModelMixins

API model for working with adapters.

router

Router for this API model.

get()[source]

Pass.

get_by_name(name, node='Master')[source]

Pass.

config_get(name, node='Master', generic=True)[source]

Pass.

config_refetch(adapter, generic=True)[source]

Pass.

config_update(name, node='Master', generic=True, **kwargs)[source]

Pass.

file_upload(name, field_name, file_name, file_content, file_content_type=None, node='Master')[source]

Upload a str as a file to a specific adapter on a specific node.

Parameters:
  • adapter (str or dict) –
    • If str, the name of the adapter to get the metadata for
    • If dict, the metadata for a previously fetched adapter
  • field (str) – name of field to store data in
  • name (str) – filename to use when uploading file
  • content (str or bytes) – content of file to upload
  • node (str, optional) – default DEFAULT_NODE - node name running adapter
  • content_type (str, optional) – default None - mime type of content
Returns:

dict that can be used in a connection parameter of type file that contains the keys:

  • uuid: UUID of uploaded file
  • filename: filename of uploaded file

Return type:

dict

file_upload_path(path, **kwargs)[source]

Upload the contents of a file to a specific adapter on a specific node.

Parameters:
  • adapter (str or dict) –
    • If str, the name of the adapter to get the metadata for
    • If dict, the metadata for a previously fetched adapter
  • field (str) – name of field to store data in
  • name (str) – filename to use when uploading file
  • path (str or pathlib.Path) – path to file containing contents to upload
  • node (str, optional) – default DEFAULT_NODE - node name running adapter
  • content_type (str, optional) – default None - mime type of content
Returns:

dict that can be used in a connection parameter of type file that contains the keys:

  • uuid: UUID of uploaded file
  • filename: filename of uploaded file

Return type:

dict

_init(auth, **kwargs)[source]

Post init method for subclasses to use for extra setup.

Parameters:auth (auth.Model) – object to use for auth and sending API requests
_get()[source]

Direct API method to get all adapters.

Returns:raw metadata for all adapters
Return type:dict
_config_update(name_raw, name_config, new_config)[source]

Direct API method to set advanced settings for an adapter.

Parameters:
  • name_raw (str) – unique plugin name of adapter to set advanced settings for. unique plugin name refers to the name of an adapter for a specific node
  • name_config (str) – name of advanced settings to set - either AdapterBase for generic advanced settings or AwsSettings for adapter specific settings, if applicable
  • config (dict) – the configuration values to set
Returns:

empty str

Return type:

str

_config_get(name_plugin, name_config)[source]

Direct API method to set advanced settings for an adapter.

Parameters:
  • name_plugin (str) – unique plugin name of adapter to set advanced settings for. unique plugin name refers to the name of an adapter for a specific node i.e. aws_adapter_0
  • name_config (str) – name of advanced settings to set - either AdapterBase for generic advanced settings or AwsSettings for adapter specific settings, if applicable
Returns:

current settings for name_config of name_plugin

Return type:

dict

_file_upload(name_raw, node_id, field_name, file_name, file_content, file_content_type=None, file_headers=None)[source]

Direct API method to upload a file to a specific adapter on a specifc node.

Parameters:
  • name_raw (str) – name of the adapter to upload a file to
  • node_id (str) – ID of node running adapter
  • field_name (str) – name of setting this file is intended for
  • file_name (str) – filename to use when uploading file
  • file_content (str or bytes) – content to upload
  • file_content_type (str, optional) – default None - mime type of content
  • file_headers (dict, optional) – default None - headers to use for file content
Returns:

dict that can be used in a connection parameter of type file that contains the keys:

  • uuid: UUID of uploaded file
  • filename: filename of uploaded file

Return type:

dict