turbaszek commented on a change in pull request #18184:
URL: https://github.com/apache/airflow/pull/18184#discussion_r706774942
##########
File path: airflow/providers/google/cloud/hooks/cloud_build.py
##########
@@ -55,95 +52,564 @@ class CloudBuildHook(GoogleBaseHook):
:type impersonation_chain: Union[str, Sequence[str]]
"""
- _conn = None # type: Optional[Any]
-
def __init__(
self,
- api_version: str = "v1",
gcp_conn_id: str = "google_cloud_default",
delegate_to: Optional[str] = None,
impersonation_chain: Optional[Union[str, Sequence[str]]] = None,
) -> None:
super().__init__(
- gcp_conn_id=gcp_conn_id,
- delegate_to=delegate_to,
- impersonation_chain=impersonation_chain,
+ gcp_conn_id=gcp_conn_id, delegate_to=delegate_to,
impersonation_chain=impersonation_chain
)
+ self._client: Optional[CloudBuildClient] = None
- self.api_version = api_version
+ def get_conn(self) -> CloudBuildClient:
+ """
+ Retrieves the connection to Google Cloud Build.
- def get_conn(self) -> build:
+ :return: Google Cloud Build client object.
+ :rtype: `google.cloud.devtools.cloudbuild_v1.CloudBuildClient`
"""
- Retrieves the connection to Cloud Build.
+ if not self._client:
+ self._client =
CloudBuildClient(credentials=self._get_credentials(),
client_info=self.client_info)
+ return self._client
+
+ @GoogleBaseHook.fallback_to_default_project_id
+ def cancel_build(
+ self,
+ id: str,
Review comment:
`id` is Python [built-in
function](https://docs.python.org/3/library/functions.html#id). Should we using
something like `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]