| :py:mod:`airflow.providers.google.cloud.utils.credentials_provider` |
| =================================================================== |
| |
| .. py:module:: airflow.providers.google.cloud.utils.credentials_provider |
| |
| .. autoapi-nested-parse:: |
| |
| This module contains a mechanism for providing temporary |
| Google Cloud authentication. |
| |
| |
| |
| Module Contents |
| --------------- |
| |
| |
| Functions |
| ~~~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.google.cloud.utils.credentials_provider.build_gcp_conn |
| airflow.providers.google.cloud.utils.credentials_provider.provide_gcp_credentials |
| airflow.providers.google.cloud.utils.credentials_provider.provide_gcp_connection |
| airflow.providers.google.cloud.utils.credentials_provider.provide_gcp_conn_and_credentials |
| airflow.providers.google.cloud.utils.credentials_provider.get_credentials_and_project_id |
| |
| |
| |
| Attributes |
| ~~~~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.google.cloud.utils.credentials_provider.log |
| airflow.providers.google.cloud.utils.credentials_provider.AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT |
| |
| |
| .. py:data:: log |
| |
| |
| |
| |
| .. py:data:: AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT |
| :annotation: = AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT |
| |
| |
| |
| .. py:function:: build_gcp_conn(key_file_path = None, scopes = None, project_id = None) |
| |
| Builds a uri that can be used as :envvar:`AIRFLOW_CONN_{CONN_ID}` with provided service key, |
| scopes and project id. |
| |
| :param key_file_path: Path to service key. |
| :param scopes: Required OAuth scopes. |
| :param project_id: The Google Cloud project id to be used for the connection. |
| :return: String representing Airflow connection. |
| |
| |
| .. py:function:: provide_gcp_credentials(key_file_path = None, key_file_dict = None) |
| |
| Context manager that provides a Google Cloud credentials for application supporting |
| `Application Default Credentials (ADC) strategy`__. |
| |
| It can be used to provide credentials for external programs (e.g. gcloud) that expect authorization |
| file in ``GOOGLE_APPLICATION_CREDENTIALS`` environment variable. |
| |
| :param key_file_path: Path to file with Google Cloud Service Account .json file. |
| :param key_file_dict: Dictionary with credentials. |
| |
| __ https://cloud.google.com/docs/authentication/production |
| |
| |
| .. py:function:: provide_gcp_connection(key_file_path = None, scopes = None, project_id = None) |
| |
| Context manager that provides a temporary value of :envvar:`AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT` |
| connection. It build a new connection that includes path to provided service json, |
| required scopes and project id. |
| |
| :param key_file_path: Path to file with Google Cloud Service Account .json file. |
| :param scopes: OAuth scopes for the connection |
| :param project_id: The id of Google Cloud project for the connection. |
| |
| |
| .. py:function:: provide_gcp_conn_and_credentials(key_file_path = None, scopes = None, project_id = None) |
| |
| Context manager that provides both: |
| |
| - Google Cloud credentials for application supporting `Application Default Credentials (ADC) |
| strategy`__. |
| - temporary value of :envvar:`AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT` connection |
| |
| :param key_file_path: Path to file with Google Cloud Service Account .json file. |
| :param scopes: OAuth scopes for the connection |
| :param project_id: The id of Google Cloud project for the connection. |
| |
| __ https://cloud.google.com/docs/authentication/production |
| |
| |
| .. py:function:: get_credentials_and_project_id(*args, **kwargs) |
| |
| Returns the Credentials object for Google API and the associated project_id. |
| |
| |