Beispiel #1
0
def get_trigger(trigger_storage: TriggerStorage, workspace: str,
                trigger_id: str):
    trigger = trigger_storage.get_key(workspace=workspace,
                                      document_id='triggers',
                                      key=trigger_id)

    if trigger is not None:
        return {trigger_id: trigger}, 200
    else:
        return {'error': 'Trigger {} not found'.format(trigger_id)}, 404
def get_event_source(trigger_storage: TriggerStorage, workspace: str,
                     event_source_name: str):
    event_source = trigger_storage.get_key(workspace=workspace,
                                           document_id='event_sources',
                                           key=event_source_name)

    if event_source is not None:
        return {event_source_name: event_source}, 200
    else:
        return {
            "error": "Event source {} not found".format(event_source_name)
        }, 404