Terarea  2
The automation project
Loading...
Searching...
No Matches
src.lib.actions.action_management.ActionManagement Class Reference
Collaboration diagram for src.lib.actions.action_management.ActionManagement:
Collaboration graph

Public Member Functions

 __init__ (self, Variables variable, ActionLogger logger, RuntimeData runtime_data, int action_id=0, Any scope="default_scope", int error=84, int success=0, bool debug=False, int delay=10)
 
Any get_response_verification (self, Dict[str, Any] response_node)
 
Any get_verification_value (self, Dict[str, Any] response_node)
 
Any get_response_content (self, str variable_name)
 
Any get_variable_data_if_required (self, str node, bool attempt_bruteforce=True)
 
bool check_data_comparison (self, Any data, ACONST.operator operator, Any verification_value)
 
None set_runtime_variables (self, Dict[str, Any] data)
 
int process_node (self, Dict[str, Any] consequences)
 
int run (self, str key)
 

Data Fields

int error = error
 
Any scope = scope
 
int delay = delay
 
bool debug = debug
 
int success = success
 
str action_id = str(action_id)
 
ActionLogger logger = logger
 
Variables variable = variable
 
RuntimeData runtime_data = runtime_data
 
Disp disp
 
Secrets secrets
 
QueryEndpoint query_endpoint
 
APIQuerier api_querier_initialised = None
 
Dict[str, Any] api_response = None
 

Protected Member Functions

int _log_fatal (self, str title, msg, int action_id, bool raise_item=False, object raise_func=ValueError)
 

Detailed Description

_summary_

Definition at line 22 of file action_management.py.

Constructor & Destructor Documentation

◆ __init__()

src.lib.actions.action_management.ActionManagement.__init__ ( self,
Variables variable,
ActionLogger logger,
RuntimeData runtime_data,
int action_id = 0,
Any scope = "default_scope",
int error = 84,
int success = 0,
bool debug = False,
int delay = 10 )
_summary_
    This is the class in charge of checking the actions to be run and storing variables if required.
Args:
    variable (Variables): _description_: The class variable in charge of tracking the variables for the runtime.
    logger (ActionLogger): _description_: The class logger in charge of logging the actions.
    runtime_data (RuntimeData): _description_: The class runtime data in charge of containing important connections.
    action_id (int): _description_: The action ID to log.
    scope (Any, optional): _description_: The scope of the consequences. Defaults to "default_scope".
    error (int, optional): _description_. Defaults to 84.: The error value
    success (int, optional): _description_. Defaults to 0.: The success value
    debug (bool, optional): _description_. Defaults to False.: Set to True if you wish to activate debug mode.
    delay (int, optional): _description_. Defaults to 10.: The delay to wait before running the action.

Definition at line 26 of file action_management.py.

Member Function Documentation

◆ _log_fatal()

int src.lib.actions.action_management.ActionManagement._log_fatal ( self,
str title,
msg,
int action_id,
bool raise_item = False,
object raise_func = ValueError )
protected
_summary_
    A function that will log a provided fatal error.

Args:
    title (str): _description_: the title of the function
    msg (str): _description_: The message to log
    raise_item (bool, optional): _description_. Inform if the logger should raise or just return an error. Defaults to False.
    raise_func (object, optional): _description_. The function to raise if required. Defaults to ValueError.

Raises:
    ValueError: _description_: One of the possible errors to raise.

Returns:
    int: _description_: Will return self.error if raise_item is False

Definition at line 76 of file action_management.py.

◆ check_data_comparison()

bool src.lib.actions.action_management.ActionManagement.check_data_comparison ( self,
Any data,
ACONST.operator operator,
Any verification_value )
_summary_
    Check the data comparison.

Args:
    data (Any): _description_
    operator (Any): _description_
    verification_value (Any): _description_

Returns:
    bool: _description_

Definition at line 316 of file action_management.py.

◆ get_response_content()

Any src.lib.actions.action_management.ActionManagement.get_response_content ( self,
str variable_name )
_summary_
    Get the response content.

Args:
    variable_name (str): _description_

Returns:
    Any: _description_

Definition at line 181 of file action_management.py.

