@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,258 @@
|
|
|
1
|
+
import type { HuaweiPair, SignFn } from '../cost/credentials.ts';
|
|
2
|
+
import type { OrgCapability } from '../org-types.ts';
|
|
3
|
+
/** Organizations 全局端点(apiexplorer endpoints=true 确认)。 */
|
|
4
|
+
export declare const ORG_HOST = "organizations.myhuaweicloud.com";
|
|
5
|
+
/** 各接口的路径。 */
|
|
6
|
+
export declare const ORG_PATHS: {
|
|
7
|
+
/** ShowOrganization:查询所属组织。 */
|
|
8
|
+
readonly organization: "/v1/organizations";
|
|
9
|
+
/** ListRoots:组织的根。 */
|
|
10
|
+
readonly roots: "/v1/organizations/roots";
|
|
11
|
+
/** ListEntities:按 parent_id 列直属子实体(OU + 账号)。 */
|
|
12
|
+
readonly entities: "/v1/organizations/entities";
|
|
13
|
+
/** ListAccounts:组织内全部账号。 */
|
|
14
|
+
readonly accounts: "/v1/organizations/accounts";
|
|
15
|
+
/** ListDelegatedAdministrators:委托管理员。 */
|
|
16
|
+
readonly delegatedAdmins: "/v1/organizations/delegated-administrators";
|
|
17
|
+
/** CreateResourceAccount(v2):创建资源账号(无需邮箱手机)。 */
|
|
18
|
+
readonly createResourceAccount: "/v2/organizations/accounts";
|
|
19
|
+
/** MoveAccount:把账号移到目标 OU(或根)。按账号拼路径。 */
|
|
20
|
+
readonly moveAccount: "/v1/organizations/accounts";
|
|
21
|
+
};
|
|
22
|
+
/** CreateResourceAccount(v2)请求体。 */
|
|
23
|
+
export interface CreateResourceAccountInput {
|
|
24
|
+
/** 账号名,1~64 个字符。 */
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly description?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* 帐号访问委托名。默认 OrganizationAccountAccessAgency —— 组织云服务会在
|
|
29
|
+
* 新账号里自动创建所需的委托;显式带上这个字段是为了让委托名可见可改。
|
|
30
|
+
*/
|
|
31
|
+
readonly agency_name?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** 创建账号的状态(202 响应里的 create_account_status)。 */
|
|
34
|
+
export interface CreateAccountStatus {
|
|
35
|
+
readonly account_id: string;
|
|
36
|
+
readonly account_name: string;
|
|
37
|
+
readonly created_at: string;
|
|
38
|
+
readonly completed_at?: string;
|
|
39
|
+
/** 创建状态查询 id(ShowCreateAccountStatus 用)。 */
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly state: 'in_progress' | 'succeeded' | 'failed' | string;
|
|
42
|
+
readonly failure_reason?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 移动账号到目标 OU/根(写操作)。
|
|
46
|
+
*
|
|
47
|
+
* 华为云要求 source_parent_id 与 destination_parent_id 成对携带(源必须与账号
|
|
48
|
+
* 当前挂载位置一致,不一致直接 409)。单次调用不重试(POST 重试在移动场景
|
|
49
|
+
* 与创建同样危险)。返回 200 无载荷。
|
|
50
|
+
*/
|
|
51
|
+
export declare function moveAccount(ctx: OrgContext, accountId: string, sourceParentId: string, destinationParentId: string): Promise<OrgOutcome<Record<string, never>>>;
|
|
52
|
+
/**
|
|
53
|
+
* 创建资源账号(v2,写操作)。
|
|
54
|
+
*
|
|
55
|
+
* 与读路径的规矩不同:**单次调用、不重试** —— GET 重试是安全的,POST 重试
|
|
56
|
+
* 会在网络抖动时悄悄创建两个账号。失败把服务端原话带回去。
|
|
57
|
+
*/
|
|
58
|
+
export declare function createResourceAccount(ctx: OrgContext, input: CreateResourceAccountInput): Promise<OrgOutcome<{
|
|
59
|
+
create_account_status: CreateAccountStatus;
|
|
60
|
+
}>>;
|
|
61
|
+
/** 单页上限。 */
|
|
62
|
+
export declare const PAGE_SIZE = 100;
|
|
63
|
+
/** 一次调用的结果。失败时带一个可直接展示的能力状态,而不是抛异常。 */
|
|
64
|
+
export type OrgOutcome<T> = {
|
|
65
|
+
readonly ok: true;
|
|
66
|
+
readonly data: T;
|
|
67
|
+
readonly ms: number;
|
|
68
|
+
} | {
|
|
69
|
+
readonly ok: false;
|
|
70
|
+
readonly capability: OrgCapability;
|
|
71
|
+
readonly ms: number;
|
|
72
|
+
};
|
|
73
|
+
/** 调用上下文(凭据与签名器,与费用页 BssContext 同形)。 */
|
|
74
|
+
export interface OrgContext {
|
|
75
|
+
readonly pair: HuaweiPair;
|
|
76
|
+
readonly sign: SignFn;
|
|
77
|
+
}
|
|
78
|
+
/** 华为云的错误体(只取我们用得到的字段)。 */
|
|
79
|
+
interface OrgErrorBody {
|
|
80
|
+
readonly error_code?: string;
|
|
81
|
+
readonly error_msg?: string;
|
|
82
|
+
readonly message?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 把一次非 2xx 响应翻译成能力状态。
|
|
86
|
+
*
|
|
87
|
+
* 401/403 的含义必须分开:签名错(要改凭据)与权限不足(改凭据也没用,
|
|
88
|
+
* 要加 IAM 权限)。这是费用页 P0 实测得来的区分,组织域同样适用。
|
|
89
|
+
*/
|
|
90
|
+
export declare function classifyHttpError(status: number, body: OrgErrorBody | undefined, rawText: string): OrgCapability;
|
|
91
|
+
/**
|
|
92
|
+
* 发一个签名过的 Organizations 请求(只读 GET,带瞬时错误重试)。
|
|
93
|
+
*
|
|
94
|
+
* @param ctx 凭据与签名器。
|
|
95
|
+
* @param path 路径(不带 query)。
|
|
96
|
+
* @param query query 参数(会参与签名)。
|
|
97
|
+
*/
|
|
98
|
+
export declare function orgCall<T>(ctx: OrgContext, path: string, query?: Record<string, string>): Promise<OrgOutcome<T>>;
|
|
99
|
+
export declare function readObject(value: unknown, key?: string): Record<string, unknown> | undefined;
|
|
100
|
+
export declare function readArray(value: unknown, key?: string): readonly Record<string, unknown>[];
|
|
101
|
+
export declare function readStr(rec: Record<string, unknown> | undefined, key: string): string;
|
|
102
|
+
/** 读分页 marker(page_info.next_marker,兼容顶层 marker)。 */
|
|
103
|
+
export declare function readMarker(value: unknown): string;
|
|
104
|
+
/** ShowOrganization 响应(只取用得到的字段)。 */
|
|
105
|
+
export interface OrganizationResponse {
|
|
106
|
+
readonly organization?: {
|
|
107
|
+
readonly id?: string;
|
|
108
|
+
readonly management_account_id?: string;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** ListRoots 响应。 */
|
|
112
|
+
export interface RootsResponse {
|
|
113
|
+
readonly roots?: readonly {
|
|
114
|
+
readonly id?: string;
|
|
115
|
+
readonly name?: string;
|
|
116
|
+
}[];
|
|
117
|
+
}
|
|
118
|
+
/** ListEntities 响应(直属子实体)。 */
|
|
119
|
+
export interface EntitiesResponse {
|
|
120
|
+
readonly entities?: readonly {
|
|
121
|
+
readonly id?: string;
|
|
122
|
+
readonly type?: string;
|
|
123
|
+
readonly name?: string;
|
|
124
|
+
}[];
|
|
125
|
+
readonly page_info?: {
|
|
126
|
+
readonly next_marker?: string;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/** ListAccounts 的单个账号(字段名来自 hwstaff_ldz_test 实测)。 */
|
|
130
|
+
export interface AccountItem {
|
|
131
|
+
readonly id?: string;
|
|
132
|
+
readonly name?: string;
|
|
133
|
+
readonly status?: string;
|
|
134
|
+
readonly joined_at?: string;
|
|
135
|
+
readonly join_method?: string;
|
|
136
|
+
/** 账号描述(创建时带的用途一句话;邀请账号多为 null)。 */
|
|
137
|
+
readonly description?: string | null;
|
|
138
|
+
}
|
|
139
|
+
/** ListAccounts 响应。 */
|
|
140
|
+
export interface AccountsResponse {
|
|
141
|
+
readonly accounts?: readonly AccountItem[];
|
|
142
|
+
readonly page_info?: {
|
|
143
|
+
readonly next_marker?: string;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/** ListDelegatedAdministrators 响应。 */
|
|
147
|
+
export interface DelegatedAdminsResponse {
|
|
148
|
+
readonly delegated_administrators?: readonly {
|
|
149
|
+
readonly account_id?: string;
|
|
150
|
+
}[];
|
|
151
|
+
readonly page_info?: {
|
|
152
|
+
readonly next_marker?: string;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/** 查询所属组织。 */
|
|
156
|
+
export declare function fetchOrganization(ctx: OrgContext): Promise<OrgOutcome<OrganizationResponse>>;
|
|
157
|
+
/** 查询组织根(取第一个)。 */
|
|
158
|
+
export declare function fetchRoots(ctx: OrgContext): Promise<OrgOutcome<RootsResponse>>;
|
|
159
|
+
/** 查某父节点的直属子实体(单页)。 */
|
|
160
|
+
export declare function fetchEntitiesPage(ctx: OrgContext, parentId: string, marker?: string): Promise<OrgOutcome<EntitiesResponse>>;
|
|
161
|
+
/** 查询组织内全部账号(翻完所有页)。 */
|
|
162
|
+
export declare function fetchAllAccounts(ctx: OrgContext): Promise<OrgOutcome<readonly AccountItem[]>>;
|
|
163
|
+
/** 查询委托管理员(翻页,防御上限内取尽)。 */
|
|
164
|
+
export declare function fetchDelegatedAdmins(ctx: OrgContext): Promise<OrgOutcome<readonly string[]>>;
|
|
165
|
+
/** 管理用户列表一行(用户名/描述/状态/创建时间)。 */
|
|
166
|
+
export interface AccountUserView {
|
|
167
|
+
readonly id: string;
|
|
168
|
+
readonly name: string;
|
|
169
|
+
readonly description: string;
|
|
170
|
+
readonly status: '启用' | '停用';
|
|
171
|
+
/** 创建时间(UTC ISO;null=接口未返回)。 */
|
|
172
|
+
readonly created_at: string | null;
|
|
173
|
+
/** 账号根用户:列表展示但不给删除。 */
|
|
174
|
+
readonly is_root_user: boolean;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* 查目标账号的 IAM 用户列表(assume 组织委托 + V5 ListUsers,只读)。
|
|
178
|
+
*
|
|
179
|
+
* 用 V5 接口(GET /v5/users)而非 keystone v3:V3 响应没有创建时间,V5 一次
|
|
180
|
+
* 给齐 user_id/created_at/is_root_user。"最近活动时间"不做(2026-11-20 用户
|
|
181
|
+
* 拍板):last-login 只能逐用户查询,N 用户 = N 次请求,性能不划算。
|
|
182
|
+
*
|
|
183
|
+
* IAM 是全局服务的域级读:AK/SK 签名(含委托临时凭据)必须带 X-Domain-Id 头
|
|
184
|
+
* (签名外追加),网关按它把凭据换算成目标域的域级 token 再转发——缺头一律
|
|
185
|
+
* 403 "You are not authorized"(inventory.ts ListAgencies、per-service.ts 均有
|
|
186
|
+
* 同款实测教训;2026-11-20「管理用户」踩中第三次)。头的值 = 成员账号 domain_id。
|
|
187
|
+
*/
|
|
188
|
+
export declare function fetchAccountUsers(ctx: OrgContext, domainId: string): Promise<OrgOutcome<readonly AccountUserView[]>>;
|
|
189
|
+
/** 创建用户输入。 */
|
|
190
|
+
export interface CreateAccountUserInput {
|
|
191
|
+
readonly name: string;
|
|
192
|
+
readonly description?: string;
|
|
193
|
+
}
|
|
194
|
+
/** 创建用户成功回执。 */
|
|
195
|
+
export interface AccountUserCreated {
|
|
196
|
+
readonly user_id: string;
|
|
197
|
+
readonly user_name: string;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 生成合规初始密码(crypto 随机,不用 Math.random)。
|
|
201
|
+
*
|
|
202
|
+
* 口径:16 位,大写/小写/数字/特殊字符各≥1 —— 同时满足"至少两类字符"的
|
|
203
|
+
* 任意组合策略(ShowPasswordPolicyV5 的 password_char_combination=2 挡不住它),
|
|
204
|
+
* 且避开易混淆字符(O/0/I/1/l)与引号/反斜杠等复制易错字符。
|
|
205
|
+
* 密码只在创建回执出现一次:不写日志、不落盘、不进任何缓存。
|
|
206
|
+
*/
|
|
207
|
+
export declare function generateInitialPassword(length?: number): string;
|
|
208
|
+
/**
|
|
209
|
+
* 为新建用户创建登录信息(assume 组织委托 + V5 POST /v5/users/{id}/login-profile)。
|
|
210
|
+
*
|
|
211
|
+
* password_reset_required=true:用户首次登录被强制修改密码——比"提示尽快修改"
|
|
212
|
+
* 更强,不改就进不去。密码经请求体一次送达华为云,不在任何日志出现。
|
|
213
|
+
*/
|
|
214
|
+
export declare function createLoginProfile(ctx: OrgContext, domainId: string, userId: string, password: string): Promise<OrgOutcome<{
|
|
215
|
+
readonly password_reset_required: boolean;
|
|
216
|
+
}>>;
|
|
217
|
+
/**
|
|
218
|
+
* 在目标账号里创建一个 IAM 用户(assume 组织委托 + V5 POST /v5/users)。
|
|
219
|
+
*
|
|
220
|
+
* 创建不带密码/访问密钥(V5 允许裸创建):用户先立住,密码与 AK 由账号管理员
|
|
221
|
+
* 后续在 IAM 控制台配置——工作台不做凭据录入,与"登录交给会话页面"同一边界。
|
|
222
|
+
* POST 单次不重试(与创建账号/删除用户同款纪律);401/403 作废 STS 缓存。
|
|
223
|
+
*/
|
|
224
|
+
export declare function createAccountUser(ctx: OrgContext, domainId: string, input: CreateAccountUserInput): Promise<OrgOutcome<AccountUserCreated>>;
|
|
225
|
+
/**
|
|
226
|
+
* 开启 IAM 用户登录保护(assume 委托 + UpdateLoginProtect:
|
|
227
|
+
* PUT /v3.0/OS-USER/users/{id}/login-protect,verification_method=sms)。
|
|
228
|
+
* 手机验证保护要求用户已绑定手机号——调用方先 bindUserPhone 再开保护。
|
|
229
|
+
*/
|
|
230
|
+
export declare function enableSmsLoginProtect(ctx: OrgContext, domainId: string, userId: string): Promise<OrgOutcome<Record<string, never>>>;
|
|
231
|
+
/**
|
|
232
|
+
* 为用户绑定手机号(assume 委托 + UpdateUser 推荐:PUT /v3.0/OS-USER/users/{id})。
|
|
233
|
+
* 中国大陆国家码 0086 固定携带(华为云要求国家码与手机号同时存在)。
|
|
234
|
+
*/
|
|
235
|
+
export declare function bindUserPhone(ctx: OrgContext, domainId: string, userId: string, phone: string): Promise<OrgOutcome<Record<string, never>>>;
|
|
236
|
+
/**
|
|
237
|
+
* 在目标账号里按名找用户组(先精确匹配,再忽略大小写兜底)。
|
|
238
|
+
* 找不到返回 null(调用方按"组不存在"提示,不自动建组——建一个没有权限策略的
|
|
239
|
+
* admin 组没有意义,授权边界必须由人在 IAM 里定)。
|
|
240
|
+
*/
|
|
241
|
+
export declare function findAccountGroup(ctx: OrgContext, domainId: string, name: string): Promise<OrgOutcome<{
|
|
242
|
+
readonly group_id: string;
|
|
243
|
+
readonly group_name: string;
|
|
244
|
+
} | null>>;
|
|
245
|
+
/** 把用户加入用户组(V5 POST /v5/groups/{gid}/add-user;409=已在组,视为成功)。 */
|
|
246
|
+
export declare function addUserToGroup(ctx: OrgContext, domainId: string, groupId: string, userId: string): Promise<OrgOutcome<Record<string, never>>>;
|
|
247
|
+
/**
|
|
248
|
+
* 删除目标账号里的一个 IAM 用户(assume 组织委托 + V5 DELETE /v5/users/{user_id})。
|
|
249
|
+
*
|
|
250
|
+
* 前置校验(V5 ShowUser):用户不存在 → 人话报错;is_root_user → 拒绝(账号根
|
|
251
|
+
* 用户不可删)。删除走与查询同一对临时凭据 + X-Domain-Id;401/403 作废 STS 缓存
|
|
252
|
+
* (补权限后重试才会拿到新范围的凭据)。
|
|
253
|
+
*/
|
|
254
|
+
export declare function deleteAccountUser(ctx: OrgContext, domainId: string, userId: string): Promise<OrgOutcome<Record<string, never>>>;
|
|
255
|
+
/** 供测试/凭据变更手动失效 STS 缓存。 */
|
|
256
|
+
export declare function forgetAccountUsersCache(domainId?: string): void;
|
|
257
|
+
export {};
|
|
258
|
+
//# sourceMappingURL=orgs.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type WebServerLike } from '../http.ts';
|
|
2
|
+
/**
|
|
3
|
+
* 供测试/手动失效用——**组织写操作后必须调它**(创建账号受理/移动账号成功)。
|
|
4
|
+
*
|
|
5
|
+
* 2026-11-21 升级为内存 + 盘双清:盘 L2(24h)加入后,只清内存会在"写后 live
|
|
6
|
+
* 取数失败"的兜底路径上回放出**写操作之前**的旧结构(用户刚建的账号"消失")。
|
|
7
|
+
* org 写操作低频,全空间清空可接受;下次 live 取数会覆盖写回新数据。
|
|
8
|
+
*/
|
|
9
|
+
export declare function forgetOrgCache(): Promise<void>;
|
|
10
|
+
/** 路由需要的外围依赖。 */
|
|
11
|
+
export interface OrgRoutesDeps {
|
|
12
|
+
readonly webServer: WebServerLike;
|
|
13
|
+
readonly logger: {
|
|
14
|
+
info: (message: string) => void;
|
|
15
|
+
warn: (message: string) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* SSE 广播(2026-11-21):组织写操作成功后发事件——治理总览经
|
|
19
|
+
* subscribeOverviewRefresh 订阅同一总线,零前端改动即自动刷新组织槽。
|
|
20
|
+
* 可选:缺省只记日志(与 cost 域同款容错)。
|
|
21
|
+
*/
|
|
22
|
+
readonly broadcast?: (event: {
|
|
23
|
+
tool: string;
|
|
24
|
+
} & Record<string, unknown>) => void;
|
|
25
|
+
}
|
|
26
|
+
/** 注册组织架构路由,返回清理函数列表。 */
|
|
27
|
+
export declare function registerOrgRoutes(deps: OrgRoutesDeps): Array<() => void>;
|
|
28
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 组织架构页数据契约 — host 聚合与 client 渲染共用的纯类型(无运行时代码)。
|
|
3
|
+
*
|
|
4
|
+
* 数据链路(与费用页 cost/ 同一模式):
|
|
5
|
+
* 浏览器 → GET /api/wb/org-structure → workbench host 读 AI Shell 凭据库
|
|
6
|
+
* → 官方签名直连 organizations.myhuaweicloud.com(只读 GET) → 聚合 →
|
|
7
|
+
* Envelope(数据 + 元信息 + 能力状态)返回。
|
|
8
|
+
* 能力缺失不报 4xx:统一 200 + `unavailable`,页面能显示人话提示而不是红错。
|
|
9
|
+
*
|
|
10
|
+
* @module @huaweidevtools/landingzone-workbench/org-types
|
|
11
|
+
*/
|
|
12
|
+
/** 账号在组织中的治理角色。 */
|
|
13
|
+
export type OrgAccountRole = 'management' | 'core-governance' | 'audit-log' | 'delegated-admin';
|
|
14
|
+
/**
|
|
15
|
+
* 账号状态(2026-11-10 按实测拆分)。
|
|
16
|
+
*
|
|
17
|
+
* 华为云 ListAccounts 的原始状态:active / pending_closure / suspended / 其他。
|
|
18
|
+
* 之前把 pending_closure 并进 pending、suspended 并进 suspended,实测 45 账号里
|
|
19
|
+
* "关闭中 5 + 已关闭 12"会被读成"处理中 8 + 停用 17"——两种流程语义完全不同。
|
|
20
|
+
*/
|
|
21
|
+
export type OrgAccountStatus = 'active' | 'pending' | 'closing' | 'closed' | 'unknown';
|
|
22
|
+
/** 名册状态计表(聚合层输出,统计卡/总览锚点直接消费,不从列表反推)。 */
|
|
23
|
+
export interface OrgStructureCounts {
|
|
24
|
+
/** 生效账号数(含管理账号)。 */
|
|
25
|
+
readonly active_total: number;
|
|
26
|
+
/** 创建流程中的账号数(真正的 pending)。 */
|
|
27
|
+
readonly pending_creating: number;
|
|
28
|
+
/** 关闭流程中的账号数(pending_closure)。 */
|
|
29
|
+
readonly closing_total: number;
|
|
30
|
+
/** 已关闭账号数(suspended;名册仍可见可数,资源与费用仍留存)。 */
|
|
31
|
+
readonly closed_total: number;
|
|
32
|
+
}
|
|
33
|
+
/** 数据来源。当前只出 live;'planned' 为后续方案元数据补充预留。 */
|
|
34
|
+
export type OrgAccountSource = 'live' | 'planned';
|
|
35
|
+
/**
|
|
36
|
+
* 能力状态:一次取数为什么没拿到数据。
|
|
37
|
+
* 语义与费用页 CostCapability 一致 —— 是"这个能力现在不可用"的说明,
|
|
38
|
+
* 不是一次请求的异常(异常走 HTTP 层,由客户端抛错)。
|
|
39
|
+
*/
|
|
40
|
+
export interface OrgCapability {
|
|
41
|
+
readonly ok: false;
|
|
42
|
+
/** not_configured=未配凭据;auth=签名被拒;permission=IAM 权限不足;account_type=账号类型不够;transient=网络/服务端临时错误。 */
|
|
43
|
+
readonly reason: 'not_configured' | 'auth' | 'permission' | 'account_type' | 'transient';
|
|
44
|
+
/** permission 时列出缺少的 IAM 权限码(服务端报文里能抠出来就给)。 */
|
|
45
|
+
readonly needs?: readonly string[];
|
|
46
|
+
/** 可直接展示的人话说明。 */
|
|
47
|
+
readonly message: string;
|
|
48
|
+
}
|
|
49
|
+
/** 数据元信息:出处与截止时间。 */
|
|
50
|
+
export interface OrgMeta {
|
|
51
|
+
/** live=刚从华为云取的;cache=内存缓存(命中 TTL)。 */
|
|
52
|
+
readonly source: 'live' | 'cache';
|
|
53
|
+
/** 数据截止时间(ISO)。 */
|
|
54
|
+
readonly as_of: string;
|
|
55
|
+
}
|
|
56
|
+
/** 树上的账号叶子(挂在所属 OU/root 节点下)。 */
|
|
57
|
+
export interface OrgTreeAccountLeaf {
|
|
58
|
+
readonly id: string;
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly status: OrgAccountStatus;
|
|
61
|
+
}
|
|
62
|
+
/** 组织树节点(root=组织根;ou=组织单元)。 */
|
|
63
|
+
export interface OrgTreeNode {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly type: 'root' | 'ou';
|
|
66
|
+
readonly name: string;
|
|
67
|
+
/** 直接挂在该节点的成员账号数(不含子 OU 下的)。 */
|
|
68
|
+
readonly accountCount: number;
|
|
69
|
+
readonly accountIds: readonly string[];
|
|
70
|
+
/** 直接挂在该节点的账号叶子(渲染在子 OU 之后,连接线连到这里)。 */
|
|
71
|
+
readonly accounts?: readonly OrgTreeAccountLeaf[];
|
|
72
|
+
readonly children?: readonly OrgTreeNode[];
|
|
73
|
+
}
|
|
74
|
+
/** 核心账号视图(管理账号 + Core 治理 + 审计日志 + 委托管理员)。 */
|
|
75
|
+
export interface OrgAccountView {
|
|
76
|
+
readonly id: string;
|
|
77
|
+
readonly name: string;
|
|
78
|
+
readonly role: OrgAccountRole;
|
|
79
|
+
readonly status: OrgAccountStatus;
|
|
80
|
+
/** OU 面包屑(如 ['Core']),空数组 = 根下。 */
|
|
81
|
+
readonly ouPath: readonly string[];
|
|
82
|
+
readonly joinedAt?: string;
|
|
83
|
+
/** 是否担任某个可信服务的委托管理员。 */
|
|
84
|
+
readonly delegated?: boolean;
|
|
85
|
+
readonly source: OrgAccountSource;
|
|
86
|
+
}
|
|
87
|
+
/** 成员账号视图(成员账号列表行)。列表含管理账号以外的全部账号;治理类账号带 role 标签。 */
|
|
88
|
+
export interface MemberAccountView {
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly name: string;
|
|
91
|
+
/** 所属 OU 实体 id(用于树联动过滤;根下 = undefined)。 */
|
|
92
|
+
readonly ouId?: string;
|
|
93
|
+
/** OU 面包屑(如 ['Applications', 'App-Dev']),空数组 = Root。 */
|
|
94
|
+
readonly ouPath: readonly string[];
|
|
95
|
+
readonly joinedAt?: string;
|
|
96
|
+
/** 加入方式(invited / created)。 */
|
|
97
|
+
readonly joinMethod?: string;
|
|
98
|
+
/** 账号描述(创建时填的用途一句话;无则 undefined)。 */
|
|
99
|
+
readonly description?: string;
|
|
100
|
+
readonly status: OrgAccountStatus;
|
|
101
|
+
/** 治理角色(有值 = 该账号同时出现在核心账号卡片;undefined = 普通成员账号)。 */
|
|
102
|
+
readonly role?: OrgAccountRole;
|
|
103
|
+
readonly source: OrgAccountSource;
|
|
104
|
+
}
|
|
105
|
+
/** 组织结构聚合结果(Envelope 的 data 部分)。 */
|
|
106
|
+
export interface OrgStructurePayload {
|
|
107
|
+
readonly organization?: {
|
|
108
|
+
readonly id?: string;
|
|
109
|
+
readonly managementAccountId?: string;
|
|
110
|
+
};
|
|
111
|
+
readonly tree?: OrgTreeNode;
|
|
112
|
+
readonly coreAccounts: readonly OrgAccountView[];
|
|
113
|
+
readonly memberAccounts: readonly MemberAccountView[];
|
|
114
|
+
/** 名册状态计表(2026-11-10):账号数量口径的唯一权威来源。 */
|
|
115
|
+
readonly counts?: OrgStructureCounts;
|
|
116
|
+
readonly fetchedAt: string;
|
|
117
|
+
}
|
|
118
|
+
/** GET /api/wb/org-structure 的完整载荷(与费用页 Envelope 同形)。 */
|
|
119
|
+
export interface OrgEnvelope {
|
|
120
|
+
readonly data: OrgStructurePayload | null;
|
|
121
|
+
readonly meta?: OrgMeta;
|
|
122
|
+
readonly unavailable?: OrgCapability;
|
|
123
|
+
}
|
|
124
|
+
/** 一个"已不在组织"的账号(本地曾在册、当前名册没有)。 */
|
|
125
|
+
export interface ChurnDeletedAccount {
|
|
126
|
+
readonly account_id: string;
|
|
127
|
+
readonly account_name: string;
|
|
128
|
+
readonly ou_path: string;
|
|
129
|
+
/** 最后一次见到该账号的同步完成时间(ISO);run 时间无法回溯时为 null。 */
|
|
130
|
+
readonly last_seen_at: string | null;
|
|
131
|
+
}
|
|
132
|
+
/** GET /api/wb/org-account-churn 的 data 部分(账号在册对比)。 */
|
|
133
|
+
export interface AccountChurnView {
|
|
134
|
+
/** 名册抓取时间(ISO)。 */
|
|
135
|
+
readonly compared_at: string;
|
|
136
|
+
/** false = 没有本地基线(从未同步过),deleted_count 无意义。 */
|
|
137
|
+
readonly has_baseline: boolean;
|
|
138
|
+
/** 最近一次成功同步的完成时间(基线时间锚);从未成功同步则 null。 */
|
|
139
|
+
readonly last_sync_finished_at: string | null;
|
|
140
|
+
/** 当前名册账号总数(含停用)。 */
|
|
141
|
+
readonly roster_total: number;
|
|
142
|
+
/** 名册里 active 的账号数。 */
|
|
143
|
+
readonly active_total: number;
|
|
144
|
+
/** 名册里关闭流程中(pending_closure)的数量。 */
|
|
145
|
+
readonly closing_count: number;
|
|
146
|
+
/** 名册里已关闭(suspended)的数量;名册仍可见可数,不算"删除"。 */
|
|
147
|
+
readonly closed_roster_count: number;
|
|
148
|
+
readonly deleted: readonly ChurnDeletedAccount[];
|
|
149
|
+
readonly deleted_count: number;
|
|
150
|
+
}
|
|
151
|
+
/** GET /api/wb/org-account-churn 的完整载荷。 */
|
|
152
|
+
export interface ChurnEnvelope {
|
|
153
|
+
readonly data: AccountChurnView | null;
|
|
154
|
+
readonly unavailable?: OrgCapability;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=org-types.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** 一条采集行(RMS 命名空间;id 与 RMS resource_id 同键,managed 交集直接可用)。 */
|
|
2
|
+
export interface PerServiceRow {
|
|
3
|
+
readonly provider: string;
|
|
4
|
+
readonly type: string;
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly region_id: string;
|
|
8
|
+
/** 企业项目 id;'0' = 未归集(拍板④:服务不带该字段时置 0,不假装有口径)。 */
|
|
9
|
+
readonly ep_id: string;
|
|
10
|
+
/** ISO 时间;多数 list 接口不带,空串即可(表列已有缺省)。 */
|
|
11
|
+
readonly created: string;
|
|
12
|
+
}
|
|
13
|
+
/** 一处采集失败(类型 × 区域去重前)。 */
|
|
14
|
+
export interface CollectFailure {
|
|
15
|
+
readonly type: string;
|
|
16
|
+
readonly region: string;
|
|
17
|
+
readonly error: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 逐服务采集主入口。类型×区域逐个采集;单处失败不中断其余(进失败清单)。
|
|
21
|
+
*/
|
|
22
|
+
export declare function collectPerService(): Promise<{
|
|
23
|
+
readonly rows: readonly PerServiceRow[];
|
|
24
|
+
readonly failures: readonly CollectFailure[];
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* 从 IAM 403 原文提取权限码(如 vpc:vpcs:list);非权限类失败返回 undefined。
|
|
28
|
+
* 这是权限码的唯一提取点:classifyError 把它拼进展示文案,collect.ts 把它
|
|
29
|
+
* 去重后持久化到 stats per_service.perm_codes —— 客户端「复制权限策略模板」
|
|
30
|
+
* 消费该字段,不需要从展示文案里反向解析(文案措辞变更不再影响功能)。
|
|
31
|
+
*/
|
|
32
|
+
export declare function extractPermCode(error: string): string | undefined;
|
|
33
|
+
/** 失败清单去重聚合(同类型同原因合并,标注区域数——各区域同 403 不刷屏)。 */
|
|
34
|
+
export declare function summarizeFailures(failures: readonly CollectFailure[]): readonly {
|
|
35
|
+
readonly type: string;
|
|
36
|
+
readonly regions: number;
|
|
37
|
+
readonly error: string;
|
|
38
|
+
}[];
|
|
39
|
+
//# sourceMappingURL=per-service.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export interface BlueprintField {
|
|
2
|
+
readonly path: string;
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly type: 'enum' | 'string' | 'boolean' | 'number' | 'object-map' | 'array' | 'policy-refs';
|
|
5
|
+
readonly required: boolean;
|
|
6
|
+
readonly recommendBadge?: boolean;
|
|
7
|
+
readonly options?: ReadonlyArray<{
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
recommend?: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
readonly aliases?: readonly string[];
|
|
13
|
+
readonly monthlyCost?: boolean;
|
|
14
|
+
readonly decisionField?: boolean;
|
|
15
|
+
readonly specMapping?: string | readonly string[];
|
|
16
|
+
readonly editable?: boolean;
|
|
17
|
+
readonly note?: string;
|
|
18
|
+
readonly refSource?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface BlueprintSection {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly revealedBy: string;
|
|
24
|
+
readonly fields: ReadonlyArray<BlueprintField>;
|
|
25
|
+
}
|
|
26
|
+
export interface Blueprint {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly extends?: string;
|
|
29
|
+
readonly label: string;
|
|
30
|
+
readonly desc: string;
|
|
31
|
+
readonly suitableFor: readonly string[];
|
|
32
|
+
readonly hiddenModules: readonly string[];
|
|
33
|
+
readonly dependencies: ReadonlyArray<{
|
|
34
|
+
module: string;
|
|
35
|
+
requires: string;
|
|
36
|
+
action: 'autoSelect' | 'warn';
|
|
37
|
+
}>;
|
|
38
|
+
readonly sections: ReadonlyArray<BlueprintSection>;
|
|
39
|
+
/** 合并后的默认值(蓝图 defaults > _base defaults,字段路径级覆盖) */
|
|
40
|
+
readonly defaults: {
|
|
41
|
+
readonly prefill: {
|
|
42
|
+
readonly modules: {
|
|
43
|
+
readonly enhanced: readonly string[];
|
|
44
|
+
readonly extended: readonly string[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
readonly lockedFields: readonly string[];
|
|
48
|
+
readonly budgetCeiling: number | null;
|
|
49
|
+
readonly values: Record<string, unknown>;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** 加载全部蓝图(_base 除外均可选)。返回 Map<blueprintId, Blueprint>。 */
|
|
53
|
+
export declare function loadBlueprints(): Map<string, Blueprint>;
|
|
54
|
+
/** 取单个蓝图;未知 id 抛错(引擎层转 BLUEPRINT_UNKNOWN) */
|
|
55
|
+
export declare function getBlueprint(id: string): Blueprint;
|
|
56
|
+
export declare class SetupBlueprintUnknown extends Error {
|
|
57
|
+
readonly id: string;
|
|
58
|
+
constructor(id: string);
|
|
59
|
+
}
|
|
60
|
+
/** 卡片数据(GET /api/wb/setup/blueprints 用) */
|
|
61
|
+
export declare function blueprintCards(): Array<{
|
|
62
|
+
id: string;
|
|
63
|
+
label: string;
|
|
64
|
+
desc: string;
|
|
65
|
+
suitableFor: string[];
|
|
66
|
+
moduleCounts: {
|
|
67
|
+
base: number;
|
|
68
|
+
enhanced: number;
|
|
69
|
+
extended: number;
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
72
|
+
/** 节显隐判定(revealedBy 求值,引擎/面板共用) */
|
|
73
|
+
export declare function sectionRevealed(revealedBy: string, modules: {
|
|
74
|
+
enhanced: readonly string[];
|
|
75
|
+
extended: readonly string[];
|
|
76
|
+
}): boolean;
|
|
77
|
+
/** 字段是否被蓝图锁定(lockedFields:不出现在 formView) */
|
|
78
|
+
export declare function fieldLocked(bp: Blueprint, path: string): boolean;
|
|
79
|
+
/** 测试用:清缓存(知识热改后重载) */
|
|
80
|
+
export declare function clearBlueprintCache(): void;
|
|
81
|
+
//# sourceMappingURL=blueprint-loader.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M2 S2-1 云调用器 — WbCaller 三层通道(10 篇定稿:桥主 + STS 旁路 + 直签名降级)。
|
|
3
|
+
*
|
|
4
|
+
* 通道:
|
|
5
|
+
* ① 工具桥(主):ctx.tools.execute → aishell__openapi_request / aishell__apiexplorer
|
|
6
|
+
* (aishell-dsh-deploy 0.0.21+,随 base 聚合加载,原生注册 ctx.tools;
|
|
7
|
+
* 旧 mcp__huaweicloud-ops-deploy__* MCP 形态保留为候选回退)
|
|
8
|
+
* ② STS 旁路:成员账号资源经 AssumeClient(src/agency.ts,M4 N11 用)
|
|
9
|
+
* ③ 直签名 fallback:桥不可用时降级 cost/credentials.ts 官方签名(只读安全)
|
|
10
|
+
*
|
|
11
|
+
* 错误归一(09 G9 修复随行):两种华为云错误形状归一为 WbHttpError(kind 结构化);
|
|
12
|
+
* 凭据过期特征(401/ExpiredToken/SK signature)→ 统一 userHint 引导重新认证。
|
|
13
|
+
*
|
|
14
|
+
* @module @huaweidevtools/landingzone-workbench/setup/caller
|
|
15
|
+
*/
|
|
16
|
+
export type WbErrKind = 'permission' | 'conflict' | 'not-found' | 'business' | 'network';
|
|
17
|
+
export declare class WbHttpError extends Error {
|
|
18
|
+
readonly status: number;
|
|
19
|
+
readonly code: string;
|
|
20
|
+
readonly kind: WbErrKind;
|
|
21
|
+
readonly userHint?: string | undefined;
|
|
22
|
+
constructor(status: number, code: string, message: string, kind: WbErrKind, userHint?: string | undefined);
|
|
23
|
+
}
|
|
24
|
+
/** 华为云两种错误形状归一 → WbHttpError(旧插件实测坑:IAM 嵌套形曾被漏识别) */
|
|
25
|
+
export declare function toWbHttpError(status: number, body: unknown): WbHttpError | null;
|
|
26
|
+
interface RetryCfg {
|
|
27
|
+
retryablePatterns: string[];
|
|
28
|
+
maxRetries: number;
|
|
29
|
+
baseDelayMs: number;
|
|
30
|
+
maxDelayMs: number;
|
|
31
|
+
}
|
|
32
|
+
export interface WbCaller {
|
|
33
|
+
/** 发签名请求(桥/直签名)。4xx/5xx 一律抛 WbHttpError(双形状已归一)。 */
|
|
34
|
+
openapiRequest(method: 'GET' | 'POST' | 'PUT' | 'DELETE', url: string, body?: string): Promise<unknown>;
|
|
35
|
+
/** 服务 host:桥 apiexplorer 优先,降级 config hostFallbacks(${region} 占位)。查不到抛错不猜。 */
|
|
36
|
+
serviceHost(service: string, region: string): Promise<string>;
|
|
37
|
+
/** STS assume 成员账号(agency.ts 既有实现;缓存到期前 5min)。M4 N11 用。 */
|
|
38
|
+
assume(accountId: string): Promise<WbCaller>;
|
|
39
|
+
/** 通道自述(日志/验收用) */
|
|
40
|
+
readonly channel: 'tools-bridge' | 'direct-sign';
|
|
41
|
+
}
|
|
42
|
+
interface SettledResult {
|
|
43
|
+
isError?: boolean;
|
|
44
|
+
error?: {
|
|
45
|
+
message?: string;
|
|
46
|
+
info?: {
|
|
47
|
+
code?: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
value?: {
|
|
51
|
+
content?: Array<{
|
|
52
|
+
type?: string;
|
|
53
|
+
text?: string;
|
|
54
|
+
}>;
|
|
55
|
+
structuredContent?: unknown;
|
|
56
|
+
};
|
|
57
|
+
content?: Array<{
|
|
58
|
+
type?: string;
|
|
59
|
+
text?: string;
|
|
60
|
+
}>;
|
|
61
|
+
}
|
|
62
|
+
/** ctx.tools.execute 的最小面(与旧插件桥同源契约) */
|
|
63
|
+
export interface ToolsExecBridge {
|
|
64
|
+
execute(batch: {
|
|
65
|
+
calls: Array<{
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
arguments: string;
|
|
69
|
+
}>;
|
|
70
|
+
signal: AbortSignal;
|
|
71
|
+
}): Promise<{
|
|
72
|
+
results?: Array<{
|
|
73
|
+
result?: SettledResult;
|
|
74
|
+
}>;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
interface SignPair {
|
|
78
|
+
access: string;
|
|
79
|
+
secret: string;
|
|
80
|
+
token?: string;
|
|
81
|
+
}
|
|
82
|
+
type SignFn = (method: string, host: string, path: string, query: Record<string, string>, body: string, pair: SignPair) => Record<string, string>;
|
|
83
|
+
export declare function withRetry(inner: WbCaller, cfg: RetryCfg): WbCaller;
|
|
84
|
+
/**
|
|
85
|
+
* 创建 WbCaller:桥可用走桥;不可用降级直签名(成本页 credentials 既有签名对)。
|
|
86
|
+
* 返回 { caller, channel }——channel 供启动日志与验收。
|
|
87
|
+
*/
|
|
88
|
+
export declare function createWbCaller(opts: {
|
|
89
|
+
tools: ToolsExecBridge | null;
|
|
90
|
+
/** 直签名 fallback 材料(cost/credentials 模块运行时加载给);缺省=无降级 */
|
|
91
|
+
directSign?: () => {
|
|
92
|
+
pair: SignPair;
|
|
93
|
+
sign: SignFn;
|
|
94
|
+
} | null | undefined;
|
|
95
|
+
logger: {
|
|
96
|
+
info(m: string): void;
|
|
97
|
+
warn(m: string): void;
|
|
98
|
+
};
|
|
99
|
+
}): Promise<WbCaller>;
|
|
100
|
+
/** index.ts 创建成功后注入 */
|
|
101
|
+
export declare function setWbCaller(c: WbCaller): void;
|
|
102
|
+
/** N1/N7 节点惰性取——null=未就绪(探测降级本地占位) */
|
|
103
|
+
export declare function getWbCaller(): WbCaller | null;
|
|
104
|
+
export {};
|
|
105
|
+
//# sourceMappingURL=caller.d.ts.map
|