blob: f0d1bc509eb656392fcd2cea546a21c3b579ad65 [file] [log] [blame]
:py:mod:`airflow.providers.google.cloud.hooks.functions`
========================================================
.. py:module:: airflow.providers.google.cloud.hooks.functions
.. autoapi-nested-parse::
This module contains a Google Cloud Functions Hook.
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.google.cloud.hooks.functions.CloudFunctionsHook
Attributes
~~~~~~~~~~
.. autoapisummary::
airflow.providers.google.cloud.hooks.functions.TIME_TO_SLEEP_IN_SECONDS
.. py:data:: TIME_TO_SLEEP_IN_SECONDS
:annotation: = 1
.. py:class:: CloudFunctionsHook(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`
Hook for the Google Cloud Functions APIs.
All the methods in the hook where project_id is used must be called with
keyword arguments rather than positional.
.. py:method:: get_conn(self)
Retrieves the connection to Cloud Functions.
:return: Google Cloud Function services object.
:rtype: dict
.. py:method:: get_function(self, name)
Returns the Cloud Function with the given name.
:param name: Name of the function.
:return: A Cloud Functions object representing the function.
:rtype: dict
.. py:method:: create_new_function(self, location, body, project_id)
Creates a new function in Cloud Function in the location specified in the body.
:param location: The location of the function.
:param body: The body required by the Cloud Functions insert API.
: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 Google Cloud connection is used.
:return: None
.. py:method:: update_function(self, name, body, update_mask)
Updates Cloud Functions according to the specified update mask.
:param name: The name of the function.
:param body: The body required by the cloud function patch API.
:param update_mask: The update mask - array of fields that should be patched.
:return: None
.. py:method:: upload_function_zip(self, location, zip_path, project_id)
Uploads zip file with sources.
:param location: The location where the function is created.
:param zip_path: The path of the valid .zip file to upload.
: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 Google Cloud connection is used.
:return: The upload URL that was returned by generateUploadUrl method.
:rtype: str
.. py:method:: delete_function(self, name)
Deletes the specified Cloud Function.
:param name: The name of the function.
:return: None
.. py:method:: call_function(self, function_id, input_data, location, project_id = PROVIDE_PROJECT_ID)
Synchronously invokes a deployed Cloud Function. To be used for testing
purposes as very limited traffic is allowed.
:param function_id: ID of the function to be called
:param input_data: Input to be passed to the function
:param location: The location where the function is located.
: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 Google Cloud connection is used.
:return: None