huaweicloud-devkit 1.0.2-dev.9 → 1.0.2-next.0

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 (97) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +163 -138
  4. package/README.zh-CN.md +161 -138
  5. package/bin/setup.cjs +8 -8
  6. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  7. package/integrations/opencode/opencode.json +14 -14
  8. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
  9. package/package.json +46 -44
  10. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +44 -44
  11. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +43 -43
  12. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +44 -44
  13. package/plugins/huaweicloud-core/.mcp.json +15 -15
  14. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +44 -44
  15. package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
  16. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +136 -136
  17. package/plugins/huaweicloud-core/safety/policy.json +99 -99
  18. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +199 -199
  19. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +164 -164
  20. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
  21. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
  22. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -101
  23. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
  24. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +190 -190
  25. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +124 -124
  26. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
  27. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
  28. package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +56 -56
  29. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
  30. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
  31. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
  32. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +185 -185
  33. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +133 -133
  34. package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
  35. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +55 -55
  36. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  37. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +131 -131
  38. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
  39. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -71
  40. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
  41. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
  42. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
  43. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -65
  44. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
  45. package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +122 -122
  46. package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -56
  47. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
  48. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +133 -127
  49. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
  50. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -26
  51. package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +100 -100
  52. package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -40
  53. package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
  54. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +224 -224
  55. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +135 -134
  56. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
  57. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +84 -84
  58. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +76 -76
  59. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -59
  60. package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -50
  61. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
  62. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -56
  63. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
  64. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +51 -47
  65. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
  66. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +128 -128
  67. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
  68. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +110 -95
  69. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
  70. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +19 -19
  71. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
  72. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +60 -60
  73. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
  74. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
  75. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
  76. package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +105 -87
  77. package/plugins/huaweicloud-core/src/auth/credentials.mjs +95 -95
  78. package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
  79. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
  80. package/plugins/huaweicloud-core/src/mcp-server.mjs +129 -129
  81. package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +155 -0
  82. package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +87 -0
  83. package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +137 -137
  84. package/plugins/huaweicloud-core/src/safety-policy.mjs +302 -302
  85. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +91 -87
  86. package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +162 -153
  87. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +112 -105
  88. package/plugins/huaweicloud-core/src/search-market.mjs +174 -169
  89. package/plugins/huaweicloud-core/src/setup-cli.mjs +2017 -1594
  90. package/plugins/huaweicloud-core/src/tools.mjs +1008 -993
  91. package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +427 -427
  92. package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +132 -132
  93. package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +227 -227
  94. package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +202 -202
  95. package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +158 -158
  96. package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
  97. package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
