@cloudbase/manager-node 5.8.8-beta.0 → 5.8.9-beta.0
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/.coding-ci-publish-beta.yaml +316 -0
- package/CHANGELOG.md +14 -0
- package/lib/env/index.js +22 -1
- package/lib/environment.js +8 -0
- package/lib/error.js +2 -1
- package/lib/hosting/index.js +3 -2
- package/lib/index.js +7 -0
- package/lib/platform/index.js +177 -0
- package/lib/platform/type.js +2 -0
- package/lib/storage/index.js +24 -5
- package/lib/utils/storage-config.js +12 -6
- package/package.json +1 -1
- package/types/env/index.d.ts +16 -1
- package/types/env/type.d.ts +112 -4
- package/types/environment.d.ts +6 -0
- package/types/error.d.ts +2 -0
- package/types/index.d.ts +6 -0
- package/types/platform/index.d.ts +133 -0
- package/types/platform/type.d.ts +525 -0
- package/types/storage/index.d.ts +16 -0
- package/types/utils/storage-config.d.ts +7 -2
package/lib/storage/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.StorageService = exports.md5File = void 0;
|
|
14
|
+
exports.collectBatchDeleteFailures = collectBatchDeleteFailures;
|
|
14
15
|
const fs_1 = __importDefault(require("fs"));
|
|
15
16
|
const util_1 = __importDefault(require("util"));
|
|
16
17
|
const path_1 = __importDefault(require("path"));
|
|
@@ -34,6 +35,23 @@ const DEFAULT_MD5_PARALLEL = 20;
|
|
|
34
35
|
const CONSISTENT_DEPLOY_BACKUP_PREFIX = '.cloudbase-backup/';
|
|
35
36
|
var helper_2 = require("./helper");
|
|
36
37
|
Object.defineProperty(exports, "md5File", { enumerable: true, get: function () { return helper_2.md5File; } });
|
|
38
|
+
/**
|
|
39
|
+
* 整理 storage.batchDeleteFile 的逐文件删除结果,取出失败项并回填对应的 cloudPath
|
|
40
|
+
*
|
|
41
|
+
* 该接口逐文件返回 code,未失败的文件已经删除成功。把结果汇总成一条错误消息会丢掉逐项信息,
|
|
42
|
+
* 调用方无法区分「删掉了哪些」和「哪些本来就不存在」,因此保留结构化失败列表。
|
|
43
|
+
* 接口未保证 delete_list 与入参同序,这里按 fileID 反查。
|
|
44
|
+
*/
|
|
45
|
+
function collectBatchDeleteFailures(deleteList, fileIdList, cloudPathList) {
|
|
46
|
+
const cloudPathByFileId = new Map(fileIdList.map((fileId, index) => [fileId, cloudPathList[index]]));
|
|
47
|
+
return (deleteList || [])
|
|
48
|
+
.filter(item => item.code !== 'SUCCESS')
|
|
49
|
+
.map(item => ({
|
|
50
|
+
fileId: item.fileID,
|
|
51
|
+
cloudPath: cloudPathByFileId.get(item.fileID),
|
|
52
|
+
code: item.code
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
37
55
|
class StorageService {
|
|
38
56
|
constructor(environment) {
|
|
39
57
|
this.environment = environment;
|
|
@@ -1152,11 +1170,12 @@ class StorageService {
|
|
|
1152
1170
|
},
|
|
1153
1171
|
method: 'POST'
|
|
1154
1172
|
});
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
.map(item => `${item.
|
|
1158
|
-
|
|
1159
|
-
|
|
1173
|
+
const failed = collectBatchDeleteFailures(res.data.delete_list, fileIdList, cloudPathList);
|
|
1174
|
+
if (failed.length) {
|
|
1175
|
+
const failedList = failed.map(item => `${item.fileId} : ${item.code}`);
|
|
1176
|
+
throw new error_1.CloudBaseError(`部分删除文件失败:${JSON.stringify(failedList)}`, {
|
|
1177
|
+
meta: { failed, total: cloudPathList.length }
|
|
1178
|
+
});
|
|
1160
1179
|
}
|
|
1161
1180
|
}
|
|
1162
1181
|
/**
|
|
@@ -32,7 +32,7 @@ function toLogicalPath(basePath, key) {
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* 解析环境的有效云存储配置
|
|
35
|
-
* 共享桶环境(Storages[0].
|
|
35
|
+
* 共享桶环境(Storages[0].ExternalStorage.Enabled 为 true)下,BasePath 从 ExternalStorage 读取,桶名、地域在顶层为空时回退到 ExternalStorage;
|
|
36
36
|
* 普通环境保持读取 Storages[0].Bucket / Region,basePath 为空串
|
|
37
37
|
*/
|
|
38
38
|
function resolveStorageConfig(envConfig) {
|
|
@@ -54,18 +54,24 @@ function resolveStorageConfig(envConfig) {
|
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* 按共享桶规则解析有效桶,云存储(Storages)与静态托管(DescribeStaticStore)共用
|
|
57
|
-
*
|
|
57
|
+
*
|
|
58
|
+
* 是否共享桶只看 ExternalStorage.Enabled,不看顶层 Bucket 是否为空:
|
|
59
|
+
* 目前线上共享桶环境的顶层 Bucket 均返回空串,但接口定义并未保证这一点,
|
|
60
|
+
* 若后端回填桶名而 basePath 仍按「Bucket 为空」判定,文件会静默写到桶根目录,
|
|
61
|
+
* 造成同一共享桶内跨环境污染。因此 basePath 只由 Enabled + BasePath 决定,
|
|
62
|
+
* 桶名则优先用顶层 Bucket,为空时回退到 ExternalStorage.BucketName。
|
|
58
63
|
*/
|
|
59
64
|
function resolveBucketConfig(options) {
|
|
60
65
|
const { envId, bucket, region, externalStorage } = options;
|
|
61
|
-
if (
|
|
66
|
+
if ((externalStorage === null || externalStorage === void 0 ? void 0 : externalStorage.Enabled) === true) {
|
|
67
|
+
const effectiveBucket = bucket || externalStorage.BucketName;
|
|
62
68
|
// 线上存在已启用外部存储但未返回桶名的环境,继续执行会在 COS 调用时报 missing param Bucket
|
|
63
|
-
if (!
|
|
69
|
+
if (!effectiveBucket) {
|
|
64
70
|
throw new error_1.CloudBaseError(`环境 ${envId} 已启用外部存储(ExternalStorage),但未返回存储桶名称(BucketName),无法访问存储桶,请联系平台检查该环境的共享桶配置`);
|
|
65
71
|
}
|
|
66
72
|
return {
|
|
67
|
-
bucket:
|
|
68
|
-
region: externalStorage.Region,
|
|
73
|
+
bucket: effectiveBucket,
|
|
74
|
+
region: region || externalStorage.Region,
|
|
69
75
|
basePath: externalStorage.BasePath || ''
|
|
70
76
|
};
|
|
71
77
|
}
|
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, 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 } from './type';
|
|
4
4
|
import { CreateBillingDealParams, CreateEnvParams, BaasPackageInfo, DescribeBaasPackageListParams, ModifyEnvPlanParams, RenewEnvParams, DestroyEnvParams, DescribeEnvsParams, DescribeEnvInfoParams, DescribeEnvInfoResponse, DescribeEnvAccountCircleParams, DescribeEnvAccountCircleRes, DescribeCreditsUsageDetailParams, EnvPkgCreditsUsage } from '../interfaces/tcb.interface';
|
|
5
5
|
type SOURCE = 'miniapp' | 'qcloud';
|
|
6
6
|
interface IDeleteDomainRes {
|
|
@@ -928,6 +928,21 @@ export declare class EnvService {
|
|
|
928
928
|
* @returns {Promise<DeleteHttpServiceRouteRes>}
|
|
929
929
|
*/
|
|
930
930
|
deleteHttpServiceRoute(params: DeleteHttpServiceRouteParams): Promise<DeleteHttpServiceRouteRes>;
|
|
931
|
+
/**
|
|
932
|
+
* 清除HTTP访问服务域名缓存
|
|
933
|
+
* 支持 CDN 和 EO 两种缓存类型。CDN 仅支持 PURGE_URL 刷新方式;PURGE_PREFIX / PURGE_HOST 仅 EO 支持
|
|
934
|
+
* 清除缓存后会生成任务ID,可通过 DescribeHTTPServiceCachePurgeTask 查询任务进度和详细信息
|
|
935
|
+
* @param {PurgeHttpServiceCacheParams} params 清除缓存参数
|
|
936
|
+
* @returns {Promise<PurgeHttpServiceCacheRes>}
|
|
937
|
+
*/
|
|
938
|
+
purgeHttpServiceCache(params: PurgeHttpServiceCacheParams): Promise<PurgeHttpServiceCacheRes>;
|
|
939
|
+
/**
|
|
940
|
+
* 查询HTTP访问服务域名缓存清除任务详情
|
|
941
|
+
* 通过 purgeHttpServiceCache 清除域名缓存后,可传入任务ID查询清除任务状态、时间、缓存类型等信息;也可不传任务ID查询历史任务记录
|
|
942
|
+
* @param {DescribeHttpServiceCachePurgeTaskParams} params 查询参数
|
|
943
|
+
* @returns {Promise<DescribeHttpServiceCachePurgeTaskRes>}
|
|
944
|
+
*/
|
|
945
|
+
describeHttpServiceCachePurgeTask(params: DescribeHttpServiceCachePurgeTaskParams): Promise<DescribeHttpServiceCachePurgeTaskRes>;
|
|
931
946
|
/**
|
|
932
947
|
* 绑定自定义域名到HTTP访问服务
|
|
933
948
|
* 底层调用 CreateHTTPServiceRoute API,专用于域名绑定场景
|
package/types/env/type.d.ts
CHANGED
|
@@ -215,11 +215,62 @@ export interface HTTPServiceHeadersHandler {
|
|
|
215
215
|
ResponseHeadersToAdd?: HTTPServiceHeaderToAdd[];
|
|
216
216
|
ResponseHeadersToRemove?: string[];
|
|
217
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* HTTPService 缓存配置(域名维度)
|
|
220
|
+
*/
|
|
221
|
+
export interface HTTPServiceCacheSet {
|
|
222
|
+
Rules?: HTTPServiceCacheRule[];
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* HTTPService 缓存规则条目
|
|
226
|
+
*/
|
|
227
|
+
export interface HTTPServiceCacheRule {
|
|
228
|
+
Description?: string;
|
|
229
|
+
Enable?: boolean;
|
|
230
|
+
Condition: HTTPServiceRuleCondition;
|
|
231
|
+
Actions: HTTPServiceCacheAction[];
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* HTTPService 缓存规则匹配条件
|
|
235
|
+
*/
|
|
236
|
+
export interface HTTPServiceRuleCondition {
|
|
237
|
+
Target?: 'url_path' | 'file_extension' | 'full_uri';
|
|
238
|
+
MatchType?: 'prefix' | 'suffix' | 'contains' | 'exact';
|
|
239
|
+
Values?: string[];
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* HTTPService 缓存动作(Type 与被设置的子字段必须一一对应)
|
|
243
|
+
*/
|
|
244
|
+
export interface HTTPServiceCacheAction {
|
|
245
|
+
Type?: 'Cache' | 'CacheKey';
|
|
246
|
+
Cache?: HTTPServiceCacheParams;
|
|
247
|
+
CacheKey?: HTTPServiceCacheKeyParams;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* HTTPService 缓存参数(节点缓存 + 浏览器缓存)
|
|
251
|
+
* FollowOrigin / NoCache / (CacheTime||MaxAgeTime) 三者互斥,必须开启其一
|
|
252
|
+
*/
|
|
253
|
+
export interface HTTPServiceCacheParams {
|
|
254
|
+
FollowOrigin?: boolean;
|
|
255
|
+
NoCache?: boolean;
|
|
256
|
+
CacheTime?: number;
|
|
257
|
+
MaxAgeTime?: number;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* 自定义缓存键参数。约束:FullURLCache=on 与 QueryStringSwitch=on 互斥
|
|
261
|
+
*/
|
|
262
|
+
export interface HTTPServiceCacheKeyParams {
|
|
263
|
+
FullURLCache?: 'on' | 'off';
|
|
264
|
+
QueryStringSwitch?: 'on' | 'off';
|
|
265
|
+
QueryStringAction?: 'includeCustom' | 'excludeCustom';
|
|
266
|
+
QueryStringValues?: string[];
|
|
267
|
+
}
|
|
218
268
|
/**
|
|
219
269
|
* HTTP访问服务路由扩展字段
|
|
220
270
|
*/
|
|
221
271
|
export interface HTTPServiceExtension {
|
|
222
272
|
HeadersHandler?: HTTPServiceHeadersHandler;
|
|
273
|
+
Cache?: HTTPServiceCacheSet;
|
|
223
274
|
[key: string]: unknown;
|
|
224
275
|
}
|
|
225
276
|
/**
|
|
@@ -245,14 +296,15 @@ export interface HTTPServiceRoute {
|
|
|
245
296
|
export interface HTTPServiceDomain {
|
|
246
297
|
Domain: string;
|
|
247
298
|
DomainType: 'HTTPSERVICE' | 'CBR' | 'ANYSERVICE' | 'AI_AGENT' | 'VM' | 'INTEGRATION_CALLBACK';
|
|
248
|
-
AccessType: 'DIRECT' | 'CDN' | 'CUSTOM' | 'EO';
|
|
299
|
+
AccessType: 'DIRECT' | 'CDN' | 'CUSTOM' | 'EO' | 'NONE';
|
|
249
300
|
CertId: string;
|
|
250
301
|
Protocol: 'HTTP_AND_HTTPS' | 'HTTP_TO_HTTPS' | 'HTTPS_TO_HTTP';
|
|
251
302
|
Cname: string;
|
|
252
303
|
IsDefault: boolean;
|
|
253
304
|
Enable: boolean;
|
|
254
|
-
Status: 'PROCESSING' | 'FAIL' | 'SUCCESS';
|
|
255
|
-
DNSStatus: 'OK' | 'INVALID';
|
|
305
|
+
Status: 'PROCESSING' | 'FAIL' | 'EO_PENDING_VERIFICATION' | 'SUCCESS';
|
|
306
|
+
DNSStatus: 'OK' | 'EMPTY' | 'INVALID';
|
|
307
|
+
PlatformCnameDNSStatus?: 'OK' | 'EMPTY' | 'INVALID';
|
|
256
308
|
Routes?: HTTPServiceRoute[];
|
|
257
309
|
Extension?: HTTPServiceExtension;
|
|
258
310
|
CreateTime: string;
|
|
@@ -303,7 +355,7 @@ export interface HTTPServiceRouteParam {
|
|
|
303
355
|
*/
|
|
304
356
|
export interface HTTPServiceDomainParam {
|
|
305
357
|
Domain: string;
|
|
306
|
-
AccessType?: 'DIRECT' | 'CDN' | 'CUSTOM' | 'EO';
|
|
358
|
+
AccessType?: 'DIRECT' | 'CDN' | 'CUSTOM' | 'EO' | 'NONE';
|
|
307
359
|
CertId?: string;
|
|
308
360
|
Protocol?: 'HTTP' | 'HTTPS' | 'HTTP_AND_HTTPS' | 'HTTP_TO_HTTPS' | 'HTTPS_TO_HTTP';
|
|
309
361
|
CustomCname?: string;
|
|
@@ -414,6 +466,62 @@ export interface DeleteHttpServiceRouteParams {
|
|
|
414
466
|
export interface DeleteHttpServiceRouteRes {
|
|
415
467
|
RequestId: string;
|
|
416
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* PurgeHTTPServiceCache 请求参数
|
|
471
|
+
* 用于清除HTTP访问服务域名缓存,支持 CDN 和 EO 两种缓存类型
|
|
472
|
+
*/
|
|
473
|
+
export interface PurgeHttpServiceCacheParams {
|
|
474
|
+
EnvId: string;
|
|
475
|
+
Domain: string;
|
|
476
|
+
CacheType: 'CDN' | 'EO';
|
|
477
|
+
PurgeType: 'PURGE_URL' | 'PURGE_PREFIX' | 'PURGE_HOST';
|
|
478
|
+
Targets: string[];
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* PurgeHTTPServiceCache 返回结果
|
|
482
|
+
*/
|
|
483
|
+
export interface PurgeHttpServiceCacheRes {
|
|
484
|
+
CacheType: 'CDN' | 'EO';
|
|
485
|
+
TaskId: string;
|
|
486
|
+
RequestId: string;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* 缓存清除任务详情
|
|
490
|
+
*/
|
|
491
|
+
export interface HTTPServiceCachePurgeTask {
|
|
492
|
+
TaskId: string;
|
|
493
|
+
CacheType: 'CDN' | 'EO';
|
|
494
|
+
Status: 'PROCESSING' | 'SUCCESS' | 'FAILED' | 'TIMEOUT' | 'CANCELED';
|
|
495
|
+
PurgeType: 'PURGE_URL' | 'PURGE_PREFIX' | 'PURGE_HOST';
|
|
496
|
+
Method: 'INVALIDATE' | 'DELETE';
|
|
497
|
+
Targets: string[];
|
|
498
|
+
FailReason?: string;
|
|
499
|
+
CreateTime: string;
|
|
500
|
+
UpdateTime: string;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* DescribeHTTPServiceCachePurgeTask 请求参数
|
|
504
|
+
* 用于查询HTTPService域名缓存清除任务详情
|
|
505
|
+
*/
|
|
506
|
+
export interface DescribeHttpServiceCachePurgeTaskParams {
|
|
507
|
+
EnvId: string;
|
|
508
|
+
Domain: string;
|
|
509
|
+
CacheType: 'CDN' | 'EO';
|
|
510
|
+
TaskId?: string;
|
|
511
|
+
PurgeType?: 'PURGE_URL' | 'PURGE_PREFIX' | 'PURGE_HOST';
|
|
512
|
+
StartTime?: string;
|
|
513
|
+
EndTime?: string;
|
|
514
|
+
Offset?: number;
|
|
515
|
+
Limit?: number;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* DescribeHTTPServiceCachePurgeTask 返回结果
|
|
519
|
+
*/
|
|
520
|
+
export interface DescribeHttpServiceCachePurgeTaskRes {
|
|
521
|
+
Tasks: HTTPServiceCachePurgeTask[];
|
|
522
|
+
TotalCount: number;
|
|
523
|
+
RequestId: string;
|
|
524
|
+
}
|
|
417
525
|
/**
|
|
418
526
|
* 绑定自定义域名的域名参数
|
|
419
527
|
* 与 HTTPServiceDomainParam 类似,但不包含 Routes(绑定域名场景)
|
package/types/environment.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { SandboxService } from './sandbox';
|
|
|
21
21
|
import { AiModelService } from './aiModel';
|
|
22
22
|
import { MonitorService } from './monitor';
|
|
23
23
|
import { IntegrationService } from './integration';
|
|
24
|
+
import { PlatformService } from './platform';
|
|
24
25
|
export declare class Environment {
|
|
25
26
|
inited: boolean;
|
|
26
27
|
cloudBaseContext: CloudBaseContext;
|
|
@@ -47,6 +48,7 @@ export declare class Environment {
|
|
|
47
48
|
private aiModelService;
|
|
48
49
|
private monitorService;
|
|
49
50
|
private integrationService;
|
|
51
|
+
private platformService;
|
|
50
52
|
constructor(context: CloudBaseContext, envId: string);
|
|
51
53
|
lazyInit(): Promise<any>;
|
|
52
54
|
getEnvId(): string;
|
|
@@ -75,6 +77,10 @@ export declare class Environment {
|
|
|
75
77
|
getAiModelService(): AiModelService;
|
|
76
78
|
getMonitorService(): MonitorService;
|
|
77
79
|
getIntegrationService(): IntegrationService;
|
|
80
|
+
/**
|
|
81
|
+
* 获取平台版套餐服务
|
|
82
|
+
*/
|
|
83
|
+
getPlatformService(): PlatformService;
|
|
78
84
|
getCommonService(serviceType: string, serviceVersion: any): CommonService;
|
|
79
85
|
getServicesEnvInfo(): Promise<any>;
|
|
80
86
|
getAuthConfig(): {
|
package/types/error.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ interface Options {
|
|
|
4
4
|
code?: string | number;
|
|
5
5
|
requestId?: string;
|
|
6
6
|
action?: string;
|
|
7
|
+
meta?: Record<string, any>;
|
|
7
8
|
}
|
|
8
9
|
export declare class CloudBaseError extends Error {
|
|
9
10
|
readonly exit: number;
|
|
@@ -13,6 +14,7 @@ export declare class CloudBaseError extends Error {
|
|
|
13
14
|
readonly code: string | number;
|
|
14
15
|
readonly requestId: string;
|
|
15
16
|
readonly action: string;
|
|
17
|
+
readonly meta: Record<string, any> | undefined;
|
|
16
18
|
constructor(message: string, options?: Options);
|
|
17
19
|
}
|
|
18
20
|
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { CloudAppService } from './cloudApp';
|
|
|
23
23
|
import { AiModelService } from './aiModel';
|
|
24
24
|
import { IntegrationService } from './integration';
|
|
25
25
|
import { MonitorService } from './monitor';
|
|
26
|
+
import { PlatformService } from './platform';
|
|
26
27
|
import { ProjectValidator } from './projectValidator';
|
|
27
28
|
import { DeployOrchestrator } from './deploy/DeployOrchestrator';
|
|
28
29
|
import { resolveBuildCommand as frameworkResolveBuildCommand, resolveHostingOutputDir as frameworkResolveHostingOutputDir, buildHostingItem as frameworkBuildHostingItem } from './deploy/framework';
|
|
@@ -113,6 +114,11 @@ declare class CloudBase {
|
|
|
113
114
|
* 提供指标查询能力
|
|
114
115
|
*/
|
|
115
116
|
get monitor(): MonitorService;
|
|
117
|
+
/**
|
|
118
|
+
* 平台版套餐服务
|
|
119
|
+
* 提供平台版套餐查询、环境管理、资源用量及 HTTP 访问服务路由等能力
|
|
120
|
+
*/
|
|
121
|
+
get platform(): PlatformService;
|
|
116
122
|
get docs(): DocsService;
|
|
117
123
|
get projectValidator(): ProjectValidator;
|
|
118
124
|
getProjectValidator(): ProjectValidator;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Environment } from '../environment';
|
|
2
|
+
import { CreatePlatformEnvParams, CreatePlatformEnvRes, CreatePlatformHTTPServiceRouteParams, CreatePlatformHTTPServiceRouteRes, DescribePlatformAccountCircleParams, DescribePlatformAccountCircleRes, DescribePlatformCreditsUsageDetailParams, DescribePlatformCreditsUsageDetailRes, DescribePlatformCreditsUsageParams, DescribePlatformCreditsUsageRes, DescribePlatformEnvCreditsRankingParams, DescribePlatformEnvCreditsRankingRes, DescribePlatformEnvUsageParams, DescribePlatformEnvUsageRes, DescribePlatformHTTPServiceRouteParams, DescribePlatformHTTPServiceRouteRes, DescribePlatformPackageListParams, DescribePlatformPackageListRes, DescribePlatformsParams, DescribePlatformsRes, DeletePlatformHTTPServiceRouteParams, DeletePlatformHTTPServiceRouteRes, DestroyPlatformEnvParams, DestroyPlatformEnvRes, ModifyPlatformEnvParams, ModifyPlatformEnvRes, ModifyPlatformHTTPServiceRouteParams, ModifyPlatformHTTPServiceRouteRes, VerifyPlatformHTTPServiceRouteParams, VerifyPlatformHTTPServiceRouteRes } from './type';
|
|
3
|
+
/**
|
|
4
|
+
* 平台版服务
|
|
5
|
+
* 提供平台版套餐查询、资源用量统计、环境生命周期管理及 HTTP 访问服务路由管理能力
|
|
6
|
+
*/
|
|
7
|
+
export declare class PlatformService {
|
|
8
|
+
private environment;
|
|
9
|
+
private envId;
|
|
10
|
+
private cloudService;
|
|
11
|
+
constructor(environment: Environment);
|
|
12
|
+
/**
|
|
13
|
+
* 查询在售的平台版套餐列表
|
|
14
|
+
* 返回当前可购买的平台版套餐,包括计费下单配置(BillTags)、套餐规格(Spec)等商品信息,
|
|
15
|
+
* 用于购买前的套餐查询,不涉及用户已购资源。
|
|
16
|
+
* @param {DescribePlatformPackageListParams} params 查询参数,可通过 PackageId 查询指定套餐
|
|
17
|
+
* @returns {Promise<DescribePlatformPackageListRes>} 在售套餐列表
|
|
18
|
+
*/
|
|
19
|
+
describePlatformPackageList(params?: DescribePlatformPackageListParams): Promise<DescribePlatformPackageListRes>;
|
|
20
|
+
/**
|
|
21
|
+
* 查询当前账号下的平台版资源实例列表
|
|
22
|
+
* 返回已购平台版资源的计费信息(购买与过期时间、计费状态、自动续费),
|
|
23
|
+
* 以及存储、日志、静态托管等底层资源明细。
|
|
24
|
+
* @param {DescribePlatformsParams} params 查询参数,PlatformIds 指定实例(缺省分页返回全部),Limit 取值 [10, 100]
|
|
25
|
+
* @returns {Promise<DescribePlatformsRes>} 平台版资源列表及总数
|
|
26
|
+
* @throws {CloudBaseError} Limit 非法时抛出,须为 10 至 100 的整数
|
|
27
|
+
*/
|
|
28
|
+
describePlatforms(params?: DescribePlatformsParams): Promise<DescribePlatformsRes>;
|
|
29
|
+
/**
|
|
30
|
+
* 查询平台版资源当前所处的计费周期
|
|
31
|
+
* 平台版资源点按月结算,计费周期自购买日起算,每个周期各享有一笔抵扣额度。
|
|
32
|
+
* 例如 2026-01-05 购买 3 个月(2026-04-05 到期),则三个周期分别为
|
|
33
|
+
* 01-05 ~ 02-05、02-06 ~ 03-05、03-06 ~ 04-05。
|
|
34
|
+
* @param {DescribePlatformAccountCircleParams} params 查询参数,WithHistoryCircle 为 true 时附带返回最近两个历史周期
|
|
35
|
+
* @returns {Promise<DescribePlatformAccountCircleRes>} 当前周期起止时间及是否过期
|
|
36
|
+
*/
|
|
37
|
+
describePlatformAccountCircle(params: DescribePlatformAccountCircleParams): Promise<DescribePlatformAccountCircleRes>;
|
|
38
|
+
/**
|
|
39
|
+
* 查询平台版资源的资源点用量汇总
|
|
40
|
+
* 返回指定时间范围内的资源点用量统计,包括套餐内抵扣、资源包抵扣、
|
|
41
|
+
* 按量上报、原价消耗四类总量的每日明细。
|
|
42
|
+
* @param {DescribePlatformCreditsUsageParams} params 查询参数,StartDate/EndDate 格式为 'YYYY-MM-DD'
|
|
43
|
+
* @returns {Promise<DescribePlatformCreditsUsageRes>} 四类用量总量及每日明细
|
|
44
|
+
*/
|
|
45
|
+
describePlatformCreditsUsage(params: DescribePlatformCreditsUsageParams): Promise<DescribePlatformCreditsUsageRes>;
|
|
46
|
+
/**
|
|
47
|
+
* 查询平台版资源的资源点用量明细
|
|
48
|
+
* 按模块(Usages)→ 指标(MetricUsageDetail)→ 每日明细(ValueDetailList)三个层级,
|
|
49
|
+
* 返回各模块的资源点用量及原始用量明细。
|
|
50
|
+
* @param {DescribePlatformCreditsUsageDetailParams} params 查询参数,Modules 指定查询的模块(如 FLEXDB、SCF、AI、COS 等)
|
|
51
|
+
* @returns {Promise<DescribePlatformCreditsUsageDetailRes>} 各模块的用量明细数据
|
|
52
|
+
*/
|
|
53
|
+
describePlatformCreditsUsageDetail(params: DescribePlatformCreditsUsageDetailParams): Promise<DescribePlatformCreditsUsageDetailRes>;
|
|
54
|
+
/**
|
|
55
|
+
* 查询平台版下各环境的资源点用量排行
|
|
56
|
+
* 按 TimeRange 指定的时间范围返回各环境的资源点用量排序,
|
|
57
|
+
* 排行数据由后台定时计算,可能存在小时级延迟。
|
|
58
|
+
* @param {DescribePlatformEnvCreditsRankingParams} params 查询参数,TimeRange 缺省为 Today(近 1 天)
|
|
59
|
+
* @returns {Promise<DescribePlatformEnvCreditsRankingRes>} 环境用量排行列表及分页信息
|
|
60
|
+
*/
|
|
61
|
+
describePlatformEnvCreditsRanking(params?: DescribePlatformEnvCreditsRankingParams): Promise<DescribePlatformEnvCreditsRankingRes>;
|
|
62
|
+
/**
|
|
63
|
+
* 查询平台版环境内各资源类型的用量
|
|
64
|
+
* 按资源类型(存储、函数、数据库等)返回各指标的用量及按日明细,
|
|
65
|
+
* 包括资源点用量与原始用量值及对应单位。
|
|
66
|
+
* @param {DescribePlatformEnvUsageParams} params 查询参数,EnvId 缺省时使用当前环境,ResourceTypes 指定资源类型
|
|
67
|
+
* @returns {Promise<DescribePlatformEnvUsageRes>} 资源用量明细及资源点总量
|
|
68
|
+
*/
|
|
69
|
+
describePlatformEnvUsage(params: DescribePlatformEnvUsageParams): Promise<DescribePlatformEnvUsageRes>;
|
|
70
|
+
/**
|
|
71
|
+
* 创建平台版环境
|
|
72
|
+
* 在已购平台版资源下开通新环境。
|
|
73
|
+
* @param {CreatePlatformEnvParams} params 创建参数,ReqKey 为幂等键,可用于防止重复创建
|
|
74
|
+
* @returns {Promise<CreatePlatformEnvRes>} 新创建环境的 EnvId
|
|
75
|
+
*/
|
|
76
|
+
createPlatformEnv(params: CreatePlatformEnvParams): Promise<CreatePlatformEnvRes>;
|
|
77
|
+
/**
|
|
78
|
+
* 修改平台版环境状态
|
|
79
|
+
* 支持启用/禁用环境,以及云存储(Storage)、FlexDB 资源的状态变更,未传入的资源不做更新。
|
|
80
|
+
* @param {ModifyPlatformEnvParams} params 修改参数,EnvId 缺省时使用当前环境
|
|
81
|
+
* @returns {Promise<ModifyPlatformEnvRes>} 环境的最终状态
|
|
82
|
+
* @throws {CloudBaseError} Status 非法时抛出,仅支持 ENABLE / DISABLE
|
|
83
|
+
*/
|
|
84
|
+
modifyPlatformEnv(params: ModifyPlatformEnvParams): Promise<ModifyPlatformEnvRes>;
|
|
85
|
+
/**
|
|
86
|
+
* 删除平台版环境
|
|
87
|
+
* 删除操作不可逆,须显式指定目标环境 ID。
|
|
88
|
+
* @param {DestroyPlatformEnvParams} params 删除参数,EnvId 为必填
|
|
89
|
+
* @returns {Promise<DestroyPlatformEnvRes>} 请求执行结果
|
|
90
|
+
*/
|
|
91
|
+
destroyPlatformEnv(params: DestroyPlatformEnvParams): Promise<DestroyPlatformEnvRes>;
|
|
92
|
+
/**
|
|
93
|
+
* 校验 HTTP 访问服务路由配置(预检)
|
|
94
|
+
* 创建路由前的只读预检,覆盖域名归属权、证书、配额、路由冲突、域名占用等检查项,
|
|
95
|
+
* 不创建任何资源。Passed 为 true 时可调用 createPlatformHttpServiceRoute 正式创建;
|
|
96
|
+
* 为 false 时根据各检查项的 Code 定位并修正问题。
|
|
97
|
+
* 预检通过不代表创建必然成功,但预检不通过则创建必然失败。
|
|
98
|
+
* @param {VerifyPlatformHTTPServiceRouteParams} params 校验参数,包含待校验的域名路由信息
|
|
99
|
+
* @returns {Promise<VerifyPlatformHTTPServiceRouteRes>} 整体校验结果及各检查项明细
|
|
100
|
+
*/
|
|
101
|
+
verifyPlatformHttpServiceRoute(params: VerifyPlatformHTTPServiceRouteParams): Promise<VerifyPlatformHTTPServiceRouteRes>;
|
|
102
|
+
/**
|
|
103
|
+
* 创建 HTTP 访问服务路由
|
|
104
|
+
* 不传 Domain.Routes 时仅创建域名信息。域名与路由均为异步下发,创建后需调用
|
|
105
|
+
* describePlatformHttpServiceRoute 轮询域名状态,直到 SUCCESS 或 FAIL(FAIL 可删除后重新创建);
|
|
106
|
+
* 下发完成前访问域名可能返回 404 或 HTTPS 握手失败。
|
|
107
|
+
* @param {CreatePlatformHTTPServiceRouteParams} params 创建参数
|
|
108
|
+
* @returns {Promise<CreatePlatformHTTPServiceRouteRes>} 域名归属权验证指引(归属校验未通过时返回)
|
|
109
|
+
*/
|
|
110
|
+
createPlatformHttpServiceRoute(params: CreatePlatformHTTPServiceRouteParams): Promise<CreatePlatformHTTPServiceRouteRes>;
|
|
111
|
+
/**
|
|
112
|
+
* 修改 HTTP 访问服务路由
|
|
113
|
+
* 增量更新,对应字段未传入则不修改。
|
|
114
|
+
* @param {ModifyPlatformHTTPServiceRouteParams} params 修改参数,包含目标域名及待更新的路由信息
|
|
115
|
+
* @returns {Promise<ModifyPlatformHTTPServiceRouteRes>} 请求执行结果
|
|
116
|
+
*/
|
|
117
|
+
modifyPlatformHttpServiceRoute(params: ModifyPlatformHTTPServiceRouteParams): Promise<ModifyPlatformHTTPServiceRouteRes>;
|
|
118
|
+
/**
|
|
119
|
+
* 删除 HTTP 访问服务路由
|
|
120
|
+
* Paths 为空时删除域名及其下全部路由,非空时仅删除指定路径的路由。
|
|
121
|
+
* @param {DeletePlatformHTTPServiceRouteParams} params 删除参数,Paths 缺省时删除整个域名
|
|
122
|
+
* @returns {Promise<DeletePlatformHTTPServiceRouteRes>} 请求执行结果
|
|
123
|
+
*/
|
|
124
|
+
deletePlatformHttpServiceRoute(params: DeletePlatformHTTPServiceRouteParams): Promise<DeletePlatformHTTPServiceRouteRes>;
|
|
125
|
+
/**
|
|
126
|
+
* 查询 HTTP 访问服务路由
|
|
127
|
+
* 返回各域名及其路由信息列表、自定义接入的源站域名及域名总数,
|
|
128
|
+
* 支持按 Domain、Path、DomainType、UpstreamResourceType 过滤及分页。
|
|
129
|
+
* @param {DescribePlatformHTTPServiceRouteParams} params 查询参数,Limit 默认 20、最大 1000
|
|
130
|
+
* @returns {Promise<DescribePlatformHTTPServiceRouteRes>} 域名路由列表及域名总数
|
|
131
|
+
*/
|
|
132
|
+
describePlatformHttpServiceRoute(params: DescribePlatformHTTPServiceRouteParams): Promise<DescribePlatformHTTPServiceRouteRes>;
|
|
133
|
+
}
|