anishgirianish commented on code in PR #62343:
URL: https://github.com/apache/airflow/pull/62343#discussion_r2971264843


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/connections.py:
##########
@@ -174,6 +189,70 @@ def bulk_connections(
     return BulkConnectionService(session=session, 
request=request).handle_request()
 
 
+@connections_router.patch(
+    "/{connection_id}/test",
+    responses=create_openapi_http_exception_doc(
+        [
+            status.HTTP_400_BAD_REQUEST,
+            status.HTTP_403_FORBIDDEN,
+            status.HTTP_404_NOT_FOUND,
+        ]
+    ),
+    dependencies=[Depends(requires_access_connection(method="PUT")), 
Depends(action_logging())],
+)
+def patch_connection_and_test(
+    connection_id: str,
+    patch_body: ConnectionBody,
+    session: SessionDep,
+    update_mask: list[str] | None = Query(None),
+    executor: str | None = Query(None, description="Executor to route the 
connection test to"),
+    queue: str | None = Query(None, description="Queue to route the connection 
test to"),
+) -> ConnectionSaveAndTestResponse:
+    """
+    Update a connection and queue an async test with revert-on-failure.
+
+    Atomically saves the edit and creates a ConnectionTest with snapshots of 
the
+    pre-edit and post-edit state. If the test fails, the connection is 
automatically
+    reverted to its pre-edit values.
+    """
+    _ensure_test_connection_enabled()
+
+    if patch_body.connection_id != connection_id:
+        raise HTTPException(
+            status.HTTP_400_BAD_REQUEST,
+            "The connection_id in the request body does not match the URL 
parameter",
+        )
+
+    connection = 
session.scalar(select(Connection).filter_by(conn_id=connection_id).limit(1))
+    if connection is None:
+        raise HTTPException(
+            status.HTTP_404_NOT_FOUND,
+            f"The Connection with connection_id: `{connection_id}` was not 
found",
+        )
+
+    try:
+        ConnectionBody(**patch_body.model_dump())

Review Comment:
   Addressed, this entire endpoint is removed in the redesign.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to