Help Center/ FunctionGraph/ User Guide/ Managing Functions Using KooCLI
Updated on 2025-08-19 GMT+08:00

Managing Functions Using KooCLI

FunctionGraph provides the command line interface (CLI) for you to manage functions, triggers, and aliases, and invoke functions.

Notes and Constraints

  • When you access Huawei Cloud through an API, you must undergo AK/SK identity authentication with the access request encrypted, and ensure that the access request is secret, complete, and correct. Properly keep the config.yaml file to prevent unauthorized use of your access key.
  • If your access key is used by an unauthorized person (due to a loss or leakage), you can delete the access key or notify the administrator of resetting it and configure it again.
  • Deleted access keys cannot be recovered.

KooCLI Download Links

KooCLI can run on a 64-bit Linux x86 operating system (OS), 64-bit Windows OS, or macOS. Table 1 provides the download links of KooCLI.

Table 1 Download links of CLI

OS

Software Package and Verification File

Reference

Linux

KooCLI and Verification File

KooCLI Overview

Windows

Mac

Installing KooCLI

  1. Install KooCLI. For details, see Installing KooCLI in Linux.
  2. Obtain an access key (access key ID and secret access key, also called "AK/SK").
    • If you have access to the console, log in to it, and create an access key on the My Credentials page. For details, see Creating an Access Key. An AK/SK file is downloaded. Generally, it is named credentials.csv. As shown in the following figure, the file contains a username, AK, and SK.
      Figure 1 Content of the credentials.csv file
    • If you do not have access to the console, request the administrator to create an access key for you on the IAM console in case your access key is lost or needs to be reset. For details, see Managing Access Keys for an IAM User.
  3. Obtain a region name. For details, see Regions and Endpoints.
    Figure 2 Obtaining region information
  4. Initialize KooCLI.

    Run the following command to initialize KooCLI:

    hcloud configure init

    Enter an access key ID, secret access key, and region name. If the information shown in Figure 3 is displayed, the initialization is successful.

    Figure 3 Initialization successful
  5. Run the following command to view the commands supported by FunctionGraph. As shown in Figure 4, Available Operations lists the operations supported by FunctionGraph.
    hcloud FunctionGraph --help
    Figure 4 Operations supported by FunctionGraph

    Run the following command to obtain help information about operation InvokeFunction. If the command is successfully executed, the information shown in Figure 5 is displayed.

    hcloud FunctionGraph InvokeFunction --help
    Figure 5 Help information about operation InvokeFunction

Invoking a Function

Before invoking a function, obtain the URN, as shown in Figure 6.

Figure 6 Obtaining a function URN
  • Synchronous invocation

    The following is an example command for synchronous invocation. For details about the parameters, see Table 2.

    hcloud FunctionGraph InvokeFunction --cli-region="ap-southeast-1" --X-Cff-Log-Type="tail" --X-CFF-Request-Version="v1" --function_urn="urn:fss:cn-east-3:******:function:default:hcloud-invoke:latest" --project_id="******" --key="value"
    Table 2 Parameters

    Parameter

    Mandatory

    Description

    --cli-region

    Yes

    Region where the target function is located.

    --function_urn

    Yes

    Function URN.

    --project_id

    Yes

    Project ID.

    --X-Cff-Log-Type

    No

    Options: tail (4 KB logs will be returned in the header) and null (no logs will be returned).

    X-CFF-Request-Version

    No

    Response body format. Options:

    • v0: text format.
    • v1: JSON format. Use this format when using an SDK.

    Body

    Yes

    Request body in --key="value" format. The JSON structure is {"key":"value"}.

    Figure 7 shows the output result. For details about the response parameters, see Table 3.

    Figure 7 Output result
    Table 3 Response parameter

    Parameter

    Type

    Description

    request_id

    String

    Request ID.

    result

    String

    Function execution result.

    log

    String

    Function execution log.

    status

    Integer

    Execution status.

    error_code

    String

    Error code.

  • Asynchronous invocation

    The following is an example command for asynchronous invocation. For details about the parameters, see Table 4.

    hcloud FunctionGraph AsyncInvokeFunction --cli-region="cn-east-3" --function_urn="urn:fss:cn-east-3:******:function:default:hcloud-invoke:latest" --project_id="******" --key="value"
    Table 4 Parameters

    Parameter

    Mandatory

    Description

    --cli-region

    Yes

    Region where the target function is located.

    --function_urn

    Yes

    Function URN.

    --project_id

    Yes

    Project ID.

    Body

    Yes

    Request body in --key="value" format. The JSON structure is {"key":"value"}.

    Figure 8 shows the output result. For details about the response parameters, see Table 3.

    Figure 8 Output result
    Table 5 Parameters in the response body

    Parameter

    Type

    Description

    request_id

    String

    Request ID.

Configuring a Network Proxy Using KooCLI

Run the following command to set a proxy:

export HTTP_PROXY="http://user:password@proxyIp:proxyPort"

For more information, see https://www.cyberciti.biz/faq/unix-linux-export-variable-http_proxy-with-special-characters/.