baroque.defaults package¶
Submodules¶
baroque.defaults.config module¶
Default Baroque configuration
baroque.defaults.events module¶
-
class
baroque.defaults.events.
EventFactory
¶ Bases:
object
A factory class that exposes methods to quickly create useful
baroque.entities.event.Event
instances-
classmethod
new
(**kwargs)¶ Factory method returning a generic type event.
Parameters: **kwargs – positional arguments for Event instantiation Returns: baroque.entities.event.Event
-
classmethod
baroque.defaults.eventtypes module¶
-
class
baroque.defaults.eventtypes.
DataOperationEventType
(owner=None)¶ Bases:
baroque.entities.eventtype.EventType
Describes events cast when some kind of operation is done on a piece of data. Suitable i.e. to track CRUD operations on DB tables or whole datastores. Details about the impacted data entity and the operation are conveyed in the event payload.
Parameters: owner (str, optional) – ID of the owner of this event type.
-
class
baroque.defaults.eventtypes.
GenericEventType
(owner=None)¶ Bases:
baroque.entities.eventtype.EventType
Describes generic events with a free-form content.
Parameters: owner (str, optional) – ID of the owner of this event type.
-
class
baroque.defaults.eventtypes.
MetricEventType
(owner=None)¶ Bases:
baroque.entities.eventtype.EventType
Describes events carrying metric data. Suitable i.e. to track values about measured physical quantities. The metric name and value are conveyed in the event payload.
Parameters: owner (str, optional) – ID of the owner of this event type.
-
class
baroque.defaults.eventtypes.
StateTransitionEventType
(owner=None)¶ Bases:
baroque.entities.eventtype.EventType
Describes events cast when something changes its state. Suitable i.e. to track state machines changes. Old and new states are conveyed in the event payload, as well as the cause of the state transition.
Parameters: owner (str, optional) – ID of the owner of this event type.
baroque.defaults.reactors module¶
-
class
baroque.defaults.reactors.
ReactorFactory
¶ Bases:
object
A factory class that exposes methods to quickly create useful
baroque.entities.reactor.Reactor
instances-
classmethod
call_function
(obj, function_name, *args, **kwargs)¶ Factory method returning a reactor that calls a method on an object.
Parameters: - obj (object) – the target object
- function_name (function) – the function to be invoked on the object
Returns:
-
classmethod
json_webhook
(url, payload, query_params=None, headers=None)¶ Factory method returning a reactor that POSTs arbitrary JSON data to a webhook, along with the specified HTTP headers.
Parameters: - url (str) – the webhook URL
- payload (dict) – payload data dict to be dumped to JSON and sent
- query_params (dict) – dict of query parameters
- headers (dict) – dict of headers
Returns: A dict containing the response HTTP status code (int) and payload (str), ie:
{'status': 200, 'payload': None}
-
classmethod
log_event
(logger, loglevel)¶ Factory method returning a reactor that logs on a logger at a specified loglevel.
Parameters: - logger (
logging.Logger
) – the logger object - loglevel (int) – the logging level
Returns: - logger (
-
classmethod
stdout
()¶ Factory method returning a reactor that prints events to stdout.
Returns: baroque.entities.reactor.Reactor
-
classmethod