You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/11/23 18:19:16 UTC

[GitHub] [airflow] eladkal commented on a change in pull request #19725: Adjust built-in base_aws methods to avoid Deprecation warnings

eladkal commented on a change in pull request #19725:
URL: https://github.com/apache/airflow/pull/19725#discussion_r755395265



##########
File path: airflow/providers/postgres/hooks/postgres.py
##########
@@ -184,7 +184,8 @@ def get_iam_token(self, conn: Connection) -> Tuple[str, str, int]:
             # Pull the custer-identifier from the beginning of the Redshift URL
             # ex. my-cluster.ccdre4hpd39h.us-east-1.redshift.amazonaws.com returns my-cluster
             cluster_identifier = conn.extra_dejson.get('cluster-identifier', conn.host.split('.')[0])
-            client = aws_hook.get_client_type('redshift')
+            session, endpoint_url = aws_hook._get_credentials()
+            client = session.client('redshift', endpoint_url=endpoint_url, config=aws_hook.config, verify=aws_hook.verify)

Review comment:
       Is this the right fix? I thought the issue is only when using `get_client_type('iam')` ?
   Shouldn't we set the `client_type` on the hook and then use `aws_hook.get_client_type(client_type='redshift')` ?

##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -173,7 +173,8 @@ def get_bucket(self, bucket_name: Optional[str] = None) -> str:
         :return: the bucket object to the bucket name.
         :rtype: boto3.S3.Bucket
         """
-        s3_resource = self.get_resource_type('s3')
+        session, endpoint_url = self._get_credentials()
+        s3_resource = session.client('s3', endpoint_url=endpoint_url, config=self.config, verify=self.verify)

Review comment:
       Same question as the comment on redshift in PostgresHook




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org