def get_heartbeat(id): try: heartbeat = db.get_heartbeat(id=id) except Exception as e: return jsonify(status="error", message=str(e)), 500 if heartbeat: body = heartbeat.get_body() body['href'] = request.base_url return jsonify(status="ok", total=1, heartbeat=body) else: return jsonify(status="error", message="not found", total=0, heartbeat=None), 404
def get_heartbeat(id): try: heartbeat = db.get_heartbeat(id=id) except Exception as e: return jsonify(status="error", message=str(e)), 500 if heartbeat: if g.get('role', None) != 'admin' and not heartbeat.customer == g.get('customer', None): return jsonify(status="error", message="not found", total=0, alert=None), 404 body = heartbeat.get_body() body['href'] = absolute_url('/hearbeat/' + heartbeat.id) return jsonify(status="ok", total=1, heartbeat=body) else: return jsonify(status="error", message="not found", total=0, heartbeat=None), 404
def get_heartbeat(id): customer = g.get('customer', None) try: heartbeat = db.get_heartbeat(id=id, customer=customer) except Exception as e: return jsonify(status="error", message=str(e)), 500 if heartbeat: body = heartbeat.get_body() body['href'] = absolute_url('/hearbeat/' + heartbeat.id) return jsonify(status="ok", total=1, heartbeat=body) else: return jsonify(status="error", message="not found", total=0, heartbeat=None), 404
def get_heartbeat(id): try: heartbeat = db.get_heartbeat(id=id) except Exception as e: return jsonify(status="error", message=str(e)), 500 if heartbeat: if g.get('role', None) != 'admin' and not heartbeat.customer == g.get('customer', None): return jsonify(status="error", message="not found", total=0, alert=None), 404 body = heartbeat.get_body() body['href'] = request.base_url return jsonify(status="ok", total=1, heartbeat=body) else: return jsonify(status="error", message="not found", total=0, heartbeat=None), 404
def get_heartbeat(tenant,id): tenant = generateDBName(tenant) try: heartbeat = db.get_heartbeat(tenant, id=id) except Exception as e: return jsonify(status="error", message=str(e)), 500 if heartbeat: if g.get('role', None) != 'admin' and not heartbeat.customer == g.get('customer', None): return jsonify(status="error", message="not found", total=0, alert=None), 404 body = heartbeat.get_body() body['href'] = request.base_url return jsonify(status="ok", total=1, heartbeat=body) else: return jsonify(status="error", message="not found", total=0, heartbeat=None), 404
def find_by_id(id: str, customers: List[str]=None) -> Optional['Heartbeat']: return Heartbeat.from_db(db.get_heartbeat(id, customers))
def get(id, customer=None): return Heartbeat.from_db(db.get_heartbeat(id, customer))
def find_by_id(id, customer=None): return Heartbeat.from_db(db.get_heartbeat(id, customer))
def find_by_id(id, customers=None): return Heartbeat.from_db(db.get_heartbeat(id, customers))