huaweicloud-devkit 0.1.21-dev.0 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +169 -148
  4. package/bin/setup.cjs +7 -7
  5. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  6. package/integrations/opencode/opencode.json +14 -14
  7. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +30 -30
  8. package/package.json +43 -43
  9. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
  10. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
  11. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
  12. package/plugins/huaweicloud-core/.mcp.json +13 -13
  13. package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
  14. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +88 -88
  15. package/plugins/huaweicloud-core/safety/policy.json +85 -85
  16. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +144 -144
  17. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
  18. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
  19. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -101
  20. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +73 -73
  21. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
  22. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
  23. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
  24. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
  25. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
  26. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +131 -131
  27. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +96 -96
  28. package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
  29. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +28 -28
  30. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  31. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -132
  32. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
  33. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -71
  34. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
  35. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
  36. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
  37. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -65
  38. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
  39. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
  40. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +118 -118
  41. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -26
  42. package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
  43. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +181 -181
  44. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
  45. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +78 -78
  46. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +76 -76
  47. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -59
  48. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
  49. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
  50. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +47 -47
  51. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
  52. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +127 -127
  53. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
  54. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +93 -93
  55. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
  56. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +19 -19
  57. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
  58. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +46 -46
  59. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
  60. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
  61. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
  62. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
  63. package/plugins/huaweicloud-core/src/mcp-server.mjs +93 -93
  64. package/plugins/huaweicloud-core/src/safety-policy.mjs +289 -289
  65. package/plugins/huaweicloud-core/src/setup-cli.mjs +869 -672
  66. package/plugins/huaweicloud-core/src/tools.mjs +677 -672
