Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.

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
Help Center/ FunctionGraph/ User Guide (Kuala Lumpur Region)/ FAQs/ Function Creation FAQs/ What Are the Rules for Packaging a Function Project?
Updated on 2024-08-07 GMT+08:00

What Are the Rules for Packaging a Function Project?

In addition to inline code editing, you can create a function by uploading a ZIP or JAR file, or uploading a ZIP file from OBS. For details, see Packaging Rules and Example ZIP Project Packages.

Packaging Rules

In addition to inline code editing, you can create a function by uploading a local ZIP file or JAR file, or uploading a ZIP file from Object Storage Service (OBS). Table 1 describes the rules for packaging a function project.

Table 1 Function project packaging rules

Runtime

JAR File

ZIP File

ZIP File on OBS

Node.js

Not supported.

  • If the function project files are saved under the ~/Code/ directory, select and package all files under this directory to ensure that the function handler is under the root directory after the ZIP file is decompressed.
  • If the function project uses third-party dependencies, package the dependencies into a ZIP file, and import the ZIP file on the function code page. Alternatively, package the third-party dependencies and the function project files together.

Compress project files into a ZIP file and upload it to an OBS bucket.

PHP

Not supported.

  • If the function project files are saved under the ~/Code/ directory, select and package all files under this directory to ensure that the function handler is under the root directory after the ZIP file is decompressed.
  • If the function project uses third-party dependencies, package the dependencies into a ZIP file, and import the ZIP file on the function code page. Alternatively, package the third-party dependencies and the function project files together.

Compress project files into a ZIP file and upload it to an OBS bucket.

Python 2.7

Not supported.

  • If the function project files are saved under the ~/Code/ directory, select and package all files under this directory to ensure that the function handler is under the root directory after the ZIP file is decompressed.
  • If the function project uses third-party dependencies, package the dependencies into a ZIP file, and import the ZIP file on the function code page. Alternatively, package the third-party dependencies and the function project files together.

Compress project files into a ZIP file and upload it to an OBS bucket.

Python 3.6

Not supported.

  • If the function project files are saved under the ~/Code/ directory, select and package all files under this directory to ensure that the function handler is under the root directory after the ZIP file is decompressed.
  • If the function project uses third-party dependencies, package the dependencies into a ZIP file, and import the ZIP file on the function code page. Alternatively, package the third-party dependencies and the function project files together.

Compress project files into a ZIP file and upload it to an OBS bucket.

Java 8

If the function does not reference third-party components, compile only the function project files into a JAR file.

If the function references third-party components, compile the function project files into a JAR file, and compress all third-party components and the function JAR file into a ZIP file.

Compress project files into a ZIP file and upload it to an OBS bucket.

Go 1.8

Not supported.

Compress project files into a ZIP file, and ensure that the name of the dynamic library file is consistent with the handler plugin name. For example, if the name of the dynamic library file is testplugin.so, set the handler plugin name to testplugin.Handler. Handler indicates the function handler.

Compress project files into a ZIP file and upload it to an OBS bucket.

Go 1.x

Not supported.

Zip the compiled file and ensure that the name of the binary file is consistent with that of the handler. For example, if the name of the binary file is Handler, set the name of the handler to Handler.

Compress project files into a ZIP file and upload it to an OBS bucket.

C#

Not supported.

Compress project files into a ZIP file. The ZIP file must contain the following files: Project_name.deps.json, Project_name.dll, Project_name.runtimeconfig.json, Project_name.pdb, and HC.Serverless.Function.Common.dll.

Compress project files into a ZIP file and upload it to an OBS bucket.

Custom

Not supported.

Compress project files into a ZIP file. The ZIP file must contain a bootstrap file.

Compress project files into a ZIP file and upload it to an OBS bucket.

Example ZIP Project Packages

  • Example directory of a Nods.js project package
    Example.zip                            Example project package
    |--- lib                               Service file directory
    |--- node_modules                      NPM third-party component directory
    |--- index.js                          .js handler file (mandatory)
    |--- package.json                      NPM project management file
  • Example directory of a PHP project package
    Example.zip                            Example project package
    |--- ext                               Extension library directory
    |--- pear                              PHP extension and application repository
    |--- index.php                         PHP handler file
  • Example directory of a Python project package
    Example.zip                            Example project package
    |--- com                               Service file directory
    |--- PLI                               Third-party dependency PLI directory
    |--- index.py                          .py handler file (mandatory)
    |--- watermark.py                      .py file for image watermarking
    |--- watermark.png                     Watermarked image
  • Example directory of a Java project package
    Example.zip                            Example project package
    |--- obstest.jar                       Service function JAR file
    |--- esdk-obs-java-3.20.2.jar          Third-party dependency JAR file
    |--- jackson-core-2.10.0.jar           Third-party dependency JAR file
    |--- jackson-databind-2.10.0.jar       Third-party dependency JAR file
    |--- log4j-api-2.12.0.jar              Third-party dependency JAR file
    |--- log4j-core-2.12.0.jar             Third-party dependency JAR file
    |--- okhttp-3.14.2.jar                 Third-party dependency JAR file
    |--- okio-1.17.2.jar                   Third-party dependency JAR file
  • Example directory of a Go project package
    Example.zip                            Example project package
    |--- testplugin.so                     Service function package
  • Example directory of a C# project package
    Example.zip                                   Example project package
    |--- fssExampleCsharp2.0.deps.json            File generated after project compilation
    |--- fssExampleCsharp2.0.dll                  File generated after project compilation
    |--- fssExampleCsharp2.0.pdb                  File generated after project compilation
    |--- fssExampleCsharp2.0.runtimeconfig.json   File generated after project compilation
    |--- Handler                                  Help file, which can be directly used
    |--- HC.Serverless.Function.Common.dll        .dll file provided by FunctionGraph
  • Custom
    Example.zip                                   Example project package
    |--- bootstrap                                Executable boot file

Kami menggunakan cookie untuk meningkatkan kualitas situs kami dan pengalaman Anda. Dengan melanjutkan penelusuran di situs kami berarti Anda menerima kebijakan cookie kami. Cari tahu selengkapnya