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 2022/12/23 23:26:58 UTC

[GitHub] [airflow] confusedpublic commented on a diff in pull request #28545: Fix Provider Amazon Test Connection when using custom endpoint url

confusedpublic commented on code in PR #28545:
URL: https://github.com/apache/airflow/pull/28545#discussion_r1056686843


##########
airflow/providers/amazon/aws/hooks/base_aws.py:
##########
@@ -754,7 +754,9 @@ def test_connection(self):
         """
         try:
             session = self.get_session()
-            conn_info = session.client("sts").get_caller_identity()
+            conn_info = session.client(
+                "sts", endpoint_url=self.conn_config.endpoint_url
+            ).get_caller_identity()

Review Comment:
   So you think we need to implement something like the following on the connection extra details..
   
   ```json
   {
       "service_endpoints": {
           "s3": "https://s3.eu-west-2.amazonaws.com",
           "emr": "https://elasticmapreduce.eu-west-1.amazonaws.com"
       },
       "endpoint_url": "http://localstack:4566"
   }
   ```
   
   where the connection should do something like the following... (very pseudo code):
   
   ```python
   
   def get_client(client_type):
       
       service_endpoint = self.extra.service_endpoints.get("client_type", self.endpoint_url)
       return self.client(client_type, endpoint_url=service_endpoint
   ```
   
   where we first attempt to get a service level endpoint url, falling back to a custom/overall endpoint url, which can default to `None` if not set, therefore allowing the default AWS endpoint url to be used?



-- 
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