Updated on 2023-10-19 GMT+08:00

Description of the function Field

function Field

Table 1 Description of the function field

Parameter Name

Required

Type

Description

functionName

True

String

Function name

handler

True

String

Handler of the function in the format of "xx.xx". It must contain a period (.).

runtime

True

String

Runtime

package

False

String

Package (or group) to which the function belongs. Default: default

memorySize

True

Number

Memory size (MB) allocated to the function. The options include 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2560, 3072, 3584, and 4096.

timeout

True

Number

Timeout duration the function can be executed. Value range: 3s–900s.

Code Type

True

String

Function code type

codeUrl

False

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.

environmentVariables

False

Struct

Environment variable. A maximum of 20 environment variables can be defined. The total length cannot exceed 4 KB.

agencyName

False

String

Name of an agency created in Identity and Access Management (IAM). This is required when the function needs to access other services.

vpcId

False

String

Specifies the unique VPC (Virtual Private Cloud) ID. During configuration, agencyName is required. You can log in to the VPC Console to view the VPC ID.

subnetId

False

String

Subnet ID. agencyName is required when this parameter is set. To obtain the subnet ID, log in to the VPC Subnet page.

dependVersionList

False

List<String>

Dependency package ID

code

False

Struct

Local code address, which is required if CodeType is set to zip.

concurrency

False

Number

Maximum number of instances in which a function can run. Range: –1 to +1000. –1: The function can run in any number of instances. 0: The function is disabled.

concurrentNum

False

Number

Maximum number of concurrent requests per instance. Range: –1 to +1000

description

False

String

Brief description of a function

Example:
function:
  functionName: event-function
  description: this is a test
  runtime: Node.js14.18
  handler: index.handler
  memorySize: 128
  timeout: 60
  code: 
    codeUri: ./code
  environmentVariables:
    test: 123
    hello: world

runtime

Currently, the runtime supports the following versions:

  • Node.js 14.18, Node.js 12.13, Node.js 10.16, Node.js 8.10, Node.js 6, Node.js 4.4
  • Python 3.9, Python 3.6, Python 2.7
  • Java 11, Java 8
  • Go 1.x, Go 1.8
  • PHP 7.3
  • HTTP
  • Custom

Code Type

Supported code types:

  • inline: inline code
  • zip: ZIP file
  • obs: function code stored in an OBS bucket
  • jar: JAR file, mainly for Java functions

Func Code

Table 2 Func Code parameters

Parameter Name

Required

Type

Description

codeUri

True

String

Local code address

Environment Variables

Object format. For example:
DB_connection: jdbc:mysql://ip:port/dbname

Do not write sensitive information to s.yaml in plaintext.