@cloudbase/manager-node 5.10.4 → 5.10.5
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/CHANGELOG.md +4 -0
- package/changelog_content_en.md +2 -2
- package/jest.config.js +3 -1
- package/lib/env/index.js +58 -0
- package/package.json +1 -1
- package/types/env/index.d.ts +18 -1
- package/types/env/type.d.ts +94 -0
package/CHANGELOG.md
CHANGED
package/changelog_content_en.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
## [5.10.
|
|
1
|
+
## [5.10.4] 2026-11-11
|
|
2
2
|
|
|
3
|
-
- [Added] [TODO: translate]
|
|
3
|
+
- [Added] [TODO: translate] permission: 补齐网关鉴权引擎查询与策略清空能力
|
package/jest.config.js
CHANGED
|
@@ -16,7 +16,9 @@ module.exports = {
|
|
|
16
16
|
// MySQL 集成测试依赖账号的 MySQL 开通白名单与 cynosdb 操作权限:
|
|
17
17
|
// 流水线账号调 createMySQL 返回「操作不支持,当前用户不在 MySQL 开通白名单内」,
|
|
18
18
|
// 属环境权限缺失而非代码缺陷,故整体跳过(本地需验证时用 --testPathIgnorePatterns 覆盖)
|
|
19
|
-
'test/mysql/.*\\.test\\.ts$'
|
|
19
|
+
'test/mysql/.*\\.test\\.ts$',
|
|
20
|
+
// 环境访问控制集成测试依赖企业版环境,流水线账号无企业版权限,默认跳过
|
|
21
|
+
'test/env/access-control\\.test\\.ts$'
|
|
20
22
|
],
|
|
21
23
|
// https://github.com/facebook/jest/issues/5164
|
|
22
24
|
globalSetup: './test/global-setup-hook.ts',
|
package/lib/env/index.js
CHANGED
|
@@ -919,6 +919,64 @@ class EnvService {
|
|
|
919
919
|
Domain
|
|
920
920
|
});
|
|
921
921
|
}
|
|
922
|
+
/**
|
|
923
|
+
* 查询环境访问控制配置(域名来源)
|
|
924
|
+
* 返回指定环境下默认域名在公网(PUBLIC)、VPC、办公网(WOA)三种来源的当前访问策略
|
|
925
|
+
* @param {DescribeEnvAccessControlParams} params 查询参数
|
|
926
|
+
* @returns {Promise<DescribeEnvAccessControlRes>} 当前生效的配置
|
|
927
|
+
*/
|
|
928
|
+
async describeEnvAccessControl(params = {}) {
|
|
929
|
+
const EnvId = params.EnvId || this.envId;
|
|
930
|
+
if (!EnvId) {
|
|
931
|
+
(0, error_1.throwInvalidParam)('EnvId is required');
|
|
932
|
+
}
|
|
933
|
+
return this.cloudService.request('DescribeEnvAccessControl', {
|
|
934
|
+
EnvId
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* 修改环境访问控制配置(域名来源)
|
|
939
|
+
* 影响指定环境下默认域名的访问来源策略,Action 为 OPEN 放通、CLOSE 拦截:
|
|
940
|
+
* - SourceType = PUBLIC 时,控制公网请求(拦截后公网访问默认域名返回 403)
|
|
941
|
+
* - SourceType = VPC 时,可选通过 VPCWhiteList 配置 VPC 白名单,不传表示不修改
|
|
942
|
+
* 各来源是否可改以服务端为准,WX(微信)与 WOA(办公网)为产品内部来源,后端暂未开放
|
|
943
|
+
* @param {ModifyEnvAccessControlParams} params 修改参数
|
|
944
|
+
* @returns {Promise<ModifyEnvAccessControlRes>} 影响行数与修改后生效的配置
|
|
945
|
+
*/
|
|
946
|
+
async modifyEnvAccessControl(params) {
|
|
947
|
+
const { EnvId = this.envId, Sources } = params;
|
|
948
|
+
if (!EnvId) {
|
|
949
|
+
(0, error_1.throwInvalidParam)('EnvId is required');
|
|
950
|
+
}
|
|
951
|
+
if (!Array.isArray(Sources) || Sources.length === 0) {
|
|
952
|
+
(0, error_1.throwInvalidParam)('Sources is required and must be a non-empty array');
|
|
953
|
+
}
|
|
954
|
+
// 校验 Sources 内部字段的合法性
|
|
955
|
+
const validActions = ['OPEN', 'CLOSE'];
|
|
956
|
+
const validWoAAuths = ['FORCE_AUTH', 'NO_AUTH'];
|
|
957
|
+
for (const source of Sources) {
|
|
958
|
+
if (!source) {
|
|
959
|
+
(0, error_1.throwInvalidParam)('Sources must not contain empty item');
|
|
960
|
+
}
|
|
961
|
+
if (source.Action !== undefined && !validActions.includes(source.Action)) {
|
|
962
|
+
(0, error_1.throwInvalidParam)(`Action must be one of ${validActions.join(' | ')}`);
|
|
963
|
+
}
|
|
964
|
+
if (source.WOAAuth !== undefined && !validWoAAuths.includes(source.WOAAuth)) {
|
|
965
|
+
(0, error_1.throwInvalidParam)(`WOAAuth must be one of ${validWoAAuths.join(' | ')}`);
|
|
966
|
+
}
|
|
967
|
+
// WOAAuth 仅 SourceType 为 WOA 且 Action 为 OPEN 时生效,强制鉴权时必须传 AuthToken
|
|
968
|
+
if (source.SourceType === 'WOA' &&
|
|
969
|
+
source.Action === 'OPEN' &&
|
|
970
|
+
source.WOAAuth === 'FORCE_AUTH' &&
|
|
971
|
+
!source.AuthToken) {
|
|
972
|
+
(0, error_1.throwInvalidParam)('AuthToken is required when WOAAuth is FORCE_AUTH');
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
return this.cloudService.request('ModifyEnvAccessControl', {
|
|
976
|
+
EnvId,
|
|
977
|
+
Sources
|
|
978
|
+
});
|
|
979
|
+
}
|
|
922
980
|
// 获取 COS CORS 域名
|
|
923
981
|
async getCOSDomains() {
|
|
924
982
|
const cos = this.getCos();
|
package/package.json
CHANGED
package/types/env/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Environment } from '../environment';
|
|
2
2
|
import { IResponseInfo, AuthDomain, EnvInfo, LoginConfigItem, ICheckTcbServiceRes, ICreatePostpayRes, EnvBillingInfoItem, PriceResult } from '../interfaces';
|
|
3
|
-
import { CalculatePackageCreatePriceParams, CalculatePackageRenewPriceParams, CalculatePackageModifyPriceParams, DescribeHttpServiceRouteParams, DescribeHttpServiceRouteRes, VerifyHttpServiceRouteParams, VerifyHttpServiceRouteRes, CreateHttpServiceRouteParams, CreateHttpServiceRouteRes, ModifyHttpServiceRouteParams, ModifyHttpServiceRouteRes, DeleteHttpServiceRouteParams, DeleteHttpServiceRouteRes, PurgeHttpServiceCacheParams, PurgeHttpServiceCacheRes, DescribeHttpServiceCachePurgeTaskParams, DescribeHttpServiceCachePurgeTaskRes, BindCustomDomainParams, BindCustomDomainRes, DeleteCustomDomainParams, DeleteCustomDomainRes, DescribeCertificatesParams, DescribeCertificatesRes } from './type';
|
|
3
|
+
import { CalculatePackageCreatePriceParams, CalculatePackageRenewPriceParams, CalculatePackageModifyPriceParams, DescribeHttpServiceRouteParams, DescribeHttpServiceRouteRes, VerifyHttpServiceRouteParams, VerifyHttpServiceRouteRes, CreateHttpServiceRouteParams, CreateHttpServiceRouteRes, ModifyHttpServiceRouteParams, ModifyHttpServiceRouteRes, DeleteHttpServiceRouteParams, DeleteHttpServiceRouteRes, PurgeHttpServiceCacheParams, PurgeHttpServiceCacheRes, DescribeHttpServiceCachePurgeTaskParams, DescribeHttpServiceCachePurgeTaskRes, BindCustomDomainParams, BindCustomDomainRes, DeleteCustomDomainParams, DeleteCustomDomainRes, DescribeCertificatesParams, DescribeCertificatesRes, ModifyEnvAccessControlParams, ModifyEnvAccessControlRes, DescribeEnvAccessControlParams, DescribeEnvAccessControlRes } from './type';
|
|
4
4
|
import { CreateBillingDealParams, CreateEnvParams, BaasPackageInfo, DescribeBaasPackageListParams, ModifyEnvPlanParams, RenewEnvParams, DestroyEnvParams, DescribeEnvsParams, DescribeEnvInfoParams, DescribeEnvInfoResponse, DescribeEnvAccountCircleParams, DescribeEnvAccountCircleRes, DescribeCreditsUsageDetailParams, DescribeCreditsUsageParams, DescribeCreditsUsageRes, EnvPkgCreditsUsage } from '../interfaces/tcb.interface';
|
|
5
5
|
type SOURCE = 'miniapp' | 'qcloud';
|
|
6
6
|
interface IDeleteDomainRes {
|
|
@@ -965,6 +965,23 @@ export declare class EnvService {
|
|
|
965
965
|
* @returns {Promise<DeleteCustomDomainRes>}
|
|
966
966
|
*/
|
|
967
967
|
deleteCustomDomain(params: DeleteCustomDomainParams): Promise<DeleteCustomDomainRes>;
|
|
968
|
+
/**
|
|
969
|
+
* 查询环境访问控制配置(域名来源)
|
|
970
|
+
* 返回指定环境下默认域名在公网(PUBLIC)、VPC、办公网(WOA)三种来源的当前访问策略
|
|
971
|
+
* @param {DescribeEnvAccessControlParams} params 查询参数
|
|
972
|
+
* @returns {Promise<DescribeEnvAccessControlRes>} 当前生效的配置
|
|
973
|
+
*/
|
|
974
|
+
describeEnvAccessControl(params?: DescribeEnvAccessControlParams): Promise<DescribeEnvAccessControlRes>;
|
|
975
|
+
/**
|
|
976
|
+
* 修改环境访问控制配置(域名来源)
|
|
977
|
+
* 影响指定环境下默认域名的访问来源策略,Action 为 OPEN 放通、CLOSE 拦截:
|
|
978
|
+
* - SourceType = PUBLIC 时,控制公网请求(拦截后公网访问默认域名返回 403)
|
|
979
|
+
* - SourceType = VPC 时,可选通过 VPCWhiteList 配置 VPC 白名单,不传表示不修改
|
|
980
|
+
* 各来源是否可改以服务端为准,WX(微信)与 WOA(办公网)为产品内部来源,后端暂未开放
|
|
981
|
+
* @param {ModifyEnvAccessControlParams} params 修改参数
|
|
982
|
+
* @returns {Promise<ModifyEnvAccessControlRes>} 影响行数与修改后生效的配置
|
|
983
|
+
*/
|
|
984
|
+
modifyEnvAccessControl(params: ModifyEnvAccessControlParams): Promise<ModifyEnvAccessControlRes>;
|
|
968
985
|
private getCOSDomains;
|
|
969
986
|
private modifyCosCorsDomain;
|
|
970
987
|
private getCos;
|
package/types/env/type.d.ts
CHANGED
|
@@ -565,3 +565,97 @@ export interface DeleteCustomDomainParams {
|
|
|
565
565
|
export interface DeleteCustomDomainRes {
|
|
566
566
|
RequestId: string;
|
|
567
567
|
}
|
|
568
|
+
/**
|
|
569
|
+
* 访问来源类型
|
|
570
|
+
* - PUBLIC: 公网链路访问配置
|
|
571
|
+
* - VPC: VPC 链路访问配置
|
|
572
|
+
* - WX: 微信侧来源访问配置(产品内部来源,当前未对外开放,仅查询会返回)
|
|
573
|
+
* - WOA: 办公网链路访问配置(产品内部来源,当前未对外开放,仅查询会返回)
|
|
574
|
+
*/
|
|
575
|
+
export type EnvAccessSourceType = 'PUBLIC' | 'VPC' | 'WX' | 'WOA';
|
|
576
|
+
/**
|
|
577
|
+
* 开关动作
|
|
578
|
+
* - OPEN: 放通
|
|
579
|
+
* - CLOSE: 拦截
|
|
580
|
+
*/
|
|
581
|
+
export type EnvAccessControlAction = 'OPEN' | 'CLOSE';
|
|
582
|
+
/**
|
|
583
|
+
* 办公网(WOA)鉴权模式
|
|
584
|
+
* - FORCE_AUTH: 强制鉴权
|
|
585
|
+
* - NO_AUTH: 不鉴权
|
|
586
|
+
*/
|
|
587
|
+
export type EnvAccessWoAAuth = 'FORCE_AUTH' | 'NO_AUTH';
|
|
588
|
+
/**
|
|
589
|
+
* VPC 信息(对应数据结构 VPCInfo)
|
|
590
|
+
*/
|
|
591
|
+
export interface EnvAccessVpcItem {
|
|
592
|
+
UniqVpcId: string;
|
|
593
|
+
Region: string;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* VPC 白名单配置(对应数据结构 VPCWhiteListConfig)
|
|
597
|
+
* - Action = OPEN:开启白名单,VPCs 必填,覆盖写入
|
|
598
|
+
* - Action = CLOSE:关闭白名单,VPCs 填入时覆盖写入
|
|
599
|
+
*/
|
|
600
|
+
export interface EnvAccessVpcWhiteList {
|
|
601
|
+
Action?: EnvAccessControlAction;
|
|
602
|
+
VPCs?: EnvAccessVpcItem[];
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* 访问来源配置
|
|
606
|
+
* SourceType 决定实际生效的字段:
|
|
607
|
+
* - PUBLIC: 由 Action 控制公网请求放通/拦截
|
|
608
|
+
* - VPC: 由 Action 控制 VPC 请求放通/拦截,VPCWhiteList 控制白名单(不传表示不修改)
|
|
609
|
+
* - WOA / WX: 产品内部来源,后端暂未开放修改
|
|
610
|
+
*/
|
|
611
|
+
export interface EnvAccessSourceSetting {
|
|
612
|
+
SourceType: EnvAccessSourceType;
|
|
613
|
+
Action?: EnvAccessControlAction;
|
|
614
|
+
WOAAuth?: EnvAccessWoAAuth;
|
|
615
|
+
AuthToken?: string;
|
|
616
|
+
VPCWhiteList?: EnvAccessVpcWhiteList;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* 当前生效的访问来源配置(DescribeEnvAccessControl / ModifyEnvAccessControl 的 Current)
|
|
620
|
+
* 未配置的枚举字段接口会返回空字符串,VPCWhiteList 也可能为 null,故此处按返回值放宽
|
|
621
|
+
*/
|
|
622
|
+
export type EnvAccessCurrentSetting = Array<{
|
|
623
|
+
SourceType: EnvAccessSourceType;
|
|
624
|
+
Action?: string;
|
|
625
|
+
WOAAuth?: string;
|
|
626
|
+
AuthToken?: string;
|
|
627
|
+
VPCWhiteList?: {
|
|
628
|
+
Action?: string;
|
|
629
|
+
VPCs?: EnvAccessVpcItem[] | null;
|
|
630
|
+
} | null;
|
|
631
|
+
}>;
|
|
632
|
+
/**
|
|
633
|
+
* DescribeEnvAccessControl 请求参数
|
|
634
|
+
* 查询环境的默认域名访问来源策略(公网、VPC、办公网)
|
|
635
|
+
*/
|
|
636
|
+
export interface DescribeEnvAccessControlParams {
|
|
637
|
+
EnvId?: string;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* DescribeEnvAccessControl 返回结果
|
|
641
|
+
*/
|
|
642
|
+
export interface DescribeEnvAccessControlRes {
|
|
643
|
+
Current: EnvAccessCurrentSetting;
|
|
644
|
+
RequestId: string;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* ModifyEnvAccessControl 请求参数
|
|
648
|
+
* 修改环境的默认域名访问来源策略(公网开关、VPC 白名单、办公网鉴权)
|
|
649
|
+
*/
|
|
650
|
+
export interface ModifyEnvAccessControlParams {
|
|
651
|
+
EnvId?: string;
|
|
652
|
+
Sources: EnvAccessSourceSetting[];
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* ModifyEnvAccessControl 返回结果
|
|
656
|
+
*/
|
|
657
|
+
export interface ModifyEnvAccessControlRes {
|
|
658
|
+
AffectedRows: number;
|
|
659
|
+
Current: EnvAccessCurrentSetting;
|
|
660
|
+
RequestId: string;
|
|
661
|
+
}
|