This is an automated email from the ASF dual-hosted git repository.
jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 088e796e93b Remove Provider Deprecations in Microsoft-AZURE (#44763)
088e796e93b is described below
commit 088e796e93b1f573a84bd965666913bdc56a291c
Author: vatsrahul1001 <[email protected]>
AuthorDate: Sun Dec 8 01:12:42 2024 +0530
Remove Provider Deprecations in Microsoft-AZURE (#44763)
* remove deprecations
* updating change log
* fixing static checks
---
.../transfer/azure_blob_to_gcs.rst | 20 --------
generated/provider_dependencies.json | 1 -
.../providers/microsoft/azure/CHANGELOG.rst | 27 +++++++++++
.../airflow/providers/microsoft/azure/hooks/adx.py | 10 +---
.../providers/microsoft/azure/hooks/base_azure.py | 20 +-------
.../microsoft/azure/hooks/container_instance.py | 43 +----------------
.../microsoft/azure/hooks/data_factory.py | 11 +----
.../providers/microsoft/azure/hooks/synapse.py | 10 +---
.../providers/microsoft/azure/operators/adx.py | 8 ----
.../providers/microsoft/azure/operators/batch.py | 8 +---
.../providers/microsoft/azure/provider.yaml | 5 +-
.../providers/microsoft/azure/secrets/key_vault.py | 20 --------
.../providers/microsoft/azure/sensors/wasb.py | 36 +--------------
.../microsoft/azure/transfers/azure_blob_to_gcs.py | 44 ------------------
.../microsoft/azure/secrets/test_key_vault.py | 54 ----------------------
15 files changed, 36 insertions(+), 281 deletions(-)
diff --git
a/docs/apache-airflow-providers-microsoft-azure/transfer/azure_blob_to_gcs.rst
b/docs/apache-airflow-providers-microsoft-azure/transfer/azure_blob_to_gcs.rst
deleted file mode 100644
index df2cd0bccee..00000000000
---
a/docs/apache-airflow-providers-microsoft-azure/transfer/azure_blob_to_gcs.rst
+++ /dev/null
@@ -1,20 +0,0 @@
- .. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- .. http://www.apache.org/licenses/LICENSE-2.0
-
- .. Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-
-Upload data from Azure Blob Storage to Google Cloud Storage (Moved to Google
Providers)
-=======================================================================================
diff --git a/generated/provider_dependencies.json
b/generated/provider_dependencies.json
index 6003a119538..fe11c5804eb 100644
--- a/generated/provider_dependencies.json
+++ b/generated/provider_dependencies.json
@@ -847,7 +847,6 @@
"cross-providers-deps": [
"amazon",
"common.compat",
- "google",
"oracle",
"sftp"
],
diff --git a/providers/src/airflow/providers/microsoft/azure/CHANGELOG.rst
b/providers/src/airflow/providers/microsoft/azure/CHANGELOG.rst
index 2329c87f12e..d90e57def42 100644
--- a/providers/src/airflow/providers/microsoft/azure/CHANGELOG.rst
+++ b/providers/src/airflow/providers/microsoft/azure/CHANGELOG.rst
@@ -27,6 +27,33 @@
Changelog
---------
+main
+....
+
+.. warning::
+ All deprecated classes, parameters and features have been removed from the
microsoft azure provider package.
+ The following breaking changes were introduced:
+
+ * Removed deprecated ``extra__azure_data_explorer__foo`` in azure
connection extra.
+ * Removed deprecated ``extra__azure__tenantId`` in azure connection extra.
Use ``tenantId`` instead.
+ * Removed deprecated ``get_state_exitcode_details`` method. Use
``get_state`` instead.
+ * Removed deprecated ``get_messages`` method. Use ``get_state`` instead.
+ * Removed deprecated ``extra__azure_data_factory__foo`` in azure
connection extra.
+ * Usage of `default_conn_name=azure_synapse_connection` is deprecated in
``AzureSynapsePipelineHook``. Use ``default_conn_name=azure_synapse_default``
instead.
+ * Removed deprecated method ``get_hook`` to get instance of
``AzureDataExplorerHook``. Use ``hook`` property instead.
+ * Removed deprecated method ``get_hook`` to get instance of
``AzureBatchHook``. Use ``hook`` property instead.
+ * Removed deprecated method ``AzureKeyVaultBackend.get_conn_uri``. Use
``get_conn_value`` instead.
+ * Removed deprecated class ``WasbBlobAsyncSensor``. Use ``WasbBlobSensor``
with ``deferrable=True`` instead.
+ * Removed deprecated operator `AzureBlobStorageToGCSOperator`. Use
``airflow.providers.google.cloud.transfers.azure_blob_to_gcs.AzureBlobStorageToGCSOperator``
instead.
+
+
+
+
+
+
+
+
+
11.1.0
......
diff --git a/providers/src/airflow/providers/microsoft/azure/hooks/adx.py
b/providers/src/airflow/providers/microsoft/azure/hooks/adx.py
index 8ad40959701..b08f6015dca 100644
--- a/providers/src/airflow/providers/microsoft/azure/hooks/adx.py
+++ b/providers/src/airflow/providers/microsoft/azure/hooks/adx.py
@@ -33,7 +33,7 @@ from typing import TYPE_CHECKING, Any
from azure.kusto.data import ClientRequestProperties, KustoClient,
KustoConnectionStringBuilder
from azure.kusto.data.exceptions import KustoServiceError
-from airflow.exceptions import AirflowException,
AirflowProviderDeprecationWarning
+from airflow.exceptions import AirflowException
from airflow.hooks.base import BaseHook
from airflow.providers.microsoft.azure.utils import (
add_managed_identity_connection_widgets,
@@ -161,14 +161,6 @@ class AzureDataExplorerHook(BaseHook):
value = extras.get(name)
if value:
warn_if_collison(name, backcompat_key)
- if not value and extras.get(backcompat_key):
- warnings.warn(
- f"`{backcompat_key}` is deprecated in azure connection
extra,"
- f" please use `{name}` instead",
- AirflowProviderDeprecationWarning,
- stacklevel=2,
- )
- value = extras.get(backcompat_key)
if not value:
raise AirflowException(f"Required connection parameter is
missing: `{name}`")
return value
diff --git
a/providers/src/airflow/providers/microsoft/azure/hooks/base_azure.py
b/providers/src/airflow/providers/microsoft/azure/hooks/base_azure.py
index 70496d8796d..c54ece1e041 100644
--- a/providers/src/airflow/providers/microsoft/azure/hooks/base_azure.py
+++ b/providers/src/airflow/providers/microsoft/azure/hooks/base_azure.py
@@ -16,13 +16,12 @@
# under the License.
from __future__ import annotations
-import warnings
from typing import Any
from azure.common.client_factory import get_client_from_auth_file,
get_client_from_json_dict
from azure.common.credentials import ServicePrincipalCredentials
-from airflow.exceptions import AirflowException,
AirflowProviderDeprecationWarning
+from airflow.exceptions import AirflowException
from airflow.hooks.base import BaseHook
from airflow.providers.microsoft.azure.utils import (
AzureIdentityCredentialAdapter,
@@ -99,24 +98,7 @@ class AzureBaseHook(BaseHook):
"""
conn = self.get_connection(self.conn_id)
tenant = conn.extra_dejson.get("tenantId")
- if not tenant and conn.extra_dejson.get("extra__azure__tenantId"):
- warnings.warn(
- "`extra__azure__tenantId` is deprecated in azure connection
extra, "
- "please use `tenantId` instead",
- AirflowProviderDeprecationWarning,
- stacklevel=2,
- )
- tenant = conn.extra_dejson.get("extra__azure__tenantId")
subscription_id = conn.extra_dejson.get("subscriptionId")
- if not subscription_id and
conn.extra_dejson.get("extra__azure__subscriptionId"):
- warnings.warn(
- "`extra__azure__subscriptionId` is deprecated in azure
connection extra, "
- "please use `subscriptionId` instead",
- AirflowProviderDeprecationWarning,
- stacklevel=2,
- )
- subscription_id =
conn.extra_dejson.get("extra__azure__subscriptionId")
-
key_path = conn.extra_dejson.get("key_path")
if key_path:
if not key_path.endswith(".json"):
diff --git
a/providers/src/airflow/providers/microsoft/azure/hooks/container_instance.py
b/providers/src/airflow/providers/microsoft/azure/hooks/container_instance.py
index a3547bfa1a9..4aaa668c5ae 100644
---
a/providers/src/airflow/providers/microsoft/azure/hooks/container_instance.py
+++
b/providers/src/airflow/providers/microsoft/azure/hooks/container_instance.py
@@ -23,18 +23,14 @@ from typing import TYPE_CHECKING, Any, cast
from azure.common.client_factory import get_client_from_auth_file,
get_client_from_json_dict
from azure.identity import ClientSecretCredential, DefaultAzureCredential
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
-from deprecated import deprecated
-from airflow.exceptions import AirflowException,
AirflowProviderDeprecationWarning
+from airflow.exceptions import AirflowException
from airflow.providers.microsoft.azure.hooks.base_azure import AzureBaseHook
from airflow.providers.microsoft.azure.utils import
get_sync_default_azure_credential
if TYPE_CHECKING:
from azure.mgmt.containerinstance.models import (
ContainerGroup,
- ContainerPropertiesInstanceView,
- ContainerState,
- Event,
)
@@ -116,43 +112,6 @@ class AzureContainerInstanceHook(AzureBaseHook):
"""
self.connection.container_groups.begin_create_or_update(resource_group, name,
container_group)
- @deprecated(
- reason="get_state_exitcode_details() is deprecated. Related method is
get_state()",
- category=AirflowProviderDeprecationWarning,
- )
- def get_state_exitcode_details(self, resource_group: str, name: str) ->
tuple:
- """
- Get the state and exitcode of a container group.
-
- :param resource_group: the name of the resource group
- :param name: the name of the container group
- :return: A tuple with the state, exitcode, and details.
- If the exitcode is unknown 0 is returned.
- """
- cg_state = self.get_state(resource_group, name)
- container = cg_state.containers[0]
- instance_view: ContainerPropertiesInstanceView =
container.instance_view # type: ignore[assignment]
- c_state: ContainerState = instance_view.current_state # type:
ignore[assignment]
- return c_state.state, c_state.exit_code, c_state.detail_status
-
- @deprecated(
- reason="get_messages() is deprecated. Related method is get_state()",
- category=AirflowProviderDeprecationWarning,
- )
- def get_messages(self, resource_group: str, name: str) -> list:
- """
- Get the messages of a container group.
-
- :param resource_group: the name of the resource group
- :param name: the name of the container group
- :return: A list of the event messages
- """
- cg_state = self.get_state(resource_group, name)
- container = cg_state.containers[0]
- instance_view: ContainerPropertiesInstanceView =
container.instance_view # type: ignore[assignment]
- events: list[Event] = instance_view.events # type: ignore[assignment]
- return [event.message for event in events]
-
def get_state(self, resource_group: str, name: str) -> ContainerGroup:
"""
Get the state of a container group.
diff --git
a/providers/src/airflow/providers/microsoft/azure/hooks/data_factory.py
b/providers/src/airflow/providers/microsoft/azure/hooks/data_factory.py
index 2e95ac6994f..2b12729f1a7 100644
--- a/providers/src/airflow/providers/microsoft/azure/hooks/data_factory.py
+++ b/providers/src/airflow/providers/microsoft/azure/hooks/data_factory.py
@@ -35,7 +35,6 @@ from __future__ import annotations
import inspect
import time
-import warnings
from functools import wraps
from typing import IO, TYPE_CHECKING, Any, Callable, TypeVar, Union, cast
@@ -48,7 +47,7 @@ from azure.identity.aio import (
from azure.mgmt.datafactory import DataFactoryManagementClient
from azure.mgmt.datafactory.aio import DataFactoryManagementClient as
AsyncDataFactoryManagementClient
-from airflow.exceptions import AirflowException,
AirflowProviderDeprecationWarning
+from airflow.exceptions import AirflowException
from airflow.hooks.base import BaseHook
from airflow.providers.microsoft.azure.utils import (
add_managed_identity_connection_widgets,
@@ -1095,14 +1094,6 @@ def provide_targeted_factory_async(func: T) -> T:
default_value = extras.get(default_key) or extras.get(
f"extra__azure_data_factory__{default_key}"
)
- if not default_value and
extras.get(f"extra__azure_data_factory__{default_key}"):
- warnings.warn(
- f"`extra__azure_data_factory__{default_key}` is
deprecated in azure connection extra,"
- f" please use `{default_key}` instead",
- AirflowProviderDeprecationWarning,
- stacklevel=2,
- )
- default_value =
extras.get(f"extra__azure_data_factory__{default_key}")
if not default_value:
raise AirflowException("Could not determine the targeted
data factory.")
diff --git a/providers/src/airflow/providers/microsoft/azure/hooks/synapse.py
b/providers/src/airflow/providers/microsoft/azure/hooks/synapse.py
index 39e6d1022bc..af5a77aebf0 100644
--- a/providers/src/airflow/providers/microsoft/azure/hooks/synapse.py
+++ b/providers/src/airflow/providers/microsoft/azure/hooks/synapse.py
@@ -17,7 +17,6 @@
from __future__ import annotations
import time
-import warnings
from typing import TYPE_CHECKING, Any, Union
from azure.core.exceptions import ServiceRequestError
@@ -25,7 +24,7 @@ from azure.identity import ClientSecretCredential,
DefaultAzureCredential
from azure.synapse.artifacts import ArtifactsClient
from azure.synapse.spark import SparkClient
-from airflow.exceptions import AirflowException,
AirflowProviderDeprecationWarning, AirflowTaskTimeout
+from airflow.exceptions import AirflowException, AirflowTaskTimeout
from airflow.hooks.base import BaseHook
from airflow.providers.microsoft.azure.utils import (
add_managed_identity_connection_widgets,
@@ -307,13 +306,6 @@ class AzureSynapsePipelineHook(BaseAzureSynapseHook):
azure_synapse_conn_id: str = default_conn_name,
**kwargs,
):
- # Handling deprecation of "default_conn_name"
- if azure_synapse_conn_id == self.default_conn_name:
- warnings.warn(
- "The usage of `default_conn_name=azure_synapse_connection` is
deprecated and will be removed in future. Please update your code to use the
new default connection name: `default_conn_name=azure_synapse_default`. ",
- AirflowProviderDeprecationWarning,
- stacklevel=2,
- )
self._conn: ArtifactsClient | None = None
self.azure_synapse_workspace_dev_endpoint =
azure_synapse_workspace_dev_endpoint
super().__init__(azure_synapse_conn_id=azure_synapse_conn_id, **kwargs)
diff --git a/providers/src/airflow/providers/microsoft/azure/operators/adx.py
b/providers/src/airflow/providers/microsoft/azure/operators/adx.py
index 5efa087f9de..05c2cd8d54e 100644
--- a/providers/src/airflow/providers/microsoft/azure/operators/adx.py
+++ b/providers/src/airflow/providers/microsoft/azure/operators/adx.py
@@ -23,10 +23,7 @@ from collections.abc import Sequence
from functools import cached_property
from typing import TYPE_CHECKING
-from deprecated.classic import deprecated
-
from airflow.configuration import conf
-from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.models import BaseOperator
from airflow.providers.microsoft.azure.hooks.adx import AzureDataExplorerHook
@@ -72,11 +69,6 @@ class AzureDataExplorerQueryOperator(BaseOperator):
"""Return new instance of AzureDataExplorerHook."""
return AzureDataExplorerHook(self.azure_data_explorer_conn_id)
- @deprecated(reason="use `hook` property instead.",
category=AirflowProviderDeprecationWarning)
- def get_hook(self) -> AzureDataExplorerHook:
- """Return new instance of AzureDataExplorerHook."""
- return self.hook
-
def execute(self, context: Context) -> KustoResultTable | str:
"""
Run KQL Query on Azure Data Explorer (Kusto).
diff --git a/providers/src/airflow/providers/microsoft/azure/operators/batch.py
b/providers/src/airflow/providers/microsoft/azure/operators/batch.py
index da724624a4b..5b366b5b6bd 100644
--- a/providers/src/airflow/providers/microsoft/azure/operators/batch.py
+++ b/providers/src/airflow/providers/microsoft/azure/operators/batch.py
@@ -22,9 +22,8 @@ from functools import cached_property
from typing import TYPE_CHECKING, Any
from azure.batch import models as batch_models
-from deprecated.classic import deprecated
-from airflow.exceptions import AirflowException,
AirflowProviderDeprecationWarning
+from airflow.exceptions import AirflowException
from airflow.models import BaseOperator
from airflow.providers.microsoft.azure.hooks.batch import AzureBatchHook
@@ -184,11 +183,6 @@ class AzureBatchOperator(BaseOperator):
"""Create and return an AzureBatchHook (cached)."""
return AzureBatchHook(self.azure_batch_conn_id)
- @deprecated(reason="use `hook` property instead.",
category=AirflowProviderDeprecationWarning)
- def get_hook(self) -> AzureBatchHook:
- """Create and return an AzureBatchHook."""
- return self.hook
-
def _check_inputs(self) -> Any:
if not self.os_family and not self.vm_publisher:
raise AirflowException("You must specify either vm_publisher or
os_family")
diff --git a/providers/src/airflow/providers/microsoft/azure/provider.yaml
b/providers/src/airflow/providers/microsoft/azure/provider.yaml
index 257d50a6f8f..6b54d6fdac7 100644
--- a/providers/src/airflow/providers/microsoft/azure/provider.yaml
+++ b/providers/src/airflow/providers/microsoft/azure/provider.yaml
@@ -328,10 +328,7 @@ transfers:
target-integration-name: Microsoft Azure Blob Storage
how-to-guide:
/docs/apache-airflow-providers-microsoft-azure/transfer/s3_to_wasb.rst
python-module: airflow.providers.microsoft.azure.transfers.s3_to_wasb
- - source-integration-name: Microsoft Azure Blob Storage
- target-integration-name: Google Cloud Storage (GCS)
- how-to-guide:
/docs/apache-airflow-providers-microsoft-azure/transfer/azure_blob_to_gcs.rst
- python-module:
airflow.providers.microsoft.azure.transfers.azure_blob_to_gcs
+
connection-types:
- hook-class-name:
airflow.providers.microsoft.azure.hooks.base_azure.AzureBaseHook
diff --git
a/providers/src/airflow/providers/microsoft/azure/secrets/key_vault.py
b/providers/src/airflow/providers/microsoft/azure/secrets/key_vault.py
index 8735af0c8a8..aa1724b8e1b 100644
--- a/providers/src/airflow/providers/microsoft/azure/secrets/key_vault.py
+++ b/providers/src/airflow/providers/microsoft/azure/secrets/key_vault.py
@@ -31,9 +31,7 @@ from functools import cached_property
from azure.core.exceptions import ResourceNotFoundError
from azure.identity import ClientSecretCredential, DefaultAzureCredential
from azure.keyvault.secrets import SecretClient
-from deprecated import deprecated
-from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.providers.microsoft.azure.utils import
get_sync_default_azure_credential
from airflow.secrets import BaseSecretsBackend
from airflow.utils.log.logging_mixin import LoggingMixin
@@ -154,24 +152,6 @@ class AzureKeyVaultBackend(BaseSecretsBackend,
LoggingMixin):
return self._get_secret(self.connections_prefix, conn_id)
- @deprecated(
- reason=(
- "Method `AzureKeyVaultBackend.get_conn_uri` is deprecated and will
be removed "
- "in a future release. Please use method `get_conn_value` instead."
- ),
- category=AirflowProviderDeprecationWarning,
- )
- def get_conn_uri(self, conn_id: str) -> str | None:
- """
- Return URI representation of Connection conn_id.
-
- As of Airflow version 2.3.0 this method is deprecated.
-
- :param conn_id: the connection id
- :return: deserialized Connection
- """
- return self.get_conn_value(conn_id)
-
def get_variable(self, key: str) -> str | None:
"""
Get an Airflow Variable from an Azure Key Vault secret.
diff --git a/providers/src/airflow/providers/microsoft/azure/sensors/wasb.py
b/providers/src/airflow/providers/microsoft/azure/sensors/wasb.py
index 5862b518233..ec02c3cef8b 100644
--- a/providers/src/airflow/providers/microsoft/azure/sensors/wasb.py
+++ b/providers/src/airflow/providers/microsoft/azure/sensors/wasb.py
@@ -19,12 +19,10 @@ from __future__ import annotations
from collections.abc import Sequence
from datetime import timedelta
-from typing import TYPE_CHECKING, Any
-
-from deprecated import deprecated
+from typing import TYPE_CHECKING
from airflow.configuration import conf
-from airflow.exceptions import AirflowException,
AirflowProviderDeprecationWarning
+from airflow.exceptions import AirflowException
from airflow.providers.microsoft.azure.hooks.wasb import WasbHook
from airflow.providers.microsoft.azure.triggers.wasb import
WasbBlobSensorTrigger, WasbPrefixSensorTrigger
from airflow.sensors.base import BaseSensorOperator
@@ -111,36 +109,6 @@ class WasbBlobSensor(BaseSensorOperator):
raise AirflowException("Did not receive valid event from the
triggerer")
-@deprecated(
- reason=(
- "Class `WasbBlobAsyncSensor` is deprecated and "
- "will be removed in a future release. "
- "Please use `WasbBlobSensor` and "
- "set `deferrable` attribute to `True` instead"
- ),
- category=AirflowProviderDeprecationWarning,
-)
-class WasbBlobAsyncSensor(WasbBlobSensor):
- """
- Poll asynchronously for the existence of a blob in a WASB container.
-
- This class is deprecated and will be removed in a future release.
-
- Please use
:class:`airflow.providers.microsoft.azure.sensors.wasb.WasbBlobSensor`
- and set *deferrable* attribute to *True* instead.
-
- :param container_name: name of the container in which the blob should be
searched for
- :param blob_name: name of the blob to check existence for
- :param wasb_conn_id: the connection identifier for connecting to Azure WASB
- :param poke_interval: polling period in seconds to check for the status
- :param public_read: whether an anonymous public read access should be
used. Default is False
- :param timeout: Time, in seconds before the task times out and fails.
- """
-
- def __init__(self, **kwargs: Any) -> None:
- super().__init__(**kwargs, deferrable=True)
-
-
class WasbPrefixSensor(BaseSensorOperator):
"""
Wait for blobs matching a prefix to arrive on Azure Blob Storage.
diff --git
a/providers/src/airflow/providers/microsoft/azure/transfers/azure_blob_to_gcs.py
b/providers/src/airflow/providers/microsoft/azure/transfers/azure_blob_to_gcs.py
deleted file mode 100644
index 5a8417a3f26..00000000000
---
a/providers/src/airflow/providers/microsoft/azure/transfers/azure_blob_to_gcs.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-from __future__ import annotations
-
-from deprecated import deprecated
-
-from airflow.exceptions import AirflowProviderDeprecationWarning
-from airflow.providers.google.cloud.transfers.azure_blob_to_gcs import (
- AzureBlobStorageToGCSOperator as
AzureBlobStorageToGCSOperatorFromGoogleProvider,
-)
-
-
-@deprecated(
- reason=(
- "Please use "
-
"`airflow.providers.google.cloud.transfers.azure_blob_to_gcs.AzureBlobStorageToGCSOperator`."
- ),
- category=AirflowProviderDeprecationWarning,
-)
-class
AzureBlobStorageToGCSOperator(AzureBlobStorageToGCSOperatorFromGoogleProvider):
- """
- This class is deprecated.
-
- Please use
-
:class:`airflow.providers.google.cloud.transfers.azure_blob_to_gcs.AzureBlobStorageToGCSOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
diff --git a/providers/tests/microsoft/azure/secrets/test_key_vault.py
b/providers/tests/microsoft/azure/secrets/test_key_vault.py
index 60040804e10..6ad744f2196 100644
--- a/providers/tests/microsoft/azure/secrets/test_key_vault.py
+++ b/providers/tests/microsoft/azure/secrets/test_key_vault.py
@@ -19,10 +19,8 @@ from __future__ import annotations
from unittest import mock
-import pytest
from azure.core.exceptions import ResourceNotFoundError
-from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.providers.microsoft.azure.secrets.key_vault import
AzureKeyVaultBackend
KEY_VAULT_MODULE = "airflow.providers.microsoft.azure.secrets.key_vault"
@@ -35,40 +33,6 @@ class TestAzureKeyVaultBackend:
conn = AzureKeyVaultBackend().get_connection("fake_conn")
assert conn.host == "host"
- @mock.patch(f"{KEY_VAULT_MODULE}.get_sync_default_azure_credential")
- @mock.patch(f"{KEY_VAULT_MODULE}.SecretClient")
- def test_get_conn_uri(self, mock_secret_client, mock_azure_cred):
- mock_cred = mock.Mock()
- mock_sec_client = mock.Mock()
- mock_azure_cred.return_value = mock_cred
- mock_secret_client.return_value = mock_sec_client
-
- mock_sec_client.get_secret.return_value = mock.Mock(
- value="postgresql://airflow:airflow@host:5432/airflow"
- )
-
- backend =
AzureKeyVaultBackend(vault_url="https://example-akv-resource-name.vault.azure.net/")
- with pytest.warns(AirflowProviderDeprecationWarning, match="Method
`.*get_conn_uri` is deprecated"):
- returned_uri = backend.get_conn_uri(conn_id="hi")
- mock_secret_client.assert_called_once_with(
- credential=mock_cred,
vault_url="https://example-akv-resource-name.vault.azure.net/"
- )
- assert returned_uri == "postgresql://airflow:airflow@host:5432/airflow"
-
- @mock.patch(f"{KEY_VAULT_MODULE}.AzureKeyVaultBackend.client")
- def test_get_conn_uri_non_existent_key(self, mock_client):
- """
- Test that if the key with connection ID is not present,
- AzureKeyVaultBackend.get_connection should return None
- """
- conn_id = "test_mysql"
- mock_client.get_secret.side_effect = ResourceNotFoundError
- backend =
AzureKeyVaultBackend(vault_url="https://example-akv-resource-name.vault.azure.net/")
-
- with pytest.warns(AirflowProviderDeprecationWarning, match="Method
`.*get_conn_uri` is deprecated"):
- assert backend.get_conn_uri(conn_id=conn_id) is None
- assert backend.get_connection(conn_id=conn_id) is None
-
@mock.patch(f"{KEY_VAULT_MODULE}.AzureKeyVaultBackend.client")
def test_get_variable(self, mock_client):
mock_client.get_secret.return_value = mock.Mock(value="world")
@@ -109,24 +73,6 @@ class TestAzureKeyVaultBackend:
mock_client.get_secret.assert_called_with(name="af-secrets-test-mysql-password")
assert secret_val == "super-secret"
- @mock.patch(f"{KEY_VAULT_MODULE}.AzureKeyVaultBackend._get_secret")
- def test_connection_prefix_none_value(self, mock_get_secret):
- """
- Test that if Connections prefix is None,
- AzureKeyVaultBackend.get_connection should return None
- AzureKeyVaultBackend._get_secret should not be called
- """
- kwargs = {"connections_prefix": None}
-
- backend = AzureKeyVaultBackend(**kwargs)
- assert backend.get_connection("test_mysql") is None
- mock_get_secret.assert_not_called()
-
- mock_get_secret.reset_mock()
- with pytest.warns(AirflowProviderDeprecationWarning, match="Method
`.*get_conn_uri` is deprecated"):
- assert backend.get_conn_uri("test_mysql") is None
- mock_get_secret.assert_not_called()
-
@mock.patch(f"{KEY_VAULT_MODULE}.AzureKeyVaultBackend._get_secret")
def test_variable_prefix_none_value(self, mock_get_secret):
"""