Introduction

πŸ“˜

Required module

Required module: App engine - Cloud Functions. Check your modules at Admin > Licenses. To obtain this module, contact your IXON account manager or IXON distributor.

Cloud Functions are apps that are implemented as a Function as a Service solution, deeply integrated into IXON Cloud. 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 also allow you to store and retrieve data using a Document Store database.

Cloud Functions are developed in Python. They are run by and accessed via the Ingress, provided with 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'
    }

@FunctionContext.expose makes the function callable from IXON Cloud. Functions can't be called by default. @CbcContext.expose is deprecated since v0.0.16, but can still be used.