4.7.4.2. Configuration schemas

Parsers for configuration schemas.

axonius_api_client.parsers.config.config_check(value, schema, source, callbacks=None, none_ok=True)[source]

Check a supplied value for a setting is correctly typed.

Parameters:
  • value (str) – value supplied by user

  • schema (dict) – configuration schema to use to validate value

  • source (str) – identifier of where value came from

  • callbacks (typing.Optional[dict]) – callback operations to run for this value

  • none_ok (bool) – Empty values are ok

Raises:
  • ApiError – If the supplied schema has an unknown type

  • ConfigInvalidValue – if none_ok is false and value is None or “None”

Return type:

typing.Any

axonius_api_client.parsers.config.config_check_file(value, schema, source, callbacks=None)[source]

Check a supplied value for a schema of type file.

Parameters:
Raises:

ApiError – If the supplied schema does not have a callback

Return type:

dict

axonius_api_client.parsers.config.config_check_bool(value, schema, source, callbacks=None)[source]

Check a supplied value for a schema of type boolean.

Parameters:
  • value (typing.Union[str, bool, int]) – value supplied by user

  • schema (dict) – configuration schema to use to validate value

  • source (str) – identifier of where value came from

  • callbacks (typing.Optional[dict]) – callback operations to run for this value

Raises:

ConfigInvalidValue – if the supplied value is not a valid boolean

Return type:

bool

axonius_api_client.parsers.config.config_check_int(value, schema, source, callbacks=None)[source]

Check a supplied value for a schema of integer.

Parameters:
  • value (typing.Union[str, int]) – value supplied by user

  • schema (dict) – configuration schema to use to validate value

  • source (str) – identifier of where value came from

  • callbacks (typing.Optional[dict]) – callback operations to run for this value

Raises:

ConfigInvalidValue – if the supplied value is not an integer

Return type:

int

axonius_api_client.parsers.config.config_check_array(value, schema, source, callbacks=None)[source]

Check a supplied value for a schema of type array.

Parameters:
Raises:

ConfigInvalidValue – if the supplied value is not a CSV string or a list of strings

Return type:

typing.List[str]

axonius_api_client.parsers.config.parse_unchanged(value)[source]

Determine if a value is ‘unchanged’.

Parameters:

value (typing.Union[str, typing.List[str]]) – value supplied by user

Return type:

typing.Tuple[bool, typing.Union[str, typing.List[str]]]

axonius_api_client.parsers.config.config_check_str(value, schema, source, callbacks=None)[source]

Check a supplied value for a schema of type string.

Parameters:
  • value (str) – value supplied by user

  • schema (dict) – configuration schema to use to validate value

  • source (str) – identifier of where value came from

  • callbacks (typing.Optional[dict]) – callback operations to run for this value

Raises:

ConfigInvalidValue – if the supplied value is not a string or if the schema has enums and the supplied value is not one of the enums

Return type:

str

axonius_api_client.parsers.config.config_build(schemas, old_config, new_config, source, check=True, callbacks=None)[source]

Build a configuration from a new config and an old config.

Parameters:
  • schemas (typing.List[dict]) – schemas to validate against key value pairs in new_config

  • old_config (dict) – previous configuration

  • new_config (dict) – new configuration supplied by user

  • source (str) – identifier of where new_config came from

  • callbacks (typing.Optional[dict]) – callback operations to use for schemas

  • check (bool) –

Return type:

dict

axonius_api_client.parsers.config.config_unknown(schemas, new_config, source, callbacks=None)[source]

Check that keys in the supplied configuration are known to the schemas for a connection.

Parameters:
  • schemas (typing.List[dict]) – schemas to validate against key value pairs in new_config

  • new_config (dict) – new configuration supplied by user

  • source (str) – identifier of where new_config came from

  • callbacks (typing.Optional[dict]) – callback operations to use for schemas

Raises:

ConfigUnknown – if the supplied new config has unknown keys to the schemas

Return type:

dict

axonius_api_client.parsers.config.config_unchanged(schemas, old_config, new_config, source, callbacks=None)[source]

Check if a new config is different from the old config.

Parameters:
  • schemas (typing.List[dict]) – schemas to validate against key value pairs in new_config

  • old_config (dict) – previous configuration

  • new_config (dict) – new configuration supplied by user

  • source (str) – identifier of where new_config came from

  • callbacks (typing.Optional[dict]) – callback operations to use for schemas

Raises:

ConfigUnchanged – if the supplied new config is empty or is not different from old config

Return type:

dict

axonius_api_client.parsers.config.config_default(schemas, new_config, source, sane_defaults=None, callbacks=None)[source]

Set defaults for a supplied config.

Parameters:
  • schemas (typing.List[dict]) – schemas to validate against key value pairs in new_config

  • new_config (dict) – new configuration supplied by user

  • source (str) – identifier of where new_config came from

  • callbacks (typing.Optional[dict]) – callback operations to use for schemas

  • sane_defaults (typing.Optional[dict]) – set of sane defaults provided by API client to use in addition to defaults defined in schemas

Return type:

dict

axonius_api_client.parsers.config.config_required(schemas, new_config, source, ignores=None, callbacks=None)[source]

Check if a new config has all required keys.

Parameters:
  • schemas (typing.List[dict]) – schemas to validate against key value pairs in new_config

  • new_config (dict) – new configuration supplied by user

  • source (str) – identifier of where new_config came from

  • ignores (typing.Optional[typing.List[str]]) – schema keys to ignore

  • callbacks (typing.Optional[dict]) – callback operations to use for schemas

Raises:

ConfigRequired – if the supplied new config is empty or is not different from old config

Return type:

dict

axonius_api_client.parsers.config.config_empty(schemas, new_config, source, callbacks=None)[source]

Check if a new config is empty.

Parameters:
  • schemas (typing.List[dict]) – schemas to validate against key value pairs in new_config

  • new_config (dict) – new configuration supplied by user

  • source (str) – identifier of where new_config came from

  • ignores – schema keys to ignore

  • callbacks (typing.Optional[dict]) – callback operations to use for schemas

Raises:

ConfigRequired – if the supplied new config is empty or is not different from old config

Return type:

dict

axonius_api_client.parsers.config.config_info(schema, value, source)[source]

Get a string repr of the schema and value.

Parameters:
  • value (typing.Any) – user supplied value

  • schema (dict) – config schema associated with value

  • source (str) – identifier of where value came from

Return type:

str

axonius_api_client.parsers.config.is_uploaded_file(value)[source]

Determine if value is a previously uploaded file.

Parameters:

value (typing.Union[str, dict]) – value supplied by user

Return type:

typing.Tuple[bool, typing.Union[str, dict]]

axonius_api_client.parsers.config.parse_schema(raw)[source]

Parse a field, adapter, or config schema into a more user-friendly format.

Parameters:

raw (dict) – original schema

Return type:

dict

axonius_api_client.parsers.config.parse_schema_enum(schema)[source]

Parse a field, adapter, or config schema into a more user-friendly format.

Parameters:
  • raw – original schema

  • schema (dict) –

axonius_api_client.parsers.config.parse_section(raw, raw_config, parent, settings)[source]

Parse a section of system settings into a more user-friendly format.

Parameters:
Return type:

dict

axonius_api_client.parsers.config.parse_settings(raw, title='')[source]

Parse system settings into a more user friendly format.

Parameters:
Return type:

dict