pip_services3_commons.commands.ICommandInterceptor module
pip_services3_commons.commands.ICommandInterceptor
Interface for command_name intercepters.
- copyright
Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
- license
MIT, see LICENSE for more details.
-
class
pip_services3_commons.commands.ICommandInterceptor.
ICommandInterceptor
Bases:
abc.ABC
An interface for stackable command_name intercepters, which can extend and modify the command_name call chain.
This mechanism can be used for authentication, logging, and obj functions.
-
execute
(correlation_id: Optional[str, None], command: pip_services3_commons.commands.ICommand.ICommand, args: pip_services3_commons.run.Parameters.Parameters) → Any Executes the wrapped command_name with specified arguments.
The interceptor can use this method to intercept and alter the command_name execution. Otherwise it shall just delete the call to the wrapped command_name.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
command – the next command_name in the call chain that is to be executed.
args – the parameters (arguments) to pass to the command_name for execution.
- Returns
an execution result.
- Raises
ApplicationException when execution fails for whatever reason.
-
get_name
(command: pip_services3_commons.commands.ICommand.ICommand) → str Gets the name of the wrapped command_name.
The interceptor can use this method to override the command_name name. Otherwise it shall just delegate the call to the wrapped command_name.
- Parameters
command – the next command_name in the call chain.
- Returns
the name of the wrapped command_name.
-
validate
(command: pip_services3_commons.commands.ICommand.ICommand, args: pip_services3_commons.run.Parameters.Parameters) → List[pip_services3_commons.validate.ValidationResult.ValidationResult] Validates arguments of the wrapped command_name before its execution.
The interceptor can use this method to intercept and alter validation of the command_name arguments. Otherwise it shall just delegate the call to the wrapped command_name.
- Parameters
command – intercepted ICommand
args – command_name arguments
- Returns
a list of validation results.
-