获取函数列表。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
fc:ListFunctions |
get |
*全部资源
|
无 | 无 |
请求语法
GET /2021-04-06/services/{serviceName}/functions HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| serviceName |
string |
是 |
服务名称。 |
demoService |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| qualifier |
string |
否 |
服务的版本 ID 或者别名。 |
LATEST |
| limit |
integer |
否 |
限定此次返回资源的数量。如果不设定,默认返回 20,最大不能超过 100。返回结果可能小于指定的数量,但不会多于指定的数量。 |
20 |
| nextToken |
string |
否 |
用来返回更多结果。第一次查询不需要提供这个参数,后续查询的 Token 从返回结果中获取。 |
8bj81uI8n**** |
| prefix |
string |
否 |
限定返回的资源名称必须以 prefix 作为前缀。 |
demoFunctionsPrefix |
| startKey |
string |
否 |
设定结果从 startKey 之后(包括 startKey)按字母排序的第一个开始返回。 |
demoStartKey |
| X-Fc-Account-Id |
string |
否 |
您的阿里云账号(主账号)ID。 |
188077086902**** |
| X-Fc-Date |
string |
否 |
调用开始日期,格式为EEE,d MMM yyyy HH:mm:ss GMT。 |
Wed, 11 May 2022 09:00:00 GMT |
| X-Fc-Trace-Id |
string |
否 |
自定义请求 ID。 |
rid281s****** |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
获取函数列表返回值。 |
||
| functions |
array<object> |
函数列表。 |
|
|
array<object> |
函数的定义。 |
||
| codeChecksum |
string |
函数代码包的 CRC64 值。 |
5434025278388143772 |
| codeSize |
integer |
系统返回的函数代码包的大小,单位为 Byte。 |
1024 |
| createdTime |
string |
函数创建时间。 |
2016-08-15T15:00:00.000+0000 |
| customContainerConfig | CustomContainerConfig |
Custom Container 运行的相关配置。 |
|
| description |
string |
函数描述。 |
This is a demo hello world function |
| environmentVariables |
object |
为函数设置的环境变量,可以在函数中获取环境变量的值。 |
|
|
string |
环境变量配置。 |
{"key":"value"} |
|
| functionId |
string |
系统为每个函数生成的唯一 ID。 |
2d28e0e9-9ba5-4eed-8b1a-d3d9cd24**** |
| functionName |
string |
函数名称。 |
demo-function |
| handler |
string |
函数的执行入口。 |
index.handler |
| lastModifiedTime |
string |
函数上次修改时间。 |
2016-08-15T17:00:00.000+0000 |
| memorySize |
integer |
函数设置的内存大小,单位为 MB。 |
512 |
| runtime |
string |
函数运行的语言环境。目前支持 nodejs16、nodejs14、nodejs12、nodejs10、nodejs8、nodejs6、nodejs4.4、python3.10、python3.9、python3、python2.7、java11、java8、go1、php7.2、dotnetcore3.1、dotnetcore2.1、custom.debian10、custom 和custom-container。更多信息,请参见支持的函数运行环境列表。 |
python3.9 |
| timeout |
integer |
函数运行的超时时间,单位为秒,默认 60 秒。最小 1 秒,最长 10 分钟。如果函数运行超过设置的时间,函数运行将被终止。 |
10 |
| initializationTimeout |
integer |
初始化函数运行的超时时间,单位为秒,默认 3 秒。最小 1 秒,最长 5 分钟。初始化函数超过这个时间后会被终止执行。 |
60 |
| initializer |
string |
初始化函数执行的入口,具体格式与语言相关,更多信息,请参见 Initializer 函数。 |
index.handler |
| caPort |
integer |
自定义、自定义容器运行时 HTTP Server 的监听端口。 |
9000 |
| instanceConcurrency |
integer |
单个函数实例的并发度。 |
10 |
| instanceSoftConcurrency |
integer |
实例软并发度,用于优雅扩容。当实例上的并发数超过软并发度时,会触发实例扩容。例如,您的实例启动较慢,可以通过设置合适的软实例并发度,提前启动实例。 取值小于或等于 instanceConcurrency。 |
5 |
| instanceType |
string |
函数的实例类型,取值如下:
|
e1 |
| layers |
array |
层的列表。 说明
多个层会按照数组下标从大到小的顺序进行合并,下标小的层的内容会覆盖下标大的层的同名文件。 |
|
|
string |
层资源的名称。 |
02f81d283888f5ec63442a88fe82b260#Layer-name#1 |
|
| layersArnV2 |
array |
层的 arn 列表 |
|
|
string |
acs:fc:cn-hangzhou:official:layers/Python310/versions/2 |
||
| instanceLifecycleConfig | InstanceLifecycleConfig |
实例生命周期配置。 |
|
| customDNS | CustomDNS |
函数自定义 DNS 配置 |
|
| customRuntimeConfig | CustomRuntimeConfig |
Custom Runtime 函数详细配置 |
|
| customHealthCheckConfig | CustomHealthCheckConfig |
函数自定义健康检查配置,仅适用于 Custom Runtime 和 Custom Container。 |
|
| cpu |
number |
函数的 CPU 规格,单位为 vCPU,为 0.05 vCPU 的倍数。 |
1.5 |
| diskSize |
integer |
函数的磁盘规格,单位为 MB,可选值为 512 MB 或 10240 MB。 |
512 |
| gpuMemorySize |
integer |
function 的 GPU 显存规格,单位为 MB,为 1024MB 的倍数 |
2048 |
| nextToken |
string |
用来返回更多的查询结果。如果这个值没有返回,则说明没有更多结果。 |
8bj81uI8n**** |
示例
正常返回示例
JSON格式
{
"functions": [
{
"codeChecksum": "5434025278388143772",
"codeSize": 1024,
"createdTime": "2016-08-15T15:00:00.000+0000",
"customContainerConfig": {
"args": "[\"-arg1\", \"value1\"]",
"command": "[\"/code/myserver\"]",
"image": "registry-vpc.cn-hangzhou.aliyuncs.com/fc-demo/helloworld:v1beta1",
"accelerationType": "Default",
"instanceID": "cri-xxxxxxxxxx",
"webServerMode": true
},
"description": "This is a demo hello world function",
"environmentVariables": {
"key": "{\"key\":\"value\"}"
},
"functionId": "2d28e0e9-9ba5-4eed-8b1a-d3d9cd24****",
"functionName": "demo-function",
"handler": "index.handler",
"lastModifiedTime": "2016-08-15T17:00:00.000+0000",
"memorySize": 512,
"runtime": "python3.9",
"timeout": 10,
"initializationTimeout": 60,
"initializer": "index.handler",
"caPort": 9000,
"instanceConcurrency": 10,
"instanceSoftConcurrency": 5,
"instanceType": "e1",
"layers": [
"02f81d283888f5ec63442a88fe82b260#Layer-name#1"
],
"layersArnV2": [
"acs:fc:cn-hangzhou:official:layers/Python310/versions/2"
],
"instanceLifecycleConfig": {
"preFreeze": {
"handler": "index.preStop",
"timeout": 10
},
"preStop": {
"handler": "index.preStop",
"timeout": 10
}
},
"customDNS": {
"nameServers": [
"8.8.x.x"
],
"searches": [
"ns1.svc.cluster-domain.example"
],
"dnsOptions": [
{
"name": "ndots",
"value": "2"
}
]
},
"customRuntimeConfig": {
"command": [
"/code/myBootstrap"
],
"args": [
"args1"
]
},
"customHealthCheckConfig": {
"httpGetUrl": "/ready",
"initialDelaySeconds": 1,
"periodSeconds": 1,
"timeoutSeconds": 2,
"failureThreshold": 1,
"successThreshold": 2
},
"cpu": 1.5,
"diskSize": 512,
"gpuMemorySize": 2048
}
],
"nextToken": "8bj81uI8n****"
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。