Help Center/ FunctionGraph/ User Guide/ Managing Functions Using KooCLI
Updated on 2026-08-24 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 access key–based 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. Use temporary access keys (Access Key ID, Secret Access Key, and Token) to enhance security. For details about the temporary access keys, see Temporary Access Key (for Federated Users).
  • 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

Using 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").

    • Log in to the console and obtain the AK/SK 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 your access key is lost or needs to be reset, contact the account administrator to generate a new access key in IAM and send it to you. 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

    You can also configure authentication information using the temporary AK, SK, and token.

    hcloud configure set --cli-profile=default --cli-access-key=your-ak --cli-secret-key=your-sk --cli-security-token=your-token

  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. The information similar to that shown in Figure 5 is returned.

    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.

API Calling in the Non-configuration Mode

KooCLI allows you to can call cloud service APIs using a profile or do so in non-configuration mode, where you can specify temporary AK, SK, and token in the CLI. For details, see Non-configuration Mode Overview.

The following is an example command:

hcloud FunctionGraph InvokeFunction --cli-region="ap-southeast-1" --cli-access-key=your-ak --cli-secret-key=your-sk --cli-security-token=your-token --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"

Configuring a Network Proxy Using KooCLI

Run the following command to set a proxy:

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

For details, see Set/Export http_proxy With Special Characters In Password Under Unix / Linux.