o-nikolas commented on code in PR #34784:
URL: https://github.com/apache/airflow/pull/34784#discussion_r1353234785


##########
airflow/providers/amazon/aws/operators/base_aws.py:
##########
@@ -0,0 +1,150 @@
+# 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
+
+import warnings
+from functools import cached_property
+from typing import Any, Generic, Sequence, TypeVar
+
+from typing_extensions import final
+
+from airflow.exceptions import AirflowException, 
AirflowProviderDeprecationWarning
+from airflow.models import BaseOperator
+from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
+
+_AwsHook = TypeVar("_AwsHook", bound=AwsGenericHook)
+_REGION_MSG = "`region` is deprecated and will be removed in the future. 
Please use `region_name` instead."
+
+
+class AwsBaseOperator(BaseOperator, Generic[_AwsHook]):
+    """Base AWS (Amazon) Operator Class for build operators in top of AWS 
Hooks.
+
+    Examples:
+     .. code-block:: python
+
+        from airflow.providers.amazon.aws.hooks.foo_bar import FooBarThinHook, 
FooBarThickHook
+
+
+        class AwsFooBarOperator(AwsBaseOperator[FooBarThinHook]):
+            aws_hook_class = FooBarThinHook
+
+            def execute(self, context):
+                pass
+
+
+        class AwsFooBarOperator2(AwsBaseOperator[FooBarThickHook]):
+            aws_hook_class = FooBarThickHook
+
+            def __init__(self, *, spam: str, **kwargs):
+                super().__init__(**kwargs)
+                self.spam = spam
+
+            @property
+            def _hook_parameters(self):
+                return {**super()._hook_parameters, "spam": self.spam}
+
+            def execute(self, context):
+                pass
+
+    :param aws_conn_id: The Airflow connection used for AWS credentials.
+        If this is None or empty then the default boto3 behaviour is used. If
+        running Airflow in a distributed manner and aws_conn_id is None or
+        empty, then default boto3 configuration would be used (and must be
+        maintained on each worker node).

Review Comment:
   Using the default AWS Connection id `aws_default` (as long as it is created 
and remains untouched by the user) also uses the default boto3 behaviour. Might 
be worth mentioning.



##########
airflow/providers/amazon/aws/operators/base_aws.py:
##########
@@ -0,0 +1,97 @@
+# 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 typing import Sequence
+
+from airflow.models import BaseOperator
+from airflow.providers.amazon.aws.utils.mixins import AwsBaseHookMixin, 
AwsHookParams, AwsHookType
+
+
+class AwsBaseOperator(BaseOperator, AwsBaseHookMixin[AwsHookType]):
+    """
+    Base AWS (Amazon) Operator Class to build operators on top of AWS Hooks.
+
+    .. warning::
+        Only for internal usage, this class might be changed, renamed or 
removed in the future
+        without any further notice.

Review Comment:
   Regarding this, should we change the class name to `_AwsBaseOperator`?
   
   Same for the Sensor and mixin classes



##########
airflow/providers/amazon/aws/utils/mixins.py:
##########
@@ -0,0 +1,165 @@
+# 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 contains different internal mixin classes for internal of Amazon 
Provider.

Review Comment:
   ```suggestion
   This module contains different mixin classes for internal use within the 
Amazon provider.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to