huaweicloud/huaweicloud-skills

huawei-cloud-functiongraph-function-create

Create FunctionGraph functions on Huawei Cloud.

查看源码
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

FunctionGraph Function Creation Skill

Overview

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:

  • Quickly create cloud functions without manual console login
  • Batch creation of multiple functions
  • Foundation component for workflow deployment
  • CI/CD integration for function deployment

Typical Use Cases:

  1. "Create a Python function named my_handler"
  2. "Deploy this code to FunctionGraph"
  3. "Batch create 10 functions from template"

Prerequisites

1. Python Environment

  • Python 3.9+
  • Verify: python --version

2. SDK Installation

bash
pip install huaweicloudsdkfunctiongraph

3. Authentication Configuration

  • Valid Huawei Cloud credentials (AK/SK mode)
  • Configure via environment variables:
bash
export HUAWEI_AK="your-access-key"
export HUAWEI_SK="your-secret-key"
export HUAWEI_REGION="cn-north-4"
export HUAWEI_PROJECT_ID="your-project-id"

Security Rules:

  • NEVER expose AK/SK values in code or logs
  • NEVER let users input AK/SK directly in conversation
  • ALWAYS use environment variables for credentials
  • Recommend using IAM user instead of main account

4. IAM Permission Requirements

  • functiongraph:function:create - Create function
  • functiongraph:function:get - Query function details
  • functiongraph:function:list - List functions

See IAM Policies for detailed permission configuration.

Usage

Command

bash
cd scripts
python create_function.py   --name <function_name>   --runtime <runtime>   --han
dler <handler>   --code <code_content>   --memory <memory_size>   --timeout <timeout>

Parameter Confirmation

|| 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 Options

|| 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 ||

Verification Method

See Verification Method for detailed procedures.

Quick Verification

python
## 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)}")

Output Format

The skill returns a structured JSON object with the following fields:

  • function_urn: Unique resource identifier of the created function
  • function_name: Name of the created function
  • runtime: Runtime environment
  • memory_size: Allocated memory in MB
  • timeout: Function timeout in seconds
  • handler: Function entry point
  • description: Function description (if provided)

Example output:

json
{
  "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"
}

Best Practices

  1. Test before production: Always test in a development environment first
  2. Monitor resources: Set up monitoring for function invocations and errors
  3. Use environment variables: Store sensitive data in environment variables
  4. Implement error handling: Add proper error handling in function code
  5. Set appropriate timeouts: Configure timeout based on function logic

Error Handling

|| 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 ||

References

来自同一仓库

更多 Skills

全部 Skills
huaweicloud
社区

huawei-cloud-billing-scout

Huawei Cloud BSS billing (not AWS/Azure/other clouds; refuses pricing quotes, real-name review, and any non-billing scope): balance, spend, attribution, reconciliation, coupons, stored-value cards, enterprise/partner billing. One-page briefing via hcloud. Use only when the user explicitly mentions 华为云 / Huawei Cloud / BSS and 余额/账单/对账/资源包/代金券/储值卡/企业或伙伴账务; refuses pay, renew, refund, delete.

安装量
242
GitHub Stars
20
最近更新
8月31日
huaweicloud
社区

huawei-cloud-cci-instance-management

Huawei Cloud CCI Container Instance Lifecycle Management Overview Manage Huawei Cloud CCI (Cloud Container Instance) full lifecycle using hcloud CLI (KooCLI). CCI is a serverless container service — no cluster management needed, just create a Namespace, define a Network, then deploy workloads directly. Architecture : hcloud CLI → CCI OpenAPI → Namespace / Network / Deployment / StatefulSet / Pod / EIPPool / Service / Ingress Constraints and Rules Security Rules Two step confirmation : All destructive operations (delete Namespace/Network/Deployment/StatefulSet/Pod/EIPPool) require explicit user confirmation — preview command, resource details, and risk warning first; execute only after user confirms. Credential security : Never expose AK/SK values in conversation, commands, or output. Only use hcloud configure list to check credential status (presence only). Prefer profile mode or environ

安装量
242
GitHub Stars
20
最近更新
8月31日
huaweicloud
社区

huawei-cloud-computing-query

Queries Huawei Cloud computing resources (ECS/BMS/IMS/AS), Covers ECS instances, flavors, keypairs, quotas, server groups, block devices, NICs, VNC console, BMS bare metal servers/flavors/quotas, IMS images/OS versions/members/quotas, and AS scaling groups/configs/policies/activity logs/lifecycle hooks/warm pools/quotas. No write operations. Use this skill when the user needs to query ECS instance details, list flavors, check BMS availability, browse images, or view auto-scaling group/policy status. Triggers: 弹性云服务器, ECS, 裸金属, BMS, 镜像, IMS, 弹性伸缩, AS, 伸缩组, 伸缩策略, 规格查询, flavor, instance, image, scaling.

安装量
242
GitHub Stars
20
最近更新
8月31日
huaweicloud
社区

huawei-cloud-find-skills

Invoke this skill to search, discover, browse, find and install any Huawei Cloud (华为云) agent skill.Triggers include: "华为云","华为云有什么skill","华为云相关skill","华为云agent skill 市场","华为云skill类目","explore Huawei Cloud skills","show Huawei Cloud skill categories","does a Huawei Cloud skill exist for...","which Huawei Cloud skills exist","搜索华为云技能","有没有管理ECS/OBS/RDS的skill","帮我找 XX 华为云skill","介绍 XX Skill 内容","华为云 XX Skill 具体做什么","安装华为云Skill".

安装量
242
GitHub Stars
20
最近更新
8月31日