@@ -1,119 +1,119 @@
1
- # End-to-End Deployment Workflow
2
-
3
- ```
4
- 1. Write code → Create index.py with handler function
5
- 2. Package → zip -j function.zip index.py (no directory nesting!)
6
- 3. Create function → hcloud FunctionGraph CreateFunction (inline for small demos, zip for production)
7
- 4. Verify → hcloud FunctionGraph InvokeFunction
8
- 5. Create trigger → hcloud FunctionGraph CreateFunctionTrigger (TIMER for testing, DEDICATEDGATEWAY for HTTP)
9
- ```
10
-
11
- ## Quick Demo (Inline — No File Packaging)
12
-
13
- Use inline for small demo functions (<10KB):
14
-
15
- ```bash
16
- # 1. Prepare base64-encoded code
17
- python3 -c "
18
- import base64
19
- code = '''import json
20
- def handler(event, context):
21
- return {'statusCode': 200, 'body': json.dumps({'message': 'Hello FunctionGraph!'}), 'headers': {'Content-Type': 'application/json'}}
22
- '''
23
- print(base64.b64encode(code.encode()).decode())
24
- "
25
-
26
- # 2. Create function with inline code (paste base64 output as --func_code.file)
27
- hcloud FunctionGraph CreateFunction --help
28
- hcloud FunctionGraph CreateFunction \
29
- --func_name=my-backend \
30
- --runtime=Python3.10 \
31
- --handler=index.handler \
32
- --memory_size=256 \
33
- --package=default \
34
- --timeout=30 \
35
- --code_type=inline \
36
- --func_code.file=<base64-from-step-1> \
37
- --cli-region=<region> \
38
- --project_id=<project-id>
39
-
40
- # 3. Verify
41
- hcloud FunctionGraph InvokeFunction \
42
- --function_urn=<urn> \
43
- --name=test-event \
44
- --x_cff_request_version=v0
45
- ```
46
-
47
- ## Production Deployment (Zip)
48
-
49
- ```bash
50
- # 1. Write code
51
- cat > index.py << 'EOF'
52
- import json
53
-
54
- def handler(event, context):
55
- return {
56
- "statusCode": 200,
57
- "body": json.dumps({"message": "Hello from FunctionGraph!"}),
58
- "headers": {"Content-Type": "application/json"}
59
- }
60
- EOF
61
-
62
- # 2. Package — CRITICAL: use -j to flatten, no directory nesting
63
- zip -j function.zip index.py
64
-
65
- # 3. Create function (discover params with --help first!)
66
- hcloud FunctionGraph CreateFunction --help
67
- # Required: --func_name, --runtime, --handler, --memory_size, --package, --timeout
68
- # Code type: use --code_type=zip --code_filename=function.zip
69
- # IMPORTANT: cd to function.zip directory first! --code_filename is filename only.
70
-
71
- # 4. Verify (store URN from step 3 output)
72
- hcloud FunctionGraph InvokeFunction --help
73
- # Requires body param: --name=test-event (becomes event body passed to handler)
74
- hcloud FunctionGraph InvokeFunction \
75
- --function_urn=<urn> \
76
- --name=test-event \
77
- --x_cff_request_version=v0
78
-
79
- # 5. Create trigger (see references/triggers.md)
80
- # For quick testing: TIMER trigger (no prerequisites)
81
- # For HTTP access: DEDICATEDGATEWAY (requires APIG instance — see pre-flight checklist below)
82
-
83
- # 5a. TIMER (simple — no APIG dependency)
84
- hcloud FunctionGraph CreateFunctionTrigger \
85
- --function_urn=<urn> \
86
- --trigger_type_code=TIMER \
87
- --event_type_code=MessageCreated \
88
- --trigger_status=ACTIVE \
89
- --event_data.name=test-timer \
90
- --event_data.schedule_type=Rate \
91
- --event_data.schedule="5m"
92
- ```
93
-
94
- ## DEDICATEDGATEWAY Pre-Flight Checklist
95
-
96
- Before creating a DEDICATEDGATEWAY (HTTP) trigger, verify these prerequisites exist:
97
-
98
- ```bash
99
- # 1. Check for APIG dedicated instance
100
- hcloud APIG ListInstancesV2 --cli-region=<r>
101
-
102
- # 2. If no instance exists, create one (see huawei-apig skill)
103
- # Key: --spec_id=PROFESSIONAL --loadbalancer_provider=elb for public access
104
- # Requires: VPC, subnet, security group, enterprise_project_id
105
-
106
- # 3. Once instance is Running with public IP, create API group
107
- hcloud APIG CreateApiGroupV2 --instance_id=<id> --name=<group-name>
108
-
109
- # 4. Create DEDICATEDGATEWAY trigger (see references/triggers.md)
110
-
111
- # 5. Publish the API (after trigger creation)
112
- hcloud APIG BatchPublishOrOfflineApiV2 \
113
- --instance_id=<apig-instance-id> \
114
- --action=online \
115
- --env_id=<env-id> \
116
- --api_ids=<api-id-from-trigger-response>
117
- ```
118
-
119
- If no APIG instance is available, use TIMER trigger for function testing instead.
1
+ # End-to-End Deployment Workflow
2
+
3
+ ```
4
+ 1. Write code → Create index.py with handler function
5
+ 2. Package → zip -j function.zip index.py (no directory nesting!)
6
+ 3. Create function → hcloud FunctionGraph CreateFunction (inline for small demos, zip for production)
7
+ 4. Verify → hcloud FunctionGraph InvokeFunction
8
+ 5. Create trigger → hcloud FunctionGraph CreateFunctionTrigger (TIMER for testing, DEDICATEDGATEWAY for HTTP)
9
+ ```
10
+
11
+ ## Quick Demo (Inline — No File Packaging)
12
+
13
+ Use inline for small demo functions (<10KB):
14
+
15
+ ```bash
16
+ # 1. Prepare base64-encoded code
17
+ python3 -c "
18
+ import base64
19
+ code = '''import json
20
+ def handler(event, context):
21
+ return {'statusCode': 200, 'body': json.dumps({'message': 'Hello FunctionGraph!'}), 'headers': {'Content-Type': 'application/json'}}
22
+ '''
23
+ print(base64.b64encode(code.encode()).decode())
24
+ "
25
+
26
+ # 2. Create function with inline code (paste base64 output as --func_code.file)
27
+ hcloud FunctionGraph CreateFunction --help
28
+ hcloud FunctionGraph CreateFunction \
29
+ --func_name=my-backend \
30
+ --runtime=Python3.10 \
31
+ --handler=index.handler \
32
+ --memory_size=256 \
33
+ --package=default \
34
+ --timeout=30 \
35
+ --code_type=inline \
36
+ --func_code.file=<base64-from-step-1> \
37
+ --cli-region=<region> \
38
+ --project_id=<project-id>
39
+
40
+ # 3. Verify
41
+ hcloud FunctionGraph InvokeFunction \
42
+ --function_urn=<urn> \
43
+ --name=test-event \
44
+ --x_cff_request_version=v0
45
+ ```
46
+
47
+ ## Production Deployment (Zip)
48
+
49
+ ```bash
50
+ # 1. Write code
51
+ cat > index.py << 'EOF'
52
+ import json
53
+
54
+ def handler(event, context):
55
+ return {
56
+ "statusCode": 200,
57
+ "body": json.dumps({"message": "Hello from FunctionGraph!"}),
58
+ "headers": {"Content-Type": "application/json"}
59
+ }
60
+ EOF
61
+
62
+ # 2. Package — CRITICAL: use -j to flatten, no directory nesting
63
+ zip -j function.zip index.py
64
+
65
+ # 3. Create function (discover params with --help first!)
66
+ hcloud FunctionGraph CreateFunction --help
67
+ # Required: --func_name, --runtime, --handler, --memory_size, --package, --timeout
68
+ # Code type: use --code_type=zip --code_filename=function.zip
69
+ # IMPORTANT: cd to function.zip directory first! --code_filename is filename only.
70
+
71
+ # 4. Verify (store URN from step 3 output)
72
+ hcloud FunctionGraph InvokeFunction --help
73
+ # Requires body param: --name=test-event (becomes event body passed to handler)
74
+ hcloud FunctionGraph InvokeFunction \
75
+ --function_urn=<urn> \
76
+ --name=test-event \
77
+ --x_cff_request_version=v0
78
+
79
+ # 5. Create trigger (see references/triggers.md)
80
+ # For quick testing: TIMER trigger (no prerequisites)
81
+ # For HTTP access: DEDICATEDGATEWAY (requires APIG instance — see pre-flight checklist below)
82
+
83
+ # 5a. TIMER (simple — no APIG dependency)
84
+ hcloud FunctionGraph CreateFunctionTrigger \
85
+ --function_urn=<urn> \
86
+ --trigger_type_code=TIMER \
87
+ --event_type_code=MessageCreated \
88
+ --trigger_status=ACTIVE \
89
+ --event_data.name=test-timer \
90
+ --event_data.schedule_type=Rate \
91
+ --event_data.schedule="5m"
92
+ ```
93
+
94
+ ## DEDICATEDGATEWAY Pre-Flight Checklist
95
+
96
+ Before creating a DEDICATEDGATEWAY (HTTP) trigger, verify these prerequisites exist:
97
+
98
+ ```bash
99
+ # 1. Check for APIG dedicated instance
100
+ hcloud APIG ListInstancesV2 --cli-region=<r>
101
+
102
+ # 2. If no instance exists, create one (see huawei-apig skill)
103
+ # Key: --spec_id=PROFESSIONAL --loadbalancer_provider=elb for public access
104
+ # Requires: VPC, subnet, security group, enterprise_project_id
105
+
106
+ # 3. Once instance is Running with public IP, create API group
107
+ hcloud APIG CreateApiGroupV2 --instance_id=<id> --name=<group-name>
108
+
109
+ # 4. Create DEDICATEDGATEWAY trigger (see references/triggers.md)
110
+
111
+ # 5. Publish the API (after trigger creation)
112
+ hcloud APIG BatchPublishOrOfflineApiV2 \
113
+ --instance_id=<apig-instance-id> \
114
+ --action=online \
115
+ --env_id=<env-id> \
116
+ --api_ids=<api-id-from-trigger-response>
117
+ ```
118
+
119
+ If no APIG instance is available, use TIMER trigger for function testing instead.
@@ -1,142 +1,142 @@
1
- # Triggers
2
-
3
- **Always run `hcloud FunctionGraph CreateFunctionTrigger --help` first** for exact parameter names and requirements.
4
-
5
- ## KooCLI event_data Format (CRITICAL)
6
-
7
- KooCLI uses **dotted key-value format**, NOT JSON strings:
8
-
9
- ```bash
10
- # CORRECT
11
- --event_data.name=my-api --event_data.auth=IAM --event_data.path=/test
12
-
13
- # WRONG — will fail
14
- --event_data='{"name":"my-api","auth":"IAM","path":"/test"}'
15
- ```
16
-
17
- ## Trigger Types
18
-
19
- | Type | `--trigger_type_code` | Notes |
20
- |------|----------------------|-------|
21
- | APIG Dedicated | `DEDICATEDGATEWAY` | Use this, not `APIG` (deprecated). Requires APIG instance. |
22
- | Timer / Cron | `TIMER` | Simplest trigger for testing. No APIG dependency. |
23
- | OBS | `OBS` | Event when objects created/deleted in bucket |
24
- | SMN | `SMN` | Message notification trigger |
25
-
26
- ## TIMER Trigger (Simple Testing)
27
-
28
- The TIMER trigger is the easiest path for verifying a function works — no APIG instance needed:
29
-
30
- ```bash
31
- hcloud FunctionGraph CreateFunctionTrigger \
32
- --function_urn=<urn> \
33
- --trigger_type_code=TIMER \
34
- --event_type_code=MessageCreated \
35
- --trigger_status=ACTIVE \
36
- --event_data.name=<trigger-name> \
37
- --event_data.schedule_type=Rate \
38
- --event_data.schedule="1m"
39
- ```
40
-
41
- ## DEDICATEDGATEWAY Trigger (HTTP Access)
42
-
43
- `trigger_type_code=APIG` is **deprecated**. Use `DEDICATEDGATEWAY` for KooCLI 7.x.
44
-
45
- ### Required Parameters (Hidden Optional)
46
-
47
- These are labeled optional by `--help` but are **required** for DEDICATEDGATEWAY:
48
-
49
- | Param | Note |
50
- |-------|------|
51
- | `--event_data.protocol` | `HTTPS` or `HTTP` or `BOTH` |
52
- | `--event_data.sl_domain` | Subdomain from APIG instance (e.g. `xxxx.apic.<region>.huaweicloudapis.com`) |
53
- | `--event_data.env_name` | API environment name (`RELEASE`) |
54
- | `--event_data.env_id` | API environment ID |
55
- | `--event_data.instance_id` | APIG dedicated instance ID |
56
- | `--event_data.group_id` | API group ID |
57
- | `--event_data.name` | API name — **hyphens (`-`) are DISALLOWED**. Use underscores (`_`) instead. |
58
-
59
- ### Error Mapping
60
-
61
- | Error | Root Cause → Fix |
62
- |-------|-----------------|
63
- | FSS.1417 | Missing `instance_id`, `group_id`, `protocol`, `env_name`, or `env_id`. These are labeled optional but REQUIRED. |
64
- | API name regex fail | Rename API — remove hyphens (`-`), use `[a-zA-Z0-9_]+` only. |
65
-
66
- ### Example
67
-
68
- ```bash
69
- hcloud FunctionGraph CreateFunctionTrigger \
70
- --function_urn=<urn> \
71
- --trigger_type_code=DEDICATEDGATEWAY \
72
- --event_type_code=APICreated \
73
- --trigger_status=ACTIVE \
74
- --event_data.name=<api-name-no-hyphens> \
75
- --event_data.auth=IAM \
76
- --event_data.path=/my-backend \
77
- --event_data.match_mode=SWA \
78
- --event_data.type=1 \
79
- --event_data.protocol=HTTPS \
80
- --event_data.req_method=ANY \
81
- --event_data.func_info.timeout=5000 \
82
- --event_data.instance_id=<apig-instance-id> \
83
- --event_data.group_id=<api-group-id> \
84
- --event_data.sl_domain=<sl-domain> \
85
- --event_data.env_name=RELEASE \
86
- --event_data.env_id=<env-id>
87
- ```
88
-
89
- After trigger creation, you must **publish** the API before it's accessible:
90
-
91
- ```bash
92
- hcloud APIG BatchPublishOrOfflineApiV2 \
93
- --instance_id=<apig-instance-id> \
94
- --action=online \
95
- --env_id=<env-id> \
96
- --api_ids=<api-id-from-trigger-response>
97
- ```
98
-
99
- ### Alternative: --cli-jsonInput (Recommended for Complex Configs)
100
-
101
- For trigger configs with many nested fields, use `--cli-jsonInput` to avoid shell escaping issues:
102
-
103
- ```bash
104
- cat > trigger.json << 'EOF'
105
- {
106
- "trigger_type_code": "DEDICATEDGATEWAY",
107
- "trigger_status": "ACTIVE",
108
- "event_type_code": "APICreated",
109
- "event_data": {
110
- "name": "my-api",
111
- "auth": "IAM",
112
- "path": "/my-backend",
113
- "match_mode": "SWA",
114
- "type": 1,
115
- "protocol": "HTTPS",
116
- "req_method": "ANY",
117
- "func_info": { "timeout": 5000 },
118
- "instance_id": "<apig-instance-id>",
119
- "group_id": "<api-group-id>",
120
- "sl_domain": "<sl-domain>",
121
- "env_name": "RELEASE",
122
- "env_id": "<env-id>"
123
- }
124
- }
125
- EOF
126
- hcloud FunctionGraph CreateFunctionTrigger \
127
- --function_urn=<urn> \
128
- --cli-region=<region> \
129
- --project_id=<project_id> \
130
- --cli-jsonInput=trigger.json
131
- ```
132
-
133
- ## List / Delete Triggers
134
-
135
- ```bash
136
- hcloud FunctionGraph ListFunctionTriggers --function_urn=<urn>
137
- hcloud FunctionGraph DeleteFunctionTrigger --function_urn=<urn> --trigger_type_code=<type> --trigger_id=<id>
138
- ```
139
-
140
- > Deleting a trigger does NOT cascade-delete the associated APIG API. After `DeleteFunctionTrigger`, also run `hcloud APIG ListApisV2 --instance_id=<id>` and delete orphaned APIs to avoid resource residue.
141
- >
142
- > **APIG event format**: When using DEDICATEDGATEWAY, the event body is Base64 encoded and uses a non-standard structure. See `apig-event-format.md` for handler templates.
1
+ # Triggers
2
+
3
+ **Always run `hcloud FunctionGraph CreateFunctionTrigger --help` first** for exact parameter names and requirements.
4
+
5
+ ## KooCLI event_data Format (CRITICAL)
6
+
7
+ KooCLI uses **dotted key-value format**, NOT JSON strings:
8
+
9
+ ```bash
10
+ # CORRECT
11
+ --event_data.name=my-api --event_data.auth=IAM --event_data.path=/test
12
+
13
+ # WRONG — will fail
14
+ --event_data='{"name":"my-api","auth":"IAM","path":"/test"}'
15
+ ```
16
+
17
+ ## Trigger Types
18
+
19
+ | Type | `--trigger_type_code` | Notes |
20
+ |------|----------------------|-------|
21
+ | APIG Dedicated | `DEDICATEDGATEWAY` | Use this, not `APIG` (deprecated). Requires APIG instance. |
22
+ | Timer / Cron | `TIMER` | Simplest trigger for testing. No APIG dependency. |
23
+ | OBS | `OBS` | Event when objects created/deleted in bucket |
24
+ | SMN | `SMN` | Message notification trigger |
25
+
26
+ ## TIMER Trigger (Simple Testing)
27
+
28
+ The TIMER trigger is the easiest path for verifying a function works — no APIG instance needed:
29
+
30
+ ```bash
31
+ hcloud FunctionGraph CreateFunctionTrigger \
32
+ --function_urn=<urn> \
33
+ --trigger_type_code=TIMER \
34
+ --event_type_code=MessageCreated \
35
+ --trigger_status=ACTIVE \
36
+ --event_data.name=<trigger-name> \
37
+ --event_data.schedule_type=Rate \
38
+ --event_data.schedule="1m"
39
+ ```
40
+
41
+ ## DEDICATEDGATEWAY Trigger (HTTP Access)
42
+
43
+ `trigger_type_code=APIG` is **deprecated**. Use `DEDICATEDGATEWAY` for KooCLI 7.x.
44
+
45
+ ### Required Parameters (Hidden Optional)
46
+
47
+ These are labeled optional by `--help` but are **required** for DEDICATEDGATEWAY:
48
+
49
+ | Param | Note |
50
+ |-------|------|
51
+ | `--event_data.protocol` | `HTTPS` or `HTTP` or `BOTH` |
52
+ | `--event_data.sl_domain` | Subdomain from APIG instance (e.g. `xxxx.apic.<region>.huaweicloudapis.com`) |
53
+ | `--event_data.env_name` | API environment name (`RELEASE`) |
54
+ | `--event_data.env_id` | API environment ID |
55
+ | `--event_data.instance_id` | APIG dedicated instance ID |
56
+ | `--event_data.group_id` | API group ID |
57
+ | `--event_data.name` | API name — **hyphens (`-`) are DISALLOWED**. Use underscores (`_`) instead. |
58
+
59
+ ### Error Mapping
60
+
61
+ | Error | Root Cause → Fix |
62
+ |-------|-----------------|
63
+ | FSS.1417 | Missing `instance_id`, `group_id`, `protocol`, `env_name`, or `env_id`. These are labeled optional but REQUIRED. |
64
+ | API name regex fail | Rename API — remove hyphens (`-`), use `[a-zA-Z0-9_]+` only. |
65
+
66
+ ### Example
67
+
68
+ ```bash
69
+ hcloud FunctionGraph CreateFunctionTrigger \
70
+ --function_urn=<urn> \
71
+ --trigger_type_code=DEDICATEDGATEWAY \
72
+ --event_type_code=APICreated \
73
+ --trigger_status=ACTIVE \
74
+ --event_data.name=<api-name-no-hyphens> \
75
+ --event_data.auth=IAM \
76
+ --event_data.path=/my-backend \
77
+ --event_data.match_mode=SWA \
78
+ --event_data.type=1 \
79
+ --event_data.protocol=HTTPS \
80
+ --event_data.req_method=ANY \
81
+ --event_data.func_info.timeout=5000 \
82
+ --event_data.instance_id=<apig-instance-id> \
83
+ --event_data.group_id=<api-group-id> \
84
+ --event_data.sl_domain=<sl-domain> \
85
+ --event_data.env_name=RELEASE \
86
+ --event_data.env_id=<env-id>
87
+ ```
88
+
89
+ After trigger creation, you must **publish** the API before it's accessible:
90
+
91
+ ```bash
92
+ hcloud APIG BatchPublishOrOfflineApiV2 \
93
+ --instance_id=<apig-instance-id> \
94
+ --action=online \
95
+ --env_id=<env-id> \
96
+ --api_ids=<api-id-from-trigger-response>
97
+ ```
98
+
99
+ ### Alternative: --cli-jsonInput (Recommended for Complex Configs)
100
+
101
+ For trigger configs with many nested fields, use `--cli-jsonInput` to avoid shell escaping issues:
102
+
103
+ ```bash
104
+ cat > trigger.json << 'EOF'
105
+ {
106
+ "trigger_type_code": "DEDICATEDGATEWAY",
107
+ "trigger_status": "ACTIVE",
108
+ "event_type_code": "APICreated",
109
+ "event_data": {
110
+ "name": "my-api",
111
+ "auth": "IAM",
112
+ "path": "/my-backend",
113
+ "match_mode": "SWA",
114
+ "type": 1,
115
+ "protocol": "HTTPS",
116
+ "req_method": "ANY",
117
+ "func_info": { "timeout": 5000 },
118
+ "instance_id": "<apig-instance-id>",
119
+ "group_id": "<api-group-id>",
120
+ "sl_domain": "<sl-domain>",
121
+ "env_name": "RELEASE",
122
+ "env_id": "<env-id>"
123
+ }
124
+ }
125
+ EOF
126
+ hcloud FunctionGraph CreateFunctionTrigger \
127
+ --function_urn=<urn> \
128
+ --cli-region=<region> \
129
+ --project_id=<project_id> \
130
+ --cli-jsonInput=trigger.json
131
+ ```
132
+
133
+ ## List / Delete Triggers
134
+
135
+ ```bash
136
+ hcloud FunctionGraph ListFunctionTriggers --function_urn=<urn>
137
+ hcloud FunctionGraph DeleteFunctionTrigger --function_urn=<urn> --trigger_type_code=<type> --trigger_id=<id>
138
+ ```
139
+
140
+ > Deleting a trigger does NOT cascade-delete the associated APIG API. After `DeleteFunctionTrigger`, also run `hcloud APIG ListApisV2 --instance_id=<id>` and delete orphaned APIs to avoid resource residue.
141
+ >
142
+ > **APIG event format**: When using DEDICATEDGATEWAY, the event body is Base64 encoded and uses a non-standard structure. See `apig-event-format.md` for handler templates.
@@ -1,56 +1,56 @@
1
- ---
2
- name: huawei-gaussdb
3
- description: "Use when creating or managing GaussDB distributed database on Huawei Cloud. Covers GaussDB(for MySQL), GaussDB(for openGauss), sharding, HTAP. Triggers: GaussDB, distributed database, sharding, openGauss, HTAP. NOT for: single RDS (use huawei-rds)."
4
- version: 1
5
- ---
6
-
7
- # Huawei Cloud GaussDB
8
-
9
- **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
-
11
- Always run `hcloud GaussDB <Operation> --help` before constructing commands to discover exact parameter names and requirements.
12
-
13
- ## Overview
14
-
15
- Domain expertise for GaussDB. Covers instance lifecycle, databases, backups, configurations, and shard/readonly node management.
16
-
17
- ## Critical Warnings
18
-
19
- | Trap | Why |
20
- |------|-----|
21
- | Shard key permanent | Once set, shard key cannot be changed |
22
- | Minimum nodes | Distributed GaussDB requires at least 3 nodes for production |
23
- | Engine version pinned | MySQL-compatible vs openGauss are separate products |
24
-
25
- ## Common Workflows
26
-
27
- | Task | Operation |
28
- |------|-----------|
29
- | List instances | `ListInstances --cli-region=<r> --project_id=<p>` |
30
- | Show instance | `ShowInstance --cli-region=<r> --project_id=<p>` |
31
- | List flavors | `ListFlavors --cli-region=<r> --project_id=<p>` |
32
- | Create instance | `CreateInstance --cli-region=<r> --project_id=<p>` |
33
- | Delete instance | `DeleteInstance --cli-region=<r> --project_id=<p>` |
34
- | Create backup | `CreateGaussMySqlBackup --cli-region=<r> --project_id=<p>` |
35
- | Add readonly node | `AddReadonlyNode --cli-region=<r> --project_id=<p>` |
36
- | Add shard | `AddShardingNode --cli-region=<r> --project_id=<p>` |
37
- | Manage database | `AddDatabasePermission --cli-region=<r> --project_id=<p>` |
38
-
39
- Discover exact parameters with `--help` before executing any command.
40
-
41
- ## Troubleshooting
42
-
43
- | Error | Fix |
44
- |-------|-----|
45
- | Instance creation fails | Check VPC/subnet availability and flavor capacity |
46
- | Connection refused | SG missing database port |
47
-
48
- ## Security
49
-
50
- - MUST use security groups for database access
51
- - MUST enable SSL for connections
52
-
53
- ## Cross-Skill References
54
-
55
- - **VPC/Subnet/Security Group**: See `huawei-vpc`
56
- - **Backup/CBR**: See `huawei-cbr`
1
+ ---
2
+ name: huawei-gaussdb
3
+ description: "Use when creating or managing GaussDB distributed database on Huawei Cloud. Covers GaussDB(for MySQL), GaussDB(for openGauss), sharding, HTAP. Triggers: GaussDB, distributed database, sharding, openGauss, HTAP. NOT for: single RDS (use huawei-rds)."
4
+ version: 1
5
+ ---
6
+
7
+ # Huawei Cloud GaussDB
8
+
9
+ **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
+
11
+ Always run `hcloud GaussDB <Operation> --help` before constructing commands to discover exact parameter names and requirements.
12
+
13
+ ## Overview
14
+
15
+ Domain expertise for GaussDB. Covers instance lifecycle, databases, backups, configurations, and shard/readonly node management.
16
+
17
+ ## Critical Warnings
18
+
19
+ | Trap | Why |
20
+ |------|-----|
21
+ | Shard key permanent | Once set, shard key cannot be changed |
22
+ | Minimum nodes | Distributed GaussDB requires at least 3 nodes for production |
23
+ | Engine version pinned | MySQL-compatible vs openGauss are separate products |
24
+
25
+ ## Common Workflows
26
+
27
+ | Task | Operation |
28
+ |------|-----------|
29
+ | List instances | `ListInstances --cli-region=<r> --project_id=<p>` |
30
+ | Show instance | `ShowInstance --cli-region=<r> --project_id=<p>` |
31
+ | List flavors | `ListFlavors --cli-region=<r> --project_id=<p>` |
32
+ | Create instance | `CreateInstance --cli-region=<r> --project_id=<p>` |
33
+ | Delete instance | `DeleteInstance --cli-region=<r> --project_id=<p>` |
34
+ | Create backup | `CreateGaussMySqlBackup --cli-region=<r> --project_id=<p>` |
35
+ | Add readonly node | `AddReadonlyNode --cli-region=<r> --project_id=<p>` |
36
+ | Add shard | `AddShardingNode --cli-region=<r> --project_id=<p>` |
37
+ | Manage database | `AddDatabasePermission --cli-region=<r> --project_id=<p>` |
38
+
39
+ Discover exact parameters with `--help` before executing any command.
40
+
41
+ ## Troubleshooting
42
+
43
+ | Error | Fix |
44
+ |-------|-----|
45
+ | Instance creation fails | Check VPC/subnet availability and flavor capacity |
46
+ | Connection refused | SG missing database port |
47
+
48
+ ## Security
49
+
50
+ - MUST use security groups for database access
51
+ - MUST enable SSL for connections
52
+
53
+ ## Cross-Skill References
54
+
55
+ - **VPC/Subnet/Security Group**: See `huawei-vpc`
56
+ - **Backup/CBR**: See `huawei-cbr`