@@ -1,132 +1,132 @@
1
- ---
2
- name: huawei-functiongraph
3
- description: "Use when creating, deploying, or managing serverless functions on FunctionGraph. Covers triggers (APIG/OBS/timer/SMN), cold start, reserved concurrency. Triggers: FunctionGraph, serverless, function, Lambda, trigger. NOT for: CCE containers (use huawei-cce)."
4
- version: 1
5
- ---
6
-
7
- # Huawei Cloud FunctionGraph
8
-
9
- **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
-
11
- ## Overview
12
-
13
- Domain expertise for Huawei Cloud FunctionGraph. Covers function lifecycle, code deployment, trigger configuration, and troubleshooting.
14
-
15
- ## How to Use This Skill
16
-
17
- 1. This skill tells you the **correct service/operation names** and **non-obvious traps**.
18
- 2. **Parameters are discovered via `--help`, not hardcoded.** Always run `hcloud FunctionGraph <Operation> --help` before constructing commands.
19
- 3. Detailed examples are in `references/` — load them only when needed.
20
-
21
- ## Critical Warnings
22
-
23
- | Trap | Why |
24
- |------|-----|
25
- | Service name is `FunctionGraph` | NOT `FGS`. KooCLI 7.x uses the full service name |
26
- | CLI requires `project_id` | Get it: `hcloud IAM KeystoneListProjects` or extract from URN `urn:fss:<region>:<project_id>:...` |
27
- | Cold start 100ms-2s | Reserve concurrency for latency-sensitive workloads |
28
- | Max execution 900s | Use ECS/CCE for long-running tasks |
29
- | Env vars plaintext | Use DEW for secrets |
30
- | **ZIP upload is unreliable** | `CreateFunction --code_type=zip --code_filename=xxx.zip` succeeds even with a nonexistent file — the function is created with empty code. Prefer `code_type=inline` for simple functions. If using zip, verify `code_size` > placeholder after creation and run `InvokeFunction` to confirm output. |
31
- | **DeleteFunction strip `:latest`** | Passing `urn:fss:...:function:xxx:latest` causes FSS.0400. Strip `:latest` suffix (DeleteFunction only — UpdateApiV2 needs the full URN). |
32
- | **DeleteFunctionTrigger does NOT cascade** | Deleting a DEDICATEDGATEWAY trigger leaves the API in APIG. Manually clean up: `hcloud APIG DeleteApiV2 --instance_id=<id> --api_id=<api-id>`. |
33
-
34
- ## Prerequisites
35
-
36
- ```bash
37
- hcloud configure list # confirm a profile exists
38
- hcloud FunctionGraph --help # confirm service is available
39
- ```
40
-
41
- ## IAM Permissions
42
-
43
- If you see `FSS.0403 Forbidden`, the user needs these permissions:
44
-
45
- | Operation | Required Permission |
46
- |-----------|---------------------|
47
- | Create function | `functiongraph:function:createFunction` |
48
- | List functions | `functiongraph:function:list` |
49
- | Delete function | `functiongraph:function:deleteFunction` |
50
- | Invoke function | `functiongraph:function:invoke` |
51
- | Create trigger | `functiongraph:trigger:*` |
52
-
53
- Grant via IAM console (`FunctionGraph FullAccess` role) or ask project admin.
54
-
55
- ## Operations
56
-
57
- Always discover parameters with `--help` before executing. These are the correct operation names:
58
-
59
- | Task | Operation | Gotchas |
60
- |------|-----------|---------|
61
- | List functions | `ListFunctions` | |
62
- | Show function | `ShowFunctionConfig` | |
63
- | Create function | `CreateFunction` | references/create-function.md |
64
- | Delete function | `DeleteFunction` | Strip `:latest` from URN |
65
- | Invoke function | `InvokeFunction` | Requires body param (`--name=<value>` becomes event body). Use `--x_cff_request_version=v0` for raw output, `v1` for APIG-wrapped. |
66
- | List runtimes | `ListRuntimes` | |
67
- | Create trigger | `CreateFunctionTrigger` | references/triggers.md |
68
- | List triggers | `ListFunctionTriggers` | |
69
- | Delete trigger | `DeleteFunctionTrigger` | |
70
-
71
- Discover exact parameters:
72
- ```bash
73
- hcloud FunctionGraph CreateFunction --help
74
- hcloud FunctionGraph CreateFunctionTrigger --help
75
- ```
76
-
77
- ## Deployment Workflow
78
-
79
- ```
80
- Write code → zip → CreateFunction → InvokeFunction → CreateFunctionTrigger
81
- ```
82
-
83
- See `references/deploy-workflow.md` for a step-by-step example with code templates.
84
-
85
- ## Troubleshooting
86
-
87
- | Error | Root Cause -> Fix |
88
- |-------|------------------|
89
- | `不支持的服务名称:FGS` | Use `FunctionGraph`, not `FGS` |
90
- | `不支持的operation:CreateTrigger` | Use `CreateFunctionTrigger` |
91
- | `FSS.0403` / Forbidden | Missing IAM permissions — see IAM Permissions above |
92
- | `缺少必填参数:{*}` on Invoke | Add body param: `--name=<value>` |
93
- | APIG/EOM trigger error | `trigger_type_code=APIG` deprecated — use `DEDICATEDGATEWAY` |
94
- | `event_data` parse error | Use dotted format: `--event_data.key=value`, NOT JSON string |
95
- | FSS.1078 / code upload fails | `--code_filename` is filename-only, no path. `cd` to zip directory first |
96
- | DeleteFunction with `:latest` | Strip `:latest` version suffix from URN |
97
- | Code too large | Inline limit 10KB — use `zip`/`obs` code type |
98
- | Cold start slow | Set reserved instances for critical functions |
99
- | Auth failure | Run `hcloud configure init` |
100
-
101
- ## Security Considerations
102
-
103
- - MUST use DEW for secrets, never hardcode in environment variables
104
- - MUST use `--app_xrole` (agency) for cross-service access
105
- - SHOULD enable CTS audit logging for function invocations
106
- - MUST NOT expose AK/SK in function code
107
-
108
- ## MCP Tools
109
-
110
- - `huaweicloud_list_operations` service=FunctionGraph
111
- - `huaweicloud_run_readonly_command` for discovery
112
- - `huaweicloud_run_approved_command` for writes
113
-
114
- ## Without MCP
115
-
116
- Fall back to hcloud CLI. State: "MCP unavailable, using local hcloud CLI."
117
-
118
- ## Cross-Skill References
119
-
120
- - **APIG trigger setup**: See `huawei-apig` for API group creation and publishing
121
- - **OBS trigger setup**: See `huawei-obs` for bucket and object event configuration
122
- - **DEW secrets**: See `huawei-dew` for managing function secrets
123
- - **SMN notifications**: See `huawei-smn-dms` for notification topics
124
- - **VPC configuration**: See `huawei-vpc` for network settings
125
-
126
- ## References
127
-
128
- - FunctionGraph Docs: https://support.huaweicloud.com/functiongraph/
129
- - Create function: references/create-function.md
130
- - Triggers: references/triggers.md
131
- - Deploy workflow: references/deploy-workflow.md
132
- - APIG event format: references/apig-event-format.md
1
+ ---
2
+ name: huawei-functiongraph
3
+ description: "Use when creating, deploying, or managing serverless functions on FunctionGraph. Covers triggers (APIG/OBS/timer/SMN), cold start, reserved concurrency. Triggers: FunctionGraph, serverless, function, Lambda, trigger. NOT for: CCE containers (use huawei-cce)."
4
+ version: 1
5
+ ---
6
+
7
+ # Huawei Cloud FunctionGraph
8
+
9
+ **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
+
11
+ ## Overview
12
+
13
+ Domain expertise for Huawei Cloud FunctionGraph. Covers function lifecycle, code deployment, trigger configuration, and troubleshooting.
14
+
15
+ ## How to Use This Skill
16
+
17
+ 1. This skill tells you the **correct service/operation names** and **non-obvious traps**.
18
+ 2. **Parameters are discovered via `--help`, not hardcoded.** Always run `hcloud FunctionGraph <Operation> --help` before constructing commands.
19
+ 3. Detailed examples are in `references/` — load them only when needed.
20
+
21
+ ## Critical Warnings
22
+
23
+ | Trap | Why |
24
+ |------|-----|
25
+ | Service name is `FunctionGraph` | NOT `FGS`. KooCLI 7.x uses the full service name |
26
+ | CLI requires `project_id` | Get it: `hcloud IAM KeystoneListProjects` or extract from URN `urn:fss:<region>:<project_id>:...` |
27
+ | Cold start 100ms-2s | Reserve concurrency for latency-sensitive workloads |
28
+ | Max execution 900s | Use ECS/CCE for long-running tasks |
29
+ | Env vars plaintext | Use DEW for secrets |
30
+ | **ZIP upload is unreliable** | `CreateFunction --code_type=zip --code_filename=xxx.zip` succeeds even with a nonexistent file — the function is created with empty code. Prefer `code_type=inline` for simple functions. If using zip, verify `code_size` > placeholder after creation and run `InvokeFunction` to confirm output. |
31
+ | **DeleteFunction strip `:latest`** | Passing `urn:fss:...:function:xxx:latest` causes FSS.0400. Strip `:latest` suffix (DeleteFunction only — UpdateApiV2 needs the full URN). |
32
+ | **DeleteFunctionTrigger does NOT cascade** | Deleting a DEDICATEDGATEWAY trigger leaves the API in APIG. Manually clean up: `hcloud APIG DeleteApiV2 --instance_id=<id> --api_id=<api-id>`. |
33
+
34
+ ## Prerequisites
35
+
36
+ ```bash
37
+ hcloud configure list # confirm a profile exists
38
+ hcloud FunctionGraph --help # confirm service is available
39
+ ```
40
+
41
+ ## IAM Permissions
42
+
43
+ If you see `FSS.0403 Forbidden`, the user needs these permissions:
44
+
45
+ | Operation | Required Permission |
46
+ |-----------|---------------------|
47
+ | Create function | `functiongraph:function:createFunction` |
48
+ | List functions | `functiongraph:function:list` |
49
+ | Delete function | `functiongraph:function:deleteFunction` |
50
+ | Invoke function | `functiongraph:function:invoke` |
51
+ | Create trigger | `functiongraph:trigger:*` |
52
+
53
+ Grant via IAM console (`FunctionGraph FullAccess` role) or ask project admin.
54
+
55
+ ## Operations
56
+
57
+ Always discover parameters with `--help` before executing. These are the correct operation names:
58
+
59
+ | Task | Operation | Gotchas |
60
+ |------|-----------|---------|
61
+ | List functions | `ListFunctions` | |
62
+ | Show function | `ShowFunctionConfig` | |
63
+ | Create function | `CreateFunction` | references/create-function.md |
64
+ | Delete function | `DeleteFunction` | Strip `:latest` from URN |
65
+ | Invoke function | `InvokeFunction` | Requires body param (`--name=<value>` becomes event body). Use `--x_cff_request_version=v0` for raw output, `v1` for APIG-wrapped. |
66
+ | List runtimes | `ListRuntimes` | |
67
+ | Create trigger | `CreateFunctionTrigger` | references/triggers.md |
68
+ | List triggers | `ListFunctionTriggers` | |
69
+ | Delete trigger | `DeleteFunctionTrigger` | |
70
+
71
+ Discover exact parameters:
72
+ ```bash
73
+ hcloud FunctionGraph CreateFunction --help
74
+ hcloud FunctionGraph CreateFunctionTrigger --help
75
+ ```
76
+
77
+ ## Deployment Workflow
78
+
79
+ ```
80
+ Write code → zip → CreateFunction → InvokeFunction → CreateFunctionTrigger
81
+ ```
82
+
83
+ See `references/deploy-workflow.md` for a step-by-step example with code templates.
84
+
85
+ ## Troubleshooting
86
+
87
+ | Error | Root Cause -> Fix |
88
+ |-------|------------------|
89
+ | `不支持的服务名称:FGS` | Use `FunctionGraph`, not `FGS` |
90
+ | `不支持的operation:CreateTrigger` | Use `CreateFunctionTrigger` |
91
+ | `FSS.0403` / Forbidden | Missing IAM permissions — see IAM Permissions above |
92
+ | `缺少必填参数:{*}` on Invoke | Add body param: `--name=<value>` |
93
+ | APIG/EOM trigger error | `trigger_type_code=APIG` deprecated — use `DEDICATEDGATEWAY` |
94
+ | `event_data` parse error | Use dotted format: `--event_data.key=value`, NOT JSON string |
95
+ | FSS.1078 / code upload fails | `--code_filename` is filename-only, no path. `cd` to zip directory first |
96
+ | DeleteFunction with `:latest` | Strip `:latest` version suffix from URN |
97
+ | Code too large | Inline limit 10KB — use `zip`/`obs` code type |
98
+ | Cold start slow | Set reserved instances for critical functions |
99
+ | Auth failure | Run `hcloud configure init` |
100
+
101
+ ## Security Considerations
102
+
103
+ - MUST use DEW for secrets, never hardcode in environment variables
104
+ - MUST use `--app_xrole` (agency) for cross-service access
105
+ - SHOULD enable CTS audit logging for function invocations
106
+ - MUST NOT expose AK/SK in function code
107
+
108
+ ## MCP Tools
109
+
110
+ - `huaweicloud_list_operations` service=FunctionGraph
111
+ - `huaweicloud_run_readonly_command` for discovery
112
+ - `huaweicloud_run_approved_command` for writes
113
+
114
+ ## Without MCP
115
+
116
+ Fall back to hcloud CLI. State: "MCP unavailable, using local hcloud CLI."
117
+
118
+ ## Cross-Skill References
119
+
120
+ - **APIG trigger setup**: See `huawei-apig` for API group creation and publishing
121
+ - **OBS trigger setup**: See `huawei-obs` for bucket and object event configuration
122
+ - **DEW secrets**: See `huawei-dew` for managing function secrets
123
+ - **SMN notifications**: See `huawei-smn-dms` for notification topics
124
+ - **VPC configuration**: See `huawei-vpc` for network settings
125
+
126
+ ## References
127
+
128
+ - FunctionGraph Docs: https://support.huaweicloud.com/functiongraph/
129
+ - Create function: references/create-function.md
130
+ - Triggers: references/triggers.md
131
+ - Deploy workflow: references/deploy-workflow.md
132
+ - APIG event format: references/apig-event-format.md
@@ -1,58 +1,58 @@
1
- # APIG DEDICATEDGATEWAY Event Format
2
-
3
- When APIG calls FunctionGraph via DEDICATEDGATEWAY trigger, the event structure is NOT the standard HTTP event. Key differences:
4
-
5
- ## Event Structure
6
-
7
- ```json
8
- {
9
- "isBase64Encoded": true,
10
- "body": "<Base64-encoded request body>",
11
- "httpMethod": "POST",
12
- "requestContext": {
13
- "apiId": "xxx",
14
- "requestId": "xxx",
15
- "stage": "RELEASE"
16
- }
17
- }
18
- ```
19
-
20
- ## Critical: body is Base64 Encoded
21
-
22
- `event["body"]` is Base64 encoded. You MUST decode it:
23
-
24
- **Python handler template:**
25
- ```python
26
- import json, base64
27
-
28
- def handler(event, context):
29
- body = event.get("body", "")
30
- if event.get("isBase64Encoded"):
31
- body = base64.b64decode(body).decode("utf-8")
32
- data = json.loads(body) if body else {}
33
- return {
34
- "statusCode": 200,
35
- "body": json.dumps({"message": "ok", "received": data}),
36
- "headers": {"Content-Type": "application/json"}
37
- }
38
- ```
39
-
40
- **Node.js handler template:**
41
- ```js
42
- exports.handler = async (event, context) => {
43
- let body = event.body || "";
44
- if (event.isBase64Encoded) {
45
- body = Buffer.from(body, "base64").toString("utf8");
46
- }
47
- const data = body ? JSON.parse(body) : {};
48
- return {
49
- statusCode: 200,
50
- body: JSON.stringify({ message: "ok", received: data }),
51
- headers: { "Content-Type": "application/json" }
52
- };
53
- };
54
- ```
55
-
56
- ## Missing Fields vs Standard HTTP
57
-
58
- Fields NOT in DEDICATEDGATEWAY event: `event.path`, `event.headers`, `event.queryStringParameters`. Use `event.httpMethod` for method detection.
1
+ # APIG DEDICATEDGATEWAY Event Format
2
+
3
+ When APIG calls FunctionGraph via DEDICATEDGATEWAY trigger, the event structure is NOT the standard HTTP event. Key differences:
4
+
5
+ ## Event Structure
6
+
7
+ ```json
8
+ {
9
+ "isBase64Encoded": true,
10
+ "body": "<Base64-encoded request body>",
11
+ "httpMethod": "POST",
12
+ "requestContext": {
13
+ "apiId": "xxx",
14
+ "requestId": "xxx",
15
+ "stage": "RELEASE"
16
+ }
17
+ }
18
+ ```
19
+
20
+ ## Critical: body is Base64 Encoded
21
+
22
+ `event["body"]` is Base64 encoded. You MUST decode it:
23
+
24
+ **Python handler template:**
25
+ ```python
26
+ import json, base64
27
+
28
+ def handler(event, context):
29
+ body = event.get("body", "")
30
+ if event.get("isBase64Encoded"):
31
+ body = base64.b64decode(body).decode("utf-8")
32
+ data = json.loads(body) if body else {}
33
+ return {
34
+ "statusCode": 200,
35
+ "body": json.dumps({"message": "ok", "received": data}),
36
+ "headers": {"Content-Type": "application/json"}
37
+ }
38
+ ```
39
+
40
+ **Node.js handler template:**
41
+ ```js
42
+ exports.handler = async (event, context) => {
43
+ let body = event.body || "";
44
+ if (event.isBase64Encoded) {
45
+ body = Buffer.from(body, "base64").toString("utf8");
46
+ }
47
+ const data = body ? JSON.parse(body) : {};
48
+ return {
49
+ statusCode: 200,
50
+ body: JSON.stringify({ message: "ok", received: data }),
51
+ headers: { "Content-Type": "application/json" }
52
+ };
53
+ };
54
+ ```
55
+
56
+ ## Missing Fields vs Standard HTTP
57
+
58
+ Fields NOT in DEDICATEDGATEWAY event: `event.path`, `event.headers`, `event.queryStringParameters`. Use `event.httpMethod` for method detection.
@@ -1,71 +1,71 @@
1
- # FunctionGraph Function Creation Reference
2
-
3
- ## Runtime Options
4
-
5
- | Runtime | Handler Format | Example |
6
- |---------|---------------|---------|
7
- | Python3.9 | `index.handler` | `def handler(event, context): return {"statusCode": 200}` |
8
- | Python3.10 | `index.handler` | Same as 3.9 |
9
- | Node.js 18 | `index.handler` | `exports.handler = async (event, context) => ({statusCode: 200})` |
10
- | Java 8/11/17 | `com.example.Handler::handleRequest` | Java class method |
11
- | Go 1.x | `handler` | Go function name |
12
- | C# (.NET Core) | `CsharpDemo::CsharpDemo.Function::Handler` | Namespace.Class::Method |
13
-
14
- ## Create Function (inline)
15
-
16
- ```bash
17
- hcloud FunctionGraph CreateFunction \
18
- --func_name=<name> \
19
- --package=default \
20
- --runtime=Python3.10 \
21
- --handler=index.handler \
22
- --memory_size=128 \
23
- --timeout=3 \
24
- --code_type=inline \
25
- --func_code.file=<base64-encoded-code> \
26
- --cli-region=<region>
27
- ```
28
-
29
- | Param | Required | Range/Default |
30
- |-------|----------|---------------|
31
- | `--func_name` | Yes | 1-60 chars |
32
- | `--runtime` | Yes | See runtime options above |
33
- | `--handler` | Yes | Per runtime |
34
- | `--memory_size` | No | 128-4096 MB, default 128 |
35
- | `--timeout` | No | 1-900s, default 3 |
36
-
37
- ## ZIP Upload Warning
38
-
39
- `--code_type=zip --code_filename=xxx.zip` **succeeds even with non-existent file** — function created with empty code. Prefer `code_type=inline` for simple functions. If using zip, verify `code_size > 0` after creation and invoke the function to confirm output.
40
-
41
- ## Required IAM Permissions
42
-
43
- - `functiongraph:function:createFunction` — Create
44
- - `functiongraph:function:list` — List
45
- - `functiongraph:function:getConfig` — Read config
46
- - `functiongraph:function:invoke` — Invoke
47
-
48
- Grant `FunctionGraph FullAccess` role or custom policy.
49
-
50
- ## Error Codes
51
-
52
- | Error | Root Cause -> Fix |
53
- |-------|-------------------|
54
- | FSS.0400 | `:latest` suffix on URN. Strip it |
55
- | FSS.1417 | Missing DEDICATEDGATEWAY params |
56
- | FSS.0403 | Insufficient IAM permission |
57
- | FSS.1020 | Missing `--app_xrole` when binding VPC. Create IAM agency with `trust_domain_name=functiongraph`. See `huawei-iam` skill → Agencies section |
58
-
59
- ## VPC + Agency Configuration
60
-
61
- To access VPC-internal resources from FunctionGraph:
62
-
63
- ```bash
64
- # 1. Create agency (see huawei-iam skill)
65
- hcloud IAM CreateAgency --agency_name=<name> --trust_domain_name=functiongraph
66
- # 2. Grant role (e.g., VPC Administrator)
67
- hcloud IAM GrantRoleToAgency --agency_name=<name> --role_id=<role-id>
68
- # 3. Use in CreateFunction
69
- hcloud FunctionGraph CreateFunction --func_vpc.vpc_id=<vpc> --func_vpc.subnet_id=<subnet> --app_xrole=<name> ...
70
- ```
71
- | QuotaExceeded | Max 10 functions per project per region |
1
+ # FunctionGraph Function Creation Reference
2
+
3
+ ## Runtime Options
4
+
5
+ | Runtime | Handler Format | Example |
6
+ |---------|---------------|---------|
7
+ | Python3.9 | `index.handler` | `def handler(event, context): return {"statusCode": 200}` |
8
+ | Python3.10 | `index.handler` | Same as 3.9 |
9
+ | Node.js 18 | `index.handler` | `exports.handler = async (event, context) => ({statusCode: 200})` |
10
+ | Java 8/11/17 | `com.example.Handler::handleRequest` | Java class method |
11
+ | Go 1.x | `handler` | Go function name |
12
+ | C# (.NET Core) | `CsharpDemo::CsharpDemo.Function::Handler` | Namespace.Class::Method |
13
+
14
+ ## Create Function (inline)
15
+
16
+ ```bash
17
+ hcloud FunctionGraph CreateFunction \
18
+ --func_name=<name> \
19
+ --package=default \
20
+ --runtime=Python3.10 \
21
+ --handler=index.handler \
22
+ --memory_size=128 \
23
+ --timeout=3 \
24
+ --code_type=inline \
25
+ --func_code.file=<base64-encoded-code> \
26
+ --cli-region=<region>
27
+ ```
28
+
29
+ | Param | Required | Range/Default |
30
+ |-------|----------|---------------|
31
+ | `--func_name` | Yes | 1-60 chars |
32
+ | `--runtime` | Yes | See runtime options above |
33
+ | `--handler` | Yes | Per runtime |
34
+ | `--memory_size` | No | 128-4096 MB, default 128 |
35
+ | `--timeout` | No | 1-900s, default 3 |
36
+
37
+ ## ZIP Upload Warning
38
+
39
+ `--code_type=zip --code_filename=xxx.zip` **succeeds even with non-existent file** — function created with empty code. Prefer `code_type=inline` for simple functions. If using zip, verify `code_size > 0` after creation and invoke the function to confirm output.
40
+
41
+ ## Required IAM Permissions
42
+
43
+ - `functiongraph:function:createFunction` — Create
44
+ - `functiongraph:function:list` — List
45
+ - `functiongraph:function:getConfig` — Read config
46
+ - `functiongraph:function:invoke` — Invoke
47
+
48
+ Grant `FunctionGraph FullAccess` role or custom policy.
49
+
50
+ ## Error Codes
51
+
52
+ | Error | Root Cause -> Fix |
53
+ |-------|-------------------|
54
+ | FSS.0400 | `:latest` suffix on URN. Strip it |
55
+ | FSS.1417 | Missing DEDICATEDGATEWAY params |
56
+ | FSS.0403 | Insufficient IAM permission |
57
+ | FSS.1020 | Missing `--app_xrole` when binding VPC. Create IAM agency with `trust_domain_name=functiongraph`. See `huawei-iam` skill → Agencies section |
58
+
59
+ ## VPC + Agency Configuration
60
+
61
+ To access VPC-internal resources from FunctionGraph:
62
+
63
+ ```bash
64
+ # 1. Create agency (see huawei-iam skill)
65
+ hcloud IAM CreateAgency --agency_name=<name> --trust_domain_name=functiongraph
66
+ # 2. Grant role (e.g., VPC Administrator)
67
+ hcloud IAM GrantRoleToAgency --agency_name=<name> --role_id=<role-id>
68
+ # 3. Use in CreateFunction
69
+ hcloud FunctionGraph CreateFunction --func_vpc.vpc_id=<vpc> --func_vpc.subnet_id=<subnet> --app_xrole=<name> ...
70
+ ```
71
+ | QuotaExceeded | Max 10 functions per project per region |