huawei-cloud-functiongraph-function-create
huaweicloud/huaweicloud-skills · 15.5k installs · 52 stars
Skill
Marked External Downloads · Command Execution
Install
npx -y skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-functiongraph-function-create --agent claude-codeRun in a terminal. Claude loads the skill when a task calls for it. Check the repo's README before you run it.
Files
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:
- "Create a Python function named my_handler"
- "Deploy this code to FunctionGraph"
- "Batch create 10 functions from template"
Prerequisites
1. Python Environment
- Python 3.9+
- Verify:
python --version
2. SDK Installation
pip install huaweicloudsdkfunctiongraph
3. Authentication Configuration
- Valid Huawei Cloud credentials (AK/SK mode)
- Configure via environment variables:
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 functionfunctiongraph:function:get- Query function detailsfunctiongraph:function:list- List functions
See IAM Policies for detailed permission configuration.
Usage
Command
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
## 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 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:
{
"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
- Test before production: Always test in a development environment first
- Monitor resources: Set up monitoring for function invocations and errors
- Use environment variables: Store sensitive data in environment variables
- Implement error handling: Add proper error handling in function code
- 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
Facts
- Kind
- Skill
- Repo
- huaweicloud/huaweicloud-skills
- Group
- Uncategorized
- Installs
- 15.5k
- Stars
- 52
- 1find-skillsvercel-labs/skillsHelps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.3.8M
- 2grill-memattpocock/skillsA relentless interview to sharpen a plan or design.1.3M
- 3grill-with-docsmattpocock/skillsA relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.1.1M
- 4agent-browservercel-labs/agent-browserBrowser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.1.1M
- 5improve-codebase-architecturemattpocock/skillsScan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.1.1M
- 6tddmattpocock/skillsTest-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.1.1M