def delete_event_source(trigger_storage: TriggerStorage, workspace: str, event_source_name: str): if trigger_storage.key_exists(workspace=workspace, document_id='event_sources', key=event_source_name): trigger_storage.delete_key(workspace=workspace, document_id='event_sources', key=event_source_name) return { "message": "Event source {} deleted".format(event_source_name) }, 200 else: return { "error": "Event source {} not found".format(event_source_name) }, 404
def delete_trigger(trigger_storage: TriggerStorage, workspace: str, trigger_id: str): deleted = trigger_storage.delete_key(workspace=workspace, document_id='triggers', key=trigger_id) if deleted != 0: return {'message': 'Deleted {}'.format(trigger_id)}, 200 else: return {'error': 'Trigger {} not found'.format(trigger_id)}, 404