@geek-fun/serverlessinsight 0.6.15 → 0.7.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/AGENTS.md +405 -10
- package/README.md +59 -1
- package/README.zh-CN.md +3 -1
- package/dist/package.json +42 -34
- package/dist/src/commands/deploy.js +4 -0
- package/dist/src/commands/destroy.js +4 -0
- package/dist/src/common/aliyunClient/apigwOperations.js +9 -4
- package/dist/src/common/aliyunClient/cdnOperations.js +191 -0
- package/dist/src/common/aliyunClient/ecsOperations.js +2 -2
- package/dist/src/common/aliyunClient/fc3Operations.js +1 -1
- package/dist/src/common/aliyunClient/index.js +8 -0
- package/dist/src/common/aliyunClient/ossOperations.js +62 -2
- package/dist/src/common/aliyunClient/ramOperations.js +1 -1
- package/dist/src/common/credentials.js +12 -0
- package/dist/src/common/hashUtils.js +4 -0
- package/dist/src/common/iacHelper.js +5 -0
- package/dist/src/common/lockManager.js +8 -0
- package/dist/src/common/planFormatter.js +4 -0
- package/dist/src/common/providerEnum.js +1 -0
- package/dist/src/common/retryUtils.js +1 -1
- package/dist/src/common/runtimeMapper.js +24 -3
- package/dist/src/common/stateManager.js +10 -0
- package/dist/src/common/volcengineClient/apigwOperations.js +271 -0
- package/dist/src/common/volcengineClient/iamOperations.js +349 -0
- package/dist/src/common/volcengineClient/index.js +99 -0
- package/dist/src/common/volcengineClient/tlsOperations.js +256 -0
- package/dist/src/common/volcengineClient/tosOperations.js +440 -0
- package/dist/src/common/volcengineClient/types.js +26 -0
- package/dist/src/common/volcengineClient/vefaasOperations.js +386 -0
- package/dist/src/lang/en.js +135 -0
- package/dist/src/lang/zh-CN.js +134 -0
- package/dist/src/parser/bucketParser.js +111 -46
- package/dist/src/stack/aliyunStack/apigwResource.js +310 -47
- package/dist/src/stack/aliyunStack/apigwTypes.js +61 -1
- package/dist/src/stack/aliyunStack/ossResource.js +401 -69
- package/dist/src/stack/aliyunStack/ossTypes.js +58 -16
- package/dist/src/stack/deploy.js +4 -0
- package/dist/src/stack/scfStack/cosTypes.js +3 -6
- package/dist/src/stack/volcengineStack/apigwExecutor.js +87 -0
- package/dist/src/stack/volcengineStack/apigwPlanner.js +110 -0
- package/dist/src/stack/volcengineStack/apigwResource.js +302 -0
- package/dist/src/stack/volcengineStack/apigwTypes.js +106 -0
- package/dist/src/stack/volcengineStack/deployer.js +59 -0
- package/dist/src/stack/volcengineStack/destroyer.js +72 -0
- package/dist/src/stack/volcengineStack/index.js +44 -0
- package/dist/src/stack/volcengineStack/planner.js +27 -0
- package/dist/src/stack/volcengineStack/tosExecutor.js +106 -0
- package/dist/src/stack/volcengineStack/tosPlanner.js +96 -0
- package/dist/src/stack/volcengineStack/tosResource.js +103 -0
- package/dist/src/stack/volcengineStack/tosTypes.js +63 -0
- package/dist/src/stack/volcengineStack/vefaasExecutor.js +102 -0
- package/dist/src/stack/volcengineStack/vefaasPlanner.js +84 -0
- package/dist/src/stack/volcengineStack/vefaasResource.js +513 -0
- package/dist/src/stack/volcengineStack/vefaasTypes.js +75 -0
- package/dist/src/types/domains/state.js +6 -0
- package/dist/src/validator/bucketSchema.js +124 -56
- package/dist/src/validator/eventSchema.js +20 -0
- package/dist/src/validator/functionSchema.js +13 -0
- package/dist/src/validator/rootSchema.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +42 -34
- package/samples/README_TENCENT_COS.md +3 -15
- package/samples/aliyun-poc-bucket-cdn.yml +63 -0
- package/samples/aliyun-poc-bucket.yml +0 -2
- package/samples/aliyun-poc-domain.yml +0 -2
- package/samples/tencent-poc-cos.yml +0 -2
- package/samples/volcengine-poc-advanced.yml +59 -0
- package/samples/volcengine-poc-api.yml +31 -0
- package/samples/volcengine-poc-bucket.yml +16 -0
- package/samples/volcengine-poc-function.yml +19 -0
- package/samples/volcengine-poc-vpc.yml +34 -0
|
@@ -144,14 +144,35 @@ const mapRuntime = (standardRuntime, provider) => {
|
|
|
144
144
|
return providerRuntime;
|
|
145
145
|
};
|
|
146
146
|
exports.mapRuntime = mapRuntime;
|
|
147
|
-
const
|
|
148
|
-
|
|
147
|
+
const VOLCENGINE_NATIVE_RUNTIMES = [
|
|
148
|
+
'nodejs/v20',
|
|
149
|
+
'nodejs/v18',
|
|
150
|
+
'nodejs/v16',
|
|
151
|
+
'nodejs/v14',
|
|
152
|
+
'python/v3.12',
|
|
153
|
+
'python/v3.11',
|
|
154
|
+
'python/v3.10',
|
|
155
|
+
'python/v3.9',
|
|
156
|
+
'golang/v1',
|
|
157
|
+
'java/v21',
|
|
158
|
+
'java/v17',
|
|
159
|
+
'java/v11',
|
|
160
|
+
'java/v8',
|
|
161
|
+
];
|
|
162
|
+
const isRuntimeSupported = (runtime, provider) => {
|
|
163
|
+
if (provider === providerEnum_1.ProviderEnum.VOLCENGINE) {
|
|
164
|
+
return VOLCENGINE_NATIVE_RUNTIMES.includes(runtime);
|
|
165
|
+
}
|
|
166
|
+
const mapping = runtimeMappings[runtime];
|
|
149
167
|
return !!mapping && !!mapping[provider];
|
|
150
168
|
};
|
|
151
169
|
exports.isRuntimeSupported = isRuntimeSupported;
|
|
152
170
|
const getSupportedRuntimes = (provider) => {
|
|
153
171
|
if (!provider) {
|
|
154
|
-
return Object.values(StandardRuntime);
|
|
172
|
+
return [...Object.values(StandardRuntime), ...VOLCENGINE_NATIVE_RUNTIMES];
|
|
173
|
+
}
|
|
174
|
+
if (provider === providerEnum_1.ProviderEnum.VOLCENGINE) {
|
|
175
|
+
return VOLCENGINE_NATIVE_RUNTIMES;
|
|
155
176
|
}
|
|
156
177
|
return Object.entries(runtimeMappings)
|
|
157
178
|
.filter(([, mapping]) => !!mapping[provider])
|
|
@@ -9,10 +9,12 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
9
9
|
const types_1 = require("../types");
|
|
10
10
|
const lockManager_1 = require("./lockManager");
|
|
11
11
|
const STATE_DIR = '.serverlessinsight';
|
|
12
|
+
/* istanbul ignore next */
|
|
12
13
|
const getStatePath = (app, service, baseDir = process.cwd()) => {
|
|
13
14
|
return node_path_1.default.join(baseDir, STATE_DIR, `state-${app}-${service}.json`);
|
|
14
15
|
};
|
|
15
16
|
exports.getStatePath = getStatePath;
|
|
17
|
+
/* istanbul ignore next */
|
|
16
18
|
const ensureStateDir = (baseDir = process.cwd()) => {
|
|
17
19
|
const stateDir = node_path_1.default.join(baseDir, STATE_DIR);
|
|
18
20
|
if (!node_fs_1.default.existsSync(stateDir)) {
|
|
@@ -24,6 +26,7 @@ exports.ensureStateDir = ensureStateDir;
|
|
|
24
26
|
* Load state file, scoped to the given stage.
|
|
25
27
|
* The returned StateFile has `resources` populated from `stages[stage].resources`.
|
|
26
28
|
*/
|
|
29
|
+
/* istanbul ignore next */
|
|
27
30
|
const loadState = (provider, app, service, stage, baseDir = process.cwd()) => {
|
|
28
31
|
const statePath = (0, exports.getStatePath)(app, service, baseDir);
|
|
29
32
|
try {
|
|
@@ -41,6 +44,7 @@ const loadState = (provider, app, service, stage, baseDir = process.cwd()) => {
|
|
|
41
44
|
return { version: types_1.CURRENT_STATE_VERSION, provider, app, service, stages: {}, resources: {} };
|
|
42
45
|
};
|
|
43
46
|
exports.loadState = loadState;
|
|
47
|
+
/* istanbul ignore next */
|
|
44
48
|
const saveState = (state, app, service, stage, baseDir = process.cwd()) => {
|
|
45
49
|
(0, exports.ensureStateDir)(baseDir);
|
|
46
50
|
const statePath = (0, exports.getStatePath)(app, service, baseDir);
|
|
@@ -82,6 +86,7 @@ exports.saveState = saveState;
|
|
|
82
86
|
* Save state with automatic locking.
|
|
83
87
|
* This should be used by high-level operations like deploy/destroy.
|
|
84
88
|
*/
|
|
89
|
+
/* istanbul ignore next */
|
|
85
90
|
const saveStateWithLock = async (state, app, service, stage, operation, baseDir = process.cwd(), options) => {
|
|
86
91
|
const statePath = (0, exports.getStatePath)(app, service, baseDir);
|
|
87
92
|
await (0, lockManager_1.withLock)(statePath, operation, async () => {
|
|
@@ -89,10 +94,12 @@ const saveStateWithLock = async (state, app, service, stage, operation, baseDir
|
|
|
89
94
|
}, options);
|
|
90
95
|
};
|
|
91
96
|
exports.saveStateWithLock = saveStateWithLock;
|
|
97
|
+
/* istanbul ignore next */
|
|
92
98
|
const getResource = (state, resourceId) => {
|
|
93
99
|
return state.resources[resourceId];
|
|
94
100
|
};
|
|
95
101
|
exports.getResource = getResource;
|
|
102
|
+
/* istanbul ignore next */
|
|
96
103
|
const setResource = (state, resourceId, resourceState) => {
|
|
97
104
|
return {
|
|
98
105
|
...state,
|
|
@@ -103,6 +110,7 @@ const setResource = (state, resourceId, resourceState) => {
|
|
|
103
110
|
};
|
|
104
111
|
};
|
|
105
112
|
exports.setResource = setResource;
|
|
113
|
+
/* istanbul ignore next */
|
|
106
114
|
const removeResource = (state, resourceId) => {
|
|
107
115
|
const { [resourceId]: _, ...remainingResources } = state.resources;
|
|
108
116
|
return {
|
|
@@ -111,6 +119,7 @@ const removeResource = (state, resourceId) => {
|
|
|
111
119
|
};
|
|
112
120
|
};
|
|
113
121
|
exports.removeResource = removeResource;
|
|
122
|
+
/* istanbul ignore next */
|
|
114
123
|
const getAllResources = (state) => {
|
|
115
124
|
return state.resources;
|
|
116
125
|
};
|
|
@@ -119,6 +128,7 @@ exports.getAllResources = getAllResources;
|
|
|
119
128
|
* Extract role ARN from function state for event resources.
|
|
120
129
|
* Looks through all function resources to find a RAM role instance and returns its ARN.
|
|
121
130
|
*/
|
|
131
|
+
/* istanbul ignore next */
|
|
122
132
|
const getRoleArnFromState = (state) => {
|
|
123
133
|
const allResources = (0, exports.getAllResources)(state);
|
|
124
134
|
for (const [logicalId, resourceState] of Object.entries(allResources)) {
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createApigwOperations = void 0;
|
|
4
|
+
const logger_1 = require("../logger");
|
|
5
|
+
const lang_1 = require("../../lang");
|
|
6
|
+
/* istanbul ignore next */ const createApigwOperations = (client) => {
|
|
7
|
+
if (!client) {
|
|
8
|
+
return {
|
|
9
|
+
createGateway: async (_config) => {
|
|
10
|
+
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
11
|
+
},
|
|
12
|
+
getGateway: async (_gatewayId) => {
|
|
13
|
+
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
14
|
+
},
|
|
15
|
+
findGatewayByName: async (_gatewayName) => {
|
|
16
|
+
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
17
|
+
},
|
|
18
|
+
updateGateway: async (_gatewayId, _config) => {
|
|
19
|
+
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
20
|
+
},
|
|
21
|
+
deleteGateway: async (_gatewayId) => {
|
|
22
|
+
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
23
|
+
},
|
|
24
|
+
createApi: async (_config) => {
|
|
25
|
+
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
26
|
+
},
|
|
27
|
+
getApi: async (_gatewayId, _apiId) => {
|
|
28
|
+
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
29
|
+
},
|
|
30
|
+
updateApi: async (_apiId, _config) => {
|
|
31
|
+
throw new Error(lang_1.lang.__('VOLCENGINE_APIGW_CLIENT_NOT_INITIALIZED'));
|
|
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
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
createGateway: async (config) => {
|
|
49
|
+
logger_1.logger.info(lang_1.lang.__('VOLCENGINE_CREATING_APIGW', { gatewayName: config.groupName }));
|
|
50
|
+
const params = {
|
|
51
|
+
Name: config.groupName,
|
|
52
|
+
...(config.description && { Description: config.description }),
|
|
53
|
+
...(config.protocol && { Protocol: config.protocol }),
|
|
54
|
+
};
|
|
55
|
+
const response = await client.fetchOpenAPI({
|
|
56
|
+
Action: 'CreateGateway',
|
|
57
|
+
Version: '2021-03-03',
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: { 'content-type': 'application/json' },
|
|
60
|
+
data: params,
|
|
61
|
+
});
|
|
62
|
+
const data = (response.Result || {});
|
|
63
|
+
return {
|
|
64
|
+
gatewayId: data.GatewayId,
|
|
65
|
+
gatewayName: data.Name,
|
|
66
|
+
protocol: data.Protocol,
|
|
67
|
+
status: data.Status,
|
|
68
|
+
createdTime: data.CreatedTime,
|
|
69
|
+
description: data.Description,
|
|
70
|
+
subDomain: data.SubDomain,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
getGateway: async (gatewayId) => {
|
|
74
|
+
try {
|
|
75
|
+
const response = await client.fetchOpenAPI({
|
|
76
|
+
Action: 'GetGateway',
|
|
77
|
+
Version: '2021-03-03',
|
|
78
|
+
method: 'POST',
|
|
79
|
+
headers: { 'content-type': 'application/json' },
|
|
80
|
+
data: { GatewayId: gatewayId },
|
|
81
|
+
});
|
|
82
|
+
const data = (response.Result || {});
|
|
83
|
+
return {
|
|
84
|
+
gatewayId: data.GatewayId,
|
|
85
|
+
gatewayName: data.Name,
|
|
86
|
+
protocol: data.Protocol,
|
|
87
|
+
status: data.Status,
|
|
88
|
+
createdTime: data.CreatedTime,
|
|
89
|
+
description: data.Description,
|
|
90
|
+
subDomain: data.SubDomain,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
if (error && typeof error === 'object' && 'code' in error) {
|
|
95
|
+
if (error.code === 'ResourceNotFound' || error.code === 'GatewayNotFound') {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
findGatewayByName: async (gatewayName) => {
|
|
103
|
+
const response = await client.fetchOpenAPI({
|
|
104
|
+
Action: 'ListGateways',
|
|
105
|
+
Version: '2021-03-03',
|
|
106
|
+
method: 'POST',
|
|
107
|
+
headers: { 'content-type': 'application/json' },
|
|
108
|
+
data: { Name: gatewayName },
|
|
109
|
+
});
|
|
110
|
+
const result = (response.Result || {});
|
|
111
|
+
const gateways = (result.Gateways || []);
|
|
112
|
+
const gateway = gateways.find((g) => g.Name === gatewayName);
|
|
113
|
+
if (!gateway)
|
|
114
|
+
return null;
|
|
115
|
+
return {
|
|
116
|
+
gatewayId: gateway.GatewayId,
|
|
117
|
+
gatewayName: gateway.Name,
|
|
118
|
+
protocol: gateway.Protocol,
|
|
119
|
+
status: gateway.Status,
|
|
120
|
+
createdTime: gateway.CreatedTime,
|
|
121
|
+
description: gateway.Description,
|
|
122
|
+
subDomain: gateway.SubDomain,
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
updateGateway: async (gatewayId, config) => {
|
|
126
|
+
const params = {
|
|
127
|
+
GatewayId: gatewayId,
|
|
128
|
+
Name: config.groupName,
|
|
129
|
+
...(config.description && { Description: config.description }),
|
|
130
|
+
...(config.protocol && { Protocol: config.protocol }),
|
|
131
|
+
};
|
|
132
|
+
await client.fetchOpenAPI({
|
|
133
|
+
Action: 'UpdateGateway',
|
|
134
|
+
Version: '2021-03-03',
|
|
135
|
+
method: 'POST',
|
|
136
|
+
headers: { 'content-type': 'application/json' },
|
|
137
|
+
data: params,
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
deleteGateway: async (gatewayId) => {
|
|
141
|
+
logger_1.logger.info(lang_1.lang.__('VOLCENGINE_DELETING_APIGW', { gatewayName: gatewayId }));
|
|
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
|
+
};
|
|
162
|
+
const response = await client.fetchOpenAPI({
|
|
163
|
+
Action: 'CreateApi',
|
|
164
|
+
Version: '2021-03-03',
|
|
165
|
+
method: 'POST',
|
|
166
|
+
headers: { 'content-type': 'application/json' },
|
|
167
|
+
data: params,
|
|
168
|
+
});
|
|
169
|
+
const data = (response.Result || {});
|
|
170
|
+
return data.ApiId;
|
|
171
|
+
},
|
|
172
|
+
getApi: async (gatewayId, apiId) => {
|
|
173
|
+
try {
|
|
174
|
+
const response = await client.fetchOpenAPI({
|
|
175
|
+
Action: 'GetApi',
|
|
176
|
+
Version: '2021-03-03',
|
|
177
|
+
method: 'POST',
|
|
178
|
+
headers: { 'content-type': 'application/json' },
|
|
179
|
+
data: { GatewayId: gatewayId, ApiId: apiId },
|
|
180
|
+
});
|
|
181
|
+
const data = (response.Result || {});
|
|
182
|
+
const backendConfig = (data.BackendConfig || {});
|
|
183
|
+
return {
|
|
184
|
+
apiId: data.ApiId,
|
|
185
|
+
apiName: data.Name,
|
|
186
|
+
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
|
+
status: data.Status,
|
|
194
|
+
createdTime: data.CreatedTime,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
if (error && typeof error === 'object' && 'code' in error) {
|
|
199
|
+
if (error.code === 'ResourceNotFound' || error.code === 'ApiNotFound') {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
updateApi: async (apiId, config) => {
|
|
207
|
+
const params = {
|
|
208
|
+
ApiId: apiId,
|
|
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',
|
|
221
|
+
Version: '2021-03-03',
|
|
222
|
+
method: 'POST',
|
|
223
|
+
headers: { 'content-type': 'application/json' },
|
|
224
|
+
data: params,
|
|
225
|
+
});
|
|
226
|
+
},
|
|
227
|
+
deleteApi: async (gatewayId, apiId) => {
|
|
228
|
+
await client.fetchOpenAPI({
|
|
229
|
+
Action: 'DeleteApi',
|
|
230
|
+
Version: '2021-03-03',
|
|
231
|
+
method: 'POST',
|
|
232
|
+
headers: { 'content-type': 'application/json' },
|
|
233
|
+
data: { GatewayId: gatewayId, ApiId: apiId },
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
deployApi: async (gatewayId, apiId) => {
|
|
237
|
+
await client.fetchOpenAPI({
|
|
238
|
+
Action: 'DeployApi',
|
|
239
|
+
Version: '2021-03-03',
|
|
240
|
+
method: 'POST',
|
|
241
|
+
headers: { 'content-type': 'application/json' },
|
|
242
|
+
data: { GatewayId: gatewayId, ApiId: apiId, Stage: 'RELEASE' },
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
bindDomain: async (config) => {
|
|
246
|
+
const params = {
|
|
247
|
+
GatewayId: config.gatewayId,
|
|
248
|
+
DomainName: config.domainName,
|
|
249
|
+
...(config.certificateId && { CertificateId: config.certificateId }),
|
|
250
|
+
};
|
|
251
|
+
await client.fetchOpenAPI({
|
|
252
|
+
Action: 'BindDomain',
|
|
253
|
+
Version: '2021-03-03',
|
|
254
|
+
method: 'POST',
|
|
255
|
+
headers: { 'content-type': 'application/json' },
|
|
256
|
+
data: params,
|
|
257
|
+
});
|
|
258
|
+
logger_1.logger.info(lang_1.lang.__('APIGW_DOMAIN_BOUND_SUCCESS', { domain: config.domainName }));
|
|
259
|
+
},
|
|
260
|
+
unbindDomain: async (gatewayId, domainName) => {
|
|
261
|
+
await client.fetchOpenAPI({
|
|
262
|
+
Action: 'UnbindDomain',
|
|
263
|
+
Version: '2021-03-03',
|
|
264
|
+
method: 'POST',
|
|
265
|
+
headers: { 'content-type': 'application/json' },
|
|
266
|
+
data: { GatewayId: gatewayId, DomainName: domainName },
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
exports.createApigwOperations = createApigwOperations;
|