Function as a Service
Create function
Create a new serverless function in the specified namespace. The function can be configured with code, dependencies, and runtime settings.
post/cloud/v1/faas/namespaces/{project_id}/{region_id}/{namespace_name}/functions
Path parameters
project_idinteger required
Project ID
Example:1
Project ID
region_idinteger required
Region ID
Example:1
Region ID
namespace_namestring required
Namespace name
Example:namespace-name
Namespace name
Request body
Example request
{
"autoscaling": {
"max_instances": 5,
"min_instances": 1
},
"code_text": "def main():\n return 'Hello World'",
"dependencies": "numpy==1.21.0\npandas==1.3.0",
"description": "This is a sample function.",
"enable_api_key": true,
"envs": {
"ENV_VAR": "value"
},
"flavor": "64m-64MB",
"main_method": "handler",
"name": "function-name",
"runtime": "python3.7.12",
"timeout": 5
}Response
OK
Example response
{
"tasks": [
"d478ae29-dedc-4869-82f0-96104425f565"
]
}