...
Code Block | ||
---|---|---|
| ||
{ "status": "ok", "statusCode": 200, "valueType": "string", "value": "Hello World: Max" ... } |
status
- Can be one ofok
orerror
statusCode
- Is compatible with the HTTP status codes. For example200
is OK and500
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 examplestring
,number
,object
,array
orboolean
.value
- This is the return value of given type. In case the function has no return value, this value is set tonull
andvalueType
is set tonull
value
- This is the return value of given type. In case the function has no return value, this value is set tonull
andvalueType
is set tonull
.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 |
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 | ||
---|---|---|
| ||
{
"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 | ||
---|---|---|
| ||
{
"value": "Hello World"
} |
value
- This is the return value of given type. In case the function has no return value, this value is set tonull
andvalueType
is set tonull
.
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:
...
language | json |
---|
...
with additional metadata. For example:
Code Block | ||
---|---|---|
| ||
{ "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 .