prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Endpoint to disable telemtry
  fairly self explainatory, add and an endpoint to the HTTP API that can be used to disable/enable the telemtry.
  
  Endpoint to disable telemtry
  fairly self explainatory, add and an endpoint to the HTTP API that can be used to disable/enable the telemtry.
  
  
  </issue>
  <code>
  [start of mindsdb/api/http/namespaces/util.py]
  1 from flask import request
  2 from flask_restx import Resource, abort
  3 from flask import current_app as ca
  4 
  5 from mindsdb.api.http.namespaces.configs.util import ns_conf
  6 from mindsdb import __about__
  7 
  8 @ns_conf.route('/ping')
  9 class Ping(Resource):
  10     @ns_conf.doc('get_ping')
  11     def get(self):
  12         '''Checks server avaliable'''
  13         return {'status': 'ok'}
  14 
  15 @ns_conf.route('/report_uuid')
  16 class ReportUUID(Resource):
  17     @ns_conf.doc('get_report_uuid')
  18     def get(self):
  19         metamodel_name = '___monitroing_metamodel___'
  20         predictor = ca.mindsdb_native.create(metamodel_name)
  21         return {
  22             'report_uuid': predictor.report_uuid
  23         }
  24
  [end of mindsdb/api/http/namespaces/util.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/mindsdb/api/http/namespaces/util.py b/mindsdb/api/http/namespaces/util.py
  --- a/mindsdb/api/http/namespaces/util.py
  +++ b/mindsdb/api/http/namespaces/util.py
  @@ -1,3 +1,4 @@
  +import os
   from flask import request
   from flask_restx import Resource, abort
   from flask import current_app as ca
  @@ -5,6 +6,8 @@
   from mindsdb.api.http.namespaces.configs.util import ns_conf
   from mindsdb import __about__
   
  +TELEMETRY_FILE = 'telemetry.lock'
  +
   @ns_conf.route('/ping')
   class Ping(Resource):
       @ns_conf.doc('get_ping')
  @@ -21,3 +24,34 @@
           return {
               'report_uuid': predictor.report_uuid
           }
  +
  +@ns_conf.route('/telemetry')
  +class Telemetry(Resource):
  +    @ns_conf.doc('get_telemetry_status')
  +    def get(self):
  +        status = "enabled" if is_telemetry_active() else "disabled"
  +        return {"status": status}
  +
  +    @ns_conf.doc('set_telemetry')
  +    def post(self):
  +        data = request.json
  +        action = data['action']
  +        if str(action).lower() in ["true", "enable", "on"]:
  +            enable_telemetry()
  +        else:
  +            disable_telemetry()
  +
  +
  +def enable_telemetry():
  +    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)
  +    if os.path.exists(path):
  +        os.remove(path)
  +
  +def disable_telemetry():
  +    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)
  +    with open(path, 'w') as _:
  +        pass
  +
  +def is_telemetry_active():
  +    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)
  +    return not os.path.exists(path)
  
verification_info: {"golden_diff": "diff --git a/mindsdb/api/http/namespaces/util.py b/mindsdb/api/http/namespaces/util.py\n--- a/mindsdb/api/http/namespaces/util.py\n+++ b/mindsdb/api/http/namespaces/util.py\n@@ -1,3 +1,4 @@\n+import os\n from flask import request\n from flask_restx import Resource, abort\n from flask import current_app as ca\n@@ -5,6 +6,8 @@\n from mindsdb.api.http.namespaces.configs.util import ns_conf\n from mindsdb import __about__\n \n+TELEMETRY_FILE = 'telemetry.lock'\n+\n @ns_conf.route('/ping')\n class Ping(Resource):\n     @ns_conf.doc('get_ping')\n@@ -21,3 +24,34 @@\n         return {\n             'report_uuid': predictor.report_uuid\n         }\n+\n+@ns_conf.route('/telemetry')\n+class Telemetry(Resource):\n+    @ns_conf.doc('get_telemetry_status')\n+    def get(self):\n+        status = \"enabled\" if is_telemetry_active() else \"disabled\"\n+        return {\"status\": status}\n+\n+    @ns_conf.doc('set_telemetry')\n+    def post(self):\n+        data = request.json\n+        action = data['action']\n+        if str(action).lower() in [\"true\", \"enable\", \"on\"]:\n+            enable_telemetry()\n+        else:\n+            disable_telemetry()\n+\n+\n+def enable_telemetry():\n+    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)\n+    if os.path.exists(path):\n+        os.remove(path)\n+\n+def disable_telemetry():\n+    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)\n+    with open(path, 'w') as _:\n+        pass\n+\n+def is_telemetry_active():\n+    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)\n+    return not os.path.exists(path)\n", "issue": "Endpoint to disable telemtry\nfairly self explainatory, add and an endpoint to the HTTP API that can be used to disable/enable the telemtry.\r\n\nEndpoint to disable telemtry\nfairly self explainatory, add and an endpoint to the HTTP API that can be used to disable/enable the telemtry.\r\n\n", "before_files": [{"content": "from flask import request\nfrom flask_restx import Resource, abort\nfrom flask import current_app as ca\n\nfrom mindsdb.api.http.namespaces.configs.util import ns_conf\nfrom mindsdb import __about__\n\n@ns_conf.route('/ping')\nclass Ping(Resource):\n    @ns_conf.doc('get_ping')\n    def get(self):\n        '''Checks server avaliable'''\n        return {'status': 'ok'}\n\n@ns_conf.route('/report_uuid')\nclass ReportUUID(Resource):\n    @ns_conf.doc('get_report_uuid')\n    def get(self):\n        metamodel_name = '___monitroing_metamodel___'\n        predictor = ca.mindsdb_native.create(metamodel_name)\n        return {\n            'report_uuid': predictor.report_uuid\n        }\n", "path": "mindsdb/api/http/namespaces/util.py"}]}