@huawei-iac-tools/landingzone-workbench 0.0.0-stage → 0.0.1

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 (246) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +85 -2
  3. package/cordis.patch.yml +21 -0
  4. package/knowledge/account-qualification.md +128 -0
  5. package/knowledge/blueprints/_base/blueprint.json +481 -0
  6. package/knowledge/blueprints/_base/defaults.json +127 -0
  7. package/knowledge/blueprints/foundation-lz/blueprint.json +43 -0
  8. package/knowledge/blueprints/foundation-lz/defaults.json +47 -0
  9. package/knowledge/blueprints/full-lz/blueprint.json +11 -0
  10. package/knowledge/blueprints/full-lz/defaults.json +8 -0
  11. package/knowledge/config.json +43 -0
  12. package/knowledge/error-rules.json +14 -0
  13. package/knowledge/ic-policies.json +21 -0
  14. package/knowledge/modules/account-structure.md +101 -0
  15. package/knowledge/modules/compliance/config-rms.md +212 -0
  16. package/knowledge/modules/compliance/cts.md +179 -0
  17. package/knowledge/modules/compliance/obs-lts.md +155 -0
  18. package/knowledge/modules/ic-policies.json +21 -0
  19. package/knowledge/modules/identity-center.md +603 -0
  20. package/knowledge/modules/module-layers.md +169 -0
  21. package/knowledge/modules/network/er.md +222 -0
  22. package/knowledge/modules/network/nat-eip.md +123 -0
  23. package/knowledge/modules/network/ram-share.md +92 -0
  24. package/knowledge/modules/network/vpc-subnet.md +142 -0
  25. package/knowledge/modules/organization-security/scp.md +122 -0
  26. package/knowledge/modules/organizations.md +212 -0
  27. package/knowledge/modules/recommended-config.md +157 -0
  28. package/knowledge/modules/recommended-rules.json +175 -0
  29. package/knowledge/modules/scp-policies.json +111 -0
  30. package/knowledge/modules/security/aad.md +94 -0
  31. package/knowledge/modules/security/cfw.md +105 -0
  32. package/knowledge/modules/security/waf.md +110 -0
  33. package/knowledge/param-mappings.json +133 -0
  34. package/knowledge/prompts.md +83 -0
  35. package/knowledge/resource-types.json +1162 -0
  36. package/knowledge/scp-policies.json +111 -0
  37. package/knowledge/state-machine.md +33 -0
  38. package/lib/client.js +21 -0
  39. package/lib/index.js +28592 -0
  40. package/lib/types/account-role.d.ts +19 -0
  41. package/lib/types/account-scope.d.ts +10 -0
  42. package/lib/types/agency.d.ts +38 -0
  43. package/lib/types/client/DropdownSelect.d.ts +49 -0
  44. package/lib/types/client/LoginGate.d.ts +20 -0
  45. package/lib/types/client/PanelIcon.d.ts +11 -0
  46. package/lib/types/client/WorkbenchShell.d.ts +21 -0
  47. package/lib/types/client/account-role.d.ts +15 -0
  48. package/lib/types/client/credential-status.d.ts +15 -0
  49. package/lib/types/client/huawei-mark.d.ts +37 -0
  50. package/lib/types/client/index.d.ts +26 -0
  51. package/lib/types/client/layout-ref.d.ts +23 -0
  52. package/lib/types/client/pages/ConfigPage/AdviceCard.d.ts +26 -0
  53. package/lib/types/client/pages/ConfigPage/AuditBar.d.ts +21 -0
  54. package/lib/types/client/pages/ConfigPage/ChangeSummaryCard.d.ts +22 -0
  55. package/lib/types/client/pages/ConfigPage/ChangesCard.d.ts +27 -0
  56. package/lib/types/client/pages/ConfigPage/ComplianceDetail.d.ts +25 -0
  57. package/lib/types/client/pages/ConfigPage/ComplianceSummaryCard.d.ts +31 -0
  58. package/lib/types/client/pages/ConfigPage/FindingsCard.d.ts +21 -0
  59. package/lib/types/client/pages/ConfigPage/GlossaryDrawer.d.ts +17 -0
  60. package/lib/types/client/pages/ConfigPage/OrgComplianceDetail.d.ts +15 -0
  61. package/lib/types/client/pages/ConfigPage/Pager.d.ts +32 -0
  62. package/lib/types/client/pages/ConfigPage/ResourceDrawer.d.ts +26 -0
  63. package/lib/types/client/pages/ConfigPage/ResourcesTable.d.ts +35 -0
  64. package/lib/types/client/pages/ConfigPage/RollupPanel.d.ts +17 -0
  65. package/lib/types/client/pages/ConfigPage/RuleDetailDrawer.d.ts +23 -0
  66. package/lib/types/client/pages/ConfigPage/StatusCards.d.ts +26 -0
  67. package/lib/types/client/pages/ConfigPage/UncoveredDialog.d.ts +22 -0
  68. package/lib/types/client/pages/ConfigPage/config-api.d.ts +101 -0
  69. package/lib/types/client/pages/ConfigPage/config-store.d.ts +57 -0
  70. package/lib/types/client/pages/ConfigPage/index.d.ts +21 -0
  71. package/lib/types/client/pages/ConfigPage/paging.d.ts +46 -0
  72. package/lib/types/client/pages/ConfigPage/scope-options.d.ts +51 -0
  73. package/lib/types/client/pages/CostPage/AccountAllocation.d.ts +24 -0
  74. package/lib/types/client/pages/CostPage/AccountBars.d.ts +20 -0
  75. package/lib/types/client/pages/CostPage/AccountColumns.d.ts +24 -0
  76. package/lib/types/client/pages/CostPage/AccountDonut.d.ts +18 -0
  77. package/lib/types/client/pages/CostPage/AccountSwitcher.d.ts +25 -0
  78. package/lib/types/client/pages/CostPage/AdviceCard.d.ts +43 -0
  79. package/lib/types/client/pages/CostPage/AdviceFindings.d.ts +43 -0
  80. package/lib/types/client/pages/CostPage/BillingPanels.d.ts +23 -0
  81. package/lib/types/client/pages/CostPage/BudgetCard.d.ts +36 -0
  82. package/lib/types/client/pages/CostPage/GlossaryDrawer.d.ts +16 -0
  83. package/lib/types/client/pages/CostPage/KpiRow.d.ts +23 -0
  84. package/lib/types/client/pages/CostPage/MarkdownBlock.d.ts +16 -0
  85. package/lib/types/client/pages/CostPage/ReportView.d.ts +17 -0
  86. package/lib/types/client/pages/CostPage/ResourceColumns.d.ts +19 -0
  87. package/lib/types/client/pages/CostPage/ResourceDonut.d.ts +18 -0
  88. package/lib/types/client/pages/CostPage/ResourcesCard.d.ts +40 -0
  89. package/lib/types/client/pages/CostPage/RuleDetailDrawer.d.ts +23 -0
  90. package/lib/types/client/pages/CostPage/SavingView.d.ts +38 -0
  91. package/lib/types/client/pages/CostPage/ServiceDonut.d.ts +17 -0
  92. package/lib/types/client/pages/CostPage/TrendChart.d.ts +24 -0
  93. package/lib/types/client/pages/CostPage/budget-input.d.ts +30 -0
  94. package/lib/types/client/pages/CostPage/cost-api.d.ts +266 -0
  95. package/lib/types/client/pages/CostPage/cost-store.d.ts +25 -0
  96. package/lib/types/client/pages/CostPage/format.d.ts +37 -0
  97. package/lib/types/client/pages/CostPage/index.d.ts +34 -0
  98. package/lib/types/client/pages/CostPage/trend-fold.d.ts +32 -0
  99. package/lib/types/client/pages/CostPage/useEcharts.d.ts +70 -0
  100. package/lib/types/client/pages/OrgStructurePage/AccountStatsCard.d.ts +22 -0
  101. package/lib/types/client/pages/OrgStructurePage/CoreAccountsCard.d.ts +18 -0
  102. package/lib/types/client/pages/OrgStructurePage/CreateAccountDialog.d.ts +28 -0
  103. package/lib/types/client/pages/OrgStructurePage/ManageUsersDialog.d.ts +28 -0
  104. package/lib/types/client/pages/OrgStructurePage/MemberAccountsTable.d.ts +32 -0
  105. package/lib/types/client/pages/OrgStructurePage/MoveAccountDialog.d.ts +29 -0
  106. package/lib/types/client/pages/OrgStructurePage/OrgGlossaryDrawer.d.ts +13 -0
  107. package/lib/types/client/pages/OrgStructurePage/OrgTreeCard.d.ts +31 -0
  108. package/lib/types/client/pages/OrgStructurePage/index.d.ts +21 -0
  109. package/lib/types/client/pages/OrgStructurePage/org-api.d.ts +166 -0
  110. package/lib/types/client/pages/OverviewPage/AnchorRow.d.ts +24 -0
  111. package/lib/types/client/pages/OverviewPage/AttentionList.d.ts +29 -0
  112. package/lib/types/client/pages/OverviewPage/OverviewCharts.d.ts +79 -0
  113. package/lib/types/client/pages/OverviewPage/OverviewGlossaryDrawer.d.ts +15 -0
  114. package/lib/types/client/pages/OverviewPage/index.d.ts +22 -0
  115. package/lib/types/client/pages/OverviewPage/overview-api.d.ts +115 -0
  116. package/lib/types/client/pages/ResourcePage/AccountResourceList.d.ts +21 -0
  117. package/lib/types/client/pages/ResourcePage/components/GlossaryDrawer.d.ts +20 -0
  118. package/lib/types/client/pages/ResourcePage/components/MetricCards.d.ts +19 -0
  119. package/lib/types/client/pages/ResourcePage/components/MultiSelect.d.ts +27 -0
  120. package/lib/types/client/pages/ResourcePage/components/PanelPager.d.ts +26 -0
  121. package/lib/types/client/pages/ResourcePage/components/RankBars.d.ts +25 -0
  122. package/lib/types/client/pages/ResourcePage/components/ScopeSelect.d.ts +27 -0
  123. package/lib/types/client/pages/ResourcePage/components/SourceConfigModal.d.ts +21 -0
  124. package/lib/types/client/pages/ResourcePage/components/SyncControls.d.ts +18 -0
  125. package/lib/types/client/pages/ResourcePage/components/TrendChart.d.ts +14 -0
  126. package/lib/types/client/pages/ResourcePage/components/useColumnWidths.d.ts +12 -0
  127. package/lib/types/client/pages/ResourcePage/format.d.ts +9 -0
  128. package/lib/types/client/pages/ResourcePage/index.d.ts +20 -0
  129. package/lib/types/client/pages/ResourcePage/summary-api.d.ts +205 -0
  130. package/lib/types/client/pages/SetupPage/AskPanel.d.ts +21 -0
  131. package/lib/types/client/pages/SetupPage/ChatEmbed.d.ts +40 -0
  132. package/lib/types/client/pages/SetupPage/ChatTab.d.ts +17 -0
  133. package/lib/types/client/pages/SetupPage/FormTab.d.ts +12 -0
  134. package/lib/types/client/pages/SetupPage/FormTabV2.d.ts +14 -0
  135. package/lib/types/client/pages/SetupPage/ProgressTreeView.d.ts +15 -0
  136. package/lib/types/client/pages/SetupPage/StageFlow.d.ts +16 -0
  137. package/lib/types/client/pages/SetupPage/index.d.ts +10 -0
  138. package/lib/types/client/pages/SetupPage/progress-types.d.ts +36 -0
  139. package/lib/types/client/pages/SetupPage/session-binding.d.ts +38 -0
  140. package/lib/types/client/pages/SetupPage/session-store.d.ts +57 -0
  141. package/lib/types/client/pages/SetupPage/sessions-ref.d.ts +5 -0
  142. package/lib/types/client/pages/SetupPage/setup-replan.d.ts +13 -0
  143. package/lib/types/client/pages/SetupPage/wb-api.d.ts +192 -0
  144. package/lib/types/client/pages/list-preview.d.ts +36 -0
  145. package/lib/types/client/permission-mode.d.ts +53 -0
  146. package/lib/types/client/store.d.ts +22 -0
  147. package/lib/types/collect.d.ts +78 -0
  148. package/lib/types/config/account-scope.d.ts +61 -0
  149. package/lib/types/config/advice-findings.d.ts +31 -0
  150. package/lib/types/config/advice-prompt.d.ts +60 -0
  151. package/lib/types/config/advice.d.ts +116 -0
  152. package/lib/types/config/cts.d.ts +30 -0
  153. package/lib/types/config/evidence/rules.d.ts +31 -0
  154. package/lib/types/config/evidence/types.d.ts +103 -0
  155. package/lib/types/config/failure-note.d.ts +46 -0
  156. package/lib/types/config/fingerprint-cache.d.ts +45 -0
  157. package/lib/types/config/identity.d.ts +67 -0
  158. package/lib/types/config/query.d.ts +49 -0
  159. package/lib/types/config/rms.d.ts +412 -0
  160. package/lib/types/config/routes.d.ts +32 -0
  161. package/lib/types/config/types.d.ts +785 -0
  162. package/lib/types/config/views.d.ts +158 -0
  163. package/lib/types/cost/accounts.d.ts +29 -0
  164. package/lib/types/cost/advice-findings.d.ts +77 -0
  165. package/lib/types/cost/advice-model.d.ts +19 -0
  166. package/lib/types/cost/advice-prompt.d.ts +73 -0
  167. package/lib/types/cost/advice-subagent-types.d.ts +6 -0
  168. package/lib/types/cost/advice-subagent.d.ts +116 -0
  169. package/lib/types/cost/advice-types.d.ts +63 -0
  170. package/lib/types/cost/advice.d.ts +125 -0
  171. package/lib/types/cost/aggregate.d.ts +157 -0
  172. package/lib/types/cost/assume.d.ts +43 -0
  173. package/lib/types/cost/bss.d.ts +166 -0
  174. package/lib/types/cost/budget-overview.d.ts +38 -0
  175. package/lib/types/cost/budget.d.ts +56 -0
  176. package/lib/types/cost/cache.d.ts +58 -0
  177. package/lib/types/cost/caliber.d.ts +40 -0
  178. package/lib/types/cost/console-links.d.ts +27 -0
  179. package/lib/types/cost/credentials.d.ts +38 -0
  180. package/lib/types/cost/data-window.d.ts +38 -0
  181. package/lib/types/cost/evidence/catalog.d.ts +35 -0
  182. package/lib/types/cost/evidence/index.d.ts +70 -0
  183. package/lib/types/cost/evidence/inventory.d.ts +44 -0
  184. package/lib/types/cost/evidence/pricing.d.ts +72 -0
  185. package/lib/types/cost/evidence/projects.d.ts +18 -0
  186. package/lib/types/cost/evidence/rules.d.ts +66 -0
  187. package/lib/types/cost/evidence/state.d.ts +38 -0
  188. package/lib/types/cost/evidence/thresholds.d.ts +68 -0
  189. package/lib/types/cost/evidence/types.d.ts +288 -0
  190. package/lib/types/cost/evidence/utilization.d.ts +37 -0
  191. package/lib/types/cost/history.d.ts +36 -0
  192. package/lib/types/cost/ledger.d.ts +97 -0
  193. package/lib/types/cost/normalize.d.ts +37 -0
  194. package/lib/types/cost/period-projection.d.ts +57 -0
  195. package/lib/types/cost/plan-check.d.ts +102 -0
  196. package/lib/types/cost/plan-db.d.ts +73 -0
  197. package/lib/types/cost/plan-types.d.ts +183 -0
  198. package/lib/types/cost/plan.d.ts +63 -0
  199. package/lib/types/cost/quote.d.ts +45 -0
  200. package/lib/types/cost/report.d.ts +136 -0
  201. package/lib/types/cost/resources.d.ts +108 -0
  202. package/lib/types/cost/routes.d.ts +38 -0
  203. package/lib/types/cost/scope.d.ts +42 -0
  204. package/lib/types/cost/types.d.ts +335 -0
  205. package/lib/types/cost/unit-prices-derive.d.ts +19 -0
  206. package/lib/types/cost/unit-prices.d.ts +23 -0
  207. package/lib/types/db.d.ts +228 -0
  208. package/lib/types/host-log.d.ts +7 -0
  209. package/lib/types/http.d.ts +42 -0
  210. package/lib/types/index.d.ts +30 -0
  211. package/lib/types/inventory.d.ts +286 -0
  212. package/lib/types/obs.d.ts +16 -0
  213. package/lib/types/org/aggregate.d.ts +36 -0
  214. package/lib/types/org/churn.d.ts +10 -0
  215. package/lib/types/org/orgs.d.ts +258 -0
  216. package/lib/types/org/routes.d.ts +28 -0
  217. package/lib/types/org-types.d.ts +156 -0
  218. package/lib/types/per-service.d.ts +39 -0
  219. package/lib/types/setup/blueprint-loader.d.ts +81 -0
  220. package/lib/types/setup/caller.d.ts +105 -0
  221. package/lib/types/setup/engine.d.ts +41 -0
  222. package/lib/types/setup/form-store.d.ts +13 -0
  223. package/lib/types/setup/nodes/n1-check.d.ts +14 -0
  224. package/lib/types/setup/nodes/n10-governance.d.ts +6 -0
  225. package/lib/types/setup/nodes/n11-infra.d.ts +6 -0
  226. package/lib/types/setup/nodes/n12-reconcile.d.ts +6 -0
  227. package/lib/types/setup/nodes/n2-region.d.ts +6 -0
  228. package/lib/types/setup/nodes/n3-blueprint.d.ts +6 -0
  229. package/lib/types/setup/nodes/n4-modules.d.ts +6 -0
  230. package/lib/types/setup/nodes/n5-details.d.ts +6 -0
  231. package/lib/types/setup/nodes/n6-plan.d.ts +6 -0
  232. package/lib/types/setup/nodes/n7-verify.d.ts +6 -0
  233. package/lib/types/setup/nodes/n8-approve.d.ts +6 -0
  234. package/lib/types/setup/nodes/n9-buildmode.d.ts +6 -0
  235. package/lib/types/setup/plan-state.d.ts +10 -0
  236. package/lib/types/setup/prompt-loader.d.ts +16 -0
  237. package/lib/types/setup/routes.d.ts +22 -0
  238. package/lib/types/setup/session-notify.d.ts +30 -0
  239. package/lib/types/setup/tools.d.ts +19 -0
  240. package/lib/types/setup/types.d.ts +157 -0
  241. package/lib/types/sse-bus.d.ts +23 -0
  242. package/lib/types/tools/config-facts.d.ts +16 -0
  243. package/lib/types/tools/cost-facts.d.ts +10 -0
  244. package/lib/types/tools/register.d.ts +18 -0
  245. package/lib/types/wb-conventions.d.ts +140 -0
  246. package/package.json +77 -4
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "blueprint-v1",
3
+ "id": "full-lz",
4
+ "extends": "_base",
5
+ "label": "全域服务",
6
+ "desc": "所有服务全开放——网络/身份中心/防火墙等逐项细配,适合全量生产或学习完整 Landing Zone",
7
+ "suitableFor": ["全量生产", "完整 LZ", "学习演练"],
8
+ "hiddenModules": [],
9
+ "dependencies": [],
10
+ "sections": []
11
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "blueprint-defaults-v1",
3
+ "description": "全域服务蓝图默认值:模块不预勾选(用户自由多选);预算不锁定(N6 后询问/填写);其余继承 _base。",
4
+ "prefill": { "modules": { "enhanced": [], "extended": [] } },
5
+ "lockedFields": [],
6
+ "budgetCeiling": null,
7
+ "values": {}
8
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "$schema": "workbench-lz-config-v1",
3
+ "description": "初始搭建全局配置常量(迁移自旧插件 config.json,按 05§8.1 改造:+validRegions/+writeMode;host 兜底沿用)",
4
+ "defaultRegion": "cn-north-4",
5
+ "validRegions": ["cn-north-4", "cn-east-3", "cn-south-1"],
6
+ "writeMode": "dry-run",
7
+ "retry": {
8
+ "description": "云调用重试(网络瞬时错 + 429)。caller.ts 读此配置,不硬编码。",
9
+ "retryablePatterns": [
10
+ "fetch failed", "timeout", "ETIMEDOUT", "ECONNRESET", "ECONNREFUSED",
11
+ "ENOTFOUND", "EAI_AGAIN", "socket hang up", "network error",
12
+ "429", "ratelimit", "rate limit", "throttl", "too many requests"
13
+ ],
14
+ "maxRetries": 3,
15
+ "baseDelayMs": 800,
16
+ "maxDelayMs": 6000
17
+ },
18
+ "statusGroups": {
19
+ "description": "资源执行状态分组(幂等判断)。orchestrator 读此配置判断哪些状态算成功可复用。",
20
+ "success": ["created", "exists", "queried", "historical_exists"],
21
+ "skip": ["skipped"],
22
+ "retry": ["failed", "blocked"],
23
+ "pending": ["pending"]
24
+ },
25
+ "asyncPollDefaults": {
26
+ "description": "异步资源轮询默认(超时/间隔)。资源级 asyncPoll 优先。",
27
+ "timeoutMs": 120000,
28
+ "intervalMs": 5000
29
+ },
30
+ "hostFallbacks": {
31
+ "description": "服务 host 兜底(service → host 模板,支持 ${region} 占位)。",
32
+ "Organizations": "organizations.myhuaweicloud.com",
33
+ "IdentityCenter": "identitystore.myhuaweicloud.com",
34
+ "IAM": "iam.myhuaweicloud.com",
35
+ "BSS": "bss.myhuaweicloud.com",
36
+ "RMS": "rms.myhuaweicloud.com",
37
+ "VPC": "vpc.${region}.myhuaweicloud.com",
38
+ "CTS": "cts.${region}.myhuaweicloud.com",
39
+ "ECS": "ecs.${region}.myhuaweicloud.com",
40
+ "OBS": "obs.${region}.myhuaweicloud.com",
41
+ "Config": "config.${region}.myhuaweicloud.com"
42
+ }
43
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "error-rules-v2",
3
+ "description": "halt 规则(workbench 版,09 G1/10 篇定稿):detect 改 kind 结构化匹配,弃文案匹配(修旧 H1 死代码——直签名/桥的错误归一化已产出结构化 kind)。orchestrator 读本文件,匹配则停止整批并标记剩余资源为 blocked。",
4
+ "haltRules": [
5
+ {
6
+ "id": "permission-denied",
7
+ "detect": "kind",
8
+ "kind": "permission",
9
+ "reason": "权限拒绝(只读模式/凭据无效/非管理账号)",
10
+ "action": "halt",
11
+ "userGuidance": "写操作被权限拦截:若会话为只读模式,请在 DSH 设置开启读写模式;若凭据过期请重新认证 ops-deploy 凭据(401);若提示非组织管理账号,请切换管理账号凭据(403)。已完成的只读操作不受影响,处理后重试即可(已建项自动跳过)。"
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "ic-policies-v1",
3
+ "description": "IC 权限集策略推荐定义(唯一来源)。planner.ts getModuleRecommendedConfig / applyModuleDetailParams 读此文件。改策略 content 只改本文件。路径 B:用自定义策略(PutCustomPolicyToPermissionSet),AK/SK 可调,不依赖系统策略 role id 查询(避免 ListPermissions 需 token 的障碍)。",
4
+ "policies": [
5
+ {
6
+ "code": "lzReadOnlyCustomPolicy",
7
+ "name": "LZ-ReadOnly-Custom",
8
+ "description": "Landing Zone 只读权限(查/列表/展示类操作全放开)",
9
+ "content": {
10
+ "Version": "5.0",
11
+ "Statement": [
12
+ {
13
+ "Effect": "Allow",
14
+ "Action": ["*:get*", "*:list*", "*:show*", "*:query*", "*:describe*"],
15
+ "Resource": ["*"]
16
+ }
17
+ ]
18
+ }
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,101 @@
1
+ # 账号体系(account-structure)
2
+
3
+ > LZ 的账号骨架——账号怎么划分、怎么分组、各账号什么职责。
4
+ > 这是横切体系,不是独立资源块,但其他所有块都落在它上面。
5
+
6
+ ---
7
+
8
+ ## 一、是什么 / 为什么需要
9
+
10
+ 一套 LZ 有多个账号,需要明确:哪些是基础设施账号(公共服务)、哪些是业务账号(跑业务)、怎么分组管理、谁管什么。
11
+
12
+ **为什么不建在单账号**:单账号无法隔离故障域、无法隔离计费、无法隔离安全边界;多账号 + OU 分组才能做到"公共能力集中、业务能力隔离"。
13
+
14
+ ## 二、里面应该有什么(子结构)
15
+
16
+ ### 账号角色
17
+
18
+ | 角色 | 账号 | 数量 | OU | 职责 |
19
+ |---|---|---|---|---|
20
+ | 管理账号 | hwstaff_xxx(组织根) | 1 | 根 | 组织管理、凭据持有、新版执行 |
21
+ | 基础设施 | SharedServices | 1 | Core | 共享服务(DNS/镜像/共享VPC/ER hub) |
22
+ | 基础设施 | LogArchive | 1 | Core | 日志归档(CTS 委托管理员) |
23
+ | 基础设施 | Security | 1 | Core | 安全运维(Config 委托管理员) |
24
+ | 基础设施 | Ops | 1 | Applications | 运维管理(运维 VPC/NAT) |
25
+ | 调试 | Dev | 可选 | Applications | 测试环境 |
26
+ | 调试 | Prod | 可选 | Applications | 生产环境 |
27
+
28
+ ### OU 树
29
+
30
+ ```
31
+ Organization
32
+ ├── Core OU
33
+ │ ├── SharedServices
34
+ │ ├── LogArchive
35
+ │ └── Security
36
+ └── Applications OU
37
+ ├── Ops(运维)
38
+ ├── Dev(调试,可选)
39
+ ├── Prod(调试,可选)
40
+ └── ...
41
+ ```
42
+
43
+ ### 账号数公式
44
+
45
+ ```
46
+ 总账号数 = 5(管理+共享+日志+安全+运维) + 可选2(调试Dev+Prod)
47
+ ```
48
+
49
+ - 不选调试账号 → 5 账号(管理+3核心+运维)
50
+ - 选调试账号 → 7 账号(+调试Dev+Prod)
51
+
52
+ ## 三、注意点 / 最佳实践 / 坑
53
+
54
+ ### 约束
55
+ - **账号名需 `es_` 前缀**(华为云 Organizations 约定,如 `es_SharedServices_test5`)
56
+ - **账号名必须全名,不允许缩写**:华为云 Organizations 账号名全局唯一,缩写(如 `es_SharedServices`)会和已有账号重名(CreateResourceAccount 失败),且探测时无法与云上实际名精确匹配。全名 = `es_<角色>_<环境标识>`(如 `es_SharedServices_test5`),含环境标识后缀保证唯一。spec.accounts.xxx.name 必须填全名,探测用全名严格相等匹配,不做缩写推导或模糊匹配。
57
+ - **管理账号是组织根**,所有组织级操作用它执行;它的 AK/SK 是"组织钥匙"
58
+ - **成员账号创建是异步的**(CreateResourceAccount → 轮询 ShowCreateAccountStatus),不能创建后立即用
59
+
60
+ ### 最佳实践
61
+ - 业务线测试与生产**分账号**(爆炸半径可控)
62
+ - 公共服务集中在 SharedServices(避免每业务账号重复建)
63
+ - 日志/安全各设专属账号(职责隔离)
64
+
65
+ ### 坑
66
+ - **管理账号本身不能被删除或移出组织**——它是根
67
+ - **账号 status=suspended 的不能复用**(历史 suspended 账号要排除,只复用 active)
68
+ - 成员账号创建后,会自动获得 `OrganizationAccountAccessAgency` 委托——这是 assume 跨账号的基础,无需手动建
69
+
70
+ ## 四、创建依赖
71
+
72
+ ### 前置
73
+ - **Organization 必须先建**(账号挂在组织下)
74
+
75
+ ### 被依赖
76
+ - IC 账号分配依赖账号存在(权限集绑到具体账号)
77
+ - 网络资源(VPC/CFW)建在成员账号内,依赖账号存在 + assume
78
+ - 委托管理员(CTS→LogArchive,Config→Security)依赖对应账号存在
79
+
80
+ ## 五、怎么查接口(指向 ops-deploy)
81
+
82
+ | 查什么 | productshort | 关键 API |
83
+ |---|---|---|
84
+ | 建账号 | Organizations | CreateResourceAccount(异步) |
85
+ | 查账号 | Organizations | ListAccounts |
86
+ | 查账号创建状态 | Organizations | ShowCreateAccountStatus |
87
+ | 建 OU | Organizations | CreateOrganizationalUnit |
88
+ | 查 OU | Organizations | ListOrganizationalUnits |
89
+
90
+ **查法**:`apiexplorer(productshort)` 列 API → `apiexplorer(productshort, apiName, compact=true)` 查契约 → `endpoints=true` 查 host。
91
+ > Organizations 是全局服务,host 不带区域前缀(`organizations.myhuaweicloud.com`),但**以 endpoints 查到的为准**。
92
+
93
+ ## 六、演示示例
94
+
95
+ ```
96
+ 业务线=1:
97
+ 管理账号: hwstaff_ldz_test
98
+ Core OU: es_SharedServices / es_LogArchive / es_SecurityServices
99
+ Apps OU: es_DailyService(Dev) / es_ProdService(Prod)
100
+ 总计 7 账号
101
+ ```
@@ -0,0 +1,212 @@
1
+ # 配置审计 Config/RMS(config-rms)
2
+
3
+ > RMS/Config 盘点"有什么资源、合不合规"。
4
+ > LZ 合规审计四件套之一。
5
+
6
+ ---
7
+
8
+ ## 一、是什么 / 为什么需要
9
+
10
+ RMS(Resource Management Service)/ Config 记录所有账号的资源清单 + 配置变更,支持合规规则评估(如"是否所有 OBS 桶都加密")。组织级聚合让 Security 账号看到全组织资源。
11
+
12
+ **为什么需要**:资源盘点(有什么)、配置合规(对不对)、变更追踪(变了什么);合规审计必备。
13
+
14
+ ## 二、里面应该有什么(子结构)
15
+
16
+ | 资源 | 职责 | 必备 |
17
+ |---|---|---|
18
+ | Config 信任委托 | IAM 委托,让 RMS 代为访问资源 | ✅ |
19
+ | Config 资源记录器 | 记录资源配置 | ✅ |
20
+ | Config 委托管理员 | Security 账号代管组织级 Config | ✅ |
21
+ | 可信服务 service.RMSMultiAccountSetup | 让 RMS 跨账号操作 | ✅ |
22
+ | OBS 桶 | 配置快照转储 | ✅ |
23
+
24
+ ## 三、注意点 / 最佳实践 / 坑
25
+
26
+ ### 约束
27
+ - **RMS 是区域服务**,host 带 `rms.<region>.`
28
+ - **信任委托是 IAM 委托**:建在管理账号(IAM 服务)
29
+ - **Config 记录器依赖信任委托 + OBS 桶**
30
+
31
+ ### 最佳实践
32
+ - Security 账号做 Config 委托管理员(它管安全)
33
+ - 资源记录器转 OBS 桶(配置快照留存)
34
+
35
+ ### 坑
36
+ - **ListConfigurationAggregators 可能 404**:APIGW.0101,容错处理
37
+ - **信任委托名需符合 IAM 命名**:如 `rms_tracker_trust_agency`
38
+
39
+ ## 四、费用属性(预计,仅作方案决策参考,非最终账单)
40
+ | 项目 | 月费(元,预计) | 说明 |
41
+ |---|---|---|
42
+ | Config 资源记录器 | 0 | 基线服务免费,配置快照转 OBS 存储费另计 |
43
+ | Config 信任委托 | 0 | IAM 委托免费 |
44
+
45
+ > RMS/Config 基线免费,关联的 OBS 存储费见 obs-lts.md。
46
+
47
+ ## 五、创建依赖
48
+
49
+ ### 前置
50
+ - **Organization 已建**
51
+ - **service.RMSMultiAccountSetup 可信服务已 enable**
52
+ - **Security 账号已建**(做委托管理员)
53
+ - **OBS 桶已建**(配置转储)
54
+
55
+ ### 被依赖
56
+ - 无(Config 是审计末端)
57
+
58
+ ### 依赖链
59
+ ```
60
+ Organization → enable RMS trusted service
61
+ → 委托管理员(Security)
62
+ → IAM 信任委托(管理账号)
63
+ → OBS 桶
64
+ → Config 资源记录器(依赖委托 + 桶)
65
+ ```
66
+
67
+ ## 五、怎么查接口(指向 ops-deploy)
68
+
69
+ | 查什么 | productshort | 关键 API |
70
+ |---|---|---|
71
+ | 资源记录器 | RMS | ListConfigurationRecorders / CreateConfigurationRecorder |
72
+ | 聚合器 | RMS | ListConfigurationAggregators |
73
+ | 信任委托 | IAM | ListAgencies / CreateAgency |
74
+ | 可信服务 | Organizations | ListTrustedServices / EnableTrustedService |
75
+ | 委托管理员 | Organizations | RegisterDelegatedAdministrator |
76
+
77
+ **查法**:`apiexplorer('RMS')` / `apiexplorer('IAM')` → compact → `apiexplorerHost(productshort, region)`。
78
+ > RMS 区域服务;IAM 全局服务。聚合器查询可能 404,容错。
79
+
80
+ ## 六、资源探测指引
81
+
82
+ > ⚠️ 本节定义该资源如何探测是否已存在。
83
+ > Config 记录器是管理账号级(建在管理账号),用 caller.openapiRequest(MCP,不需 assume)。
84
+ > ShowTrackerConfig 的 path 含 {domain_id}(管理账号 id),先查 ShowOrganization 拿 management_account_id 填入。
85
+
86
+ > **委托探测接口选型(2026-11-12 实测沉淀)**:
87
+ > - `rms_tracker_trust_agency` 属**信任委托**,仅 **v5 接口**(`GET /v5/agencies?domain_id=all`)可查;
88
+ > - 普通委托 v3(`GET /v3.0/OS-AGENCY/agencies`)/v5 都能查,但 v3 要求 Security
89
+ > Administrator token(普通子用户必 403,文档明示"用于管理员");
90
+ > - **统一用 v5**:普通子用户可用,信任/普通委托都能查,更保险(本会话 check 阶段同款方法)。
91
+
92
+ ```json
93
+ {
94
+ "probes": [
95
+ {
96
+ "typeId": "config_recorder",
97
+ "service": "RMS",
98
+ "hostMode": "regional",
99
+ "steps": [
100
+ {
101
+ "step": 1,
102
+ "action": "query-host",
103
+ "productshort": "RMS",
104
+ "via": "apiexplorerHost",
105
+ "output": "host"
106
+ },
107
+ {
108
+ "step": 2,
109
+ "action": "query-host",
110
+ "productshort": "Organizations",
111
+ "via": "apiexplorerHost",
112
+ "output": "orgsHost"
113
+ },
114
+ {
115
+ "step": 3,
116
+ "action": "query-list",
117
+ "method": "GET",
118
+ "api": "ShowOrganization",
119
+ "path": "/v1/organizations",
120
+ "hostKey": "orgsHost",
121
+ "extract": "organization.management_account_id",
122
+ "output": "domain_id",
123
+ "save": true,
124
+ "depends": [
125
+ "orgsHost"
126
+ ]
127
+ },
128
+ {
129
+ "step": 4,
130
+ "action": "query-list",
131
+ "method": "GET",
132
+ "api": "ShowTrackerConfig",
133
+ "path": "/v1/resource-manager/domains/{domain_id}/tracker-config",
134
+ "hostKey": "host",
135
+ "output": "tracker_config",
136
+ "depends": [
137
+ "host",
138
+ "domain_id"
139
+ ]
140
+ }
141
+ ],
142
+ "match": {
143
+ "field": "tracker_config.id",
144
+ "expect": "exists-non-empty"
145
+ },
146
+ "existsStatus": "historical_exists",
147
+ "existsDetail": "Config 资源记录器已存在,复用",
148
+ "pendingDetail": "Config 资源记录器未创建,待建",
149
+ "absentWhen": {
150
+ "httpStatus": 404,
151
+ "errorCodes": [
152
+ "RMS.00010005"
153
+ ]
154
+ }
155
+ },
156
+ {
157
+ "typeId": "config_trust_agency",
158
+ "service": "IAM",
159
+ "hostMode": "global",
160
+ "steps": [
161
+ {
162
+ "step": 1,
163
+ "action": "query-host",
164
+ "productshort": "IAM",
165
+ "via": "apiexplorerHost",
166
+ "output": "iamHost"
167
+ },
168
+ {
169
+ "step": 2,
170
+ "action": "query-list",
171
+ "method": "GET",
172
+ "api": "ListAgencies",
173
+ "path": "/v5/agencies?domain_id=all",
174
+ "hostKey": "iamHost",
175
+ "output": "agencies",
176
+ "save": true,
177
+ "depends": [
178
+ "iamHost"
179
+ ]
180
+ }
181
+ ],
182
+ "match": {
183
+ "field": "agencies[].agency_name",
184
+ "expect": "equals-semanticParam",
185
+ "semField": "name",
186
+ "idFields": [
187
+ "agency_id"
188
+ ]
189
+ },
190
+ "existsStatus": "historical_exists",
191
+ "existsDetail": "Config 信任委托({name})已存在,复用",
192
+ "pendingDetail": "Config 信任委托({name})未创建,待建"
193
+ }
194
+ ]
195
+ }```
196
+
197
+ > 字段说明:
198
+ > - Config 记录器是管理账号级(不 assume),用 caller.openapiRequest 查
199
+ > - step2-3:先查 Organizations 的 host(全局),再 ShowOrganization 拿 management_account_id(即 domain_id)
200
+ > - step4:用 {domain_id} 填入 ShowTrackerConfig 的 path,查资源记录器
201
+ > - match:用 exists-non-empty(有 tracker_config.id 即存在)
202
+ > - config_trust_agency(IAM 委托)暂未探测:IAM ListAgencies 需复杂参数,保守标 pending
203
+
204
+ ## 七、演示示例
205
+
206
+ ```
207
+ 可信服务: service.RMSMultiAccountSetup enabled
208
+ 委托管理员: Security 账号
209
+ 信任委托: rms_tracker_trust_agency (IAM)
210
+ OBS 桶: config-bucket-{management_account_id}(管理账号,桶名含账号 ID 防冲突)
211
+ 资源记录器: 转储到 config-bucket-{management_account_id}
212
+ ```
@@ -0,0 +1,179 @@
1
+ # 云审计 CTS(cts)
2
+
3
+ > CTS(Cloud Trace Service)记录"谁干了什么"的操作日志。
4
+ > LZ 合规审计四件套之一。
5
+
6
+ ---
7
+
8
+ ## 一、是什么 / 为什么需要
9
+
10
+ CTS 自动记录云上所有 API 操作(创建/删除/修改),日志可转储 OBS 桶长期留存。组织级追踪器覆盖全组织所有账号。
11
+
12
+ **为什么需要**:合规审计要求可追溯;安全事件需查操作记录;等保要求日志留存(通常 6 个月+)。
13
+
14
+ ## 二、里面应该有什么(子结构)
15
+
16
+ | 资源 | 职责 | 必备 |
17
+ |---|---|---|
18
+ | CTS 组织追踪器 | 覆盖全组织所有账号的操作记录 | ✅ |
19
+ | CTS 委托管理员 | LogArchive 账号代管组织级 CTS | ✅ |
20
+ | 可信服务 service.CTS | 让 CTS 跨账号操作 | ✅ |
21
+
22
+ ### 关联资源
23
+ - OBS 桶(日志转储)→ 见 obs-lts.md
24
+ - LTS(日志检索)→ 见 obs-lts.md
25
+
26
+ ## 三、注意点 / 最佳实践 / 坑
27
+
28
+ ### 约束
29
+ - **CTS 是区域服务**,host 带 `cts.<region>.`
30
+ - **组织追踪器需委托管理员**:LogArchive 账号做委托管理员才能管组织级 CTS
31
+ - **顺序**:enable trusted service → delegate administrator → 建追踪器
32
+
33
+ ### 最佳实践
34
+ - LogArchive 账号做 CTS 委托管理员(它管日志)
35
+ - 追踪器日志转 OBS(长期留存)+ LTS(检索)
36
+
37
+ ### 坑
38
+ - **ListTrackers 可能 404**:某些环境 APIGW.0101(API 未发布),不代表没有追踪器,需容错
39
+ - **追踪器依赖 OBS 桶**:桶要先建(在 LogArchive 账号)
40
+
41
+ ## 四、费用属性(预计,仅作方案决策参考,非最终账单)
42
+ | 项目 | 月费(元,预计) | 说明 |
43
+ |---|---|---|
44
+ | CTS 追踪器 | 0 | 基线服务免费,日志转储 OBS 存储费另计 |
45
+
46
+ > CTS 追踪器本身免费,关联的 OBS 存储费见 obs-lts.md。
47
+
48
+ ## 五、创建依赖
49
+
50
+ ### 前置
51
+ - **Organization 已建**
52
+ - **service.CTS 可信服务已 enable**
53
+ - **LogArchive 账号已建**(做委托管理员)
54
+ - **OBS 桶已建**(日志转储目标)
55
+
56
+ ### 被依赖
57
+ - 无(CTS 是审计末端)
58
+
59
+ ## 五、怎么查接口(指向 ops-deploy)
60
+
61
+ | 查什么 | productshort | 关键 API |
62
+ |---|---|---|
63
+ | 追踪器 | CTS | ListTrackers / CreateTracker |
64
+ | 可信服务 | Organizations | ListTrustedServices / EnableTrustedService |
65
+ | 委托管理员 | Organizations | RegisterDelegatedAdministrator |
66
+
67
+ **查法**:`apiexplorer('CTS')` → compact → `apiexplorerHost('CTS', region)`(区域服务)。
68
+ > ListTrackers path 含 project_id;查询可能 404,容错。
69
+
70
+ ## 六、资源探测指引
71
+
72
+ > ⚠️ 本节定义该资源如何探测是否已存在。
73
+ > CTS 组织追踪器建在委托管理员(LogArchive 账号),探测需 assume 进 LogArchive。
74
+ > path 含 {project_id},需先 query-project 查 LogArchive 的 project_id。
75
+
76
+ ```json
77
+ {
78
+ "probes": [
79
+ {
80
+ "typeId": "cts_tracker",
81
+ "service": "CTS",
82
+ "hostMode": "regional",
83
+ "steps": [
84
+ {
85
+ "step": 1,
86
+ "action": "query-host",
87
+ "productshort": "CTS",
88
+ "via": "apiexplorerHost",
89
+ "output": "ctsHost"
90
+ },
91
+ {
92
+ "step": 2,
93
+ "action": "query-host",
94
+ "productshort": "Organizations",
95
+ "via": "apiexplorerHost",
96
+ "output": "orgsHost"
97
+ },
98
+ {
99
+ "step": 3,
100
+ "action": "query-list",
101
+ "method": "GET",
102
+ "api": "ShowOrganization",
103
+ "path": "/v1/organizations",
104
+ "hostKey": "orgsHost",
105
+ "extract": "organization.management_account_id",
106
+ "output": "domainId",
107
+ "save": true,
108
+ "depends": [
109
+ "orgsHost"
110
+ ]
111
+ },
112
+ {
113
+ "step": 4,
114
+ "action": "query-project",
115
+ "output": "projectId",
116
+ "save": true,
117
+ "depends": [
118
+ "ctsHost"
119
+ ]
120
+ },
121
+ {
122
+ "step": 5,
123
+ "action": "query-list",
124
+ "method": "GET",
125
+ "api": "ListTrackers",
126
+ "path": "/v3/{projectId}/trackers",
127
+ "hostKey": "ctsHost",
128
+ "output": "trackers",
129
+ "save": true,
130
+ "depends": [
131
+ "ctsHost",
132
+ "projectId"
133
+ ]
134
+ }
135
+ ],
136
+ "match": {
137
+ "field": "trackers",
138
+ "expect": "attribute-check",
139
+ "checks": [
140
+ {
141
+ "field": "is_organization_tracker",
142
+ "equals": true
143
+ },
144
+ {
145
+ "field": "obs_info.bucket_name",
146
+ "equals": "obs-cts-{domainId}",
147
+ "placeholder": "{domainId}",
148
+ "placeholderSource": "domainId"
149
+ },
150
+ {
151
+ "field": "lts.is_lts_enabled",
152
+ "equals": true
153
+ }
154
+ ]
155
+ },
156
+ "existsStatus": "historical_exists",
157
+ "existsDetail": "CTS 组织追踪器已存在且属性合规(组织级+桶+LTS),复用",
158
+ "pendingDetail": "CTS 组织追踪器未创建,待建",
159
+ "mismatchDetail": "CTS 追踪器存在但属性不符:{mismatches}"
160
+ }
161
+ ]
162
+ }```
163
+
164
+ > 字段说明:
165
+ > - CTS 是区域服务,hostMode=regional(host 带 `cts.<region>.`)
166
+ > - query-project:用 assumed.getProjectId(region) 查 LogArchive 账号 project_id
167
+ > - match:用 exists-non-empty 粗判(账号下有追踪器即存在;精确匹配按 tracker_name,属扩展)
168
+ > - 探测可能 404(某些环境 API 未发布),容错标 probe_failed
169
+
170
+ ## 七、演示示例
171
+
172
+ ```
173
+ 可信服务: service.CTS enabled
174
+ 委托管理员: LogArchive 账号
175
+ 组织追踪器: 覆盖全组织,日志转 OBS(obs-cts-019f8c84334a7c19a34e021322a2b39d),LTS 同开(is_lts_enabled:true)
176
+ 组织级追踪器创建参数(2026-11-13 定,CreateTracker 契约):tracker_type=system + is_organization_tracker=true
177
+ + is_lts_enabled=true + agency_name=cts_admin_trust(云服务委托,CTS 自动建)+ obs_info.bucket_name=obs-cts-{domainId}
178
+ (LZ spec 的 ctsBucketName 即此桶;桶名占位符 {domainId} 在执行侧解析为管理账号 ID)
179
+ ```