Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejson
{
  "status": "ok",
  "statusCode": 200,
  "valueType": "string",
  "value": "Hello World: Max"
  ...
}
  • status - Can be one of ok or error

  • statusCode - Is compatible with the HTTP status codes. For example 200 is OK and 500 would mean an internal error.

  • statusMessage - Is an optional field and contains information about the status. For example a short hint in case of an error.

  • valueType - Defines the JSON type of the value field which can be one of the types declared by the JSON schema specification. For example string, number, object, array or boolean.

  • value - This is the return value of given type. In case the function has no return value, this value is set to null and valueType is set to nullvalue - This is the return value of given type. In case the function has no return value, this value is set to null and valueType is set to null.

  • There could be also some other attributes in the result JSON as well depending on the execution types but usually they can be ignored since they contain only metadata required by the framework. You should not use these additional data in your app.

You can then use the returned value for further processing inside your pipeline.

...

Instead, it is better to store environment variables in an extra configuration store like the Property Store and secrets encrypted in the Secrets store.

...

Info

For security reasons only secrets starting with prefix PIPEFORCE_TEST_ and PIPEFORCE_SHARED_ can be passed this way. Any other secret cannot be passed to the function service. In this case an exception will be raised on deployment.

Returning values

Make sure the type of your return value of your function is something, which can be converted to a JSON. This is true for all primitives like integer, boolean or string or any dict or array containing such primitives. Also nested.

The returned value is embedded into a result JSON with a structure like this:

Code Block
languagejson
{
  "status": "ok",
  "statusCode": 200,
  "valueType": "string",
  "value": "Hello World"
}

...

status - Can be one of ok or error

...

statusCode - Is compatible with the HTTP status codes. For example 200 is OK and 500 would mean an internal error.

...

statusMessage - Is an optional field and contains information about the status. For example a short hint in case of an error.

...

other secret cannot be passed to the function service. In this case an exception will be raised on deployment.

Returning values

Make sure the type of your return value of your function is something, which can be converted to a JSON. This is true for all primitives like integer, boolean or string or any dict or array containing such primitives. Also nested.

The returned value is embedded into a result JSON with a structure like this:

Code Block
languagejson
{
  "value": "Hello World"
}
  • value - This is the return value of given type. In case the function has no return value, this value is set to null and valueType is set to null.

You can then use the returned value from the result JSON for further processing inside your pipeline.

...

This will return a list of all functions with additional metadata. For example:

...

languagejson

...

with additional metadata. For example:

Code Block
languagejson
{
    "value": [
        {
            "name": "myapp:function1",
            "size": 100,
            "created": 1.6742085685755234E9,
            "modified": 1.6742085685755234E9,
            "language": "python",
            "status": "ok",
            "statusMessage": ""
        },
        {
            "name": "myapp:function2",
            "size": 52,
            "created": 1.6742124433455272E9,
            "modified": 1.6742124433455272E9,
            "language": "python",
            "status": "ok",
            "statusMessage": ""
        },
        {
            "name": "common:function3",
            "size": 60,
            "created": 1.6742906565813148E9,
            "modified": 1.6742906565813148E9,
            "language": "python",
            "status": "ok",
            "statusMessage": ""
        }
    ],
    "valueType": "array",
    "count": 3...
}

Return a single function

...

Which will return the information about the function like this example:

Code Block
{
    "status": "ok",
 
  "statusCode": 200,     "value": {
        "type": "object",
        "data": {
            "name": "myapp:myfunction",
            "size": 60,
            "created": 1.6742906565813148E9,
            "modified": 1.6742906565813148E9,
            "language": "python",
            "content": "def function(args):\n    return \"HELLO WORLD: \" + args['foo']"
        }
    },
    "valueType": "object"...
}

Hooks

Hooks are functions with a reserved name. In case such a function is defined in a script, it will be called whenever the according action happened.

...

Hint: PIPEFORCE allows to install apps directly from GitHub using the Marketplace. This way you can easily distribute and/or rollout your applications then. See: App Marketplace .