Coverage for /home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/execution_api/routes/__init__.py: 100%
22 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 14:22 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 14:22 +0000
1# Licensed to the Apache Software Foundation (ASF) under one
2# or more contributor license agreements. See the NOTICE file
3# distributed with this work for additional information
4# regarding copyright ownership. The ASF licenses this file
5# to you under the Apache License, Version 2.0 (the
6# "License"); you may not use this file except in compliance
7# with the License. You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing,
12# software distributed under the License is distributed on an
13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14# KIND, either express or implied. See the License for the
15# specific language governing permissions and limitations
16# under the License.
17from __future__ import annotations
19from cadwyn import VersionedAPIRouter
20from fastapi import APIRouter, Security
22from airflow.api_fastapi.execution_api.routes import (
23 asset_events,
24 asset_state_store,
25 assets,
26 connection_tests,
27 connections,
28 dag_runs,
29 dags,
30 health,
31 hitl,
32 task_instances,
33 task_reschedules,
34 task_state_store,
35 variables,
36 xcoms,
37)
38from airflow.api_fastapi.execution_api.security import require_auth
40execution_api_router = APIRouter()
41# health.router declares its full paths ("/health", "/health/ping") and is included without a
42# prefix, unlike the routers below. A root route registered as @router.get("") under an include-time
43# prefix=... raises "Prefix and path cannot be both empty" once FastAPI switched to lazy router
44# inclusion (>=0.137); see https://github.com/apache/airflow/issues/68562. Don't reintroduce a prefix here.
45execution_api_router.include_router(health.router, tags=["Health"])
47# _Every_ single endpoint under here must be authenticated. Some do further checks on top of these
48authenticated_router = VersionedAPIRouter(dependencies=[Security(require_auth)]) # type: ignore[list-item]
50authenticated_router.include_router(assets.router, prefix="/assets", tags=["Assets"])
51authenticated_router.include_router(asset_events.router, prefix="/asset-events", tags=["Asset Events"])
52authenticated_router.include_router(
53 connection_tests.router, prefix="/connection-tests", tags=["Connection Tests"]
54)
55authenticated_router.include_router(connections.router, prefix="/connections", tags=["Connections"])
56authenticated_router.include_router(dag_runs.router, prefix="/dag-runs", tags=["Dag Runs"])
57authenticated_router.include_router(dags.router, prefix="/dags", tags=["Dags"])
58authenticated_router.include_router(task_instances.router, prefix="/task-instances", tags=["Task Instances"])
59authenticated_router.include_router(
60 task_reschedules.router, prefix="/task-reschedules", tags=["Task Reschedules"]
61)
62authenticated_router.include_router(variables.router, prefix="/variables", tags=["Variables"])
63authenticated_router.include_router(xcoms.router, prefix="/xcoms", tags=["XComs"])
64authenticated_router.include_router(hitl.router, prefix="/hitlDetails", tags=["Human in the Loop"])
65authenticated_router.include_router(task_state_store.router, prefix="/store/ti", tags=["Task State Store"])
66authenticated_router.include_router(
67 asset_state_store.router, prefix="/store/asset", tags=["Asset State Store"]
68)
70execution_api_router.include_router(authenticated_router)