Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
Huawei Cloud Astro Canvas
Huawei Cloud Astro Zero
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance (CCI)
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Cloud Transformation
Well-Architected Framework
Cloud Adoption Framework
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

YAML File

Updated on 2025-03-14 GMT+08:00

Complete YAML Configuration

The YAML fields of Huawei Cloud FunctionGraph component are as follows:
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
Table 1 Parameter description

Parameter

Required

Type

Description

region

True

Enum

Region

function

True

Struct

Function

triggers

False

Struct

Triggers

Description of function Fields

The function fields in the YAML file are described in Table 2.

Table 2 Description of function fields

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:

  • 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

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:

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

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 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

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 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
    Object format. For example:
    DB_connection: jdbc:mysql://ip:port/dbname

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

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

Description of triggers Fields

The triggers fields in the YAML file are described in Table 4.

Table 4 trigger parameter description

Parameter Name

Required

Type

Description

triggerTypeCode

True

String

Trigger type

status

False

Enum

Trigger status. Options: ACTIVE (default) and DISABLED

eventData

True

Struct

Trigger configurations, including APIG and timer triggers

  • 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

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback