def put(self, id, event_trigger): """Updates an existing event trigger. The exchange, topic and event can not be updated. The right way to change them is to delete the event trigger first, then create a new event trigger with new params. """ acl.enforce('event_trigger:update', auth_ctx.ctx()) values = event_trigger.to_dict() for field in UPDATE_NOT_ALLOWED: if values.get(field, None): raise exc.EventTriggerException( "Can not update fields %s of event trigger." % UPDATE_NOT_ALLOWED ) LOG.info('Update event trigger: [id=%s, values=%s]', id, values) with db_api.transaction(): db_api.ensure_event_trigger_exists(id) db_model = triggers.update_event_trigger(id, values) return resources.EventTrigger.from_dict(db_model.to_dict())
def _update_event_trigger(): with db_api.transaction(): # ensure that event trigger exists db_api.get_event_trigger(id) return triggers.update_event_trigger(id, values)