airflow.providers.google.cloud.hooks.functions
¶
This module contains a Google Cloud Functions Hook.
Module Contents¶
Classes¶
Hook for the Google Cloud Functions APIs. |
Attributes¶
- class airflow.providers.google.cloud.hooks.functions.CloudFunctionsHook(api_version: str, gcp_conn_id: str = 'google_cloud_default', delegate_to: Optional[str] = None, impersonation_chain: Optional[Union[str, Sequence[str]]] = None)[source]¶
Bases:
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.
- get_conn(self) googleapiclient.discovery.build [source]¶
Retrieves the connection to Cloud Functions.
- Returns
Google Cloud Function services object.
- Return type
- create_new_function(self, location: str, body: dict, project_id: str) None [source]¶
Creates a new function in Cloud Function in the location specified in the body.
- Parameters
- Returns
None
- update_function(self, name: str, body: dict, update_mask: List[str]) None [source]¶
Updates Cloud Functions according to the specified update mask.
- upload_function_zip(self, location: str, zip_path: str, project_id: str) str [source]¶
Uploads zip file with sources.
- Parameters
location (str) -- The location where the function is created.
zip_path (str) -- The path of the valid .zip file to upload.
project_id (str) -- 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.
- Returns
The upload URL that was returned by generateUploadUrl method.
- Return type
- delete_function(self, name: str) None [source]¶
Deletes the specified Cloud Function.
- Parameters
name (str) -- The name of the function.
- Returns
None
- call_function(self, function_id: str, input_data: Dict, location: str, project_id: str = PROVIDE_PROJECT_ID) dict [source]¶
Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed.
- Parameters
function_id (str) -- ID of the function to be called
input_data (Dict) -- Input to be passed to the function
location (str) -- The location where the function is located.
project_id (str) -- 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.
- Returns
None