Lee-W commented on code in PR #36341:
URL: https://github.com/apache/airflow/pull/36341#discussion_r1435458749


##########
airflow/providers/google/cloud/hooks/bigquery.py:
##########
@@ -3247,6 +3251,35 @@ def _format_schema_for_description(schema: dict) -> list:
     return description
 
 
+class ImpersonationToken:
+    """Simulate the interface of gcloud.aio.auth.token.BaseToken and generate 
impersonation_chain access_token"""
+
+    def __init__(self, project_id: str | None, impersonation_account: str) -> 
None:
+        self.project_id = project_id
+        self.impersonation_account = impersonation_account
+
+    async def get_project(self) -> str | None:
+        project = (
+            self.project_id
+            or os.environ.get("GOOGLE_CLOUD_PROJECT")
+            or os.environ.get("GCLOUD_PROJECT")
+            or os.environ.get("APPLICATION_ID")
+        )
+        return project
+
+    async def get(self) -> str | None:
+        creds, _ = google.auth.default()
+
+        impersonated_creds = impersonated_credentials.Credentials(
+            source_credentials=creds,
+            target_principal=self.impersonation_account,

Review Comment:
   Thanks for reminding me! just addressed



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to