ahilashsasidharan commented on code in PR #63994:
URL: https://github.com/apache/airflow/pull/63994#discussion_r3069416446
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/pools.py:
##########
@@ -157,27 +165,55 @@ def patch_pool(
"",
status_code=status.HTTP_201_CREATED,
responses=create_openapi_http_exception_doc(
- [status.HTTP_409_CONFLICT]
- ), # handled by global exception handler
+ [
+ status.HTTP_400_BAD_REQUEST,
+ status.HTTP_409_CONFLICT, # handled by global exception handler
+ ]
+ ),
dependencies=[Depends(requires_access_pool(method="POST")),
Depends(action_logging())],
)
def post_pool(
body: PoolBody,
session: SessionDep,
) -> PoolResponse:
"""Create a Pool."""
+ if body.team_name is not None and not conf.getboolean("core",
"multi_team"):
+ raise HTTPException(
+ status.HTTP_400_BAD_REQUEST,
+ MULTI_TEAM_ERROR_MESSAGE,
+ )
+
pool = Pool(**body.model_dump())
session.add(pool)
return pool
@pools_router.patch(
"",
+ responses=create_openapi_http_exception_doc([status.HTTP_400_BAD_REQUEST]),
dependencies=[Depends(requires_access_pool_bulk()),
Depends(action_logging())],
)
def bulk_pools(
request: BulkBody[PoolBody],
session: SessionDep,
) -> BulkResponse:
"""Bulk create, update, and delete pools."""
+ if not conf.getboolean("core", "multi_team"):
+ invalid_entities = []
+
+ for action in request.actions:
+ if action.action == BulkAction.CREATE or action.action ==
BulkAction.UPDATE:
+ for entity in action.entities:
+ if isinstance(entity, PoolBody) and entity.team_name is
not None:
+ invalid_entities.append(entity.pool)
Review Comment:
No longer relevant. Code has been removed.
--
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]