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 |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details, see Obtaining a Project ID. |
function_urn |
Yes |
String |
Function URN. For details, see the function model description. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
func_urn |
String |
Function URN. |
func_name |
String |
Function name. |
domain_id |
String |
Domain ID. |
runtime |
String |
Environment in which a FunctionGraph function is executed. Options:
Enumeration values:
|
code_type |
String |
Function code type. Options:
Enumeration values:
|
code_url |
String |
If CodeType is set to obs, enter the OBS URL of the function code package. If CodeType is not set to obs, leave this parameter blank. |
code_filename |
String |
Name of a function file. This parameter is mandatory only when CodeType is set to jar or zip. |
code_size |
Long |
Code size in bytes. |
digest |
String |
SHA512 hash value of function code, which is used to determine whether the function has changed. |
last_modified |
String |
Time when the function was last updated. |
func_code |
FuncCode object |
Response body of the FuncCode struct. |
depend_list |
Array of strings |
Dependency ID list. |
depend_version_list |
Array of strings |
Dependency versions. |
strategy_config |
StrategyConfig object |
Function policy configuration. |
dependencies |
Array of Dependency objects |
Dependency packages. |
Parameter |
Type |
Description |
---|---|---|
file |
String |
Function code, which must be encoded using Base64. If this parameter is left blank, the default code is used. |
link |
String |
Function code URL. |
Parameter |
Type |
Description |
---|---|---|
concurrency |
Integer |
Maximum number of instances for a single function. For v1, the value can be 0 or –1; for v2, it ranges from –1 to 1000.
|
concurrent_num |
Integer |
Maximum number of concurrent requests per instance. This parameter is supported only by v2. The value ranges from –1 to 1000. |
Parameter |
Type |
Description |
---|---|---|
owner |
String |
Domain ID of the dependency owner. |
link |
String |
URL of the dependency on OBS. |
runtime |
String |
Environment in which a FunctionGraph function is executed. Options:
Enumeration values:
|
etag |
String |
MD5 value of a dependency. |
size |
Long |
Dependency size. |
name |
String |
Dependence name. |
description |
String |
Dependency description. |
file_name |
String |
File name of a dependency package (ZIP). |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Requests
Query the code of a function.
GET https://{Endpoint}/v2/{project_id}/fgs/functions/{function_urn}/code
Example Responses
Status code: 200
OK
{ "func_urn" : "urn:fss:xxxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest", "func_name" : "test", "domain_id" : "14ee2e3501124efcbca7998baa24xxxx", "runtime" : "Node.js6.10", "code_type" : "inline", "code_filename" : "index.zip", "code_size" : 245, "digest" : "39d51ae334ffb239037e194159f4cc9cec31086719aa73db7d0a608343121a290f7115693e008bd01cb12b99a803856e83aa96173b26c528c41cfed18267e08f", "last_modified" : "2019-10-31 11:37:58", "func_code" : { "file" : "", "link" : "" }, "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 |
400 |
Bad request. |
401 |
Unauthorized. |
403 |
Forbidden. |
404 |
Not found. |
500 |
Internal server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot