YAML File
Complete YAML Configuration
edition: 1.0.0 # YAML specifications version for the command line, which complies with the Semantic Versioning specifications. name: fg-test # Project name access: "default" # Key alias vars: # Global variables region: "cn-east-3" functionName: "start-fg-event-nodejs14" services: component-test: # Service name component: fgs # Component name props: region: ${vars.region} function: functionName: ${vars.functionName} # Function name handler: index.handler # Handler memorySize: 256 # Memory required for the function timeout: 30 # Timeout for executing the function runtime: Node.js14.18 # Runtime agencyName: fgs-vpc-test # Agency name environmentVariables: # Environment variables test: test hello: world vpcId: xxx-xxx # Unique ID of a Virtual Private Cloud (VPC) subnetId: xxx-xxx # Subnet ID concurrency: 10 # Maximum number of instances for the function concurrentNum: 10 # Maximum number of concurrent requests per instance codeType: zip # Function code type dependVersionList: # Dependency ID - xxx-xxx code: # Local code address codeUri: ./code trigger: triggerTypeCode: TIMER # Trigger type status: DISABLED # Trigger status eventData: # Trigger configuration name: APIG_test # API name groupName: APIGroup_xxx # Group name auth: IAM # Security authentication protocol: HTTPS # Request protocol timeout: 5000 # Backend timeout duration
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 of the function. Currently, the the following runtimes are supported:
|
package |
False |
String |
Package (or group) to which the function belongs. The default value is 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 |
Maximum duration the function can be executed. Value range: 3s–900s. |
Code Type |
True |
String |
Function code type. Options:
|
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 |
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 IAM. This is required when the function needs to access other services. |
vpcId |
False |
String |
Unique ID of a VPC. agencyName is required if you set this parameter. Log in to the VPC Console to view the VPC ID. |
subnetId |
False |
String |
Subnet ID. agencyName is required if you set this parameter. To obtain the subnet ID, log in to the VPC Subnet page. |
dependVersionList |
False |
List<String> |
Dependency package IDs. |
code |
False |
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 1,000. –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 1,000. |
description |
False |
String |
Brief description of function. |
- Func Code parameters
Table 3 Func Code parameters Parameter Name
Required
Type
Description
codeUri
True
String
Local code address
- Environment variables
Do not write sensitive information to s.yaml in plaintext.
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
Description of triggers Fields
The triggers fields in the YAML file are described in Table 4.
Parameter Name |
Required |
Type |
Description |
---|---|---|---|
triggerTypeCode |
True |
String |
Trigger type |
status |
False |
Enum |
Trigger status. Options: ACTIVE (default) and DISABLED |
eventData |
True |
Struct |
- APIG trigger
Table 5 APIG trigger parameters Parameter Name
Required
Type
Description
name
False
String
API name. The function name is used by default.
groupName
False
String
Group. The first one is selected by default.
auth
False
Enum
Authentication mode. Default: IAM.
API authentication mode. Options:- App: AppKey and AppSecret high security authentication. This authentication mode is recommended. For details, see App Authentication.
- IAM: IAM authentication. Only IAM users are allowed to access the system. The security level is medium. For details, see IAM Authentication.
- None: No authentication. This mode grants access permissions to all users.
protocol
False
Enum
Request protocol. Default: HTTPS.
Options:
- HTTP
- HTTPS
timeout
False
Number
Backend timeout in milliseconds. Range: 1–60,000. Default: 5000.
Example:trigger: triggerTypeCode: APIG status: ACTIVE eventData: name: APIG_test groupName: APIGroup_xxx auth: IAM protocol: HTTPS timeout: 5000
- Timer trigger
Table 6 Timer trigger parameter description Parameter Name
Required
Type
Description
name
False
String
Timer name.
scheduleType
True
Enum
Trigger rule. The value can be Rate or Cron.
schedule
True
String
Timer rule content.
userEvent
False
String
Additional information, which will be put into the user_event field of the timer event source.
Example:trigger: triggerTypeCode: TIMER status: ACTIVE eventData: name: Timer-xxx scheduleType: Rate schedule: 3m userEvent: xxxx trigger: triggerTypeCode: TIMER status: ACTIVE eventData: name: Timer-xxx scheduleType: Cron schedule: 0 15 2 * * ? userEvent: xxxx
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot