The openstack_dashboard.openstack.common.notifier.api ModuleΒΆ
- exception openstack_dashboard.openstack.common.notifier.api.BadPriorityException[source]
Bases: exceptions.Exception
- openstack_dashboard.openstack.common.notifier.api.add_driver(notification_driver)[source]
Add a notification driver at runtime.
- openstack_dashboard.openstack.common.notifier.api.notify(context, publisher_id, event_type, priority, payload)[source]
Sends a notification using the specified driver
Parameters: - publisher_id – the source worker_type.host of the message
- event_type – the literal type of event (ex. Instance Creation)
- priority – patterned after the enumeration of Python logging levels in the set (DEBUG, WARN, INFO, ERROR, CRITICAL)
- payload – A python dictionary of attributes
Outgoing message format includes the above parameters, and appends the following:
- message_id
- a UUID representing the id for this notification
- timestamp
- the GMT timestamp the notification was sent at
The composite message will be constructed as a dictionary of the above attributes, which will then be sent via the transport mechanism defined by the driver.
Message example:
{'message_id': str(uuid.uuid4()), 'publisher_id': 'compute.host1', 'timestamp': timeutils.utcnow(), 'priority': 'WARN', 'event_type': 'compute.create_instance', 'payload': {'instance_id': 12, ... }}
- openstack_dashboard.openstack.common.notifier.api.notify_decorator(name, fn)[source]
Decorator for notify which is used from utils.monkey_patch().
Parameters: - name – name of the function
- function –
- object of the function
Returns: function – decorated function
- openstack_dashboard.openstack.common.notifier.api.publisher_id(service, host=None)[source]