Mengkueri informasi tentang fungsi.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
fc:GetFunction |
get |
*All Resource
|
None | None |
Sintaks permintaan
GET /2021-04-06/services/{serviceName}/functions/{functionName} HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| serviceName |
string |
Yes |
Nama layanan. |
service_name |
| functionName |
string |
Yes |
Nama fungsi. |
function_name |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| qualifier |
string |
No |
Versi atau alias layanan. |
demoQualifier |
| X-Fc-Account-Id |
string |
No |
ID akun Alibaba Cloud Anda. |
188077086902**** |
| X-Fc-Date |
string |
No |
Waktu saat fungsi dipanggil. Format nilainya adalah: EEE,d MMM yyyy HH:mm:ss GMT. |
Wed, 11 May 2022 09:00:00 GMT |
| X-Fc-Trace-Id |
string |
No |
ID permintaan kustom. |
asdf**** |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
The definition of the function. |
||
| codeChecksum |
string |
The CRC-64 value of the function code package. |
2825179536350**** |
| codeSize |
integer |
The size of the function code package. Unit: byte. |
421 |
| createdTime |
string |
The time when the function was created. |
2020-04-01T08:15:27Z |
| description |
string |
The description of the function. |
test_description |
| environmentVariables |
object |
The environment variables that are configured for the function. You can obtain the values of the environment variables from the function. For more information, see Environment variables. |
|
|
string |
The environment variables that you configured for the function. |
{"key":"value"} |
|
| functionId |
string |
The ID that is generated by the system for the function. Each function ID is unique in Function Compute. |
aa715851-1c20-4b89-a8fb-*** |
| functionName |
string |
The name of the function. |
function_name |
| handler |
string |
The handler of the function. For more information, see Function handler. |
index.handler |
| lastModifiedTime |
string |
The time when the function was last modified. |
2020-04-01T08:15:27Z |
| memorySize |
integer |
The memory size for the function. Unit: MB. The value must be a multiple of 64. The memory size varies based on the function instance type. For more information, see Instance types. |
256 |
| runtime |
string |
The runtime of the function. Valid values: nodejs20, nodejs18, nodejs16, nodejs14, nodejs12, nodejs10, nodejs8, nodejs6, nodejs4.4, python3.10, python3.9, python3, python2.7, java11, java8, go1, php7.2, dotnetcore2.1, custom.debian10, custom, and custom-container. |
python3 |
| timeout |
integer |
The timeout period for the execution of the function. Unit: seconds. Default value: 60. Valid values: 1 to 600. When this period expires, the execution of the function is terminated. |
60 |
| initializationTimeout |
integer |
The timeout period for the execution of the Initializer hook. Unit: seconds. Default value: 3. Valid values: 1 to 300. When this period ends, the execution of the Initializer hook is terminated. |
60 |
| initializer |
string |
The handler of the Initializer hook. The format of the value is determined by the programming language that you use. For more information, see Initializer hook. |
index.handler |
| caPort |
integer |
The port on which the HTTP server listens for the custom runtime or custom container runtime. |
9000 |
| customContainerConfig | CustomContainerConfigInfo |
The configurations of the Custom Container runtime. After you configure the Custom Container runtime, you can use a custom container image to execute functions. |
|
| layers |
array |
The list of layers (ARN V1). Catatan
If multiple layers exist, the layers are merged based on the array subscripts in descending order. The content of a layer with a smaller subscript overwrites that of a larger subscript. Catatan
This parameter is to be deprecated. Use layersArnV2. |
|
|
string |
The name of the layer resource (ARN V1 version). |
02f81d283888f5ec63442a88fe82b260#Layer-name#1 |
|
| instanceConcurrency |
integer |
The number of requests that can be concurrently processed by a single instance. |
10 |
| instanceSoftConcurrency |
integer |
The soft concurrency of the instance. You can use this parameter to implement graceful scale-up of instances. If the number of concurrent requests on an instance is greater than the value of soft concurrency, an instance scale-up is triggered. For example, if your instance requires a long time to start, you can specify a suitable soft concurrency to start the instance in advance. The value must be less than or equal to that of the instanceConcurrency parameter. |
5 |
| instanceType |
string |
The instance type of the function. Valid values:
|
e1 |
| instanceLifecycleConfig |
InstanceLifecycleConfig |
The lifecycle configurations of instances. |
|
| customDNS | CustomDNS |
The custom Domain Name System (DNS) settings of the function. |
|
| customRuntimeConfig | CustomRuntimeConfig |
The configurations of the function that runs in the custom runtime. |
|
| customHealthCheckConfig | CustomHealthCheckConfig |
The custom health check configurations of the function. This parameter is applicable only to custom runtimes and Custom Container runtimes. |
|
| layersArnV2 |
array |
The list of layers (ARN V2). Catatan
If multiple layers exist, the layers are merged based on the array subscripts in descending order. The content of a layer with a smaller subscript overwrites that of a larger subscript. |
|
|
string |
The name of the layer resource (ARN V2 version). |
acs:fc:{region}:{accountID}:layers/{layerName}/versions/{layerVersion} |
|
| cpu |
number |
The number of vCPUs of the function. The value must be a multiple of 0.05. |
1.5 |
| diskSize |
integer |
The disk size of the function. Unit: MB. Valid values: 512 and 10240. |
512 |
| gpuMemorySize |
integer |
The GPU memory capacity for the function. Unit: MB. The value is a multiple of 1,024. |
2048 |
Contoh
Respons sukses
JSONformat
{
"codeChecksum": "2825179536350****",
"codeSize": 421,
"createdTime": "2020-04-01T08:15:27Z",
"description": "test_description",
"environmentVariables": {
"key": "{\"key\":\"value\"}"
},
"functionId": "aa715851-1c20-4b89-a8fb-***",
"functionName": "function_name",
"handler": "index.handler",
"lastModifiedTime": "2020-04-01T08:15:27Z",
"memorySize": 256,
"runtime": "python3",
"timeout": 60,
"initializationTimeout": 60,
"initializer": "index.handler",
"caPort": 9000,
"customContainerConfig": {
"args": "[\"-arg1\", \"value1\"]",
"command": "[\"/code/myserver\"]",
"image": "registry-vpc.cn-hangzhou.aliyuncs.com/fc-demo/helloworld:v1beta1",
"accelerationType": "Default",
"accelerationInfo": {
"status": "Preparing"
},
"instanceID": "cri-xxxxxxxxxx",
"webServerMode": true
},
"layers": [
"02f81d283888f5ec63442a88fe82b260#Layer-name#1"
],
"instanceConcurrency": 10,
"instanceSoftConcurrency": 5,
"instanceType": "e1",
"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
},
"layersArnV2": [
"acs:fc:{region}:{accountID}:layers/{layerName}/versions/{layerVersion}"
],
"cpu": 1.5,
"diskSize": 512,
"gpuMemorySize": 2048
}
Kode kesalahan
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.