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.
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.
Parameter |
Description |
---|---|
* Function Type |
|
*Region |
Select a region where you will deploy your code. |
*Function Name |
Name of the function, which must meet the following requirements:
|
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. |
Runtime |
Select a runtime to compile the function. NOTICE:
CloudIDE supports Node.js and Python only. |
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.
Code attributes show the code size and the time the code was modified.
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 5.
Once a function is created, the runtime cannot be changed.
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 |
Python |
Memory (MB): 128 Handler: index.handler Execution Timeout (s): 3 |
Go 1.x |
Memory (MB): 128 Handler: handler Execution Timeout (s): 3 |