Querying the Versions of a Function
Function
This API is used to query the versions of a function.
URI
GET /v2/{project_id}/fgs/functions/{function_urn}/versions
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. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
marker |
No |
String |
Final record queried last time. |
maxitems |
No |
String |
Maximum number of functions to obtain in a request. |
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 |
---|---|---|
versions |
Array of ListFunctionVersionResult objects |
Version list. |
next_marker |
Long |
Next record location. |
count |
Long |
Total number of versions. |
Parameter |
Type |
Description |
---|---|---|
func_urn |
String |
Function URN. |
func_name |
String |
Function name. |
domain_id |
String |
Domain ID. |
namespace |
String |
Project ID. |
project_name |
String |
Project name. |
package |
String |
Group to which the function belongs. This field is defined to group functions. |
runtime |
String |
Environment in which a FunctionGraph function is executed. Options:
Enumeration values:
|
timeout |
Integer |
Maximum duration the function can be executed. Value range: 3s–900s. The value can be up to 12 hours for whitelisted users. For details, contact FunctionGraph personnel. |
handler |
String |
Handler of a function in the format of "xx.xx". It must contain a period (.). For example, for Node.js function myfunction.handler, the file name is myfunction.js, and the handler function is handler. |
memory_size |
Integer |
Memory consumed by a function. Unit: MB. The value can be 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2560, 3072, 3584 or 4096. The value ranges from 128 to 4096. |
cpu |
Integer |
CPU resources of a function. Unit: millicore (1 core = 1000 millicores). The value of this field is proportional to that of MemorySize. By default, 100 CPU millicores are required for 128 MB memory. The value is calculated as follows: Memory/128 x 100 + 200 (basic CPU millicores) |
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. |
user_data |
String |
Name/Value information defined for the function. These are parameters used in the function. For example, if a function needs to access a host, define Host={host_ip}. You can define a maximum of 20 such parameters, and their total length cannot exceed 4 KB. |
encrypted_user_data |
String |
User-defined name/value to be encrypted. |
digest |
String |
SHA512 hash value of function code, which is used to determine whether the function has changed. |
version |
String |
Function version, which is automatically generated by the system. The version name is in the format of "vYYYYMMDD-HHMMSS" (v+year/month/day-hour/minute/second). |
image_name |
String |
Internal identifier of a function version. |
xrole |
String |
Agency used by the function. You need to create an agency on the IAM console. This field is mandatory when a function needs to access other services. |
app_xrole |
String |
Agency used by the function app. You need to create an agency on the IAM console. This field is mandatory when a function needs to access other services. |
last_modified |
String |
Time when the function was last updated. |
func_vpc_id |
String |
VPC ID. |
concurrency |
Integer |
0: A function is disabled. -1: A function is enabled. |
concurrent_num |
Integer |
Number of concurrent instances. |
strategy_config |
StrategyConfig object |
Function policy configuration. |
initializer_handler |
String |
Initializer of the function. It is in the format of "xx.xx" and must contain a period (.). For example, for Node.js function myfunction.initializer, the file name is myfunction.js, and the initialization function is initializer. |
initializer_timeout |
Integer |
Maximum duration the function can be initialized. Value range: 1s–300s. |
long_time |
Boolean |
Whether long-term running is supported. |
function_async_config |
FunctionAsyncConfig object |
Return struct of the asynchronous execution notification settings. |
type |
String |
Function version. |
enable_cloud_debug |
String |
Whether to enable cloud-based debugging. |
enable_dynamic_memory |
Boolean |
Whether to enable dynamic memory allocation. |
enterprise_project_id |
String |
Enterprise project ID. This parameter is mandatory if you create a function as an enterprise user. |
is_stateful_function |
Boolean |
Whether stateful functions are supported. If they are supported, set this parameter to true. This parameter is supported in FunctionGraph v2. |
enable_auth_in_header |
Boolean |
Whether to allow authentication information in the request header. |
custom_image |
CustomImage object |
Container image. |
reserved_instance_idle_mode |
Boolean |
Whether to enable idle mode for reserved instances. |
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 |
---|---|---|
max_async_event_age_in_seconds |
Integer |
Maximum validity period of a message. Value range: 60–86,400. Unit: second. |
max_async_retry_attempts |
Integer |
Maximum number of retry attempts to be made if asynchronous invocation fails. Default value: 3. Value range: 0–8. |
destination_config |
FuncAsyncDestinationConfig object |
Asynchronous invocation target. |
created_time |
String |
Time when asynchronous execution notification was configured. |
last_modified |
String |
Time when the asynchronous execution notification settings were last modified. |
Parameter |
Type |
Description |
---|---|---|
on_success |
FuncDestinationConfig object |
Target to be invoked when a function is successfully executed. |
on_failure |
FuncDestinationConfig object |
Target to be invoked when a function fails to be executed due to a system error or an internal error. |
Parameter |
Type |
Description |
---|---|---|
destination |
String |
Object type.
Enumeration values:
|
param |
String |
Parameters (in JSON format) corresponding to the target service.
|
Parameter |
Type |
Description |
---|---|---|
enabled |
Boolean |
Whether to enable this feature. |
image |
String |
Image address. |
command |
String |
Command for starting a container image. |
args |
String |
Command line parameter for starting a container image. |
working_dir |
String |
Working directory of an image container. |
uid |
String |
User ID of an image container. |
gid |
String |
User group ID of an image container. |
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 functions.
GET https://{Endpoint}/v2/{project_id}/fgs/functions/{function_urn}/versions
Example Responses
Status code: 200
OK
{ "versions" : [ { "func_urn" : "urn:fss:xxxxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test", "func_name" : "test", "domain_id" : "14ee2e3501124efcbca7998baa24xxxx", "namespace" : "46b6f338fc3445b8846c71dfb1fbxxxx", "project_name" : "xxxxx", "package" : "default", "runtime" : "Node.js6.10", "timeout" : 3, "handler" : "test.handler", "memory_size" : 128, "cpu" : 300, "code_type" : "inline", "code_filename" : "index.js", "code_size" : 272, "digest" : "faa825575c45437cddd4e369bea69893bcbe195d478178462ad90984fe72993f3f59d15f41c5373f807f3e05fb9af322c55dabeb16565c386e402413458e6068", "version" : "latest", "image_name" : "latest-191025153727@zehht", "last_modified" : "2019-10-25 15:37:27", "strategy_config" : { "concurrency" : 0 } } ], "next_marker" : 5 }
Status code: 404
Not found.
{ "error_code" : "FSS.1051", "error_msg" : "Not found the function" }
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