Bu sayfa henüz yerel dilinizde mevcut değildir. Daha fazla dil seçeneği eklemek için yoğun bir şekilde çalışıyoruz. Desteğiniz için teşekkür ederiz.

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
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
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
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
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
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
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
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating an Event Function

Updated on 2024-11-12 GMT+08:00

Overview

A function is customized code for processing events. You can create a function from scratch and configure the function based on site requirements.

FunctionGraph manages the compute resources required for function execution. After editing code for your function, configure compute resources on the FunctionGraph console.

You can create a function from scratch or by using a template or container image.

NOTE:

When creating a function from scratch, configure the basic and code information based on Table 1. The parameters marked with an asterisk (*) are mandatory.

Each FunctionGraph function runs in its own environment and has its own resources and file system.

Prerequisites

  1. You must be familiar with the programming languages supported by FunctionGraph. For details, see Supported Programming Languages.
  2. You have created a deployment package. For details, see Creating a Deployment Package.
  3. (Optional) You have created an agency. For details, see Configuring Agency Permissions.

Procedure

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. On the Function List page, click Create Function in the upper right corner.
  3. Click Create from scratch and configure the function information by referring to Table 1. The parameters marked with an asterisk (*) are mandatory.
    Figure 1 Creating a function from scratch
    Table 1 Basic information

    Parameter

    Description

    * Function Type

    • Event functions: triggered by triggers.
    • HTTP functions: triggered once HTTP requests are sent to specific URLs.
      NOTE:
      • HTTP functions do not distinguish between programming languages. The handler must be set in the bootstrap file. You can directly write the startup command, and allow access over port 8000.
      • HTTP functions support APIG and APIC triggers only.
      • For details about how to use HTTP functions, see Creating an HTTP Function.

    *Region

    Select a region where you will deploy your code.

    *Function Name

    Name of the function, which must meet the following requirements:

    • Consists of 1 to 60 characters, and can contain letters, digits, hyphens (-), and underscores (_).
    • Starts with a letter and ends with a letter or digit.

    Agency

    An agency is required if FunctionGraph accesses other cloud services. For details on how to create an agency, see Configuring Agency Permissions.

    No agency is required if FunctionGraph does not access any cloud services.

    *Enterprise Project

    Select a created enterprise project and add the function to it. By default, default is selected.

    NOTE:

    If Enterprise Project Management Service (EPS) is not enabled, this parameter is unavailable. For details, see Enabling the Enterprise Project Function.

    Runtime

    Select a runtime to compile the function.

    NOTICE:

    CloudIDE supports Node.js, Python, and PHP only.

  4. Click Create Function. On the displayed Code tab page, continue to configure the code.

Configuring Code

  1. You can deploy the code based on the runtime you select. For details, see Creating a Deployment Package. After the deployment is complete, click Deploy.

    As shown in the following example, to deploy code in Node.js 10.16, you can edit code inline, upload a local ZIP file, or upload a ZIP file from OBS.

    Figure 2 Deploying code
    NOTE:

    If you deploy code by uploading a local ZIP file, ensure that the region selected for creating the function is the same as that selected for creating an OBS bucket.

  2. You can modify the code and click Deploy to deploy the code again.

Viewing Code Information

  1. View code attributes.
    Code attributes show the code size and the time the code was modified.
    Figure 3 Viewing code attributes
  2. View basic information.

    Configuring Basic Settings shows the default memory and execution timeout in each runtime. You can click Edit to switch to the Basic Settings page and modify Handler, Memory (MB), and Execution Timeout (s) as required. For details, see Figure 4.

    Figure 4 Editing basic information
    NOTICE:

    Once a function is created, the runtime cannot be changed.

    Table 2 Default basic information of each runtime

    Runtime

    Default Basic Information

    Java

    Memory (MB): 512

    Handler: com.demo.TriggerTests.apigTest

    Execution Timeout (s): 15

    Node.js

    Memory (MB): 128

    Handler: index.handler

    Execution Timeout (s): 3

    Custom

    Memory (MB): 128

    Handler: bootstrap

    Execution Timeout (s): 3

    PHP

    Memory (MB): 128

    Handler: index.handler

    Execution Timeout (s): 3

    Python

    Memory (MB): 128

    Handler: index.handler

    Execution Timeout (s): 3

    Go 1.x

    Memory (MB): 128

    Handler: handler

    Execution Timeout (s): 3

Sitemizi ve deneyiminizi iyileştirmek için çerezleri kullanırız. Sitemizde tarama yapmaya devam ederek çerez politikamızı kabul etmiş olursunuz. Daha fazla bilgi edinin

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback