phanikumv commented on code in PR #24682:
URL: https://github.com/apache/airflow/pull/24682#discussion_r908299435
##########
airflow/providers/google/common/hooks/base_google.py:
##########
@@ -580,3 +580,16 @@ def download_content_from_request(file_handle, request:
dict, chunk_size: int) -
while done is False:
_, done = downloader.next_chunk()
file_handle.flush()
+
+ def test_connection(self):
+ """Test the Google cloud connectivity from UI"""
+ status, message = False, ''
+ try:
+ if self.project_id:
Review Comment:
Based on provided key JSON , it will connect to GCP oauth module and derive
project_id
```
def _get_credentials_using_keyfile_dict(self):
self._log_debug('Getting connection using JSON Dict')
# Depending on how the JSON was formatted, it may contain
# escaped newlines. Convert those to actual newlines.
self.keyfile_dict['private_key'] =
self.keyfile_dict['private_key'].replace('\\n', '\n')
credentials =
google.oauth2.service_account.Credentials.from_service_account_info(
self.keyfile_dict, scopes=self.scopes
)
project_id = credentials.project_id
return credentials, project_id
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]