jroachgolf84 commented on code in PR #68527:
URL: https://github.com/apache/airflow/pull/68527#discussion_r3410064879
##########
providers/databricks/src/airflow/providers/databricks/hooks/databricks_base.py:
##########
@@ -233,6 +238,47 @@ def _get_connection_attr(self, attr_name: str) -> str:
raise ValueError(f"`{attr_name}` must be present in Connection")
return attr
+ @cached_property
+ def proxies(self) -> dict[str, str] | None:
+ """Return validated proxy configuration from connection extras."""
+ extra_dejson = self.databricks_conn.extra_dejson
Review Comment:
If not a dictionary, what type would this take?
##########
providers/databricks/src/airflow/providers/databricks/hooks/databricks_base.py:
##########
@@ -445,7 +495,9 @@ def _get_aad_token_for_default_az_credential(self,
resource: str) -> str:
#
# While there is a WorkloadIdentityCredential class, the
below class is advised by Microsoft
#
https://learn.microsoft.com/en-us/azure/aks/workload-identity-overview
- token =
DefaultAzureCredential().get_token(f"{resource}/.default")
+ token =
DefaultAzureCredential(**self._get_azure_credential_kwargs()).get_token(
Review Comment:
Have you validated that these args can be passed to `DefaultAzureCredential`?
##########
providers/databricks/src/airflow/providers/databricks/hooks/databricks_base.py:
##########
@@ -233,6 +238,47 @@ def _get_connection_attr(self, attr_name: str) -> str:
raise ValueError(f"`{attr_name}` must be present in Connection")
return attr
+ @cached_property
+ def proxies(self) -> dict[str, str] | None:
+ """Return validated proxy configuration from connection extras."""
+ extra_dejson = self.databricks_conn.extra_dejson
+ if not isinstance(extra_dejson, dict):
+ return None
+
+ proxies = extra_dejson.get("proxies")
+ if proxies is None:
+ return None
+ if not isinstance(proxies, dict):
+ raise DatabricksProxyConfigurationError("Connection extra
'proxies' must be a JSON object.")
+
+ invalid_keys = set(proxies) - {"http", "https"}
+ if invalid_keys:
+ invalid_keys_str = ", ".join(sorted(invalid_keys))
+ raise DatabricksProxyConfigurationError(
+ f"Connection extra 'proxies' only supports 'http' and 'https'
keys. Got: {invalid_keys_str}."
+ )
+
+ for proxy_scheme, proxy_url in proxies.items():
Review Comment:
Would it be an issue if both `http` and `https` were in `proxies`?
--
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]