Let us begin with understanding of Google Cloud Function plugin and how it benefits our workload automation users.
“GCP is a plugin that helps you to invoke GCP Cloud Functions in a synchronous way and also monitor the job”.
GCP requires no servers to provision, manage, or upgrade. It automatically scales up based on the load. It has Integrated monitoring, logging, and debugging capability. It has built-in security at role and per function level based on the principle of least privilege. It also has the networking capabilities for hybrid and multi-cloud scenarios.
GCP Cloud Functions
The GCP Cloud Function includes the following features:
Plugin Use Case / Functionalities
Invoke - Invoke GCP Cloud Functions in a synchronous way.
Monitor - Get function output state: retrieve function output object if it is executed successfully or catch errors if the execution failed.
Figure 2 GCP Cloud Function Console
Figure 3 GCP Cloud Function Console
Installation & Prerequisite
Must have access to:
Let us begin with our plugin part with job definition parameters
GCP Cloud Function Plugin
Log in to the Dynamic Workload Console and open the Workload Designer. Choose to create a new job and select “GCP Cloud Function Plugin” job type in the Cloud section.
Figure 4 Job Definition
Establishing connection to the GCP Cloud.
Use this section to connect to Google Cloud.
GCP Default Credentials - Select this option if you want system to fetch default credentials from system configuration.
Note: Environment variable has to be configured for default access GOOGLE_APPLICATION_CREDENTIALS.
GCP Server Credentials - Select this option to enter the GCP credentials manually.
Service Account - The service account associated to your GCP Cloud Function account. Click the Select button to choose the service account in the cloud console. Select an item from the list, the selected item is displayed in the Service Account field.
Note: This attribute is required. The service account is the identity of the service, and the service account's permissions control which resources the service can access.
Project ID - The project ID is a unique number associated with each project. It is mandatory and unique for each service account.
Test Connection - Click to verify if the connection to the Google Cloud works correctly.
Figure 5 connection tab
GCP Default Credentials
If the previous steps do not find valid credentials, ADC will fail, and an error occurs.
Figure 6 Connection Tab
Use this section to define invocation options for GCP cloud function.
Region where GCP function is located (for example us-east-2).
Click the Select button to specify the name of the GCP cloud function to be invoked. The selected name appears in the Function Name field.
Function Input Event
Input From File
Select this option if GCP cloud function input event is stored inside a file (for example: text, json).
This field is available only if the Input from File has been checked. Provide here the absolute path to the file which contains the event payload. Event payload must be a valid JSON.
Select this option to provide the GCP cloud function input event manually.
This field is available only if the Manual Input has been checked. Provide here the json to send as function input while invoking GCP cloud function.
Save Function Output to File
Select the check box to save the function output.
Output File Path
Provide the location to save the function output files.
Figure 7 Action Tab
Figure 8 Action tab – Application List
Figure 9- Action tab – File Path
Submitting your job
It is time to Submit your job into the current plan. You can add your job to the job stream that automates your business process flow. Select the action menu in the top-left corner of the job definition panel and click on Submit Job into Current Plan. A confirmation message is displayed, and you can switch to the Monitoring view to see what is going on.
Figure 10 Job Log
Figure 11 Monitor Job