Files
SupplierSystem/docs/audit/scripts/20260915-tencent-cloud-inventory/tc-inventory.mjs
T
Ubuntu deb3e72750
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
chore: 以 AI 生鲜配送系统 当前版本作为 SupplierSystem 起点
来源仓库:jxc/ai-fresh-delivery
来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d
快照树:  09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件)

按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据
(生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、
deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值),
整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。
供应商系统后续开发自本提交开始。
2026-10-08 17:35:43 +08:00

81 lines
4.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 只读列举腾讯云资源(CAM 凭证来自 .env.tencent;不打印任何密钥)
import { loadTencentCredentials, tc3Request } from '/home/ubuntu/harness/ai-fresh-delivery/server/scripts/tencent-lib.mjs';
const cred = loadTencentCredentials();
const REGION = cred.env?.TENCENT_REGION || 'ap-nanjing';
const call = async (service, action, version, payload = {}, region = REGION) => {
try { const r = await tc3Request({ ...cred, service, region, action, version, payload }); return { ok: true, r }; }
catch (e) { return { ok: false, err: String(e.message || e).slice(0, 120) }; }
};
const line = (s) => console.log(s);
line(`凭证来源 .env.tencent ✓|默认地域 ${REGION}\n`);
// 1) CVM
const cvm = await call('cvm', 'DescribeInstances', '2017-03-12', { Limit: 100 });
if (cvm.ok) {
const list = cvm.r.Response?.InstanceSet || [];
line(`=== CVM 实例(${list.length})===`);
for (const i of list) {
const pub = (i.PublicIpAddresses || []).join(',') || '-';
const prv = (i.PrivateIpAddresses || []).join(',') || '-';
line(` ${String(i.InstanceId).padEnd(16)} ${String(i.InstanceName).padEnd(20)} ${String(i.InstanceState).padEnd(9)} 公网 ${pub.padEnd(16)} 内网 ${prv.padEnd(14)} ${i.InstanceType || ''} ${i.Placement?.Zone || ''}`);
}
} else line(`=== CVM 列举失败: ${cvm.err}`);
// 2) CLB
const clb = await call('clb', 'DescribeLoadBalancers', '2018-03-17', { Limit: 100 });
if (clb.ok) {
const list = clb.r.Response?.LoadBalancerSet || [];
line(`\n=== CLB(${list.length})===`);
for (const l of list) {
line(` ${String(l.LoadBalancerId).padEnd(18)} ${String(l.LoadBalancerName).padEnd(12)} ${String(l.LoadBalancerType).padEnd(6)} VIP ${String(l.LoadBalancerVips || []).padEnd(30)} 状态 ${l.Status}`);
const ls = await call('clb', 'DescribeListeners', '2018-03-17', { LoadBalancerId: l.LoadBalancerId, Limit: 50 });
for (const x of (ls.r?.Response?.Listeners || [])) line(` listener ${x.ListenerId} ${x.Protocol}:${x.Port}${x.Certificate?.SSLMode ? ' SSL=' + x.Certificate.SSLMode : ''} ${x.Certificate?.CertId || ''}`);
const tg = await call('clb', 'DescribeTargets', '2018-03-17', { LoadBalancerId: l.LoadBalancerId, Limit: 50 });
for (const g of (tg.r?.Response?.Listeners || [])) for (const t of (g.Targets || [])) line(` target ${g.ListenerId}/${g.Protocol}:${g.Port} → ${t.InstanceId || t.EniIp} :${t.Port} 权重 ${t.Weight}`);
}
} else line(`\n=== CLB 列举失败: ${clb.err}`);
// 3) EIP
const eip = await call('vpc', 'DescribeAddresses', '2017-03-12', { Limit: 100 });
if (eip.ok) {
const list = eip.r.Response?.AddressSet || [];
line(`\n=== EIP(${list.length})===`);
for (const a of list) line(` ${String(a.AddressId).padEnd(18)} ${String(a.AddressIp).padEnd(16)} ${a.AddressStatus} 绑定 ${a.InstanceId || '-'} ${a.AddressName || ''}`);
} else line(`\n=== EIP 列举失败: ${eip.err}`);
// 4) VPC / 子网 / 安全组
const vpc = await call('vpc', 'DescribeVpcs', '2017-03-12', { Limit: 20 });
if (vpc.ok) {
line(`\n=== VPC ===`);
for (const v of (vpc.r.Response?.VpcSet || [])) line(` ${String(v.VpcId).padEnd(14)} ${String(v.VpcName).padEnd(16)} ${String(v.CidrBlock).padEnd(18)} 子网 ${v.SubnetNum ?? ''}`);
}
const sg = await call('vpc', 'DescribeSecurityGroups', '2017-03-12', { Limit: 100 });
if (sg.ok) {
const list = sg.r.Response?.SecurityGroupSet || [];
line(`\n=== 安全组(${list.length})===`);
for (const g of list) line(` ${String(g.SecurityGroupId).padEnd(16)} ${String(g.SecurityGroupName).padEnd(22)} 规则(入/出) ${g.SecurityGroupPolicyStatistics?.Ingress ?? '?'}/${g.SecurityGroupPolicyStatistics?.Egress ?? '?'}`);
} else line(`\n=== 安全组列举失败: ${sg.err}`);
// 5) 云数据库 / Redis(判断是否有托管实例)
const pg = await call('postgres', 'DescribeDBInstances', '2017-03-12', { Limit: 20 });
line(`\n=== 托管 PostgreSQL: ${pg.ok ? (pg.r.Response?.DBInstanceSet || []).length + ' 个' : '不可用(' + pg.err + ')'}`);
const redis = await call('redis', 'DescribeInstances', '2018-04-12', { Limit: 20 });
line(`=== 托管 Redis: ${redis.ok ? (redis.r.Response?.InstanceSet || []).length + ' 个' : '不可用(' + redis.err + ')'}`);
// 6) SSL 证书
const ssl = await call('ssl', 'DescribeCertificates', '2019-12-05', { Limit: 50 });
if (ssl.ok) {
const list = ssl.r.Response?.Certificates || [];
line(`\n=== SSL 证书(${list.length})===`);
for (const c of list) line(` ${String(c.CertificateId).padEnd(20)} ${String(c.Domain || '').padEnd(34)} ${c.StatusName || c.Status} 到期 ${c.CertEndTime || ''}`);
} else line(`\n=== SSL 列举失败: ${ssl.err}`);
// 7) DNSPod
const dom = await call('dnspod', 'DescribeDomainList', '2021-03-23', { Limit: 20 }, '');
if (dom.ok) {
const list = dom.r.Response?.DomainList || [];
line(`\n=== DNSPod 域名(${list.length})===`);
for (const d of list) line(` ${String(d.Name).padEnd(28)} 状态 ${d.Status} 记录数 ${d.RecordCount} ${d.Remark || ''}`);
} else line(`\n=== DNSPod 列举失败: ${dom.err}`);