This is an automated email from the ASF dual-hosted git repository.

taragolis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new f30d5b8ec1 Restore delegate_to param in GoogleDiscoveryApiHook (#35728)
f30d5b8ec1 is described below

commit f30d5b8ec1fd839592bafb2abd4218fdea959c42
Author: Austin Letson <[email protected]>
AuthorDate: Sat Nov 18 15:20:29 2023 -0500

    Restore delegate_to param in GoogleDiscoveryApiHook (#35728)
    
    Restore delegate_to param to GoogleDiscoveryApiHook to allow to
    specification of a service account for domain-wide delegation when using
    GoogleDiscoveryApiHook to access Google APIs which support domain-wide
    delegation but do not have a dedicated hook (such as Workspaces Admin
    API).
    
    Note that based on the discussion in #9461, the delegate_to param was
    deprecated in #29088 (and removed in #30748) from many hooks
    including GoogleDiscoveryApiHook. However, the delegate_to param was
    not removed from the docstring for the GoogleDiscoveryApiHook
    constructor.
    
    Update GCP connection docs to reflect delegate_to param in
    GoogleDiscoveryApiHook usage only when using Google APIs that support
    domain-wide delegation.
---
 airflow/providers/google/common/hooks/discovery_api.py   | 2 ++
 docs/apache-airflow-providers-google/connections/gcp.rst | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/airflow/providers/google/common/hooks/discovery_api.py 
b/airflow/providers/google/common/hooks/discovery_api.py
index da0b9f9ce4..37e2d86581 100644
--- a/airflow/providers/google/common/hooks/discovery_api.py
+++ b/airflow/providers/google/common/hooks/discovery_api.py
@@ -53,10 +53,12 @@ class GoogleDiscoveryApiHook(GoogleBaseHook):
         api_service_name: str,
         api_version: str,
         gcp_conn_id: str = "google_cloud_default",
+        delegate_to: str | None = None,
         impersonation_chain: str | Sequence[str] | None = None,
     ) -> None:
         super().__init__(
             gcp_conn_id=gcp_conn_id,
+            delegate_to=delegate_to,
             impersonation_chain=impersonation_chain,
         )
         self.api_service_name = api_service_name
diff --git a/docs/apache-airflow-providers-google/connections/gcp.rst 
b/docs/apache-airflow-providers-google/connections/gcp.rst
index 83bab9ca90..79422fb2f0 100644
--- a/docs/apache-airflow-providers-google/connections/gcp.rst
+++ b/docs/apache-airflow-providers-google/connections/gcp.rst
@@ -307,7 +307,7 @@ For example:
             
delegate_to=f"projects/-/serviceAccounts/SA@{PROJECT_ID}.iam.gserviceaccount.com",
         )
 
-Note that as domain-wide delegation is currently supported by most of the 
Google operators and hooks, its usage should be limited only to Google 
Workspace (gsuite) and marketing platform operators and hooks. It is deprecated 
in the following usages:
+Note that as domain-wide delegation is currently supported by most of the 
Google operators and hooks, its usage should be limited only to Google 
Workspace (gsuite) and marketing platform operators and hooks or by accessing 
these services through the GoogleDiscoveryAPI hook. It is deprecated in the 
following usages:
 
 * All of Google Cloud operators and hooks.
 * Firebase hooks.

Reply via email to