coffre ObsiGate Phase 4 (issue #22) : app/routers/agent.py
This commit is contained in:
+10
-1
@@ -673,6 +673,8 @@ def create_connectors_route(request: Request, body: dict = Body(default={})):
|
|||||||
body.get("name") or "", body.get("url") or "", str(body.get("secret") or ""),
|
body.get("name") or "", body.get("url") or "", str(body.get("secret") or ""),
|
||||||
kind=str(body.get("kind") or "custom"),
|
kind=str(body.get("kind") or "custom"),
|
||||||
auth=str(body.get("auth") or "bearer"),
|
auth=str(body.get("auth") or "bearer"),
|
||||||
|
workspace_id=body.get("workspace_id"),
|
||||||
|
coffre_reference=body.get("coffre_reference"),
|
||||||
)
|
)
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||||
@@ -682,11 +684,17 @@ def create_connectors_route(request: Request, body: dict = Body(default={})):
|
|||||||
def update_connectors_route(request: Request, connector_id: int, body: dict = Body(default={})):
|
def update_connectors_route(request: Request, connector_id: int, body: dict = Body(default={})):
|
||||||
_current_user_id(request)
|
_current_user_id(request)
|
||||||
try:
|
try:
|
||||||
|
kwargs = {}
|
||||||
|
if "workspace_id" in body:
|
||||||
|
kwargs["workspace_id"] = body.get("workspace_id")
|
||||||
|
if "coffre_reference" in body:
|
||||||
|
kwargs["coffre_reference"] = body.get("coffre_reference")
|
||||||
row = connectors.update_connector(
|
row = connectors.update_connector(
|
||||||
connector_id,
|
connector_id,
|
||||||
name=body.get("name"),
|
name=body.get("name"),
|
||||||
enabled=body.get("enabled"),
|
enabled=body.get("enabled"),
|
||||||
secret=body.get("secret"),
|
secret=body.get("secret"),
|
||||||
|
**kwargs,
|
||||||
)
|
)
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||||
@@ -711,7 +719,8 @@ async def probe_connectors_route(request: Request, body: dict = Body(default={})
|
|||||||
raise HTTPException(status_code=400, detail="connector est requis")
|
raise HTTPException(status_code=400, detail="connector est requis")
|
||||||
user_id = _current_user_id(request)
|
user_id = _current_user_id(request)
|
||||||
try:
|
try:
|
||||||
return await connectors.probe(target, user_id)
|
return await connectors.probe(target, user_id,
|
||||||
|
workspace_id=body.get("workspace_id"))
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
raise HTTPException(status_code=404, detail=str(exc)) from exc
|
raise HTTPException(status_code=404, detail=str(exc)) from exc
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user