取得函式清單。
調試
您可以在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 |
系統傳回的函式程式碼套件的大小,單位為位元組。 |
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****"
}
錯誤碼
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。