From f3bad1e9e173565e035e5c3d2a47eb8a0cb0de97 Mon Sep 17 00:00:00 2001 From: Pierre Jeambrun Date: Mon, 18 Nov 2024 19:59:04 +0800 Subject: [PATCH] AIP-84 Clean status code (#44134) --- .../core_api/routes/public/connections.py | 6 ------ .../core_api/routes/public/event_logs.py | 1 - .../core_api/routes/public/pools.py | 4 +--- .../core_api/routes/public/task_instances.py | 20 +++++-------------- 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/airflow/api_fastapi/core_api/routes/public/connections.py b/airflow/api_fastapi/core_api/routes/public/connections.py index f1e71eb0f485..406d689d5e9e 100644 --- a/airflow/api_fastapi/core_api/routes/public/connections.py +++ b/airflow/api_fastapi/core_api/routes/public/connections.py @@ -180,12 +180,6 @@ def patch_connection( @connections_router.post( "/test", - responses=create_openapi_http_exception_doc( - [ - status.HTTP_401_UNAUTHORIZED, - status.HTTP_403_FORBIDDEN, - ] - ), ) def test_connection( test_body: ConnectionBody, diff --git a/airflow/api_fastapi/core_api/routes/public/event_logs.py b/airflow/api_fastapi/core_api/routes/public/event_logs.py index 6405c177a390..1a0e7fad2f63 100644 --- a/airflow/api_fastapi/core_api/routes/public/event_logs.py +++ b/airflow/api_fastapi/core_api/routes/public/event_logs.py @@ -62,7 +62,6 @@ def get_event_log( @event_logs_router.get( "/", - responses=create_openapi_http_exception_doc([status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN]), ) def get_event_logs( limit: QueryLimit, diff --git a/airflow/api_fastapi/core_api/routes/public/pools.py b/airflow/api_fastapi/core_api/routes/public/pools.py index 07ed0f6a0b5e..b3874347b415 100644 --- a/airflow/api_fastapi/core_api/routes/public/pools.py +++ b/airflow/api_fastapi/core_api/routes/public/pools.py @@ -66,9 +66,7 @@ def delete_pool( @pools_router.get( "/{pool_name}", - responses=create_openapi_http_exception_doc( - [status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN, status.HTTP_404_NOT_FOUND] - ), + responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), ) def get_pool( pool_name: str, diff --git a/airflow/api_fastapi/core_api/routes/public/task_instances.py b/airflow/api_fastapi/core_api/routes/public/task_instances.py index 271f75e69e68..c805095f5820 100644 --- a/airflow/api_fastapi/core_api/routes/public/task_instances.py +++ b/airflow/api_fastapi/core_api/routes/public/task_instances.py @@ -97,9 +97,7 @@ def get_task_instance( @task_instances_router.get( "/{task_id}/listMapped", - responses=create_openapi_http_exception_doc( - [status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN, status.HTTP_404_NOT_FOUND] - ), + responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), ) def get_mapped_task_instances( dag_id: str, @@ -182,15 +180,11 @@ def get_mapped_task_instances( @task_instances_router.get( "/{task_id}/dependencies", - responses=create_openapi_http_exception_doc( - [status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN, status.HTTP_404_NOT_FOUND] - ), + responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), ) @task_instances_router.get( "/{task_id}/{map_index}/dependencies", - responses=create_openapi_http_exception_doc( - [status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN, status.HTTP_404_NOT_FOUND] - ), + responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), ) def get_task_instance_dependencies( dag_id: str, @@ -240,9 +234,7 @@ def get_task_instance_dependencies( @task_instances_router.get( "/{task_id}/{map_index}", - responses=create_openapi_http_exception_doc( - [status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN, status.HTTP_404_NOT_FOUND] - ), + responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), ) def get_mapped_task_instance( dag_id: str, @@ -271,9 +263,7 @@ def get_mapped_task_instance( @task_instances_router.get( "/", - responses=create_openapi_http_exception_doc( - [status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN, status.HTTP_404_NOT_FOUND] - ), + responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), ) def get_task_instances( dag_id: str,