From 3cc119860eee3d63a0824c36f105b735ff687f33 Mon Sep 17 00:00:00 2001 From: Rahul Vats Date: Fri, 18 Sep 2026 13:23:17 +0530 Subject: [PATCH] Update Python Client to 3.3.2rc1 --- CHANGELOG.md | 13 ++ airflow_client/client/__init__.py | 2 +- airflow_client/client/api/backfill_api.py | 3 + airflow_client/client/api/dag_api.py | 3 + airflow_client/client/api/dag_run_api.py | 12 +- airflow_client/client/api/login_api.py | 2 + .../client/api/task_instance_api.py | 12 +- .../client/api/task_state_store_api.py | 157 +++++++++--------- airflow_client/client/api_client.py | 43 ++++- airflow_client/client/configuration.py | 61 ++++++- .../models/asset_alias_collection_response.py | 3 +- .../models/asset_collection_response.py | 3 +- .../models/asset_event_collection_response.py | 3 +- .../client/models/asset_event_response.py | 3 +- .../client/models/asset_response.py | 15 +- .../asset_state_store_collection_response.py | 3 +- .../models/backfill_collection_response.py | 3 +- .../models/bulk_body_bulk_dag_run_body.py | 3 +- .../bulk_body_bulk_task_instance_body.py | 3 +- .../models/bulk_body_connection_body.py | 3 +- .../client/models/bulk_body_pool_body.py | 3 +- .../client/models/bulk_body_variable_body.py | 3 +- .../bulk_create_action_bulk_dag_run_body.py | 3 +- ...k_create_action_bulk_task_instance_body.py | 3 +- .../bulk_create_action_connection_body.py | 3 +- .../models/bulk_create_action_pool_body.py | 3 +- .../bulk_create_action_variable_body.py | 3 +- .../client/models/bulk_dag_run_clear_body.py | 3 +- .../bulk_delete_action_bulk_dag_run_body.py | 3 +- ...k_delete_action_bulk_task_instance_body.py | 3 +- .../bulk_delete_action_connection_body.py | 3 +- .../models/bulk_delete_action_pool_body.py | 3 +- .../bulk_delete_action_variable_body.py | 3 +- .../bulk_update_action_bulk_dag_run_body.py | 3 +- ...k_update_action_bulk_task_instance_body.py | 3 +- .../bulk_update_action_connection_body.py | 3 +- .../models/bulk_update_action_pool_body.py | 3 +- .../bulk_update_action_variable_body.py | 3 +- ...clear_task_instance_collection_response.py | 3 +- .../models/clear_task_instances_body.py | 3 +- airflow_client/client/models/config.py | 3 +- .../client/models/config_section.py | 3 +- .../client/models/connection_body.py | 7 +- .../models/connection_collection_response.py | 3 +- .../models/connection_test_request_body.py | 7 +- .../client/models/create_asset_events_body.py | 7 +- .../client/models/dag_collection_response.py | 3 +- .../client/models/dag_details_response.py | 3 +- airflow_client/client/models/dag_response.py | 3 +- .../client/models/dag_run_asset_reference.py | 8 +- .../models/dag_run_collection_response.py | 9 +- .../client/models/dag_run_response.py | 3 +- .../models/dag_stats_collection_response.py | 3 +- .../client/models/dag_stats_response.py | 3 +- .../models/dag_version_collection_response.py | 3 +- .../models/dag_warning_collection_response.py | 3 +- .../dry_run_backfill_collection_response.py | 3 +- .../models/event_log_collection_response.py | 3 +- airflow_client/client/models/hitl_detail.py | 3 +- .../client/models/hitl_detail_collection.py | 3 +- .../client/models/hitl_detail_history.py | 3 +- .../client/models/http_validation_error.py | 3 +- .../import_error_collection_response.py | 3 +- .../client/models/job_collection_response.py | 3 +- .../models/plugin_collection_response.py | 3 +- ...plugin_import_error_collection_response.py | 3 +- .../client/models/plugin_response.py | 18 +- .../client/models/pool_collection_response.py | 3 +- .../models/provider_collection_response.py | 3 +- .../queued_event_collection_response.py | 3 +- .../client/models/task_collection_response.py | 3 +- .../task_dependency_collection_response.py | 3 +- .../task_instance_collection_response.py | 9 +- ...sk_instance_history_collection_response.py | 3 +- .../task_state_store_collection_response.py | 3 +- .../client/models/validation_error.py | 3 +- .../models/variable_collection_response.py | 3 +- .../models/x_com_collection_response.py | 3 +- airflow_client/client/rest.py | 87 +++++++++- docs/AssetEventResponse.md | 2 +- docs/AssetResponse.md | 2 +- docs/BackfillApi.md | 1 + docs/ConfigApi.md | 8 +- docs/DAGApi.md | 1 + docs/DAGRunCollectionResponse.md | 1 + docs/DagRunApi.md | 5 +- docs/DagRunAssetReference.md | 1 + docs/DagSourceApi.md | 4 +- docs/LoginApi.md | 15 +- docs/ResponseClearDagRuns.md | 1 + docs/TaskInstanceApi.md | 13 +- docs/TaskInstanceCollectionResponse.md | 1 + docs/TaskStateStoreApi.md | 41 +++-- pyproject.toml | 5 +- spec/v2.yaml | 140 +++++++++++----- test/test_asset_event_collection_response.py | 6 +- test/test_asset_event_response.py | 6 +- test/test_dag_run_asset_reference.py | 4 +- test/test_dag_run_collection_response.py | 3 +- test/test_response_clear_dag_runs.py | 3 +- .../test_task_instance_collection_response.py | 3 +- version.txt | 2 +- 102 files changed, 556 insertions(+), 367 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb6b01d..f0f5a66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,19 @@ under the License. --> +# v3.3.2 + +## Improvements: + +- Document HTTP statuses that API routes raise but never declared (#71622) + +## Bug Fixes: + +- Revoke every credential presented to the logout endpoint, not just the session cookie (#72933) +- Restore counts on the Dag Run and Task Instance lists (#72739) +- Return HTTP 404 from task state store endpoints for unknown task instances (#71860) +- Mark only a run's most recent asset event as triggering it (#71547) + # v3.3.1 ## Bug Fixes: diff --git a/airflow_client/client/__init__.py b/airflow_client/client/__init__.py index 52f9ab8..ea4fcb2 100644 --- a/airflow_client/client/__init__.py +++ b/airflow_client/client/__init__.py @@ -14,7 +14,7 @@ """ # noqa: E501 -__version__ = "3.3.1" +__version__ = "3.3.2" # Define package exports __all__ = [ diff --git a/airflow_client/client/api/backfill_api.py b/airflow_client/client/api/backfill_api.py index 7466180..2c79598 100644 --- a/airflow_client/client/api/backfill_api.py +++ b/airflow_client/client/api/backfill_api.py @@ -662,6 +662,7 @@ def create_backfill_dry_run( _response_types_map: Dict[str, Optional[str]] = { '200': "DryRunBackfillCollectionResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", @@ -734,6 +735,7 @@ def create_backfill_dry_run_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "DryRunBackfillCollectionResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", @@ -806,6 +808,7 @@ def create_backfill_dry_run_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "DryRunBackfillCollectionResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", diff --git a/airflow_client/client/api/dag_api.py b/airflow_client/client/api/dag_api.py index ab181da..198235e 100644 --- a/airflow_client/client/api/dag_api.py +++ b/airflow_client/client/api/dag_api.py @@ -102,6 +102,7 @@ def delete_dag( '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", + '409': "HTTPExceptionResponse", '422': "HTTPExceptionResponse", } response_data = self.api_client.call_api( @@ -174,6 +175,7 @@ def delete_dag_with_http_info( '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", + '409': "HTTPExceptionResponse", '422': "HTTPExceptionResponse", } response_data = self.api_client.call_api( @@ -246,6 +248,7 @@ def delete_dag_without_preload_content( '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", + '409': "HTTPExceptionResponse", '422': "HTTPExceptionResponse", } response_data = self.api_client.call_api( diff --git a/airflow_client/client/api/dag_run_api.py b/airflow_client/client/api/dag_run_api.py index 9115145..a470f0d 100644 --- a/airflow_client/client/api/dag_run_api.py +++ b/airflow_client/client/api/dag_run_api.py @@ -1338,6 +1338,7 @@ def delete_dag_run( '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", + '409': "HTTPExceptionResponse", '422': "HTTPValidationError", } response_data = self.api_client.call_api( @@ -1414,6 +1415,7 @@ def delete_dag_run_with_http_info( '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", + '409': "HTTPExceptionResponse", '422': "HTTPValidationError", } response_data = self.api_client.call_api( @@ -1490,6 +1492,7 @@ def delete_dag_run_without_preload_content( '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", + '409': "HTTPExceptionResponse", '422': "HTTPValidationError", } response_data = self.api_client.call_api( @@ -1916,7 +1919,7 @@ def get_dag_runs( ) -> DAGRunCollectionResponse: """Get Dag Runs - Get all Dag Runs. This endpoint allows specifying `~` as the dag_id to retrieve Dag Runs for all Dags. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is not returned. ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. + Get all Dag Runs. This endpoint allows specifying `~` as the dag_id to retrieve Dag Runs for all Dags. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is capped at `total_entries_limit` (a value equal to that limit means at least that many runs match). ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. :param dag_id: (required) :type dag_id: str @@ -2084,6 +2087,7 @@ def get_dag_runs( _response_types_map: Dict[str, Optional[str]] = { '200': "DAGRunCollectionResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", @@ -2163,7 +2167,7 @@ def get_dag_runs_with_http_info( ) -> ApiResponse[DAGRunCollectionResponse]: """Get Dag Runs - Get all Dag Runs. This endpoint allows specifying `~` as the dag_id to retrieve Dag Runs for all Dags. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is not returned. ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. + Get all Dag Runs. This endpoint allows specifying `~` as the dag_id to retrieve Dag Runs for all Dags. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is capped at `total_entries_limit` (a value equal to that limit means at least that many runs match). ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. :param dag_id: (required) :type dag_id: str @@ -2331,6 +2335,7 @@ def get_dag_runs_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "DAGRunCollectionResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", @@ -2410,7 +2415,7 @@ def get_dag_runs_without_preload_content( ) -> RESTResponseType: """Get Dag Runs - Get all Dag Runs. This endpoint allows specifying `~` as the dag_id to retrieve Dag Runs for all Dags. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is not returned. ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. + Get all Dag Runs. This endpoint allows specifying `~` as the dag_id to retrieve Dag Runs for all Dags. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is capped at `total_entries_limit` (a value equal to that limit means at least that many runs match). ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. :param dag_id: (required) :type dag_id: str @@ -2578,6 +2583,7 @@ def get_dag_runs_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "DAGRunCollectionResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", diff --git a/airflow_client/client/api/login_api.py b/airflow_client/client/api/login_api.py index e13bba1..2c316a2 100644 --- a/airflow_client/client/api/login_api.py +++ b/airflow_client/client/api/login_api.py @@ -535,6 +535,8 @@ def _logout_serialize( # authentication setting _auth_settings: List[str] = [ + 'OAuth2PasswordBearer', + 'HTTPBearer' ] return self.api_client.param_serialize( diff --git a/airflow_client/client/api/task_instance_api.py b/airflow_client/client/api/task_instance_api.py index 2864561..6684aee 100644 --- a/airflow_client/client/api/task_instance_api.py +++ b/airflow_client/client/api/task_instance_api.py @@ -6919,7 +6919,7 @@ def get_task_instances( ) -> TaskInstanceCollectionResponse: """Get Task Instances - Get list of task instances. This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve task instances for all Dags and Dag runs. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is not returned. ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. + Get list of task instances. This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve task instances for all Dags and Dag runs. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is capped at `total_entries_limit` (a value equal to that limit means at least that many task instances match). ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. :param dag_id: (required) :type dag_id: str @@ -7203,7 +7203,7 @@ def get_task_instances_with_http_info( ) -> ApiResponse[TaskInstanceCollectionResponse]: """Get Task Instances - Get list of task instances. This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve task instances for all Dags and Dag runs. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is not returned. ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. + Get list of task instances. This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve task instances for all Dags and Dag runs. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is capped at `total_entries_limit` (a value equal to that limit means at least that many task instances match). ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. :param dag_id: (required) :type dag_id: str @@ -7487,7 +7487,7 @@ def get_task_instances_without_preload_content( ) -> RESTResponseType: """Get Task Instances - Get list of task instances. This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve task instances for all Dags and Dag runs. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is not returned. ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. + Get list of task instances. This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve task instances for all Dags and Dag runs. Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). When `cursor` is provided, `offset` is ignored and `total_entries` is capped at `total_entries_limit` (a value equal to that limit means at least that many task instances match). ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. :param dag_id: (required) :type dag_id: str @@ -10761,6 +10761,7 @@ def post_clear_task_instances( _response_types_map: Dict[str, Optional[str]] = { '200': "TaskInstanceCollectionResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", @@ -10837,6 +10838,7 @@ def post_clear_task_instances_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "TaskInstanceCollectionResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", @@ -10913,6 +10915,7 @@ def post_clear_task_instances_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "TaskInstanceCollectionResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", @@ -11078,6 +11081,7 @@ def update_hitl_detail( _response_types_map: Dict[str, Optional[str]] = { '200': "HITLDetailResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", @@ -11166,6 +11170,7 @@ def update_hitl_detail_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "HITLDetailResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", @@ -11254,6 +11259,7 @@ def update_hitl_detail_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "HITLDetailResponse", + '400': "HTTPExceptionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", '404': "HTTPExceptionResponse", diff --git a/airflow_client/client/api/task_state_store_api.py b/airflow_client/client/api/task_state_store_api.py index 1fd3979..263de7d 100644 --- a/airflow_client/client/api/task_state_store_api.py +++ b/airflow_client/client/api/task_state_store_api.py @@ -47,8 +47,8 @@ def clear_task_state_store( dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, all_map_indices: Optional[StrictBool] = None, + map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -72,10 +72,10 @@ def clear_task_state_store( :type dag_run_id: str :param task_id: (required) :type task_id: str - :param map_index: - :type map_index: int :param all_map_indices: :type all_map_indices: bool + :param map_index: + :type map_index: int :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -102,8 +102,8 @@ def clear_task_state_store( dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - map_index=map_index, all_map_indices=all_map_indices, + map_index=map_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -134,8 +134,8 @@ def clear_task_state_store_with_http_info( dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, all_map_indices: Optional[StrictBool] = None, + map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -159,10 +159,10 @@ def clear_task_state_store_with_http_info( :type dag_run_id: str :param task_id: (required) :type task_id: str - :param map_index: - :type map_index: int :param all_map_indices: :type all_map_indices: bool + :param map_index: + :type map_index: int :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -189,8 +189,8 @@ def clear_task_state_store_with_http_info( dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - map_index=map_index, all_map_indices=all_map_indices, + map_index=map_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -221,8 +221,8 @@ def clear_task_state_store_without_preload_content( dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, all_map_indices: Optional[StrictBool] = None, + map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -246,10 +246,10 @@ def clear_task_state_store_without_preload_content( :type dag_run_id: str :param task_id: (required) :type task_id: str - :param map_index: - :type map_index: int :param all_map_indices: :type all_map_indices: bool + :param map_index: + :type map_index: int :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -276,8 +276,8 @@ def clear_task_state_store_without_preload_content( dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - map_index=map_index, all_map_indices=all_map_indices, + map_index=map_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -303,8 +303,8 @@ def _clear_task_state_store_serialize( dag_id, dag_run_id, task_id, - map_index, all_map_indices, + map_index, _request_auth, _content_type, _headers, @@ -333,14 +333,14 @@ def _clear_task_state_store_serialize( if task_id is not None: _path_params['task_id'] = task_id # process the query parameters - if map_index is not None: - - _query_params.append(('map_index', map_index)) - if all_map_indices is not None: _query_params.append(('all_map_indices', all_map_indices)) + if map_index is not None: + + _query_params.append(('map_index', map_index)) + # process the header parameters # process the form parameters # process the body parameter @@ -382,10 +382,10 @@ def _clear_task_state_store_serialize( @validate_call def delete_task_state_store( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ None, @@ -404,14 +404,14 @@ def delete_task_state_store( Delete a single task state store key. No-op if the key does not exist. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param map_index: :type map_index: int :param _request_timeout: timeout setting for this request. If one @@ -437,10 +437,10 @@ def delete_task_state_store( """ # noqa: E501 _param = self._delete_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, map_index=map_index, _request_auth=_request_auth, _content_type=_content_type, @@ -469,10 +469,10 @@ def delete_task_state_store( @validate_call def delete_task_state_store_with_http_info( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ None, @@ -491,14 +491,14 @@ def delete_task_state_store_with_http_info( Delete a single task state store key. No-op if the key does not exist. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param map_index: :type map_index: int :param _request_timeout: timeout setting for this request. If one @@ -524,10 +524,10 @@ def delete_task_state_store_with_http_info( """ # noqa: E501 _param = self._delete_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, map_index=map_index, _request_auth=_request_auth, _content_type=_content_type, @@ -556,10 +556,10 @@ def delete_task_state_store_with_http_info( @validate_call def delete_task_state_store_without_preload_content( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ None, @@ -578,14 +578,14 @@ def delete_task_state_store_without_preload_content( Delete a single task state store key. No-op if the key does not exist. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param map_index: :type map_index: int :param _request_timeout: timeout setting for this request. If one @@ -611,10 +611,10 @@ def delete_task_state_store_without_preload_content( """ # noqa: E501 _param = self._delete_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, map_index=map_index, _request_auth=_request_auth, _content_type=_content_type, @@ -638,10 +638,10 @@ def delete_task_state_store_without_preload_content( def _delete_task_state_store_serialize( self, + key, dag_id, dag_run_id, task_id, - key, map_index, _request_auth, _content_type, @@ -664,14 +664,14 @@ def _delete_task_state_store_serialize( _body_params: Optional[bytes] = None # process the path parameters + if key is not None: + _path_params['key'] = key if dag_id is not None: _path_params['dag_id'] = dag_id if dag_run_id is not None: _path_params['dag_run_id'] = dag_run_id if task_id is not None: _path_params['task_id'] = task_id - if key is not None: - _path_params['key'] = key # process the query parameters if map_index is not None: @@ -718,10 +718,10 @@ def _delete_task_state_store_serialize( @validate_call def get_task_state_store( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ None, @@ -740,14 +740,14 @@ def get_task_state_store( Get a single task state store entry. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param map_index: :type map_index: int :param _request_timeout: timeout setting for this request. If one @@ -773,10 +773,10 @@ def get_task_state_store( """ # noqa: E501 _param = self._get_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, map_index=map_index, _request_auth=_request_auth, _content_type=_content_type, @@ -805,10 +805,10 @@ def get_task_state_store( @validate_call def get_task_state_store_with_http_info( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ None, @@ -827,14 +827,14 @@ def get_task_state_store_with_http_info( Get a single task state store entry. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param map_index: :type map_index: int :param _request_timeout: timeout setting for this request. If one @@ -860,10 +860,10 @@ def get_task_state_store_with_http_info( """ # noqa: E501 _param = self._get_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, map_index=map_index, _request_auth=_request_auth, _content_type=_content_type, @@ -892,10 +892,10 @@ def get_task_state_store_with_http_info( @validate_call def get_task_state_store_without_preload_content( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ None, @@ -914,14 +914,14 @@ def get_task_state_store_without_preload_content( Get a single task state store entry. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param map_index: :type map_index: int :param _request_timeout: timeout setting for this request. If one @@ -947,10 +947,10 @@ def get_task_state_store_without_preload_content( """ # noqa: E501 _param = self._get_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, map_index=map_index, _request_auth=_request_auth, _content_type=_content_type, @@ -974,10 +974,10 @@ def get_task_state_store_without_preload_content( def _get_task_state_store_serialize( self, + key, dag_id, dag_run_id, task_id, - key, map_index, _request_auth, _content_type, @@ -1000,14 +1000,14 @@ def _get_task_state_store_serialize( _body_params: Optional[bytes] = None # process the path parameters + if key is not None: + _path_params['key'] = key if dag_id is not None: _path_params['dag_id'] = dag_id if dag_run_id is not None: _path_params['dag_run_id'] = dag_run_id if task_id is not None: _path_params['task_id'] = task_id - if key is not None: - _path_params['key'] = key # process the query parameters if map_index is not None: @@ -1128,7 +1128,6 @@ def list_task_state_store( '200': "TaskStateStoreCollectionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", - '404': "HTTPExceptionResponse", '422': "HTTPValidationError", } response_data = self.api_client.call_api( @@ -1219,7 +1218,6 @@ def list_task_state_store_with_http_info( '200': "TaskStateStoreCollectionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", - '404': "HTTPExceptionResponse", '422': "HTTPValidationError", } response_data = self.api_client.call_api( @@ -1310,7 +1308,6 @@ def list_task_state_store_without_preload_content( '200': "TaskStateStoreCollectionResponse", '401': "HTTPExceptionResponse", '403': "HTTPExceptionResponse", - '404': "HTTPExceptionResponse", '422': "HTTPValidationError", } response_data = self.api_client.call_api( @@ -1409,10 +1406,10 @@ def _list_task_state_store_serialize( @validate_call def patch_task_state_store( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, task_state_store_patch_body: TaskStateStorePatchBody, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ @@ -1432,14 +1429,14 @@ def patch_task_state_store( Update the value of an existing task state store key. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param task_state_store_patch_body: (required) :type task_state_store_patch_body: TaskStateStorePatchBody :param map_index: @@ -1467,10 +1464,10 @@ def patch_task_state_store( """ # noqa: E501 _param = self._patch_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, task_state_store_patch_body=task_state_store_patch_body, map_index=map_index, _request_auth=_request_auth, @@ -1500,10 +1497,10 @@ def patch_task_state_store( @validate_call def patch_task_state_store_with_http_info( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, task_state_store_patch_body: TaskStateStorePatchBody, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ @@ -1523,14 +1520,14 @@ def patch_task_state_store_with_http_info( Update the value of an existing task state store key. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param task_state_store_patch_body: (required) :type task_state_store_patch_body: TaskStateStorePatchBody :param map_index: @@ -1558,10 +1555,10 @@ def patch_task_state_store_with_http_info( """ # noqa: E501 _param = self._patch_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, task_state_store_patch_body=task_state_store_patch_body, map_index=map_index, _request_auth=_request_auth, @@ -1591,10 +1588,10 @@ def patch_task_state_store_with_http_info( @validate_call def patch_task_state_store_without_preload_content( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, task_state_store_patch_body: TaskStateStorePatchBody, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ @@ -1614,14 +1611,14 @@ def patch_task_state_store_without_preload_content( Update the value of an existing task state store key. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param task_state_store_patch_body: (required) :type task_state_store_patch_body: TaskStateStorePatchBody :param map_index: @@ -1649,10 +1646,10 @@ def patch_task_state_store_without_preload_content( """ # noqa: E501 _param = self._patch_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, task_state_store_patch_body=task_state_store_patch_body, map_index=map_index, _request_auth=_request_auth, @@ -1677,10 +1674,10 @@ def patch_task_state_store_without_preload_content( def _patch_task_state_store_serialize( self, + key, dag_id, dag_run_id, task_id, - key, task_state_store_patch_body, map_index, _request_auth, @@ -1704,14 +1701,14 @@ def _patch_task_state_store_serialize( _body_params: Optional[bytes] = None # process the path parameters + if key is not None: + _path_params['key'] = key if dag_id is not None: _path_params['dag_id'] = dag_id if dag_run_id is not None: _path_params['dag_run_id'] = dag_run_id if task_id is not None: _path_params['task_id'] = task_id - if key is not None: - _path_params['key'] = key # process the query parameters if map_index is not None: @@ -1773,10 +1770,10 @@ def _patch_task_state_store_serialize( @validate_call def set_task_state_store( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, task_state_store_body: TaskStateStoreBody, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ @@ -1796,14 +1793,14 @@ def set_task_state_store( Set a task state store value. Creates or overwrites the key. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param task_state_store_body: (required) :type task_state_store_body: TaskStateStoreBody :param map_index: @@ -1831,10 +1828,10 @@ def set_task_state_store( """ # noqa: E501 _param = self._set_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, task_state_store_body=task_state_store_body, map_index=map_index, _request_auth=_request_auth, @@ -1864,10 +1861,10 @@ def set_task_state_store( @validate_call def set_task_state_store_with_http_info( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, task_state_store_body: TaskStateStoreBody, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ @@ -1887,14 +1884,14 @@ def set_task_state_store_with_http_info( Set a task state store value. Creates or overwrites the key. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param task_state_store_body: (required) :type task_state_store_body: TaskStateStoreBody :param map_index: @@ -1922,10 +1919,10 @@ def set_task_state_store_with_http_info( """ # noqa: E501 _param = self._set_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, task_state_store_body=task_state_store_body, map_index=map_index, _request_auth=_request_auth, @@ -1955,10 +1952,10 @@ def set_task_state_store_with_http_info( @validate_call def set_task_state_store_without_preload_content( self, + key: StrictStr, dag_id: StrictStr, dag_run_id: StrictStr, task_id: StrictStr, - key: StrictStr, task_state_store_body: TaskStateStoreBody, map_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = None, _request_timeout: Union[ @@ -1978,14 +1975,14 @@ def set_task_state_store_without_preload_content( Set a task state store value. Creates or overwrites the key. + :param key: (required) + :type key: str :param dag_id: (required) :type dag_id: str :param dag_run_id: (required) :type dag_run_id: str :param task_id: (required) :type task_id: str - :param key: (required) - :type key: str :param task_state_store_body: (required) :type task_state_store_body: TaskStateStoreBody :param map_index: @@ -2013,10 +2010,10 @@ def set_task_state_store_without_preload_content( """ # noqa: E501 _param = self._set_task_state_store_serialize( + key=key, dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, - key=key, task_state_store_body=task_state_store_body, map_index=map_index, _request_auth=_request_auth, @@ -2041,10 +2038,10 @@ def set_task_state_store_without_preload_content( def _set_task_state_store_serialize( self, + key, dag_id, dag_run_id, task_id, - key, task_state_store_body, map_index, _request_auth, @@ -2068,14 +2065,14 @@ def _set_task_state_store_serialize( _body_params: Optional[bytes] = None # process the path parameters + if key is not None: + _path_params['key'] = key if dag_id is not None: _path_params['dag_id'] = dag_id if dag_run_id is not None: _path_params['dag_run_id'] = dag_run_id if task_id is not None: _path_params['task_id'] = task_id - if key is not None: - _path_params['key'] = key # process the query parameters if map_index is not None: diff --git a/airflow_client/client/api_client.py b/airflow_client/client/api_client.py index 3d7f36d..856b49a 100644 --- a/airflow_client/client/api_client.py +++ b/airflow_client/client/api_client.py @@ -91,7 +91,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/3.3.1/python' + self.user_agent = 'OpenAPI-Generator/3.3.2/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): @@ -247,7 +247,6 @@ def param_serialize( return method, url, header_params, body, post_params - def call_api( self, method, @@ -302,6 +301,12 @@ def response_deserialize( # if not found, look for '1XX', '2XX', etc. response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + # If the response_type has not matched (eg. did not match the previous if statements) and the default response is available, use it. + if response_type is None and str(response_data.status) not in response_types_map \ + and (not isinstance(response_data.status, int) or not 100 <= response_data.status <= 599 or str(response_data.status)[0] + "XX" not in response_types_map) \ + and 'default' in response_types_map: + response_type = response_types_map['default'] + # deserialize response data response_text = None return_data = None @@ -434,6 +439,12 @@ def __deserialize(self, data, klass): return None if isinstance(klass, str): + if klass.startswith('Optional['): + m = re.match(r'Optional\[(.*)]', klass) + assert m is not None, "Malformed Optional type definition" + # data is not None here, so the optionality is already resolved + return self.__deserialize(data, m.group(1)) + if klass.startswith('List['): m = re.match(r'List\[(.*)]', klass) assert m is not None, "Malformed List type definition" @@ -482,10 +493,15 @@ def parameters_to_tuples(self, params, collection_formats): if collection_formats is None: collection_formats = {} for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': - new_params.extend((k, value) for value in v) + new_params.extend( + (k, str(value).lower() if isinstance(value, bool) else value) + for value in v + ) else: if collection_format == 'ssv': delimiter = ' ' @@ -496,7 +512,9 @@ def parameters_to_tuples(self, params, collection_formats): else: # csv is the default delimiter = ',' new_params.append( - (k, delimiter.join(str(value) for value in v))) + (k, delimiter.join( + str(value).lower() if isinstance(value, bool) else str(value) + for value in v))) else: new_params.append((k, v)) return new_params @@ -522,7 +540,10 @@ def parameters_to_url_query(self, params, collection_formats): if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': - new_params.extend((k, quote(str(value))) for value in v) + new_params.extend( + (k, quote(str(value).lower() if isinstance(value, bool) else str(value))) + for value in v + ) else: if collection_format == 'ssv': delimiter = ' ' @@ -533,7 +554,9 @@ def parameters_to_url_query(self, params, collection_formats): else: # csv is the default delimiter = ',' new_params.append( - (k, delimiter.join(quote(str(value)) for value in v)) + (k, delimiter.join( + quote(str(value).lower() if isinstance(value, bool) else str(value)) + for value in v)) ) else: new_params.append((k, quote(str(v)))) @@ -672,7 +695,13 @@ def _apply_auth_params( :param auth_setting: auth settings for the endpoint """ if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] + if not 'Cookie' in headers: + headers['Cookie'] = "" + else: + headers['Cookie'] += "; " + # Account for cookie value containing spaces and special characters, excluding base64 delimiters + cookie_value = quote(str(auth_setting['value']), safe="!#$%&'()*+-./:<=>?@[]^_`{|}~%+/=") + headers['Cookie'] += f"{auth_setting['key']}={cookie_value}" elif auth_setting['in'] == 'header': if auth_setting['type'] != 'http-signature': headers[auth_setting['key']] = auth_setting['value'] diff --git a/airflow_client/client/configuration.py b/airflow_client/client/configuration.py index acbb775..3d969ea 100644 --- a/airflow_client/client/configuration.py +++ b/airflow_client/client/configuration.py @@ -15,8 +15,11 @@ import logging from logging import FileHandler import multiprocessing +import ssl import sys from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from urllib.parse import urlparse +from urllib.request import getproxies from typing_extensions import NotRequired, Self import urllib3 @@ -170,7 +173,9 @@ class Configuration: :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server. :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync. :param proxy: Proxy URL. + :param no_proxy: Comma-separated hosts that bypass the proxy. :param proxy_headers: Proxy headers. + :param proxy_ssl_context: SSL context used only for the TLS handshake with the proxy itself, independent of the destination TLS settings. :param safe_chars_for_path_param: Safe characters for path parameter encoding. :param client_side_validation: Enable client-side validation. Default True. :param socket_options: Options to pass down to the underlying urllib3 socket. @@ -205,7 +210,9 @@ def __init__( tls_server_name: Optional[str]=None, connection_pool_maxsize: Optional[int]=None, proxy: Optional[str]=None, + no_proxy: Optional[str]=None, proxy_headers: Optional[Any]=None, + proxy_ssl_context: Optional[ssl.SSLContext]=None, safe_chars_for_path_param: str='', client_side_validation: bool=True, socket_options: Optional[Any]=None, @@ -311,12 +318,29 @@ def __init__( per pool. None in the constructor is coerced to cpu_count * 5. """ - self.proxy = proxy - """Proxy URL + # urllib3 does not read proxy environment variables itself: + # https://github.com/urllib3/urllib3/issues/1785 + # A proxy taken from the environment is re-resolved when the host is + # assigned; see the host setter. + self._proxy_from_env = proxy is None + if proxy is None or no_proxy is None: + proxies = getproxies() + if proxy is None: + proxy = self._env_proxy(proxies, self.host) + if no_proxy is None: + no_proxy = proxies.get("no") + self._proxy = proxy + self.no_proxy = no_proxy + """Hosts that bypass the proxy """ self.proxy_headers = proxy_headers """Proxy headers """ + self.proxy_ssl_context = proxy_ssl_context + """SSL context used only for the TLS handshake with the proxy itself + (e.g. an HTTPS CONNECT tunnel), independent of the destination TLS + settings above. + """ self.safe_chars_for_path_param = safe_chars_for_path_param """Safe chars for path_param """ @@ -343,13 +367,17 @@ def __deepcopy__(self, memo: Dict[int, Any]) -> Self: result = cls.__new__(cls) memo[id(self)] = result for k, v in self.__dict__.items(): + if k == 'proxy_ssl_context': + # ssl.SSLContext holds unpicklable C state and can't be deepcopied. + setattr(result, k, v) + continue if k not in ('logger', 'logger_file_handler'): setattr(result, k, copy.deepcopy(v, memo)) # shallow copy of loggers result.logger = copy.copy(self.logger) - # use setters to configure loggers + # use setter to re-create the file handler (excluded from __dict__ copy) result.logger_file = self.logger_file - result.debug = self.debug + return result def __setattr__(self, name: str, value: Any) -> None: @@ -486,7 +514,8 @@ def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> self.refresh_api_key_hook(self) key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) if key: - prefix = self.api_key_prefix.get(identifier) + prefix = self.api_key_prefix.get( + identifier, self.api_key_prefix.get(alias) if alias is not None else None) if prefix: return "%s %s" % (prefix, key) else: @@ -541,7 +570,7 @@ def to_debug_report(self) -> str: "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 2\n"\ - "SDK Package Version: 3.3.1".\ + "SDK Package Version: 3.3.2".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self) -> List[HostSetting]: @@ -611,3 +640,23 @@ def host(self, value: str) -> None: """Fix base path.""" self._base_path = value self.server_index = None + if self._proxy_from_env: + # the scheme-specific proxy depends on the host, which is + # commonly assigned after construction + self._proxy = self._env_proxy(getproxies(), value) + + @staticmethod + def _env_proxy(proxies: Dict[str, str], host: str) -> Optional[str]: + """Pick the environment proxy that applies to `host`.""" + return proxies.get(urlparse(host).scheme) or proxies.get("all") + + @property + def proxy(self) -> Optional[str]: + """Proxy URL + """ + return self._proxy + + @proxy.setter + def proxy(self, value: Optional[str]) -> None: + self._proxy = value + self._proxy_from_env = False diff --git a/airflow_client/client/models/asset_alias_collection_response.py b/airflow_client/client/models/asset_alias_collection_response.py index a91490c..a23c5d2 100644 --- a/airflow_client/client/models/asset_alias_collection_response.py +++ b/airflow_client/client/models/asset_alias_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.asset_aliases: for _item_asset_aliases in self.asset_aliases: - if _item_asset_aliases: - _items.append(_item_asset_aliases.to_dict()) + _items.append(_item_asset_aliases.to_dict() if _item_asset_aliases is not None else None) _dict['asset_aliases'] = _items return _dict diff --git a/airflow_client/client/models/asset_collection_response.py b/airflow_client/client/models/asset_collection_response.py index 9751db5..e48f14c 100644 --- a/airflow_client/client/models/asset_collection_response.py +++ b/airflow_client/client/models/asset_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.assets: for _item_assets in self.assets: - if _item_assets: - _items.append(_item_assets.to_dict()) + _items.append(_item_assets.to_dict() if _item_assets is not None else None) _dict['assets'] = _items return _dict diff --git a/airflow_client/client/models/asset_event_collection_response.py b/airflow_client/client/models/asset_event_collection_response.py index 60c4a16..5771dcb 100644 --- a/airflow_client/client/models/asset_event_collection_response.py +++ b/airflow_client/client/models/asset_event_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.asset_events: for _item_asset_events in self.asset_events: - if _item_asset_events: - _items.append(_item_asset_events.to_dict()) + _items.append(_item_asset_events.to_dict() if _item_asset_events is not None else None) _dict['asset_events'] = _items return _dict diff --git a/airflow_client/client/models/asset_event_response.py b/airflow_client/client/models/asset_event_response.py index c598caa..fdde12a 100644 --- a/airflow_client/client/models/asset_event_response.py +++ b/airflow_client/client/models/asset_event_response.py @@ -87,8 +87,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.created_dagruns: for _item_created_dagruns in self.created_dagruns: - if _item_created_dagruns: - _items.append(_item_created_dagruns.to_dict()) + _items.append(_item_created_dagruns.to_dict() if _item_created_dagruns is not None else None) _dict['created_dagruns'] = _items return _dict diff --git a/airflow_client/client/models/asset_response.py b/airflow_client/client/models/asset_response.py index ee5b13e..937591e 100644 --- a/airflow_client/client/models/asset_response.py +++ b/airflow_client/client/models/asset_response.py @@ -92,15 +92,13 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.aliases: for _item_aliases in self.aliases: - if _item_aliases: - _items.append(_item_aliases.to_dict()) + _items.append(_item_aliases.to_dict() if _item_aliases is not None else None) _dict['aliases'] = _items # override the default output from pydantic by calling `to_dict()` of each item in consuming_tasks (list) _items = [] if self.consuming_tasks: for _item_consuming_tasks in self.consuming_tasks: - if _item_consuming_tasks: - _items.append(_item_consuming_tasks.to_dict()) + _items.append(_item_consuming_tasks.to_dict() if _item_consuming_tasks is not None else None) _dict['consuming_tasks'] = _items # override the default output from pydantic by calling `to_dict()` of last_asset_event if self.last_asset_event: @@ -109,22 +107,19 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.producing_tasks: for _item_producing_tasks in self.producing_tasks: - if _item_producing_tasks: - _items.append(_item_producing_tasks.to_dict()) + _items.append(_item_producing_tasks.to_dict() if _item_producing_tasks is not None else None) _dict['producing_tasks'] = _items # override the default output from pydantic by calling `to_dict()` of each item in scheduled_dags (list) _items = [] if self.scheduled_dags: for _item_scheduled_dags in self.scheduled_dags: - if _item_scheduled_dags: - _items.append(_item_scheduled_dags.to_dict()) + _items.append(_item_scheduled_dags.to_dict() if _item_scheduled_dags is not None else None) _dict['scheduled_dags'] = _items # override the default output from pydantic by calling `to_dict()` of each item in watchers (list) _items = [] if self.watchers: for _item_watchers in self.watchers: - if _item_watchers: - _items.append(_item_watchers.to_dict()) + _items.append(_item_watchers.to_dict() if _item_watchers is not None else None) _dict['watchers'] = _items return _dict diff --git a/airflow_client/client/models/asset_state_store_collection_response.py b/airflow_client/client/models/asset_state_store_collection_response.py index 10e88f9..4de5af4 100644 --- a/airflow_client/client/models/asset_state_store_collection_response.py +++ b/airflow_client/client/models/asset_state_store_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.asset_state_store: for _item_asset_state_store in self.asset_state_store: - if _item_asset_state_store: - _items.append(_item_asset_state_store.to_dict()) + _items.append(_item_asset_state_store.to_dict() if _item_asset_state_store is not None else None) _dict['asset_state_store'] = _items return _dict diff --git a/airflow_client/client/models/backfill_collection_response.py b/airflow_client/client/models/backfill_collection_response.py index a122ed8..64803e8 100644 --- a/airflow_client/client/models/backfill_collection_response.py +++ b/airflow_client/client/models/backfill_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.backfills: for _item_backfills in self.backfills: - if _item_backfills: - _items.append(_item_backfills.to_dict()) + _items.append(_item_backfills.to_dict() if _item_backfills is not None else None) _dict['backfills'] = _items return _dict diff --git a/airflow_client/client/models/bulk_body_bulk_dag_run_body.py b/airflow_client/client/models/bulk_body_bulk_dag_run_body.py index ad8f261..507d526 100644 --- a/airflow_client/client/models/bulk_body_bulk_dag_run_body.py +++ b/airflow_client/client/models/bulk_body_bulk_dag_run_body.py @@ -74,8 +74,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.actions: for _item_actions in self.actions: - if _item_actions: - _items.append(_item_actions.to_dict()) + _items.append(_item_actions.to_dict() if _item_actions is not None else None) _dict['actions'] = _items return _dict diff --git a/airflow_client/client/models/bulk_body_bulk_task_instance_body.py b/airflow_client/client/models/bulk_body_bulk_task_instance_body.py index c8a6c55..6ee0375 100644 --- a/airflow_client/client/models/bulk_body_bulk_task_instance_body.py +++ b/airflow_client/client/models/bulk_body_bulk_task_instance_body.py @@ -74,8 +74,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.actions: for _item_actions in self.actions: - if _item_actions: - _items.append(_item_actions.to_dict()) + _items.append(_item_actions.to_dict() if _item_actions is not None else None) _dict['actions'] = _items return _dict diff --git a/airflow_client/client/models/bulk_body_connection_body.py b/airflow_client/client/models/bulk_body_connection_body.py index dcaba92..cb27603 100644 --- a/airflow_client/client/models/bulk_body_connection_body.py +++ b/airflow_client/client/models/bulk_body_connection_body.py @@ -74,8 +74,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.actions: for _item_actions in self.actions: - if _item_actions: - _items.append(_item_actions.to_dict()) + _items.append(_item_actions.to_dict() if _item_actions is not None else None) _dict['actions'] = _items return _dict diff --git a/airflow_client/client/models/bulk_body_pool_body.py b/airflow_client/client/models/bulk_body_pool_body.py index 1f3b6ab..ac0485a 100644 --- a/airflow_client/client/models/bulk_body_pool_body.py +++ b/airflow_client/client/models/bulk_body_pool_body.py @@ -74,8 +74,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.actions: for _item_actions in self.actions: - if _item_actions: - _items.append(_item_actions.to_dict()) + _items.append(_item_actions.to_dict() if _item_actions is not None else None) _dict['actions'] = _items return _dict diff --git a/airflow_client/client/models/bulk_body_variable_body.py b/airflow_client/client/models/bulk_body_variable_body.py index 9f1fb69..eacedb5 100644 --- a/airflow_client/client/models/bulk_body_variable_body.py +++ b/airflow_client/client/models/bulk_body_variable_body.py @@ -74,8 +74,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.actions: for _item_actions in self.actions: - if _item_actions: - _items.append(_item_actions.to_dict()) + _items.append(_item_actions.to_dict() if _item_actions is not None else None) _dict['actions'] = _items return _dict diff --git a/airflow_client/client/models/bulk_create_action_bulk_dag_run_body.py b/airflow_client/client/models/bulk_create_action_bulk_dag_run_body.py index 4b56913..dbdc7c2 100644 --- a/airflow_client/client/models/bulk_create_action_bulk_dag_run_body.py +++ b/airflow_client/client/models/bulk_create_action_bulk_dag_run_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_create_action_bulk_task_instance_body.py b/airflow_client/client/models/bulk_create_action_bulk_task_instance_body.py index eb0fa02..c1e8583 100644 --- a/airflow_client/client/models/bulk_create_action_bulk_task_instance_body.py +++ b/airflow_client/client/models/bulk_create_action_bulk_task_instance_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_create_action_connection_body.py b/airflow_client/client/models/bulk_create_action_connection_body.py index 425cfde..c19055d 100644 --- a/airflow_client/client/models/bulk_create_action_connection_body.py +++ b/airflow_client/client/models/bulk_create_action_connection_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_create_action_pool_body.py b/airflow_client/client/models/bulk_create_action_pool_body.py index c084954..6ba00c9 100644 --- a/airflow_client/client/models/bulk_create_action_pool_body.py +++ b/airflow_client/client/models/bulk_create_action_pool_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_create_action_variable_body.py b/airflow_client/client/models/bulk_create_action_variable_body.py index 7e857f6..ca28698 100644 --- a/airflow_client/client/models/bulk_create_action_variable_body.py +++ b/airflow_client/client/models/bulk_create_action_variable_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_dag_run_clear_body.py b/airflow_client/client/models/bulk_dag_run_clear_body.py index 957a8db..ed189c0 100644 --- a/airflow_client/client/models/bulk_dag_run_clear_body.py +++ b/airflow_client/client/models/bulk_dag_run_clear_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.dag_runs: for _item_dag_runs in self.dag_runs: - if _item_dag_runs: - _items.append(_item_dag_runs.to_dict()) + _items.append(_item_dag_runs.to_dict() if _item_dag_runs is not None else None) _dict['dag_runs'] = _items return _dict diff --git a/airflow_client/client/models/bulk_delete_action_bulk_dag_run_body.py b/airflow_client/client/models/bulk_delete_action_bulk_dag_run_body.py index 3d91db2..218e0f9 100644 --- a/airflow_client/client/models/bulk_delete_action_bulk_dag_run_body.py +++ b/airflow_client/client/models/bulk_delete_action_bulk_dag_run_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_delete_action_bulk_task_instance_body.py b/airflow_client/client/models/bulk_delete_action_bulk_task_instance_body.py index 5cd21a0..bbad76a 100644 --- a/airflow_client/client/models/bulk_delete_action_bulk_task_instance_body.py +++ b/airflow_client/client/models/bulk_delete_action_bulk_task_instance_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_delete_action_connection_body.py b/airflow_client/client/models/bulk_delete_action_connection_body.py index c7829cc..7f3a467 100644 --- a/airflow_client/client/models/bulk_delete_action_connection_body.py +++ b/airflow_client/client/models/bulk_delete_action_connection_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_delete_action_pool_body.py b/airflow_client/client/models/bulk_delete_action_pool_body.py index 2233c63..c2f01b2 100644 --- a/airflow_client/client/models/bulk_delete_action_pool_body.py +++ b/airflow_client/client/models/bulk_delete_action_pool_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_delete_action_variable_body.py b/airflow_client/client/models/bulk_delete_action_variable_body.py index 25c271f..540008e 100644 --- a/airflow_client/client/models/bulk_delete_action_variable_body.py +++ b/airflow_client/client/models/bulk_delete_action_variable_body.py @@ -84,8 +84,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_update_action_bulk_dag_run_body.py b/airflow_client/client/models/bulk_update_action_bulk_dag_run_body.py index 732447d..4ea0199 100644 --- a/airflow_client/client/models/bulk_update_action_bulk_dag_run_body.py +++ b/airflow_client/client/models/bulk_update_action_bulk_dag_run_body.py @@ -85,8 +85,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_update_action_bulk_task_instance_body.py b/airflow_client/client/models/bulk_update_action_bulk_task_instance_body.py index c1c24e9..14402de 100644 --- a/airflow_client/client/models/bulk_update_action_bulk_task_instance_body.py +++ b/airflow_client/client/models/bulk_update_action_bulk_task_instance_body.py @@ -85,8 +85,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_update_action_connection_body.py b/airflow_client/client/models/bulk_update_action_connection_body.py index 7313c72..f471dee 100644 --- a/airflow_client/client/models/bulk_update_action_connection_body.py +++ b/airflow_client/client/models/bulk_update_action_connection_body.py @@ -85,8 +85,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_update_action_pool_body.py b/airflow_client/client/models/bulk_update_action_pool_body.py index 3f3ec77..11cc074 100644 --- a/airflow_client/client/models/bulk_update_action_pool_body.py +++ b/airflow_client/client/models/bulk_update_action_pool_body.py @@ -85,8 +85,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/bulk_update_action_variable_body.py b/airflow_client/client/models/bulk_update_action_variable_body.py index 3b515a5..239351e 100644 --- a/airflow_client/client/models/bulk_update_action_variable_body.py +++ b/airflow_client/client/models/bulk_update_action_variable_body.py @@ -85,8 +85,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.entities: for _item_entities in self.entities: - if _item_entities: - _items.append(_item_entities.to_dict()) + _items.append(_item_entities.to_dict() if _item_entities is not None else None) _dict['entities'] = _items return _dict diff --git a/airflow_client/client/models/clear_task_instance_collection_response.py b/airflow_client/client/models/clear_task_instance_collection_response.py index 1240ca6..a3459be 100644 --- a/airflow_client/client/models/clear_task_instance_collection_response.py +++ b/airflow_client/client/models/clear_task_instance_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.task_instances: for _item_task_instances in self.task_instances: - if _item_task_instances: - _items.append(_item_task_instances.to_dict()) + _items.append(_item_task_instances.to_dict() if _item_task_instances is not None else None) _dict['task_instances'] = _items return _dict diff --git a/airflow_client/client/models/clear_task_instances_body.py b/airflow_client/client/models/clear_task_instances_body.py index ba554d8..0f074d0 100644 --- a/airflow_client/client/models/clear_task_instances_body.py +++ b/airflow_client/client/models/clear_task_instances_body.py @@ -90,8 +90,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.task_ids: for _item_task_ids in self.task_ids: - if _item_task_ids: - _items.append(_item_task_ids.to_dict()) + _items.append(_item_task_ids.to_dict() if _item_task_ids is not None else None) _dict['task_ids'] = _items return _dict diff --git a/airflow_client/client/models/config.py b/airflow_client/client/models/config.py index 562d4d3..0413544 100644 --- a/airflow_client/client/models/config.py +++ b/airflow_client/client/models/config.py @@ -74,8 +74,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.sections: for _item_sections in self.sections: - if _item_sections: - _items.append(_item_sections.to_dict()) + _items.append(_item_sections.to_dict() if _item_sections is not None else None) _dict['sections'] = _items return _dict diff --git a/airflow_client/client/models/config_section.py b/airflow_client/client/models/config_section.py index 4c1aa24..193508e 100644 --- a/airflow_client/client/models/config_section.py +++ b/airflow_client/client/models/config_section.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.options: for _item_options in self.options: - if _item_options: - _items.append(_item_options.to_dict()) + _items.append(_item_options.to_dict() if _item_options is not None else None) _dict['options'] = _items return _dict diff --git a/airflow_client/client/models/connection_body.py b/airflow_client/client/models/connection_body.py index 9dc4507..3cb5ae6 100644 --- a/airflow_client/client/models/connection_body.py +++ b/airflow_client/client/models/connection_body.py @@ -40,13 +40,10 @@ class ConnectionBody(BaseModel): team_name: Optional[Annotated[str, Field(strict=True, max_length=50)]] = None __properties: ClassVar[List[str]] = ["conn_type", "connection_id", "description", "extra", "host", "login", "password", "port", "schema", "team_name"] - @field_validator('connection_id') + @field_validator('connection_id', mode="before") def connection_id_validate_regular_expression(cls, value): """Validates the regular expression""" - if not isinstance(value, str): - value = str(value) - - if not re.match(r"^[\w.-]+$", value): + if isinstance(value, str) and not re.match(r"^[\w.-]+$", value): raise ValueError(r"must validate the regular expression /^[\w.-]+$/") return value diff --git a/airflow_client/client/models/connection_collection_response.py b/airflow_client/client/models/connection_collection_response.py index 7885305..e1a9690 100644 --- a/airflow_client/client/models/connection_collection_response.py +++ b/airflow_client/client/models/connection_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.connections: for _item_connections in self.connections: - if _item_connections: - _items.append(_item_connections.to_dict()) + _items.append(_item_connections.to_dict() if _item_connections is not None else None) _dict['connections'] = _items return _dict diff --git a/airflow_client/client/models/connection_test_request_body.py b/airflow_client/client/models/connection_test_request_body.py index 040f633..3128463 100644 --- a/airflow_client/client/models/connection_test_request_body.py +++ b/airflow_client/client/models/connection_test_request_body.py @@ -43,13 +43,10 @@ class ConnectionTestRequestBody(BaseModel): team_name: Optional[Annotated[str, Field(strict=True, max_length=50)]] = None __properties: ClassVar[List[str]] = ["commit_on_success", "conn_type", "connection_id", "description", "executor", "extra", "host", "login", "password", "port", "queue", "schema", "team_name"] - @field_validator('connection_id') + @field_validator('connection_id', mode="before") def connection_id_validate_regular_expression(cls, value): """Validates the regular expression""" - if not isinstance(value, str): - value = str(value) - - if not re.match(r"^[\w.-]+$", value): + if isinstance(value, str) and not re.match(r"^[\w.-]+$", value): raise ValueError(r"must validate the regular expression /^[\w.-]+$/") return value diff --git a/airflow_client/client/models/create_asset_events_body.py b/airflow_client/client/models/create_asset_events_body.py index 1ee001c..6e3cc9f 100644 --- a/airflow_client/client/models/create_asset_events_body.py +++ b/airflow_client/client/models/create_asset_events_body.py @@ -36,16 +36,13 @@ class CreateAssetEventsBody(BaseModel): additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["access_control", "asset_id", "extra", "partition_key"] - @field_validator('partition_key') + @field_validator('partition_key', mode="before") def partition_key_validate_regular_expression(cls, value): """Validates the regular expression""" if value is None: return value - if not isinstance(value, str): - value = str(value) - - if not re.match(r"\S", value): + if isinstance(value, str) and not re.match(r"\S", value): raise ValueError(r"must validate the regular expression /\S/") return value diff --git a/airflow_client/client/models/dag_collection_response.py b/airflow_client/client/models/dag_collection_response.py index eba15db..1f6b72f 100644 --- a/airflow_client/client/models/dag_collection_response.py +++ b/airflow_client/client/models/dag_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.dags: for _item_dags in self.dags: - if _item_dags: - _items.append(_item_dags.to_dict()) + _items.append(_item_dags.to_dict() if _item_dags is not None else None) _dict['dags'] = _items return _dict diff --git a/airflow_client/client/models/dag_details_response.py b/airflow_client/client/models/dag_details_response.py index 8f7c064..c819c70 100644 --- a/airflow_client/client/models/dag_details_response.py +++ b/airflow_client/client/models/dag_details_response.py @@ -134,8 +134,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.tags: for _item_tags in self.tags: - if _item_tags: - _items.append(_item_tags.to_dict()) + _items.append(_item_tags.to_dict() if _item_tags is not None else None) _dict['tags'] = _items return _dict diff --git a/airflow_client/client/models/dag_response.py b/airflow_client/client/models/dag_response.py index 1c62919..17641fd 100644 --- a/airflow_client/client/models/dag_response.py +++ b/airflow_client/client/models/dag_response.py @@ -109,8 +109,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.tags: for _item_tags in self.tags: - if _item_tags: - _items.append(_item_tags.to_dict()) + _items.append(_item_tags.to_dict() if _item_tags is not None else None) _dict['tags'] = _items return _dict diff --git a/airflow_client/client/models/dag_run_asset_reference.py b/airflow_client/client/models/dag_run_asset_reference.py index c462107..9d526fd 100644 --- a/airflow_client/client/models/dag_run_asset_reference.py +++ b/airflow_client/client/models/dag_run_asset_reference.py @@ -18,7 +18,7 @@ import json from datetime import datetime -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self @@ -37,7 +37,8 @@ class DagRunAssetReference(BaseModel): run_id: StrictStr start_date: datetime state: StrictStr - __properties: ClassVar[List[str]] = ["dag_id", "data_interval_end", "data_interval_start", "end_date", "logical_date", "partition_key", "run_id", "start_date", "state"] + triggering: StrictBool = Field(description="Whether this asset event triggered the referenced dag run. Only a run's most recent consumed asset event triggers it; earlier consumed events are included in the run but did not trigger it.") + __properties: ClassVar[List[str]] = ["dag_id", "data_interval_end", "data_interval_start", "end_date", "logical_date", "partition_key", "run_id", "start_date", "state", "triggering"] model_config = ConfigDict( validate_by_name=True, @@ -98,7 +99,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "partition_key": obj.get("partition_key"), "run_id": obj.get("run_id"), "start_date": obj.get("start_date"), - "state": obj.get("state") + "state": obj.get("state"), + "triggering": obj.get("triggering") }) return _obj diff --git a/airflow_client/client/models/dag_run_collection_response.py b/airflow_client/client/models/dag_run_collection_response.py index 9d57b12..bea7e93 100644 --- a/airflow_client/client/models/dag_run_collection_response.py +++ b/airflow_client/client/models/dag_run_collection_response.py @@ -32,7 +32,8 @@ class DAGRunCollectionResponse(BaseModel): next_cursor: Optional[StrictStr] = None previous_cursor: Optional[StrictStr] = None total_entries: Optional[StrictInt] = None - __properties: ClassVar[List[str]] = ["dag_runs", "next_cursor", "previous_cursor", "total_entries"] + total_entries_limit: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["dag_runs", "next_cursor", "previous_cursor", "total_entries", "total_entries_limit"] model_config = ConfigDict( validate_by_name=True, @@ -77,8 +78,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.dag_runs: for _item_dag_runs in self.dag_runs: - if _item_dag_runs: - _items.append(_item_dag_runs.to_dict()) + _items.append(_item_dag_runs.to_dict() if _item_dag_runs is not None else None) _dict['dag_runs'] = _items return _dict @@ -95,7 +95,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "dag_runs": [DAGRunResponse.from_dict(_item) for _item in obj["dag_runs"]] if obj.get("dag_runs") is not None else None, "next_cursor": obj.get("next_cursor"), "previous_cursor": obj.get("previous_cursor"), - "total_entries": obj.get("total_entries") + "total_entries": obj.get("total_entries"), + "total_entries_limit": obj.get("total_entries_limit") }) return _obj diff --git a/airflow_client/client/models/dag_run_response.py b/airflow_client/client/models/dag_run_response.py index f04d2d9..5b35a14 100644 --- a/airflow_client/client/models/dag_run_response.py +++ b/airflow_client/client/models/dag_run_response.py @@ -99,8 +99,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.dag_versions: for _item_dag_versions in self.dag_versions: - if _item_dag_versions: - _items.append(_item_dag_versions.to_dict()) + _items.append(_item_dag_versions.to_dict() if _item_dag_versions is not None else None) _dict['dag_versions'] = _items return _dict diff --git a/airflow_client/client/models/dag_stats_collection_response.py b/airflow_client/client/models/dag_stats_collection_response.py index ecd3ca3..64d9924 100644 --- a/airflow_client/client/models/dag_stats_collection_response.py +++ b/airflow_client/client/models/dag_stats_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.dags: for _item_dags in self.dags: - if _item_dags: - _items.append(_item_dags.to_dict()) + _items.append(_item_dags.to_dict() if _item_dags is not None else None) _dict['dags'] = _items return _dict diff --git a/airflow_client/client/models/dag_stats_response.py b/airflow_client/client/models/dag_stats_response.py index 32d1d26..9d682ee 100644 --- a/airflow_client/client/models/dag_stats_response.py +++ b/airflow_client/client/models/dag_stats_response.py @@ -76,8 +76,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.stats: for _item_stats in self.stats: - if _item_stats: - _items.append(_item_stats.to_dict()) + _items.append(_item_stats.to_dict() if _item_stats is not None else None) _dict['stats'] = _items return _dict diff --git a/airflow_client/client/models/dag_version_collection_response.py b/airflow_client/client/models/dag_version_collection_response.py index ebf8f7d..a0a63ac 100644 --- a/airflow_client/client/models/dag_version_collection_response.py +++ b/airflow_client/client/models/dag_version_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.dag_versions: for _item_dag_versions in self.dag_versions: - if _item_dag_versions: - _items.append(_item_dag_versions.to_dict()) + _items.append(_item_dag_versions.to_dict() if _item_dag_versions is not None else None) _dict['dag_versions'] = _items return _dict diff --git a/airflow_client/client/models/dag_warning_collection_response.py b/airflow_client/client/models/dag_warning_collection_response.py index 8781757..9678b18 100644 --- a/airflow_client/client/models/dag_warning_collection_response.py +++ b/airflow_client/client/models/dag_warning_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.dag_warnings: for _item_dag_warnings in self.dag_warnings: - if _item_dag_warnings: - _items.append(_item_dag_warnings.to_dict()) + _items.append(_item_dag_warnings.to_dict() if _item_dag_warnings is not None else None) _dict['dag_warnings'] = _items return _dict diff --git a/airflow_client/client/models/dry_run_backfill_collection_response.py b/airflow_client/client/models/dry_run_backfill_collection_response.py index bcb8f34..30f2252 100644 --- a/airflow_client/client/models/dry_run_backfill_collection_response.py +++ b/airflow_client/client/models/dry_run_backfill_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.backfills: for _item_backfills in self.backfills: - if _item_backfills: - _items.append(_item_backfills.to_dict()) + _items.append(_item_backfills.to_dict() if _item_backfills is not None else None) _dict['backfills'] = _items return _dict diff --git a/airflow_client/client/models/event_log_collection_response.py b/airflow_client/client/models/event_log_collection_response.py index becbde0..d80cbc5 100644 --- a/airflow_client/client/models/event_log_collection_response.py +++ b/airflow_client/client/models/event_log_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.event_logs: for _item_event_logs in self.event_logs: - if _item_event_logs: - _items.append(_item_event_logs.to_dict()) + _items.append(_item_event_logs.to_dict() if _item_event_logs is not None else None) _dict['event_logs'] = _items return _dict diff --git a/airflow_client/client/models/hitl_detail.py b/airflow_client/client/models/hitl_detail.py index 2835f8e..852a9e6 100644 --- a/airflow_client/client/models/hitl_detail.py +++ b/airflow_client/client/models/hitl_detail.py @@ -90,8 +90,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.assigned_users: for _item_assigned_users in self.assigned_users: - if _item_assigned_users: - _items.append(_item_assigned_users.to_dict()) + _items.append(_item_assigned_users.to_dict() if _item_assigned_users is not None else None) _dict['assigned_users'] = _items # override the default output from pydantic by calling `to_dict()` of responded_by_user if self.responded_by_user: diff --git a/airflow_client/client/models/hitl_detail_collection.py b/airflow_client/client/models/hitl_detail_collection.py index 1e3fbc9..515cada 100644 --- a/airflow_client/client/models/hitl_detail_collection.py +++ b/airflow_client/client/models/hitl_detail_collection.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.hitl_details: for _item_hitl_details in self.hitl_details: - if _item_hitl_details: - _items.append(_item_hitl_details.to_dict()) + _items.append(_item_hitl_details.to_dict() if _item_hitl_details is not None else None) _dict['hitl_details'] = _items return _dict diff --git a/airflow_client/client/models/hitl_detail_history.py b/airflow_client/client/models/hitl_detail_history.py index 2396011..136dabe 100644 --- a/airflow_client/client/models/hitl_detail_history.py +++ b/airflow_client/client/models/hitl_detail_history.py @@ -90,8 +90,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.assigned_users: for _item_assigned_users in self.assigned_users: - if _item_assigned_users: - _items.append(_item_assigned_users.to_dict()) + _items.append(_item_assigned_users.to_dict() if _item_assigned_users is not None else None) _dict['assigned_users'] = _items # override the default output from pydantic by calling `to_dict()` of responded_by_user if self.responded_by_user: diff --git a/airflow_client/client/models/http_validation_error.py b/airflow_client/client/models/http_validation_error.py index 636ad4a..a24f2da 100644 --- a/airflow_client/client/models/http_validation_error.py +++ b/airflow_client/client/models/http_validation_error.py @@ -74,8 +74,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.detail: for _item_detail in self.detail: - if _item_detail: - _items.append(_item_detail.to_dict()) + _items.append(_item_detail.to_dict() if _item_detail is not None else None) _dict['detail'] = _items return _dict diff --git a/airflow_client/client/models/import_error_collection_response.py b/airflow_client/client/models/import_error_collection_response.py index 1ff150f..4934664 100644 --- a/airflow_client/client/models/import_error_collection_response.py +++ b/airflow_client/client/models/import_error_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.import_errors: for _item_import_errors in self.import_errors: - if _item_import_errors: - _items.append(_item_import_errors.to_dict()) + _items.append(_item_import_errors.to_dict() if _item_import_errors is not None else None) _dict['import_errors'] = _items return _dict diff --git a/airflow_client/client/models/job_collection_response.py b/airflow_client/client/models/job_collection_response.py index 9745d77..04e6c69 100644 --- a/airflow_client/client/models/job_collection_response.py +++ b/airflow_client/client/models/job_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.jobs: for _item_jobs in self.jobs: - if _item_jobs: - _items.append(_item_jobs.to_dict()) + _items.append(_item_jobs.to_dict() if _item_jobs is not None else None) _dict['jobs'] = _items return _dict diff --git a/airflow_client/client/models/plugin_collection_response.py b/airflow_client/client/models/plugin_collection_response.py index 4a6aadd..78bd7a4 100644 --- a/airflow_client/client/models/plugin_collection_response.py +++ b/airflow_client/client/models/plugin_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.plugins: for _item_plugins in self.plugins: - if _item_plugins: - _items.append(_item_plugins.to_dict()) + _items.append(_item_plugins.to_dict() if _item_plugins is not None else None) _dict['plugins'] = _items return _dict diff --git a/airflow_client/client/models/plugin_import_error_collection_response.py b/airflow_client/client/models/plugin_import_error_collection_response.py index af470b6..fb628c4 100644 --- a/airflow_client/client/models/plugin_import_error_collection_response.py +++ b/airflow_client/client/models/plugin_import_error_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.import_errors: for _item_import_errors in self.import_errors: - if _item_import_errors: - _items.append(_item_import_errors.to_dict()) + _items.append(_item_import_errors.to_dict() if _item_import_errors is not None else None) _dict['import_errors'] = _items return _dict diff --git a/airflow_client/client/models/plugin_response.py b/airflow_client/client/models/plugin_response.py index 700fe37..7b5f57e 100644 --- a/airflow_client/client/models/plugin_response.py +++ b/airflow_client/client/models/plugin_response.py @@ -92,43 +92,37 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.appbuilder_menu_items: for _item_appbuilder_menu_items in self.appbuilder_menu_items: - if _item_appbuilder_menu_items: - _items.append(_item_appbuilder_menu_items.to_dict()) + _items.append(_item_appbuilder_menu_items.to_dict() if _item_appbuilder_menu_items is not None else None) _dict['appbuilder_menu_items'] = _items # override the default output from pydantic by calling `to_dict()` of each item in appbuilder_views (list) _items = [] if self.appbuilder_views: for _item_appbuilder_views in self.appbuilder_views: - if _item_appbuilder_views: - _items.append(_item_appbuilder_views.to_dict()) + _items.append(_item_appbuilder_views.to_dict() if _item_appbuilder_views is not None else None) _dict['appbuilder_views'] = _items # override the default output from pydantic by calling `to_dict()` of each item in external_views (list) _items = [] if self.external_views: for _item_external_views in self.external_views: - if _item_external_views: - _items.append(_item_external_views.to_dict()) + _items.append(_item_external_views.to_dict() if _item_external_views is not None else None) _dict['external_views'] = _items # override the default output from pydantic by calling `to_dict()` of each item in fastapi_apps (list) _items = [] if self.fastapi_apps: for _item_fastapi_apps in self.fastapi_apps: - if _item_fastapi_apps: - _items.append(_item_fastapi_apps.to_dict()) + _items.append(_item_fastapi_apps.to_dict() if _item_fastapi_apps is not None else None) _dict['fastapi_apps'] = _items # override the default output from pydantic by calling `to_dict()` of each item in fastapi_root_middlewares (list) _items = [] if self.fastapi_root_middlewares: for _item_fastapi_root_middlewares in self.fastapi_root_middlewares: - if _item_fastapi_root_middlewares: - _items.append(_item_fastapi_root_middlewares.to_dict()) + _items.append(_item_fastapi_root_middlewares.to_dict() if _item_fastapi_root_middlewares is not None else None) _dict['fastapi_root_middlewares'] = _items # override the default output from pydantic by calling `to_dict()` of each item in react_apps (list) _items = [] if self.react_apps: for _item_react_apps in self.react_apps: - if _item_react_apps: - _items.append(_item_react_apps.to_dict()) + _items.append(_item_react_apps.to_dict() if _item_react_apps is not None else None) _dict['react_apps'] = _items return _dict diff --git a/airflow_client/client/models/pool_collection_response.py b/airflow_client/client/models/pool_collection_response.py index 0fc685a..f7b962e 100644 --- a/airflow_client/client/models/pool_collection_response.py +++ b/airflow_client/client/models/pool_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.pools: for _item_pools in self.pools: - if _item_pools: - _items.append(_item_pools.to_dict()) + _items.append(_item_pools.to_dict() if _item_pools is not None else None) _dict['pools'] = _items return _dict diff --git a/airflow_client/client/models/provider_collection_response.py b/airflow_client/client/models/provider_collection_response.py index 9a04974..b47f416 100644 --- a/airflow_client/client/models/provider_collection_response.py +++ b/airflow_client/client/models/provider_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.providers: for _item_providers in self.providers: - if _item_providers: - _items.append(_item_providers.to_dict()) + _items.append(_item_providers.to_dict() if _item_providers is not None else None) _dict['providers'] = _items return _dict diff --git a/airflow_client/client/models/queued_event_collection_response.py b/airflow_client/client/models/queued_event_collection_response.py index d4a8c9b..e6fae54 100644 --- a/airflow_client/client/models/queued_event_collection_response.py +++ b/airflow_client/client/models/queued_event_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.queued_events: for _item_queued_events in self.queued_events: - if _item_queued_events: - _items.append(_item_queued_events.to_dict()) + _items.append(_item_queued_events.to_dict() if _item_queued_events is not None else None) _dict['queued_events'] = _items return _dict diff --git a/airflow_client/client/models/task_collection_response.py b/airflow_client/client/models/task_collection_response.py index ec9eeac..d24e294 100644 --- a/airflow_client/client/models/task_collection_response.py +++ b/airflow_client/client/models/task_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.tasks: for _item_tasks in self.tasks: - if _item_tasks: - _items.append(_item_tasks.to_dict()) + _items.append(_item_tasks.to_dict() if _item_tasks is not None else None) _dict['tasks'] = _items return _dict diff --git a/airflow_client/client/models/task_dependency_collection_response.py b/airflow_client/client/models/task_dependency_collection_response.py index c79d69e..7484bd2 100644 --- a/airflow_client/client/models/task_dependency_collection_response.py +++ b/airflow_client/client/models/task_dependency_collection_response.py @@ -74,8 +74,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.dependencies: for _item_dependencies in self.dependencies: - if _item_dependencies: - _items.append(_item_dependencies.to_dict()) + _items.append(_item_dependencies.to_dict() if _item_dependencies is not None else None) _dict['dependencies'] = _items return _dict diff --git a/airflow_client/client/models/task_instance_collection_response.py b/airflow_client/client/models/task_instance_collection_response.py index 04d1fc8..c1c68e5 100644 --- a/airflow_client/client/models/task_instance_collection_response.py +++ b/airflow_client/client/models/task_instance_collection_response.py @@ -32,7 +32,8 @@ class TaskInstanceCollectionResponse(BaseModel): previous_cursor: Optional[StrictStr] = None task_instances: List[TaskInstanceResponse] total_entries: Optional[StrictInt] = None - __properties: ClassVar[List[str]] = ["next_cursor", "previous_cursor", "task_instances", "total_entries"] + total_entries_limit: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["next_cursor", "previous_cursor", "task_instances", "total_entries", "total_entries_limit"] model_config = ConfigDict( validate_by_name=True, @@ -77,8 +78,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.task_instances: for _item_task_instances in self.task_instances: - if _item_task_instances: - _items.append(_item_task_instances.to_dict()) + _items.append(_item_task_instances.to_dict() if _item_task_instances is not None else None) _dict['task_instances'] = _items return _dict @@ -95,7 +95,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "next_cursor": obj.get("next_cursor"), "previous_cursor": obj.get("previous_cursor"), "task_instances": [TaskInstanceResponse.from_dict(_item) for _item in obj["task_instances"]] if obj.get("task_instances") is not None else None, - "total_entries": obj.get("total_entries") + "total_entries": obj.get("total_entries"), + "total_entries_limit": obj.get("total_entries_limit") }) return _obj diff --git a/airflow_client/client/models/task_instance_history_collection_response.py b/airflow_client/client/models/task_instance_history_collection_response.py index 80e48e1..60ce0dc 100644 --- a/airflow_client/client/models/task_instance_history_collection_response.py +++ b/airflow_client/client/models/task_instance_history_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.task_instances: for _item_task_instances in self.task_instances: - if _item_task_instances: - _items.append(_item_task_instances.to_dict()) + _items.append(_item_task_instances.to_dict() if _item_task_instances is not None else None) _dict['task_instances'] = _items return _dict diff --git a/airflow_client/client/models/task_state_store_collection_response.py b/airflow_client/client/models/task_state_store_collection_response.py index 8b1061a..2097ceb 100644 --- a/airflow_client/client/models/task_state_store_collection_response.py +++ b/airflow_client/client/models/task_state_store_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.task_state_store: for _item_task_state_store in self.task_state_store: - if _item_task_state_store: - _items.append(_item_task_state_store.to_dict()) + _items.append(_item_task_state_store.to_dict() if _item_task_state_store is not None else None) _dict['task_state_store'] = _items return _dict diff --git a/airflow_client/client/models/validation_error.py b/airflow_client/client/models/validation_error.py index 783e814..8027a72 100644 --- a/airflow_client/client/models/validation_error.py +++ b/airflow_client/client/models/validation_error.py @@ -78,8 +78,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.loc: for _item_loc in self.loc: - if _item_loc: - _items.append(_item_loc.to_dict()) + _items.append(_item_loc.to_dict() if _item_loc is not None else None) _dict['loc'] = _items # set to None if input (nullable) is None # and model_fields_set contains the field diff --git a/airflow_client/client/models/variable_collection_response.py b/airflow_client/client/models/variable_collection_response.py index ba47255..8c57add 100644 --- a/airflow_client/client/models/variable_collection_response.py +++ b/airflow_client/client/models/variable_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.variables: for _item_variables in self.variables: - if _item_variables: - _items.append(_item_variables.to_dict()) + _items.append(_item_variables.to_dict() if _item_variables is not None else None) _dict['variables'] = _items return _dict diff --git a/airflow_client/client/models/x_com_collection_response.py b/airflow_client/client/models/x_com_collection_response.py index 1fb8f7c..e388538 100644 --- a/airflow_client/client/models/x_com_collection_response.py +++ b/airflow_client/client/models/x_com_collection_response.py @@ -75,8 +75,7 @@ def to_dict(self) -> Dict[str, Any]: _items = [] if self.xcom_entries: for _item_xcom_entries in self.xcom_entries: - if _item_xcom_entries: - _items.append(_item_xcom_entries.to_dict()) + _items.append(_item_xcom_entries.to_dict() if _item_xcom_entries is not None else None) _dict['xcom_entries'] = _items return _dict diff --git a/airflow_client/client/rest.py b/airflow_client/client/rest.py index 856647b..0ea0e56 100644 --- a/airflow_client/client/rest.py +++ b/airflow_client/client/rest.py @@ -12,10 +12,12 @@ """ # noqa: E501 +import ipaddress import io import json import re import ssl +from urllib.parse import urlparse import urllib3 @@ -34,6 +36,59 @@ def is_socks_proxy_url(url): else: return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES +def contenttype_matches(contenttype, maintype, subtype): + """Matches the given contenttype against the given type and subtype + + :param contenttype: the content type to match + :param maintype: the expected maintype + :param subtype: the expected subtype + :return: `true` when the given content type matches the given type and subtype, + regardless of the presence of mime type parameters, otherwise returns `false`. + :rtype: bool + """ + pattern = '{type}/(?:[^+;]+\\+)?{subtype}(?:[ \t]*;.*)?'.format( + type = re.escape(maintype), + subtype = re.escape(subtype), + ) + return re.fullmatch(pattern, contenttype, re.IGNORECASE) is not None + +def should_bypass_proxies(url: str, no_proxy: str) -> bool: + """Return whether ``url`` matches the comma-separated ``no_proxy`` rules.""" + parsed_url = urlparse(url) + if not parsed_url.hostname: + return True + + host = parsed_url.hostname.lower() + host_and_port = parsed_url.netloc.lower() + try: + host_ip = ipaddress.ip_address(host) + except ValueError: + host_ip = None + + for entry in (entry.strip().lower() for entry in no_proxy.split(',')): + if not entry: + continue + if entry == '*': + return True + + if host_ip is not None: + try: + if host_ip in ipaddress.ip_network(entry, strict=False): + return True + except ValueError: + pass + + entry = entry.lstrip('.') + if ( + host == entry + or host.endswith('.' + entry) + or host_and_port == entry + or host_and_port.endswith('.' + entry) + ): + return True + + return False + class RESTResponse(io.IOBase): @@ -104,7 +159,9 @@ def __init__(self, configuration) -> None: # https pool manager self.pool_manager: urllib3.PoolManager - if configuration.proxy: + if configuration.proxy and not should_bypass_proxies( + configuration.host, configuration.no_proxy or '' + ): if is_socks_proxy_url(configuration.proxy): from urllib3.contrib.socks import SOCKSProxyManager pool_args["proxy_url"] = configuration.proxy @@ -113,6 +170,8 @@ def __init__(self, configuration) -> None: else: pool_args["proxy_url"] = configuration.proxy pool_args["proxy_headers"] = configuration.proxy_headers + if configuration.proxy_ssl_context is not None: + pool_args["proxy_ssl_context"] = configuration.proxy_ssl_context self.pool_manager = urllib3.ProxyManager(**pool_args) else: self.pool_manager = urllib3.PoolManager(**pool_args) @@ -176,12 +235,24 @@ def request( # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: - # no content type provided or payload is json content_type = headers.get('Content-Type') - if ( + is_json = ( not content_type - or re.search('json', content_type, re.IGNORECASE) - ): + or contenttype_matches(content_type, 'application', 'json') + ) + # JSON is valid YAML 1.2, so structured YAML bodies can use + # the existing JSON serializer: + # https://yaml.org/spec/1.2.2/#13-relation-to-json + is_structured_yaml = ( + content_type + and ( + contenttype_matches(content_type, 'application', 'yaml') + or contenttype_matches(content_type, 'text', 'yaml') + or contenttype_matches(content_type, 'text', 'x-yaml') + ) + and not isinstance(body, (str, bytes)) + ) + if is_json or is_structured_yaml: request_body = None if body is not None: request_body = json.dumps(body) @@ -193,7 +264,7 @@ def request( headers=headers, preload_content=False ) - elif content_type == 'application/x-www-form-urlencoded': + elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'): r = self.pool_manager.request( method, url, @@ -203,7 +274,7 @@ def request( headers=headers, preload_content=False ) - elif content_type == 'multipart/form-data': + elif contenttype_matches(content_type, 'multipart', 'form-data'): # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. @@ -231,7 +302,7 @@ def request( headers=headers, preload_content=False ) - elif headers['Content-Type'].startswith('text/') and isinstance(body, bool): + elif content_type.startswith('text/') and isinstance(body, bool): request_body = "true" if body else "false" r = self.pool_manager.request( method, diff --git a/docs/AssetEventResponse.md b/docs/AssetEventResponse.md index 4dffd0d..fe93661 100644 --- a/docs/AssetEventResponse.md +++ b/docs/AssetEventResponse.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **asset_id** | **int** | | **created_dagruns** | [**List[DagRunAssetReference]**](DagRunAssetReference.md) | | -**extra** | **Dict[str, object]** | | [optional] +**extra** | **Dict[str, Optional[object]]** | | [optional] **group** | **str** | | [optional] **id** | **int** | | **name** | **str** | | [optional] diff --git a/docs/AssetResponse.md b/docs/AssetResponse.md index 5583ce3..f123c58 100644 --- a/docs/AssetResponse.md +++ b/docs/AssetResponse.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **aliases** | [**List[AssetAliasResponse]**](AssetAliasResponse.md) | | **consuming_tasks** | [**List[TaskInletAssetReference]**](TaskInletAssetReference.md) | | **created_at** | **datetime** | | -**extra** | **Dict[str, object]** | | [optional] +**extra** | **Dict[str, Optional[object]]** | | [optional] **group** | **str** | | **id** | **int** | | **last_asset_event** | [**LastAssetEventResponse**](LastAssetEventResponse.md) | | [optional] diff --git a/docs/BackfillApi.md b/docs/BackfillApi.md index 311bb22..5b544b5 100644 --- a/docs/BackfillApi.md +++ b/docs/BackfillApi.md @@ -261,6 +261,7 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successful Response | - | +**400** | Bad Request | - | **401** | Unauthorized | - | **403** | Forbidden | - | **404** | Not Found | - | diff --git a/docs/ConfigApi.md b/docs/ConfigApi.md index 38ea955..31a1dc1 100644 --- a/docs/ConfigApi.md +++ b/docs/ConfigApi.md @@ -47,7 +47,7 @@ with airflow_client.client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = airflow_client.client.ConfigApi(api_client) section = 'section_example' # str | (optional) - accept = */* # str | (optional) (default to */*) + accept = '*/*' # str | (optional) (default to '*/*') try: # Get Config @@ -66,7 +66,7 @@ with airflow_client.client.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **section** | **str**| | [optional] - **accept** | **str**| | [optional] [default to */*] + **accept** | **str**| | [optional] [default to '*/*'] ### Return type @@ -134,7 +134,7 @@ with airflow_client.client.ApiClient(configuration) as api_client: api_instance = airflow_client.client.ConfigApi(api_client) section = 'section_example' # str | option = 'option_example' # str | - accept = */* # str | (optional) (default to */*) + accept = '*/*' # str | (optional) (default to '*/*') try: # Get Config Value @@ -154,7 +154,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **section** | **str**| | **option** | **str**| | - **accept** | **str**| | [optional] [default to */*] + **accept** | **str**| | [optional] [default to '*/*'] ### Return type diff --git a/docs/DAGApi.md b/docs/DAGApi.md index dc013bd..bd0dfa6 100644 --- a/docs/DAGApi.md +++ b/docs/DAGApi.md @@ -96,6 +96,7 @@ Name | Type | Description | Notes **401** | Unauthorized | - | **403** | Forbidden | - | **404** | Not Found | - | +**409** | Conflict | - | **422** | Unprocessable Entity | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/docs/DAGRunCollectionResponse.md b/docs/DAGRunCollectionResponse.md index 9a4c9cb..66a61bd 100644 --- a/docs/DAGRunCollectionResponse.md +++ b/docs/DAGRunCollectionResponse.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **next_cursor** | **str** | | [optional] **previous_cursor** | **str** | | [optional] **total_entries** | **int** | | [optional] +**total_entries_limit** | **int** | | [optional] ## Example diff --git a/docs/DagRunApi.md b/docs/DagRunApi.md index fdeefb0..def2cf1 100644 --- a/docs/DagRunApi.md +++ b/docs/DagRunApi.md @@ -452,6 +452,7 @@ void (empty response body) **401** | Unauthorized | - | **403** | Forbidden | - | **404** | Not Found | - | +**409** | Conflict | - | **422** | Validation Error | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -555,7 +556,8 @@ Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). -When `cursor` is provided, `offset` is ignored and `total_entries` is not returned. +When `cursor` is provided, `offset` is ignored and `total_entries` is capped at +`total_entries_limit` (a value equal to that limit means at least that many runs match). ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` on the first page. @@ -718,6 +720,7 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successful Response | - | +**400** | Bad Request | - | **401** | Unauthorized | - | **403** | Forbidden | - | **404** | Not Found | - | diff --git a/docs/DagRunAssetReference.md b/docs/DagRunAssetReference.md index 2b63202..41b16ed 100644 --- a/docs/DagRunAssetReference.md +++ b/docs/DagRunAssetReference.md @@ -15,6 +15,7 @@ Name | Type | Description | Notes **run_id** | **str** | | **start_date** | **datetime** | | **state** | **str** | | +**triggering** | **bool** | Whether this asset event triggered the referenced dag run. Only a run's most recent consumed asset event triggers it; earlier consumed events are included in the run but did not trigger it. | ## Example diff --git a/docs/DagSourceApi.md b/docs/DagSourceApi.md index b407989..3ad3025 100644 --- a/docs/DagSourceApi.md +++ b/docs/DagSourceApi.md @@ -49,7 +49,7 @@ with airflow_client.client.ApiClient(configuration) as api_client: api_instance = airflow_client.client.DagSourceApi(api_client) dag_id = 'dag_id_example' # str | version_number = 56 # int | (optional) - accept = */* # str | (optional) (default to */*) + accept = '*/*' # str | (optional) (default to '*/*') try: # Get Dag Source @@ -69,7 +69,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **dag_id** | **str**| | **version_number** | **int**| | [optional] - **accept** | **str**| | [optional] [default to */*] + **accept** | **str**| | [optional] [default to '*/*'] ### Return type diff --git a/docs/LoginApi.md b/docs/LoginApi.md index f4bf21a..667c38f 100644 --- a/docs/LoginApi.md +++ b/docs/LoginApi.md @@ -87,6 +87,8 @@ Logout the user. ### Example +* OAuth Authentication (OAuth2PasswordBearer): +* Bearer Authentication (HTTPBearer): ```python import airflow_client.client @@ -99,6 +101,17 @@ configuration = airflow_client.client.Configuration( host = "http://localhost" ) +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Configure Bearer authorization: HTTPBearer +configuration = airflow_client.client.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) # Enter a context with an instance of the API client with airflow_client.client.ApiClient(configuration) as api_client: @@ -126,7 +139,7 @@ This endpoint does not need any parameter. ### Authorization -No authorization required +[OAuth2PasswordBearer](../README.md#OAuth2PasswordBearer), [HTTPBearer](../README.md#HTTPBearer) ### HTTP request headers diff --git a/docs/ResponseClearDagRuns.md b/docs/ResponseClearDagRuns.md index afb77dd..d58a82f 100644 --- a/docs/ResponseClearDagRuns.md +++ b/docs/ResponseClearDagRuns.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **dag_runs** | [**List[DAGRunResponse]**](DAGRunResponse.md) | | **next_cursor** | **str** | | [optional] **previous_cursor** | **str** | | [optional] +**total_entries_limit** | **int** | | [optional] ## Example diff --git a/docs/TaskInstanceApi.md b/docs/TaskInstanceApi.md index 602e64b..2f214c5 100644 --- a/docs/TaskInstanceApi.md +++ b/docs/TaskInstanceApi.md @@ -754,7 +754,7 @@ with airflow_client.client.ApiClient(configuration) as api_client: full_content = False # bool | (optional) (default to False) map_index = -1 # int | (optional) (default to -1) token = 'token_example' # str | (optional) - accept = */* # str | (optional) (default to */*) + accept = '*/*' # str | (optional) (default to '*/*') try: # Get Log @@ -779,7 +779,7 @@ Name | Type | Description | Notes **full_content** | **bool**| | [optional] [default to False] **map_index** | **int**| | [optional] [default to -1] **token** | **str**| | [optional] - **accept** | **str**| | [optional] [default to */*] + **accept** | **str**| | [optional] [default to '*/*'] ### Return type @@ -1722,9 +1722,10 @@ Supports two pagination modes: **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`. **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). -When `cursor` is provided, `offset` is ignored and `total_entries` is not returned. -``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` -on the first page. +When `cursor` is provided, `offset` is ignored and `total_entries` is capped at +`total_entries_limit` (a value equal to that limit means at least that many task instances +match). ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is +``null`` on the first page. ### Example @@ -2661,6 +2662,7 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successful Response | - | +**400** | Bad Request | - | **401** | Unauthorized | - | **403** | Forbidden | - | **404** | Not Found | - | @@ -2756,6 +2758,7 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successful Response | - | +**400** | Bad Request | - | **401** | Unauthorized | - | **403** | Forbidden | - | **404** | Not Found | - | diff --git a/docs/TaskInstanceCollectionResponse.md b/docs/TaskInstanceCollectionResponse.md index e95e26c..f9ef247 100644 --- a/docs/TaskInstanceCollectionResponse.md +++ b/docs/TaskInstanceCollectionResponse.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **previous_cursor** | **str** | | [optional] **task_instances** | [**List[TaskInstanceResponse]**](TaskInstanceResponse.md) | | **total_entries** | **int** | | [optional] +**total_entries_limit** | **int** | | [optional] ## Example diff --git a/docs/TaskStateStoreApi.md b/docs/TaskStateStoreApi.md index f742284..d3289b8 100644 --- a/docs/TaskStateStoreApi.md +++ b/docs/TaskStateStoreApi.md @@ -13,7 +13,7 @@ Method | HTTP request | Description # **clear_task_state_store** -> clear_task_state_store(dag_id, dag_run_id, task_id, map_index=map_index, all_map_indices=all_map_indices) +> clear_task_state_store(dag_id, dag_run_id, task_id, all_map_indices=all_map_indices, map_index=map_index) Clear Task State Store @@ -57,12 +57,12 @@ with airflow_client.client.ApiClient(configuration) as api_client: dag_id = 'dag_id_example' # str | dag_run_id = 'dag_run_id_example' # str | task_id = 'task_id_example' # str | - map_index = -1 # int | (optional) (default to -1) all_map_indices = False # bool | (optional) (default to False) + map_index = -1 # int | (optional) (default to -1) try: # Clear Task State Store - api_instance.clear_task_state_store(dag_id, dag_run_id, task_id, map_index=map_index, all_map_indices=all_map_indices) + api_instance.clear_task_state_store(dag_id, dag_run_id, task_id, all_map_indices=all_map_indices, map_index=map_index) except Exception as e: print("Exception when calling TaskStateStoreApi->clear_task_state_store: %s\n" % e) ``` @@ -77,8 +77,8 @@ Name | Type | Description | Notes **dag_id** | **str**| | **dag_run_id** | **str**| | **task_id** | **str**| | - **map_index** | **int**| | [optional] [default to -1] **all_map_indices** | **bool**| | [optional] [default to False] + **map_index** | **int**| | [optional] [default to -1] ### Return type @@ -106,7 +106,7 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **delete_task_state_store** -> delete_task_state_store(dag_id, dag_run_id, task_id, key, map_index=map_index) +> delete_task_state_store(key, dag_id, dag_run_id, task_id, map_index=map_index) Delete Task State Store @@ -144,15 +144,15 @@ configuration = airflow_client.client.Configuration( with airflow_client.client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = airflow_client.client.TaskStateStoreApi(api_client) + key = 'key_example' # str | dag_id = 'dag_id_example' # str | dag_run_id = 'dag_run_id_example' # str | task_id = 'task_id_example' # str | - key = 'key_example' # str | map_index = -1 # int | (optional) (default to -1) try: # Delete Task State Store - api_instance.delete_task_state_store(dag_id, dag_run_id, task_id, key, map_index=map_index) + api_instance.delete_task_state_store(key, dag_id, dag_run_id, task_id, map_index=map_index) except Exception as e: print("Exception when calling TaskStateStoreApi->delete_task_state_store: %s\n" % e) ``` @@ -164,10 +164,10 @@ with airflow_client.client.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **key** | **str**| | **dag_id** | **str**| | **dag_run_id** | **str**| | **task_id** | **str**| | - **key** | **str**| | **map_index** | **int**| | [optional] [default to -1] ### Return type @@ -196,7 +196,7 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_task_state_store** -> TaskStateStoreResponse get_task_state_store(dag_id, dag_run_id, task_id, key, map_index=map_index) +> TaskStateStoreResponse get_task_state_store(key, dag_id, dag_run_id, task_id, map_index=map_index) Get Task State Store @@ -235,15 +235,15 @@ configuration = airflow_client.client.Configuration( with airflow_client.client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = airflow_client.client.TaskStateStoreApi(api_client) + key = 'key_example' # str | dag_id = 'dag_id_example' # str | dag_run_id = 'dag_run_id_example' # str | task_id = 'task_id_example' # str | - key = 'key_example' # str | map_index = -1 # int | (optional) (default to -1) try: # Get Task State Store - api_response = api_instance.get_task_state_store(dag_id, dag_run_id, task_id, key, map_index=map_index) + api_response = api_instance.get_task_state_store(key, dag_id, dag_run_id, task_id, map_index=map_index) print("The response of TaskStateStoreApi->get_task_state_store:\n") pprint(api_response) except Exception as e: @@ -257,10 +257,10 @@ with airflow_client.client.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **key** | **str**| | **dag_id** | **str**| | **dag_run_id** | **str**| | **task_id** | **str**| | - **key** | **str**| | **map_index** | **int**| | [optional] [default to -1] ### Return type @@ -378,13 +378,12 @@ Name | Type | Description | Notes **200** | Successful Response | - | **401** | Unauthorized | - | **403** | Forbidden | - | -**404** | Not Found | - | **422** | Validation Error | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **patch_task_state_store** -> object patch_task_state_store(dag_id, dag_run_id, task_id, key, task_state_store_patch_body, map_index=map_index) +> object patch_task_state_store(key, dag_id, dag_run_id, task_id, task_state_store_patch_body, map_index=map_index) Patch Task State Store @@ -423,16 +422,16 @@ configuration = airflow_client.client.Configuration( with airflow_client.client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = airflow_client.client.TaskStateStoreApi(api_client) + key = 'key_example' # str | dag_id = 'dag_id_example' # str | dag_run_id = 'dag_run_id_example' # str | task_id = 'task_id_example' # str | - key = 'key_example' # str | task_state_store_patch_body = airflow_client.client.TaskStateStorePatchBody() # TaskStateStorePatchBody | map_index = -1 # int | (optional) (default to -1) try: # Patch Task State Store - api_response = api_instance.patch_task_state_store(dag_id, dag_run_id, task_id, key, task_state_store_patch_body, map_index=map_index) + api_response = api_instance.patch_task_state_store(key, dag_id, dag_run_id, task_id, task_state_store_patch_body, map_index=map_index) print("The response of TaskStateStoreApi->patch_task_state_store:\n") pprint(api_response) except Exception as e: @@ -446,10 +445,10 @@ with airflow_client.client.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **key** | **str**| | **dag_id** | **str**| | **dag_run_id** | **str**| | **task_id** | **str**| | - **key** | **str**| | **task_state_store_patch_body** | [**TaskStateStorePatchBody**](TaskStateStorePatchBody.md)| | **map_index** | **int**| | [optional] [default to -1] @@ -479,7 +478,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **set_task_state_store** -> set_task_state_store(dag_id, dag_run_id, task_id, key, task_state_store_body, map_index=map_index) +> set_task_state_store(key, dag_id, dag_run_id, task_id, task_state_store_body, map_index=map_index) Set Task State Store @@ -518,16 +517,16 @@ configuration = airflow_client.client.Configuration( with airflow_client.client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = airflow_client.client.TaskStateStoreApi(api_client) + key = 'key_example' # str | dag_id = 'dag_id_example' # str | dag_run_id = 'dag_run_id_example' # str | task_id = 'task_id_example' # str | - key = 'key_example' # str | task_state_store_body = airflow_client.client.TaskStateStoreBody() # TaskStateStoreBody | map_index = -1 # int | (optional) (default to -1) try: # Set Task State Store - api_instance.set_task_state_store(dag_id, dag_run_id, task_id, key, task_state_store_body, map_index=map_index) + api_instance.set_task_state_store(key, dag_id, dag_run_id, task_id, task_state_store_body, map_index=map_index) except Exception as e: print("Exception when calling TaskStateStoreApi->set_task_state_store: %s\n" % e) ``` @@ -539,10 +538,10 @@ with airflow_client.client.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **key** | **str**| | **dag_id** | **str**| | **dag_run_id** | **str**| | **task_id** | **str**| | - **key** | **str**| | **task_state_store_body** | [**TaskStateStoreBody**](TaskStateStoreBody.md)| | **map_index** | **int**| | [optional] [default to -1] diff --git a/pyproject.toml b/pyproject.toml index 1a4d907..6574020 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,11 +17,12 @@ [build-system] requires = [ - "hatchling==1.30.1", - "packaging==26.2", + "hatchling==1.32.0", + "packaging==26.3", "pathspec==1.1.1", "pluggy==1.6.0", "tomli==2.4.1; python_version < '3.11'", + "tomlkit==0.15.1", "trove-classifiers==2026.6.1.19", ] build-backend = "hatchling.build" diff --git a/spec/v2.yaml b/spec/v2.yaml index be53b9b..1f0a434 100644 --- a/spec/v2.yaml +++ b/spec/v2.yaml @@ -1928,6 +1928,9 @@ components: total_entries: nullable: true type: integer + total_entries_limit: + nullable: true + type: integer required: - dag_runs title: DAGRunCollectionResponse @@ -2286,11 +2289,18 @@ components: state: title: State type: string + triggering: + description: Whether this asset event triggered the referenced dag run. + Only a run's most recent consumed asset event triggers it; earlier consumed + events are included in the run but did not trigger it. + title: Triggering + type: boolean required: - run_id - dag_id - start_date - state + - triggering title: DagRunAssetReference type: object DagRunMutableStates: @@ -3609,6 +3619,9 @@ components: total_entries: nullable: true type: integer + total_entries_limit: + nullable: true + type: integer required: - task_instances title: TaskInstanceCollectionResponse @@ -5674,6 +5687,9 @@ paths: schema: $ref: '#/components/schemas/HTTPExceptionResponse' description: Temporary Redirect + security: + - OAuth2PasswordBearer: [] + - HTTPBearer: [] summary: Logout tags: - Login @@ -5827,6 +5843,12 @@ paths: schema: $ref: '#/components/schemas/DryRunBackfillCollectionResponse' description: Successful Response + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPExceptionResponse' + description: Bad Request '401': content: application/json: @@ -7486,6 +7508,12 @@ paths: schema: $ref: '#/components/schemas/HTTPExceptionResponse' description: Not Found + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPExceptionResponse' + description: Conflict '422': content: application/json: @@ -7988,6 +8016,12 @@ paths: schema: $ref: '#/components/schemas/TaskInstanceCollectionResponse' description: Successful Response + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPExceptionResponse' + description: Bad Request '401': content: application/json: @@ -8042,8 +8076,11 @@ paths: **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). - When `cursor` is provided, `offset` is ignored and `total_entries` is not - returned. + When `cursor` is provided, `offset` is ignored and `total_entries` is capped + at + + `total_entries_limit` (a value equal to that limit means at least that many + runs match). ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` is ``null`` @@ -8404,6 +8441,12 @@ paths: schema: $ref: '#/components/schemas/DAGRunCollectionResponse' description: Successful Response + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPExceptionResponse' + description: Bad Request '401': content: application/json: @@ -8644,6 +8687,12 @@ paths: schema: $ref: '#/components/schemas/HTTPExceptionResponse' description: Not Found + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPExceptionResponse' + description: Conflict '422': content: application/json: @@ -9226,13 +9275,16 @@ paths: **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response). - When `cursor` is provided, `offset` is ignored and `total_entries` is not - returned. + When `cursor` is provided, `offset` is ignored and `total_entries` is capped + at - ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` - is ``null`` + `total_entries_limit` (a value equal to that limit means at least that many + task instances - on the first page.' + match). ``next_cursor`` is ``null`` when there are no more pages; ``previous_cursor`` + is + + ``null`` on the first page.' operationId: get_task_instances parameters: - in: path @@ -10859,6 +10911,13 @@ paths: schema: title: Task Id type: string + - in: query + name: all_map_indices + required: false + schema: + default: false + title: All Map Indices + type: boolean - in: query name: map_index required: false @@ -10867,13 +10926,6 @@ paths: minimum: -1 title: Map Index type: integer - - in: query - name: all_map_indices - required: false - schema: - default: false - title: All Map Indices - type: boolean responses: '204': description: Successful Response @@ -10972,12 +11024,6 @@ paths: schema: $ref: '#/components/schemas/HTTPExceptionResponse' description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/HTTPExceptionResponse' - description: Not Found '422': content: application/json: @@ -10996,6 +11042,12 @@ paths: exist. operationId: delete_task_state_store parameters: + - in: path + name: key + required: true + schema: + title: Key + type: string - in: path name: dag_id required: true @@ -11014,12 +11066,6 @@ paths: schema: title: Task Id type: string - - in: path - name: key - required: true - schema: - title: Key - type: string - in: query name: map_index required: false @@ -11065,6 +11111,12 @@ paths: description: Get a single task state store entry. operationId: get_task_state_store parameters: + - in: path + name: key + required: true + schema: + title: Key + type: string - in: path name: dag_id required: true @@ -11083,12 +11135,6 @@ paths: schema: title: Task Id type: string - - in: path - name: key - required: true - schema: - title: Key - type: string - in: query name: map_index required: false @@ -11138,6 +11184,12 @@ paths: description: Update the value of an existing task state store key. operationId: patch_task_state_store parameters: + - in: path + name: key + required: true + schema: + title: Key + type: string - in: path name: dag_id required: true @@ -11156,12 +11208,6 @@ paths: schema: title: Task Id type: string - - in: path - name: key - required: true - schema: - title: Key - type: string - in: query name: map_index required: false @@ -11216,6 +11262,12 @@ paths: description: Set a task state store value. Creates or overwrites the key. operationId: set_task_state_store parameters: + - in: path + name: key + required: true + schema: + title: Key + type: string - in: path name: dag_id required: true @@ -11234,12 +11286,6 @@ paths: schema: title: Task Id type: string - - in: path - name: key - required: true - schema: - title: Key - type: string - in: query name: map_index required: false @@ -12418,6 +12464,12 @@ paths: schema: $ref: '#/components/schemas/HITLDetailResponse' description: Successful Response + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPExceptionResponse' + description: Bad Request '401': content: application/json: diff --git a/test/test_asset_event_collection_response.py b/test/test_asset_event_collection_response.py index 20f1f01..0d4b8a6 100644 --- a/test/test_asset_event_collection_response.py +++ b/test/test_asset_event_collection_response.py @@ -48,7 +48,8 @@ def make_instance(self, include_optional) -> AssetEventCollectionResponse: partition_key = '', run_id = '', start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - state = '', ) + state = '', + triggering = True, ) ], extra = { 'key' : null @@ -81,7 +82,8 @@ def make_instance(self, include_optional) -> AssetEventCollectionResponse: partition_key = '', run_id = '', start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - state = '', ) + state = '', + triggering = True, ) ], extra = { 'key' : null diff --git a/test/test_asset_event_response.py b/test/test_asset_event_response.py index 567f823..c28b464 100644 --- a/test/test_asset_event_response.py +++ b/test/test_asset_event_response.py @@ -46,7 +46,8 @@ def make_instance(self, include_optional) -> AssetEventResponse: partition_key = '', run_id = '', start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - state = '', ) + state = '', + triggering = True, ) ], extra = { 'key' : null @@ -75,7 +76,8 @@ def make_instance(self, include_optional) -> AssetEventResponse: partition_key = '', run_id = '', start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - state = '', ) + state = '', + triggering = True, ) ], id = 56, source_map_index = 56, diff --git a/test/test_dag_run_asset_reference.py b/test/test_dag_run_asset_reference.py index ee838da..e82c397 100644 --- a/test/test_dag_run_asset_reference.py +++ b/test/test_dag_run_asset_reference.py @@ -43,7 +43,8 @@ def make_instance(self, include_optional) -> DagRunAssetReference: partition_key = '', run_id = '', start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - state = '' + state = '', + triggering = True ) else: return DagRunAssetReference( @@ -51,6 +52,7 @@ def make_instance(self, include_optional) -> DagRunAssetReference: run_id = '', start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), state = '', + triggering = True, ) """ diff --git a/test/test_dag_run_collection_response.py b/test/test_dag_run_collection_response.py index 6ea70b2..388c489 100644 --- a/test/test_dag_run_collection_response.py +++ b/test/test_dag_run_collection_response.py @@ -72,7 +72,8 @@ def make_instance(self, include_optional) -> DAGRunCollectionResponse: ], next_cursor = '', previous_cursor = '', - total_entries = 56 + total_entries = 56, + total_entries_limit = 56 ) else: return DAGRunCollectionResponse( diff --git a/test/test_response_clear_dag_runs.py b/test/test_response_clear_dag_runs.py index dd403c6..255710f 100644 --- a/test/test_response_clear_dag_runs.py +++ b/test/test_response_clear_dag_runs.py @@ -75,7 +75,8 @@ def make_instance(self, include_optional) -> ResponseClearDagRuns: triggering_user_name = '', ) ], next_cursor = '', - previous_cursor = '' + previous_cursor = '', + total_entries_limit = 56 ) else: return ResponseClearDagRuns( diff --git a/test/test_task_instance_collection_response.py b/test/test_task_instance_collection_response.py index 9790263..ef3c896 100644 --- a/test/test_task_instance_collection_response.py +++ b/test/test_task_instance_collection_response.py @@ -74,7 +74,8 @@ def make_instance(self, include_optional) -> TaskInstanceCollectionResponse: try_number = 56, unixname = '', ) ], - total_entries = 56 + total_entries = 56, + total_entries_limit = 56 ) else: return TaskInstanceCollectionResponse( diff --git a/version.txt b/version.txt index bea438e..4772543 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -3.3.1 +3.3.2