@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,67 @@
|
|
|
1
|
+
import type { CostCapability } from '../cost/types.ts';
|
|
2
|
+
import { type RmsContext } from './rms.ts';
|
|
3
|
+
import type { ConfigCapability, ConfigChannel } from './types.ts';
|
|
4
|
+
/** CostCapability → ConfigCapability(费用域那套 reason 在配置域语义相同,失败半边是子集)。 */
|
|
5
|
+
export declare function asConfigCapability(capability: CostCapability): ConfigCapability;
|
|
6
|
+
/** 解析出来的登录身份。 */
|
|
7
|
+
export interface ConfigIdentity {
|
|
8
|
+
/** 这份凭据属于哪个账号。 */
|
|
9
|
+
readonly own: {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
};
|
|
13
|
+
/** 组织管理账号;成员凭据下读不到组织信息时为 null。 */
|
|
14
|
+
readonly main: {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
} | null;
|
|
18
|
+
/**
|
|
19
|
+
* 组织视角该用哪个 domain。
|
|
20
|
+
*
|
|
21
|
+
* 主账号可知时是主账号;不可知时退化成"自己" —— 主账号读自己的 domain 得到的
|
|
22
|
+
* 就是组织视角(聚合器挂在它名下),所以这个退化在多数情况下恰好是对的;
|
|
23
|
+
* 成员身份则根本走不到这里(通道已判成 account)。
|
|
24
|
+
*/
|
|
25
|
+
readonly orgDomain: {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly name: string;
|
|
28
|
+
};
|
|
29
|
+
/** 组织视角能不能给。 */
|
|
30
|
+
readonly channel: ConfigChannel;
|
|
31
|
+
/** 凭据指纹(sha256 截断,不含 AK 原文)。 */
|
|
32
|
+
readonly fingerprint: string;
|
|
33
|
+
/** 通道判定的说明(成员身份时为什么要锁定本账号)。 */
|
|
34
|
+
readonly note?: string;
|
|
35
|
+
}
|
|
36
|
+
/** 解析结果:成功时连签名上下文一起给,避免调用方再读一次凭据库。 */
|
|
37
|
+
export type IdentityResult = {
|
|
38
|
+
readonly ok: true;
|
|
39
|
+
readonly identity: ConfigIdentity;
|
|
40
|
+
readonly ctx: RmsContext;
|
|
41
|
+
} | {
|
|
42
|
+
readonly ok: false;
|
|
43
|
+
readonly capability: ConfigCapability;
|
|
44
|
+
};
|
|
45
|
+
/** 清掉进程内身份缓存(刷新按钮用;换凭据靠指纹失配,不必手动清)。 */
|
|
46
|
+
export declare function forgetIdentity(): void;
|
|
47
|
+
/**
|
|
48
|
+
* 解析当前凭据的身份。
|
|
49
|
+
*
|
|
50
|
+
* @param force 忽略缓存(刷新按钮)。
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveIdentity(force?: boolean): Promise<IdentityResult>;
|
|
53
|
+
/**
|
|
54
|
+
* 取组织管理账号(Config 的路径里必须带它)。
|
|
55
|
+
*
|
|
56
|
+
* 注意这里**不**因为读不到就报错 —— 成员凭据读不到组织信息是正常现象,
|
|
57
|
+
* 由调用方决定"没有主账号 id 时怎么取数"(见 `resolveIdentity` 的 orgDomain)。
|
|
58
|
+
*/
|
|
59
|
+
export declare function getMainAccount(ctx: RmsContext, force?: boolean): Promise<{
|
|
60
|
+
ok: true;
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
} | {
|
|
64
|
+
ok: false;
|
|
65
|
+
capability: ConfigCapability;
|
|
66
|
+
}>;
|
|
67
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ResourceQL 表达式构造器。
|
|
3
|
+
*
|
|
4
|
+
* **安全边界:本模块是唯一拼 SQL 的地方,且只接受"我们自己校验过"的参数。**
|
|
5
|
+
* 页面传来的服务名、区域名一律先过白名单正则(只允许字母数字和连字符),
|
|
6
|
+
* 关键字搜索**不进 SQL**(在取回的行上做,见 views.ts)—— 这样就不存在
|
|
7
|
+
* "用户输入拼进查询语句"这条路,也就不需要字符串转义这种容易被漏掉的防线。
|
|
8
|
+
*
|
|
9
|
+
* 已验证的能力边界(实测,别凭 SQL 常识改):
|
|
10
|
+
* · `where` / `group by` / `order by` / `limit` 可用;
|
|
11
|
+
* · **`offset` 不支持**(`mismatched input 'offset'`),所以单次查询最多
|
|
12
|
+
* `QUERY_ROW_LIMIT` 行 —— 组织视角的明细天然只能取前 N 条;
|
|
13
|
+
* · 数组字面量 `tag = []` 语法错误,`size()` 函数不存在 —— 所以"无标签"
|
|
14
|
+
* 不能靠 SQL 数,只能在取回的行上数(这正是治理指标用抽样计算的原因)。
|
|
15
|
+
*
|
|
16
|
+
* @module @huaweidevtools/landingzone-workbench/config/query
|
|
17
|
+
*/
|
|
18
|
+
/** 组织聚合器里的资源表(**唯一**能在聚合器查询里用的表名)。 */
|
|
19
|
+
export declare const AGG_TABLE = "aggregator_resources";
|
|
20
|
+
/** 账号自己的资源表(`run-query` 用,账号视角走 all-resources 更全,这里只作兜底)。 */
|
|
21
|
+
export declare const RES_TABLE = "resources";
|
|
22
|
+
/** 校验服务名;不合法就返回 null(调用方当作"没筛")。 */
|
|
23
|
+
export declare function safeProvider(value: string | null | undefined): string | null;
|
|
24
|
+
/** 校验区域名。 */
|
|
25
|
+
export declare function safeRegion(value: string | null | undefined): string | null;
|
|
26
|
+
/** 校验账号 domainId。 */
|
|
27
|
+
export declare function isDomainId(value: string | null | undefined): boolean;
|
|
28
|
+
/** 资源字段(明细与详情共用一套,避免两处字段名漂移)。 */
|
|
29
|
+
export declare const RESOURCE_FIELDS: readonly ["domain_id", "id", "name", "provider", "type", "region_id", "ep_id", "project_id", "tag", "provisioning_state", "created", "updated"];
|
|
30
|
+
/** 资源明细查询的过滤条件。 */
|
|
31
|
+
export interface ResourceFilter {
|
|
32
|
+
readonly domainId?: string | null;
|
|
33
|
+
readonly provider?: string | null;
|
|
34
|
+
readonly region?: string | null;
|
|
35
|
+
}
|
|
36
|
+
/** 过滤条件拼成 where 子串。 */
|
|
37
|
+
export declare function resourceWhere(filter: ResourceFilter, table?: typeof AGG_TABLE | typeof RES_TABLE): string;
|
|
38
|
+
/** `select count(*) as n ...`。 */
|
|
39
|
+
export declare function countAll(filter?: ResourceFilter): string;
|
|
40
|
+
/** `select <column>, count(*) as n ... group by <column>`。 */
|
|
41
|
+
export declare function countBy(column: 'provider' | 'region_id' | 'domain_id', filter?: ResourceFilter): string;
|
|
42
|
+
/**
|
|
43
|
+
* 取一批明细行。
|
|
44
|
+
*
|
|
45
|
+
* 排序用 `updated desc`:Config 的明细天然是"最近变过的在前",比随意截断有意义。
|
|
46
|
+
* 而且资源一多,用户想看的本来就是刚动过的东西。
|
|
47
|
+
*/
|
|
48
|
+
export declare function sampleRows(limit: number, filter?: ResourceFilter): string;
|
|
49
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 配置审计(Config)的最小 REST 客户端。
|
|
3
|
+
*
|
|
4
|
+
* 为什么不复用 `cost/bss.ts` 的 `bssCall`:那个函数除了发请求,还内建了一套
|
|
5
|
+
* **费用中心专属**的错误语义(CBC.0151 → 缺 bbs:xxx 权限、`domain_id has no
|
|
6
|
+
* access` → 伙伴账号专属接口)。Config 的错误码完全是另一套:
|
|
7
|
+
*
|
|
8
|
+
* · `RMS.00010006 You are not authorized to this resources` —— 拿主账号凭据去读
|
|
9
|
+
* 别人的 domain,必须单独识别,否则会被当成"缺 IAM 权限"误导用户去加策略;
|
|
10
|
+
* · `APIGW.0101 The API does not exist or has not been published` —— 接口没发布,
|
|
11
|
+
* 是最难查的一类(路径写错了和真没有,报错一模一样);
|
|
12
|
+
* · `RMS.00010005 Resource relationships does not exist` —— 查到了但是没数据。
|
|
13
|
+
*
|
|
14
|
+
* 用的还是同一套 AK/SK 与官方签名(`ctx.pair` / `ctx.sign`),只是错误翻译各管各的。
|
|
15
|
+
*
|
|
16
|
+
* 端点事实(实测,不要凭产品直觉改):
|
|
17
|
+
* · `rms.cn-north-4.myhuaweicloud.com` 通;`rms.cn-east-3` TLS 直接断开 ——
|
|
18
|
+
* Config 是**账号级**服务,不要按资源所在区域去轮询端点;
|
|
19
|
+
* · `all-resources` 的 `limit` 上限是 **200**,给 201 直接 400(不是截断)。
|
|
20
|
+
*
|
|
21
|
+
* @module @huaweidevtools/landingzone-workbench/config/rms
|
|
22
|
+
*/
|
|
23
|
+
import type { BssContext } from '../cost/bss.ts';
|
|
24
|
+
import type { ConfigCapability } from './types.ts';
|
|
25
|
+
/** Config 端点。固定华北-北京四(Config 是账号级服务,与资源所在区域无关)。 */
|
|
26
|
+
export declare const RMS_HOST = "rms.cn-north-4.myhuaweicloud.com";
|
|
27
|
+
/** 组织服务(取主账号 domainId、账号名单)。 */
|
|
28
|
+
export declare const ORG_HOST = "organizations.myhuaweicloud.com";
|
|
29
|
+
/** 调用上下文(与费用域同一形状:一对凭据 + 签名器)。 */
|
|
30
|
+
export type RmsContext = BssContext;
|
|
31
|
+
/** `all-resources` 单页上限(超过就 400,实测)。 */
|
|
32
|
+
export declare const PAGE_LIMIT = 200;
|
|
33
|
+
/** 最多翻多少页(12 000 个资源)。超过就置 truncated,不假装取全了。 */
|
|
34
|
+
export declare const MAX_PAGES = 60;
|
|
35
|
+
/** ResourceQL 单次返回的行数上限(实测 200,且不支持 offset)。 */
|
|
36
|
+
export declare const QUERY_ROW_LIMIT = 200;
|
|
37
|
+
/** 路径表。全部带 domain_id —— Config 的每个接口都是 domain 作用域。 */
|
|
38
|
+
export declare const RMS_PATHS: {
|
|
39
|
+
readonly trackerConfig: (domainId: string) => string;
|
|
40
|
+
readonly allResources: (domainId: string) => string;
|
|
41
|
+
readonly resourceDetail: (domainId: string, id: string) => string;
|
|
42
|
+
readonly resourceHistory: (domainId: string, id: string) => string;
|
|
43
|
+
readonly aggregators: (domainId: string) => string;
|
|
44
|
+
readonly aggregatorQuery: (domainId: string, aggregatorId: string) => string;
|
|
45
|
+
readonly policyAssignments: (domainId: string) => string;
|
|
46
|
+
readonly complianceSummary: (domainId: string) => string;
|
|
47
|
+
readonly providers: (domainId: string) => string;
|
|
48
|
+
readonly regions: (domainId: string) => string;
|
|
49
|
+
};
|
|
50
|
+
/** 一次调用的结果。失败时带一个可展示的能力状态,不抛异常。 */
|
|
51
|
+
export type RmsOutcome<T> = {
|
|
52
|
+
readonly ok: true;
|
|
53
|
+
readonly data: T;
|
|
54
|
+
readonly ms: number;
|
|
55
|
+
} | {
|
|
56
|
+
readonly ok: false;
|
|
57
|
+
readonly capability: ConfigCapability;
|
|
58
|
+
readonly ms: number;
|
|
59
|
+
};
|
|
60
|
+
/** 华为云错误体(只取用得到的字段)。 */
|
|
61
|
+
interface RmsErrorBody {
|
|
62
|
+
readonly error_code?: string;
|
|
63
|
+
readonly error_msg?: string;
|
|
64
|
+
readonly message?: string;
|
|
65
|
+
readonly code?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 把一次非 2xx 响应翻译成能力状态。
|
|
69
|
+
*
|
|
70
|
+
* `RMS.00010006` 必须归到 permission 而不是 auth:它是"你有合法凭据,但没资格读
|
|
71
|
+
* 这个账号的资源",解决办法是换凭据(assume)或用聚合器,重新配 AK/SK 没有用。
|
|
72
|
+
*/
|
|
73
|
+
export declare function classifyRmsError(status: number, body: RmsErrorBody | undefined, rawText: string): ConfigCapability;
|
|
74
|
+
/**
|
|
75
|
+
* 发一个签名过的 Config 请求。
|
|
76
|
+
*
|
|
77
|
+
* @param ctx 凭据与签名器。
|
|
78
|
+
* @param method GET / POST。
|
|
79
|
+
* @param path 路径(不带 query)。
|
|
80
|
+
* @param query query 参数(参与签名)。
|
|
81
|
+
* @param payload JSON body;GET 传 undefined。
|
|
82
|
+
* @param host 默认 Config 端点(组织接口传 ORG_HOST)。
|
|
83
|
+
*/
|
|
84
|
+
export declare function rmsCall<T>(ctx: RmsContext, method: 'GET' | 'POST', path: string, query?: Record<string, string>, payload?: unknown, host?: string): Promise<RmsOutcome<T>>;
|
|
85
|
+
/** 资源记录器配置(字段名按实测返回体声明,不按文档猜)。 */
|
|
86
|
+
export interface TrackerConfigResponse {
|
|
87
|
+
readonly channel?: {
|
|
88
|
+
readonly smn?: {
|
|
89
|
+
readonly topic_urn?: string | null;
|
|
90
|
+
} | null;
|
|
91
|
+
readonly obs?: {
|
|
92
|
+
readonly bucket_name?: string | null;
|
|
93
|
+
readonly bucket_prefix?: string | null;
|
|
94
|
+
readonly region_id?: string | null;
|
|
95
|
+
} | null;
|
|
96
|
+
};
|
|
97
|
+
readonly selector?: {
|
|
98
|
+
readonly all_supported?: boolean;
|
|
99
|
+
readonly resource_types?: readonly string[];
|
|
100
|
+
};
|
|
101
|
+
readonly retention_period_in_days?: number;
|
|
102
|
+
readonly agency_name?: string;
|
|
103
|
+
readonly domain_id?: string;
|
|
104
|
+
readonly frozen_status?: string | null;
|
|
105
|
+
}
|
|
106
|
+
/** 一条资源(`all-resources` 与聚合器结果字段基本一致,聚合器多一个 domain_id)。 */
|
|
107
|
+
export interface RawResource {
|
|
108
|
+
readonly id?: string;
|
|
109
|
+
readonly name?: string;
|
|
110
|
+
readonly provider?: string;
|
|
111
|
+
readonly type?: string;
|
|
112
|
+
readonly region_id?: string;
|
|
113
|
+
readonly project_id?: string;
|
|
114
|
+
readonly project_name?: string;
|
|
115
|
+
readonly ep_id?: string;
|
|
116
|
+
readonly ep_name?: string;
|
|
117
|
+
readonly provisioning_state?: string | null;
|
|
118
|
+
readonly tags?: Record<string, string> | readonly {
|
|
119
|
+
readonly key?: string;
|
|
120
|
+
readonly value?: string;
|
|
121
|
+
}[];
|
|
122
|
+
readonly tag?: readonly {
|
|
123
|
+
readonly key?: string;
|
|
124
|
+
readonly value?: string;
|
|
125
|
+
}[] | Record<string, string>;
|
|
126
|
+
readonly properties?: Record<string, unknown>;
|
|
127
|
+
readonly created?: string;
|
|
128
|
+
readonly updated?: string;
|
|
129
|
+
readonly checksum?: string | null;
|
|
130
|
+
readonly domain_id?: string;
|
|
131
|
+
}
|
|
132
|
+
/** `all-resources` 的一页。 */
|
|
133
|
+
export interface AllResourcesResponse {
|
|
134
|
+
readonly resources?: readonly RawResource[];
|
|
135
|
+
readonly page_info?: {
|
|
136
|
+
readonly current_count?: number;
|
|
137
|
+
readonly next_marker?: string | null;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/** ResourceQL 的执行结果。 */
|
|
141
|
+
export interface RunQueryResponse {
|
|
142
|
+
readonly query_info?: {
|
|
143
|
+
readonly select_fields?: readonly string[];
|
|
144
|
+
};
|
|
145
|
+
readonly results?: readonly Record<string, unknown>[];
|
|
146
|
+
}
|
|
147
|
+
/** 聚合器列表。 */
|
|
148
|
+
export interface AggregatorsResponse {
|
|
149
|
+
readonly configuration_aggregators?: readonly {
|
|
150
|
+
readonly aggregator_name?: string;
|
|
151
|
+
readonly aggregator_id?: string;
|
|
152
|
+
readonly aggregator_type?: string;
|
|
153
|
+
readonly account_aggregation_sources?: {
|
|
154
|
+
readonly domain_ids?: readonly string[];
|
|
155
|
+
};
|
|
156
|
+
}[];
|
|
157
|
+
}
|
|
158
|
+
/** 服务(provider)与资源类型字典。 */
|
|
159
|
+
export interface ProvidersResponse {
|
|
160
|
+
readonly resource_providers?: readonly {
|
|
161
|
+
readonly provider?: string;
|
|
162
|
+
readonly display_name?: string;
|
|
163
|
+
readonly category_display_name?: string;
|
|
164
|
+
readonly resource_types?: readonly {
|
|
165
|
+
readonly name?: string;
|
|
166
|
+
readonly display_name?: string;
|
|
167
|
+
readonly global?: boolean;
|
|
168
|
+
}[];
|
|
169
|
+
}[];
|
|
170
|
+
}
|
|
171
|
+
/** 区域字典。 */
|
|
172
|
+
export interface RegionsResponse {
|
|
173
|
+
readonly value?: readonly {
|
|
174
|
+
readonly region_id?: string;
|
|
175
|
+
readonly display_name?: string;
|
|
176
|
+
}[];
|
|
177
|
+
}
|
|
178
|
+
/** 合规规则列表(只取用得着的字段)。 */
|
|
179
|
+
export interface PolicyAssignmentsResponse {
|
|
180
|
+
readonly value?: readonly {
|
|
181
|
+
readonly id?: string;
|
|
182
|
+
readonly name?: string;
|
|
183
|
+
readonly policy_assignment_type?: string;
|
|
184
|
+
readonly state?: string;
|
|
185
|
+
readonly compliance_state?: string;
|
|
186
|
+
}[];
|
|
187
|
+
readonly page_info?: {
|
|
188
|
+
readonly current_count?: number;
|
|
189
|
+
readonly next_marker?: string | null;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* 合规结果汇总(字段按**实测返回体**声明)。
|
|
194
|
+
*
|
|
195
|
+
* 易错点:`policy_assignments[i]` 里套着 `policy_assignment { id, name, … }`
|
|
196
|
+
* 与 `results { resource_details { … } }` 两层,不是扁平的
|
|
197
|
+
* `policy_assignment_id` / `non_compliant_count`。
|
|
198
|
+
*/
|
|
199
|
+
export interface ComplianceSummaryResponse {
|
|
200
|
+
readonly results?: {
|
|
201
|
+
readonly resource_details?: {
|
|
202
|
+
readonly compliant_count?: number;
|
|
203
|
+
readonly non_compliant_count?: number;
|
|
204
|
+
};
|
|
205
|
+
readonly assignment_details?: {
|
|
206
|
+
readonly compliant_count?: number;
|
|
207
|
+
readonly non_compliant_count?: number;
|
|
208
|
+
} | null;
|
|
209
|
+
};
|
|
210
|
+
readonly policy_assignments?: readonly {
|
|
211
|
+
readonly compliance_state?: string;
|
|
212
|
+
readonly policy_assignment?: {
|
|
213
|
+
readonly id?: string;
|
|
214
|
+
readonly name?: string;
|
|
215
|
+
readonly policy_assignment_type?: string;
|
|
216
|
+
readonly state?: string;
|
|
217
|
+
};
|
|
218
|
+
readonly results?: {
|
|
219
|
+
readonly resource_details?: {
|
|
220
|
+
readonly compliant_count?: number;
|
|
221
|
+
readonly non_compliant_count?: number;
|
|
222
|
+
} | null;
|
|
223
|
+
readonly assignment_details?: unknown;
|
|
224
|
+
} | null;
|
|
225
|
+
}[];
|
|
226
|
+
}
|
|
227
|
+
/** 组织信息(只要主账号)。 */
|
|
228
|
+
export interface OrganizationResponse {
|
|
229
|
+
readonly organization?: {
|
|
230
|
+
readonly id?: string;
|
|
231
|
+
readonly management_account_id?: string;
|
|
232
|
+
readonly management_account_name?: string;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/** 读资源记录器配置。 */
|
|
236
|
+
export declare function fetchTrackerConfig(ctx: RmsContext, domainId: string): Promise<RmsOutcome<TrackerConfigResponse>>;
|
|
237
|
+
/**
|
|
238
|
+
* 读某个 domain 的**全部**资源(自动翻页)。
|
|
239
|
+
*
|
|
240
|
+
* @returns rows 与 truncated;truncated 为 true 表示翻到页数上限还没取完 ——
|
|
241
|
+
* 此时页面必须写明"只统计了前 N 个",不能让用户以为看到了全部。
|
|
242
|
+
*/
|
|
243
|
+
export declare function fetchAllResources(ctx: RmsContext, domainId: string): Promise<RmsOutcome<{
|
|
244
|
+
rows: readonly RawResource[];
|
|
245
|
+
truncated: boolean;
|
|
246
|
+
pages: number;
|
|
247
|
+
}>>;
|
|
248
|
+
/** 读组织信息(主账号 domainId + 名称)。 */
|
|
249
|
+
export declare function fetchOrganization(ctx: RmsContext): Promise<RmsOutcome<OrganizationResponse>>;
|
|
250
|
+
/** 列聚合器。 */
|
|
251
|
+
export declare function fetchAggregators(ctx: RmsContext, domainId: string): Promise<RmsOutcome<AggregatorsResponse>>;
|
|
252
|
+
/**
|
|
253
|
+
* 跑一条 ResourceQL(组织视角的唯一入口)。
|
|
254
|
+
*
|
|
255
|
+
* 表名必须是 `aggregator_resources` —— 用 `resources` 会 400
|
|
256
|
+
* `You can only use 'aggregator_resources' to query`(实测)。
|
|
257
|
+
*/
|
|
258
|
+
export declare function runAggregatorQuery(ctx: RmsContext, domainId: string, aggregatorId: string, expression: string): Promise<RmsOutcome<RunQueryResponse>>;
|
|
259
|
+
/** 服务与资源类型字典(用来把 provider 翻成中文名)。 */
|
|
260
|
+
export declare function fetchProviders(ctx: RmsContext, domainId: string): Promise<RmsOutcome<ProvidersResponse>>;
|
|
261
|
+
/** 区域字典(region_id → 中文名)。 */
|
|
262
|
+
export declare function fetchRegions(ctx: RmsContext, domainId: string): Promise<RmsOutcome<RegionsResponse>>;
|
|
263
|
+
/** 合规规则列表(第一页足够判断"有没有规则")。 */
|
|
264
|
+
export declare function fetchPolicyAssignments(ctx: RmsContext, domainId: string): Promise<RmsOutcome<PolicyAssignmentsResponse>>;
|
|
265
|
+
/** 合规结果汇总。 */
|
|
266
|
+
export declare function fetchComplianceSummary(ctx: RmsContext, domainId: string): Promise<RmsOutcome<ComplianceSummaryResponse>>;
|
|
267
|
+
/** 单个资源详情。 */
|
|
268
|
+
export declare function fetchResourceDetail(ctx: RmsContext, domainId: string, id: string): Promise<RmsOutcome<RawResource>>;
|
|
269
|
+
/** 资源时间线(实测路径是 `/resources/{id}/history`,不是 `/tracked-resources/.../history`)。 */
|
|
270
|
+
/**
|
|
271
|
+
* 资源时间线的一页(字段按实测返回体声明)。
|
|
272
|
+
*
|
|
273
|
+
* 关键点:每条 item 都带 `resource`(**完整快照**)与 `relations` —— 所以
|
|
274
|
+
* "改了哪个字段"与"关系变成了什么"都能从这里算出来,不需要另外的 diff 接口。
|
|
275
|
+
* `relations` 的形状实测是数组:`[{relation_type, from_resource_type, to_resource_type,
|
|
276
|
+
* from_resource_id, to_resource_id}]`。
|
|
277
|
+
*/
|
|
278
|
+
export interface ResourceHistoryItem {
|
|
279
|
+
readonly domain_id?: string;
|
|
280
|
+
readonly resource_id?: string;
|
|
281
|
+
readonly resource_type?: string;
|
|
282
|
+
readonly capture_time?: string;
|
|
283
|
+
readonly status?: string;
|
|
284
|
+
readonly relations?: unknown;
|
|
285
|
+
readonly relationships?: unknown;
|
|
286
|
+
readonly resource?: Record<string, unknown>;
|
|
287
|
+
}
|
|
288
|
+
export interface ResourceHistoryResponse {
|
|
289
|
+
readonly items?: readonly ResourceHistoryItem[];
|
|
290
|
+
}
|
|
291
|
+
export declare function fetchResourceHistory(ctx: RmsContext, domainId: string, id: string): Promise<RmsOutcome<ResourceHistoryResponse>>;
|
|
292
|
+
/** 一条资源的合规判定(policy-states 的一行,字段名按实测返回体)。 */
|
|
293
|
+
export interface PolicyStateRow {
|
|
294
|
+
readonly domain_id?: string;
|
|
295
|
+
readonly region_id?: string;
|
|
296
|
+
readonly resource_id?: string;
|
|
297
|
+
readonly resource_name?: string;
|
|
298
|
+
readonly resource_provider?: string;
|
|
299
|
+
readonly resource_type?: string;
|
|
300
|
+
readonly trigger_type?: string;
|
|
301
|
+
readonly compliance_state?: string;
|
|
302
|
+
readonly policy_assignment_id?: string;
|
|
303
|
+
readonly policy_assignment_name?: string;
|
|
304
|
+
readonly policy_definition_id?: string;
|
|
305
|
+
readonly evaluation_time?: string;
|
|
306
|
+
}
|
|
307
|
+
/** 单条规则(policy-assignment)详情 —— 字段名按实测可能不同,调用侧按需容错。 */
|
|
308
|
+
export interface PolicyAssignmentDetailResponse {
|
|
309
|
+
readonly id?: string;
|
|
310
|
+
readonly name?: string;
|
|
311
|
+
readonly description?: string;
|
|
312
|
+
readonly state?: string;
|
|
313
|
+
readonly policy_assignment_type?: string;
|
|
314
|
+
readonly policy_definition_id?: string;
|
|
315
|
+
readonly policy_filter?: unknown;
|
|
316
|
+
readonly parameters?: unknown;
|
|
317
|
+
readonly created?: string;
|
|
318
|
+
readonly updated?: string;
|
|
319
|
+
}
|
|
320
|
+
/** 规则定义(policy-definition)详情。 */
|
|
321
|
+
export interface PolicyDefinitionResponse {
|
|
322
|
+
readonly id?: string;
|
|
323
|
+
readonly name?: string;
|
|
324
|
+
/** 人读的名字(内置规则给的是 display_name)。 */
|
|
325
|
+
readonly display_name?: string;
|
|
326
|
+
readonly description?: string;
|
|
327
|
+
readonly policy_type?: string;
|
|
328
|
+
/** 判定方式:resource_ql(ResourceQL)/ 其它。 */
|
|
329
|
+
readonly policy_rule_type?: string;
|
|
330
|
+
/** 判定逻辑原文。**内置规则这里是 null** —— 逻辑在服务端,不对外。 */
|
|
331
|
+
readonly policy_rule?: string | null;
|
|
332
|
+
readonly trigger_type?: string;
|
|
333
|
+
readonly resource_type?: string;
|
|
334
|
+
readonly keywords?: readonly string[];
|
|
335
|
+
/** 适用资源类型:{ provider, type }。 */
|
|
336
|
+
readonly default_resource_types?: readonly {
|
|
337
|
+
readonly provider?: string;
|
|
338
|
+
readonly type?: string;
|
|
339
|
+
}[];
|
|
340
|
+
readonly parameters?: Record<string, {
|
|
341
|
+
readonly name?: string | null;
|
|
342
|
+
readonly description?: string | null;
|
|
343
|
+
readonly type?: string | null;
|
|
344
|
+
readonly default_value?: string | number | boolean | null;
|
|
345
|
+
readonly allowed_values?: readonly unknown[] | null;
|
|
346
|
+
}>;
|
|
347
|
+
readonly created?: string;
|
|
348
|
+
readonly updated?: string;
|
|
349
|
+
}
|
|
350
|
+
/** 单条规则详情。 */
|
|
351
|
+
export declare function fetchPolicyAssignment(ctx: RmsContext, domainId: string, id: string): Promise<RmsOutcome<PolicyAssignmentDetailResponse>>;
|
|
352
|
+
/**
|
|
353
|
+
* 规则定义详情(细则:描述 + 判定逻辑)。
|
|
354
|
+
*
|
|
355
|
+
* 实测两套路径并存,不同环境只响应其中一套:
|
|
356
|
+
* ① `/domains/{domain}/policy-definitions/{id}`
|
|
357
|
+
* ② `/policy-definitions/{id}`(组织级,不带 domain)
|
|
358
|
+
* 所以这里先试 ①,失败再试 ② —— 两套都不通才算真取不到。
|
|
359
|
+
*/
|
|
360
|
+
export declare function fetchPolicyDefinition(ctx: RmsContext, domainId: string, id: string): Promise<RmsOutcome<PolicyDefinitionResponse>>;
|
|
361
|
+
/** policy-states 的一页。 */
|
|
362
|
+
export interface PolicyStatesResponse {
|
|
363
|
+
readonly value?: readonly PolicyStateRow[];
|
|
364
|
+
readonly page_info?: {
|
|
365
|
+
readonly current_count?: number;
|
|
366
|
+
readonly next_marker?: string | null;
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
/** 查合规判定(可按规则 / 合规状态过滤)。 */
|
|
370
|
+
export declare function fetchPolicyStates(ctx: RmsContext, domainId: string, query: {
|
|
371
|
+
readonly ruleId?: string;
|
|
372
|
+
readonly complianceState?: string;
|
|
373
|
+
readonly marker?: string;
|
|
374
|
+
readonly limit?: number;
|
|
375
|
+
}): Promise<RmsOutcome<PolicyStatesResponse>>;
|
|
376
|
+
/**
|
|
377
|
+
* 翻页取全合规判定。
|
|
378
|
+
*
|
|
379
|
+
* @returns rows 与 truncated;truncated 表示翻到页数上限还没取完 ——
|
|
380
|
+
* 此时页面必须写"只统计了前 N 条",不能让"55 个不合规"变成上限值。
|
|
381
|
+
*/
|
|
382
|
+
export declare function fetchAllPolicyStates(ctx: RmsContext, domainId: string, filter: {
|
|
383
|
+
readonly ruleId?: string;
|
|
384
|
+
readonly complianceState?: string;
|
|
385
|
+
}): Promise<RmsOutcome<{
|
|
386
|
+
rows: readonly PolicyStateRow[];
|
|
387
|
+
truncated: boolean;
|
|
388
|
+
}>>;
|
|
389
|
+
/** 翻页取全合规规则(规则可以有几百条,第一页不够)。 */
|
|
390
|
+
export declare function fetchAllPolicyAssignments(ctx: RmsContext, domainId: string): Promise<RmsOutcome<{
|
|
391
|
+
rows: readonly NonNullable<PolicyAssignmentsResponse['value']>[number][];
|
|
392
|
+
truncated: boolean;
|
|
393
|
+
}>>;
|
|
394
|
+
/** 账号自己域上的 ResourceQL(主账号/本账号凭据可用;assumed 凭据会 403)。 */
|
|
395
|
+
export declare function runAccountQuery(ctx: RmsContext, domainId: string, expression: string): Promise<RmsOutcome<RunQueryResponse>>;
|
|
396
|
+
/** 合规规则包(conformance pack):一组规则的集合,按包下发。 */
|
|
397
|
+
export interface ConformancePacksResponse {
|
|
398
|
+
readonly value?: readonly {
|
|
399
|
+
readonly id?: string;
|
|
400
|
+
readonly conformance_pack_name?: string;
|
|
401
|
+
readonly conformance_pack_urn?: string;
|
|
402
|
+
readonly created_at?: string;
|
|
403
|
+
readonly updated_at?: string;
|
|
404
|
+
}[];
|
|
405
|
+
readonly page_info?: {
|
|
406
|
+
readonly current_count?: number;
|
|
407
|
+
readonly next_marker?: string | null;
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
export declare function fetchConformancePacks(ctx: RmsContext, domainId: string): Promise<RmsOutcome<ConformancePacksResponse>>;
|
|
411
|
+
export {};
|
|
412
|
+
//# sourceMappingURL=rms.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type WebServerLike } from '../http.ts';
|
|
2
|
+
/** 路由需要的外围依赖。 */
|
|
3
|
+
export interface ConfigRoutesDeps {
|
|
4
|
+
readonly webServer: WebServerLike;
|
|
5
|
+
readonly logger: {
|
|
6
|
+
info: (message: string) => void;
|
|
7
|
+
warn: (message: string) => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 跑一次"配置审计分析建议"(后台一次性子代理,delivery=caller)。
|
|
11
|
+
*
|
|
12
|
+
* 放在 deps 里而不是直接 import:子代理要 host 的 agents/subagents 服务,
|
|
13
|
+
* 只有 index.ts 拿得到。路由层只管拼 prompt、存档、通知。
|
|
14
|
+
*/
|
|
15
|
+
readonly runAdvice?: (input: {
|
|
16
|
+
readonly prompt: string;
|
|
17
|
+
readonly outputSchema: object;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
readonly ok: boolean;
|
|
21
|
+
readonly structured?: unknown;
|
|
22
|
+
readonly text?: string;
|
|
23
|
+
readonly error?: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 注册全部配置审计路由。
|
|
28
|
+
* @returns 注销函数列表(调用方放进 ctx.effect)。
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerConfigRoutes(deps: ConfigRoutesDeps): (() => void)[];
|
|
31
|
+
export declare const CONFIG_ROUTE_COUNT = 9;
|
|
32
|
+
//# sourceMappingURL=routes.d.ts.map
|