blob: 89eea5c5c22ba56712aaf0e60ac17b8209205d97 [file] [log] [blame]
:mod:`airflow.contrib.hooks.gcp_cloud_build_hook`
=================================================
.. py:module:: airflow.contrib.hooks.gcp_cloud_build_hook
.. autoapi-nested-parse::
Hook for Google Cloud Build service
Module Contents
---------------
.. data:: TIME_TO_SLEEP_IN_SECONDS
:annotation: = 5
.. py:class:: CloudBuildHook(api_version='v1', gcp_conn_id='google_cloud_default', delegate_to=None)
Bases: :class:`airflow.contrib.hooks.gcp_api_base_hook.GoogleCloudBaseHook`
Hook for the Google Cloud Build APIs.
All the methods in the hook where project_id is used must be called with
keyword arguments rather than positional.
:param api_version: API version used (for example v1 or v1beta1).
:type api_version: str
:param gcp_conn_id: The connection ID to use when fetching connection info.
:type gcp_conn_id: str
:param delegate_to: The account to impersonate, if any.
For this to work, the service account making the request must have
domain-wide delegation enabled.
:type delegate_to: str
.. attribute:: _conn
.. method:: get_conn(self)
Retrieves the connection to Cloud Functions.
:return: Google Cloud Build services object.
.. method:: create_build(self, body, project_id=None)
Starts a build with the specified configuration.
:param body: The request body.
See: https://cloud.google.com/cloud-build/docs/api/reference/rest/Shared.Types/Build
:type body: dict
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:type project_id: str
:return: None
.. method:: _wait_for_operation_to_complete(self, operation_name)
Waits for the named operation to complete - checks status of the
asynchronous call.
:param operation_name: The name of the operation.
:type operation_name: str
:return: The response returned by the operation.
:rtype: dict
:exception: AirflowException in case error is returned.