All Products
Search
Document Center

Function Compute:GetFunction

Last Updated:Jun 02, 2023

Queries the information about a function.

Authorization information

There is currently no authorization information disclosed in the API.

Request syntax

GET /2021-04-06/services/{serviceName}/functions/{functionName}

Request parameters

ParameterTypeRequiredDescriptionExample
serviceNamestringYes

The name of the function.

service_name
qualifierstringNo

The ID of your Alibaba Cloud account.

demoQualifier
functionNamestringYes

The time on which the function is invoked. The format of the value is: EEE,d MMM yyyy HH:mm:ss GMT.

function_name
X-Fc-Account-IdstringNo

The custom request ID.

188077086902****
X-Fc-DatestringNo

The value that is used to ensure that the modified function is consistent with the function that is expected to be modified.

Wed, 11 May 2022 09:00:00 GMT
X-Fc-Trace-IdstringNo

The definition of the function.

asdf****

Response parameters

ParameterTypeDescriptionExample
headersobject
ETagstring

The CRC-64 value of the function code package.

function_name
object

The size of the function code package. Unit: byte.

codeChecksumstring

The time when the function was created.

2825179536350****
codeSizelong

The description of the function.

421
createdTimestring

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.

2020-04-01T08:15:27Z
descriptionstring

The environment variables that you configured for the function.

test_description
environmentVariablesobject

The ID that is generated by the system for the function. Each function ID is unique in Function Compute.

string

The name of the function.

{"key":"value"}
functionIdstring

The handler of the function. For more information, see Function handler.

aa715851-1c20-4b89-a8fb-***
functionNamestring

The time when the function was last modified.

function_name
handlerstring

The memory size for the function. Unit: MB. The memory size must be a multiple of 64 MB. The memory size varies based on the function instance type. For more information, see Instance types.

index.handler
lastModifiedTimestring

The runtime environment of the function. Valid values: nodejs16, nodejs14, nodejs12, nodejs10, nodejs8, nodejs6, nodejs4.4, python3.9, python3, python2.7, java11, java8, go1, php7.2, dotnetcore2.1, custom, and custom-container.

2020-04-01T08:15:27Z
memorySizeinteger

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.

256
runtimestring

The timeout period for the execution of the initializer function. Unit: seconds. Default value: 3. Valid values: 1 to 300. When this period ends, the execution of the initializer function is terminated.

python3
timeoutinteger

The handler of the initializer function. The format of the value is determined by the programming language that you use. For more information, see Initializer function.

60
initializationTimeoutinteger

The port on which the HTTP server listens for the custom runtime or custom container runtime.

60
initializerstring

The configurations of the custom container runtime. After you configure the custom container runtime, Function Compute can execute the function in a container created from a custom image.

index.handler
caPortinteger

The list of layers (ARN V1 version).

NoteIf multiple layers exist, the layers are merged based on the order of array subscripts. The content of a layer with a smaller subscript overwrites the file with the same name in the layer with a larger subscript. >

**

Warning: This parameter is to be deprecated. Use layersArnV2.

9000
customContainerConfigCustomContainerConfigInfo

The name of the layer resource (ARN V1 version).

layersarray

The number of requests that can be concurrently processed by a single instance.

string

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 number of the soft concurrency, the 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.

02f81d283888f5ec63442a88fe82b260#Layer-name#1
instanceConcurrencyinteger

The instance type of the function. Valid values:

  • e1: elastic instance
  • c1: performance instance
  • fc.gpu.tesla.1: GPU-accelerated instances (Tesla T4)
  • fc.gpu.ampere.1: GPU-accelerated instances (Ampere A10)
  • g1: same fc.gpu.tesla.1
10
instanceSoftConcurrencyinteger

The lifecycle configurations of the instance.

5
instanceTypestring

The custom DNS configurations of the function.

e1
instanceLifecycleConfigInstanceLifecycleConfig

The configurations of the custom runtime.

customDNSCustomDNS

The custom health check configuration of the function. This parameter is applicable only to custom runtimes and custom containers.

customRuntimeConfigCustomRuntimeConfig

The list of layers (ARN V2 version).

NoteIf multiple layers exist, the layers are merged based on the order of array subscripts. The content of a layer with a smaller subscript overwrites the file that has the same name and a larger subscript in the layer.
customHealthCheckConfigCustomHealthCheckConfig

The name of the layer resource (ARN V2 version).

layersArnV2array

The number of vCPUs of the function. The value must be a multiple of 0.05.

string

The disk size of the function. Unit: MB. Valid values: 512 and 10240.

acs:fc:{region}:{accountID}:layers/{layerName}/versions/{layerVersion}
cpufloat

The GPU memory capacity for the function. Unit: MB. The memory capacity must be a multiple of 1024 MB.

1.5

Examples

Sample success responses

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
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2021-06-30The input parameters of the API operation change.
Change itemChange content
Input ParametersThe input parameters of the API operation change.
    Added Input Parameters: X-Fc-Account-Id
    Added Input Parameters: X-Fc-Code-Checksum
    Added Input Parameters: X-Fc-Log-Type
    Added Input Parameters: X-Fc-Invocation-Type
    Added Input Parameters: X-Fc-Date
    Added Input Parameters: X-Fc-Trace-Id
2021-06-30The input parameters of the API operation change.,The response structure of the API operation changes.
Change itemChange content
Input ParametersThe input parameters of the API operation change.
    Added Input Parameters: X-Fc-Account-Id
Output ParametersThe response structure of the API operation changes.
2021-06-30The input parameters of the API operation change.,The response structure of the API operation changes.
Change itemChange content
Input ParametersThe input parameters of the API operation change.
    delete Input Parameters: X-Fc-Account-Id
Output ParametersThe response structure of the API operation changes.