PATCH
/
cloud
/
v1
/
faas
/
namespaces
/
{project_id}
/
{region_id}
/
{namespace_name}
/
functions
/
{function_name}
Update function
curl --request PATCH \
  --url https://api.gcore.com/cloud/v1/faas/namespaces/{project_id}/{region_id}/{namespace_name}/functions/{function_name} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "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.",
  "disabled": false,
  "enable_api_key": true,
  "envs": {
    "ENV_VAR": "value"
  },
  "flavor": "128m-128MB",
  "keys": [
    "key1",
    "key2"
  ],
  "main_method": "run",
  "timeout": 60
}'
{
  "tasks": [
    "d478ae29-dedc-4869-82f0-96104425f565"
  ]
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

project_id
integer
required

Project ID

Examples:

1

region_id
integer
required

Region ID

Examples:

1

namespace_name
string
required

Namespace name

Examples:

"namespace-name"

function_name
string
required

Function name

Examples:

"function-name"

Body

application/json
autoscaling
object | null

Autoscaling configuration for the function. Keys must be 'min_instances' or 'max_instances', and values must be integers between 0 and 50.

Examples:
{ "max_instances": 5, "min_instances": 1 }
code_text
string | null

Function code text.

Required string length: 1 - 100000
Examples:

"def main():\n return 'Hello World'"

dependencies
string | null

Dependencies for the function to install.

Maximum length: 100000
Examples:

"numpy==1.21.0\npandas==1.3.0"

description
string | null

Description of the function.

Maximum length: 255
Examples:

"This is a sample function."

disabled
boolean | null

Set to true if the function is disabled.

Examples:

false

enable_api_key
boolean | null

Enable or disable API key authentication. Enable api key is temporarily disabled. As a result, using Functions with authorization is currently not supported.

Examples:

true

envs
object | null

Environment variables for the function. Keys must match a specific regex pattern and be 1-255 characters long, and values must be 0-255 characters long.

Examples:
{ "ENV_VAR": "value" }
flavor
string | null

The name of the flavor associated with the function.

Examples:

"128m-128MB"

keys
string[] | null

List of used authentication API keys, matching a specific regex pattern.

Examples:
["key1", "key2"]
main_method
string | null

The main startup method name.

Required string length: 1 - 100
Examples:

"run"

timeout
integer | null

Function timeout in seconds.

Required range: 0 <= x <= 180
Examples:

60

Response

200 - application/json

OK

tasks
string[]
required

List of task IDs

Examples:
["d478ae29-dedc-4869-82f0-96104425f565"]