获取指定函数代码
功能介绍
获取指定函数的代码。
URI
GET /v2/{project_id}/fgs/functions/{function_urn}/code
URI参数说明如表1所示。
|
参数 |
类型 |
必选 |
说明 |
|---|---|---|---|
|
project_id |
String |
必选 |
Project ID。 |
|
function_urn |
String |
必选 |
函数的URN,详细解释见FunctionGraph函数模型的描述。 |
请求消息
无
响应消息
|
名称 |
参数类型 |
说明 |
|---|---|---|
|
func_urn |
String |
函数的URN(Uniform Resource Name),唯一标识函数。 |
|
func_name |
String |
函数名称。 |
|
domain_id |
String |
域名id。 |
|
runtime |
String |
FunctionGraph函数的执行环境,支持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和PHP 7.3。 |
|
concurrency |
Int |
|
|
code_type |
String |
函数代码类型,取值有4种:
|
|
code_url |
String |
|
|
code_filename |
String |
函数的文件名。
|
|
code_size |
String |
函数大小,单位:字节。 |
|
func_code |
String |
函数代码,请参考表3。 |
|
digest |
String |
函数代码SHA512 hash值,用于判断函数是否变化。 |
|
last_modified |
String |
函数最后一次更新时间。 |
|
depend_list |
String |
依赖包列表。 |
|
strategy_config |
String |
函数策略配置,请参考表4。 |
|
func_vpc |
func_vpc |
VPC配置,请参考表6。 |
示例
请求示例
GET /v2/7aad83af3e8d42e99ac194e8419e2c9b/fgs/functions/urn:fss:xxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest/code HTTP/1.1
响应示例
成功时的返回格式:
HTTP/1.1 200 OK
{
"code_filename": "index.js",
"code_size": 272,
"code_type": "inline",
"digest": "decbce6939297b0b5ec6d1a23bf9c725870f5e69fc338a89a6a4029264688dc26338f56d08b6535de47f15ad538e22ca66613b9a46f807d50b687bb53fded1c6",
"func_code": {
"file": "",
"link": "https://functionstorage-hk06.obs.xx-xxx.xxxxxxxxcloud.com/xxx/d2b0xxxf6e65/default/test143/latest/index.zip"
},
"func_name": "test",
"func_urn": "urn:fss:xxxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest",
"last_modified": "2018-03-28T11:30:32+08:00",
"runtime": "Node.js6.10",
"strategy_config": {
"concurrency": -1
},
}
失败时的返回格式:
HTTP/1.1 404 Not Found
{
"error_code": "FSS.1052",
"error_msg": "Not found the function version"
}
状态码
状态码请参见状态码。