◆ get_response_verification()

Any src.lib.actions.action_management.ActionManagement.get_response_verification ( self,
Dict[str, Any] response_node )
_summary_
    Get the response verification.

Args:
    response_node (Dict[str, Any]): _description_

Returns:
    Any: _description_

Definition at line 104 of file action_management.py.

◆ get_variable_data_if_required()

Any src.lib.actions.action_management.ActionManagement.get_variable_data_if_required ( self,
str node,
bool attempt_bruteforce = True )
_summary_
    Get the variable data if required.

Args:
    node (Dict[str, Any]): _description_

Returns:
    Any: _description_

Definition at line 257 of file action_management.py.

◆ get_verification_value()

Any src.lib.actions.action_management.ActionManagement.get_verification_value ( self,
Dict[str, Any] response_node )
_summary_
    Get the verification value.

Args:
    response_node (Dict[str, Any]): _description_

Returns:
    Any: _description_

Definition at line 142 of file action_management.py.

◆ process_node()

int src.lib.actions.action_management.ActionManagement.process_node ( self,
Dict[str, Any] consequences )
_summary_
    Process the nodes contained in the action json.

Args:
    node (Dict[str, Any]): _description_

Returns:
    int: _description_

Definition at line 377 of file action_management.py.

◆ run()

int src.lib.actions.action_management.ActionManagement.run ( self,
str key )
_summary_
    Run the consequences checking.

Returns:
    int: _description_: Returns self.success if the program succeeded, self.error otherwise.

Definition at line 427 of file action_management.py.

◆ set_runtime_variables()

None src.lib.actions.action_management.ActionManagement.set_runtime_variables ( self,
Dict[str, Any] data )
_summary_
    Set the runtime variables.

Args:
    data (Any): _description_

Definition at line 345 of file action_management.py.

Field Documentation

◆ action_id

src.lib.actions.action_management.ActionManagement.action_id = str(action_id)

Definition at line 46 of file action_management.py.

◆ api_querier_initialised

APIQuerier src.lib.actions.action_management.ActionManagement.api_querier_initialised = None

Definition at line 73 of file action_management.py.

◆ api_response

Dict[str, Any] src.lib.actions.action_management.ActionManagement.api_response = None

Definition at line 74 of file action_management.py.

◆ debug

bool src.lib.actions.action_management.ActionManagement.debug = debug

Definition at line 44 of file action_management.py.

◆ delay

int src.lib.actions.action_management.ActionManagement.delay = delay

Definition at line 43 of file action_management.py.

◆ disp

Disp src.lib.actions.action_management.ActionManagement.disp
Initial value:
= Disp(
TOML_CONF,
SAVE_TO_FILE,
FILE_NAME,
FILE_DESCRIPTOR,
debug=self.debug,
logger=self.__class__.__name__
)

Definition at line 51 of file action_management.py.

◆ error

int src.lib.actions.action_management.ActionManagement.error = error

Definition at line 41 of file action_management.py.

◆ logger

ActionLogger src.lib.actions.action_management.ActionManagement.logger = logger

Definition at line 47 of file action_management.py.

◆ query_endpoint

QueryEndpoint src.lib.actions.action_management.ActionManagement.query_endpoint
Initial value:
= QueryEndpoint(
host="",
port=None,
delay=0,
debug=self.debug
)

Definition at line 66 of file action_management.py.

◆ runtime_data

RuntimeData src.lib.actions.action_management.ActionManagement.runtime_data = runtime_data

Definition at line 49 of file action_management.py.

◆ scope

src.lib.actions.action_management.ActionManagement.scope = scope

Definition at line 42 of file action_management.py.

◆ secrets

Secrets src.lib.actions.action_management.ActionManagement.secrets
Initial value:
= Secrets(
success=self.success,
error=self.error,
debug=self.debug
)

Definition at line 60 of file action_management.py.

◆ success

int src.lib.actions.action_management.ActionManagement.success = success

Definition at line 45 of file action_management.py.

◆ variable

Variables src.lib.actions.action_management.ActionManagement.variable = variable

Definition at line 48 of file action_management.py.


The documentation for this class was generated from the following file: