5.2.1. adapters

API models package.

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

Bases: axonius_api_client.api.mixins.ModelMixins

API model for working with adapters.

router

Router for this API model.

get() → List[dict][source]

Pass.

get_by_name(name: str, node: str = 'Master') → dict[source]

Pass.

config_get(name: str, node: Optional[str] = 'Master', config_type: Optional[str] = 'generic') → dict[source]

Pass.

config_refetch(adapter: dict, config_type: str = 'generic') → dict[source]

Pass.

config_update(name: str, node: str = 'Master', config_type: str = 'generic', **kwargs) → dict[source]

Pass.

file_upload(name: str, field_name: str, file_name: str, file_content: Union[str, bytes], file_content_type: Optional[str] = None, node: str = 'Master') → dict[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: Union[str, pathlib.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(**kwargs)[source]

Post init method for subclasses to use for extra setup.

_get() → dict[source]

Direct API method to get all adapters.

Returns:raw metadata for all adapters
Return type:dict
_config_update(name_raw: str, name_config: str, new_config: dict) → str[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: str, name_config: str) → dict[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: str, node_id: str, field_name: str, file_name: str, file_content: Union[bytes, str], file_content_type: Optional[str] = None, file_headers: Optional[dict] = None) → dict[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