Querying the Code of a Function
Function
This API is used to query the code of a function.
URI
GET /v2/{project_id}/fgs/functions/{function_urn}/code
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
function_urn |
Yes |
String |
Function URN. |
|
project_id |
Yes |
String |
Tenant's project ID. |
Request Parameters
None
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
func_code |
FuncCode object |
Function code. |
|
func_urn |
String |
Function URN. |
|
func_name |
String |
Function name. |
|
domain_id |
String |
Tenant's domain ID. |
|
runtime |
String |
Function runtime. Enumeration values:
|
|
concurrency |
Long |
0: The function is disabled. -1: The function is enabled. Enumeration values:
|
|
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:
|
|
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. |
|
digest |
String |
Unique function hash value. |
|
last_modified |
String |
Latest update time. |
|
depend_list |
Array of strings |
Dependency list. |
|
dependencies |
Array of Dependency objects |
Detailed information about the dependency list. |
|
strategy_config |
StrategyConfig object |
Function policy configuration. |
|
func_vpc |
FuncVpc object |
VPC configuration. |
|
Parameter |
Type |
Description |
|---|---|---|
|
file |
String |
Function code. When code_type is set to inline, zip, or jar, this parameter is required. Moreover, the code must be encoded using Base64. When code_type is set to obs, this parameter is not required. |
|
link |
String |
Function code. When code_type is set to obs, this parameter indicates the address of a function code package in OBS. |
|
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
GET https://{functiongraph_endpoint}/v2/7aad83af3e8d42e99ac194e8419e2c9b/fgs/functions/urn:fss:xxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest/code
Example Responses
Status code: 200
OK
{
"func_urn" : "urn:fss:xxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest",
"func_name" : "xxxxx",
"domain_id" : "14ee2e35****a7998b******aa24cabf",
"runtime" : "Python2.7",
"code_type" : "inline",
"code_filename" : "index.zip",
"code_size" : 245,
"digest" : "39d51ae334ffb239037e194159f4cc9cec31086719aa73db7d0a608343121a290f7115693e008bd01cb12b99a803856e83aa96173b26c528c41cfed18267e08f",
"last_modified" : "2019-09-25T19:02:17+08:00",
"func_code" : {
"file" : "UEsDBAoAAAAIAAhYOU8ssPQsgwAAALYAAAAIAAAAaW5kZXgucHlVzbEOwjAMBNA9X2GVoQ1QZhSJvb8RNW4xSp3IcVDF1wOlCzee7ukO0B97GFMgnl3Vqb9+C0NLTqLwKImNCTgBMSn5SC+UbkysuKp1Bj7JQqxds+5p7La/ew4RBTp8IusZ/k2qmqvCDdoBY0ywYCl+RgctnLbTS6hLLj9sNyKoVXiXb1BLAQIeAwoAAAAIAAhYOU8ssPQsgwAAALYAAAAIAAAAAAAAAAAAAADzAgAAAABpbmRleC5weVBLBQYAAAAAAQABADYAAACpAAAAAAA=",
"link" : "https://functionstorage.obs.cn-north-7.myhuaweicloud.com/functions/46b6f338fc3445b8846c71dfb1fbd9e8/default/xxxxx/latest/index.zip"
},
"strategy_config" : {
"concurrency" : -1
}
}
Status code: 404
Not Found
{
"error_code" : "FSS.1052",
"error_msg" : "Not found the function version"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK |
|
404 |
Not Found |
Error Codes
See Error Codes.
Last Article: Modifying the Alias Information About a Function Version
Next Article: Modifying the Code of a Function
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.