Querying a Function List
Function
This API is used to query a function list.
URI
GET /v2/{project_id}/fgs/functions?marker={marker}&maxitems={maxitems}
Table 1 describes the URI parameter.
Parameter | Type | Mandatory | Description |
---|---|---|---|
project_id | String | Yes | Project ID. |
Request
Table 2 describes the request parameters.
Parameter | Type | Mandatory | Description |
---|---|---|---|
marker | Int | No | Final record queried last time. |
maxitems | Int | No | Maximum number of function templates that can be queried each time. The maximum value is 400. If this parameter is not set or is 0 or greater than 400, the default value 400 is used. If this parameter is less than 0, a message indicating a parameter error is returned. |
Response
Table 3 describes the response parameters.
Parameter | Type | Description |
---|---|---|
func_urn | String | Function URN. |
func_name | String | Function name. |
domain_id | String | Domain ID. |
namespace | String | Project ID. |
project_name | String | Project name. |
package | String | Group to which the function belongs. This field is defined to group functions. |
runtime | String | Environment for executing the function. FunctionGraph supports Node.js 6.10, Node.js 8.10, Node.js 10.16, Node.js 12.13, Python 2.7, Python 3.6, Java 8, Go 1.8, C# (.NET Core 2.0), C# (.NET Core 2.1), C# (.NET Core 3.1), and PHP 7.3. |
timeout | Int | Maximum duration the function can be executed. Value range: 3s–900s. |
handler | String | Handler of the function in the format of "xx.xx". It must contain a period (.). For example, for Node.js function myfunction.handler, the file name is myfunction.js, and the entry point function is handler. |
memory_size | Int | Memory (MB) consumed by the function. Options: 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2560, 3072, 3584, and 4096. |
cpu | Int | 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 | Function code type. Options:
|
code_url | String |
|
code_filename | String | Function file name.
|
code_size | Int64 | Code size in bytes. |
user_data | String | Name/Value information defined for the function. For example, if a function needs to access a host, define Host={host_ip}. You can define a maximum of 20 such parameters, and their total length cannot exceed 4 KB. |
digest | String | SHA512 hash value of function code, which is used to determine whether the function is changed. |
version | String | Function version, which is automatically generated by the system. The version name is in the format of "vYYYYMMDD-HHMMSS" (v+year/month/day-hour/minute/second). |
image_name | String | Internal identifier of a function version. |
xrole | String | Agency used by the function. You need to create an agency on the Identity and Access Management (IAM) console. This field is mandatory when a function needs to access other services. |
app_xrole | *String | Agency used by the function app. You need to create an agency on the IAM console. This field is mandatory when a function needs to access other services. |
description | String | Description of the function. |
version_description | String | Description of the function version. |
last_modified | String | Time when the function was last updated. |
func_code | String | Function code. See Table 4. |
depend_list | []String | Dependency list. |
strategy_config | String | Function policy configuration. See Table 5. |
extend_config | String | Function extension configuration. |
dependencies | []*String | Dependency code package. |
initializer_handler | String | Initializer of the function in the format of "xx.xx". It must contain a period (.). For example, for Node.js function myfunction.initializer, the file name is myfunction.js, and the initialization function is initializer. |
initializer_timeout | Int | Maximum duration the function can be initialized. Value range: 1s–300s. |
func_vpc | *String | Virtual Private Cloud (VPC) configuration. See Table 6. |
mount_config | *String | Disk mount configuration. See Table 7. |
Parameter | Type | Description |
---|---|---|
file | String | Function code (deprecated). |
link | String | Function code link (code can be downloaded through the OBS SDK). |
Parameter | Type | Description |
---|---|---|
concurrency | Int |
|
Parameter | Type | Mandatory | 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. |
Parameter | Type | Mandatory | Description |
---|---|---|---|
user_id | Int | Yes when mount_user is not empty. | User ID, which is an integer from –1 to 65,534, excluding 0, 1000, and 1002. |
user_group_id | Int | Yes when mount_user is not empty. | User group ID, which is an integer from –1 to 65,534, excluding 0, 1000, and 1002. |
Parameter | Type | Mandatory | Description |
---|---|---|---|
id | String | - | Unique ID that identifies a file system. |
mount_type | String | Yes when func_mounts is not empty. | Mount type. Options: sfs and ecs. |
mount_resource | String | Yes when func_mounts is not empty. | ID of the mounted resource (corresponding cloud service). |
mount_share_path | String | Yes when mount_type is set to ecs. | Remote mount path. Example: 192.168.0.12:/data. |
local_mount_path | String | Yes when func_mounts is not empty. | Function access path. |
status | String | - | Status. Options: ACTIVE and DISABLED. |
Example
Example request
GET /v2/7aad83af3e8d42e99ac194e8419e2c9b/fgs/functions?marker=0&maxitems=400 HTTP/1.1
Example response
The format of the response for a successful request is as follows:
HTTP/1.1 200 OK{"functions": [{"func_urn": "urn:fss:xxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test","func_name": "test","user_domain": "cff01_hk","namespace": "7aad83af3e8d42e99ac194e8419e2c9b","project_name": "xxxxxxxx","package": "default","runtime": "Node.js6.10","timeout": 3,"handler": "test.handler","memory_size": 128,"cpu": 300,"code_type": "inline","code_filename": "index.js","code_size": 272,"digest": "decbce6939297b0b5ec6d1a23bf9c725870f5e69fc338a89a6a4029264688dc26338f56d08b6535de47f15ad538e22ca66613b9a46f807d50b687bb53fded1c6","version": "latest","image_name": "latest-5qe8e","xrole": "cff","description": "111","last_modified": "2018-03-28T11:30:32+08:00","func_code": {},"strategy_config": {"concurrency": -1,"initializer_handler": "index.initializer","initializer_timeout": 3}],"next_marker": 45}
The format of the response for a failed request is as follows:
HTTP/1.1 403 Forbidden{"error_code": "FSS.0403","error_msg": "namespace and token mismatch"}
Status Code
See Status Codes.
- Function
- URI
- Request
- Response
- Example
- Status Code