functiongraph函数模型-j9九游会登录
介绍functiongraph函数模型的返回字段。
函数模型
functiongraph函数模型如下。
{
"functions": [
{
"func_urn": "urn:fss:xxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test",
"func_name": "test",
"domain_id": "cff01_hk",
"namespace": "7aad83af3e8d42e99ac194e8419e2c9b",
"project_name": "xxxxxxxxxx",
"package": "default",
"runtime": "node.js6.10",
"timeout": 3,
"handler": "test.handler",
"memory_size": 128,
"cpu": 300,
"code_type": "inline",
"code_url": "",
"code_filename": "index.js",
"code_size": 272,
"user_data": "",
"digest": "decbce6939297b0b5ec6d1a23bf9c725870f5e69fc338a89a6a4029264688dc26338f56d08b6535de47f15ad538e22ca66613b9a46f807d50b687bb53fded1c6",
"version": "latest",
"image_name": "latest-5qe8e",
"xrole": "cff",
"app_xrole": null,
"description": "111",
"version_description": "",
"last_modified": "2018-03-28t11:30:32 08:00",
"func_code": {
"file": "",
"link": ""
},
"func_vpc": null,
"mount_config": null,
"depend_list": null,
"strategy_config": {
"concurrency": -1
},
"extend_config": "",
"dependencies": null,
"initializer_handler": "index.initializer",
"initializer_timeout": 3
}
],
"next_marker": 45
}
字段说明
functiongraph函数字段说明如表1所示。
|
名称 |
说明 |
|---|---|
|
func_urn |
函数的urn(uniform resource name),唯一标识函数。 |
|
func_name |
函数名称。 |
|
domain_id |
租户名称。 |
|
namespace |
租户的project id。 |
|
project_name |
租户的project name。 |
|
package |
函数所属的分组package,用于用户针对函数的自定义分组。 |
|
runtime |
functiongraph函数的执行环境,支持node.js 6.10、node.js 8.10、node.js 10.16、node.js 12.13、node.js 14.18、node.js 16.17、node.js 18.15、node.js 20.15、python 2.7、python 3.6、python 3.9、python 3.10、python 3.12、java 8、java 11、java 17、java 21、go 1.x、c#.net core 2.1、c#.net core 3.1、c#.net core 6.0、c#.net core 8.0、cangjie 1.0、php 7.3、php 8.3、custom: 自定义运行时、http: http函数和custom image: 自定义镜像函数。 |
|
timeout |
函数执行超时时间,超时函数将被强行停止,范围3~900秒。 |
|
handler |
函数执行入口,规则:xx.xx,必须包含“. ”。 举例:对于node.js函数:myfunction.handler,则表示函数的文件名为myfunction.js,执行的入口函数名为handler。 |
|
memory_size |
函数消耗的内存,单位m。 取值范围为:128、256、512、768、1024、1280、1536、1792、2048、2560、3072、3584、4096、8192、10240。最小值为128,最大值为10240。 |
|
cpu |
函数占用的cpu资源。 |
|
code_type |
函数代码类型,取值有4种:
|
|
code_url |
|
|
code_filename |
函数的文件名。
|
|
code_size |
函数大小,单位:字节。 |
|
user_data |
用户自定义的name/value信息,在函数中使用的参数。 举例:如函数要访问某个主机,可以设置自定义参数:host={host_ip},总长度不超过4kb。 |
|
digest |
函数代码sha512 hash值,用于判断函数是否变化。 |
|
version |
函数版本号,由系统自动生成,规则:vyyyymmdd-hhmmss(v 年月日-时分秒)。 |
|
image_name |
函数版本的内部标识。 |
|
xrole |
函数使用的权限委托名称,需要iam支持,并在iam界面创建委托,当函数需要访问其他服务时,必须提供该字段。 |
|
app_xrole |
函数app使用的权限委托名称,需要iam支持,并在iam界面创建委托,当函数需要访问其他服务时,必须提供该字段。 |
|
description |
函数描述。 |
|
version_description |
函数版本描述。 |
|
last_modified |
函数最后一次更新时间。 |
|
func_code |
函数代码,请参考表2。 |
|
depend_list |
依赖包列表。 |
|
strategy_config |
函数策略配置,请参考表3。 |
|
extend_config |
函数扩展配置。 |
|
dependencies |
依赖代码包列表,请参考表5。 |
|
initializer_handler |
函数初始化入口,规则:xx.xx,必须包含“. ”。 举例:对于node.js函数:myfunction.initializer,则表示函数的文件名为myfunction.js,初始化的入口函数名为initializer。 |
|
initializer_timeout |
初始化超时时间,超时函数将被强行停止,范围1 ~ 300秒。 |
|
func_vpc |
vpc配置,请参考表4。 |
|
mount_config |
文件系统配置,请参考表6 mount_config参数说明。 |
|
参数 |
说明 |
|---|---|
|
file |
函数代码内容,接口返回空。 |
|
link |
函数代码链接,接口返回空。 |
|
参数 |
说明 |
|---|---|
|
concurrency |
|
|
参数 |
类型 |
是否必选 |
说明 |
|---|---|---|---|
|
vpc_name |
string |
否 |
虚拟私有云名称 |
|
vpc_id |
string |
当func_vpc非空时必选 |
虚拟私有云唯一标识 |
|
subnet_name |
string |
否 |
子网名称 |
|
subnet_id |
string |
当func_vpc非空时必选 |
子网编号 |
|
cidr |
string |
否 |
子网掩码 |
|
gateway |
string |
否 |
网关 |
|
参数 |
类型 |
是否必选 |
说明 |
|---|---|---|---|
|
owner |
string |
否 |
依赖包属主的domainid |
|
link |
string |
否 |
依赖包在obs上的链接 |
|
runtime |
string |
否 |
依赖包语言类型(仅作为分类条件) |
|
etag |
string |
否 |
依赖包md5值 |
|
size |
int |
否 |
依赖包大小 |
|
name |
string |
否 |
依赖包名称 |
|
description |
string |
否 |
依赖包描述 |
|
file_name |
string |
否 |
依赖包文件名(如果创建方式为zip时) |
|
参数 |
类型 |
是否必选 |
说明 |
|---|---|---|---|
|
mount_user |
否 |
文件系统用户配置 |
|
|
func_mounts |
否 |
文件系统列表 |
|
参数 |
类型 |
是否必选 |
说明 |
|---|---|---|---|
|
user_id |
int |
mount_user非空时必选 |
用户id,-1 ~ 65534的整数(0、1000、1002除外) |
|
user_group_id |
int |
mount_user非空时必选 |
用户组id,-1 ~ 65534的整数(0、1000、1002除外) |
|
参数 |
类型 |
是否必选 |
说明 |
|---|---|---|---|
|
mount_type |
string |
func_mounts非空时必选 |
挂载类型(sfs/sfsturbo/ecs)
|
|
mount_resource |
string |
func_mounts非空时必选 |
挂载资源id(对应云服务id) |
|
mount_share_path |
string |
“mount_type”为“ecs”时,必选 |
远端挂载路径(例如192.168.0.12:/data) |
|
local_mount_path |
string |
func_mounts非空时必选 |
函数访问路径 |
funcurn格式说明
urn:fss:: :function: : [: |:! ]
funcurn使用冒号分隔为8个域,region_id为系统配置的值(测试时可以填成与后台相同的值),最后一个中括号的内容表示可以为函数的版本号,也可以为该版本指向的别名,如果为别名时需要在名称前加上感叹号!以示区分。
当作为api参数时,可以提供简化格式的funcurn,具体如下。
- 提供1个域:解析为
,“project_id”从token中获取,“package”为“default”,“version”为“latest”。 - 提供2个域:解析为
: ,“project_id”从token中获取,“version”为“latest”。 - 提供3个域:解析为
: : ,“version”为“latest”。 - 提供4个域:解析为
: : : 。 - 提供7个域:解析为urn:fss:
: :function: : ,“version”为“latest”。 - 提供8个域:解析为urn:fss:
: :function: : : 。
函数实例数据
{
"func_urn":"urn:fss:xxxxxxxxx:73d69ae0cfcf460190522d060f05ad:function:default:auto_testfunc93749",
"func_name":"auto_testfunc93749",
"domain_id":"b8aca445e0d04d81a34bb59de5280c72",
"namespace":"73d69ae0cfcf460190522d060f05ad",
"project_name":"xxxxxxxxx",
"package":"default",
"runtime":"python2.7",
"timeout":5,
"handler":"index.handler",
"memory_size":128,
"cpu":300,
"code_type":"inline",
"code_filename":"index.py",
"code_size":1992,
"version":"latest",
"image_name": "latest-200731100126@obffv",
"description": "使用api网关调用函数,在函数中演示了返回不同的内容,如html页面和json结构体。",
"last_modified": "2020-07-31t10:01:26 08:00",
"func_code": {},
"funccode": {},
"concurrency": -1,
"strategy_config": {
"concurrency": -1
},
"enterprise_project_id": "0"
}
相关文档
意见反馈
文档内容是否对您有帮助?
如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