Updated on 2026-11-06 GMT+08:00

Creating a Function with FunctionGraph

Learn about the process of using FunctionGraph.

Step 1: Creating a Function

  1. Log in to the FunctionGraph console.
  2. In the navigation pane on the left, choose Functions > Function List. On the displayed page, click Create Function.
    Figure 1 Creating a function
  3. Click Create from scratch and configure required parameters.

    For details about the parameters, see Creating an Event Function.

Step 2: Configuring the Function

  1. Set the function handler.
    1. After the function is created, click the function name in the list to go to its details page.
    2. Choose Configuration > Basic Settings and set the UDTF handler in the Handler area.

      The UDTF handler is in the format of [Package name].[Class name].[Function name].

      • [Package name].[Class name] indicates the class where the UDTF is located.
      • The function name is fixed to handleRequest.

      In this example, it is set to com.huawei.demo.UDTFDemo.handleRequest.

    3. After the setting is complete, click Save.
  2. Set the execution timeout interval and memory.
    1. After the function is created, click the function name in the list to go to its details page.
    2. Choose Configuration > Basic Settings and set the execution time and memory.

      Configure the execution timeout interval and memory size based on the complexity of the UDTF. The memory size determines the billing.

      In this example, the execution time is set to 15 seconds and the memory is set to 1024 MB.

    3. After the setting is complete, click Save.
  3. Configure the class isolation.
    1. After the function is created, click the function name in the list to go to its details page.
    2. Choose Configuration > Advanced Settings and configure the Class Isolation option.

      After class isolation is enabled, an independent class loader is used to load the uploaded code and its dependencies, resolving dependency and runtime conflicts. You can disable class isolation if there is no dependency conflict.

    In this example, the class isolation is disabled. After the setting is complete, click Save.

Step 3: Uploading the JAR Package

  1. On the FunctionGraph console, click the target function name in the function list to go to its details page.
  2. Click the Code tab, select Local JAR from the Upload drop-down list on the right, and upload the exported JAR package.
  3. After the upload is successful, you can copy the Uniform Resource Name (URN) on the function details page. The URN uniquely identifies a function and will be used when the function is called.

Related Operation: Configuring an Agency for FunctionGraph to Access Other Cloud Services

  1. Log in to the management console.
  2. In the upper right corner of the page, hover over the username and select Identity and Access Management.
  3. In the navigation pane of the IAM console, choose Agencies.
  4. On the displayed page, click Create Agency.
  5. Set the following parameters:
    • Agency Name: Enter an agency name.
    • Agency Type: Select Cloud service.
    • Cloud Service: Select FunctionGraph from the drop-down list. This parameter is available only when you select Cloud service for Agency Type.
    • Validity Period: Select Unlimited.
    • Description: You can enter Agency with OBS OperateAccess permissions. This parameter is optional.
      Figure 2 Creating an agency
  6. After configuring the basic information, click OK.
  7. On the displayed page, search for the OBS Administrator permission in the search box on the right and select it. Then, click Next.
  8. Click Next. On the Select Scope page, set the authorization scope.

    For details about authorization operations, see Creating a User Group and Assigning Permissions.

    • All resources: IAM users will be able to use all resources, including those in enterprise projects, region-specific projects, and global services under your account based on assigned permissions.
    • Global services: Global services are deployed in all regions, so you can access them seamlessly without having to switch between regions. However, global services cannot be authorized based on regional projects. They include services like Object Storage Service (OBS) and Content Delivery Network (CDN). After authorization, you can use the selected services based on your permissions.
    • Region-specific projects: IAM users will be able to use resources in the selected region-specific projects based on assigned permissions.
    • Enterprise projects: IAM users will be able to use resources in the selected enterprise projects based on assigned permissions. For example, an enterprise project may contain resources that are deployed in different regions. After you associate the enterprise project with the IAM users, they can access the resources in this enterprise project based on the assigned permissions.

    In this example, an OBS policy is selected. Therefore, select Global services.

  9. Click OK.
  10. It takes 15 to 30 minutes for the authorization to be in effect.

    After the authorization takes effect, return to the function details page, select the corresponding agency. The authorized policy is displayed.