You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/08/09 19:42:01 UTC
[airflow] branch main updated: Remove deprecated modules from Amazon provider package (#25609)
This is an automated email from the ASF dual-hosted git repository.
potiuk 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 85137f3763 Remove deprecated modules from Amazon provider package (#25609)
85137f3763 is described below
commit 85137f376373876267675f606cffdb788caa4818
Author: Vincent <97...@users.noreply.github.com>
AuthorDate: Tue Aug 9 15:41:50 2022 -0400
Remove deprecated modules from Amazon provider package (#25609)
* Remove deprecated modules from Amazon provider package
---
airflow/contrib/hooks/aws_athena_hook.py | 2 +-
airflow/contrib/hooks/aws_datasync_hook.py | 2 +-
airflow/contrib/hooks/aws_dynamodb_hook.py | 2 +-
airflow/contrib/hooks/aws_firehose_hook.py | 2 +-
airflow/contrib/hooks/aws_glue_catalog_hook.py | 2 +-
airflow/contrib/hooks/aws_lambda_hook.py | 2 +-
airflow/contrib/hooks/aws_sns_hook.py | 2 +-
airflow/contrib/operators/aws_athena_operator.py | 2 +-
airflow/contrib/operators/awsbatch_operator.py | 29 +----
airflow/contrib/operators/ecs_operator.py | 7 +-
.../sensors/aws_glue_catalog_partition_sensor.py | 4 +-
airflow/providers/amazon/aws/exceptions.py | 17 ---
airflow/providers/amazon/aws/hooks/athena.py | 16 ---
airflow/providers/amazon/aws/hooks/base_aws.py | 20 +--
airflow/providers/amazon/aws/hooks/batch_client.py | 33 -----
.../providers/amazon/aws/hooks/batch_waiters.py | 17 ---
.../providers/amazon/aws/hooks/cloud_formation.py | 17 ---
airflow/providers/amazon/aws/hooks/datasync.py | 16 ---
airflow/providers/amazon/aws/hooks/dynamodb.py | 17 ---
airflow/providers/amazon/aws/hooks/eks.py | 32 -----
airflow/providers/amazon/aws/hooks/glue.py | 17 ---
airflow/providers/amazon/aws/hooks/glue_catalog.py | 17 ---
airflow/providers/amazon/aws/hooks/glue_crawler.py | 17 ---
airflow/providers/amazon/aws/hooks/kinesis.py | 17 ---
.../providers/amazon/aws/hooks/lambda_function.py | 17 ---
airflow/providers/amazon/aws/hooks/sagemaker.py | 31 -----
airflow/providers/amazon/aws/hooks/ses.py | 16 ---
airflow/providers/amazon/aws/hooks/sns.py | 16 ---
airflow/providers/amazon/aws/hooks/sqs.py | 16 ---
airflow/providers/amazon/aws/operators/athena.py | 17 ---
airflow/providers/amazon/aws/operators/batch.py | 17 ---
airflow/providers/amazon/aws/operators/datasync.py | 17 ---
airflow/providers/amazon/aws/operators/ecs.py | 48 --------
airflow/providers/amazon/aws/operators/eks.py | 136 ---------------------
airflow/providers/amazon/aws/operators/glue.py | 17 ---
.../providers/amazon/aws/operators/glue_crawler.py | 17 ---
airflow/providers/amazon/aws/operators/sqs.py | 17 ---
airflow/providers/amazon/aws/sensors/eks.py | 49 --------
airflow/providers/amazon/aws/sensors/glue.py | 17 ---
.../amazon/aws/sensors/glue_catalog_partition.py | 17 ---
.../providers/amazon/aws/sensors/glue_crawler.py | 17 ---
airflow/providers/amazon/aws/sensors/s3.py | 65 ----------
airflow/providers/amazon/aws/sensors/sqs.py | 16 ---
.../amazon/aws/transfers/s3_to_redshift.py | 12 --
airflow/sensors/s3_prefix_sensor.py | 28 -----
tests/always/test_project_structure.py | 26 ----
tests/deprecated_classes.py | 44 -------
tests/providers/amazon/aws/hooks/test_base_aws.py | 83 +------------
tests/providers/amazon/aws/sensors/test_s3_key.py | 23 +---
.../providers/amazon/aws/sensors/test_s3_prefix.py | 68 -----------
.../amazon/aws/transfers/test_s3_to_redshift.py | 52 --------
51 files changed, 25 insertions(+), 1183 deletions(-)
diff --git a/airflow/contrib/hooks/aws_athena_hook.py b/airflow/contrib/hooks/aws_athena_hook.py
index db1ecdfdbf..d2d0b80176 100644
--- a/airflow/contrib/hooks/aws_athena_hook.py
+++ b/airflow/contrib/hooks/aws_athena_hook.py
@@ -20,7 +20,7 @@
import warnings
-from airflow.providers.amazon.aws.hooks.athena import AWSAthenaHook # noqa
+from airflow.providers.amazon.aws.hooks.athena import AthenaHook as AWSAthenaHook # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.athena`.",
diff --git a/airflow/contrib/hooks/aws_datasync_hook.py b/airflow/contrib/hooks/aws_datasync_hook.py
index 0d485475b0..1ec0841506 100644
--- a/airflow/contrib/hooks/aws_datasync_hook.py
+++ b/airflow/contrib/hooks/aws_datasync_hook.py
@@ -20,7 +20,7 @@
import warnings
-from airflow.providers.amazon.aws.hooks.datasync import AWSDataSyncHook # noqa
+from airflow.providers.amazon.aws.hooks.datasync import DataSyncHook as AWSDataSyncHook # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.datasync`.",
diff --git a/airflow/contrib/hooks/aws_dynamodb_hook.py b/airflow/contrib/hooks/aws_dynamodb_hook.py
index dedb80073e..e87d59c61c 100644
--- a/airflow/contrib/hooks/aws_dynamodb_hook.py
+++ b/airflow/contrib/hooks/aws_dynamodb_hook.py
@@ -19,7 +19,7 @@
import warnings
-from airflow.providers.amazon.aws.hooks.dynamodb import AwsDynamoDBHook # noqa
+from airflow.providers.amazon.aws.hooks.dynamodb import DynamoDBHook as AwsDynamoDBHook # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.dynamodb`.",
diff --git a/airflow/contrib/hooks/aws_firehose_hook.py b/airflow/contrib/hooks/aws_firehose_hook.py
index c6d39cd795..3819710048 100644
--- a/airflow/contrib/hooks/aws_firehose_hook.py
+++ b/airflow/contrib/hooks/aws_firehose_hook.py
@@ -20,7 +20,7 @@
import warnings
-from airflow.providers.amazon.aws.hooks.kinesis import AwsFirehoseHook # noqa
+from airflow.providers.amazon.aws.hooks.kinesis import FirehoseHook # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.kinesis`.",
diff --git a/airflow/contrib/hooks/aws_glue_catalog_hook.py b/airflow/contrib/hooks/aws_glue_catalog_hook.py
index 703ba47b81..9ff0c9a963 100644
--- a/airflow/contrib/hooks/aws_glue_catalog_hook.py
+++ b/airflow/contrib/hooks/aws_glue_catalog_hook.py
@@ -19,7 +19,7 @@
import warnings
-from airflow.providers.amazon.aws.hooks.glue_catalog import AwsGlueCatalogHook # noqa
+from airflow.providers.amazon.aws.hooks.glue_catalog import GlueCatalogHook as AwsGlueCatalogHook # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.glue_catalog`.",
diff --git a/airflow/contrib/hooks/aws_lambda_hook.py b/airflow/contrib/hooks/aws_lambda_hook.py
index 379aaf5486..a6328d7471 100644
--- a/airflow/contrib/hooks/aws_lambda_hook.py
+++ b/airflow/contrib/hooks/aws_lambda_hook.py
@@ -23,7 +23,7 @@ Please use :mod:`airflow.providers.amazon.aws.hooks.lambda_function`.
import warnings
-from airflow.providers.amazon.aws.hooks.lambda_function import AwsLambdaHook # noqa
+from airflow.providers.amazon.aws.hooks.lambda_function import LambdaHook as AwsLambdaHook # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.lambda_function`.",
diff --git a/airflow/contrib/hooks/aws_sns_hook.py b/airflow/contrib/hooks/aws_sns_hook.py
index b1318f52ad..1b846b396e 100644
--- a/airflow/contrib/hooks/aws_sns_hook.py
+++ b/airflow/contrib/hooks/aws_sns_hook.py
@@ -20,7 +20,7 @@
import warnings
-from airflow.providers.amazon.aws.hooks.sns import AwsSnsHook # noqa
+from airflow.providers.amazon.aws.hooks.sns import SnsHook as AwsSnsHook # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.sns`.",
diff --git a/airflow/contrib/operators/aws_athena_operator.py b/airflow/contrib/operators/aws_athena_operator.py
index e799c74635..14d8a5c253 100644
--- a/airflow/contrib/operators/aws_athena_operator.py
+++ b/airflow/contrib/operators/aws_athena_operator.py
@@ -20,7 +20,7 @@
import warnings
-from airflow.providers.amazon.aws.operators.athena import AWSAthenaOperator # noqa
+from airflow.providers.amazon.aws.operators.athena import AthenaOperator as AWSAthenaOperator # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.operators.athena`.",
diff --git a/airflow/contrib/operators/awsbatch_operator.py b/airflow/contrib/operators/awsbatch_operator.py
index a6be224cb9..a89e56cba8 100644
--- a/airflow/contrib/operators/awsbatch_operator.py
+++ b/airflow/contrib/operators/awsbatch_operator.py
@@ -27,9 +27,8 @@ This module is deprecated. Please use:
import warnings
-from airflow.providers.amazon.aws.hooks.batch_client import AwsBatchProtocol
-from airflow.providers.amazon.aws.operators.batch import AwsBatchOperator
-from airflow.typing_compat import Protocol, runtime_checkable
+from airflow.providers.amazon.aws.hooks.batch_client import BatchProtocol # noqa
+from airflow.providers.amazon.aws.operators.batch import BatchOperator
warnings.warn(
"This module is deprecated. "
@@ -41,35 +40,17 @@ warnings.warn(
)
-class AWSBatchOperator(AwsBatchOperator):
+class AWSBatchOperator(BatchOperator):
"""
This class is deprecated. Please use
- `airflow.providers.amazon.aws.operators.batch.AwsBatchOperator`.
+ `airflow.providers.amazon.aws.operators.batch.BatchOperator`.
"""
def __init__(self, *args, **kwargs):
warnings.warn(
"""This class is deprecated.
- Please use `airflow.providers.amazon.aws.operators.batch.AwsBatchOperator`.""",
+ Please use `airflow.providers.amazon.aws.operators.batch.BatchOperator`.""",
DeprecationWarning,
stacklevel=2,
)
super().__init__(*args, **kwargs)
-
-
-@runtime_checkable
-class BatchProtocol(AwsBatchProtocol, Protocol):
- """
- This class is deprecated. Please use
- `airflow.providers.amazon.aws.hooks.batch_client.AwsBatchProtocol`.
- """
-
- # A Protocol cannot be instantiated
-
- def __new__(cls, *args, **kwargs):
- warnings.warn(
- """This class is deprecated.
- Please use `airflow.providers.amazon.aws.hooks.batch_client.AwsBatchProtocol`.""",
- DeprecationWarning,
- stacklevel=2,
- )
diff --git a/airflow/contrib/operators/ecs_operator.py b/airflow/contrib/operators/ecs_operator.py
index 569df0c284..68dbe0a433 100644
--- a/airflow/contrib/operators/ecs_operator.py
+++ b/airflow/contrib/operators/ecs_operator.py
@@ -19,9 +19,10 @@
import warnings
-from airflow.providers.amazon.aws.operators.ecs import ECSOperator, ECSProtocol
-
-__all__ = ["ECSOperator", "ECSProtocol"]
+from airflow.providers.amazon.aws.operators.ecs import ( # noqa
+ EcsOperator as ECSOperator,
+ EcsProtocol as ECSProtocol,
+)
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.operators.ecs`.",
diff --git a/airflow/contrib/sensors/aws_glue_catalog_partition_sensor.py b/airflow/contrib/sensors/aws_glue_catalog_partition_sensor.py
index 66975a86f3..42a3795a56 100644
--- a/airflow/contrib/sensors/aws_glue_catalog_partition_sensor.py
+++ b/airflow/contrib/sensors/aws_glue_catalog_partition_sensor.py
@@ -22,7 +22,9 @@ Please use :mod:`airflow.providers.amazon.aws.sensors.glue_catalog_partition`.
import warnings
-from airflow.providers.amazon.aws.sensors.glue_catalog_partition import AwsGlueCatalogPartitionSensor # noqa
+from airflow.providers.amazon.aws.sensors.glue_catalog_partition import ( # noqa
+ GlueCatalogPartitionSensor as AwsGlueCatalogPartitionSensor,
+)
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.sensors.glue_catalog_partition`.",
diff --git a/airflow/providers/amazon/aws/exceptions.py b/airflow/providers/amazon/aws/exceptions.py
index 27f46dfae7..cb59d5b694 100644
--- a/airflow/providers/amazon/aws/exceptions.py
+++ b/airflow/providers/amazon/aws/exceptions.py
@@ -18,7 +18,6 @@
#
# Note: Any AirflowException raised is expected to cause the TaskInstance
# to be marked in an ERROR state
-import warnings
class EcsTaskFailToStart(Exception):
@@ -42,19 +41,3 @@ class EcsOperatorError(Exception):
def __reduce__(self):
return EcsOperatorError, (self.failures, self.message)
-
-
-class ECSOperatorError(EcsOperatorError):
- """
- This class is deprecated.
- Please use :class:`airflow.providers.amazon.aws.exceptions.EcsOperatorError`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This class is deprecated. "
- "Please use `airflow.providers.amazon.aws.exceptions.EcsOperatorError`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/athena.py b/airflow/providers/amazon/aws/hooks/athena.py
index 82e69ccf6f..0c224e5fd5 100644
--- a/airflow/providers/amazon/aws/hooks/athena.py
+++ b/airflow/providers/amazon/aws/hooks/athena.py
@@ -23,7 +23,6 @@ This module contains AWS Athena hook.
PageIterator
"""
-import warnings
from time import sleep
from typing import Any, Dict, Optional
@@ -252,18 +251,3 @@ class AthenaHook(AwsBaseHook):
:return: dict
"""
return self.get_conn().stop_query_execution(QueryExecutionId=query_execution_id)
-
-
-class AWSAthenaHook(AthenaHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.athena.AthenaHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. Please use `airflow.providers.amazon.aws.hooks.athena.AthenaHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/base_aws.py b/airflow/providers/amazon/aws/hooks/base_aws.py
index 01cc56e8d7..d93b2bc0b9 100644
--- a/airflow/providers/amazon/aws/hooks/base_aws.py
+++ b/airflow/providers/amazon/aws/hooks/base_aws.py
@@ -438,19 +438,11 @@ class AwsGenericHook(BaseHook, Generic[BaseAwsConnection]):
def get_client_type(
self,
- client_type: Optional[str] = None,
region_name: Optional[str] = None,
config: Optional[Config] = None,
) -> boto3.client:
"""Get the underlying boto3 client using boto3 session"""
- if client_type:
- warnings.warn(
- "client_type is deprecated. Set client_type from class attribute.",
- DeprecationWarning,
- stacklevel=2,
- )
- else:
- client_type = self.client_type
+ client_type = self.client_type
# No AWS Operators use the config argument to this method.
# Keep backward compatibility with other users who might use it
@@ -464,19 +456,11 @@ class AwsGenericHook(BaseHook, Generic[BaseAwsConnection]):
def get_resource_type(
self,
- resource_type: Optional[str] = None,
region_name: Optional[str] = None,
config: Optional[Config] = None,
) -> boto3.resource:
"""Get the underlying boto3 resource using boto3 session"""
- if resource_type:
- warnings.warn(
- "resource_type is deprecated. Set resource_type from class attribute.",
- DeprecationWarning,
- stacklevel=2,
- )
- else:
- resource_type = self.resource_type
+ resource_type = self.resource_type
# No AWS Operators use the config argument to this method.
# Keep backward compatibility with other users who might use it
diff --git a/airflow/providers/amazon/aws/hooks/batch_client.py b/airflow/providers/amazon/aws/hooks/batch_client.py
index 287e319f51..ccc617cde7 100644
--- a/airflow/providers/amazon/aws/hooks/batch_client.py
+++ b/airflow/providers/amazon/aws/hooks/batch_client.py
@@ -24,7 +24,6 @@ A client for AWS Batch services
- http://boto3.readthedocs.io/en/latest/reference/services/batch.html
- https://docs.aws.amazon.com/batch/latest/APIReference/Welcome.html
"""
-import warnings
from random import uniform
from time import sleep
from typing import Dict, List, Optional, Union
@@ -551,35 +550,3 @@ class BatchClientHook(AwsBaseHook):
delay = 1 + pow(tries * 0.6, 2)
delay = min(max_interval, delay)
return uniform(delay / 3, delay)
-
-
-class AwsBatchProtocol(BatchProtocol, Protocol):
- """
- This class is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.batch.BatchProtocol`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This class is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.hooks.batch.BatchProtocol`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class AwsBatchClientHook(BatchClientHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.batch.BatchClientHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.hooks.batch.BatchClientHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/batch_waiters.py b/airflow/providers/amazon/aws/hooks/batch_waiters.py
index 3d1cd9d4b4..b984d3e23f 100644
--- a/airflow/providers/amazon/aws/hooks/batch_waiters.py
+++ b/airflow/providers/amazon/aws/hooks/batch_waiters.py
@@ -28,7 +28,6 @@ AWS Batch service waiters
import json
import sys
-import warnings
from copy import deepcopy
from pathlib import Path
from typing import Dict, List, Optional, Union
@@ -227,19 +226,3 @@ class BatchWaitersHook(BatchClientHook):
except (botocore.exceptions.ClientError, botocore.exceptions.WaiterError) as err:
raise AirflowException(err)
-
-
-class AwsBatchWaitersHook(BatchWaitersHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.batch.BatchWaitersHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.hooks.batch.BatchWaitersHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/cloud_formation.py b/airflow/providers/amazon/aws/hooks/cloud_formation.py
index e96f397628..6c17ad81e0 100644
--- a/airflow/providers/amazon/aws/hooks/cloud_formation.py
+++ b/airflow/providers/amazon/aws/hooks/cloud_formation.py
@@ -17,7 +17,6 @@
# under the License.
"""This module contains AWS CloudFormation Hook"""
-import warnings
from typing import Optional, Union
from boto3 import client, resource
@@ -75,19 +74,3 @@ class CloudFormationHook(AwsBaseHook):
if 'StackName' not in cloudformation_parameters:
cloudformation_parameters['StackName'] = stack_name
self.get_conn().delete_stack(**cloudformation_parameters)
-
-
-class AWSCloudFormationHook(CloudFormationHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.cloud_formation.CloudFormationHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.hooks.cloud_formation.CloudFormationHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/datasync.py b/airflow/providers/amazon/aws/hooks/datasync.py
index b75123d6fc..6db8438c49 100644
--- a/airflow/providers/amazon/aws/hooks/datasync.py
+++ b/airflow/providers/amazon/aws/hooks/datasync.py
@@ -18,7 +18,6 @@
"""Interact with AWS DataSync, using the AWS ``boto3`` library."""
import time
-import warnings
from typing import List, Optional
from airflow.exceptions import AirflowBadRequest, AirflowException, AirflowTaskTimeout
@@ -316,18 +315,3 @@ class DataSyncHook(AwsBaseHook):
if iterations <= 0:
raise AirflowTaskTimeout("Max iterations exceeded!")
raise AirflowException(f"Unknown status: {status}") # Should never happen
-
-
-class AWSDataSyncHook(DataSyncHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.datasync.DataSyncHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. Please use `airflow.providers.amazon.aws.hooks.datasync.DataSyncHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/dynamodb.py b/airflow/providers/amazon/aws/hooks/dynamodb.py
index 7b298ee15c..bb0637ae64 100644
--- a/airflow/providers/amazon/aws/hooks/dynamodb.py
+++ b/airflow/providers/amazon/aws/hooks/dynamodb.py
@@ -18,7 +18,6 @@
"""This module contains the AWS DynamoDB hook"""
-import warnings
from typing import Iterable, List, Optional
from airflow.exceptions import AirflowException
@@ -58,19 +57,3 @@ class DynamoDBHook(AwsBaseHook):
return True
except Exception as general_error:
raise AirflowException(f"Failed to insert items in dynamodb, error: {str(general_error)}")
-
-
-class AwsDynamoDBHook(DynamoDBHook):
- """
- This class is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.dynamodb.DynamoDBHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This class is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.hooks.dynamodb.DynamoDBHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/eks.py b/airflow/providers/amazon/aws/hooks/eks.py
index 298d9f641e..3157b2dbf8 100644
--- a/airflow/providers/amazon/aws/hooks/eks.py
+++ b/airflow/providers/amazon/aws/hooks/eks.py
@@ -20,7 +20,6 @@ import base64
import json
import sys
import tempfile
-import warnings
from contextlib import contextmanager
from enum import Enum
from functools import partial
@@ -499,8 +498,6 @@ class EksHook(AwsBaseHook):
self,
eks_cluster_name: str,
pod_namespace: Optional[str],
- pod_username: Optional[str] = None,
- pod_context: Optional[str] = None,
) -> Generator[str, None, None]:
"""
Writes the kubeconfig file given an EKS Cluster.
@@ -508,20 +505,6 @@ class EksHook(AwsBaseHook):
:param eks_cluster_name: The name of the cluster to generate kubeconfig file for.
:param pod_namespace: The namespace to run within kubernetes.
"""
- if pod_username:
- warnings.warn(
- "This pod_username parameter is deprecated, because changing the value does not make any "
- "visible changes to the user.",
- DeprecationWarning,
- stacklevel=2,
- )
- if pod_context:
- warnings.warn(
- "This pod_context parameter is deprecated, because changing the value does not make any "
- "visible changes to the user.",
- DeprecationWarning,
- stacklevel=2,
- )
# Set up the client
eks_client = self.conn
@@ -628,18 +611,3 @@ class EksHook(AwsBaseHook):
# remove any base64 encoding padding:
return 'k8s-aws-v1.' + base64_url.rstrip("=")
-
-
-class EKSHook(EksHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.eks.EksHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. Please use `airflow.providers.amazon.aws.hooks.eks.EksHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/glue.py b/airflow/providers/amazon/aws/hooks/glue.py
index fba765e2ff..adbe9626e6 100644
--- a/airflow/providers/amazon/aws/hooks/glue.py
+++ b/airflow/providers/amazon/aws/hooks/glue.py
@@ -17,7 +17,6 @@
# under the License.
import time
-import warnings
from typing import Dict, List, Optional
import boto3
@@ -283,19 +282,3 @@ class GlueJobHook(AwsBaseHook):
except Exception as general_error:
self.log.error("Failed to create aws glue job, error: %s", general_error)
raise
-
-
-class AwsGlueJobHook(GlueJobHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.glue.GlueJobHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.hooks.glue.GlueJobHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/glue_catalog.py b/airflow/providers/amazon/aws/hooks/glue_catalog.py
index e77916d09e..c02d1ed6d3 100644
--- a/airflow/providers/amazon/aws/hooks/glue_catalog.py
+++ b/airflow/providers/amazon/aws/hooks/glue_catalog.py
@@ -17,7 +17,6 @@
# under the License.
"""This module contains AWS Glue Catalog Hook"""
-import warnings
from typing import Dict, List, Optional, Set
from botocore.exceptions import ClientError
@@ -178,19 +177,3 @@ class GlueCatalogHook(AwsBaseHook):
except ClientError as e:
self.log.error("Client error: %s", e)
raise AirflowException("AWS request failed, check logs for more info")
-
-
-class AwsGlueCatalogHook(GlueCatalogHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.glue_catalog.GlueCatalogHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.hooks.glue_catalog.GlueCatalogHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/glue_crawler.py b/airflow/providers/amazon/aws/hooks/glue_crawler.py
index e4138290d1..03a7f926f6 100644
--- a/airflow/providers/amazon/aws/hooks/glue_crawler.py
+++ b/airflow/providers/amazon/aws/hooks/glue_crawler.py
@@ -15,7 +15,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import warnings
from time import sleep
from airflow.compat.functools import cached_property
@@ -157,19 +156,3 @@ class GlueCrawlerHook(AwsBaseHook):
self.log.info("Crawler should finish soon")
sleep(poll_interval)
-
-
-class AwsGlueCrawlerHook(GlueCrawlerHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.glue_crawler.GlueCrawlerHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.hooks.glue_crawler.GlueCrawlerHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/kinesis.py b/airflow/providers/amazon/aws/hooks/kinesis.py
index f15457c6c2..7e40016572 100644
--- a/airflow/providers/amazon/aws/hooks/kinesis.py
+++ b/airflow/providers/amazon/aws/hooks/kinesis.py
@@ -17,7 +17,6 @@
# under the License.
"""This module contains AWS Firehose hook"""
-import warnings
from typing import Iterable
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
@@ -44,19 +43,3 @@ class FirehoseHook(AwsBaseHook):
def put_records(self, records: Iterable):
"""Write batch records to Kinesis Firehose"""
return self.get_conn().put_record_batch(DeliveryStreamName=self.delivery_stream, Records=records)
-
-
-class AwsFirehoseHook(FirehoseHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.kinesis.FirehoseHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.hooks.kinesis.FirehoseHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/lambda_function.py b/airflow/providers/amazon/aws/hooks/lambda_function.py
index b6819d9dba..edf5fdc50b 100644
--- a/airflow/providers/amazon/aws/hooks/lambda_function.py
+++ b/airflow/providers/amazon/aws/hooks/lambda_function.py
@@ -17,7 +17,6 @@
# under the License.
"""This module contains AWS Lambda hook"""
-import warnings
from typing import Any, List, Optional
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
@@ -120,19 +119,3 @@ class LambdaHook(AwsBaseHook):
return self.conn.create_function(
**{k: v for k, v in create_function_args.items() if v is not None},
)
-
-
-class AwsLambdaHook(LambdaHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.lambda_function.LambdaHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.hooks.lambda_function.LambdaHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/sagemaker.py b/airflow/providers/amazon/aws/hooks/sagemaker.py
index d4b07ef23c..f5f883eb23 100644
--- a/airflow/providers/amazon/aws/hooks/sagemaker.py
+++ b/airflow/providers/amazon/aws/hooks/sagemaker.py
@@ -20,7 +20,6 @@ import os
import tarfile
import tempfile
import time
-import warnings
from datetime import datetime
from functools import partial
from typing import Any, Callable, Dict, Generator, List, Optional, Set, Tuple, cast
@@ -236,36 +235,6 @@ class SageMakerHook(AwsBaseHook):
if "S3DataSource" in channel['DataSource']:
self.check_s3_url(channel['DataSource']['S3DataSource']['S3Uri'])
- def get_log_conn(self):
- """
- This method is deprecated.
- Please use :py:meth:`airflow.providers.amazon.aws.hooks.logs.AwsLogsHook.get_conn` instead.
- """
- warnings.warn(
- "Method `get_log_conn` has been deprecated. "
- "Please use `airflow.providers.amazon.aws.hooks.logs.AwsLogsHook.get_conn` instead.",
- category=DeprecationWarning,
- stacklevel=2,
- )
-
- return self.logs_hook.get_conn()
-
- def log_stream(self, log_group, stream_name, start_time=0, skip=0):
- """
- This method is deprecated.
- Please use
- :py:meth:`airflow.providers.amazon.aws.hooks.logs.AwsLogsHook.get_log_events` instead.
- """
- warnings.warn(
- "Method `log_stream` has been deprecated. "
- "Please use "
- "`airflow.providers.amazon.aws.hooks.logs.AwsLogsHook.get_log_events` instead.",
- category=DeprecationWarning,
- stacklevel=2,
- )
-
- return self.logs_hook.get_log_events(log_group, stream_name, start_time, skip)
-
def multi_stream_iter(self, log_group: str, streams: list, positions=None) -> Generator:
"""
Iterate over the available events coming from a set of log streams in a single log group
diff --git a/airflow/providers/amazon/aws/hooks/ses.py b/airflow/providers/amazon/aws/hooks/ses.py
index 92dcce7ecb..7780331558 100644
--- a/airflow/providers/amazon/aws/hooks/ses.py
+++ b/airflow/providers/amazon/aws/hooks/ses.py
@@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
"""This module contains AWS SES Hook"""
-import warnings
from typing import Any, Dict, Iterable, List, Optional, Union
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
@@ -96,18 +95,3 @@ class SesHook(AwsBaseHook):
return ses_client.send_raw_email(
Source=mail_from, Destinations=recipients, RawMessage={'Data': message.as_string()}
)
-
-
-class SESHook(SesHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.ses.SesHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. Please use :class:`airflow.providers.amazon.aws.hooks.ses.SesHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/sns.py b/airflow/providers/amazon/aws/hooks/sns.py
index fc009d9f9b..30750ea1c5 100644
--- a/airflow/providers/amazon/aws/hooks/sns.py
+++ b/airflow/providers/amazon/aws/hooks/sns.py
@@ -18,7 +18,6 @@
"""This module contains AWS SNS hook"""
import json
-import warnings
from typing import Dict, Optional, Union
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
@@ -90,18 +89,3 @@ class SnsHook(AwsBaseHook):
}
return self.get_conn().publish(**publish_kwargs)
-
-
-class AwsSnsHook(SnsHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.sns.SnsHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. Please use :class:`airflow.providers.amazon.aws.hooks.sns.SnsHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/hooks/sqs.py b/airflow/providers/amazon/aws/hooks/sqs.py
index d3bcd837c9..bb1002a6cc 100644
--- a/airflow/providers/amazon/aws/hooks/sqs.py
+++ b/airflow/providers/amazon/aws/hooks/sqs.py
@@ -17,7 +17,6 @@
# under the License.
"""This module contains AWS SQS hook"""
-import warnings
from typing import Dict, Optional
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
@@ -85,18 +84,3 @@ class SqsHook(AwsBaseHook):
params['MessageGroupId'] = message_group_id
return self.get_conn().send_message(**params)
-
-
-class SQSHook(SqsHook):
- """
- This hook is deprecated.
- Please use :class:`airflow.providers.amazon.aws.hooks.sqs.SqsHook`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This hook is deprecated. Please use :class:`airflow.providers.amazon.aws.hooks.sqs.SqsHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/operators/athena.py b/airflow/providers/amazon/aws/operators/athena.py
index b3e3f90889..679e71000a 100644
--- a/airflow/providers/amazon/aws/operators/athena.py
+++ b/airflow/providers/amazon/aws/operators/athena.py
@@ -16,7 +16,6 @@
# specific language governing permissions and limitations
# under the License.
#
-import warnings
from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence
from airflow.compat.functools import cached_property
@@ -131,19 +130,3 @@ class AthenaOperator(BaseOperator):
'Polling Athena for query with id %s to reach final state', self.query_execution_id
)
self.hook.poll_query_status(self.query_execution_id)
-
-
-class AWSAthenaOperator(AthenaOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.athena.AthenaOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. Please use "
- "`airflow.providers.amazon.aws.operators.athena.AthenaOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/operators/batch.py b/airflow/providers/amazon/aws/operators/batch.py
index 4db83ecf78..567c419715 100644
--- a/airflow/providers/amazon/aws/operators/batch.py
+++ b/airflow/providers/amazon/aws/operators/batch.py
@@ -26,7 +26,6 @@ An Airflow operator for AWS Batch services
- https://docs.aws.amazon.com/batch/latest/APIReference/Welcome.html
"""
import sys
-import warnings
from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence
from airflow.providers.amazon.aws.utils import trim_none_values
@@ -377,19 +376,3 @@ class BatchCreateComputeEnvironmentOperator(BaseOperator):
self.hook.client.create_compute_environment(**trim_none_values(kwargs))
self.log.info('AWS Batch compute environment created successfully')
-
-
-class AwsBatchOperator(BatchOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.batch.BatchOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.operators.batch.BatchOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/operators/datasync.py b/airflow/providers/amazon/aws/operators/datasync.py
index ffe864d5ce..84b939c46c 100644
--- a/airflow/providers/amazon/aws/operators/datasync.py
+++ b/airflow/providers/amazon/aws/operators/datasync.py
@@ -19,7 +19,6 @@
import logging
import random
-import warnings
from typing import TYPE_CHECKING, List, Optional, Sequence
from airflow.exceptions import AirflowException, AirflowTaskTimeout
@@ -403,19 +402,3 @@ class DataSyncOperator(BaseOperator):
location_arns = self.get_hook().get_location_arns(location_uri)
self.log.info("Found LocationArns %s for LocationUri %s", location_arns, location_uri)
return location_arns
-
-
-class AWSDataSyncOperator(DataSyncOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.datasync.DataSyncOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. Please use "
- "`airflow.providers.amazon.aws.operators.datasync.DataSyncHook`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/operators/ecs.py b/airflow/providers/amazon/aws/operators/ecs.py
index 7967fe0d13..e04fbc3040 100644
--- a/airflow/providers/amazon/aws/operators/ecs.py
+++ b/airflow/providers/amazon/aws/operators/ecs.py
@@ -18,7 +18,6 @@
import re
import sys
import time
-import warnings
from collections import deque
from datetime import datetime, timedelta
from logging import Logger
@@ -518,50 +517,3 @@ class EcsOperator(BaseOperator):
cluster=self.cluster, task=self.arn, reason='Task killed by the user'
)
self.log.info(response)
-
-
-class ECSOperator(EcsOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.ecs.EcsOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.ecs.EcsOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class ECSTaskLogFetcher(EcsTaskLogFetcher):
- """
- This class is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.ecs.EcsTaskLogFetcher`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This class is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.ecs.EcsTaskLogFetcher`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class ECSProtocol(EcsProtocol):
- """
- This class is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.ecs.EcsProtocol`.
- """
-
- def __init__(self):
- warnings.warn(
- "This class is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.ecs.EcsProtocol`.",
- DeprecationWarning,
- stacklevel=2,
- )
diff --git a/airflow/providers/amazon/aws/operators/eks.py b/airflow/providers/amazon/aws/operators/eks.py
index 8e97015d86..fb1870c187 100644
--- a/airflow/providers/amazon/aws/operators/eks.py
+++ b/airflow/providers/amazon/aws/operators/eks.py
@@ -37,7 +37,6 @@ DEFAULT_CONN_ID = 'aws_default'
DEFAULT_FARGATE_PROFILE_NAME = 'profile'
DEFAULT_NAMESPACE_NAME = 'default'
DEFAULT_NODEGROUP_NAME = 'nodegroup'
-DEFAULT_POD_NAME = 'pod'
ABORT_MSG = "{compute} are still active after the allocated time limit. Aborting."
CAN_NOT_DELETE_MSG = "A cluster can not be deleted with attached {compute}. Deleting {count} {compute}."
@@ -654,15 +653,6 @@ class EksPodOperator(KubernetesPodOperator):
is_delete_operator_pod: Optional[bool] = None,
**kwargs,
) -> None:
- if pod_name is None:
- warnings.warn(
- "Default value of pod name is deprecated. "
- "We recommend that you pass pod name explicitly. ",
- DeprecationWarning,
- stacklevel=2,
- )
- pod_name = DEFAULT_POD_NAME
-
if is_delete_operator_pod is None:
warnings.warn(
f"You have not set parameter `is_delete_operator_pod` in class {self.__class__.__name__}. "
@@ -687,20 +677,6 @@ class EksPodOperator(KubernetesPodOperator):
is_delete_operator_pod=is_delete_operator_pod,
**kwargs,
)
- if pod_username:
- warnings.warn(
- "This pod_username parameter is deprecated, because changing the value does not make any "
- "visible changes to the user.",
- DeprecationWarning,
- stacklevel=2,
- )
- if pod_context:
- warnings.warn(
- "This pod_context parameter is deprecated, because changing the value does not make any "
- "visible changes to the user.",
- DeprecationWarning,
- stacklevel=2,
- )
# There is no need to manage the kube_config file, as it will be generated automatically.
# All Kubernetes parameters (except config_file) are also valid for the EksPodOperator.
if self.config_file:
@@ -715,115 +691,3 @@ class EksPodOperator(KubernetesPodOperator):
eks_cluster_name=self.cluster_name, pod_namespace=self.namespace
) as self.config_file:
return super().execute(context)
-
-
-class EKSCreateClusterOperator(EksCreateClusterOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.eks.EksCreateClusterOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.eks.EksCreateClusterOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class EKSCreateNodegroupOperator(EksCreateNodegroupOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.eks.EksCreateNodegroupOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.eks.EksCreateNodegroupOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class EKSCreateFargateProfileOperator(EksCreateFargateProfileOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.eks.EksCreateFargateProfileOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.eks.EksCreateFargateProfileOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class EKSDeleteClusterOperator(EksDeleteClusterOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.eks.EksDeleteClusterOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.eks.EksDeleteClusterOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class EKSDeleteNodegroupOperator(EksDeleteNodegroupOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.eks.EksDeleteNodegroupOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.eks.EksDeleteNodegroupOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class EKSDeleteFargateProfileOperator(EksDeleteFargateProfileOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.eks.EksDeleteFargateProfileOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.eks.EksDeleteFargateProfileOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class EKSPodOperator(EksPodOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.eks.EksPodOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.eks.EksPodOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/operators/glue.py b/airflow/providers/amazon/aws/operators/glue.py
index 424cd75f36..48b201ba9c 100644
--- a/airflow/providers/amazon/aws/operators/glue.py
+++ b/airflow/providers/amazon/aws/operators/glue.py
@@ -17,7 +17,6 @@
# under the License.
import os.path
-import warnings
from typing import TYPE_CHECKING, Optional, Sequence
from airflow.models import BaseOperator
@@ -154,19 +153,3 @@ class GlueJobOperator(BaseOperator):
else:
self.log.info("AWS Glue Job: %s. Run Id: %s", self.job_name, glue_job_run['JobRunId'])
return glue_job_run['JobRunId']
-
-
-class AwsGlueJobOperator(GlueJobOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.glue.GlueJobOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.operators.glue.GlueJobOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/operators/glue_crawler.py b/airflow/providers/amazon/aws/operators/glue_crawler.py
index c75febf267..b7968d72aa 100644
--- a/airflow/providers/amazon/aws/operators/glue_crawler.py
+++ b/airflow/providers/amazon/aws/operators/glue_crawler.py
@@ -15,7 +15,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import warnings
from typing import TYPE_CHECKING, Sequence
if TYPE_CHECKING:
@@ -83,19 +82,3 @@ class GlueCrawlerOperator(BaseOperator):
self.hook.wait_for_crawler_completion(crawler_name=crawler_name, poll_interval=self.poll_interval)
return crawler_name
-
-
-class AwsGlueCrawlerOperator(GlueCrawlerOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.glue_crawler.GlueCrawlerOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.operators.glue_crawler.GlueCrawlerOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/operators/sqs.py b/airflow/providers/amazon/aws/operators/sqs.py
index c9874c4d1e..57b8a455d7 100644
--- a/airflow/providers/amazon/aws/operators/sqs.py
+++ b/airflow/providers/amazon/aws/operators/sqs.py
@@ -16,7 +16,6 @@
# under the License.
"""Publish message to SQS queue"""
-import warnings
from typing import TYPE_CHECKING, Optional, Sequence
from airflow.models import BaseOperator
@@ -95,19 +94,3 @@ class SqsPublishOperator(BaseOperator):
self.log.info('send_message result: %s', result)
return result
-
-
-class SQSPublishOperator(SqsPublishOperator):
- """
- This operator is deprecated.
- Please use :class:`airflow.providers.amazon.aws.operators.sqs.SqsPublishOperator`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This operator is deprecated. "
- "Please use `airflow.providers.amazon.aws.operators.sqs.SqsPublishOperator`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/sensors/eks.py b/airflow/providers/amazon/aws/sensors/eks.py
index 76b2703e89..6c3ab7cdf9 100644
--- a/airflow/providers/amazon/aws/sensors/eks.py
+++ b/airflow/providers/amazon/aws/sensors/eks.py
@@ -16,7 +16,6 @@
# under the License.
#
"""Tracking the state of Amazon EKS Clusters, Amazon EKS managed node groups, and AWS Fargate profiles."""
-import warnings
from typing import TYPE_CHECKING, Optional, Sequence
from airflow.exceptions import AirflowException
@@ -256,51 +255,3 @@ class EksNodegroupStateSensor(BaseSensorOperator):
)
)
return nodegroup_state == self.target_state
-
-
-class EKSClusterStateSensor(EksClusterStateSensor):
- """
- This sensor is deprecated.
- Please use :class:`airflow.providers.amazon.aws.sensors.eks.EksClusterStateSensor`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This sensor is deprecated. "
- "Please use `airflow.providers.amazon.aws.sensors.eks.EksClusterStateSensor`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class EKSFargateProfileStateSensor(EksFargateProfileStateSensor):
- """
- This sensor is deprecated.
- Please use :class:`airflow.providers.amazon.aws.sensors.eks.EksFargateProfileStateSensor`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This sensor is deprecated. "
- "Please use `airflow.providers.amazon.aws.sensors.eks.EksFargateProfileStateSensor`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
-class EKSNodegroupStateSensor(EksNodegroupStateSensor):
- """
- This sensor is deprecated.
- Please use :class:`airflow.providers.amazon.aws.sensors.eks.EksNodegroupStateSensor`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This sensor is deprecated. "
- "Please use `airflow.providers.amazon.aws.sensors.eks.EksNodegroupStateSensor`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/sensors/glue.py b/airflow/providers/amazon/aws/sensors/glue.py
index a7989f64ec..68038307ba 100644
--- a/airflow/providers/amazon/aws/sensors/glue.py
+++ b/airflow/providers/amazon/aws/sensors/glue.py
@@ -15,7 +15,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import warnings
from typing import TYPE_CHECKING, List, Optional, Sequence
from airflow.exceptions import AirflowException
@@ -85,19 +84,3 @@ class GlueJobSensor(BaseSensorOperator):
job_failed=job_failed,
next_token=self.next_log_token,
)
-
-
-class AwsGlueJobSensor(GlueJobSensor):
- """
- This sensor is deprecated.
- Please use :class:`airflow.providers.amazon.aws.sensors.glue.GlueJobSensor`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This sensor is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.sensors.glue.GlueJobSensor`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/sensors/glue_catalog_partition.py b/airflow/providers/amazon/aws/sensors/glue_catalog_partition.py
index c49277f343..6b9df747e7 100644
--- a/airflow/providers/amazon/aws/sensors/glue_catalog_partition.py
+++ b/airflow/providers/amazon/aws/sensors/glue_catalog_partition.py
@@ -15,7 +15,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import warnings
from typing import TYPE_CHECKING, Optional, Sequence
from airflow.providers.amazon.aws.hooks.glue_catalog import GlueCatalogHook
@@ -89,19 +88,3 @@ class GlueCatalogPartitionSensor(BaseSensorOperator):
self.hook = GlueCatalogHook(aws_conn_id=self.aws_conn_id, region_name=self.region_name)
return self.hook
-
-
-class AwsGlueCatalogPartitionSensor(GlueCatalogPartitionSensor):
- """
- This sensor is deprecated. Please use
- :class:`airflow.providers.amazon.aws.sensors.glue_catalog_partition.GlueCatalogPartitionSensor`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This sensor is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.sensors.glue_catalog_partition.GlueCatalogPartitionSensor`.", # noqa: 501
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/sensors/glue_crawler.py b/airflow/providers/amazon/aws/sensors/glue_crawler.py
index fa2c714ee4..f48b453174 100644
--- a/airflow/providers/amazon/aws/sensors/glue_crawler.py
+++ b/airflow/providers/amazon/aws/sensors/glue_crawler.py
@@ -15,7 +15,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import warnings
from typing import TYPE_CHECKING, Optional, Sequence
from airflow.exceptions import AirflowException
@@ -71,19 +70,3 @@ class GlueCrawlerSensor(BaseSensorOperator):
self.hook = GlueCrawlerHook(aws_conn_id=self.aws_conn_id)
return self.hook
-
-
-class AwsGlueCrawlerSensor(GlueCrawlerSensor):
- """
- This sensor is deprecated. Please use
- :class:`airflow.providers.amazon.aws.sensors.glue_crawler.GlueCrawlerSensor`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This sensor is deprecated. "
- "Please use :class:`airflow.providers.amazon.aws.sensors.glue_crawler.GlueCrawlerSensor`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/sensors/s3.py b/airflow/providers/amazon/aws/sensors/s3.py
index cb27ed574a..6c24c191e4 100644
--- a/airflow/providers/amazon/aws/sensors/s3.py
+++ b/airflow/providers/amazon/aws/sensors/s3.py
@@ -19,7 +19,6 @@
import fnmatch
import os
import re
-import warnings
from datetime import datetime
from typing import TYPE_CHECKING, Callable, List, Optional, Sequence, Set, Union
@@ -136,40 +135,6 @@ class S3KeySensor(BaseSensorOperator):
return self.hook
-class S3KeySizeSensor(S3KeySensor):
- """
- This class is deprecated.
- Please use :class:`~airflow.providers.amazon.aws.sensors.s3.S3KeySensor`.
- """
-
- def __init__(
- self,
- *,
- check_fn: Optional[Callable[..., bool]] = None,
- **kwargs,
- ):
- warnings.warn(
- """
- S3KeySizeSensor is deprecated.
- Please use `airflow.providers.amazon.aws.sensors.s3.S3KeySensor`.
- """,
- DeprecationWarning,
- stacklevel=2,
- )
-
- super().__init__(
- check_fn=check_fn if check_fn is not None else S3KeySizeSensor.default_check_fn, **kwargs
- )
-
- @staticmethod
- def default_check_fn(data: List) -> bool:
- """Default function for checking that S3 Objects have size more than 0
-
- :param data: List of the objects in S3 bucket.
- """
- return all(f.get('Size', 0) > 0 for f in data)
-
-
@poke_mode_only
class S3KeysUnchangedSensor(BaseSensorOperator):
"""
@@ -310,33 +275,3 @@ class S3KeysUnchangedSensor(BaseSensorOperator):
def poke(self, context: 'Context'):
return self.is_keys_unchanged(set(self.hook.list_keys(self.bucket_name, prefix=self.prefix)))
-
-
-class S3PrefixSensor(S3KeySensor):
- """
- This class is deprecated.
- Please use :class:`~airflow.providers.amazon.aws.sensors.s3.S3KeySensor`.
- """
-
- template_fields: Sequence[str] = ('prefix', 'bucket_name')
-
- def __init__(
- self,
- *,
- prefix: Union[str, List[str]],
- delimiter: str = '/',
- **kwargs,
- ):
- warnings.warn(
- """
- S3PrefixSensor is deprecated.
- Please use `airflow.providers.amazon.aws.sensors.s3.S3KeySensor`.
- """,
- DeprecationWarning,
- stacklevel=2,
- )
-
- prefixes = [prefix] if isinstance(prefix, str) else prefix
- keys = [pref if pref.endswith(delimiter) else pref + delimiter for pref in prefixes]
-
- super().__init__(bucket_key=keys, **kwargs)
diff --git a/airflow/providers/amazon/aws/sensors/sqs.py b/airflow/providers/amazon/aws/sensors/sqs.py
index c1b6c4c747..190c5edc15 100644
--- a/airflow/providers/amazon/aws/sensors/sqs.py
+++ b/airflow/providers/amazon/aws/sensors/sqs.py
@@ -17,7 +17,6 @@
# under the License.
"""Reads and then deletes the message from SQS queue"""
import json
-import warnings
from typing import TYPE_CHECKING, Any, Collection, List, Optional, Sequence
from jsonpath_ng import parse
@@ -225,18 +224,3 @@ class SqsSensor(BaseSensorOperator):
filtered_messages.append(message)
break
return filtered_messages
-
-
-class SQSSensor(SqsSensor):
- """
- This sensor is deprecated.
- Please use :class:`airflow.providers.amazon.aws.sensors.sqs.SqsSensor`.
- """
-
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "This class is deprecated. Please use `airflow.providers.amazon.aws.sensors.sqs.SqsSensor`.",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/airflow/providers/amazon/aws/transfers/s3_to_redshift.py b/airflow/providers/amazon/aws/transfers/s3_to_redshift.py
index 747c97e1f1..e0de981d7e 100644
--- a/airflow/providers/amazon/aws/transfers/s3_to_redshift.py
+++ b/airflow/providers/amazon/aws/transfers/s3_to_redshift.py
@@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
-import warnings
from typing import TYPE_CHECKING, Iterable, List, Optional, Sequence, Union
from airflow.exceptions import AirflowException
@@ -85,17 +84,6 @@ class S3ToRedshiftOperator(BaseOperator):
upsert_keys: Optional[List[str]] = None,
**kwargs,
) -> None:
-
- if 'truncate_table' in kwargs:
- warnings.warn(
- """`truncate_table` is deprecated. Please use `REPLACE` method.""",
- DeprecationWarning,
- stacklevel=2,
- )
- if kwargs['truncate_table']:
- method = 'REPLACE'
- kwargs.pop('truncate_table', None)
-
super().__init__(**kwargs)
self.schema = schema
self.table = table
diff --git a/airflow/sensors/s3_prefix_sensor.py b/airflow/sensors/s3_prefix_sensor.py
deleted file mode 100644
index 3990e8774a..0000000000
--- a/airflow/sensors/s3_prefix_sensor.py
+++ /dev/null
@@ -1,28 +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.
-"""This module is deprecated. Please use :mod:`airflow.providers.amazon.aws.sensors.s3`."""
-
-import warnings
-
-from airflow.providers.amazon.aws.sensors.s3 import S3PrefixSensor # noqa
-
-warnings.warn(
- "This module is deprecated. Please use `airflow.providers.amazon.aws.sensors.s3`.",
- DeprecationWarning,
- stacklevel=2,
-)
diff --git a/tests/always/test_project_structure.py b/tests/always/test_project_structure.py
index 845aca579c..1e6feb5d93 100644
--- a/tests/always/test_project_structure.py
+++ b/tests/always/test_project_structure.py
@@ -418,32 +418,6 @@ class TestAmazonProviderProjectStructure(ExampleCoverageTest):
'airflow.providers.amazon.aws.sensors.glue_catalog_partition.GlueCatalogPartitionSensor',
}
- DEPRECATED_CLASSES = {
- 'airflow.providers.amazon.aws.operators.athena.AWSAthenaOperator',
- 'airflow.providers.amazon.aws.operators.batch.AwsBatchOperator',
- 'airflow.providers.amazon.aws.operators.datasync.AWSDataSyncOperator',
- 'airflow.providers.amazon.aws.operators.ecs.ECSOperator',
- 'airflow.providers.amazon.aws.operators.eks.EKSCreateClusterOperator',
- 'airflow.providers.amazon.aws.operators.eks.EKSCreateFargateProfileOperator',
- 'airflow.providers.amazon.aws.operators.eks.EKSCreateNodegroupOperator',
- 'airflow.providers.amazon.aws.operators.eks.EKSDeleteClusterOperator',
- 'airflow.providers.amazon.aws.operators.eks.EKSDeleteFargateProfileOperator',
- 'airflow.providers.amazon.aws.operators.eks.EKSDeleteNodegroupOperator',
- 'airflow.providers.amazon.aws.operators.eks.EKSPodOperator',
- 'airflow.providers.amazon.aws.operators.glue.AwsGlueJobOperator',
- 'airflow.providers.amazon.aws.operators.glue_crawler.AwsGlueCrawlerOperator',
- 'airflow.providers.amazon.aws.operators.sqs.SQSPublishOperator',
- 'airflow.providers.amazon.aws.sensors.eks.EKSClusterStateSensor',
- 'airflow.providers.amazon.aws.sensors.eks.EKSFargateProfileStateSensor',
- 'airflow.providers.amazon.aws.sensors.eks.EKSNodegroupStateSensor',
- 'airflow.providers.amazon.aws.sensors.glue.AwsGlueJobSensor',
- 'airflow.providers.amazon.aws.sensors.glue_catalog_partition.AwsGlueCatalogPartitionSensor',
- 'airflow.providers.amazon.aws.sensors.glue_crawler.AwsGlueCrawlerSensor',
- 'airflow.providers.amazon.aws.sensors.s3.S3KeySizeSensor',
- 'airflow.providers.amazon.aws.sensors.s3.S3PrefixSensor',
- 'airflow.providers.amazon.aws.sensors.sqs.SQSSensor',
- }
-
class TestElasticsearchProviderProjectStructure(ExampleCoverageTest):
PROVIDER = "elasticsearch"
diff --git a/tests/deprecated_classes.py b/tests/deprecated_classes.py
index d64c068b77..5806c437a7 100644
--- a/tests/deprecated_classes.py
+++ b/tests/deprecated_classes.py
@@ -127,14 +127,6 @@ HOOKS = [
"airflow.providers.google.cloud.hooks.bigquery.BigQueryHook",
"airflow.contrib.hooks.bigquery_hook.BigQueryHook",
),
- (
- "airflow.providers.amazon.aws.hooks.athena.AWSAthenaHook",
- "airflow.contrib.hooks.aws_athena_hook.AWSAthenaHook",
- ),
- (
- "airflow.providers.amazon.aws.hooks.datasync.AWSDataSyncHook",
- "airflow.contrib.hooks.aws_datasync_hook.AWSDataSyncHook",
- ),
(
"airflow.providers.amazon.aws.hooks.s3.S3Hook",
"airflow.hooks.S3_hook.S3Hook",
@@ -143,14 +135,6 @@ HOOKS = [
"airflow.providers.amazon.aws.hooks.sqs.SqsHook",
"airflow.contrib.hooks.aws_sqs_hook.SQSHook",
),
- (
- "airflow.providers.amazon.aws.hooks.lambda_function.AwsLambdaHook",
- "airflow.contrib.hooks.aws_lambda_hook.AwsLambdaHook",
- ),
- (
- "airflow.providers.amazon.aws.hooks.sns.AwsSnsHook",
- "airflow.contrib.hooks.aws_sns_hook.AwsSnsHook",
- ),
(
'airflow.providers.apache.pinot.hooks.pinot.PinotDbApiHook',
'airflow.contrib.hooks.pinot_hook.PinotDbApiHook',
@@ -239,10 +223,6 @@ HOOKS = [
'airflow.providers.microsoft.azure.hooks.wasb.WasbHook',
'airflow.contrib.hooks.wasb_hook.WasbHook',
),
- (
- 'airflow.providers.amazon.aws.hooks.glue_catalog.AwsGlueCatalogHook',
- 'airflow.contrib.hooks.aws_glue_catalog_hook.AwsGlueCatalogHook',
- ),
(
'airflow.providers.amazon.aws.hooks.logs.AwsLogsHook',
'airflow.contrib.hooks.aws_logs_hook.AwsLogsHook',
@@ -407,10 +387,6 @@ HOOKS = [
'airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook',
'airflow.contrib.hooks.aws_hook.AwsHook',
),
- (
- 'airflow.providers.amazon.aws.hooks.dynamodb.DynamoDBHook',
- 'airflow.contrib.hooks.aws_dynamodb_hook.AwsDynamoDBHook',
- ),
(
'airflow.providers.sftp.hooks.sftp.SFTPHook',
'airflow.contrib.hooks.sftp_hook.SFTPHook',
@@ -963,10 +939,6 @@ OPERATORS = [
"airflow.providers.google.cloud.operators.gcs.GCSCreateBucketOperator",
"airflow.contrib.operators.gcs_operator.GoogleCloudStorageCreateBucketOperator",
),
- (
- "airflow.providers.amazon.aws.operators.athena.AWSAthenaOperator",
- "airflow.contrib.operators.aws_athena_operator.AWSAthenaOperator",
- ),
(
"airflow.providers.amazon.aws.operators.batch.BatchOperator",
"airflow.contrib.operators.awsbatch_operator.AWSBatchOperator",
@@ -1035,14 +1007,6 @@ OPERATORS = [
'airflow.providers.microsoft.azure.operators.wasb_delete_blob.WasbDeleteBlobOperator',
'airflow.contrib.operators.wasb_delete_blob_operator.WasbDeleteBlobOperator',
),
- (
- 'airflow.providers.amazon.aws.operators.ecs.ECSOperator',
- 'airflow.contrib.operators.ecs_operator.ECSOperator',
- ),
- (
- 'airflow.providers.amazon.aws.operators.lambda_function.AwsLambdaInvokeFunctionOperator',
- 'airflow.providers.amazon.aws.operators.aws_lambda.AwsLambdaInvokeFunctionOperator',
- ),
(
'airflow.providers.amazon.aws.operators.sagemaker.SageMakerBaseOperator',
'airflow.contrib.operators.sagemaker_base_operator.SageMakerBaseOperator',
@@ -1454,10 +1418,6 @@ SENSORS = [
'airflow.providers.microsoft.azure.sensors.wasb.WasbPrefixSensor',
'airflow.contrib.sensors.wasb_sensor.WasbPrefixSensor',
),
- (
- 'airflow.providers.amazon.aws.sensors.glue_catalog_partition.AwsGlueCatalogPartitionSensor',
- 'airflow.contrib.sensors.aws_glue_catalog_partition_sensor.AwsGlueCatalogPartitionSensor',
- ),
(
'airflow.providers.amazon.aws.sensors.emr.EmrBaseSensor',
'airflow.contrib.sensors.emr_base_sensor.EmrBaseSensor',
@@ -1490,10 +1450,6 @@ SENSORS = [
'airflow.providers.amazon.aws.sensors.s3.S3KeySensor',
'airflow.sensors.s3_key_sensor.S3KeySensor',
),
- (
- 'airflow.providers.amazon.aws.sensors.s3.S3PrefixSensor',
- 'airflow.sensors.s3_prefix_sensor.S3PrefixSensor',
- ),
(
'airflow.sensors.bash.BashSensor',
'airflow.contrib.sensors.bash_sensor.BashSensor',
diff --git a/tests/providers/amazon/aws/hooks/test_base_aws.py b/tests/providers/amazon/aws/hooks/test_base_aws.py
index 67fdd7c186..0e9b4e47e1 100644
--- a/tests/providers/amazon/aws/hooks/test_base_aws.py
+++ b/tests/providers/amazon/aws/hooks/test_base_aws.py
@@ -220,17 +220,6 @@ class TestSessionFactory:
class TestAwsBaseHook:
- @unittest.skipIf(mock_emr is None, 'mock_emr package not present')
- @mock_emr
- def test_get_client_type_returns_a_boto3_client_of_the_requested_type(self):
- client = boto3.client('emr', region_name='us-east-1')
- if client.list_clusters()['Clusters']:
- raise ValueError('AWS not properly mocked')
- hook = AwsBaseHook(aws_conn_id='aws_default', client_type='emr')
- client_from_hook = hook.get_client_type('emr')
-
- assert client_from_hook.list_clusters()['Clusters'] == []
-
@unittest.skipIf(mock_emr is None, 'mock_emr package not present')
@mock_emr
def test_get_client_type_set_in_class_attribute(self):
@@ -242,45 +231,6 @@ class TestAwsBaseHook:
assert client_from_hook.list_clusters()['Clusters'] == []
- @unittest.skipIf(mock_emr is None, 'mock_emr package not present')
- @mock_emr
- def test_get_client_type_overwrite(self):
- client = boto3.client('emr', region_name='us-east-1')
- if client.list_clusters()['Clusters']:
- raise ValueError('AWS not properly mocked')
- hook = AwsBaseHook(aws_conn_id='aws_default', client_type='dynamodb')
- client_from_hook = hook.get_client_type(client_type='emr')
- assert client_from_hook.list_clusters()['Clusters'] == []
-
- @unittest.skipIf(mock_emr is None, 'mock_emr package not present')
- @mock_emr
- def test_get_client_type_deprecation_warning(self):
- hook = AwsBaseHook(aws_conn_id='aws_default', client_type='emr')
- warning_message = """client_type is deprecated. Set client_type from class attribute."""
- with pytest.warns(DeprecationWarning) as warnings:
- hook.get_client_type(client_type='emr')
- assert warning_message in [str(w.message) for w in warnings]
-
- @unittest.skipIf(mock_dynamodb2 is None, 'mock_dynamo2 package not present')
- @mock_dynamodb2
- def test_get_resource_type_returns_a_boto3_resource_of_the_requested_type(self):
- hook = AwsBaseHook(aws_conn_id='aws_default', resource_type='dynamodb')
- resource_from_hook = hook.get_resource_type('dynamodb')
-
- # this table needs to be created in production
- table = resource_from_hook.create_table(
- TableName='test_airflow',
- KeySchema=[
- {'AttributeName': 'id', 'KeyType': 'HASH'},
- ],
- AttributeDefinitions=[{'AttributeName': 'id', 'AttributeType': 'S'}],
- ProvisionedThroughput={'ReadCapacityUnits': 10, 'WriteCapacityUnits': 10},
- )
-
- table.meta.client.get_waiter('table_exists').wait(TableName='test_airflow')
-
- assert table.item_count == 0
-
@unittest.skipIf(mock_dynamodb2 is None, 'mock_dynamo2 package not present')
@mock_dynamodb2
def test_get_resource_type_set_in_class_attribute(self):
@@ -301,35 +251,6 @@ class TestAwsBaseHook:
assert table.item_count == 0
- @unittest.skipIf(mock_dynamodb2 is None, 'mock_dynamo2 package not present')
- @mock_dynamodb2
- def test_get_resource_type_overwrite(self):
- hook = AwsBaseHook(aws_conn_id='aws_default', resource_type='s3')
- resource_from_hook = hook.get_resource_type('dynamodb')
-
- # this table needs to be created in production
- table = resource_from_hook.create_table(
- TableName='test_airflow',
- KeySchema=[
- {'AttributeName': 'id', 'KeyType': 'HASH'},
- ],
- AttributeDefinitions=[{'AttributeName': 'id', 'AttributeType': 'S'}],
- ProvisionedThroughput={'ReadCapacityUnits': 10, 'WriteCapacityUnits': 10},
- )
-
- table.meta.client.get_waiter('table_exists').wait(TableName='test_airflow')
-
- assert table.item_count == 0
-
- @unittest.skipIf(mock_dynamodb2 is None, 'mock_dynamo2 package not present')
- @mock_dynamodb2
- def test_get_resource_deprecation_warning(self):
- hook = AwsBaseHook(aws_conn_id='aws_default', resource_type='dynamodb')
- warning_message = """resource_type is deprecated. Set resource_type from class attribute."""
- with pytest.warns(DeprecationWarning) as warnings:
- hook.get_resource_type('dynamodb')
- assert warning_message in [str(w.message) for w in warnings]
-
@unittest.skipIf(mock_dynamodb2 is None, 'mock_dynamo2 package not present')
@mock_dynamodb2
def test_get_session_returns_a_boto3_session(self):
@@ -621,7 +542,7 @@ class TestAwsBaseHook:
conn_id = "F5"
mock_connection = Connection(conn_id=conn_id, extra='{"role_arn":"' + role_arn + '"}')
mock_get_connection.return_value = mock_connection
- hook = AwsBaseHook(aws_conn_id='aws_default', client_type='airflow_test')
+ hook = AwsBaseHook(aws_conn_id='aws_default', client_type='sts')
expire_on_calls = []
@@ -646,7 +567,7 @@ class TestAwsBaseHook:
'airflow.providers.amazon.aws.hooks.base_aws.BaseSessionFactory._refresh_credentials'
) as mock_refresh:
mock_refresh.side_effect = mock_refresh_credentials
- client = hook.get_client_type('sts')
+ client = hook.get_client_type()
assert mock_refresh.call_count == 1
client.get_caller_identity()
assert mock_refresh.call_count == 1
diff --git a/tests/providers/amazon/aws/sensors/test_s3_key.py b/tests/providers/amazon/aws/sensors/test_s3_key.py
index 6dca0df4a1..ed7ec76fca 100644
--- a/tests/providers/amazon/aws/sensors/test_s3_key.py
+++ b/tests/providers/amazon/aws/sensors/test_s3_key.py
@@ -26,7 +26,7 @@ from parameterized import parameterized
from airflow.exceptions import AirflowException
from airflow.models import DAG, DagRun, TaskInstance
from airflow.models.variable import Variable
-from airflow.providers.amazon.aws.sensors.s3 import S3KeySensor, S3KeySizeSensor
+from airflow.providers.amazon.aws.sensors.s3 import S3KeySensor
from airflow.utils import timezone
@@ -198,24 +198,3 @@ class TestS3KeySensor(unittest.TestCase):
mock_head_object.return_value = {'ContentLength': 1}
assert op.poke(None) is True
-
-
-class TestS3KeySizeSensor(unittest.TestCase):
- def test_deprecation_warnings_generated(self):
- with pytest.warns(expected_warning=DeprecationWarning):
- S3KeySizeSensor(task_id='s3_key_sensor', bucket_key='s3://test_bucket/file')
-
- @parameterized.expand(
- [
- [{"ContentLength": 0}, False],
- [{"ContentLength": 10}, True],
- ]
- )
- @mock.patch('airflow.providers.amazon.aws.sensors.s3.S3Hook.head_object')
- def test_poke(self, head_object_return_value, poke_return_value, mock_head_object):
- op = S3KeySizeSensor(
- task_id='s3_key_sensor', bucket_key=['s3://test_bucket/file', 's3://test_bucket2/file2']
- )
-
- mock_head_object.return_value = head_object_return_value
- assert op.poke(None) is poke_return_value
diff --git a/tests/providers/amazon/aws/sensors/test_s3_prefix.py b/tests/providers/amazon/aws/sensors/test_s3_prefix.py
deleted file mode 100644
index b64afe4520..0000000000
--- a/tests/providers/amazon/aws/sensors/test_s3_prefix.py
+++ /dev/null
@@ -1,68 +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 unittest import mock
-from unittest.mock import call
-
-import pytest
-
-from airflow.providers.amazon.aws.sensors.s3 import S3PrefixSensor
-
-
-def test_deprecation_warnings_generated():
- with pytest.warns(expected_warning=DeprecationWarning):
- S3PrefixSensor(task_id='s3_prefix', bucket_name='bucket', prefix='prefix')
-
-
-@mock.patch('airflow.providers.amazon.aws.sensors.s3.S3Hook.head_object')
-def test_poke(mock_head_object):
- op = S3PrefixSensor(task_id='s3_prefix', bucket_name='bucket', prefix='prefix')
-
- mock_head_object.return_value = None
- assert not op.poke({})
- mock_head_object.assert_called_once_with('prefix/', 'bucket')
-
- mock_head_object.return_value = {'ContentLength': 0}
- assert op.poke({})
-
-
-@mock.patch('airflow.providers.amazon.aws.sensors.s3.S3Hook.head_object')
-def test_poke_should_check_multiple_prefixes(mock_head_object):
- op = S3PrefixSensor(task_id='s3_prefix', bucket_name='bucket', prefix=['prefix1', 'prefix2/'])
-
- mock_head_object.return_value = None
- assert not op.poke({}), "poke returns false when the prefixes do not exist"
-
- mock_head_object.assert_has_calls(
- calls=[
- call('prefix1/', 'bucket'),
- ]
- )
-
- mock_head_object.side_effect = [{'ContentLength': 0}, None]
- assert not op.poke({}), "poke returns false when only some of the prefixes exist"
-
- mock_head_object.side_effect = [{'ContentLength': 0}, {'ContentLength': 0}]
- assert op.poke({}), "poke returns true when both prefixes exist"
-
- mock_head_object.assert_has_calls(
- calls=[
- call('prefix1/', 'bucket'),
- call('prefix2/', 'bucket'),
- ]
- )
diff --git a/tests/providers/amazon/aws/transfers/test_s3_to_redshift.py b/tests/providers/amazon/aws/transfers/test_s3_to_redshift.py
index e1267626da..37b1a21801 100644
--- a/tests/providers/amazon/aws/transfers/test_s3_to_redshift.py
+++ b/tests/providers/amazon/aws/transfers/test_s3_to_redshift.py
@@ -122,58 +122,6 @@ class TestS3ToRedshiftTransfer(unittest.TestCase):
assert secret_key in copy_query
assert_equal_ignore_multiple_spaces(self, mock_run.call_args[0][0], copy_query)
- @mock.patch("airflow.providers.amazon.aws.hooks.s3.S3Hook.get_connection")
- @mock.patch("airflow.models.connection.Connection")
- @mock.patch("boto3.session.Session")
- @mock.patch("airflow.providers.amazon.aws.hooks.redshift_sql.RedshiftSQLHook.run")
- def test_deprecated_truncate(self, mock_run, mock_session, mock_connection, mock_hook):
- access_key = "aws_access_key_id"
- secret_key = "aws_secret_access_key"
- mock_session.return_value = Session(access_key, secret_key)
- mock_session.return_value.access_key = access_key
- mock_session.return_value.secret_key = secret_key
- mock_session.return_value.token = None
-
- mock_connection.return_value = Connection()
- mock_hook.return_value = Connection()
-
- schema = "schema"
- table = "table"
- s3_bucket = "bucket"
- s3_key = "key"
- copy_options = ""
-
- op = S3ToRedshiftOperator(
- schema=schema,
- table=table,
- s3_bucket=s3_bucket,
- s3_key=s3_key,
- copy_options=copy_options,
- truncate_table=True,
- redshift_conn_id="redshift_conn_id",
- aws_conn_id="aws_conn_id",
- task_id="task_id",
- dag=None,
- )
- op.execute(None)
- copy_statement = '''
- COPY schema.table
- FROM 's3://bucket/key'
- credentials
- 'aws_access_key_id=aws_access_key_id;aws_secret_access_key=aws_secret_access_key'
- ;
- '''
- delete_statement = f'DELETE FROM {schema}.{table};'
- transaction = f"""
- BEGIN;
- {delete_statement}
- {copy_statement}
- COMMIT
- """
- assert_equal_ignore_multiple_spaces(self, "\n".join(mock_run.call_args[0][0]), transaction)
-
- assert mock_run.call_count == 1
-
@mock.patch("airflow.providers.amazon.aws.hooks.s3.S3Hook.get_connection")
@mock.patch("airflow.models.connection.Connection")
@mock.patch("boto3.session.Session")