def get_alert(alert_id): resp = None if grafana_org_utils.get_current_org_name()["name"] == \ constants.ALERT_ORG: resp = dashboard_utils.get_alert(alert_id) elif switch_context(constants.ALERT_ORG): resp = dashboard_utils.get_alert(alert_id) # return to main org switch_context(constants.MAIN_ORG) return resp.json()
def delete_alert_dashboard(dashboard_name): slug = "alerts-" + str(dashboard_name)[:-1] + "-dashboard" dashboard_json = {} if grafana_org_utils.get_current_org_name()["name"] == \ constants.ALERT_ORG: dashboard_json = dashboard_utils.delete_dashboard(slug) elif switch_context(constants.ALERT_ORG): dashboard_json = dashboard_utils.delete_dashboard(slug) # return to main org switch_context(constants.MAIN_ORG) return dashboard_json