kgw7401 commented on code in PR #52981:
URL: https://github.com/apache/airflow/pull/52981#discussion_r2205964637


##########
providers/google/src/airflow/providers/google/cloud/hooks/dataproc.py:
##########
@@ -1286,55 +1288,90 @@ def __init__(
         super().__init__(gcp_conn_id=gcp_conn_id, 
impersonation_chain=impersonation_chain, **kwargs)
         self._cached_client: JobControllerAsyncClient | None = None
 
-    def get_cluster_client(self, region: str | None = None) -> 
ClusterControllerAsyncClient:
+    async def get_cluster_client(self, region: str | None = None) -> 
ClusterControllerAsyncClient:
         """Create a ClusterControllerAsyncClient."""
         client_options = None
         if region and region != "global":
             client_options = 
ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
 
+        sync_hook = await self.get_sync_hook()
         return ClusterControllerAsyncClient(
-            credentials=self.get_credentials(), client_info=CLIENT_INFO, 
client_options=client_options
+            credentials=sync_hook.get_credentials(), client_info=CLIENT_INFO, 
client_options=client_options
         )
 
-    def get_template_client(self, region: str | None = None) -> 
WorkflowTemplateServiceAsyncClient:
+    async def get_template_client(self, region: str | None = None) -> 
WorkflowTemplateServiceAsyncClient:
         """Create a WorkflowTemplateServiceAsyncClient."""
         client_options = None
         if region and region != "global":
             client_options = 
ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
 
+        sync_hook = await self.get_sync_hook()
         return WorkflowTemplateServiceAsyncClient(
-            credentials=self.get_credentials(), client_info=CLIENT_INFO, 
client_options=client_options
+            credentials=sync_hook.get_credentials(), client_info=CLIENT_INFO, 
client_options=client_options
         )
 
-    def get_job_client(self, region: str | None = None) -> 
JobControllerAsyncClient:
+    async def get_job_client(self, region: str | None = None) -> 
JobControllerAsyncClient:
         """Create a JobControllerAsyncClient."""
         if self._cached_client is None:
             client_options = None
             if region and region != "global":
                 client_options = 
ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
 
+            sync_hook = await self.get_sync_hook()
             self._cached_client = JobControllerAsyncClient(
-                credentials=self.get_credentials(),
+                credentials=sync_hook.get_credentials(),
                 client_info=CLIENT_INFO,
                 client_options=client_options,
             )
         return self._cached_client
 
-    def get_batch_client(self, region: str | None = None) -> 
BatchControllerAsyncClient:
+    async def get_batch_client(self, region: str | None = None) -> 
BatchControllerAsyncClient:
         """Create a BatchControllerAsyncClient."""
         client_options = None
         if region and region != "global":
             client_options = 
ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
 
+        sync_hook = await self.get_sync_hook()
         return BatchControllerAsyncClient(
-            credentials=self.get_credentials(), client_info=CLIENT_INFO, 
client_options=client_options
+            credentials=sync_hook.get_credentials(), client_info=CLIENT_INFO, 
client_options=client_options
         )
 
-    def get_operations_client(self, region: str) -> OperationsClient:
+    async def get_operations_client(self, region: str) -> OperationsClient:
         """Create a OperationsClient."""
-        return 
self.get_template_client(region=region).transport.operations_client
+        template_client = await self.get_template_client(region=region)
+        return template_client.transport.operations_client
+
+    async def get_cluster(
+        self,
+        region: str,
+        project_id: str,
+        cluster_name: str,

Review Comment:
   You're right. I didn't really think much about that. It could be a breaking 
change. I’ve fixed it.



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