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
Table 1 describes the URI parameters.
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
project_id |
String |
Yes |
Project ID. |
function_urn |
String |
Yes |
Function URN. See Function Model. |
Request
None
Response
Parameter |
Type |
Description |
---|---|---|
func_urn |
String |
Function URN. |
func_name |
String |
Function name. |
domain_id |
String |
Domain ID. |
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. |
concurrency |
Int |
|
code_type |
String |
Function code type. Options:
|
code_url |
String |
|
code_filename |
String |
Function file name.
|
code_size |
String |
Code size in bytes. |
func_code |
String |
Function code. See Table 3. |
digest |
String |
SHA512 hash value of function code, which is used to determine whether the function is changed. |
last_modified |
String |
Time when the function was last updated. |
depend_list |
String |
Dependency list. |
strategy_config |
String |
Function policy configuration. See Table 4. |
func_vpc |
func_vpc |
Virtual Private Cloud (VPC) configuration. See Table 6. |
Example
Example request
GET /v2/7aad83af3e8d42e99ac194e8419e2c9b/fgs/functions/urn:fss:xxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest/code HTTP/1.1
Example response
The format of the response for a successful request is as follows:
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 }, }
The format of the response for a failed request is as follows:
HTTP/1.1 404 Not Found { "error_code": "FSS.1052", "error_msg": "Not found the function version" }
Status Code
See Status 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