Help Center> FunctionGraph> API Reference> Function Management Zone API> Modifying the Metadata of a Function

Modifying the Metadata of a Function

Function

This API is used to modify the metadata of a function.

URI

PUT /v2/{project_id}/fgs/functions/{function_urn}/config

Table 1 Path parameters

Parameter

Mandatory

Type

Description

function_urn

Yes

String

Function URN.

project_id

Yes

String

Tenant's project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

handler

Yes

String

Handler of the function.

memory_size

Yes

Long

Memory consumed by the function. Unit: MB.

timeout

Yes

Long

Timeout for function execution. Unit: second.

runtime

Yes

String

Function runtime.

Enumeration values:

  • Python2.7

  • Python3.6

  • Go1.8

  • Go1.x

  • Java8

  • Node.js6.10

  • Node.js8.10

  • Node.js10.16

  • Node.js12.13

  • C#(.NET Core 2.0)

  • C#(.NET Core 2.1)

  • C#(.NET Core 3.1)

  • Custom

  • PHP7.3

func_vpc

No

FuncVpc object

VPC configuration.

mount_config

No

FuncMountConfig object

Mounting configuration.

description

No

String

Description of the function.

user_data

No

String

Name/Value defined for the function.

xrole

No

String

This parameter is mandatory if the function needs to access other cloud services.

app_xrole

No

String

This parameter is mandatory if the function needs to access other cloud service apps.

initializer_handler

No

String

Initializer of the function.

initializer_timeout

No

Integer

Maximum duration the function can be initialized. Value range: 1s to 300s.

func_name

No

String

Function name.

strategy_config

No

StrategyConfig object

Policy configuration.

extend_config

No

String

Function extension configuration.

enterprise_project_id

No

String

Enterprise project ID. This parameter is mandatory when an enterprise user creates a function.

Table 3 FuncVpc

Parameter

Mandatory

Type

Description

vpc_name

No

String

VPC name.

vpc_id

No

String

VPC ID.

subnet_name

No

String

Subnet name.

subnet_id

No

String

Subnet ID.

cidr

No

String

Subnet mask.

gateway

No

String

Gateway.

Table 4 FuncMountConfig

Parameter

Mandatory

Type

Description

mount_user

Yes

MountUser object

User configuration for mounting.

func_mounts

Yes

Array of FuncMounts objects

Function configuration for mounting.

Table 5 MountUser

Parameter

Mandatory

Type

Description

user_id

Yes

Integer

User ID to be used for a function to access mounted resources. Default value: –1.

Default: -1

user_group_id

Yes

Integer

User group ID to be used for a function to access mounted resources. Default value: –1.

Default: -1

Table 6 FuncMounts

Parameter

Mandatory

Type

Description

id

No

String

Unique ID.

mount_type

Yes

String

Mount type. Options: sfs, sfsTurbo, and ecs.

mount_resource

Yes

String

ID of the mounted resource (corresponding cloud service).

mount_share_path

Yes

String

Remote mount path. Example: 192.168.0.12:/data.

local_mount_path

Yes

String

Function access path.

status

No

String

Status. Options: ACTIVE and DISABLED.

Enumeration values:

  • ACTIVE

  • DISABLED

Table 7 StrategyConfig

Parameter

Mandatory

Type

Description

concurrency

No

Long

0: The function is disabled. -1: The function is enabled.

Enumeration values:

  • 0

  • -1

Response Parameters

Status code: 200

Table 8 Response body parameters

Parameter

Type

Description

func_urn

String

Function URN.

func_name

String

Function name.

domain_id

String

Tenant's domain name.

namespace

String

Tenant's project ID.

project_name

String

Project name.

package

String

App name.

runtime

String

Function runtime.

Enumeration values:

  • Python2.7

  • Python3.6

  • Go1.8

  • Go1.x

  • Java8

  • Node.js6.10

  • Node.js8.10

  • Node.js10.16

  • Node.js12.13

  • C#(.NET Core 2.0)

  • C#(.NET Core 2.1)

  • C#(.NET Core 3.1)

  • Custom

  • PHP7.3

timeout

Long

Timeout for function execution. Unit: second.

Minimum: 3

Maximum: 900

handler

String

Function handler.

memory_size

Long

Memory consumed by the function. Unit: MB.

Minimum: 128

cpu

Long

Number of CPU millicores used by the function (1 core = 1000 millicores). The value of this field is proportional to that of MemorySize. By default, 100 CPU millicores are required for 128 MB memory. The value is calculated as follows: Memory/128 x 100 + 200 (basic CPU millicores).

code_type

String

Code entry mode. inline: Online editing. This mode is supported for Node.js*, PHP7.3, Python2.7, Python3.6, and custom runtimes. zip: Upload of a local ZIP package. This mode is supported for all runtimes. jar: Upload of a local JAR package. This mode is supported for the Java 8 runtime. obs: Upload of a file through the OBS console. This mode is supported for all runtimes.

