@geek-fun/serverlessinsight 0.8.2 → 0.8.3
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/.serverlessinsight/state-cdn-flow-app-cdn-flow-service.json.backup +14 -0
- package/.serverlessinsight/state-iam-test-app-iam-test-service.json.backup +14 -0
- package/.serverlessinsight/state-insight-poc-deploy-app-insight-poc-deploy.json.backup +348 -0
- package/.serverlessinsight/state-insight-poc-destroy-app-insight-poc-destroy.json.backup +14 -0
- package/.serverlessinsight/state-insight-volc-app-insight-volc.json.backup +114 -0
- package/.serverlessinsight/state-insight-volc-destroy-app-insight-volc-destroy.json.backup +1 -0
- package/README.md +26 -18
- package/README.zh-CN.md +19 -6
- package/dist/package.json +3 -1
- package/dist/src/commands/deploy.js +87 -4
- package/dist/src/commands/destroy.js +61 -10
- package/dist/src/commands/forceUnlock.js +8 -0
- package/dist/src/commands/index.js +34 -2
- package/dist/src/commands/login.js +195 -0
- package/dist/src/commands/logout.js +17 -0
- package/dist/src/commands/show.js +15 -7
- package/dist/src/commands/whoami.js +20 -0
- package/dist/src/common/aliyunClient/apigwOperations.js +327 -30
- package/dist/src/common/aliyunClient/esOperations.js +43 -29
- package/dist/src/common/aliyunClient/fc3Operations.js +481 -207
- package/dist/src/common/aliyunClient/ossOperations.js +165 -13
- package/dist/src/common/aliyunClient/rdsOperations.js +143 -39
- package/dist/src/common/aliyunClient/slsOperations.js +56 -26
- package/dist/src/common/aliyunClient/tablestoreOperations.js +25 -22
- package/dist/src/common/apiClient.js +102 -0
- package/dist/src/common/constants.js +9 -4
- package/dist/src/common/credentialStore.js +94 -0
- package/dist/src/common/credentials.js +2 -0
- package/dist/src/common/eventQueue.js +208 -0
- package/dist/src/common/hashUtils.js +87 -11
- package/dist/src/common/imsClient.js +1 -0
- package/dist/src/common/index.js +3 -0
- package/dist/src/common/lockManager.js +61 -54
- package/dist/src/common/logger.js +2 -0
- package/dist/src/common/polling.js +54 -0
- package/dist/src/common/reportResourceEvent.js +8 -0
- package/dist/src/common/runtimeMapper.js +11 -12
- package/dist/src/common/stateBackend/index.js +10 -1
- package/dist/src/common/stateBackend/localStateBackend.js +4 -1
- package/dist/src/common/stateBackend/remoteStateBackend.js +6 -3
- package/dist/src/common/stateBackend/saasStateBackend.js +266 -0
- package/dist/src/common/stateManager.js +135 -13
- package/dist/src/common/tencentClient/cosOperations.js +180 -3
- package/dist/src/common/tencentClient/esOperations.js +110 -46
- package/dist/src/common/tencentClient/index.js +22 -1
- package/dist/src/common/tencentClient/scfOperations.js +255 -133
- package/dist/src/common/tencentClient/tdsqlcClusterMapper.js +81 -0
- package/dist/src/common/tencentClient/tdsqlcOperations.js +93 -99
- package/dist/src/common/triggerMapper.js +36 -0
- package/dist/src/common/volcengineClient/apigwOperations.js +539 -159
- package/dist/src/common/volcengineClient/iamOperations.js +58 -48
- package/dist/src/common/volcengineClient/index.js +46 -21
- package/dist/src/common/volcengineClient/stsOperations.js +32 -0
- package/dist/src/common/volcengineClient/tlsOperations.js +229 -178
- package/dist/src/common/volcengineClient/tosOperations.js +78 -19
- package/dist/src/common/volcengineClient/vefaasOperations.js +272 -54
- package/dist/src/lang/en.js +84 -0
- package/dist/src/lang/zh-CN.js +84 -0
- package/dist/src/parser/eventParser.js +2 -0
- package/dist/src/parser/functionParser.js +96 -65
- package/dist/src/parser/index.js +7 -4
- package/dist/src/stack/aliyunStack/apigwExecutor.js +39 -1
- package/dist/src/stack/aliyunStack/apigwPlanner.js +14 -10
- package/dist/src/stack/aliyunStack/apigwResource.js +216 -124
- package/dist/src/stack/aliyunStack/apigwTypes.js +16 -3
- package/dist/src/stack/aliyunStack/databaseExecutor.js +39 -1
- package/dist/src/stack/aliyunStack/databasePlanner.js +13 -1
- package/dist/src/stack/aliyunStack/databaseResource.js +135 -40
- package/dist/src/stack/aliyunStack/deployer.js +2 -2
- package/dist/src/stack/aliyunStack/destroyer.js +2 -2
- package/dist/src/stack/aliyunStack/fc3Executor.js +25 -2
- package/dist/src/stack/aliyunStack/fc3Planner.js +11 -1
- package/dist/src/stack/aliyunStack/fc3Resource.js +327 -64
- package/dist/src/stack/aliyunStack/ossExecutor.js +39 -1
- package/dist/src/stack/aliyunStack/ossPlanner.js +15 -1
- package/dist/src/stack/aliyunStack/ossResource.js +267 -219
- package/dist/src/stack/aliyunStack/tablestoreExecutor.js +39 -1
- package/dist/src/stack/aliyunStack/tablestorePlanner.js +13 -1
- package/dist/src/stack/aliyunStack/tablestoreResource.js +54 -20
- package/dist/src/stack/alreadyExists.js +26 -0
- package/dist/src/stack/ownershipTag.js +40 -0
- package/dist/src/stack/rfsStack/index.js +3 -1
- package/dist/src/stack/scfStack/cosExecutor.js +39 -1
- package/dist/src/stack/scfStack/cosPlanner.js +11 -1
- package/dist/src/stack/scfStack/cosResource.js +167 -64
- package/dist/src/stack/scfStack/deployer.js +2 -2
- package/dist/src/stack/scfStack/destroyer.js +2 -2
- package/dist/src/stack/scfStack/esServerlessExecutor.js +39 -1
- package/dist/src/stack/scfStack/esServerlessPlanner.js +11 -1
- package/dist/src/stack/scfStack/esServerlessResource.js +88 -23
- package/dist/src/stack/scfStack/scfExecutor.js +39 -1
- package/dist/src/stack/scfStack/scfPlanner.js +12 -2
- package/dist/src/stack/scfStack/scfResource.js +484 -14
- package/dist/src/stack/scfStack/tdsqlcExecutor.js +39 -1
- package/dist/src/stack/scfStack/tdsqlcPlanner.js +12 -1
- package/dist/src/stack/scfStack/tdsqlcResource.js +95 -16
- package/dist/src/stack/scfStack/tdsqlcTypes.js +5 -1
- package/dist/src/stack/volcengineStack/apigwExecutor.js +39 -1
- package/dist/src/stack/volcengineStack/apigwPlanner.js +25 -53
- package/dist/src/stack/volcengineStack/apigwResource.js +418 -222
- package/dist/src/stack/volcengineStack/apigwTypes.js +76 -66
- package/dist/src/stack/volcengineStack/deployer.js +49 -14
- package/dist/src/stack/volcengineStack/destroyer.js +1 -1
- package/dist/src/stack/volcengineStack/index.js +1 -2
- package/dist/src/stack/volcengineStack/tosExecutor.js +25 -2
- package/dist/src/stack/volcengineStack/tosPlanner.js +11 -1
- package/dist/src/stack/volcengineStack/tosResource.js +82 -27
- package/dist/src/stack/volcengineStack/tosTypes.js +12 -0
- package/dist/src/stack/volcengineStack/vefaasExecutor.js +25 -2
- package/dist/src/stack/volcengineStack/vefaasPlanner.js +71 -2
- package/dist/src/stack/volcengineStack/vefaasResource.js +148 -98
- package/dist/src/stack/volcengineStack/vefaasTypes.js +1 -3
- package/dist/src/types/domains/backend.js +1 -0
- package/dist/src/types/domains/state.js +29 -1
- package/dist/src/validator/eventSchema.js +10 -0
- package/dist/src/validator/functionSchema.js +37 -12
- package/dist/src/validator/iacSchema.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -1
|
@@ -3,54 +3,137 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createApigwOperations = void 0;
|
|
4
4
|
const logger_1 = require("../logger");
|
|
5
5
|
const lang_1 = require("../../lang");
|
|
6
|
+
const polling_1 = require("../polling");
|
|
7
|
+
// Gateway provisioning is slow (mirrors the 30-minute Terraform timeout) —
|
|
8
|
+
// use a longer, gentler poll window than the 60s SCF default.
|
|
9
|
+
const APIGW_POLL_INTERVAL_MS = 10000;
|
|
10
|
+
const APIGW_POLL_MAX_ATTEMPTS = 120; // up to 20 minutes
|
|
6
11
|
/* istanbul ignore next */ const createApigwOperations = (client) => {
|
|
7
12
|
if (!client) {
|
|
13
|
+
const notInitialized = () => Promise.reject(new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED')));
|
|
8
14
|
return {
|
|
9
|
-
createGateway: async (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
deleteApi: async (_gatewayId, _apiId) => {
|
|
34
|
-
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
35
|
-
},
|
|
36
|
-
deployApi: async (_gatewayId, _apiId) => {
|
|
37
|
-
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
38
|
-
},
|
|
39
|
-
bindDomain: async (_config) => {
|
|
40
|
-
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
41
|
-
},
|
|
42
|
-
unbindDomain: async (_gatewayId, _domainName) => {
|
|
43
|
-
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
44
|
-
},
|
|
15
|
+
createGateway: async (_c) => notInitialized(),
|
|
16
|
+
getGateway: async (_id) => notInitialized(),
|
|
17
|
+
findGatewayByName: async (_n) => notInitialized(),
|
|
18
|
+
findServerlessGateway: async () => notInitialized(),
|
|
19
|
+
waitForGatewayRunning: async (_id) => notInitialized(),
|
|
20
|
+
updateGateway: async (_id, _c) => notInitialized(),
|
|
21
|
+
deleteGateway: async (_id) => notInitialized(),
|
|
22
|
+
updateGatewayLog: async (_id, _c) => notInitialized(),
|
|
23
|
+
createService: async (_c) => notInitialized(),
|
|
24
|
+
getService: async (_id) => notInitialized(),
|
|
25
|
+
findServiceByName: async (_g, _n) => notInitialized(),
|
|
26
|
+
deleteService: async (_id) => notInitialized(),
|
|
27
|
+
createUpstream: async (_c) => notInitialized(),
|
|
28
|
+
getUpstream: async (_id) => notInitialized(),
|
|
29
|
+
findUpstreamByName: async (_g, _n) => notInitialized(),
|
|
30
|
+
deleteUpstream: async (_id) => notInitialized(),
|
|
31
|
+
createRoute: async (_c) => notInitialized(),
|
|
32
|
+
getRoute: async (_id) => notInitialized(),
|
|
33
|
+
findRouteByName: async (_s, _n) => notInitialized(),
|
|
34
|
+
listRoutesByService: async (_s) => notInitialized(),
|
|
35
|
+
deleteRoute: async (_id) => notInitialized(),
|
|
36
|
+
createCustomDomain: async (_c) => notInitialized(),
|
|
37
|
+
deleteCustomDomain: async (_id) => notInitialized(),
|
|
45
38
|
};
|
|
46
39
|
}
|
|
40
|
+
const region = client.region ?? 'cn-beijing';
|
|
41
|
+
const parseGateway = (data) => {
|
|
42
|
+
const networkSpec = data.NetworkSpec;
|
|
43
|
+
const backendSpec = data.BackendSpec;
|
|
44
|
+
const monitorSpec = data.MonitorSpec;
|
|
45
|
+
const logSpec = data.LogSpec;
|
|
46
|
+
const resourceSpec = data.ResourceSpec;
|
|
47
|
+
const networkType = resourceSpec?.NetworkType;
|
|
48
|
+
return {
|
|
49
|
+
gatewayId: data.Id,
|
|
50
|
+
gatewayName: data.Name,
|
|
51
|
+
type: data.Type,
|
|
52
|
+
status: data.Status,
|
|
53
|
+
createdTime: data.CreatedTime,
|
|
54
|
+
// The provider returns the gateway description under `Comments` (not
|
|
55
|
+
// `Description`) — reading the wrong key left it always undefined.
|
|
56
|
+
description: data.Comments ?? data.Description,
|
|
57
|
+
message: data.Message,
|
|
58
|
+
tags: data.Tags?.map((t) => ({
|
|
59
|
+
Key: t.Key,
|
|
60
|
+
Value: t.Value,
|
|
61
|
+
})),
|
|
62
|
+
region: data.Region,
|
|
63
|
+
version: data.Version,
|
|
64
|
+
projectName: data.ProjectName,
|
|
65
|
+
networkSpec: networkSpec
|
|
66
|
+
? {
|
|
67
|
+
vpcId: networkSpec.VpcId,
|
|
68
|
+
subnetIds: networkSpec.SubnetIds,
|
|
69
|
+
}
|
|
70
|
+
: undefined,
|
|
71
|
+
backendSpec: backendSpec
|
|
72
|
+
? {
|
|
73
|
+
isVkeWithFlannelCniSupported: backendSpec.IsVkeWithFlannelCNISupported,
|
|
74
|
+
vkePodCidr: backendSpec.VkePodCidr,
|
|
75
|
+
}
|
|
76
|
+
: undefined,
|
|
77
|
+
monitorSpec: monitorSpec
|
|
78
|
+
? {
|
|
79
|
+
enable: monitorSpec.Enable,
|
|
80
|
+
workspaceId: monitorSpec.WorkspaceId,
|
|
81
|
+
}
|
|
82
|
+
: undefined,
|
|
83
|
+
logSpec: logSpec
|
|
84
|
+
? {
|
|
85
|
+
enable: logSpec.Enable,
|
|
86
|
+
projectId: logSpec.ProjectId,
|
|
87
|
+
topicId: logSpec.TopicId,
|
|
88
|
+
}
|
|
89
|
+
: undefined,
|
|
90
|
+
resourceSpec: resourceSpec
|
|
91
|
+
? {
|
|
92
|
+
replicas: resourceSpec.Replicas,
|
|
93
|
+
instanceSpecCode: resourceSpec.InstanceSpecCode,
|
|
94
|
+
clbSpecCode: resourceSpec.ClbSpecCode,
|
|
95
|
+
publicNetworkBillingType: resourceSpec.PublicNetworkBillingType,
|
|
96
|
+
publicNetworkBandwidth: resourceSpec.PublicNetworkBandwidth,
|
|
97
|
+
networkType: networkType
|
|
98
|
+
? {
|
|
99
|
+
enablePublicNetwork: networkType.EnablePublicNetwork,
|
|
100
|
+
enablePrivateNetwork: networkType.EnablePrivateNetwork,
|
|
101
|
+
}
|
|
102
|
+
: undefined,
|
|
103
|
+
}
|
|
104
|
+
: undefined,
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
// apig 无 GetGateway action;唯一读取是 ListGateways,项 ID 字段为 `Id`
|
|
108
|
+
// (对齐官方 terraform-provider-volcengine apig_gateway 实现)
|
|
109
|
+
const listGateways = async (filter) => {
|
|
110
|
+
const response = await client.fetchOpenAPI({
|
|
111
|
+
Action: 'ListGateways',
|
|
112
|
+
Version: '2021-03-03',
|
|
113
|
+
method: 'POST',
|
|
114
|
+
headers: { 'content-type': 'application/json' },
|
|
115
|
+
data: { Filter: filter, Region: region },
|
|
116
|
+
});
|
|
117
|
+
const result = (response.Result || {});
|
|
118
|
+
const items = (result.Items ?? []);
|
|
119
|
+
return items.map(parseGateway);
|
|
120
|
+
};
|
|
47
121
|
return {
|
|
48
122
|
createGateway: async (config) => {
|
|
49
|
-
logger_1.logger.info(lang_1.lang.__('VOLCENGINE_CREATING_APIGW', { gatewayName: config.
|
|
123
|
+
logger_1.logger.info(lang_1.lang.__('VOLCENGINE_CREATING_APIGW', { gatewayName: config.gatewayName }));
|
|
50
124
|
const params = {
|
|
51
|
-
Name: config.
|
|
52
|
-
|
|
53
|
-
|
|
125
|
+
Name: config.gatewayName,
|
|
126
|
+
Region: region,
|
|
127
|
+
Type: config.type ?? 'serverless',
|
|
128
|
+
// NetworkSpec (VPC + subnets) is REQUIRED by CreateGateway even for
|
|
129
|
+
// serverless gateways — verified live: omitting it returns
|
|
130
|
+
// "missing NetworkSpec parameter". ResourceSpec is optional; when
|
|
131
|
+
// present its InstanceSpecCode/Replicas become mandatory.
|
|
132
|
+
...(config.network && {
|
|
133
|
+
NetworkSpec: { VpcId: config.network.vpcId, SubnetIds: config.network.subnetIds },
|
|
134
|
+
}),
|
|
135
|
+
...(config.description && { Comments: config.description }),
|
|
136
|
+
...(config.Tags && { Tags: config.Tags }),
|
|
54
137
|
};
|
|
55
138
|
const response = await client.fetchOpenAPI({
|
|
56
139
|
Action: 'CreateGateway',
|
|
@@ -61,209 +144,506 @@ const lang_1 = require("../../lang");
|
|
|
61
144
|
});
|
|
62
145
|
const data = (response.Result || {});
|
|
63
146
|
return {
|
|
64
|
-
gatewayId: data.
|
|
65
|
-
gatewayName:
|
|
66
|
-
|
|
67
|
-
status: data.Status,
|
|
68
|
-
createdTime: data.CreatedTime,
|
|
69
|
-
description: data.Description,
|
|
70
|
-
subDomain: data.SubDomain,
|
|
147
|
+
gatewayId: data.Id,
|
|
148
|
+
gatewayName: config.gatewayName,
|
|
149
|
+
type: config.type ?? 'serverless',
|
|
71
150
|
};
|
|
72
151
|
},
|
|
73
152
|
getGateway: async (gatewayId) => {
|
|
153
|
+
const gateways = await listGateways({ Ids: [gatewayId] });
|
|
154
|
+
return gateways[0] ?? null;
|
|
155
|
+
},
|
|
156
|
+
findGatewayByName: async (gatewayName) => {
|
|
157
|
+
const gateways = await listGateways({ Name: gatewayName });
|
|
158
|
+
const match = gateways.find((g) => g.gatewayName === gatewayName);
|
|
159
|
+
return match ?? null;
|
|
160
|
+
},
|
|
161
|
+
findServerlessGateway: async () => {
|
|
162
|
+
const gateways = await listGateways({ Type: 'serverless' });
|
|
163
|
+
return gateways.find((g) => g.type === 'serverless') ?? null;
|
|
164
|
+
},
|
|
165
|
+
// Gateway creation is async — downstream calls (service/upstream/route)
|
|
166
|
+
// are rejected until the instance reaches Running.
|
|
167
|
+
waitForGatewayRunning: async (gatewayId) => {
|
|
168
|
+
const TERMINAL_FAILED_STATUSES = ['Failed', 'CreatedFailed', 'CreationFailed', 'Error'];
|
|
169
|
+
const gateway = await (0, polling_1.pollUntil)({
|
|
170
|
+
description: `API Gateway ${gatewayId} to be Running`,
|
|
171
|
+
fetch: async () => {
|
|
172
|
+
const gateways = await listGateways({ Ids: [gatewayId] });
|
|
173
|
+
const info = gateways[0] ?? null;
|
|
174
|
+
if (info && TERMINAL_FAILED_STATUSES.includes(info.status ?? '')) {
|
|
175
|
+
const reason = info.message
|
|
176
|
+
? `: ${info.message}`
|
|
177
|
+
: ` (status ${info.status}) — check the Volcengine console for the gateway instance`;
|
|
178
|
+
throw new Error(`API Gateway ${gatewayId} creation failed${reason}`);
|
|
179
|
+
}
|
|
180
|
+
return info;
|
|
181
|
+
},
|
|
182
|
+
isDone: (info) => info?.status === 'Running',
|
|
183
|
+
intervalMs: APIGW_POLL_INTERVAL_MS,
|
|
184
|
+
maxAttempts: APIGW_POLL_MAX_ATTEMPTS,
|
|
185
|
+
onProgress: (info, attempt, maxAttempts) => {
|
|
186
|
+
logger_1.logger.info(lang_1.lang.__('VOLCENGINE_APIGW_WAITING_RUNNING', {
|
|
187
|
+
gatewayName: info?.gatewayName ?? gatewayId,
|
|
188
|
+
status: info?.status ?? 'unknown',
|
|
189
|
+
attempt: String(attempt),
|
|
190
|
+
maxAttempts: String(maxAttempts),
|
|
191
|
+
}));
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
if (!gateway) {
|
|
195
|
+
throw new Error(`API Gateway ${gatewayId} disappeared while waiting for Running`);
|
|
196
|
+
}
|
|
197
|
+
return gateway;
|
|
198
|
+
},
|
|
199
|
+
updateGateway: async (gatewayId, config) => {
|
|
200
|
+
await client.fetchOpenAPI({
|
|
201
|
+
Action: 'UpdateGateway',
|
|
202
|
+
Version: '2021-03-03',
|
|
203
|
+
method: 'POST',
|
|
204
|
+
headers: { 'content-type': 'application/json' },
|
|
205
|
+
data: {
|
|
206
|
+
Id: gatewayId,
|
|
207
|
+
...(config.description && { Comments: config.description }),
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
updateGatewayLog: async (gatewayId, logConfig) => {
|
|
212
|
+
await client.fetchOpenAPI({
|
|
213
|
+
Action: 'UpdateGatewayLog',
|
|
214
|
+
Version: '2021-03-03',
|
|
215
|
+
method: 'POST',
|
|
216
|
+
headers: { 'content-type': 'application/json' },
|
|
217
|
+
data: {
|
|
218
|
+
Id: gatewayId,
|
|
219
|
+
LogSpec: {
|
|
220
|
+
Enable: logConfig.enable,
|
|
221
|
+
...(logConfig.projectId && { ProjectId: logConfig.projectId }),
|
|
222
|
+
...(logConfig.topicId && { TopicId: logConfig.topicId }),
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
if (logConfig.enable) {
|
|
227
|
+
logger_1.logger.info(lang_1.lang.__('APIGW_LOG_ENABLED', { gatewayId }));
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
logger_1.logger.info(lang_1.lang.__('APIGW_LOG_DISABLED', { gatewayId }));
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
deleteGateway: async (gatewayId) => {
|
|
234
|
+
await client.fetchOpenAPI({
|
|
235
|
+
Action: 'DeleteGateway',
|
|
236
|
+
Version: '2021-03-03',
|
|
237
|
+
method: 'POST',
|
|
238
|
+
headers: { 'content-type': 'application/json' },
|
|
239
|
+
data: { Id: gatewayId },
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
createService: async (config) => {
|
|
243
|
+
logger_1.logger.info(lang_1.lang.__('VOLCENGINE_CREATING_APIGW_SERVICE', { serviceName: config.serviceName }));
|
|
244
|
+
const response = await client.fetchOpenAPI({
|
|
245
|
+
Action: 'CreateGatewayService',
|
|
246
|
+
Version: '2021-03-03',
|
|
247
|
+
method: 'POST',
|
|
248
|
+
headers: { 'content-type': 'application/json' },
|
|
249
|
+
data: {
|
|
250
|
+
GatewayId: config.gatewayId,
|
|
251
|
+
ServiceName: config.serviceName,
|
|
252
|
+
Protocol: config.protocol ?? ['HTTP'],
|
|
253
|
+
AuthSpec: { Enable: false },
|
|
254
|
+
...(config.description && { Comments: config.description }),
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
const data = (response.Result || {});
|
|
258
|
+
return data.Id ?? '';
|
|
259
|
+
},
|
|
260
|
+
getService: async (serviceId) => {
|
|
74
261
|
try {
|
|
75
262
|
const response = await client.fetchOpenAPI({
|
|
76
|
-
Action: '
|
|
263
|
+
Action: 'GetGatewayService',
|
|
77
264
|
Version: '2021-03-03',
|
|
78
265
|
method: 'POST',
|
|
79
266
|
headers: { 'content-type': 'application/json' },
|
|
80
|
-
data: {
|
|
267
|
+
data: { Id: serviceId },
|
|
81
268
|
});
|
|
82
|
-
const
|
|
269
|
+
const result = (response.Result || {});
|
|
270
|
+
const data = (result.GatewayService ?? {});
|
|
271
|
+
const authSpec = data.AuthSpec;
|
|
83
272
|
return {
|
|
273
|
+
serviceId: data.Id,
|
|
274
|
+
serviceName: data.Name,
|
|
84
275
|
gatewayId: data.GatewayId,
|
|
85
|
-
gatewayName: data.Name,
|
|
86
|
-
protocol: data.Protocol,
|
|
87
276
|
status: data.Status,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
277
|
+
protocol: data.Protocol,
|
|
278
|
+
createdTime: data.CreateTime,
|
|
279
|
+
gatewayName: data.GatewayName,
|
|
280
|
+
message: data.Message,
|
|
281
|
+
comments: data.Comments ?? data.Description,
|
|
282
|
+
authSpec: authSpec ? { enable: authSpec.Enable } : undefined,
|
|
283
|
+
domains: data.Domains?.map((d) => ({
|
|
284
|
+
domain: d.Domain,
|
|
285
|
+
type: d.Type,
|
|
286
|
+
})),
|
|
287
|
+
customDomains: data.CustomDomains?.map((d) => ({
|
|
288
|
+
id: d.Id,
|
|
289
|
+
domain: d.Domain,
|
|
290
|
+
})),
|
|
91
291
|
};
|
|
92
292
|
}
|
|
93
293
|
catch (error) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
294
|
+
const err = error;
|
|
295
|
+
if (err.code === 'NotFound' || err.code === 'ServiceNotFound') {
|
|
296
|
+
return null;
|
|
98
297
|
}
|
|
99
298
|
throw error;
|
|
100
299
|
}
|
|
101
300
|
},
|
|
102
|
-
|
|
301
|
+
findServiceByName: async (gatewayId, serviceName) => {
|
|
103
302
|
const response = await client.fetchOpenAPI({
|
|
104
|
-
Action: '
|
|
303
|
+
Action: 'ListGatewayServices',
|
|
105
304
|
Version: '2021-03-03',
|
|
106
305
|
method: 'POST',
|
|
107
306
|
headers: { 'content-type': 'application/json' },
|
|
108
|
-
data: { Name:
|
|
307
|
+
data: { GatewayId: gatewayId, Filter: { Name: serviceName } },
|
|
109
308
|
});
|
|
110
309
|
const result = (response.Result || {});
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
310
|
+
const items = (result.Items ?? []);
|
|
311
|
+
const match = items.find((s) => s.Name === serviceName);
|
|
312
|
+
if (!match) {
|
|
114
313
|
return null;
|
|
314
|
+
}
|
|
315
|
+
const authSpec = match.AuthSpec;
|
|
115
316
|
return {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
status:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
317
|
+
serviceId: match.Id,
|
|
318
|
+
serviceName: match.Name,
|
|
319
|
+
gatewayId: match.GatewayId,
|
|
320
|
+
status: match.Status,
|
|
321
|
+
protocol: match.Protocol,
|
|
322
|
+
createdTime: match.CreateTime,
|
|
323
|
+
gatewayName: match.GatewayName,
|
|
324
|
+
message: match.Message,
|
|
325
|
+
comments: match.Comments ?? match.Description,
|
|
326
|
+
authSpec: authSpec ? { enable: authSpec.Enable } : undefined,
|
|
327
|
+
domains: match.Domains?.map((d) => ({
|
|
328
|
+
domain: d.Domain,
|
|
329
|
+
type: d.Type,
|
|
330
|
+
})),
|
|
331
|
+
customDomains: match.CustomDomains?.map((d) => ({
|
|
332
|
+
id: d.Id,
|
|
333
|
+
domain: d.Domain,
|
|
334
|
+
})),
|
|
123
335
|
};
|
|
124
336
|
},
|
|
125
|
-
|
|
126
|
-
const params = {
|
|
127
|
-
GatewayId: gatewayId,
|
|
128
|
-
Name: config.groupName,
|
|
129
|
-
...(config.description && { Description: config.description }),
|
|
130
|
-
...(config.protocol && { Protocol: config.protocol }),
|
|
131
|
-
};
|
|
337
|
+
deleteService: async (serviceId) => {
|
|
132
338
|
await client.fetchOpenAPI({
|
|
133
|
-
Action: '
|
|
339
|
+
Action: 'DeleteGatewayService',
|
|
134
340
|
Version: '2021-03-03',
|
|
135
341
|
method: 'POST',
|
|
136
342
|
headers: { 'content-type': 'application/json' },
|
|
137
|
-
data:
|
|
343
|
+
data: { Id: serviceId },
|
|
138
344
|
});
|
|
139
345
|
},
|
|
140
|
-
|
|
141
|
-
logger_1.logger.info(lang_1.lang.__('
|
|
142
|
-
await client.fetchOpenAPI({
|
|
143
|
-
Action: 'DeleteGateway',
|
|
144
|
-
Version: '2021-03-03',
|
|
145
|
-
method: 'POST',
|
|
146
|
-
headers: { 'content-type': 'application/json' },
|
|
147
|
-
data: { GatewayId: gatewayId },
|
|
148
|
-
});
|
|
149
|
-
},
|
|
150
|
-
createApi: async (config) => {
|
|
151
|
-
const params = {
|
|
152
|
-
GatewayId: config.gatewayId,
|
|
153
|
-
Name: config.apiName,
|
|
154
|
-
Method: config.method,
|
|
155
|
-
Path: config.path,
|
|
156
|
-
BackendType: 'Function',
|
|
157
|
-
BackendConfig: {
|
|
158
|
-
FunctionName: config.backendFunctionName,
|
|
159
|
-
Timeout: config.requestTimeout ?? 60,
|
|
160
|
-
},
|
|
161
|
-
};
|
|
346
|
+
createUpstream: async (config) => {
|
|
347
|
+
logger_1.logger.info(lang_1.lang.__('VOLCENGINE_CREATING_APIGW_UPSTREAM', { upstreamName: config.upstreamName }));
|
|
162
348
|
const response = await client.fetchOpenAPI({
|
|
163
|
-
Action: '
|
|
349
|
+
Action: 'CreateUpstream',
|
|
164
350
|
Version: '2021-03-03',
|
|
165
351
|
method: 'POST',
|
|
166
352
|
headers: { 'content-type': 'application/json' },
|
|
167
|
-
data:
|
|
353
|
+
data: {
|
|
354
|
+
Name: config.upstreamName,
|
|
355
|
+
GatewayId: config.gatewayId,
|
|
356
|
+
SourceType: config.sourceType,
|
|
357
|
+
Protocol: config.protocol ?? 'HTTP',
|
|
358
|
+
UpstreamSpec: {
|
|
359
|
+
// VeFaas 是单对象(非数组),内含 FunctionId
|
|
360
|
+
VeFaas: { FunctionId: config.functionId },
|
|
361
|
+
},
|
|
362
|
+
},
|
|
168
363
|
});
|
|
169
364
|
const data = (response.Result || {});
|
|
170
|
-
return data.
|
|
365
|
+
return data.Id ?? '';
|
|
171
366
|
},
|
|
172
|
-
|
|
367
|
+
getUpstream: async (upstreamId) => {
|
|
173
368
|
try {
|
|
174
369
|
const response = await client.fetchOpenAPI({
|
|
175
|
-
Action: '
|
|
370
|
+
Action: 'ListUpstreams',
|
|
176
371
|
Version: '2021-03-03',
|
|
177
372
|
method: 'POST',
|
|
178
373
|
headers: { 'content-type': 'application/json' },
|
|
179
|
-
data: {
|
|
374
|
+
data: { Filter: { Ids: [upstreamId] } },
|
|
180
375
|
});
|
|
181
|
-
const
|
|
182
|
-
const
|
|
376
|
+
const result = (response.Result || {});
|
|
377
|
+
const items = (result.Items ?? []);
|
|
378
|
+
const data = items[0];
|
|
379
|
+
if (!data) {
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
const upstreamSpec = data.UpstreamSpec;
|
|
383
|
+
const veFaas = upstreamSpec?.VeFaas;
|
|
183
384
|
return {
|
|
184
|
-
|
|
185
|
-
|
|
385
|
+
upstreamId: data.Id,
|
|
386
|
+
upstreamName: data.Name,
|
|
186
387
|
gatewayId: data.GatewayId,
|
|
187
|
-
method: data.Method,
|
|
188
|
-
path: data.Path,
|
|
189
|
-
description: data.Description,
|
|
190
|
-
backendType: data.BackendType,
|
|
191
|
-
backendId: data.BackendId,
|
|
192
|
-
backendFunctionName: backendConfig.FunctionName,
|
|
193
388
|
status: data.Status,
|
|
194
|
-
|
|
389
|
+
sourceType: data.SourceType,
|
|
390
|
+
protocol: data.Protocol,
|
|
391
|
+
functionId: veFaas?.FunctionId ?? undefined,
|
|
392
|
+
createdTime: data.CreateTime,
|
|
393
|
+
comments: data.Comments ?? data.Description,
|
|
394
|
+
resourceType: data.ResourceType,
|
|
395
|
+
updateTime: data.UpdateTime,
|
|
396
|
+
backendTargetList: data.BackendTargetList?.map((b) => ({
|
|
397
|
+
ip: b.Ip,
|
|
398
|
+
port: b.Port,
|
|
399
|
+
healthStatus: b.HealthStatus,
|
|
400
|
+
})),
|
|
195
401
|
};
|
|
196
402
|
}
|
|
197
403
|
catch (error) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
404
|
+
const err = error;
|
|
405
|
+
if (err.code === 'NotFound' || err.code === 'UpstreamNotFound') {
|
|
406
|
+
return null;
|
|
202
407
|
}
|
|
203
408
|
throw error;
|
|
204
409
|
}
|
|
205
410
|
},
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
GatewayId: config.gatewayId,
|
|
210
|
-
Name: config.apiName,
|
|
211
|
-
Method: config.method,
|
|
212
|
-
Path: config.path,
|
|
213
|
-
BackendType: 'Function',
|
|
214
|
-
BackendConfig: {
|
|
215
|
-
FunctionName: config.backendFunctionName,
|
|
216
|
-
Timeout: config.requestTimeout ?? 60,
|
|
217
|
-
},
|
|
218
|
-
};
|
|
219
|
-
await client.fetchOpenAPI({
|
|
220
|
-
Action: 'UpdateApi',
|
|
411
|
+
findUpstreamByName: async (gatewayId, upstreamName) => {
|
|
412
|
+
const response = await client.fetchOpenAPI({
|
|
413
|
+
Action: 'ListUpstreams',
|
|
221
414
|
Version: '2021-03-03',
|
|
222
415
|
method: 'POST',
|
|
223
416
|
headers: { 'content-type': 'application/json' },
|
|
224
|
-
data:
|
|
417
|
+
data: { GatewayId: gatewayId, Filter: { Name: upstreamName } },
|
|
225
418
|
});
|
|
419
|
+
const result = (response.Result || {});
|
|
420
|
+
const items = (result.Items ?? []);
|
|
421
|
+
const match = items.find((u) => u.Name === upstreamName);
|
|
422
|
+
if (!match) {
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
const upstreamSpec = match.UpstreamSpec;
|
|
426
|
+
const veFaas = upstreamSpec?.VeFaas;
|
|
427
|
+
return {
|
|
428
|
+
upstreamId: match.Id,
|
|
429
|
+
upstreamName: match.Name,
|
|
430
|
+
gatewayId: match.GatewayId,
|
|
431
|
+
sourceType: match.SourceType,
|
|
432
|
+
protocol: match.Protocol,
|
|
433
|
+
functionId: veFaas?.FunctionId ?? undefined,
|
|
434
|
+
status: match.Status,
|
|
435
|
+
createdTime: match.CreateTime,
|
|
436
|
+
comments: match.Comments ?? match.Description,
|
|
437
|
+
resourceType: match.ResourceType,
|
|
438
|
+
updateTime: match.UpdateTime,
|
|
439
|
+
backendTargetList: match.BackendTargetList?.map((b) => ({
|
|
440
|
+
ip: b.Ip,
|
|
441
|
+
port: b.Port,
|
|
442
|
+
healthStatus: b.HealthStatus,
|
|
443
|
+
})),
|
|
444
|
+
};
|
|
226
445
|
},
|
|
227
|
-
|
|
446
|
+
deleteUpstream: async (upstreamId) => {
|
|
228
447
|
await client.fetchOpenAPI({
|
|
229
|
-
Action: '
|
|
448
|
+
Action: 'DeleteUpstream',
|
|
230
449
|
Version: '2021-03-03',
|
|
231
450
|
method: 'POST',
|
|
232
451
|
headers: { 'content-type': 'application/json' },
|
|
233
|
-
data: {
|
|
452
|
+
data: { Id: upstreamId },
|
|
234
453
|
});
|
|
235
454
|
},
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
455
|
+
createRoute: async (config) => {
|
|
456
|
+
logger_1.logger.info(lang_1.lang.__('VOLCENGINE_CREATING_APIGW_ROUTE', { routeName: config.routeName }));
|
|
457
|
+
const response = await client.fetchOpenAPI({
|
|
458
|
+
Action: 'CreateRoute',
|
|
459
|
+
Version: '2022-11-12',
|
|
240
460
|
method: 'POST',
|
|
241
461
|
headers: { 'content-type': 'application/json' },
|
|
242
|
-
data: {
|
|
462
|
+
data: {
|
|
463
|
+
Name: config.routeName,
|
|
464
|
+
ServiceId: config.serviceId,
|
|
465
|
+
Enable: true,
|
|
466
|
+
Priority: 0,
|
|
467
|
+
MatchRule: {
|
|
468
|
+
// Path 是单对象(非数组)
|
|
469
|
+
Path: { MatchType: 'Exact', MatchContent: config.path },
|
|
470
|
+
Method: [config.method],
|
|
471
|
+
},
|
|
472
|
+
UpstreamList: [{ UpstreamId: config.upstreamId, Weight: 100 }],
|
|
473
|
+
},
|
|
243
474
|
});
|
|
475
|
+
const data = (response.Result || {});
|
|
476
|
+
return data.Id ?? '';
|
|
244
477
|
},
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
478
|
+
findRouteByName: async (serviceId, routeName) => {
|
|
479
|
+
const response = await client.fetchOpenAPI({
|
|
480
|
+
Action: 'ListRoutes',
|
|
481
|
+
Version: '2022-11-12',
|
|
482
|
+
method: 'POST',
|
|
483
|
+
headers: { 'content-type': 'application/json' },
|
|
484
|
+
data: { Filter: { ServiceId: serviceId } },
|
|
485
|
+
});
|
|
486
|
+
const result = (response.Result || {});
|
|
487
|
+
const items = (result.Items ?? []);
|
|
488
|
+
const match = items.find((r) => r.Name === routeName);
|
|
489
|
+
if (!match) {
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
const matchRule = match.MatchRule;
|
|
493
|
+
const path = matchRule?.Path;
|
|
494
|
+
const upstreamList = match.UpstreamList;
|
|
495
|
+
return {
|
|
496
|
+
routeId: match.Id,
|
|
497
|
+
routeName: match.Name,
|
|
498
|
+
serviceId: match.ServiceId,
|
|
499
|
+
status: match.Status,
|
|
500
|
+
enable: match.Enable,
|
|
501
|
+
priority: match.Priority,
|
|
502
|
+
method: matchRule?.Method?.[0],
|
|
503
|
+
path: path?.MatchContent,
|
|
504
|
+
upstreamIds: upstreamList?.map((u) => u.UpstreamId),
|
|
505
|
+
matchRule: matchRule
|
|
506
|
+
? {
|
|
507
|
+
method: matchRule.Method,
|
|
508
|
+
path: path
|
|
509
|
+
? {
|
|
510
|
+
matchType: path.MatchType,
|
|
511
|
+
matchContent: path.MatchContent,
|
|
512
|
+
}
|
|
513
|
+
: undefined,
|
|
514
|
+
}
|
|
515
|
+
: undefined,
|
|
516
|
+
upstreamList: upstreamList?.map((u) => ({
|
|
517
|
+
upstreamId: u.UpstreamId,
|
|
518
|
+
version: u.Version,
|
|
519
|
+
weight: u.Weight,
|
|
520
|
+
})),
|
|
250
521
|
};
|
|
522
|
+
},
|
|
523
|
+
getRoute: async (routeId) => {
|
|
524
|
+
try {
|
|
525
|
+
const response = await client.fetchOpenAPI({
|
|
526
|
+
Action: 'GetRoute',
|
|
527
|
+
Version: '2022-11-12',
|
|
528
|
+
method: 'POST',
|
|
529
|
+
headers: { 'content-type': 'application/json' },
|
|
530
|
+
data: { Id: routeId },
|
|
531
|
+
});
|
|
532
|
+
const result = (response.Result || {});
|
|
533
|
+
const data = (result.Route ?? {});
|
|
534
|
+
const matchRule = data.MatchRule;
|
|
535
|
+
const path = matchRule?.Path;
|
|
536
|
+
const upstreamList = data.UpstreamList;
|
|
537
|
+
return {
|
|
538
|
+
routeId: data.Id,
|
|
539
|
+
routeName: data.Name,
|
|
540
|
+
serviceId: data.ServiceId,
|
|
541
|
+
status: data.Status,
|
|
542
|
+
enable: data.Enable,
|
|
543
|
+
priority: data.Priority,
|
|
544
|
+
method: matchRule?.Method?.[0],
|
|
545
|
+
path: path?.MatchContent,
|
|
546
|
+
upstreamIds: upstreamList?.map((u) => u.UpstreamId),
|
|
547
|
+
matchRule: matchRule
|
|
548
|
+
? {
|
|
549
|
+
method: matchRule.Method,
|
|
550
|
+
path: path
|
|
551
|
+
? {
|
|
552
|
+
matchType: path.MatchType,
|
|
553
|
+
matchContent: path.MatchContent,
|
|
554
|
+
}
|
|
555
|
+
: undefined,
|
|
556
|
+
}
|
|
557
|
+
: undefined,
|
|
558
|
+
upstreamList: upstreamList?.map((u) => ({
|
|
559
|
+
upstreamId: u.UpstreamId,
|
|
560
|
+
version: u.Version,
|
|
561
|
+
weight: u.Weight,
|
|
562
|
+
})),
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
catch (error) {
|
|
566
|
+
const err = error;
|
|
567
|
+
if (err.code === 'NotFound' || err.code === 'RouteNotFound') {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
throw error;
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
listRoutesByService: async (serviceId) => {
|
|
574
|
+
const response = await client.fetchOpenAPI({
|
|
575
|
+
Action: 'ListRoutes',
|
|
576
|
+
Version: '2022-11-12',
|
|
577
|
+
method: 'POST',
|
|
578
|
+
headers: { 'content-type': 'application/json' },
|
|
579
|
+
data: { Filter: { ServiceId: serviceId } },
|
|
580
|
+
});
|
|
581
|
+
const result = (response.Result || {});
|
|
582
|
+
const items = (result.Items ?? []);
|
|
583
|
+
return items.map((r) => {
|
|
584
|
+
const matchRule = r.MatchRule;
|
|
585
|
+
const path = matchRule?.Path;
|
|
586
|
+
const upstreamList = r.UpstreamList;
|
|
587
|
+
return {
|
|
588
|
+
routeId: r.Id,
|
|
589
|
+
routeName: r.Name,
|
|
590
|
+
serviceId: r.ServiceId,
|
|
591
|
+
status: r.Status,
|
|
592
|
+
enable: r.Enable,
|
|
593
|
+
priority: r.Priority,
|
|
594
|
+
method: matchRule?.Method?.[0],
|
|
595
|
+
path: path?.MatchContent,
|
|
596
|
+
upstreamIds: upstreamList?.map((u) => u.UpstreamId),
|
|
597
|
+
matchRule: matchRule
|
|
598
|
+
? {
|
|
599
|
+
method: matchRule.Method,
|
|
600
|
+
path: path
|
|
601
|
+
? {
|
|
602
|
+
matchType: path.MatchType,
|
|
603
|
+
matchContent: path.MatchContent,
|
|
604
|
+
}
|
|
605
|
+
: undefined,
|
|
606
|
+
}
|
|
607
|
+
: undefined,
|
|
608
|
+
upstreamList: upstreamList?.map((u) => ({
|
|
609
|
+
upstreamId: u.UpstreamId,
|
|
610
|
+
version: u.Version,
|
|
611
|
+
weight: u.Weight,
|
|
612
|
+
})),
|
|
613
|
+
};
|
|
614
|
+
});
|
|
615
|
+
},
|
|
616
|
+
deleteRoute: async (routeId) => {
|
|
251
617
|
await client.fetchOpenAPI({
|
|
252
|
-
Action: '
|
|
618
|
+
Action: 'DeleteRoute',
|
|
619
|
+
Version: '2022-11-12',
|
|
620
|
+
method: 'POST',
|
|
621
|
+
headers: { 'content-type': 'application/json' },
|
|
622
|
+
data: { Id: routeId },
|
|
623
|
+
});
|
|
624
|
+
},
|
|
625
|
+
createCustomDomain: async (config) => {
|
|
626
|
+
const response = await client.fetchOpenAPI({
|
|
627
|
+
Action: 'CreateCustomDomain',
|
|
253
628
|
Version: '2021-03-03',
|
|
254
629
|
method: 'POST',
|
|
255
630
|
headers: { 'content-type': 'application/json' },
|
|
256
|
-
data:
|
|
631
|
+
data: {
|
|
632
|
+
ServiceId: config.serviceId,
|
|
633
|
+
Domain: config.domainName,
|
|
634
|
+
...(config.certificateId && { CertificateId: config.certificateId }),
|
|
635
|
+
},
|
|
257
636
|
});
|
|
258
|
-
|
|
637
|
+
const data = (response.Result || {});
|
|
638
|
+
return data.Id ?? '';
|
|
259
639
|
},
|
|
260
|
-
|
|
640
|
+
deleteCustomDomain: async (domainId) => {
|
|
261
641
|
await client.fetchOpenAPI({
|
|
262
|
-
Action: '
|
|
642
|
+
Action: 'DeleteCustomDomain',
|
|
263
643
|
Version: '2021-03-03',
|
|
264
644
|
method: 'POST',
|
|
265
645
|
headers: { 'content-type': 'application/json' },
|
|
266
|
-
data: {
|
|
646
|
+
data: { Id: domainId },
|
|
267
647
|
});
|
|
268
648
|
},
|
|
269
649
|
};
|