Skip to content

Commit

Permalink
Restore delegate_to param in GoogleDiscoveryApiHook (#35728)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
austinletson committed Nov 18, 2023
1 parent 50d5fe4 commit f30d5b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions airflow/providers/google/common/hooks/discovery_api.py
Expand Up @@ -53,10 +53,12 @@ def __init__(
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
Expand Down
2 changes: 1 addition & 1 deletion docs/apache-airflow-providers-google/connections/gcp.rst
Expand Up @@ -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.
Expand Down

0 comments on commit f30d5b8

Please sign in to comment.