npx skills add ...
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-functiongraph-function-create
Create FunctionGraph functions on Huawei Cloud. Use this skill when users ask to create, deploy, or upload cloud functions, serverless functions, or FunctionGraph functions. Triggered by keywords like "create function", "deploy function", "upload function", "create cloud function", "创建函数", "部署函数", "上传函数", "创建云函数", "FunctionGraph function", "serverless function".
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-functiongraph-function-create
This skill creates FunctionGraph functions on Huawei Cloud based on user-provided parameters including function name, runtime, and code content.
Architecture: Uses Huawei Cloud FunctionGraph Python SDK to interact with FunctionGraph service.
Applicable Scenarios:
Typical Use Cases:
python --versionSecurity Rules:
functiongraph:function:create - Create functionfunctiongraph:function:get - Query function detailsfunctiongraph:function:list - List functionsSee IAM Policies for detailed permission configuration.
|| Parameter | Required/Optional | Description | Default ||
|| ----------- | ------------------ | ------------- | --------- ||
|| function_name | Required | Function name, must follow naming rules | - ||
|| runtime | Required | Runtime environment (Python3.9, etc.) | - ||
|| code_content | Required | Function code content | - ||
|| handler | Required | Function entry point (e.g., index.handler) | - ||
|| memory_size | Optional | Memory size in MB | 128 ||
|| timeout | Optional | Timeout in seconds | 3 ||
|| description | Optional | Function description | - ||
|| Runtime | Handler Format | Example ||
|| --------- | ---------------- | --------- ||
|| Python3.9 | index.handler | def handler(event, context): ||
|| Node.js14.18 | index.handler | exports.handler = (event, context) => {} ||
|| Java8 | com.example.Handler::handleRequest | Java class method ||
|| Go1.x | handler | Go function name ||
See Verification Method for detailed procedures.
The skill returns a structured JSON object with the following fields:
function_urn: Unique resource identifier of the created functionfunction_name: Name of the created functionruntime: Runtime environmentmemory_size: Allocated memory in MBtimeout: Function timeout in secondshandler: Function entry pointdescription: Function description (if provided)Example output:
|| Error Code | Description | Resolution || || ------------ | ------------- | ------------ || || InvalidParameter | Invalid input parameters | Check parameter format and valu es || || InsufficientPermission | Insufficient permissions | Check IAM permissions || || QuotaExceeded | Resource quota exceeded | Request quota increase or delete un used functions || || FunctionAlreadyExists | Function with same name exists | Use different functi on name or delete existing function ||
cd scripts
python create_function.py --name <function_name> --runtime <runtime> --han
dler <handler> --code <code_content> --memory <memory_size> --timeout <timeout>## Verify function exists using SDK
from huaweicloudsdkfunctiongraph.v2.functiongraph_client import FunctionGraphClient
from huaweicloudsdkfunctiongraph.v2.model import ListFunctionsRequest
# List functions to verify creation
client = FunctionGraphClient.new_builder().build()
request = ListFunctionsRequest()
response = client.list_functions(request)
print(f"Total functions: {len(response.functions)}"){
"function_urn": "urn:fss:cn-north-4:project_id:function:default:my_function",
"function_name": "my_function",
"runtime": "Python3.9",
"memory_size": 128,
"timeout": 3,
"handler": "index.handler",
"description": "Test function created by skill"
}