Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize AWS Kinesis/Firehose naming #20362

Merged
merged 1 commit into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion airflow/providers/amazon/aws/hooks/kinesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
# 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


class AwsFirehoseHook(AwsBaseHook):
class FirehoseHook(AwsBaseHook):
"""
Interact with AWS Kinesis Firehose.

Expand All @@ -46,3 +47,19 @@ def put_records(self, records: Iterable):
response = self.get_conn().put_record_batch(DeliveryStreamName=self.delivery_stream, Records=records)

return response


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)
8 changes: 4 additions & 4 deletions tests/providers/amazon/aws/hooks/test_kinesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import boto3
import pytest

from airflow.providers.amazon.aws.hooks.kinesis import AwsFirehoseHook
from airflow.providers.amazon.aws.hooks.kinesis import FirehoseHook

try:
from moto import mock_firehose, mock_s3
Expand All @@ -30,10 +30,10 @@


@pytest.mark.skipif(mock_firehose is None, reason='moto package not present')
class TestAwsFirehoseHook:
class TestFirehoseHook:
@mock_firehose
def test_get_conn_returns_a_boto3_connection(self):
hook = AwsFirehoseHook(
hook = FirehoseHook(
aws_conn_id='aws_default', delivery_stream="test_airflow", region_name="us-east-1"
)
assert hook.get_conn() is not None
Expand All @@ -42,7 +42,7 @@ def test_get_conn_returns_a_boto3_connection(self):
@mock_s3
def test_insert_batch_records_kinesis_firehose(self):
boto3.client('s3').create_bucket(Bucket='kinesis-test')
hook = AwsFirehoseHook(
hook = FirehoseHook(
aws_conn_id='aws_default', delivery_stream="test_airflow", region_name="us-east-1"
)

Expand Down