Enumeration values:

  • inline

  • zip

  • obs

  • jar

code_url

String

When code_type is set to obs, this parameter indicates the address of a function code package in OBS. When code_type is set to inline, zip, or jar, this parameter is left blank.

code_filename

String

Function file name. When code_type is set to zip or jar, this parameter is required. When code_type is set to obs or inline, this parameter is not required.

code_size

Long

Code size. Unit: KB.

user_data

String

Name/Value defined for the function.

digest

String

Unique function hash value.

version

String

Function version.

image_name

String

Unique version number for internal use.

xrole

String

This parameter is mandatory if the function needs to access other cloud services.

app_xrole

String

This parameter is mandatory if the function needs to access other cloud service apps.

description

String

Description of the function.

version_description

String

Description of the function version.

last_modified

String

Latest update time.

depend_list

Array of strings

Dependency list.

strategy_config

StrategyConfig object

Function policy configuration.

extend_config

String

Function extension configuration.

initializer_handler

String

Initializer of the function.

initializer_timeout

Integer

Maximum duration the function can be initialized. Value range: 1s to 300s.

func_vpc

FuncVpc object

VPC configuration.

mount_config

FuncMountConfig object

Mounting configuration.

concurrency

Long

Enabling status of a function.

dependencies

Array of Dependency objects

Function dependency list.

enterprise_project_id

String

Enterprise project ID. This parameter is mandatory when an enterprise user creates a function.

Table 9 StrategyConfig

Parameter

Type

Description

concurrency

Long

0: The function is disabled. -1: The function is enabled.

Enumeration values:

  • 0

  • -1

Table 10 FuncVpc

Parameter

Type

Description

vpc_name

String

VPC name.

vpc_id

String

VPC ID.

subnet_name

String

Subnet name.

subnet_id

String

Subnet ID.

cidr

String

Subnet mask.

gateway

String

Gateway.

Table 11 FuncMountConfig

Parameter

Type

Description

mount_user

MountUser object

User configuration for mounting.

func_mounts

Array of FuncMounts objects

Function configuration for mounting.

Table 12 MountUser

Parameter

Type

Description

user_id

Integer

User ID to be used for a function to access mounted resources. Default value: –1.

Default: -1

user_group_id

Integer

User group ID to be used for a function to access mounted resources. Default value: –1.

Default: -1

Table 13 FuncMounts

Parameter

Type

Description

id

String

Unique ID.

mount_type

String

Mount type. Options: sfs, sfsTurbo, and ecs.

mount_resource

String

ID of the mounted resource (corresponding cloud service).

mount_share_path

String

Remote mount path. Example: 192.168.0.12:/data.

local_mount_path

String

Function access path.

status

String

Status. Options: ACTIVE and DISABLED.

Enumeration values:

  • ACTIVE

  • DISABLED

Table 14 Dependency

Parameter

Type

Description

id

String

Dependency ID.

owner

String

Dependency owner.

link

String

URL of the dependency in the OBS console.

runtime

String

Runtime.

etag

String

Unique ID of the dependency.

size

String

Size of the dependency.

name

String

Name of the dependency.

description

String

Description of the dependency.

file_name

String

File name of the dependency.

Example Requests

PUT https://{functiongraph_endpoint}/v2/7aad83af3e8d42e99ac194e8419e2c9b/fgs/functions/urn:fss:xxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest/config

{
  "func_name" : "test",
  "handler" : "index.handler",
  "runtime" : "C#(.NET Core 2.1)",
  "memory_size" : 256,
  "timeout" : 30,
  "xrole" : "cffservice"
}

Example Responses

Status code: 200

OK

{
  "func_urn" : "uurn:fss:xxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest",
  "func_name" : "test",
  "domain_id" : "14ee2e35****a7998b******aa24cabf",
  "namespace" : "46b6f338fc3445b8846c71dfb1fbd9e8",
  "project_name" : "cn-north-7",
  "package" : "csharp",
  "runtime" : "C#(.NET Core 2.1)",
  "timeout" : 30,
  "handler" : "fssExampleCsharp2.1::fssExampleCsharp21.Program::MyFunc",
  "memory_size" : 256,
  "cpu" : 300,
  "code_type" : "zip",
  "code_filename" : "fss_example_csharp2.1.zip",
  "code_size" : 6709,
  "xrole" : "cffservice",
  "digest" : "faa825575c45437cddd4e369bea69893bcbe195d478178462ad90984fe72993f3f59d15f41c5373f807f3e05fb9af322c55dabeb16565c386e402413458e6068",
  "version" : "latest",
  "image_name" : "latest-191025153727@zehht",
  "last_modified" : "2019-10-25T15:37:27+08:00",
  "func_code" : { },
  "strategy_config" : {
    "concurrency" : 0
  }
}

Status code: 404

Not Found

{
  "error_code" : "FSS.1051",
  "error_msg" : "Not found the function"
}

Status Codes

Status Code

Description

200

OK

404

Not Found

Error Codes

See Error Codes.