blob: 0a623b5e58989045e4a6a28b91a67b0e34d71437 [file] [log] [blame]
:py:mod:`airflow.providers.google.common.hooks.discovery_api`
=============================================================
.. py:module:: airflow.providers.google.common.hooks.discovery_api
.. autoapi-nested-parse::
This module allows you to connect to the Google Discovery API Service and query it.
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.google.common.hooks.discovery_api.GoogleDiscoveryApiHook
.. py:class:: GoogleDiscoveryApiHook(api_service_name, api_version, gcp_conn_id = 'google_cloud_default', delegate_to = None, impersonation_chain = None)
Bases: :py:obj:`airflow.providers.google.common.hooks.base_google.GoogleBaseHook`
A hook to use the Google API Discovery Service.
:param api_service_name: The name of the api service that is needed to get the data
for example 'youtube'.
:param api_version: The version of the api that will be requested for example 'v3'.
:param gcp_conn_id: The connection ID to use when fetching connection info.
:param delegate_to: The account to impersonate using domain-wide delegation of authority,
if any. For this to work, the service account making the request must have
domain-wide delegation enabled.
:param impersonation_chain: Optional service account to impersonate using short-term
credentials, or chained list of accounts required to get the access_token
of the last account in the list, which will be impersonated in the request.
If set as a string, the account must grant the originating account
the Service Account Token Creator IAM role.
If set as a sequence, the identities from the list must grant
Service Account Token Creator IAM role to the directly preceding identity, with first
account from the list granting this role to the originating account.
.. py:method:: get_conn()
Creates an authenticated api client for the given api service name and credentials.
:return: the authenticated api service.
:rtype: Resource
.. py:method:: query(endpoint, data, paginate = False, num_retries = 0)
Creates a dynamic API call to any Google API registered in Google's API Client Library
and queries it.
:param endpoint: The client libraries path to the api call's executing method.
For example: 'analyticsreporting.reports.batchGet'
.. seealso:: https://developers.google.com/apis-explorer
for more information on what methods are available.
:param data: The data (endpoint params) needed for the specific request to given endpoint.
:param paginate: If set to True, it will collect all pages of data.
:param num_retries: Define the number of retries for the requests being made if it fails.
:return: the API response from the passed endpoint.
:rtype: dict