From 44a27b6c8650f164e84a846a8c80d620af50579d Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Thu, 11 Jan 2024 19:12:49 +0800 Subject: [PATCH] feat(amazon): add deprecation warning to redshift_cluster triggerers and hooks --- .../providers/amazon/aws/hooks/redshift_cluster.py | 6 ++++++ .../amazon/aws/operators/redshift_cluster.py | 2 +- .../providers/amazon/aws/triggers/redshift_cluster.py | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/astronomer/providers/amazon/aws/hooks/redshift_cluster.py b/astronomer/providers/amazon/aws/hooks/redshift_cluster.py index 635612b49..3488db4dc 100644 --- a/astronomer/providers/amazon/aws/hooks/redshift_cluster.py +++ b/astronomer/providers/amazon/aws/hooks/redshift_cluster.py @@ -1,4 +1,5 @@ import asyncio +import warnings from typing import Any, Dict, Optional import botocore.exceptions @@ -10,6 +11,11 @@ class RedshiftHookAsync(AwsBaseHookAsync): """Interact with AWS Redshift using aiobotocore python library""" def __init__(self, *args: Any, **kwargs: Any) -> None: + warnings.warn( + "This module is deprecated and will be removed in 2.0.0.", + DeprecationWarning, + stacklevel=2, + ) kwargs["client_type"] = "redshift" kwargs["resource_type"] = "redshift" super().__init__(*args, **kwargs) diff --git a/astronomer/providers/amazon/aws/operators/redshift_cluster.py b/astronomer/providers/amazon/aws/operators/redshift_cluster.py index a22e56ec6..a7340db61 100644 --- a/astronomer/providers/amazon/aws/operators/redshift_cluster.py +++ b/astronomer/providers/amazon/aws/operators/redshift_cluster.py @@ -50,7 +50,7 @@ class RedshiftPauseClusterOperatorAsync(RedshiftPauseClusterOperator): This class is deprecated. Please use :class: `~airflow.providers.amazon.aws.operators.redshift_cluster.RedshiftPauseClusterOperator`. """ - + def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] warnings.warn( ( diff --git a/astronomer/providers/amazon/aws/triggers/redshift_cluster.py b/astronomer/providers/amazon/aws/triggers/redshift_cluster.py index e3a724a29..110736eb3 100644 --- a/astronomer/providers/amazon/aws/triggers/redshift_cluster.py +++ b/astronomer/providers/amazon/aws/triggers/redshift_cluster.py @@ -1,4 +1,5 @@ import asyncio +import warnings from typing import Any, AsyncIterator, Dict, Optional, Tuple from airflow.triggers.base import BaseTrigger, TriggerEvent @@ -30,6 +31,11 @@ def __init__( skip_final_cluster_snapshot: bool = True, final_cluster_snapshot_identifier: Optional[str] = None, ): + warnings.warn( + "This module is deprecated and will be removed in 2.0.0.", + DeprecationWarning, + stacklevel=2, + ) super().__init__() self.task_id = task_id self.polling_period_seconds = polling_period_seconds @@ -118,6 +124,11 @@ def __init__( target_status: str, poke_interval: float, ): + warnings.warn( + "This module is deprecated and will be removed in 2.0.0.", + DeprecationWarning, + stacklevel=2, + ) super().__init__() self.task_id = task_id self.aws_conn_id = aws_conn_id