4.7.3.7. Wizards¶
Constants for wizards.
- class axonius_api_client.constants.wizards.Templates[source]¶
Bases:
object
Query builder templates.
- class axonius_api_client.constants.wizards.Results[source]¶
Bases:
object
Keys for results returned from wizards.
- class axonius_api_client.constants.wizards.Patterns[source]¶
Bases:
object
Regular expression patterns for validation of values in entries.
-
FIELD_VALID:
str
= re.compile('(?ix) # case insensitive and verbose\n([^a-z0-9:._\\-]) # contains characters that are not one of: a-z 0-9 : . _ -\n', re.IGNORECASE|re.VERBOSE)¶ regex for validating that a field name is valid
-
FIELD_FIRST_ALPHA:
str
= re.compile('(?ix) # case insensitive and verbose\n(^[^a-zA-Z]) # starts with characters that are not one of: a-z\n', re.IGNORECASE|re.VERBOSE)¶ regex for validating that a field name begins with alpha characters
-
OP_ALPHA:
str
= re.compile('(?ix) # case insensitive and verbose\n([^a-z0-9_\\-]) # contains characters that are not one of: a-z 0-9 _ -\n', re.IGNORECASE|re.VERBOSE)¶ regex for validating operators
-
FLAGS:
str
= re.compile('(?ix) # case insensitive and verbose\n(?P<flags>[^a-z0-9]*)? # capture optional flags at beginning\n(?P<value>.*) # capture the rest as the value\n', re.IGNORECASE|re.VERBOSE)¶ regex for validating flags
-
FIELD:
typing.List
[str
] = [re.compile('(?ix) # case insensitive and verbose\n([^a-z0-9:._\\-]) # contains characters that are not one of: a-z 0-9 : . _ -\n', re.IGNORECASE|re.VERBOSE), re.compile('(?ix) # case insensitive and verbose\n(^[^a-zA-Z]) # starts with characters that are not one of: a-z\n', re.IGNORECASE|re.VERBOSE)]¶ regex validators to use for fields
-
OP:
typing.List
[str
] = [re.compile('(?ix) # case insensitive and verbose\n([^a-z0-9_\\-]) # contains characters that are not one of: a-z 0-9 _ -\n', re.IGNORECASE|re.VERBOSE)]¶ regex validators to use for operators
-
FIELD_VALID:
- class axonius_api_client.constants.wizards.Flags[source]¶
Bases:
object
Flag values that can be used in values for entries.
-
FLAGS:
dict
= {'!': 'Use not', '&': 'Use and instead of or (default)', '(': 'Open a parentheses', ')': 'Close a parentheses (can also be at end of entry)', '|': 'Use or instead of and (overrides &)'}¶ valid flags and their descriptions
-
FLAGS:
- class axonius_api_client.constants.wizards.Entry[source]¶
Bases:
object
Entry keys and split values.
-
REQ:
typing.List
[str
] = ['value', 'type']¶ Required keys for entries
-
REQ:
- class axonius_api_client.constants.wizards.EntrySq[source]¶
Bases:
object
Entry keys for saved query types.
-
REQ:
typing.List
[str
] = ['value', 'type']¶ Required keys for saved query types
-
OPT_ENTRY:
dict
= {'always_cached': False, 'asset_scope': False, 'gui_page_size': 20, 'private': False}¶
-
OPT:
dict
= {'always_cached': False, 'asset_scope': False, 'description': '', 'fields': 'default', 'gui_page_size': 20, 'private': False, 'tags': ''}¶ Optional keys and their defaults for saved query types
-
BOOLS:
typing.List
[str
] = ['private', 'asset_scope', 'always_cached']¶
-
INTS:
typing.List
[str
] = ['gui_page_size']¶
-
REQ:
- class axonius_api_client.constants.wizards.Types[source]¶
Bases:
object
Types of entries.
-
DICT:
typing.List
[str
] = ['simple', 'complex']¶ valid types for the base Wizard class.
-
TEXT:
typing.List
[str
] = ['simple', 'complex']¶ valid types for the WizardText class.
-
SQ:
typing.List
[str
] = ['simple', 'complex', 'saved_query']¶ valid types for the WizardCsv class.
-
CLI:
typing.List
[str
] = ['simple', 'complex', 'file', 'lines']¶ valid types for the CLI.
-
DICT:
- class axonius_api_client.constants.wizards.Docs[source]¶
Bases:
object
Documentation strings for wizards.
-
EX_TEXT:
str
= 'simple ( hostname contains test\nsimple ! hostname contains internal )\nsimple ( os.type equals windows\nsimple | os.type equals os x )\ncomplex installed_software // name contains chrome // version earlier_than 82\n'¶
-
EX_DICT:
str
= '[\n {\n "type": "simple",\n "value": "( hostname contains test"\n },\n {\n "type": "simple",\n "value": "! hostname contains internal )"\n },\n {\n "type": "simple",\n "value": "( os.type equals windows"\n },\n {\n "type": "simple",\n "value": "| os.type equals os x )"\n },\n {\n "type": "complex",\n "value": "installed_software // name contains chrome // version earlier_than 82"\n }\n]\n'¶
- GUI_PAGE_SIZES_STR = '20 or 50 or 100 (default 20 if empty)'¶
- OPT_BOOL = 'Optional: True or False (default False if empty)'¶
-
EX_CSV:
str
= '\ntype,value,description,tags,fields,asset_scope,private,always_cached,gui_page_size\n"# If type column is empty or begins with # it is ignored",,,,\n"# type of simple or complex will belong to the saved_query they are under",,,,\n"# Column descriptions for type of saved_query","Name of Saved Query","Description of Saved Query","Tags to apply to Saved Query","Columns to display in Saved Query",Optional: True or False (default False if empty),Optional: True or False (default False if empty),Optional: True or False (default False if empty),"20 or 50 or 100 (default 20 if empty)",\n"# Column descriptions for type of simple","Format -- [] represents optional items: [& | ! ( )] FIELD OPERATOR VALUE [)]","Description: Filter entry for simple fields","Only uses columns type and value",\n"# Column descriptions for type of complex","Format -- [] represents optional items: [& | ! ( )] COMPLEX-FIELD // SUB-FIELD OPERATOR VALUE[ // ...] [)]","Description: Filter entry for complex fields and their sub-fields","Only uses columns type and value",\n"# Value Flags for type of simple or complex","& Use and instead of or (default), | Use or instead of and (overrides &), ! Use not, ( Open a parentheses, ) Close a parentheses (can also be at end of entry)",,,\n"saved_query","example 1","Filters, default fields, custom fields","example,tag1,tag2","os.distribution,os.os_str,active_directory:ad_password_last_set,default,os.build"\n"simple","( hostname contains test",,,\n"simple","! hostname contains internal )",,,\n"simple","( os.type equals windows",,,\n"simple","| os.type equals os x )",,,\n"saved_query","example 2","No filters, no default fields, custom fields","example,tag3,tag4","os.distribution,os.os_str,active_directory:ad_password_last_set"\n"saved_query","example 3","No filters, default fields, no custom fields","example,tag5,tag6",\n'¶
-
TEXT:
str
= '\n# Example:\nsimple ( hostname contains test\nsimple ! hostname contains internal )\nsimple ( os.type equals windows\nsimple | os.type equals os x )\ncomplex installed_software // name contains chrome // version earlier_than 82\n\n\n# Format -- [] represents optional items:\nsimple [& | ! ( )] FIELD OPERATOR VALUE [)]\n# Description: Filter entry for simple fields\ncomplex [& | ! ( )] COMPLEX-FIELD // SUB-FIELD OPERATOR VALUE[ // ...] [)]\n# Description: Filter entry for complex fields and their sub-fields\n\n# Flags:\n# & Use and instead of or (default)\n# | Use or instead of and (overrides &)\n# ! Use not\n# ( Open a parentheses\n# ) Close a parentheses (can also be at end of entry)\n'¶
-
DICT:
str
= '\n# Example:\n[\n {\n "type": "simple",\n "value": "( hostname contains test"\n },\n {\n "type": "simple",\n "value": "! hostname contains internal )"\n },\n {\n "type": "simple",\n "value": "( os.type equals windows"\n },\n {\n "type": "simple",\n "value": "| os.type equals os x )"\n },\n {\n "type": "complex",\n "value": "installed_software // name contains chrome // version earlier_than 82"\n }\n]\n\n\n# Format -- [] represents optional items:\n# "type": "simple, "value": "[& | ! ( )] FIELD OPERATOR VALUE [)]"\n# Description: "Filter entry for simple fields"\n# "type": "complex", "value": "[& | ! ( )] COMPLEX-FIELD // SUB-FIELD OPERATOR VALUE[ // ...] [)]"\n# Description: "Filter entry for complex fields and their sub-fields"\n\n# Flags:\n# & Use and instead of or (default)\n# | Use or instead of and (overrides &)\n# ! Use not\n# ( Open a parentheses\n# ) Close a parentheses (can also be at end of entry)\n'¶
-
CSV:
str
= '\ntype,value,description,tags,fields,asset_scope,private,always_cached,gui_page_size\n"# If type column is empty or begins with # it is ignored",,,,\n"# type of simple or complex will belong to the saved_query they are under",,,,\n"# Column descriptions for type of saved_query","Name of Saved Query","Description of Saved Query","Tags to apply to Saved Query","Columns to display in Saved Query",Optional: True or False (default False if empty),Optional: True or False (default False if empty),Optional: True or False (default False if empty),"20 or 50 or 100 (default 20 if empty)",\n"# Column descriptions for type of simple","Format -- [] represents optional items: [& | ! ( )] FIELD OPERATOR VALUE [)]","Description: Filter entry for simple fields","Only uses columns type and value",\n"# Column descriptions for type of complex","Format -- [] represents optional items: [& | ! ( )] COMPLEX-FIELD // SUB-FIELD OPERATOR VALUE[ // ...] [)]","Description: Filter entry for complex fields and their sub-fields","Only uses columns type and value",\n"# Value Flags for type of simple or complex","& Use and instead of or (default), | Use or instead of and (overrides &), ! Use not, ( Open a parentheses, ) Close a parentheses (can also be at end of entry)",,,\n"saved_query","example 1","Filters, default fields, custom fields","example,tag1,tag2","os.distribution,os.os_str,active_directory:ad_password_last_set,default,os.build"\n"simple","( hostname contains test",,,\n"simple","! hostname contains internal )",,,\n"simple","( os.type equals windows",,,\n"simple","| os.type equals os x )",,,\n"saved_query","example 2","No filters, no default fields, custom fields","example,tag3,tag4","os.distribution,os.os_str,active_directory:ad_password_last_set"\n"saved_query","example 3","No filters, default fields, no custom fields","example,tag5,tag6",\n'¶
-
EX_TEXT:
- class axonius_api_client.constants.wizards.Sources[source]¶
Bases:
object
Defaults for wizard source argument.
- class axonius_api_client.constants.wizards.Fields[source]¶
Bases:
object
Keys and arguments for field schemas.
- class axonius_api_client.constants.wizards.Expr[source]¶
Bases:
object
Keys for GUI expressions.
- classmethod get_query(exprs)[source]¶
Get the query for a list of GUI expressions.
- Parameters:
exprs (
typing.List
[dict
]) – list of expressions to build query from- Return type:
- classmethod get_subs_query(sub_exprs)[source]¶
Get the complex query for a list of GUI child expressions.
- Parameters:
sub_exprs (
typing.List
[dict
]) – list of children of a complex expression to build query from- Return type:
- classmethod build(entry, query, field, idx, op_comp, field_name_override=None, value=None, is_complex=False, children=None)[source]¶
Build an expression for the GUI to understand the query.
- Parameters:
entry (
dict
) – entry to build expression fromquery (
str
) – AQL stringfield (
dict
) – schema of fieldidx (
int
) – index of this expressionfield_name_override (
typing.Optional
[str
]) – value to use as name of field in expr instead of ‘name’ key from field dictvalue (
typing.Union
[int
,str
,bool
,None
]) – raw expression valueop_comp (
str
) – comparison operatoris_complex (
bool
) – build an expression for a complex filterchildren (
typing.Optional
[typing.List
[dict
]]) – children of a complex filter
- Return type: