@cryptotaxi247 / CoPilot / commits / 7fa25096

remove old connector routes (#15)

taylor_socfortress committed Jul 12, 2023 at 15:36 UTC 7fa25096a5b9730d0a748a5c4d796dbdcf734c40
1 file changed -96
backend/app/routes/connectors.py
-96
@@ -1,99 +1,3 @@
1 -# from flask import Blueprint
2 -# from flask import jsonify
3 -# from flask import request
4 -# from loguru import logger
5 -
6 -# from app import db
7 -# from app.models.models import Connectors
8 -# from app.models.models import ConnectorsAvailable
9 -# from app.models.models import connectors_available_schema
10 -# from app.services.connectors.connectors import ConnectorService
11 -
12 -# bp = Blueprint("connectors", __name__)
13 -
14 -
15 -# @bp.route("/connectors", methods=["GET"])
16 -# def list_connectors_available():
17 -# """
18 -# Endpoint to retrieve all available connectors.
19 -
20 -# Returns:
21 -# json: A JSON response containing the list of all available connectors along with their connection verification status.
22 -# """
23 -# logger.info("Received request to get all available connectors")
24 -# connectors_service = ConnectorService(db)
25 -# connectors = ConnectorsAvailable.query.all()
26 -# result = connectors_available_schema.dump(connectors)
27 -
28 -# instantiated_connectors = [
29 -# connectors_service.process_connector(connector["connector_name"])
30 -# for connector in result
31 -# if connectors_service.process_connector(connector["connector_name"])
32 -# ]
33 -
34 -# return jsonify(instantiated_connectors)
35 -
36 -
37 -# @bp.route("/connectors/<id>", methods=["GET"])
38 -# def get_connector_details(id: str):
39 -# """
40 -# Endpoint to retrieve the details of a connector.
41 -
42 -# Args:
43 -# id (str): The ID of the connector to retrieve.
44 -
45 -# Returns:
46 -# json: A JSON response containing the details of the connector.
47 -# """
48 -# logger.info("Received request to get a connector details")
49 -# service = ConnectorService(db)
50 -# connector = service.validate_connector_exists(int(id))
51 -
52 -# if connector["success"]:
53 -# connector = Connectors.query.get(id)
54 -# instantiated_connector = service.process_connector(connector.connector_name)
55 -# return jsonify(instantiated_connector)
56 -# else:
57 -# return jsonify(connector), 404
58 -
59 -
60 -# @bp.route("/connectors/<id>", methods=["PUT"])
61 -# def update_connector_route(id: str):
62 -# """
63 -# Endpoint to update the details of a connector.
64 -
65 -# Args:
66 -# id (str): The ID of the connector to update.
67 -
68 -# Returns:
69 -# json: A JSON response containing the success status of the update operation and a message indicating the status.
70 -# If the update operation was successful, it returns the connector name and the status of the connection verification.
71 -# """
72 -# logger.info("Received request to update connector")
73 -# api_key_connector = ["Shuffle", "DFIR-IRIS", "Velociraptor"]
74 -
75 -# request_data = request.get_json()
76 -# service = ConnectorService(db)
77 -# connector = service.validate_connector_exists(int(id))
78 -
79 -# if connector["success"]:
80 -# if connector["connector_name"] in api_key_connector:
81 -# data_validated = service.validate_request_data_api_key(request_data)
82 -# if data_validated["success"]:
83 -# service.update_connector(int(id), request_data)
84 -# return service.verify_connector_connection(int(id))
85 -# else:
86 -# return jsonify(data_validated), 400
87 -# else:
88 -# data_validated = service.validate_request_data(request_data)
89 -# if data_validated["success"]:
90 -# service.update_connector(int(id), request_data)
91 -# return service.verify_connector_connection(int(id))
92 -# else:
93 -# return jsonify(data_validated), 400
94 -# else:
95 -# return jsonify(connector), 404
96 -
1 from flask import Blueprint
2 from flask import jsonify
3 from flask import request