From d3d166005000e2a3760512923500e7cf1a25db5e Mon Sep 17 00:00:00 2001 From: LIU ZHE YOU Date: Fri, 28 Feb 2025 21:07:43 +0800 Subject: [PATCH 1/2] AIP-84 | Add Auth for Variable --- .../core_api/openapi/v1-generated.yaml | 50 +++++++++++++- .../core_api/routes/public/variables.py | 9 ++- airflow/api_fastapi/core_api/security.py | 18 +++++ airflow/ui/openapi-gen/queries/common.ts | 7 +- airflow/ui/openapi-gen/queries/prefetch.ts | 13 +++- airflow/ui/openapi-gen/queries/queries.ts | 22 ++++-- airflow/ui/openapi-gen/queries/suspense.ts | 8 ++- .../ui/openapi-gen/requests/services.gen.ts | 10 +++ airflow/ui/openapi-gen/requests/types.gen.ts | 9 ++- .../core_api/routes/public/test_variables.py | 68 +++++++++++++++++++ 10 files changed, 195 insertions(+), 19 deletions(-) diff --git a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml index 259efb6cd4940..02147b11e09f1 100644 --- a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml +++ b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml @@ -6336,12 +6336,16 @@ paths: summary: Delete Variable description: Delete a variable entry. operationId: delete_variable + security: + - OAuth2PasswordBearer: [] parameters: - name: variable_key in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Variable Key responses: '204': @@ -6376,12 +6380,16 @@ paths: summary: Get Variable description: Get a variable entry. operationId: get_variable + security: + - OAuth2PasswordBearer: [] parameters: - name: variable_key in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Variable Key responses: '200': @@ -6420,12 +6428,16 @@ paths: summary: Patch Variable description: Update a variable by key. operationId: patch_variable + security: + - OAuth2PasswordBearer: [] parameters: - name: variable_key in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Variable Key - name: update_mask in: query @@ -6487,7 +6499,17 @@ paths: summary: Get Variables description: Get all Variables entries. operationId: get_variables + security: + - OAuth2PasswordBearer: [] parameters: + - name: variable_key + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + title: Variable Key - name: limit in: query required: false @@ -6550,6 +6572,17 @@ paths: summary: Post Variable description: Create a variable. operationId: post_variable + security: + - OAuth2PasswordBearer: [] + parameters: + - name: variable_key + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + title: Variable Key requestBody: required: true content: @@ -6593,6 +6626,17 @@ paths: summary: Bulk Variables description: Bulk create, update, and delete variables. operationId: bulk_variables + security: + - OAuth2PasswordBearer: [] + parameters: + - name: variable_key + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + title: Variable Key requestBody: required: true content: diff --git a/airflow/api_fastapi/core_api/routes/public/variables.py b/airflow/api_fastapi/core_api/routes/public/variables.py index e8898ce69570a..b1b9d232b85d3 100644 --- a/airflow/api_fastapi/core_api/routes/public/variables.py +++ b/airflow/api_fastapi/core_api/routes/public/variables.py @@ -38,6 +38,7 @@ VariableResponse, ) from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc +from airflow.api_fastapi.core_api.security import requires_access_variable from airflow.api_fastapi.core_api.services.public.variables import BulkVariableService from airflow.api_fastapi.logging.decorators import action_logging from airflow.models.variable import Variable @@ -49,6 +50,7 @@ "/{variable_key}", status_code=status.HTTP_204_NO_CONTENT, responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), + dependencies=[Depends(requires_access_variable("DELETE"))], ) def delete_variable( variable_key: str, @@ -64,6 +66,7 @@ def delete_variable( @variables_router.get( "/{variable_key}", responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), + dependencies=[Depends(requires_access_variable("GET"))], ) def get_variable( variable_key: str, @@ -82,6 +85,7 @@ def get_variable( @variables_router.get( "", + dependencies=[Depends(requires_access_variable("GET"))], ) def get_variables( limit: QueryLimit, @@ -124,6 +128,7 @@ def get_variables( status.HTTP_404_NOT_FOUND, ] ), + dependencies=[Depends(requires_access_variable("PUT"))], ) def patch_variable( variable_key: str, @@ -164,7 +169,7 @@ def patch_variable( "", status_code=status.HTTP_201_CREATED, responses=create_openapi_http_exception_doc([status.HTTP_409_CONFLICT]), - dependencies=[Depends(action_logging())], + dependencies=[Depends(action_logging()), Depends(requires_access_variable("POST"))], ) def post_variable( post_body: VariableBody, @@ -186,7 +191,7 @@ def post_variable( return variable -@variables_router.patch("") +@variables_router.patch("", dependencies=[Depends(requires_access_variable("PUT"))]) def bulk_variables( request: BulkBody[VariableBody], session: SessionDep, diff --git a/airflow/api_fastapi/core_api/security.py b/airflow/api_fastapi/core_api/security.py index 2b267beaa8e0b..c980b075fbfa7 100644 --- a/airflow/api_fastapi/core_api/security.py +++ b/airflow/api_fastapi/core_api/security.py @@ -30,6 +30,7 @@ DagAccessEntity, DagDetails, PoolDetails, + VariableDetails, ) from airflow.configuration import conf from airflow.utils.jwt_signer import JWTSigner, get_signing_key @@ -130,6 +131,23 @@ def callback(): return inner +def requires_access_variable(method: ResourceMethod) -> Callable[[str | None, BaseUser | None], None]: + def inner( + variable_key: str | None = None, + user: Annotated[BaseUser | None, Depends(get_user)] = None, + ) -> None: + def callback(): + return get_auth_manager().is_authorized_variable( + method=method, details=VariableDetails(key=variable_key), user=user + ) + + _requires_access( + is_authorized_callback=callback, + ) + + return inner + + def _requires_access( *, is_authorized_callback: Callable[[], bool], diff --git a/airflow/ui/openapi-gen/queries/common.ts b/airflow/ui/openapi-gen/queries/common.ts index 151e3b100a9cf..2324a18c3b23e 100644 --- a/airflow/ui/openapi-gen/queries/common.ts +++ b/airflow/ui/openapi-gen/queries/common.ts @@ -1656,15 +1656,20 @@ export const UseVariableServiceGetVariablesKeyFn = ( limit, offset, orderBy, + variableKey, variableKeyPattern, }: { limit?: number; offset?: number; orderBy?: string; + variableKey?: string; variableKeyPattern?: string; } = {}, queryKey?: Array, -) => [useVariableServiceGetVariablesKey, ...(queryKey ?? [{ limit, offset, orderBy, variableKeyPattern }])]; +) => [ + useVariableServiceGetVariablesKey, + ...(queryKey ?? [{ limit, offset, orderBy, variableKey, variableKeyPattern }]), +]; export type DagVersionServiceGetDagVersionsDefaultResponse = Awaited< ReturnType >; diff --git a/airflow/ui/openapi-gen/queries/prefetch.ts b/airflow/ui/openapi-gen/queries/prefetch.ts index c833e4268706b..df028449452d8 100644 --- a/airflow/ui/openapi-gen/queries/prefetch.ts +++ b/airflow/ui/openapi-gen/queries/prefetch.ts @@ -2315,6 +2315,7 @@ export const prefetchUseVariableServiceGetVariable = ( * Get Variables * Get all Variables entries. * @param data The data for the request. + * @param data.variableKey * @param data.limit * @param data.offset * @param data.orderBy @@ -2328,17 +2329,25 @@ export const prefetchUseVariableServiceGetVariables = ( limit, offset, orderBy, + variableKey, variableKeyPattern, }: { limit?: number; offset?: number; orderBy?: string; + variableKey?: string; variableKeyPattern?: string; } = {}, ) => queryClient.prefetchQuery({ - queryKey: Common.UseVariableServiceGetVariablesKeyFn({ limit, offset, orderBy, variableKeyPattern }), - queryFn: () => VariableService.getVariables({ limit, offset, orderBy, variableKeyPattern }), + queryKey: Common.UseVariableServiceGetVariablesKeyFn({ + limit, + offset, + orderBy, + variableKey, + variableKeyPattern, + }), + queryFn: () => VariableService.getVariables({ limit, offset, orderBy, variableKey, variableKeyPattern }), }); /** * Get Dag Versions diff --git a/airflow/ui/openapi-gen/queries/queries.ts b/airflow/ui/openapi-gen/queries/queries.ts index 2fdd58c4ec273..5d442b2b37c72 100644 --- a/airflow/ui/openapi-gen/queries/queries.ts +++ b/airflow/ui/openapi-gen/queries/queries.ts @@ -2725,6 +2725,7 @@ export const useVariableServiceGetVariable = < * Get Variables * Get all Variables entries. * @param data The data for the request. + * @param data.variableKey * @param data.limit * @param data.offset * @param data.orderBy @@ -2741,11 +2742,13 @@ export const useVariableServiceGetVariables = < limit, offset, orderBy, + variableKey, variableKeyPattern, }: { limit?: number; offset?: number; orderBy?: string; + variableKey?: string; variableKeyPattern?: string; } = {}, queryKey?: TQueryKey, @@ -2753,10 +2756,11 @@ export const useVariableServiceGetVariables = < ) => useQuery({ queryKey: Common.UseVariableServiceGetVariablesKeyFn( - { limit, offset, orderBy, variableKeyPattern }, + { limit, offset, orderBy, variableKey, variableKeyPattern }, queryKey, ), - queryFn: () => VariableService.getVariables({ limit, offset, orderBy, variableKeyPattern }) as TData, + queryFn: () => + VariableService.getVariables({ limit, offset, orderBy, variableKey, variableKeyPattern }) as TData, ...options, }); /** @@ -3416,6 +3420,7 @@ export const useXcomServiceCreateXcomEntry = < * Create a variable. * @param data The data for the request. * @param data.requestBody + * @param data.variableKey * @returns VariableResponse Successful Response * @throws ApiError */ @@ -3430,6 +3435,7 @@ export const useVariableServicePostVariable = < TError, { requestBody: VariableBody; + variableKey?: string; }, TContext >, @@ -3441,11 +3447,12 @@ export const useVariableServicePostVariable = < TError, { requestBody: VariableBody; + variableKey?: string; }, TContext >({ - mutationFn: ({ requestBody }) => - VariableService.postVariable({ requestBody }) as unknown as Promise, + mutationFn: ({ requestBody, variableKey }) => + VariableService.postVariable({ requestBody, variableKey }) as unknown as Promise, ...options, }); /** @@ -4275,6 +4282,7 @@ export const useVariableServicePatchVariable = < * Bulk create, update, and delete variables. * @param data The data for the request. * @param data.requestBody + * @param data.variableKey * @returns BulkResponse Successful Response * @throws ApiError */ @@ -4289,6 +4297,7 @@ export const useVariableServiceBulkVariables = < TError, { requestBody: BulkBody_VariableBody_; + variableKey?: string; }, TContext >, @@ -4300,11 +4309,12 @@ export const useVariableServiceBulkVariables = < TError, { requestBody: BulkBody_VariableBody_; + variableKey?: string; }, TContext >({ - mutationFn: ({ requestBody }) => - VariableService.bulkVariables({ requestBody }) as unknown as Promise, + mutationFn: ({ requestBody, variableKey }) => + VariableService.bulkVariables({ requestBody, variableKey }) as unknown as Promise, ...options, }); /** diff --git a/airflow/ui/openapi-gen/queries/suspense.ts b/airflow/ui/openapi-gen/queries/suspense.ts index 48b17556fd9ec..a42352c31237b 100644 --- a/airflow/ui/openapi-gen/queries/suspense.ts +++ b/airflow/ui/openapi-gen/queries/suspense.ts @@ -2702,6 +2702,7 @@ export const useVariableServiceGetVariableSuspense = < * Get Variables * Get all Variables entries. * @param data The data for the request. + * @param data.variableKey * @param data.limit * @param data.offset * @param data.orderBy @@ -2718,11 +2719,13 @@ export const useVariableServiceGetVariablesSuspense = < limit, offset, orderBy, + variableKey, variableKeyPattern, }: { limit?: number; offset?: number; orderBy?: string; + variableKey?: string; variableKeyPattern?: string; } = {}, queryKey?: TQueryKey, @@ -2730,10 +2733,11 @@ export const useVariableServiceGetVariablesSuspense = < ) => useSuspenseQuery({ queryKey: Common.UseVariableServiceGetVariablesKeyFn( - { limit, offset, orderBy, variableKeyPattern }, + { limit, offset, orderBy, variableKey, variableKeyPattern }, queryKey, ), - queryFn: () => VariableService.getVariables({ limit, offset, orderBy, variableKeyPattern }) as TData, + queryFn: () => + VariableService.getVariables({ limit, offset, orderBy, variableKey, variableKeyPattern }) as TData, ...options, }); /** diff --git a/airflow/ui/openapi-gen/requests/services.gen.ts b/airflow/ui/openapi-gen/requests/services.gen.ts index 81b649d31cb97..b38716aeefe49 100644 --- a/airflow/ui/openapi-gen/requests/services.gen.ts +++ b/airflow/ui/openapi-gen/requests/services.gen.ts @@ -3307,6 +3307,7 @@ export class VariableService { * Get Variables * Get all Variables entries. * @param data The data for the request. + * @param data.variableKey * @param data.limit * @param data.offset * @param data.orderBy @@ -3319,6 +3320,7 @@ export class VariableService { method: "GET", url: "/public/variables", query: { + variable_key: data.variableKey, limit: data.limit, offset: data.offset, order_by: data.orderBy, @@ -3337,6 +3339,7 @@ export class VariableService { * Create a variable. * @param data The data for the request. * @param data.requestBody + * @param data.variableKey * @returns VariableResponse Successful Response * @throws ApiError */ @@ -3344,6 +3347,9 @@ export class VariableService { return __request(OpenAPI, { method: "POST", url: "/public/variables", + query: { + variable_key: data.variableKey, + }, body: data.requestBody, mediaType: "application/json", errors: { @@ -3360,6 +3366,7 @@ export class VariableService { * Bulk create, update, and delete variables. * @param data The data for the request. * @param data.requestBody + * @param data.variableKey * @returns BulkResponse Successful Response * @throws ApiError */ @@ -3367,6 +3374,9 @@ export class VariableService { return __request(OpenAPI, { method: "PATCH", url: "/public/variables", + query: { + variable_key: data.variableKey, + }, body: data.requestBody, mediaType: "application/json", errors: { diff --git a/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow/ui/openapi-gen/requests/types.gen.ts index 2ca718644c5fd..608bc6136e7a0 100644 --- a/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow/ui/openapi-gen/requests/types.gen.ts @@ -2451,13 +2451,13 @@ export type GetTaskData = { export type GetTaskResponse = TaskResponse; export type DeleteVariableData = { - variableKey: string; + variableKey: string | null; }; export type DeleteVariableResponse = void; export type GetVariableData = { - variableKey: string; + variableKey: string | null; }; export type GetVariableResponse = VariableResponse; @@ -2465,7 +2465,7 @@ export type GetVariableResponse = VariableResponse; export type PatchVariableData = { requestBody: VariableBody; updateMask?: Array | null; - variableKey: string; + variableKey: string | null; }; export type PatchVariableResponse = VariableResponse; @@ -2474,6 +2474,7 @@ export type GetVariablesData = { limit?: number; offset?: number; orderBy?: string; + variableKey?: string | null; variableKeyPattern?: string | null; }; @@ -2481,12 +2482,14 @@ export type GetVariablesResponse = VariableCollectionResponse; export type PostVariableData = { requestBody: VariableBody; + variableKey?: string | null; }; export type PostVariableResponse = VariableResponse; export type BulkVariablesData = { requestBody: BulkBody_VariableBody_; + variableKey?: string | null; }; export type BulkVariablesResponse = BulkResponse; diff --git a/tests/api_fastapi/core_api/routes/public/test_variables.py b/tests/api_fastapi/core_api/routes/public/test_variables.py index c5af61fc035fa..b9837f4d25312 100644 --- a/tests/api_fastapi/core_api/routes/public/test_variables.py +++ b/tests/api_fastapi/core_api/routes/public/test_variables.py @@ -107,6 +107,14 @@ def test_delete_should_respond_204(self, test_client, session): variables = session.query(Variable).all() assert len(variables) == 3 + def test_delete_should_respond_401(self, unauthenticated_test_client): + response = unauthenticated_test_client.delete(f"/public/variables/{TEST_VARIABLE_KEY}") + assert response.status_code == 401 + + def test_delete_should_respond_403(self, unauthorized_test_client): + response = unauthorized_test_client.delete(f"/public/variables/{TEST_VARIABLE_KEY}") + assert response.status_code == 403 + def test_delete_should_respond_404(self, test_client): response = test_client.delete(f"/public/variables/{TEST_VARIABLE_KEY}") assert response.status_code == 404 @@ -163,6 +171,14 @@ def test_get_should_respond_200(self, test_client, session, key, expected_respon assert response.status_code == 200 assert response.json() == expected_response + def test_get_should_respond_401(self, unauthenticated_test_client): + response = unauthenticated_test_client.get(f"/public/variables/{TEST_VARIABLE_KEY}") + assert response.status_code == 401 + + def test_get_should_respond_403(self, unauthorized_test_client): + response = unauthorized_test_client.get(f"/public/variables/{TEST_VARIABLE_KEY}") + assert response.status_code == 403 + def test_get_should_respond_404(self, test_client): response = test_client.get(f"/public/variables/{TEST_VARIABLE_KEY}") assert response.status_code == 404 @@ -220,6 +236,14 @@ def test_should_respond_200( assert body["total_entries"] == expected_total_entries assert [variable["key"] for variable in body["variables"]] == expected_keys + def test_get_should_respond_401(self, unauthenticated_test_client): + response = unauthenticated_test_client.get("/public/variables") + assert response.status_code == 401 + + def test_get_should_respond_403(self, unauthorized_test_client): + response = unauthorized_test_client.get("/public/variables") + assert response.status_code == 403 + class TestPatchVariable(TestVariableEndpoint): @pytest.mark.enable_redact @@ -303,6 +327,20 @@ def test_patch_should_respond_400(self, test_client): body = response.json() assert body["detail"] == "Invalid body, key from request body doesn't match uri parameter" + def test_patch_should_respond_401(self, unauthenticated_test_client): + response = unauthenticated_test_client.patch( + f"/public/variables/{TEST_VARIABLE_KEY}", + json={"key": TEST_VARIABLE_KEY, "value": "some_value", "description": None}, + ) + assert response.status_code == 401 + + def test_patch_should_respond_403(self, unauthorized_test_client): + response = unauthorized_test_client.patch( + f"/public/variables/{TEST_VARIABLE_KEY}", + json={"key": TEST_VARIABLE_KEY, "value": "some_value", "description": None}, + ) + assert response.status_code == 403 + def test_patch_should_respond_404(self, test_client): response = test_client.patch( f"/public/variables/{TEST_VARIABLE_KEY}", @@ -378,6 +416,28 @@ def test_post_should_respond_201(self, test_client, session, body, expected_resp assert response.status_code == 201 assert response.json() == expected_response + def test_post_should_respond_401(self, unauthenticated_test_client): + response = unauthenticated_test_client.post( + "/public/variables", + json={ + "key": "new variable key", + "value": "new variable value", + "description": "new variable description", + }, + ) + assert response.status_code == 401 + + def test_post_should_respond_403(self, unauthorized_test_client): + response = unauthorized_test_client.post( + "/public/variables", + json={ + "key": "new variable key", + "value": "new variable value", + "description": "new variable description", + }, + ) + assert response.status_code == 403 + def test_post_should_respond_409_when_key_exists(self, test_client, session): self.create_variables() # Attempting to post a variable with an existing key @@ -927,3 +987,11 @@ def test_bulk_variables(self, test_client, actions, expected_results): response_data = response.json() for key, value in expected_results.items(): assert response_data[key] == value + + def test_bulk_variables_should_respond_401(self, unauthenticated_test_client): + response = unauthenticated_test_client.patch("/public/variables", json={}) + assert response.status_code == 401 + + def test_bulk_variables_should_respond_403(self, unauthorized_test_client): + response = unauthorized_test_client.patch("/public/variables", json={}) + assert response.status_code == 403 From c64e7443770022627ef40703134424c4604d7c62 Mon Sep 17 00:00:00 2001 From: LIU ZHE YOU Date: Mon, 3 Mar 2025 21:09:26 +0800 Subject: [PATCH 2/2] Fix requires_access_variable schema --- .../core_api/openapi/v1-generated.yaml | 38 ++----------------- airflow/api_fastapi/core_api/security.py | 13 +++---- airflow/ui/openapi-gen/queries/common.ts | 7 +--- airflow/ui/openapi-gen/queries/prefetch.ts | 13 +------ airflow/ui/openapi-gen/queries/queries.ts | 22 +++-------- airflow/ui/openapi-gen/queries/suspense.ts | 8 +--- .../ui/openapi-gen/requests/services.gen.ts | 10 ----- airflow/ui/openapi-gen/requests/types.gen.ts | 9 ++--- 8 files changed, 23 insertions(+), 97 deletions(-) diff --git a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml index 02147b11e09f1..e6e27e65b3f34 100644 --- a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml +++ b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml @@ -6343,9 +6343,7 @@ paths: in: path required: true schema: - anyOf: - - type: string - - type: 'null' + type: string title: Variable Key responses: '204': @@ -6387,9 +6385,7 @@ paths: in: path required: true schema: - anyOf: - - type: string - - type: 'null' + type: string title: Variable Key responses: '200': @@ -6435,9 +6431,7 @@ paths: in: path required: true schema: - anyOf: - - type: string - - type: 'null' + type: string title: Variable Key - name: update_mask in: query @@ -6502,14 +6496,6 @@ paths: security: - OAuth2PasswordBearer: [] parameters: - - name: variable_key - in: query - required: false - schema: - anyOf: - - type: string - - type: 'null' - title: Variable Key - name: limit in: query required: false @@ -6574,15 +6560,6 @@ paths: operationId: post_variable security: - OAuth2PasswordBearer: [] - parameters: - - name: variable_key - in: query - required: false - schema: - anyOf: - - type: string - - type: 'null' - title: Variable Key requestBody: required: true content: @@ -6628,15 +6605,6 @@ paths: operationId: bulk_variables security: - OAuth2PasswordBearer: [] - parameters: - - name: variable_key - in: query - required: false - schema: - anyOf: - - type: string - - type: 'null' - title: Variable Key requestBody: required: true content: diff --git a/airflow/api_fastapi/core_api/security.py b/airflow/api_fastapi/core_api/security.py index c980b075fbfa7..b1da04d6791b7 100644 --- a/airflow/api_fastapi/core_api/security.py +++ b/airflow/api_fastapi/core_api/security.py @@ -131,18 +131,17 @@ def callback(): return inner -def requires_access_variable(method: ResourceMethod) -> Callable[[str | None, BaseUser | None], None]: +def requires_access_variable(method: ResourceMethod) -> Callable[[Request, BaseUser | None], None]: def inner( - variable_key: str | None = None, + request: Request, user: Annotated[BaseUser | None, Depends(get_user)] = None, ) -> None: - def callback(): - return get_auth_manager().is_authorized_variable( - method=method, details=VariableDetails(key=variable_key), user=user - ) + variable_key: str | None = request.path_params.get("variable_key") _requires_access( - is_authorized_callback=callback, + is_authorized_callback=lambda: get_auth_manager().is_authorized_variable( + method=method, details=VariableDetails(key=variable_key), user=user + ), ) return inner diff --git a/airflow/ui/openapi-gen/queries/common.ts b/airflow/ui/openapi-gen/queries/common.ts index 2324a18c3b23e..151e3b100a9cf 100644 --- a/airflow/ui/openapi-gen/queries/common.ts +++ b/airflow/ui/openapi-gen/queries/common.ts @@ -1656,20 +1656,15 @@ export const UseVariableServiceGetVariablesKeyFn = ( limit, offset, orderBy, - variableKey, variableKeyPattern, }: { limit?: number; offset?: number; orderBy?: string; - variableKey?: string; variableKeyPattern?: string; } = {}, queryKey?: Array, -) => [ - useVariableServiceGetVariablesKey, - ...(queryKey ?? [{ limit, offset, orderBy, variableKey, variableKeyPattern }]), -]; +) => [useVariableServiceGetVariablesKey, ...(queryKey ?? [{ limit, offset, orderBy, variableKeyPattern }])]; export type DagVersionServiceGetDagVersionsDefaultResponse = Awaited< ReturnType >; diff --git a/airflow/ui/openapi-gen/queries/prefetch.ts b/airflow/ui/openapi-gen/queries/prefetch.ts index df028449452d8..c833e4268706b 100644 --- a/airflow/ui/openapi-gen/queries/prefetch.ts +++ b/airflow/ui/openapi-gen/queries/prefetch.ts @@ -2315,7 +2315,6 @@ export const prefetchUseVariableServiceGetVariable = ( * Get Variables * Get all Variables entries. * @param data The data for the request. - * @param data.variableKey * @param data.limit * @param data.offset * @param data.orderBy @@ -2329,25 +2328,17 @@ export const prefetchUseVariableServiceGetVariables = ( limit, offset, orderBy, - variableKey, variableKeyPattern, }: { limit?: number; offset?: number; orderBy?: string; - variableKey?: string; variableKeyPattern?: string; } = {}, ) => queryClient.prefetchQuery({ - queryKey: Common.UseVariableServiceGetVariablesKeyFn({ - limit, - offset, - orderBy, - variableKey, - variableKeyPattern, - }), - queryFn: () => VariableService.getVariables({ limit, offset, orderBy, variableKey, variableKeyPattern }), + queryKey: Common.UseVariableServiceGetVariablesKeyFn({ limit, offset, orderBy, variableKeyPattern }), + queryFn: () => VariableService.getVariables({ limit, offset, orderBy, variableKeyPattern }), }); /** * Get Dag Versions diff --git a/airflow/ui/openapi-gen/queries/queries.ts b/airflow/ui/openapi-gen/queries/queries.ts index 5d442b2b37c72..2fdd58c4ec273 100644 --- a/airflow/ui/openapi-gen/queries/queries.ts +++ b/airflow/ui/openapi-gen/queries/queries.ts @@ -2725,7 +2725,6 @@ export const useVariableServiceGetVariable = < * Get Variables * Get all Variables entries. * @param data The data for the request. - * @param data.variableKey * @param data.limit * @param data.offset * @param data.orderBy @@ -2742,13 +2741,11 @@ export const useVariableServiceGetVariables = < limit, offset, orderBy, - variableKey, variableKeyPattern, }: { limit?: number; offset?: number; orderBy?: string; - variableKey?: string; variableKeyPattern?: string; } = {}, queryKey?: TQueryKey, @@ -2756,11 +2753,10 @@ export const useVariableServiceGetVariables = < ) => useQuery({ queryKey: Common.UseVariableServiceGetVariablesKeyFn( - { limit, offset, orderBy, variableKey, variableKeyPattern }, + { limit, offset, orderBy, variableKeyPattern }, queryKey, ), - queryFn: () => - VariableService.getVariables({ limit, offset, orderBy, variableKey, variableKeyPattern }) as TData, + queryFn: () => VariableService.getVariables({ limit, offset, orderBy, variableKeyPattern }) as TData, ...options, }); /** @@ -3420,7 +3416,6 @@ export const useXcomServiceCreateXcomEntry = < * Create a variable. * @param data The data for the request. * @param data.requestBody - * @param data.variableKey * @returns VariableResponse Successful Response * @throws ApiError */ @@ -3435,7 +3430,6 @@ export const useVariableServicePostVariable = < TError, { requestBody: VariableBody; - variableKey?: string; }, TContext >, @@ -3447,12 +3441,11 @@ export const useVariableServicePostVariable = < TError, { requestBody: VariableBody; - variableKey?: string; }, TContext >({ - mutationFn: ({ requestBody, variableKey }) => - VariableService.postVariable({ requestBody, variableKey }) as unknown as Promise, + mutationFn: ({ requestBody }) => + VariableService.postVariable({ requestBody }) as unknown as Promise, ...options, }); /** @@ -4282,7 +4275,6 @@ export const useVariableServicePatchVariable = < * Bulk create, update, and delete variables. * @param data The data for the request. * @param data.requestBody - * @param data.variableKey * @returns BulkResponse Successful Response * @throws ApiError */ @@ -4297,7 +4289,6 @@ export const useVariableServiceBulkVariables = < TError, { requestBody: BulkBody_VariableBody_; - variableKey?: string; }, TContext >, @@ -4309,12 +4300,11 @@ export const useVariableServiceBulkVariables = < TError, { requestBody: BulkBody_VariableBody_; - variableKey?: string; }, TContext >({ - mutationFn: ({ requestBody, variableKey }) => - VariableService.bulkVariables({ requestBody, variableKey }) as unknown as Promise, + mutationFn: ({ requestBody }) => + VariableService.bulkVariables({ requestBody }) as unknown as Promise, ...options, }); /** diff --git a/airflow/ui/openapi-gen/queries/suspense.ts b/airflow/ui/openapi-gen/queries/suspense.ts index a42352c31237b..48b17556fd9ec 100644 --- a/airflow/ui/openapi-gen/queries/suspense.ts +++ b/airflow/ui/openapi-gen/queries/suspense.ts @@ -2702,7 +2702,6 @@ export const useVariableServiceGetVariableSuspense = < * Get Variables * Get all Variables entries. * @param data The data for the request. - * @param data.variableKey * @param data.limit * @param data.offset * @param data.orderBy @@ -2719,13 +2718,11 @@ export const useVariableServiceGetVariablesSuspense = < limit, offset, orderBy, - variableKey, variableKeyPattern, }: { limit?: number; offset?: number; orderBy?: string; - variableKey?: string; variableKeyPattern?: string; } = {}, queryKey?: TQueryKey, @@ -2733,11 +2730,10 @@ export const useVariableServiceGetVariablesSuspense = < ) => useSuspenseQuery({ queryKey: Common.UseVariableServiceGetVariablesKeyFn( - { limit, offset, orderBy, variableKey, variableKeyPattern }, + { limit, offset, orderBy, variableKeyPattern }, queryKey, ), - queryFn: () => - VariableService.getVariables({ limit, offset, orderBy, variableKey, variableKeyPattern }) as TData, + queryFn: () => VariableService.getVariables({ limit, offset, orderBy, variableKeyPattern }) as TData, ...options, }); /** diff --git a/airflow/ui/openapi-gen/requests/services.gen.ts b/airflow/ui/openapi-gen/requests/services.gen.ts index b38716aeefe49..81b649d31cb97 100644 --- a/airflow/ui/openapi-gen/requests/services.gen.ts +++ b/airflow/ui/openapi-gen/requests/services.gen.ts @@ -3307,7 +3307,6 @@ export class VariableService { * Get Variables * Get all Variables entries. * @param data The data for the request. - * @param data.variableKey * @param data.limit * @param data.offset * @param data.orderBy @@ -3320,7 +3319,6 @@ export class VariableService { method: "GET", url: "/public/variables", query: { - variable_key: data.variableKey, limit: data.limit, offset: data.offset, order_by: data.orderBy, @@ -3339,7 +3337,6 @@ export class VariableService { * Create a variable. * @param data The data for the request. * @param data.requestBody - * @param data.variableKey * @returns VariableResponse Successful Response * @throws ApiError */ @@ -3347,9 +3344,6 @@ export class VariableService { return __request(OpenAPI, { method: "POST", url: "/public/variables", - query: { - variable_key: data.variableKey, - }, body: data.requestBody, mediaType: "application/json", errors: { @@ -3366,7 +3360,6 @@ export class VariableService { * Bulk create, update, and delete variables. * @param data The data for the request. * @param data.requestBody - * @param data.variableKey * @returns BulkResponse Successful Response * @throws ApiError */ @@ -3374,9 +3367,6 @@ export class VariableService { return __request(OpenAPI, { method: "PATCH", url: "/public/variables", - query: { - variable_key: data.variableKey, - }, body: data.requestBody, mediaType: "application/json", errors: { diff --git a/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow/ui/openapi-gen/requests/types.gen.ts index 608bc6136e7a0..2ca718644c5fd 100644 --- a/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow/ui/openapi-gen/requests/types.gen.ts @@ -2451,13 +2451,13 @@ export type GetTaskData = { export type GetTaskResponse = TaskResponse; export type DeleteVariableData = { - variableKey: string | null; + variableKey: string; }; export type DeleteVariableResponse = void; export type GetVariableData = { - variableKey: string | null; + variableKey: string; }; export type GetVariableResponse = VariableResponse; @@ -2465,7 +2465,7 @@ export type GetVariableResponse = VariableResponse; export type PatchVariableData = { requestBody: VariableBody; updateMask?: Array | null; - variableKey: string | null; + variableKey: string; }; export type PatchVariableResponse = VariableResponse; @@ -2474,7 +2474,6 @@ export type GetVariablesData = { limit?: number; offset?: number; orderBy?: string; - variableKey?: string | null; variableKeyPattern?: string | null; }; @@ -2482,14 +2481,12 @@ export type GetVariablesResponse = VariableCollectionResponse; export type PostVariableData = { requestBody: VariableBody; - variableKey?: string | null; }; export type PostVariableResponse = VariableResponse; export type BulkVariablesData = { requestBody: BulkBody_VariableBody_; - variableKey?: string | null; }; export type BulkVariablesResponse = BulkResponse;