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:
- Raises:
ApiError – If the supplied schema has an unknown type
ConfigInvalidValue – if none_ok is false and value is None or “None”
- Return type:
- 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:
value (
typing.Union[str,dict,pathlib.Path]) – value supplied by userschema (
dict) – configuration schema to use to validate valuesource (
str) – identifier of where value came fromcallbacks (
typing.Optional[dict]) – callback operations to run for this value
- Raises:
ApiError – If the supplied schema does not have a callback
- Return type:
- 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:
- Raises:
ConfigInvalidValue – if the supplied value is not a valid boolean
- Return type:
- axonius_api_client.parsers.config.config_check_int(value, schema, source, callbacks=None)[source]¶
Check a supplied value for a schema of integer.
- Parameters:
- Raises:
ConfigInvalidValue – if the supplied value is not an integer
- Return type:
- 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:
value (
typing.Union[str,typing.List[typing.Any]]) – value supplied by userschema (
dict) – configuration schema to use to validate valuesource (
str) – identifier of where value came fromcallbacks (
typing.Optional[dict]) – callback operations to run for this value
- Raises:
ConfigInvalidValue – if the supplied value is not a CSV string or a list of strings
- Return type:
- 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 userschema (
dict) – configuration schema to use to validate valuesource (
str) – identifier of where value came fromcallbacks (
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:
- 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_configold_config (
dict) – previous configurationnew_config (
dict) – new configuration supplied by usersource (
str) – identifier of where new_config came fromcallbacks (
typing.Optional[dict]) – callback operations to use for schemascheck (
bool) –
- Return type:
- 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_confignew_config (
dict) – new configuration supplied by usersource (
str) – identifier of where new_config came fromcallbacks (
typing.Optional[dict]) – callback operations to use for schemas
- Raises:
ConfigUnknown – if the supplied new config has unknown keys to the schemas
- Return type:
- 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_configold_config (
dict) – previous configurationnew_config (
dict) – new configuration supplied by usersource (
str) – identifier of where new_config came fromcallbacks (
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:
- 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_confignew_config (
dict) – new configuration supplied by usersource (
str) – identifier of where new_config came fromcallbacks (
typing.Optional[dict]) – callback operations to use for schemassane_defaults (
typing.Optional[dict]) – set of sane defaults provided by API client to use in addition to defaults defined in schemas
- Return type:
- 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_confignew_config (
dict) – new configuration supplied by usersource (
str) – identifier of where new_config came fromignores (
typing.Optional[typing.List[str]]) – schema keys to ignorecallbacks (
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:
- 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_confignew_config (
dict) – new configuration supplied by usersource (
str) – identifier of where new_config came fromignores – 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:
- 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 valueschema (
dict) – config schema associated with valuesource (
str) – identifier of where value came from
- Return type:
- axonius_api_client.parsers.config.is_uploaded_file(value)[source]¶
Determine if value is a previously uploaded file.
- axonius_api_client.parsers.config.parse_schema(raw)[source]¶
Parse a field, adapter, or config schema into a more user-friendly format.
- 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) –