Introduction
Required moduleRequired module: App engine - Cloud Functions. Check your modules at Admin > Licenses. To obtain this module, contact your IXON account manager or IXON distributor.
Definition
Despite the word function being in their name, Cloud Functions are actually applications that contain one or more functions which provide specific functionalities that, being deeply integrated into IXON Cloud, fulfill the user's specific needs and requests. In short, it consists of the backend side of a specific app, which will then be visualized via a UI Component. A classic example of this that you can look at is the Service Logbook.
Characteristics of Cloud Functions
Being different compared to UI Components, it is worth pointing out some of the attributes that Cloud Functions possess.
Security
Cloud Functions provide a way to do custom processing without doing it on the end user's device: one reason for this is security. You may want to call an external service in a UI Component, but you don't want the end user to have access to the secure tokens needed to access it. Cloud Functions provide a safe solution for such concerns by placing an additional security level between the end user's device and sensitive data.
Data Storage
Cloud Functions also allow you to store and retrieve data using the Document Store , which consists of a MongoDB collection unique to only one Cloud Function. As mentioned in the Document Store's documentation page, a MongoDB collection is also provided when developed locally.
Customization and development
Cloud Functions are developed in Python. They are run by and accessed via the Ingress, provided via the ixoncdkingress
Python package: the ingress handles communication between your Cloud Function and the IXON Cloud, providing functionality via a Context
object.
In its most basic form, a Cloud Function consists of one Python file with a function. The first parameter is the Context, the second and subsequent parameters are up to the developer, these are set when calling the Cloud Function from a UI Component.
Below is a code example of a Hello World Cloud Function:
from ixoncdkingress.function.context import FunctionContext
@FunctionContext.expose
def hello_world(context: FunctionContext, **kwargs: dict[str, str]):
return {
'message': 'Hello World'
}
For security reasons, only functions explicitly annotated with @FunctionContext.expose
are callable from IXON Cloud.
Updated 11 days ago