@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.
- package/LICENSE +201 -0
- package/README.md +85 -2
- package/cordis.patch.yml +21 -0
- package/knowledge/account-qualification.md +128 -0
- package/knowledge/blueprints/_base/blueprint.json +481 -0
- package/knowledge/blueprints/_base/defaults.json +127 -0
- package/knowledge/blueprints/foundation-lz/blueprint.json +43 -0
- package/knowledge/blueprints/foundation-lz/defaults.json +47 -0
- package/knowledge/blueprints/full-lz/blueprint.json +11 -0
- package/knowledge/blueprints/full-lz/defaults.json +8 -0
- package/knowledge/config.json +43 -0
- package/knowledge/error-rules.json +14 -0
- package/knowledge/ic-policies.json +21 -0
- package/knowledge/modules/account-structure.md +101 -0
- package/knowledge/modules/compliance/config-rms.md +212 -0
- package/knowledge/modules/compliance/cts.md +179 -0
- package/knowledge/modules/compliance/obs-lts.md +155 -0
- package/knowledge/modules/ic-policies.json +21 -0
- package/knowledge/modules/identity-center.md +603 -0
- package/knowledge/modules/module-layers.md +169 -0
- package/knowledge/modules/network/er.md +222 -0
- package/knowledge/modules/network/nat-eip.md +123 -0
- package/knowledge/modules/network/ram-share.md +92 -0
- package/knowledge/modules/network/vpc-subnet.md +142 -0
- package/knowledge/modules/organization-security/scp.md +122 -0
- package/knowledge/modules/organizations.md +212 -0
- package/knowledge/modules/recommended-config.md +157 -0
- package/knowledge/modules/recommended-rules.json +175 -0
- package/knowledge/modules/scp-policies.json +111 -0
- package/knowledge/modules/security/aad.md +94 -0
- package/knowledge/modules/security/cfw.md +105 -0
- package/knowledge/modules/security/waf.md +110 -0
- package/knowledge/param-mappings.json +133 -0
- package/knowledge/prompts.md +83 -0
- package/knowledge/resource-types.json +1162 -0
- package/knowledge/scp-policies.json +111 -0
- package/knowledge/state-machine.md +33 -0
- package/lib/client.js +21 -0
- package/lib/index.js +28592 -0
- package/lib/types/account-role.d.ts +19 -0
- package/lib/types/account-scope.d.ts +10 -0
- package/lib/types/agency.d.ts +38 -0
- package/lib/types/client/DropdownSelect.d.ts +49 -0
- package/lib/types/client/LoginGate.d.ts +20 -0
- package/lib/types/client/PanelIcon.d.ts +11 -0
- package/lib/types/client/WorkbenchShell.d.ts +21 -0
- package/lib/types/client/account-role.d.ts +15 -0
- package/lib/types/client/credential-status.d.ts +15 -0
- package/lib/types/client/huawei-mark.d.ts +37 -0
- package/lib/types/client/index.d.ts +26 -0
- package/lib/types/client/layout-ref.d.ts +23 -0
- package/lib/types/client/pages/ConfigPage/AdviceCard.d.ts +26 -0
- package/lib/types/client/pages/ConfigPage/AuditBar.d.ts +21 -0
- package/lib/types/client/pages/ConfigPage/ChangeSummaryCard.d.ts +22 -0
- package/lib/types/client/pages/ConfigPage/ChangesCard.d.ts +27 -0
- package/lib/types/client/pages/ConfigPage/ComplianceDetail.d.ts +25 -0
- package/lib/types/client/pages/ConfigPage/ComplianceSummaryCard.d.ts +31 -0
- package/lib/types/client/pages/ConfigPage/FindingsCard.d.ts +21 -0
- package/lib/types/client/pages/ConfigPage/GlossaryDrawer.d.ts +17 -0
- package/lib/types/client/pages/ConfigPage/OrgComplianceDetail.d.ts +15 -0
- package/lib/types/client/pages/ConfigPage/Pager.d.ts +32 -0
- package/lib/types/client/pages/ConfigPage/ResourceDrawer.d.ts +26 -0
- package/lib/types/client/pages/ConfigPage/ResourcesTable.d.ts +35 -0
- package/lib/types/client/pages/ConfigPage/RollupPanel.d.ts +17 -0
- package/lib/types/client/pages/ConfigPage/RuleDetailDrawer.d.ts +23 -0
- package/lib/types/client/pages/ConfigPage/StatusCards.d.ts +26 -0
- package/lib/types/client/pages/ConfigPage/UncoveredDialog.d.ts +22 -0
- package/lib/types/client/pages/ConfigPage/config-api.d.ts +101 -0
- package/lib/types/client/pages/ConfigPage/config-store.d.ts +57 -0
- package/lib/types/client/pages/ConfigPage/index.d.ts +21 -0
- package/lib/types/client/pages/ConfigPage/paging.d.ts +46 -0
- package/lib/types/client/pages/ConfigPage/scope-options.d.ts +51 -0
- package/lib/types/client/pages/CostPage/AccountAllocation.d.ts +24 -0
- package/lib/types/client/pages/CostPage/AccountBars.d.ts +20 -0
- package/lib/types/client/pages/CostPage/AccountColumns.d.ts +24 -0
- package/lib/types/client/pages/CostPage/AccountDonut.d.ts +18 -0
- package/lib/types/client/pages/CostPage/AccountSwitcher.d.ts +25 -0
- package/lib/types/client/pages/CostPage/AdviceCard.d.ts +43 -0
- package/lib/types/client/pages/CostPage/AdviceFindings.d.ts +43 -0
- package/lib/types/client/pages/CostPage/BillingPanels.d.ts +23 -0
- package/lib/types/client/pages/CostPage/BudgetCard.d.ts +36 -0
- package/lib/types/client/pages/CostPage/GlossaryDrawer.d.ts +16 -0
- package/lib/types/client/pages/CostPage/KpiRow.d.ts +23 -0
- package/lib/types/client/pages/CostPage/MarkdownBlock.d.ts +16 -0
- package/lib/types/client/pages/CostPage/ReportView.d.ts +17 -0
- package/lib/types/client/pages/CostPage/ResourceColumns.d.ts +19 -0
- package/lib/types/client/pages/CostPage/ResourceDonut.d.ts +18 -0
- package/lib/types/client/pages/CostPage/ResourcesCard.d.ts +40 -0
- package/lib/types/client/pages/CostPage/RuleDetailDrawer.d.ts +23 -0
- package/lib/types/client/pages/CostPage/SavingView.d.ts +38 -0
- package/lib/types/client/pages/CostPage/ServiceDonut.d.ts +17 -0
- package/lib/types/client/pages/CostPage/TrendChart.d.ts +24 -0
- package/lib/types/client/pages/CostPage/budget-input.d.ts +30 -0
- package/lib/types/client/pages/CostPage/cost-api.d.ts +266 -0
- package/lib/types/client/pages/CostPage/cost-store.d.ts +25 -0
- package/lib/types/client/pages/CostPage/format.d.ts +37 -0
- package/lib/types/client/pages/CostPage/index.d.ts +34 -0
- package/lib/types/client/pages/CostPage/trend-fold.d.ts +32 -0
- package/lib/types/client/pages/CostPage/useEcharts.d.ts +70 -0
- package/lib/types/client/pages/OrgStructurePage/AccountStatsCard.d.ts +22 -0
- package/lib/types/client/pages/OrgStructurePage/CoreAccountsCard.d.ts +18 -0
- package/lib/types/client/pages/OrgStructurePage/CreateAccountDialog.d.ts +28 -0
- package/lib/types/client/pages/OrgStructurePage/ManageUsersDialog.d.ts +28 -0
- package/lib/types/client/pages/OrgStructurePage/MemberAccountsTable.d.ts +32 -0
- package/lib/types/client/pages/OrgStructurePage/MoveAccountDialog.d.ts +29 -0
- package/lib/types/client/pages/OrgStructurePage/OrgGlossaryDrawer.d.ts +13 -0
- package/lib/types/client/pages/OrgStructurePage/OrgTreeCard.d.ts +31 -0
- package/lib/types/client/pages/OrgStructurePage/index.d.ts +21 -0
- package/lib/types/client/pages/OrgStructurePage/org-api.d.ts +166 -0
- package/lib/types/client/pages/OverviewPage/AnchorRow.d.ts +24 -0
- package/lib/types/client/pages/OverviewPage/AttentionList.d.ts +29 -0
- package/lib/types/client/pages/OverviewPage/OverviewCharts.d.ts +79 -0
- package/lib/types/client/pages/OverviewPage/OverviewGlossaryDrawer.d.ts +15 -0
- package/lib/types/client/pages/OverviewPage/index.d.ts +22 -0
- package/lib/types/client/pages/OverviewPage/overview-api.d.ts +115 -0
- package/lib/types/client/pages/ResourcePage/AccountResourceList.d.ts +21 -0
- package/lib/types/client/pages/ResourcePage/components/GlossaryDrawer.d.ts +20 -0
- package/lib/types/client/pages/ResourcePage/components/MetricCards.d.ts +19 -0
- package/lib/types/client/pages/ResourcePage/components/MultiSelect.d.ts +27 -0
- package/lib/types/client/pages/ResourcePage/components/PanelPager.d.ts +26 -0
- package/lib/types/client/pages/ResourcePage/components/RankBars.d.ts +25 -0
- package/lib/types/client/pages/ResourcePage/components/ScopeSelect.d.ts +27 -0
- package/lib/types/client/pages/ResourcePage/components/SourceConfigModal.d.ts +21 -0
- package/lib/types/client/pages/ResourcePage/components/SyncControls.d.ts +18 -0
- package/lib/types/client/pages/ResourcePage/components/TrendChart.d.ts +14 -0
- package/lib/types/client/pages/ResourcePage/components/useColumnWidths.d.ts +12 -0
- package/lib/types/client/pages/ResourcePage/format.d.ts +9 -0
- package/lib/types/client/pages/ResourcePage/index.d.ts +20 -0
- package/lib/types/client/pages/ResourcePage/summary-api.d.ts +205 -0
- package/lib/types/client/pages/SetupPage/AskPanel.d.ts +21 -0
- package/lib/types/client/pages/SetupPage/ChatEmbed.d.ts +40 -0
- package/lib/types/client/pages/SetupPage/ChatTab.d.ts +17 -0
- package/lib/types/client/pages/SetupPage/FormTab.d.ts +12 -0
- package/lib/types/client/pages/SetupPage/FormTabV2.d.ts +14 -0
- package/lib/types/client/pages/SetupPage/ProgressTreeView.d.ts +15 -0
- package/lib/types/client/pages/SetupPage/StageFlow.d.ts +16 -0
- package/lib/types/client/pages/SetupPage/index.d.ts +10 -0
- package/lib/types/client/pages/SetupPage/progress-types.d.ts +36 -0
- package/lib/types/client/pages/SetupPage/session-binding.d.ts +38 -0
- package/lib/types/client/pages/SetupPage/session-store.d.ts +57 -0
- package/lib/types/client/pages/SetupPage/sessions-ref.d.ts +5 -0
- package/lib/types/client/pages/SetupPage/setup-replan.d.ts +13 -0
- package/lib/types/client/pages/SetupPage/wb-api.d.ts +192 -0
- package/lib/types/client/pages/list-preview.d.ts +36 -0
- package/lib/types/client/permission-mode.d.ts +53 -0
- package/lib/types/client/store.d.ts +22 -0
- package/lib/types/collect.d.ts +78 -0
- package/lib/types/config/account-scope.d.ts +61 -0
- package/lib/types/config/advice-findings.d.ts +31 -0
- package/lib/types/config/advice-prompt.d.ts +60 -0
- package/lib/types/config/advice.d.ts +116 -0
- package/lib/types/config/cts.d.ts +30 -0
- package/lib/types/config/evidence/rules.d.ts +31 -0
- package/lib/types/config/evidence/types.d.ts +103 -0
- package/lib/types/config/failure-note.d.ts +46 -0
- package/lib/types/config/fingerprint-cache.d.ts +45 -0
- package/lib/types/config/identity.d.ts +67 -0
- package/lib/types/config/query.d.ts +49 -0
- package/lib/types/config/rms.d.ts +412 -0
- package/lib/types/config/routes.d.ts +32 -0
- package/lib/types/config/types.d.ts +785 -0
- package/lib/types/config/views.d.ts +158 -0
- package/lib/types/cost/accounts.d.ts +29 -0
- package/lib/types/cost/advice-findings.d.ts +77 -0
- package/lib/types/cost/advice-model.d.ts +19 -0
- package/lib/types/cost/advice-prompt.d.ts +73 -0
- package/lib/types/cost/advice-subagent-types.d.ts +6 -0
- package/lib/types/cost/advice-subagent.d.ts +116 -0
- package/lib/types/cost/advice-types.d.ts +63 -0
- package/lib/types/cost/advice.d.ts +125 -0
- package/lib/types/cost/aggregate.d.ts +157 -0
- package/lib/types/cost/assume.d.ts +43 -0
- package/lib/types/cost/bss.d.ts +166 -0
- package/lib/types/cost/budget-overview.d.ts +38 -0
- package/lib/types/cost/budget.d.ts +56 -0
- package/lib/types/cost/cache.d.ts +58 -0
- package/lib/types/cost/caliber.d.ts +40 -0
- package/lib/types/cost/console-links.d.ts +27 -0
- package/lib/types/cost/credentials.d.ts +38 -0
- package/lib/types/cost/data-window.d.ts +38 -0
- package/lib/types/cost/evidence/catalog.d.ts +35 -0
- package/lib/types/cost/evidence/index.d.ts +70 -0
- package/lib/types/cost/evidence/inventory.d.ts +44 -0
- package/lib/types/cost/evidence/pricing.d.ts +72 -0
- package/lib/types/cost/evidence/projects.d.ts +18 -0
- package/lib/types/cost/evidence/rules.d.ts +66 -0
- package/lib/types/cost/evidence/state.d.ts +38 -0
- package/lib/types/cost/evidence/thresholds.d.ts +68 -0
- package/lib/types/cost/evidence/types.d.ts +288 -0
- package/lib/types/cost/evidence/utilization.d.ts +37 -0
- package/lib/types/cost/history.d.ts +36 -0
- package/lib/types/cost/ledger.d.ts +97 -0
- package/lib/types/cost/normalize.d.ts +37 -0
- package/lib/types/cost/period-projection.d.ts +57 -0
- package/lib/types/cost/plan-check.d.ts +102 -0
- package/lib/types/cost/plan-db.d.ts +73 -0
- package/lib/types/cost/plan-types.d.ts +183 -0
- package/lib/types/cost/plan.d.ts +63 -0
- package/lib/types/cost/quote.d.ts +45 -0
- package/lib/types/cost/report.d.ts +136 -0
- package/lib/types/cost/resources.d.ts +108 -0
- package/lib/types/cost/routes.d.ts +38 -0
- package/lib/types/cost/scope.d.ts +42 -0
- package/lib/types/cost/types.d.ts +335 -0
- package/lib/types/cost/unit-prices-derive.d.ts +19 -0
- package/lib/types/cost/unit-prices.d.ts +23 -0
- package/lib/types/db.d.ts +228 -0
- package/lib/types/host-log.d.ts +7 -0
- package/lib/types/http.d.ts +42 -0
- package/lib/types/index.d.ts +30 -0
- package/lib/types/inventory.d.ts +286 -0
- package/lib/types/obs.d.ts +16 -0
- package/lib/types/org/aggregate.d.ts +36 -0
- package/lib/types/org/churn.d.ts +10 -0
- package/lib/types/org/orgs.d.ts +258 -0
- package/lib/types/org/routes.d.ts +28 -0
- package/lib/types/org-types.d.ts +156 -0
- package/lib/types/per-service.d.ts +39 -0
- package/lib/types/setup/blueprint-loader.d.ts +81 -0
- package/lib/types/setup/caller.d.ts +105 -0
- package/lib/types/setup/engine.d.ts +41 -0
- package/lib/types/setup/form-store.d.ts +13 -0
- package/lib/types/setup/nodes/n1-check.d.ts +14 -0
- package/lib/types/setup/nodes/n10-governance.d.ts +6 -0
- package/lib/types/setup/nodes/n11-infra.d.ts +6 -0
- package/lib/types/setup/nodes/n12-reconcile.d.ts +6 -0
- package/lib/types/setup/nodes/n2-region.d.ts +6 -0
- package/lib/types/setup/nodes/n3-blueprint.d.ts +6 -0
- package/lib/types/setup/nodes/n4-modules.d.ts +6 -0
- package/lib/types/setup/nodes/n5-details.d.ts +6 -0
- package/lib/types/setup/nodes/n6-plan.d.ts +6 -0
- package/lib/types/setup/nodes/n7-verify.d.ts +6 -0
- package/lib/types/setup/nodes/n8-approve.d.ts +6 -0
- package/lib/types/setup/nodes/n9-buildmode.d.ts +6 -0
- package/lib/types/setup/plan-state.d.ts +10 -0
- package/lib/types/setup/prompt-loader.d.ts +16 -0
- package/lib/types/setup/routes.d.ts +22 -0
- package/lib/types/setup/session-notify.d.ts +30 -0
- package/lib/types/setup/tools.d.ts +19 -0
- package/lib/types/setup/types.d.ts +157 -0
- package/lib/types/sse-bus.d.ts +23 -0
- package/lib/types/tools/config-facts.d.ts +16 -0
- package/lib/types/tools/cost-facts.d.ts +10 -0
- package/lib/types/tools/register.d.ts +18 -0
- package/lib/types/wb-conventions.d.ts +140 -0
- package/package.json +77 -4
|
@@ -0,0 +1,785 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 配置审计(Config)域的数据契约。
|
|
3
|
+
*
|
|
4
|
+
* 与 `cost/types.ts` 同一个思路:信封 + 能力状态 + 明确的口径字段。三处不同:
|
|
5
|
+
*
|
|
6
|
+
* 1. **没有"账期"。** 配置审计看的是资源的**当前状态**,不是某段时间的花费。
|
|
7
|
+
* 所以 meta 里没有 cycle,取而代之的是 `sync_note` —— 云上把资源配置同步到
|
|
8
|
+
* Config 有延迟(官方文档:24 小时内校正),页面必须一路带着这句话,
|
|
9
|
+
* 否则"当前有 N 个资源"会被当成实时事实。
|
|
10
|
+
*
|
|
11
|
+
* 2. **两种视角的取数路径完全不同**,不是同一个接口加个 filter:
|
|
12
|
+
* · 组织视角(主账号)→ 资源聚合器 `aggregator_resources`,只看得到聚合进来的账号;
|
|
13
|
+
* · 账号视角(子账号)→ assume 换临时凭据,读**那个账号自己**的 `all-resources`。
|
|
14
|
+
* 为什么不能一套:实测主账号凭据读别的 domain 直接 403
|
|
15
|
+
* (`RMS.00010006 You are not authorized to this resources`)。
|
|
16
|
+
*
|
|
17
|
+
* 3. **合规是逐账号的。** 主账号当前 0 条规则,某个子账号有 14 条 —— 合规卡必须
|
|
18
|
+
* 跟着视角走,不能拿一个账号的合规率去代言整个组织。
|
|
19
|
+
*
|
|
20
|
+
* @module @huaweidevtools/landingzone-workbench/config/types
|
|
21
|
+
*/
|
|
22
|
+
import type { CostCapability } from '../cost/types.ts';
|
|
23
|
+
/** CostCapability 的失败半边(reuse:assume/permission/auth/transient 语义完全一样)。 */
|
|
24
|
+
type CostFailure = Extract<CostCapability, {
|
|
25
|
+
readonly ok: false;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* 配置域的能力状态。
|
|
29
|
+
*
|
|
30
|
+
* 在费用域那套之上多两个只在这里出现的失败原因:
|
|
31
|
+
* · `not_enabled` —— 资源记录器没开。Config 的一切数据都依赖它,这不是权限问题;
|
|
32
|
+
* · `no_aggregator` —— 组织里没有资源聚合器,于是"主账号视角"取不到成员账号资源。
|
|
33
|
+
*/
|
|
34
|
+
export type ConfigCapability = {
|
|
35
|
+
readonly ok: true;
|
|
36
|
+
} | CostFailure | {
|
|
37
|
+
readonly ok: false;
|
|
38
|
+
readonly reason: 'not_enabled';
|
|
39
|
+
readonly message: string;
|
|
40
|
+
} | {
|
|
41
|
+
readonly ok: false;
|
|
42
|
+
readonly reason: 'no_aggregator';
|
|
43
|
+
readonly message: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 凭据身份与请求目标对不上(跨 domain)。
|
|
47
|
+
*
|
|
48
|
+
* 单列一个 reason 而不是继续塞进 `permission`:这两种情况给用户的下一步**不一样** ——
|
|
49
|
+
* `permission` 是"去加一条策略",`scope_mismatch` 是"换一个身份,或者换一个视角"。
|
|
50
|
+
* 早先把两者混成一句话("主账号凭据无权读取该账号的资源"),结果子账号登录时
|
|
51
|
+
* 用户被指去查 IAM 权限,而真正该做的是切到「本账号」。
|
|
52
|
+
*/
|
|
53
|
+
| {
|
|
54
|
+
readonly ok: false;
|
|
55
|
+
readonly reason: 'scope_mismatch';
|
|
56
|
+
readonly message: string;
|
|
57
|
+
/** 当前凭据属于哪个账号(domainId);身份未解析时为 null。 */
|
|
58
|
+
readonly caller_id: string | null;
|
|
59
|
+
/** 这次请求想读哪个账号(domainId)。 */
|
|
60
|
+
readonly target_id: string | null;
|
|
61
|
+
};
|
|
62
|
+
/** 视角:组织(主账号,聚合器)或单账号(子账号,assume 后读它自己的清单)。 */
|
|
63
|
+
export type ConfigScope = 'organization' | 'account';
|
|
64
|
+
/**
|
|
65
|
+
* 取数通道:这份凭据够不够读组织聚合器。
|
|
66
|
+
*
|
|
67
|
+
* 与资源页的 `SyncChannel`(`aggregator` / `per-service`)是同一件事的两种说法:
|
|
68
|
+
* 那边选的是"怎么采集",这边选的是"能不能给组织视角"。探测口径一致 ——
|
|
69
|
+
* 都是拿当前凭据试一次聚合器,401/403 即成员身份。
|
|
70
|
+
*/
|
|
71
|
+
export type ConfigChannel = 'organization' | 'account';
|
|
72
|
+
/** 页面用来标注"当前是谁在看"的最小身份信息。 */
|
|
73
|
+
export interface ConfigMetaIdentity {
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly name: string;
|
|
76
|
+
}
|
|
77
|
+
/** 云上数据同步的固有延迟,页面必须显示的一句。 */
|
|
78
|
+
export declare const SYNC_NOTE = "\u914D\u7F6E\u5BA1\u8BA1\u7684\u6570\u636E\u6765\u81EA\u8D44\u6E90\u8BB0\u5F55\u5668\uFF0C\u4E91\u4E0A\u540C\u6B65\u6709\u5EF6\u8FDF\uFF0824 \u5C0F\u65F6\u5185\u6821\u6B63\uFF09\uFF0C\u4E0D\u662F\u5B9E\u65F6\u72B6\u6001";
|
|
79
|
+
/** Config 数据超过这个年龄就不算"新"(与资源记录器 24 小时校正同一个量级)。 */
|
|
80
|
+
export declare const STALE_AFTER_SECONDS: number;
|
|
81
|
+
/** 一次查询的元信息。 */
|
|
82
|
+
export interface ConfigMeta {
|
|
83
|
+
/** 这份数据(资源清单)是我们什么时候从云上取下来的。 */
|
|
84
|
+
readonly data_as_of: string | null;
|
|
85
|
+
readonly freshness_seconds: number | null;
|
|
86
|
+
readonly is_stale: boolean;
|
|
87
|
+
readonly source: 'live' | 'cache';
|
|
88
|
+
readonly scope: ConfigScope;
|
|
89
|
+
/** 组织视角时为 null;账号视角时是该账号 domainId。 */
|
|
90
|
+
readonly account_id: string | null;
|
|
91
|
+
/** 主账号 domainId(Config 的路径里必须带它)。 */
|
|
92
|
+
readonly main_account_id: string;
|
|
93
|
+
/** 云上同步延迟的固定说明,一路传到页面。 */
|
|
94
|
+
readonly sync_note: string;
|
|
95
|
+
/**
|
|
96
|
+
* 视角被改写过时的说明(组织视角不可用 → 回落本账号;请求别的账号 → 钳制到本账号)。
|
|
97
|
+
*
|
|
98
|
+
* 页面必须把它显示出来:`meta` 里说 `scope: 'account'`,而用户明明选的是
|
|
99
|
+
* "全部账号",不解释一句就成了"点了没反应"。
|
|
100
|
+
*/
|
|
101
|
+
readonly scope_note?: string;
|
|
102
|
+
/** 当前凭据的身份(由 IAM 解析,不是页面上选的视角)。 */
|
|
103
|
+
readonly identity?: ConfigMetaIdentity;
|
|
104
|
+
/** 这份数据是靠哪一种通道取到的(见 `ConfigChannel`)。 */
|
|
105
|
+
readonly channel?: ConfigChannel;
|
|
106
|
+
}
|
|
107
|
+
/** 统一响应信封。`unavailable` 只在该视角的取数依赖缺失时出现,此时 data 为 null。 */
|
|
108
|
+
export interface ConfigEnvelope<T> {
|
|
109
|
+
readonly data: T | null;
|
|
110
|
+
readonly meta: ConfigMeta;
|
|
111
|
+
readonly unavailable?: ConfigCapability;
|
|
112
|
+
}
|
|
113
|
+
/** 治理健康度:三个"该收拾但没人收拾"的指标。 */
|
|
114
|
+
export interface ConfigGovernance {
|
|
115
|
+
/** 没有任何标签的资源数。 */
|
|
116
|
+
readonly untagged: number;
|
|
117
|
+
/** 挂在默认企业项目(ep_id = '0')上的资源数。 */
|
|
118
|
+
readonly default_ep: number;
|
|
119
|
+
/**
|
|
120
|
+
* 操作状态明确不是 Succeeded 的资源数(失败 / 取消 / 处理中)。
|
|
121
|
+
*
|
|
122
|
+
* 为什么和下面那个分开数:聚合器里大量资源**根本没有操作状态**
|
|
123
|
+
* (IAM 组、OBS 桶、安全组……它们不是"创建失败",是"这个概念不适用")。
|
|
124
|
+
* 早先把两者合并成 `provisioning_state != 'Succeeded'`,实测结果是
|
|
125
|
+
* 抽样 200 行里 200 行都算"异常" —— 一个必然 100% 的指标,只会让人关掉这张卡。
|
|
126
|
+
*/
|
|
127
|
+
readonly not_succeeded: number;
|
|
128
|
+
/** 该资源类型不适用操作状态(provisioning_state 为 null)的数量。 */
|
|
129
|
+
readonly no_state: number;
|
|
130
|
+
/** 这三个数基于多少行算出来(全量时等于资源总数)。 */
|
|
131
|
+
readonly computed_from: number;
|
|
132
|
+
/** computed_from 小于资源总数时,这三个数是抽样值,页面必须标注。 */
|
|
133
|
+
readonly exact: boolean;
|
|
134
|
+
/** 某个指标在当前视角下不具参考性时的说明(例如聚合器不给操作状态)。 */
|
|
135
|
+
readonly state_note?: string;
|
|
136
|
+
}
|
|
137
|
+
/** 总览 KPI。 */
|
|
138
|
+
export interface ConfigOverview {
|
|
139
|
+
readonly scope: ConfigScope;
|
|
140
|
+
/** 该视角下资源总数(组织视角 = 聚合器里所有成员账号之和)。 */
|
|
141
|
+
readonly total: number;
|
|
142
|
+
/** 业务资源数:剔除 provider = config 的 Config 自身资源(tracker/规则等)。 */
|
|
143
|
+
readonly business_total: number;
|
|
144
|
+
/** Config 自身资源数。 */
|
|
145
|
+
readonly config_own_total: number;
|
|
146
|
+
readonly service_count: number;
|
|
147
|
+
readonly region_count: number;
|
|
148
|
+
/** 账号视角 = 1;组织视角 = 聚合器实际覆盖到的账号数。 */
|
|
149
|
+
readonly account_count: number;
|
|
150
|
+
readonly governance: ConfigGovernance;
|
|
151
|
+
}
|
|
152
|
+
/** 服务构成的一块(服务 = Config 的 provider,带中文名与分类)。 */
|
|
153
|
+
export interface ConfigServiceSlice {
|
|
154
|
+
readonly provider: string;
|
|
155
|
+
readonly name: string;
|
|
156
|
+
readonly category: string;
|
|
157
|
+
readonly count: number;
|
|
158
|
+
readonly ratio: number;
|
|
159
|
+
}
|
|
160
|
+
export interface ConfigByService {
|
|
161
|
+
readonly items: readonly ConfigServiceSlice[];
|
|
162
|
+
/** 未列出的服务合计。 */
|
|
163
|
+
readonly other_count: number;
|
|
164
|
+
readonly service_count: number;
|
|
165
|
+
readonly total: number;
|
|
166
|
+
}
|
|
167
|
+
/** 区域分布的一行。 */
|
|
168
|
+
export interface ConfigRegionSlice {
|
|
169
|
+
readonly region_id: string;
|
|
170
|
+
readonly name: string;
|
|
171
|
+
readonly count: number;
|
|
172
|
+
readonly ratio: number;
|
|
173
|
+
}
|
|
174
|
+
export interface ConfigByRegion {
|
|
175
|
+
readonly items: readonly ConfigRegionSlice[];
|
|
176
|
+
readonly total: number;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* 组织聚合的覆盖情况 —— 最容易被误读的一张卡。
|
|
180
|
+
*
|
|
181
|
+
* 实测:组织里 45 个账号,聚合器里只有 5 个有资源数据。所以"855 个资源"绝不是
|
|
182
|
+
* "组织一共 855 个资源",而是"这 5 个账号合起来 855 个"。
|
|
183
|
+
*/
|
|
184
|
+
export interface ConfigCoverage {
|
|
185
|
+
readonly rows: readonly {
|
|
186
|
+
readonly id: string;
|
|
187
|
+
readonly name: string;
|
|
188
|
+
readonly count: number;
|
|
189
|
+
}[];
|
|
190
|
+
/** 聚合器里有数据的账号数。 */
|
|
191
|
+
readonly covered: number;
|
|
192
|
+
/** 组织账号总数(含已停用的)。 */
|
|
193
|
+
readonly org_total: number;
|
|
194
|
+
/**
|
|
195
|
+
* 状态为 active 的账号数。
|
|
196
|
+
*
|
|
197
|
+
* 为什么两个都报:实测组织 45 个账号里只有 35 个 active,而聚合器只覆盖 5 个。
|
|
198
|
+
* 只报 45 会让"40 个没数据"里混进 10 个已停用账号 —— 那 10 个本来就不该有数据,
|
|
199
|
+
* 混在一起会让人误判改动量。
|
|
200
|
+
*/
|
|
201
|
+
readonly active_total: number;
|
|
202
|
+
/** 组织里存在、但聚合结果里一条资源都没有的账号(多半是没开资源记录器)。 */
|
|
203
|
+
readonly missing: readonly {
|
|
204
|
+
readonly id: string;
|
|
205
|
+
readonly name: string;
|
|
206
|
+
readonly status: string;
|
|
207
|
+
}[];
|
|
208
|
+
/** 聚合器名字;没有聚合器时为 null。 */
|
|
209
|
+
readonly aggregator_name: string | null;
|
|
210
|
+
/** 组织接口/聚合器不可用时的解释。 */
|
|
211
|
+
readonly note?: string;
|
|
212
|
+
}
|
|
213
|
+
/** 资源记录器的状态(Config 能不能用,全看这个)。 */
|
|
214
|
+
export interface ConfigTrackerView {
|
|
215
|
+
/** 关闭时 Config 的一切查询都只会返回旧数据/空,页面必须改成引导态。 */
|
|
216
|
+
readonly enabled: boolean;
|
|
217
|
+
/** 是否跟踪全部支持的资源类型(false 时只跟踪 resource_type_count 种)。 */
|
|
218
|
+
readonly all_supported: boolean;
|
|
219
|
+
readonly resource_type_count: number | null;
|
|
220
|
+
readonly obs_bucket: string | null;
|
|
221
|
+
readonly obs_region: string | null;
|
|
222
|
+
readonly smn_topic: string | null;
|
|
223
|
+
readonly retention_days: number | null;
|
|
224
|
+
readonly agency_name: string | null;
|
|
225
|
+
readonly frozen: string | null;
|
|
226
|
+
/**
|
|
227
|
+
* 读不到资源记录器配置时的原因。
|
|
228
|
+
*
|
|
229
|
+
* 为什么不把这种失败直接升级成整页不可用:这一页的其它卡片(资源清单、
|
|
230
|
+
* 服务构成)只要聚合器/清单接口通就还有数据,记录器状态卡自己说清楚即可。
|
|
231
|
+
*/
|
|
232
|
+
readonly unavailable?: ConfigCapability;
|
|
233
|
+
}
|
|
234
|
+
/** 合规审计(逐账号:主账号 0 条规则是常态,子账号可能有一堆)。 */
|
|
235
|
+
export interface ConfigComplianceView {
|
|
236
|
+
readonly assignment_count: number;
|
|
237
|
+
/** 资源维度的合规 / 不合规数。 */
|
|
238
|
+
readonly compliant_resources: number;
|
|
239
|
+
readonly non_compliant_resources: number;
|
|
240
|
+
/** 规则维度的合规 / 不合规数。 */
|
|
241
|
+
readonly compliant_assignments: number;
|
|
242
|
+
readonly non_compliant_assignments: number;
|
|
243
|
+
/** 不合规资源数最多的规则(最多 5 条)。 */
|
|
244
|
+
readonly top: readonly {
|
|
245
|
+
readonly id: string;
|
|
246
|
+
readonly name: string;
|
|
247
|
+
readonly non_compliant: number;
|
|
248
|
+
}[];
|
|
249
|
+
/** 合规规则包数量(按包下发的规则集合;0 表示没用规则包)。 */
|
|
250
|
+
readonly pack_count: number;
|
|
251
|
+
/** 规则包名字(只读展示,实测当前账号 0 个)。 */
|
|
252
|
+
readonly packs: readonly string[];
|
|
253
|
+
/** 这一段数据是怎么来的 / 为什么是空的。 */
|
|
254
|
+
readonly note: string;
|
|
255
|
+
}
|
|
256
|
+
/** 资源明细的一行。 */
|
|
257
|
+
export interface ConfigResourceRow {
|
|
258
|
+
readonly account_id: string;
|
|
259
|
+
readonly account_name: string;
|
|
260
|
+
readonly provider: string;
|
|
261
|
+
readonly service_name: string;
|
|
262
|
+
readonly type: string;
|
|
263
|
+
readonly type_name: string;
|
|
264
|
+
readonly id: string;
|
|
265
|
+
readonly name: string;
|
|
266
|
+
readonly region_id: string;
|
|
267
|
+
readonly region_name: string;
|
|
268
|
+
readonly ep_id: string;
|
|
269
|
+
readonly ep_name: string;
|
|
270
|
+
readonly provisioning_state: string | null;
|
|
271
|
+
readonly tag_count: number;
|
|
272
|
+
readonly created: string | null;
|
|
273
|
+
readonly updated: string | null;
|
|
274
|
+
}
|
|
275
|
+
export interface ConfigResourcesView {
|
|
276
|
+
readonly rows: readonly ConfigResourceRow[];
|
|
277
|
+
/** 该视角的资源总数(不是 rows.length —— 组织视角的明细会被 ResourceQL 的 200 行上限截断)。 */
|
|
278
|
+
readonly total: number;
|
|
279
|
+
/** rows 是否被截断(组织视角固定为 true,除非总数 ≤ limit)。 */
|
|
280
|
+
readonly truncated: boolean;
|
|
281
|
+
/** 明细行数上限(组织视角 = 200,账号视角 = 全量分页,没有上限)。 */
|
|
282
|
+
readonly limit: number;
|
|
283
|
+
/** 明细来自哪张表。 */
|
|
284
|
+
readonly source: 'aggregator' | 'account';
|
|
285
|
+
/** 过滤条件回显(服务端已经过滤过,页面据此显示"筛选中")。 */
|
|
286
|
+
readonly filter: {
|
|
287
|
+
readonly provider: string | null;
|
|
288
|
+
readonly region: string | null;
|
|
289
|
+
readonly keyword: string | null;
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* 筛选项的候选值。
|
|
294
|
+
*
|
|
295
|
+
* 为什么单独给:筛选生效后,y_service / y_region 里只剩被筛中的那几项,
|
|
296
|
+
* 拿它们去填充下拉框,选中之后下拉框就只剩一个选项,用户再也切不回去。
|
|
297
|
+
* 所以候选值必须来自**未筛选**的统计。
|
|
298
|
+
*/
|
|
299
|
+
export interface ConfigFacets {
|
|
300
|
+
readonly providers: readonly {
|
|
301
|
+
readonly value: string;
|
|
302
|
+
readonly label: string;
|
|
303
|
+
readonly count: number;
|
|
304
|
+
}[];
|
|
305
|
+
readonly regions: readonly {
|
|
306
|
+
readonly value: string;
|
|
307
|
+
readonly label: string;
|
|
308
|
+
readonly count: number;
|
|
309
|
+
}[];
|
|
310
|
+
}
|
|
311
|
+
/** 一次快照:整页所有卡片的数据都出自同一份取数,保证互相对得上。 */
|
|
312
|
+
export interface ConfigSnapshot {
|
|
313
|
+
readonly overview: ConfigOverview;
|
|
314
|
+
readonly by_service: ConfigByService;
|
|
315
|
+
readonly by_region: ConfigByRegion;
|
|
316
|
+
readonly coverage: ConfigCoverage | null;
|
|
317
|
+
readonly tracker: ConfigTrackerView;
|
|
318
|
+
readonly compliance: ConfigComplianceView;
|
|
319
|
+
readonly resources: ConfigResourcesView;
|
|
320
|
+
readonly facets: ConfigFacets;
|
|
321
|
+
/** 审计结论条 + 发现清单(由上面这些数字推导,不额外取数)。 */
|
|
322
|
+
readonly audit: ConfigAuditSummary;
|
|
323
|
+
/**
|
|
324
|
+
* 结论层数字的指纹(见 advice.ts 的 fingerprintOf)。
|
|
325
|
+
*
|
|
326
|
+
* 页面拿它与已存档的"分析建议"对比:不一致就说明数字变了、那份建议可能过期。
|
|
327
|
+
* 放在快照里而不是让页面再请求一次,是为了让"过期"这件事零成本可判断。
|
|
328
|
+
*/
|
|
329
|
+
readonly fingerprint: string;
|
|
330
|
+
}
|
|
331
|
+
/** 一处字段变化:改之前 / 改之后(都序列化成短字符串,够读就行)。 */
|
|
332
|
+
export interface ConfigResourceDiffField {
|
|
333
|
+
readonly key: string;
|
|
334
|
+
readonly before: string;
|
|
335
|
+
readonly after: string;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* 一次变更的差异。
|
|
339
|
+
*
|
|
340
|
+
* 配置审计的历史条目存的是**整份快照**,所以相邻两条一比就能得出"改了哪个字段、
|
|
341
|
+
* 从什么变成什么"。这里只比 properties 的顶层键并把值序列化成短串:
|
|
342
|
+
* 再深的层级对"这条资源怎么变成现在这样"没有更多帮助,却会把抽屉塞满。
|
|
343
|
+
*/
|
|
344
|
+
export interface ConfigResourceDiff {
|
|
345
|
+
readonly at: string | null;
|
|
346
|
+
/** 原始 status,例如 `ResourceChanged.UPDATE`。 */
|
|
347
|
+
readonly status: string;
|
|
348
|
+
readonly fields: readonly ConfigResourceDiffField[];
|
|
349
|
+
/** 关系变了(checksum 不变但 relations 不同)。 */
|
|
350
|
+
readonly relation_changed: boolean;
|
|
351
|
+
}
|
|
352
|
+
/** 单个资源的详情(点开抽屉时取)。 */
|
|
353
|
+
export interface ConfigResourceDetail {
|
|
354
|
+
readonly row: ConfigResourceRow;
|
|
355
|
+
/** 资源属性(云上原样返回,字段随资源类型变化)。 */
|
|
356
|
+
readonly properties: Record<string, unknown> | null;
|
|
357
|
+
readonly tags: readonly {
|
|
358
|
+
readonly key: string;
|
|
359
|
+
readonly value: string;
|
|
360
|
+
}[];
|
|
361
|
+
/** 资源时间线(capture_time 倒序,最多 20 条)。 */
|
|
362
|
+
readonly history: readonly {
|
|
363
|
+
readonly capture_time: string | null;
|
|
364
|
+
readonly status: string | null;
|
|
365
|
+
readonly provider: string | null;
|
|
366
|
+
readonly type: string | null;
|
|
367
|
+
}[];
|
|
368
|
+
/** 相邻快照的差异(最近的在前,最多 10 次)。 */
|
|
369
|
+
readonly diffs: readonly ConfigResourceDiff[];
|
|
370
|
+
/** 关系(从最新一条历史里取;本域没有独立的关系接口,实测 404)。 */
|
|
371
|
+
readonly relations: readonly {
|
|
372
|
+
readonly relation_type: string;
|
|
373
|
+
readonly from_type: string;
|
|
374
|
+
readonly to_type: string;
|
|
375
|
+
readonly to_id: string;
|
|
376
|
+
}[];
|
|
377
|
+
/** history 取不到时的一句话(接口在本域不一定有数据)。 */
|
|
378
|
+
readonly history_note: string | null;
|
|
379
|
+
}
|
|
380
|
+
/** 未覆盖账号的诊断结论。 */
|
|
381
|
+
export type UncoveredReason = 'tracker_disabled' | 'tracker_enabled' | 'tracker_unknown' | 'assume_failed';
|
|
382
|
+
/**
|
|
383
|
+
* 一个未覆盖账号的体检结果。
|
|
384
|
+
*
|
|
385
|
+
* 这里**不做任何推断**:结论只来自两个事实 —— assume 成不成、tracker-config 说什么。
|
|
386
|
+
* 实测未开记录器的账号返回 404 RMS.00010005 Tracker configuration does not exist,
|
|
387
|
+
* 于是 racker_disabled 是有据可查的,而不是"猜它没开"。
|
|
388
|
+
*/
|
|
389
|
+
export interface UncoveredAccount {
|
|
390
|
+
readonly id: string;
|
|
391
|
+
readonly name: string;
|
|
392
|
+
readonly reason: UncoveredReason;
|
|
393
|
+
/** 服务端原文/一句人话,页面直接显示(不加工成"失败"两个字)。 */
|
|
394
|
+
readonly message: string;
|
|
395
|
+
readonly obs_bucket: string | null;
|
|
396
|
+
readonly retention_days: number | null;
|
|
397
|
+
}
|
|
398
|
+
/** 未覆盖账号诊断报告。 */
|
|
399
|
+
export interface UncoveredReport {
|
|
400
|
+
readonly rows: readonly UncoveredAccount[];
|
|
401
|
+
/** 组织里 active 但聚合器里没有数据的账号数(可能大于 rows.length,见 truncated)。 */
|
|
402
|
+
readonly uncovered_total: number;
|
|
403
|
+
/** 本次真正探测了多少个。 */
|
|
404
|
+
readonly checked: number;
|
|
405
|
+
/** 未覆盖账号多于单次探测上限时为 true。 */
|
|
406
|
+
readonly truncated: boolean;
|
|
407
|
+
readonly summary: {
|
|
408
|
+
readonly tracker_disabled: number;
|
|
409
|
+
readonly tracker_enabled: number;
|
|
410
|
+
readonly tracker_unknown: number;
|
|
411
|
+
readonly assume_failed: number;
|
|
412
|
+
};
|
|
413
|
+
/** 生成时间(这份体检结果不是实时的,页面要显示)。 */
|
|
414
|
+
readonly checked_at: string;
|
|
415
|
+
}
|
|
416
|
+
/** /api/wb/config/accounts 的载荷(复用组织账号列表)。 */
|
|
417
|
+
export interface ConfigAccountList {
|
|
418
|
+
readonly accounts: readonly {
|
|
419
|
+
readonly id: string;
|
|
420
|
+
readonly name: string;
|
|
421
|
+
readonly status: string;
|
|
422
|
+
}[];
|
|
423
|
+
readonly source: 'organization' | 'none';
|
|
424
|
+
readonly organizationUnavailable?: string;
|
|
425
|
+
/** 主账号 domainId 与名称,页面用它标注"组织视角"。 */
|
|
426
|
+
readonly main_account_id: string;
|
|
427
|
+
readonly main_account_name: string;
|
|
428
|
+
/** 当前凭据自己是谁(成员登录时页面据此把"本账号"标对)。 */
|
|
429
|
+
readonly identity?: ConfigMetaIdentity;
|
|
430
|
+
/** 组织视角能不能给(不能就是成员身份,见 `ConfigChannel`)。 */
|
|
431
|
+
readonly channel?: ConfigChannel;
|
|
432
|
+
/**
|
|
433
|
+
* 视角初值:`'*'` = 组织视角;32 位 domainId = 锁到那个账号。
|
|
434
|
+
*
|
|
435
|
+
* 前端拿它当初值而不是自己猜:成员身份下服务端只发自己的账号,
|
|
436
|
+
* 页面如果还按 `''`(组织)取数,就会立刻撞上 403 而无数据可看。
|
|
437
|
+
*/
|
|
438
|
+
readonly scope_default?: string;
|
|
439
|
+
/** 通道判定的说明(身份是成员时为什么要锁定本账号)。 */
|
|
440
|
+
readonly channel_note?: string;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* 一条合规规则在本账号的评估情况。
|
|
444
|
+
*
|
|
445
|
+
* 为什么规则要带两个维度的计数(资源 / 规则自身):
|
|
446
|
+
* summary 的 `assignment_details` 是"这条规则算合规还是不合规"(布尔式),
|
|
447
|
+
* 而 `resource_details` 是"它管着的资源里有几个不合规"。只给前者,
|
|
448
|
+
* 用户看不出"这条规则很严还是很松"。
|
|
449
|
+
*/
|
|
450
|
+
export interface ConfigRuleRow {
|
|
451
|
+
readonly id: string;
|
|
452
|
+
readonly name: string;
|
|
453
|
+
/** builtin / custom(系统预设 or 自定义函数)。 */
|
|
454
|
+
readonly type: string;
|
|
455
|
+
readonly state: string | null;
|
|
456
|
+
readonly compliance_state: string | null;
|
|
457
|
+
readonly compliant_count: number;
|
|
458
|
+
readonly non_compliant_count: number;
|
|
459
|
+
readonly evaluation_time: string | null;
|
|
460
|
+
}
|
|
461
|
+
/** 一条"某资源被某规则判为不合规"的判定。 */
|
|
462
|
+
export interface ConfigNonCompliantRow {
|
|
463
|
+
readonly resource_id: string;
|
|
464
|
+
readonly resource_name: string;
|
|
465
|
+
readonly provider: string;
|
|
466
|
+
readonly service_name: string;
|
|
467
|
+
readonly type: string;
|
|
468
|
+
readonly type_name: string;
|
|
469
|
+
readonly region_id: string;
|
|
470
|
+
readonly region_name: string;
|
|
471
|
+
readonly rule_id: string;
|
|
472
|
+
readonly rule_name: string;
|
|
473
|
+
readonly evaluation_time: string | null;
|
|
474
|
+
readonly compliance_state: string;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* 合规明细(只有账号视角给得出)。
|
|
478
|
+
*
|
|
479
|
+
* 组织视角拿不到:驱动这份数据的聚合器侧接口在云上未发布
|
|
480
|
+
* (`/aggregators/{id}/policy-states` 返回 404 APIGW.0101,实测),
|
|
481
|
+
* 只能逐账号 assume 去读它自己的合规结果。
|
|
482
|
+
*/
|
|
483
|
+
export interface ConfigComplianceDetail {
|
|
484
|
+
readonly rules: readonly ConfigRuleRow[];
|
|
485
|
+
readonly non_compliant: readonly ConfigNonCompliantRow[];
|
|
486
|
+
/** 当前按哪条规则筛的;null = 全部不合规。 */
|
|
487
|
+
readonly rule_id: string | null;
|
|
488
|
+
/** 不合规总数(可能大于 non_compliant.length)。 */
|
|
489
|
+
readonly total_non_compliant: number;
|
|
490
|
+
readonly truncated: boolean;
|
|
491
|
+
}
|
|
492
|
+
/** 审计发现的严重度(决定排序与颜色,不做加权评分 —— 加权会掩盖"哪件事更该先做")。 */
|
|
493
|
+
export type FindingSeverity = 'high' | 'medium' | 'low';
|
|
494
|
+
/**
|
|
495
|
+
* 一条审计发现能点去哪里。
|
|
496
|
+
*
|
|
497
|
+
* 用字符串而不是回调:这份数据由宿主生成,客户端只负责把它映射到页面上的
|
|
498
|
+
* 动作(打开诊断弹窗 / 滚到某张卡)。`none` 表示"我们能看见,但这里做不了"——
|
|
499
|
+
* 例如创建合规规则,那需要在控制台或 IaC 里做,看板只读。
|
|
500
|
+
*/
|
|
501
|
+
export type FindingAction = 'diagnose' | 'scroll:compliance' | 'scroll:resources' | 'scroll:tracker' | 'none';
|
|
502
|
+
/** 一条审计发现。 */
|
|
503
|
+
export interface ConfigFinding {
|
|
504
|
+
readonly id: string;
|
|
505
|
+
readonly severity: FindingSeverity;
|
|
506
|
+
/** 一句话结论,例:`30 个账号未纳入审计`。 */
|
|
507
|
+
readonly title: string;
|
|
508
|
+
/** 为什么这件事重要 / 证据是什么(必须是事实,不是套话)。 */
|
|
509
|
+
readonly detail: string;
|
|
510
|
+
/** 右侧显示的量值,例:`30 / 35`。 */
|
|
511
|
+
readonly metric: string;
|
|
512
|
+
readonly action: FindingAction;
|
|
513
|
+
/** 按钮文案,例:`诊断原因`。 */
|
|
514
|
+
readonly action_hint: string;
|
|
515
|
+
}
|
|
516
|
+
/** 顶部 KPI 的语义键:前端按它决定"点了去哪儿"。 */
|
|
517
|
+
/** 规则细则(点「合规规则」看的那份)。 */
|
|
518
|
+
export interface ConfigRuleDetail {
|
|
519
|
+
readonly id: string;
|
|
520
|
+
readonly name: string;
|
|
521
|
+
readonly type: string;
|
|
522
|
+
readonly state: string;
|
|
523
|
+
readonly description: string;
|
|
524
|
+
/** 规则定义 id(拿不到时为空串)。 */
|
|
525
|
+
readonly definition_id: string;
|
|
526
|
+
/** 判定逻辑原文(ResourceQL / policy_rule JSON 字符串;内置规则为空串)。 */
|
|
527
|
+
readonly policy_rule: string;
|
|
528
|
+
/** 判定方式:resource_ql 等。 */
|
|
529
|
+
readonly rule_kind: string;
|
|
530
|
+
/** 适用的资源类型,例:"iam.users"。 */
|
|
531
|
+
readonly applies_to: readonly string[];
|
|
532
|
+
/** 关键词(内置规则用它做分类)。 */
|
|
533
|
+
readonly keywords: readonly string[];
|
|
534
|
+
/** 规则参数:名字 / 说明 / 默认值。 */
|
|
535
|
+
readonly parameters: readonly {
|
|
536
|
+
readonly name: string;
|
|
537
|
+
readonly description: string;
|
|
538
|
+
readonly type: string;
|
|
539
|
+
readonly default_value: string;
|
|
540
|
+
}[];
|
|
541
|
+
readonly account_id: string;
|
|
542
|
+
readonly account_name: string;
|
|
543
|
+
/** 这条规则下不合规 / 合规的资源数(与表格同源)。 */
|
|
544
|
+
readonly non_compliant: number;
|
|
545
|
+
readonly compliant: number;
|
|
546
|
+
readonly updated: string | null;
|
|
547
|
+
readonly note: string;
|
|
548
|
+
}
|
|
549
|
+
export type ConfigFactKey = 'resources' | 'compliance_ratio' | 'coverage' | 'rules' | 'non_compliant' | 'todo';
|
|
550
|
+
/** 审计结论条:一句话 + 四个关键数 + 可信范围。 */
|
|
551
|
+
export interface ConfigAuditSummary {
|
|
552
|
+
readonly scope: ConfigScope;
|
|
553
|
+
readonly headline: string;
|
|
554
|
+
/**
|
|
555
|
+
* 支撑数字。
|
|
556
|
+
*
|
|
557
|
+
* `weight` 决定它进"大数字条"还是退成一行小字:primary 是读者第一眼要抓的四个数,
|
|
558
|
+
* secondary(如"服务 / 区域")只是背景信息 —— 五个数挤在一排,节奏就散了。
|
|
559
|
+
*/
|
|
560
|
+
readonly facts: readonly {
|
|
561
|
+
readonly label: string;
|
|
562
|
+
readonly value: string;
|
|
563
|
+
/** 卡片副行(2026-11-25):如资源卡上的"覆盖 N 个账号"。 */
|
|
564
|
+
readonly sub?: string;
|
|
565
|
+
readonly tone?: 'ok' | 'warn' | 'muted';
|
|
566
|
+
readonly weight?: 'primary' | 'secondary';
|
|
567
|
+
/** 这个数字对应的"去哪儿看"语义键;前端据此决定点了跳到哪张卡。 */
|
|
568
|
+
readonly key?: ConfigFactKey;
|
|
569
|
+
}[];
|
|
570
|
+
/**
|
|
571
|
+
* 本次结论的可信范围。
|
|
572
|
+
*
|
|
573
|
+
* 为什么必须有:组织视角只覆盖聚合器里的账号(实测 5 / 35),
|
|
574
|
+
* 不说清就会让"855 个资源、55 条不合规"被当成整个组织的事实。
|
|
575
|
+
*/
|
|
576
|
+
readonly caveat: string;
|
|
577
|
+
readonly findings: readonly ConfigFinding[];
|
|
578
|
+
}
|
|
579
|
+
/** 变更事件的种类(由 history 条目的 status 映射而来)。 */
|
|
580
|
+
export type ChangeEventKind = 'create' | 'update' | 'delete' | 'relation' | 'other';
|
|
581
|
+
/** 一条变更事件。 */
|
|
582
|
+
export interface ConfigChangeEvent {
|
|
583
|
+
/** 云上记录的采集时间(`capture_time`),不是我们请求的时间。 */
|
|
584
|
+
readonly at: string | null;
|
|
585
|
+
readonly kind: ChangeEventKind;
|
|
586
|
+
/** 原始 status,例如 `ResourceChanged.UPDATE` —— 保留原文便于对账。 */
|
|
587
|
+
readonly status: string;
|
|
588
|
+
readonly resource_id: string;
|
|
589
|
+
readonly resource_name: string;
|
|
590
|
+
readonly provider: string;
|
|
591
|
+
readonly service_name: string;
|
|
592
|
+
readonly type: string;
|
|
593
|
+
readonly type_name: string;
|
|
594
|
+
readonly region_id: string;
|
|
595
|
+
readonly region_name: string;
|
|
596
|
+
readonly account_id: string;
|
|
597
|
+
readonly account_name: string;
|
|
598
|
+
/**
|
|
599
|
+
* 这条事件相对上一条**改了哪些字段**(properties 的顶层键名;关系变更给 `关系`)。
|
|
600
|
+
*
|
|
601
|
+
* 为什么只到顶层键:Config 的历史条目是整份快照,逐层比对能做出精确 diff,
|
|
602
|
+
* 但"改的是哪个字段"这个粒度已经足够回答"它怎么变成现在这样的",
|
|
603
|
+
* 也更适合在事件流里横向阅读。
|
|
604
|
+
*/
|
|
605
|
+
readonly changed_fields: readonly string[];
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* 变更事件流。
|
|
609
|
+
*
|
|
610
|
+
* 关键限制必须写在数据里:配置审计**没有跨资源的变更流接口**
|
|
611
|
+
* (`/resources/history` 等路径实测全部 404),ResourceQL 的日期比较又静默失效,
|
|
612
|
+
* 所以"最近 N 天所有变更"做不出来。可行的是:**回看最近变更的 N 个资源**,
|
|
613
|
+
* 把它们各自的时间线合成一条流。于是页面上的数字是"这 N 个资源的事件",不是"全部变更"。
|
|
614
|
+
*/
|
|
615
|
+
/** 一条云审计(CTS)操作记录:谁、在哪、什么时候、通过什么方式动的这个资源。 */
|
|
616
|
+
export interface ConfigResourceTrace {
|
|
617
|
+
/** 云上记录的毫秒时间戳。 */
|
|
618
|
+
readonly at: number | null;
|
|
619
|
+
readonly trace_name: string;
|
|
620
|
+
/** ConsoleAction(控制台)/ ApiCall(API)/ system(系统内部)。 */
|
|
621
|
+
readonly trace_type: string;
|
|
622
|
+
readonly service_type: string;
|
|
623
|
+
/** IAM 用户名;用委托或 AK 调用时这里是账号名或委托主体。 */
|
|
624
|
+
readonly user_name: string | null;
|
|
625
|
+
readonly user_id: string | null;
|
|
626
|
+
/** 账号名与 domainId。 */
|
|
627
|
+
readonly account_name: string | null;
|
|
628
|
+
readonly account_id: string | null;
|
|
629
|
+
/** 走 API 调用时的 AK 形态(便于判断是脚本还是人工)。 */
|
|
630
|
+
readonly access_key_id: string | null;
|
|
631
|
+
readonly source_ip: string | null;
|
|
632
|
+
readonly resource_name: string | null;
|
|
633
|
+
readonly resource_type: string | null;
|
|
634
|
+
/** normal / warning。 */
|
|
635
|
+
readonly rating: string | null;
|
|
636
|
+
/**
|
|
637
|
+
* 这条 trace 是**怎么被认成与该资源相关**的。
|
|
638
|
+
*
|
|
639
|
+
* `id` = 审计记录的资源 id 就是这个资源(最准);
|
|
640
|
+
* `related` = 记在它的**关联对象**上(挂载它的 ECS、它所属的企业项目)——
|
|
641
|
+
* 关系变更、企业项目迁移这类批量动作属于这种;
|
|
642
|
+
* `name` = 名字对上了但 id 不是同一个,可能误配,页面必须标注。
|
|
643
|
+
*/
|
|
644
|
+
readonly match: 'id' | 'related' | 'name';
|
|
645
|
+
/** 请求体/消息里最有用的一小段(被操作对象的 id 常常就在这里)。 */
|
|
646
|
+
readonly context: string | null;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* 某个资源的审计记录视图。
|
|
650
|
+
*
|
|
651
|
+
* 为什么不是一个简单的数组:云审计记的是"操作动了哪个对象",配置审计记的是
|
|
652
|
+
* "资源状态变了"。同一个变更,两边的对象经常不是同一个(盘挂到机器、企业项目迁移、
|
|
653
|
+
* 批量改标签),所以这里必须如实交代"这些记录是怎么认回来的"。
|
|
654
|
+
*/
|
|
655
|
+
export interface ConfigResourceTracesView {
|
|
656
|
+
readonly resource_id: string;
|
|
657
|
+
readonly region_id: string;
|
|
658
|
+
readonly account_id: string;
|
|
659
|
+
readonly account_name: string | null;
|
|
660
|
+
readonly traces: readonly ConfigResourceTrace[];
|
|
661
|
+
/** 最强的一档匹配方式(id > related > name)。 */
|
|
662
|
+
readonly match_mode: 'id' | 'related' | 'name' | 'none';
|
|
663
|
+
/** 为做归因额外查了几个关联对象。 */
|
|
664
|
+
readonly related_probed: number;
|
|
665
|
+
/** System 追踪器的保留天数(查不到不等于没操作,可能只是过期了)。 */
|
|
666
|
+
readonly retention_days: number;
|
|
667
|
+
readonly note: string;
|
|
668
|
+
readonly data_as_of: string;
|
|
669
|
+
}
|
|
670
|
+
export interface ConfigChangesView {
|
|
671
|
+
readonly events: readonly ConfigChangeEvent[];
|
|
672
|
+
/** 为了凑出这些事件,回看了多少个资源的历史。 */
|
|
673
|
+
readonly scanned: number;
|
|
674
|
+
/** 事件条数上限。 */
|
|
675
|
+
readonly limit: number;
|
|
676
|
+
/** 事件被截断(超过上限)时为 true。 */
|
|
677
|
+
readonly truncated: boolean;
|
|
678
|
+
/** 一句话说明"这些事件覆盖了什么、没覆盖什么"。 */
|
|
679
|
+
readonly note: string;
|
|
680
|
+
readonly data_as_of: string;
|
|
681
|
+
}
|
|
682
|
+
/** 一条规则命中的一个具体资源(建议里"落到资源 id"就是靠它)。 */
|
|
683
|
+
export interface ConfigRuleSample {
|
|
684
|
+
readonly resource_id: string;
|
|
685
|
+
readonly resource_name: string;
|
|
686
|
+
readonly resource_type: string | null;
|
|
687
|
+
readonly region_id: string | null;
|
|
688
|
+
readonly account_id: string;
|
|
689
|
+
readonly account_name: string;
|
|
690
|
+
}
|
|
691
|
+
/** 规则维度的一行:修这条规则,能消掉多少个账号 / 多少资源。 */
|
|
692
|
+
export interface ConfigRuleTarget {
|
|
693
|
+
readonly name: string;
|
|
694
|
+
readonly non_compliant: number;
|
|
695
|
+
readonly accounts: number;
|
|
696
|
+
readonly samples: readonly ConfigRuleSample[];
|
|
697
|
+
}
|
|
698
|
+
/** 账号维度的一行:这个账号为什么没数据、该开什么。 */
|
|
699
|
+
export interface ConfigAccountTarget {
|
|
700
|
+
readonly id: string;
|
|
701
|
+
readonly name: string;
|
|
702
|
+
readonly reason: string;
|
|
703
|
+
readonly message: string;
|
|
704
|
+
readonly obs_bucket: string | null;
|
|
705
|
+
readonly retention_days: number | null;
|
|
706
|
+
}
|
|
707
|
+
/** 一条建议的"可执行对象":要么是规则清单,要么是账号清单。 */
|
|
708
|
+
export type ConfigFindingTargets = {
|
|
709
|
+
readonly kind: 'rule';
|
|
710
|
+
readonly rules: readonly ConfigRuleTarget[];
|
|
711
|
+
} | {
|
|
712
|
+
readonly kind: 'account';
|
|
713
|
+
readonly accounts: readonly ConfigAccountTarget[];
|
|
714
|
+
};
|
|
715
|
+
/** 组织级合规汇总里的一个账号。 */
|
|
716
|
+
export interface ConfigRollupRow {
|
|
717
|
+
readonly id: string;
|
|
718
|
+
readonly name: string;
|
|
719
|
+
/** 该账号的合规规则数 / 不合规资源数 / 规则包数。 */
|
|
720
|
+
readonly rules: number;
|
|
721
|
+
readonly non_compliant_resources: number;
|
|
722
|
+
readonly compliant_resources: number;
|
|
723
|
+
readonly packs: number;
|
|
724
|
+
/** 取数失败时的原因(该行不计入合计)。 */
|
|
725
|
+
readonly error?: string;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* 组织级合规汇总。
|
|
729
|
+
*
|
|
730
|
+
* 为什么是**手动触发**:聚合器不聚合合规(`/aggregators/{id}/policy-states` 实测 404),
|
|
731
|
+
* 所以只能逐账号 assume 去读它自己的结果。5 个账号约 2 秒,缓存 6 小时 ——
|
|
732
|
+
* 每次打开页面都多花 2 秒换一份只读信息,不值。
|
|
733
|
+
*
|
|
734
|
+
* 合计只算**成功取到数的账号**,并把失败的账号单独报出来:把失败账号当作 0
|
|
735
|
+
* 会让"组织合规率"看起来更好,那是最危险的一种错。
|
|
736
|
+
*/
|
|
737
|
+
export interface ConfigComplianceRollup {
|
|
738
|
+
readonly rows: readonly ConfigRollupRow[];
|
|
739
|
+
/** 参与合计的账号数(= rows 里没有 error 的)。 */
|
|
740
|
+
readonly succeeded: number;
|
|
741
|
+
/** 组织里被聚合器覆盖、本次尝试过的账号数。 */
|
|
742
|
+
readonly attempted: number;
|
|
743
|
+
readonly rules: number;
|
|
744
|
+
readonly non_compliant_resources: number;
|
|
745
|
+
readonly compliant_resources: number;
|
|
746
|
+
readonly packs: number;
|
|
747
|
+
/**
|
|
748
|
+
* 跨账号合并后的「不合规最多的规则」(按规则名相加,降序,最多 8 条)。
|
|
749
|
+
*
|
|
750
|
+
* 聚合器不聚合合规,所以这是逐账号读 policy-states 后按规则名累加出来的;
|
|
751
|
+
* `accounts` 表示这条规则出现在几个账号里 —— 同一个规则名在不同账号是各自独立的
|
|
752
|
+
* 合规规则,合起来看才有"组织层面哪条最容易不合规"的意义。
|
|
753
|
+
*/
|
|
754
|
+
readonly top_rules: readonly {
|
|
755
|
+
readonly name: string;
|
|
756
|
+
readonly non_compliant: number;
|
|
757
|
+
readonly accounts: number;
|
|
758
|
+
}[];
|
|
759
|
+
/**
|
|
760
|
+
* 规则级合计(跨账号按规则名合并):组织视角的「合规明细」用它。
|
|
761
|
+
*
|
|
762
|
+
* 为什么按规则名合并:同名规则在不同账号是各自独立的合规规则;资源级明细拼不成
|
|
763
|
+
* 一张跨账号的表(每行的资源属于不同账号),能诚实合起来看的只有"这条规则在组织里
|
|
764
|
+
* 一共判了多少个资源"。
|
|
765
|
+
*/
|
|
766
|
+
readonly rule_rows: readonly {
|
|
767
|
+
readonly name: string;
|
|
768
|
+
/** 规则类型:builtin = 系统预设,custom = 自定义。 */
|
|
769
|
+
readonly type: string;
|
|
770
|
+
readonly non_compliant: number;
|
|
771
|
+
readonly compliant: number;
|
|
772
|
+
/** 这条规则出现在几个账号里。 */
|
|
773
|
+
readonly accounts: number;
|
|
774
|
+
/** 取细则用:任一个拥有该规则的账号 + 它的 assignment id。 */
|
|
775
|
+
readonly ref_account_id?: string;
|
|
776
|
+
readonly ref_assignment_id?: string;
|
|
777
|
+
/** 具体命中哪几个资源(每规则至多 4 条)—— 建议里"落到资源 id"靠它。 */
|
|
778
|
+
readonly samples?: readonly ConfigRuleSample[];
|
|
779
|
+
}[];
|
|
780
|
+
/** 口径说明 + 覆盖范围。 */
|
|
781
|
+
readonly note: string;
|
|
782
|
+
readonly checked_at: string;
|
|
783
|
+
}
|
|
784
|
+
export {};
|
|
785
|
+
//# sourceMappingURL=types.d.ts.map
|