@axway/axway-central-cli 2.17.0-rc.5 → 2.17.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/dist/cli.js +28 -6
- package/dist/commands/apply/index.js +24 -9
- package/dist/commands/completion/index.js +9 -3
- package/dist/commands/config/common/index.js +11 -2
- package/dist/commands/config/index.js +7 -2
- package/dist/commands/config/list.js +6 -2
- package/dist/commands/config/set.js +31 -4
- package/dist/commands/config/unset.js +12 -2
- package/dist/commands/create/agentResource.js +32 -12
- package/dist/commands/create/environment.js +16 -6
- package/dist/commands/create/index.js +26 -9
- package/dist/commands/create/serviceAccount.js +6 -2
- package/dist/commands/delete/index.js +33 -15
- package/dist/commands/edit/environment.js +21 -6
- package/dist/commands/edit/index.js +8 -4
- package/dist/commands/get/index.js +44 -27
- package/dist/commands/install/agents.js +73 -44
- package/dist/commands/install/apigeexSaasAgents.js +98 -35
- package/dist/commands/install/awsAgents.js +139 -89
- package/dist/commands/install/awsSaasAgents.js +142 -50
- package/dist/commands/install/azureAgents.js +79 -39
- package/dist/commands/install/edgeAgents.js +110 -17
- package/dist/commands/install/helpers/creators.js +70 -17
- package/dist/commands/install/helpers/deleters.js +11 -2
- package/dist/commands/install/helpers/getters.js +30 -4
- package/dist/commands/install/helpers/index.js +48 -13
- package/dist/commands/install/helpers/inputs.js +98 -26
- package/dist/commands/install/helpers/regex.js +34 -29
- package/dist/commands/install/helpers/templates/awsTemplates.js +23 -6
- package/dist/commands/install/helpers/templates/azureTemplates.js +24 -5
- package/dist/commands/install/helpers/templates/edgeTemplates.js +38 -7
- package/dist/commands/install/helpers/templates/istioTemplates.js +16 -5
- package/dist/commands/install/index.js +10 -4
- package/dist/commands/install/istioAgents.js +117 -40
- package/dist/commands/install/platform.js +52 -20
- package/dist/commands/proxies/create.js +18 -2
- package/dist/commands/proxies/index.js +8 -4
- package/dist/commands/proxies/promote.js +21 -2
- package/dist/common/ApiServerClient.js +173 -64
- package/dist/common/CacheController.js +32 -11
- package/dist/common/CliConfigManager.js +27 -14
- package/dist/common/CompositeError.js +30 -6
- package/dist/common/CoreConfigController.js +40 -18
- package/dist/common/DefinitionsManager.js +76 -29
- package/dist/common/Kubectl.js +25 -2
- package/dist/common/PlatformClient.js +63 -19
- package/dist/common/Renderer.js +87 -25
- package/dist/common/TmpFile.js +28 -11
- package/dist/common/bashCommands.js +22 -3
- package/dist/common/basicPrompts.js +43 -8
- package/dist/common/dataService.js +50 -22
- package/dist/common/errorHandler.js +9 -0
- package/dist/common/resultsRenderers.js +42 -10
- package/dist/common/types.js +341 -116
- package/dist/common/utils.js +99 -37
- package/dist/main.js +2 -0
- package/package.json +2 -2
- package/dist/commands/install/gitHubSaasAgents.js +0 -283
|
@@ -4,17 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.transactionLoggingMessages = exports.serviceAccountNameAlreadyExists = exports.selectServiceAccount = exports.selectIngestionProtocol = exports.selectAWSRegion = exports.secretAlreadyExists = exports.namespaceAlreadyExists = exports.k8sClusterMessages = exports.envMessages = exports.enterServiceAccountName = exports.enterPublicKeyPath = exports.enterPrivateKeyPath = exports.enterNamespaceName = exports.enterAWSRegion = exports.createNamespace = exports.createGatewayAgentCredsSecret = exports.createAmplifyAgentKeysSecret = exports.askToEnableTransactionLogging = exports.askServiceAccountName = exports.askPublicKeyPath = exports.askPublicAndPrivateKeysPath = exports.askPrivateKeyPath = exports.askNamespace = exports.askK8sClusterName = exports.askIngestionProtocol = exports.askForSecretName = exports.askEnvironmentName = exports.askDosaClientId = exports.askBundleType = exports.askAgentName = exports.askAWSRegion = exports.agentMessages = void 0;
|
|
7
|
+
|
|
7
8
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
+
|
|
8
10
|
var _inquirer = _interopRequireDefault(require("inquirer"));
|
|
11
|
+
|
|
9
12
|
var _basicPrompts = require("../../../common/basicPrompts");
|
|
13
|
+
|
|
10
14
|
var _Kubectl = require("../../../common/Kubectl");
|
|
15
|
+
|
|
11
16
|
var _PlatformClient = require("../../../common/PlatformClient");
|
|
17
|
+
|
|
12
18
|
var _types = require("../../../common/types");
|
|
19
|
+
|
|
13
20
|
var _getters = require("./getters");
|
|
21
|
+
|
|
14
22
|
var _regex = require("./regex");
|
|
23
|
+
|
|
15
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
16
26
|
const cliNowString = `cli-${Date.now()}`;
|
|
17
|
-
const envMessages =
|
|
27
|
+
const envMessages = {
|
|
18
28
|
createNewEnvironment: 'Create a new environment',
|
|
19
29
|
enterEnvironmentName: 'Enter a new environment name',
|
|
20
30
|
isProduction: 'Is the environment used for production purpose?',
|
|
@@ -23,19 +33,22 @@ const envMessages = exports.envMessages = {
|
|
|
23
33
|
environmentAlreadyExists: 'Environment already exists. Please enter a new name.',
|
|
24
34
|
selectTeam: 'Select a team'
|
|
25
35
|
};
|
|
26
|
-
|
|
36
|
+
exports.envMessages = envMessages;
|
|
37
|
+
const k8sClusterMessages = {
|
|
27
38
|
enterK8sClusterName: 'Enter a unique k8s cluster name',
|
|
28
39
|
getK8sClustersError: 'Get k8sCluster error.',
|
|
29
40
|
k8sClusterAlreadyExists: 'k8sCluster already exists. Please enter a new name.'
|
|
30
41
|
};
|
|
31
|
-
|
|
42
|
+
exports.k8sClusterMessages = k8sClusterMessages;
|
|
43
|
+
const agentMessages = {
|
|
32
44
|
enterDiscoveryAgentName: 'Enter a new discovery agent name',
|
|
33
45
|
enterTraceabilityAgentName: 'Enter a new traceability agent name',
|
|
34
46
|
getAgentsError: 'Error getting agents.',
|
|
35
47
|
agentAlreadyExists: 'Agent already exists. Please enter a new name.',
|
|
36
48
|
selectAgentType: 'Select the type of agent(s) you want to install'
|
|
37
49
|
};
|
|
38
|
-
|
|
50
|
+
exports.agentMessages = agentMessages;
|
|
51
|
+
const transactionLoggingMessages = {
|
|
39
52
|
askToEnableLogging: 'Would you like to enable transaction logging?',
|
|
40
53
|
transactionLoggingInfoMsg: 'Transaction logging is optional and not required for usage and metrics logging.\nTurning on transaction logging can have an impact on performance.',
|
|
41
54
|
enterSamplingPercentage: 'What sampling rate would you like to use? (1-100)',
|
|
@@ -43,17 +56,30 @@ const transactionLoggingMessages = exports.transactionLoggingMessages = {
|
|
|
43
56
|
askReportAllErrors: 'Would you like to report all errors?',
|
|
44
57
|
reportAllErrorsMsg: 'The agents can take out the error transactions from the sampling rate.'
|
|
45
58
|
};
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
59
|
+
exports.transactionLoggingMessages = transactionLoggingMessages;
|
|
60
|
+
const namespaceAlreadyExists = 'Namespace already exists. Please enter a new name.';
|
|
61
|
+
exports.namespaceAlreadyExists = namespaceAlreadyExists;
|
|
62
|
+
const secretAlreadyExists = 'Secret already exists. Please enter a new name.';
|
|
63
|
+
exports.secretAlreadyExists = secretAlreadyExists;
|
|
64
|
+
const enterNamespaceName = 'Enter a new namespace name';
|
|
65
|
+
exports.enterNamespaceName = enterNamespaceName;
|
|
66
|
+
const selectServiceAccount = 'Select a service account';
|
|
67
|
+
exports.selectServiceAccount = selectServiceAccount;
|
|
68
|
+
const enterServiceAccountName = 'Enter a new service account name';
|
|
69
|
+
exports.enterServiceAccountName = enterServiceAccountName;
|
|
70
|
+
const enterPublicKeyPath = 'Enter the file path to the public key';
|
|
71
|
+
exports.enterPublicKeyPath = enterPublicKeyPath;
|
|
72
|
+
const enterPrivateKeyPath = 'Enter the file path to the private key';
|
|
73
|
+
exports.enterPrivateKeyPath = enterPrivateKeyPath;
|
|
74
|
+
const selectIngestionProtocol = 'Select Traceability protocol';
|
|
75
|
+
exports.selectIngestionProtocol = selectIngestionProtocol;
|
|
76
|
+
const serviceAccountNameAlreadyExists = 'Service account already exists. Please enter a new name.';
|
|
77
|
+
exports.serviceAccountNameAlreadyExists = serviceAccountNameAlreadyExists;
|
|
78
|
+
const selectAWSRegion = 'Select an AWS Region';
|
|
79
|
+
exports.selectAWSRegion = selectAWSRegion;
|
|
80
|
+
const enterAWSRegion = 'Enter an AWS Region';
|
|
81
|
+
exports.enterAWSRegion = enterAWSRegion;
|
|
82
|
+
|
|
57
83
|
const askAWSRegion = async (region = '') => {
|
|
58
84
|
let regions = Object.values(_types.AWSRegions).map(str => ({
|
|
59
85
|
name: str,
|
|
@@ -67,6 +93,7 @@ const askAWSRegion = async (region = '') => {
|
|
|
67
93
|
value: 'CREATE_NEW'
|
|
68
94
|
}, ...regions]
|
|
69
95
|
});
|
|
96
|
+
|
|
70
97
|
if (answer === 'CREATE_NEW') {
|
|
71
98
|
return await (0, _basicPrompts.askInput)({
|
|
72
99
|
msg: enterAWSRegion
|
|
@@ -75,7 +102,9 @@ const askAWSRegion = async (region = '') => {
|
|
|
75
102
|
return answer;
|
|
76
103
|
}
|
|
77
104
|
};
|
|
105
|
+
|
|
78
106
|
exports.askAWSRegion = askAWSRegion;
|
|
107
|
+
|
|
79
108
|
const askServiceAccountName = async serviceAccountNames => {
|
|
80
109
|
console.warn(_chalk.default.yellow(`WARNING: Creating a new service account will overwrite any existing "private_key.pem" and "public_key.pem" files in this directory`));
|
|
81
110
|
const name = await (0, _basicPrompts.askInput)({
|
|
@@ -85,13 +114,14 @@ const askServiceAccountName = async serviceAccountNames => {
|
|
|
85
114
|
});
|
|
86
115
|
return name;
|
|
87
116
|
};
|
|
117
|
+
|
|
88
118
|
exports.askServiceAccountName = askServiceAccountName;
|
|
119
|
+
|
|
89
120
|
const askDosaClientId = async (client, showWarning = true) => {
|
|
90
121
|
// Fetch all existing service accounts.
|
|
91
122
|
const serviceAccounts = await client.getServiceAccounts(_PlatformClient.PlatformServiceAccountRole.ApiCentralAdmin);
|
|
92
|
-
const serviceAccountNames = serviceAccounts.map(nextAccount => nextAccount.name);
|
|
123
|
+
const serviceAccountNames = serviceAccounts.map(nextAccount => nextAccount.name); // Ask user to select an existing service account or create a new one.
|
|
93
124
|
|
|
94
|
-
// Ask user to select an existing service account or create a new one.
|
|
95
125
|
const selectedName = await (0, _basicPrompts.askList)({
|
|
96
126
|
msg: selectServiceAccount,
|
|
97
127
|
choices: [{
|
|
@@ -99,6 +129,7 @@ const askDosaClientId = async (client, showWarning = true) => {
|
|
|
99
129
|
value: 'CREATE_NEW'
|
|
100
130
|
}, new _inquirer.default.Separator(), ...serviceAccountNames, new _inquirer.default.Separator()]
|
|
101
131
|
});
|
|
132
|
+
|
|
102
133
|
if (selectedName === 'CREATE_NEW') {
|
|
103
134
|
// We're going to create a new service account. Ask for a unique name. (We'll create it later.)
|
|
104
135
|
const name = await askServiceAccountName(serviceAccountNames);
|
|
@@ -111,9 +142,9 @@ const askDosaClientId = async (client, showWarning = true) => {
|
|
|
111
142
|
// We're using an existing service account. Notify user to make its keys available to the agents.
|
|
112
143
|
if (showWarning) {
|
|
113
144
|
console.log(_chalk.default.yellow('Please make sure your "private_key.pem" and "public_key.pem" files for the selected service account are in this installation folder.'));
|
|
114
|
-
}
|
|
145
|
+
} // Fetch selected service account's client ID and return info about it.
|
|
146
|
+
|
|
115
147
|
|
|
116
|
-
// Fetch selected service account's client ID and return info about it.
|
|
117
148
|
const selectedAccount = serviceAccounts.find(nextAccount => nextAccount.name === selectedName);
|
|
118
149
|
return {
|
|
119
150
|
clientId: selectedAccount === null || selectedAccount === void 0 ? void 0 : selectedAccount.client_id,
|
|
@@ -122,7 +153,9 @@ const askDosaClientId = async (client, showWarning = true) => {
|
|
|
122
153
|
};
|
|
123
154
|
}
|
|
124
155
|
};
|
|
156
|
+
|
|
125
157
|
exports.askDosaClientId = askDosaClientId;
|
|
158
|
+
|
|
126
159
|
const askNamespace = async (msg, defaultValue) => {
|
|
127
160
|
const namespaces = await _Kubectl.kubectl.get('ns');
|
|
128
161
|
if (namespaces.error) throw Error(namespaces.error);
|
|
@@ -133,6 +166,7 @@ const askNamespace = async (msg, defaultValue) => {
|
|
|
133
166
|
value: 'CREATE_NEW'
|
|
134
167
|
}, new _inquirer.default.Separator(), ...namespaces.data, new _inquirer.default.Separator()]
|
|
135
168
|
});
|
|
169
|
+
|
|
136
170
|
if (answer === 'CREATE_NEW') {
|
|
137
171
|
const name = await (0, _basicPrompts.askInput)({
|
|
138
172
|
msg: enterNamespaceName,
|
|
@@ -150,7 +184,9 @@ const askNamespace = async (msg, defaultValue) => {
|
|
|
150
184
|
};
|
|
151
185
|
}
|
|
152
186
|
};
|
|
187
|
+
|
|
153
188
|
exports.askNamespace = askNamespace;
|
|
189
|
+
|
|
154
190
|
const askForSecretName = async (msg, defaultValue, options) => {
|
|
155
191
|
return await (0, _basicPrompts.askInput)({
|
|
156
192
|
msg,
|
|
@@ -158,7 +194,9 @@ const askForSecretName = async (msg, defaultValue, options) => {
|
|
|
158
194
|
validate: (0, _basicPrompts.runValidations)((0, _basicPrompts.validateInputIsNew)(options, secretAlreadyExists), (0, _basicPrompts.validateRegex)(_regex.resourceRegex, (0, _regex.invalidResourceMsg)('Secret')))
|
|
159
195
|
});
|
|
160
196
|
};
|
|
197
|
+
|
|
161
198
|
exports.askForSecretName = askForSecretName;
|
|
199
|
+
|
|
162
200
|
const askIngestionProtocol = async () => {
|
|
163
201
|
return await (0, _basicPrompts.askList)({
|
|
164
202
|
msg: selectIngestionProtocol,
|
|
@@ -171,14 +209,19 @@ const askIngestionProtocol = async () => {
|
|
|
171
209
|
default: _types.IngestionProtocol.Lumberjack
|
|
172
210
|
});
|
|
173
211
|
};
|
|
212
|
+
|
|
174
213
|
exports.askIngestionProtocol = askIngestionProtocol;
|
|
214
|
+
|
|
175
215
|
const askBundleType = async choices => await (0, _basicPrompts.askList)({
|
|
176
216
|
msg: agentMessages.selectAgentType,
|
|
177
217
|
choices: choices
|
|
178
218
|
});
|
|
219
|
+
|
|
179
220
|
exports.askBundleType = askBundleType;
|
|
221
|
+
|
|
180
222
|
const askEnvironmentName = async (client, defsManager, isAxwayManaged = null) => {
|
|
181
223
|
let envs;
|
|
224
|
+
|
|
182
225
|
if (isAxwayManaged == null) {
|
|
183
226
|
// do not filter any environments
|
|
184
227
|
const {
|
|
@@ -204,6 +247,7 @@ const askEnvironmentName = async (client, defsManager, isAxwayManaged = null) =>
|
|
|
204
247
|
});
|
|
205
248
|
if (!axwayManagedEnvs) throw Error(envMessages.getEnvironmentsError);
|
|
206
249
|
envs = axwayManagedEnvs;
|
|
250
|
+
|
|
207
251
|
if (!isAxwayManaged) {
|
|
208
252
|
const {
|
|
209
253
|
data: allEnvs
|
|
@@ -213,14 +257,14 @@ const askEnvironmentName = async (client, defsManager, isAxwayManaged = null) =>
|
|
|
213
257
|
resourceType: 'Environment',
|
|
214
258
|
resourceShortName: 'env'
|
|
215
259
|
});
|
|
216
|
-
if (!allEnvs) throw Error(envMessages.getEnvironmentsError);
|
|
260
|
+
if (!allEnvs) throw Error(envMessages.getEnvironmentsError); // Remove any axway managed envs from the array when isAxwayManaged is false
|
|
217
261
|
|
|
218
|
-
// Remove any axway managed envs from the array when isAxwayManaged is false
|
|
219
262
|
envs = allEnvs.filter(env => {
|
|
220
263
|
return !envs.find(axwayManagedEnv => env.name == axwayManagedEnv.name);
|
|
221
264
|
});
|
|
222
265
|
}
|
|
223
266
|
}
|
|
267
|
+
|
|
224
268
|
let answer = await (0, _basicPrompts.askList)({
|
|
225
269
|
msg: envMessages.selectEnvironment,
|
|
226
270
|
choices: [{
|
|
@@ -228,6 +272,7 @@ const askEnvironmentName = async (client, defsManager, isAxwayManaged = null) =>
|
|
|
228
272
|
value: 'CREATE_NEW'
|
|
229
273
|
}, new _inquirer.default.Separator(), ...envs.map(e => e.name).sort((name1, name2) => name1.localeCompare(name2)), new _inquirer.default.Separator()]
|
|
230
274
|
});
|
|
275
|
+
|
|
231
276
|
if (answer === 'CREATE_NEW') {
|
|
232
277
|
const name = await (0, _basicPrompts.askInput)({
|
|
233
278
|
msg: envMessages.enterEnvironmentName,
|
|
@@ -245,7 +290,9 @@ const askEnvironmentName = async (client, defsManager, isAxwayManaged = null) =>
|
|
|
245
290
|
};
|
|
246
291
|
}
|
|
247
292
|
};
|
|
293
|
+
|
|
248
294
|
exports.askEnvironmentName = askEnvironmentName;
|
|
295
|
+
|
|
249
296
|
const askK8sClusterName = async (client, defsManager) => {
|
|
250
297
|
const {
|
|
251
298
|
data: k8sCluster
|
|
@@ -263,12 +310,16 @@ const askK8sClusterName = async (client, defsManager) => {
|
|
|
263
310
|
});
|
|
264
311
|
return name;
|
|
265
312
|
};
|
|
313
|
+
|
|
266
314
|
exports.askK8sClusterName = askK8sClusterName;
|
|
315
|
+
|
|
267
316
|
const askAgentName = async (client, defsManager, agentType, scopeName) => {
|
|
268
317
|
var _agents;
|
|
318
|
+
|
|
269
319
|
let resourceType;
|
|
270
320
|
let resourceShortName;
|
|
271
321
|
let msg;
|
|
322
|
+
|
|
272
323
|
switch (agentType) {
|
|
273
324
|
case _types.AgentTypes.da:
|
|
274
325
|
{
|
|
@@ -277,6 +328,7 @@ const askAgentName = async (client, defsManager, agentType, scopeName) => {
|
|
|
277
328
|
msg = agentMessages.enterDiscoveryAgentName;
|
|
278
329
|
break;
|
|
279
330
|
}
|
|
331
|
+
|
|
280
332
|
case _types.AgentTypes.ta:
|
|
281
333
|
{
|
|
282
334
|
resourceType = 'TraceabilityAgent';
|
|
@@ -285,6 +337,7 @@ const askAgentName = async (client, defsManager, agentType, scopeName) => {
|
|
|
285
337
|
break;
|
|
286
338
|
}
|
|
287
339
|
}
|
|
340
|
+
|
|
288
341
|
let {
|
|
289
342
|
data: agents
|
|
290
343
|
} = await (0, _getters.getListByResource)({
|
|
@@ -293,8 +346,8 @@ const askAgentName = async (client, defsManager, agentType, scopeName) => {
|
|
|
293
346
|
resourceType,
|
|
294
347
|
resourceShortName,
|
|
295
348
|
scopeName
|
|
296
|
-
});
|
|
297
|
-
|
|
349
|
+
}); // if there are no agents scoped to the env, make the agents list blank to validate against
|
|
350
|
+
|
|
298
351
|
agents = (_agents = agents) !== null && _agents !== void 0 ? _agents : [];
|
|
299
352
|
const name = await (0, _basicPrompts.askInput)({
|
|
300
353
|
msg: msg,
|
|
@@ -303,7 +356,6 @@ const askAgentName = async (client, defsManager, agentType, scopeName) => {
|
|
|
303
356
|
});
|
|
304
357
|
return name;
|
|
305
358
|
};
|
|
306
|
-
|
|
307
359
|
/**
|
|
308
360
|
* @description Create a secret that contains a public & private key pair for agents to connect to central.
|
|
309
361
|
* If a user is creating a new service account, then the keys should be passed in as args.
|
|
@@ -313,7 +365,10 @@ const askAgentName = async (client, defsManager, agentType, scopeName) => {
|
|
|
313
365
|
* @param publicKey The file path to the public key attached to the chosen service account.
|
|
314
366
|
* @param privateKey The file path to the corresponding private key.
|
|
315
367
|
*/
|
|
368
|
+
|
|
369
|
+
|
|
316
370
|
exports.askAgentName = askAgentName;
|
|
371
|
+
|
|
317
372
|
const createAmplifyAgentKeysSecret = async (namespace, secretName, publicKeyName, publicKey, privateKeyName, privateKey) => {
|
|
318
373
|
const {
|
|
319
374
|
error
|
|
@@ -321,14 +376,18 @@ const createAmplifyAgentKeysSecret = async (namespace, secretName, publicKeyName
|
|
|
321
376
|
if (error) throw new Error(error);
|
|
322
377
|
console.log(`Created ${secretName} in the ${namespace} namespace.`);
|
|
323
378
|
};
|
|
379
|
+
|
|
324
380
|
exports.createAmplifyAgentKeysSecret = createAmplifyAgentKeysSecret;
|
|
381
|
+
|
|
325
382
|
const createNamespace = async namespace => {
|
|
326
383
|
const res = await _Kubectl.kubectl.create('ns', namespace);
|
|
327
384
|
if (res.error) throw new Error(res.error);
|
|
328
385
|
console.log(`Created namespace ${namespace}.`);
|
|
329
386
|
return namespace;
|
|
330
387
|
};
|
|
388
|
+
|
|
331
389
|
exports.createNamespace = createNamespace;
|
|
390
|
+
|
|
332
391
|
const createGatewayAgentCredsSecret = async (namespace, secretName, apiManagerAuthUser, apiManagerAuthPass, apiGatewayAuthUser, apiGatewayAuthPass) => {
|
|
333
392
|
const {
|
|
334
393
|
error
|
|
@@ -337,31 +396,40 @@ const createGatewayAgentCredsSecret = async (namespace, secretName, apiManagerAu
|
|
|
337
396
|
--from-literal=APIMANAGER_AUTH_PASSWORD=${apiManagerAuthPass} \
|
|
338
397
|
--from-literal=APIGATEWAY_AUTH_USERNAME=${apiGatewayAuthUser} \
|
|
339
398
|
--from-literal=APIGATEWAY_AUTH_PASSWORD=${apiGatewayAuthPass}`);
|
|
399
|
+
|
|
340
400
|
if (error) {
|
|
341
401
|
throw Error(error);
|
|
342
402
|
}
|
|
403
|
+
|
|
343
404
|
console.log(`Created ${secretName} in the ${namespace} namespace.`);
|
|
344
405
|
};
|
|
406
|
+
|
|
345
407
|
exports.createGatewayAgentCredsSecret = createGatewayAgentCredsSecret;
|
|
408
|
+
|
|
346
409
|
const askPublicKeyPath = async () => await (0, _basicPrompts.askInput)({
|
|
347
410
|
msg: enterPublicKeyPath,
|
|
348
411
|
defaultValue: 'public_key.pem'
|
|
349
412
|
});
|
|
413
|
+
|
|
350
414
|
exports.askPublicKeyPath = askPublicKeyPath;
|
|
415
|
+
|
|
351
416
|
const askPrivateKeyPath = async () => await (0, _basicPrompts.askInput)({
|
|
352
417
|
msg: enterPrivateKeyPath,
|
|
353
418
|
defaultValue: 'private_key.pem'
|
|
354
419
|
});
|
|
420
|
+
|
|
355
421
|
exports.askPrivateKeyPath = askPrivateKeyPath;
|
|
422
|
+
|
|
356
423
|
const askPublicAndPrivateKeysPath = async () => {
|
|
357
424
|
console.log(_chalk.default.yellow('Please provide the same "private_key.pem" and "public_key.pem" that was used to create the selected Service Account.'));
|
|
358
425
|
const publicKey = await askPublicKeyPath();
|
|
359
426
|
const privateKey = await askPrivateKeyPath();
|
|
360
427
|
return [publicKey, privateKey];
|
|
361
|
-
};
|
|
428
|
+
}; // askToEnableTransactionLogging - asks Yes/No question to enable transaction logging, if Yes, configure values for environment variables.
|
|
429
|
+
|
|
362
430
|
|
|
363
|
-
// askToEnableTransactionLogging - asks Yes/No question to enable transaction logging, if Yes, configure values for environment variables.
|
|
364
431
|
exports.askPublicAndPrivateKeysPath = askPublicAndPrivateKeysPath;
|
|
432
|
+
|
|
365
433
|
const askToEnableTransactionLogging = async () => {
|
|
366
434
|
console.log(_chalk.default.gray(transactionLoggingMessages.transactionLoggingInfoMsg));
|
|
367
435
|
const enable = await (0, _basicPrompts.askList)({
|
|
@@ -369,6 +437,7 @@ const askToEnableTransactionLogging = async () => {
|
|
|
369
437
|
choices: _types.YesNoChoices,
|
|
370
438
|
default: _types.YesNo.No
|
|
371
439
|
});
|
|
440
|
+
|
|
372
441
|
if (enable === _types.YesNo.Yes) {
|
|
373
442
|
console.log(_chalk.default.gray(transactionLoggingMessages.samplingPercentageInfoMsg));
|
|
374
443
|
const samplingPercentage = await (0, _basicPrompts.askInput)({
|
|
@@ -377,6 +446,7 @@ const askToEnableTransactionLogging = async () => {
|
|
|
377
446
|
validate: (0, _basicPrompts.runValidations)((0, _basicPrompts.validateRegex)(_regex.percentageRegex, _regex.invalidPercentage))
|
|
378
447
|
});
|
|
379
448
|
let shouldReportAllErrors = _types.YesNo.Yes;
|
|
449
|
+
|
|
380
450
|
if (samplingPercentage < 100) {
|
|
381
451
|
console.log(_chalk.default.gray(transactionLoggingMessages.reportAllErrorsMsg));
|
|
382
452
|
shouldReportAllErrors = await (0, _basicPrompts.askList)({
|
|
@@ -385,6 +455,7 @@ const askToEnableTransactionLogging = async () => {
|
|
|
385
455
|
default: _types.YesNo.Yes
|
|
386
456
|
});
|
|
387
457
|
}
|
|
458
|
+
|
|
388
459
|
return {
|
|
389
460
|
enabled: true,
|
|
390
461
|
samplingPercentage: samplingPercentage,
|
|
@@ -398,4 +469,5 @@ const askToEnableTransactionLogging = async () => {
|
|
|
398
469
|
};
|
|
399
470
|
}
|
|
400
471
|
};
|
|
472
|
+
|
|
401
473
|
exports.askToEnableTransactionLogging = askToEnableTransactionLogging;
|
|
@@ -3,25 +3,37 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.resourceRegex = exports.percentageRegex = exports.namespaceRegex = exports.maskingRegex = exports.invalidResourceMsg = exports.invalidPercentage = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.
|
|
7
|
-
const resourceRegex =
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
6
|
+
exports.resourceRegex = exports.percentageRegex = exports.namespaceRegex = exports.maskingRegex = exports.invalidResourceMsg = exports.invalidPercentage = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.AzureRegexPatterns = exports.AWSRegexPatterns = exports.APIGEEXRegexPatterns = void 0;
|
|
7
|
+
const resourceRegex = '^(?:[a-z0-9]*(?:\\.(?=[a-z0-9])|-+(?=[a-z0-9]))?)+[a-z0-9]$';
|
|
8
|
+
exports.resourceRegex = resourceRegex;
|
|
9
|
+
const namespaceRegex = '^[a-z0-9]?(?:[-a-z0-9]*[a-z0-9]){1,100}?$';
|
|
10
|
+
exports.namespaceRegex = namespaceRegex;
|
|
11
|
+
const domainNameRegex = '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)+([A-Za-z]){2,}$';
|
|
12
|
+
exports.domainNameRegex = domainNameRegex;
|
|
13
|
+
const dosaRegex = '^[\\w\\s-()[\\]]{1,100}$';
|
|
14
|
+
exports.dosaRegex = dosaRegex;
|
|
15
|
+
const percentageRegex = '^[1-9][0-9]?$|^100$';
|
|
16
|
+
exports.percentageRegex = percentageRegex;
|
|
17
|
+
const frequencyRegex = '^(\\d*[d])?(\\d*[h])?(\\d*[m])?$|^$';
|
|
18
|
+
exports.frequencyRegex = frequencyRegex;
|
|
19
|
+
const maskingRegex = '^[a-zA-Z0-9-*#^~.{}]{0,5}$';
|
|
20
|
+
exports.maskingRegex = maskingRegex;
|
|
21
|
+
const invalidPercentage = 'Percentage must be an integer between 1-100';
|
|
22
|
+
exports.invalidPercentage = invalidPercentage;
|
|
23
|
+
const invalidDosaName = 'Account name can contain A-z 0-9 _ - ( ) [ ] and can include 1-100 characters.';
|
|
24
|
+
exports.invalidDosaName = invalidDosaName;
|
|
25
|
+
const invalidNamespace = `Namespace must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character, and be fewer than 100 characters long.`;
|
|
26
|
+
exports.invalidNamespace = invalidNamespace;
|
|
27
|
+
const invalidDomainName = 'The host must be valid according to RFC 1123 specification';
|
|
28
|
+
exports.invalidDomainName = invalidDomainName;
|
|
29
|
+
|
|
18
30
|
const invalidResourceMsg = resource => {
|
|
19
31
|
return `${resource} must consist of lower case alphanumeric characters, ' - ' or '.', and be fewer than 100 characters long`;
|
|
20
|
-
};
|
|
32
|
+
}; // AWSRegexPatterns - regex patters to validate user inputs
|
|
33
|
+
|
|
21
34
|
|
|
22
|
-
// AWSRegexPatterns - regex patters to validate user inputs
|
|
23
35
|
exports.invalidResourceMsg = invalidResourceMsg;
|
|
24
|
-
const AWSRegexPatterns =
|
|
36
|
+
const AWSRegexPatterns = {
|
|
25
37
|
AWS_REGEXP: '^[0-9A-Za-z\\.\\-_]*(?<!/\\.)$',
|
|
26
38
|
AWS_REGEXP_LOG_GROUP_NAME: '^[0-9A-Za-z\\.\\-_]*(?<!/\\.)$|^$',
|
|
27
39
|
AWS_REGEXP_VPC_ID: '^vpc-[0-9a-z]*$|^$',
|
|
@@ -32,23 +44,16 @@ const AWSRegexPatterns = exports.AWSRegexPatterns = {
|
|
|
32
44
|
AWS_REGEXP_SECRET_ACCESS_KEY: '[a-zA-Z0-9+/]{40}',
|
|
33
45
|
AWS_REGEXP_ROLE_ARN: '^arn:aws[a-zA-Z-]*:iam::\\d{12}:role\\/?[a-zA-Z0-9+=,.@\\-_\\/]{1,128}$',
|
|
34
46
|
AWS_ACCESS_LOG_ARN: '^arn:aws[a-zA-Z-]*:logs:[a-zA-Z0-9\-]*:\\d{12}:log-group:[a-zA-Z0-9_\\-\\/\\.#]{1,512}$'
|
|
35
|
-
};
|
|
47
|
+
}; // APIGEEXRegexPatterns - regex patters to validate user inputs
|
|
36
48
|
|
|
37
|
-
|
|
38
|
-
const APIGEEXRegexPatterns =
|
|
49
|
+
exports.AWSRegexPatterns = AWSRegexPatterns;
|
|
50
|
+
const APIGEEXRegexPatterns = {
|
|
39
51
|
APIGEEX_REGEXP_PROJECT_ID: '^[a-z][a-z0-9-]{4,28}[a-z0-9]$',
|
|
40
52
|
AWS_REGEXP_EMAIL_ADDRESS: '^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
|
41
|
-
};
|
|
53
|
+
}; // AzureRegexPatterns - regex patters to validate user inputs
|
|
42
54
|
|
|
43
|
-
|
|
44
|
-
const AzureRegexPatterns =
|
|
55
|
+
exports.APIGEEXRegexPatterns = APIGEEXRegexPatterns;
|
|
56
|
+
const AzureRegexPatterns = {
|
|
45
57
|
azureApiManagementServiceNameRegex: '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'
|
|
46
58
|
};
|
|
47
|
-
|
|
48
|
-
// GitHubRegexPatterns - regex patters to validate user inputs
|
|
49
|
-
const GitHubRegexPatterns = exports.GitHubRegexPatterns = {
|
|
50
|
-
gitHubAccessTokenRegex: '^ghp_[a-zA-Z0-9]{36}$',
|
|
51
|
-
gitHubRepositoryOwnerRegex: '^(?!-)(?!.*--)[a-zA-Z0-9-]{1,37}(?<!-)$',
|
|
52
|
-
gitHubRepositoryNameRegex: '^[\w-\.]+$',
|
|
53
|
-
gitHubFilePathRegex: '^\/.*$'
|
|
54
|
-
};
|
|
59
|
+
exports.AzureRegexPatterns = AzureRegexPatterns;
|
|
@@ -4,26 +4,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.awsTAEnvVarTemplate = exports.awsDAEnvVarTemplate = exports.AWSAgentValues = void 0;
|
|
7
|
+
|
|
7
8
|
var _types = require("../../../../common/types");
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* @description Values to provide to the aws handlebars templates.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
15
|
class AWSAgentValues {
|
|
16
16
|
constructor(awsDeployment) {
|
|
17
17
|
_defineProperty(this, "accessKey", void 0);
|
|
18
|
+
|
|
18
19
|
_defineProperty(this, "secretKey", void 0);
|
|
20
|
+
|
|
19
21
|
_defineProperty(this, "logGroup", void 0);
|
|
22
|
+
|
|
20
23
|
_defineProperty(this, "region", void 0);
|
|
24
|
+
|
|
21
25
|
_defineProperty(this, "daQueueName", void 0);
|
|
26
|
+
|
|
22
27
|
_defineProperty(this, "taQueueName", void 0);
|
|
28
|
+
|
|
23
29
|
_defineProperty(this, "apigwAgentConfigZipFile", void 0);
|
|
30
|
+
|
|
24
31
|
_defineProperty(this, "centralConfig", void 0);
|
|
32
|
+
|
|
25
33
|
_defineProperty(this, "traceabilityConfig", void 0);
|
|
34
|
+
|
|
26
35
|
_defineProperty(this, "cloudFormationConfig", void 0);
|
|
36
|
+
|
|
27
37
|
_defineProperty(this, "updateCloudFormationConfig", () => {
|
|
28
38
|
if (this.cloudFormationConfig.DeploymentType === 'ECS Fargate') {
|
|
29
39
|
this.cloudFormationConfig.ECSCentralOrganizationID = this.centralConfig.orgId;
|
|
@@ -36,6 +46,7 @@ class AWSAgentValues {
|
|
|
36
46
|
this.cloudFormationConfig.ECSCentralTraceabilityHost = _types.IngestionHosts[this.centralConfig.region];
|
|
37
47
|
}
|
|
38
48
|
});
|
|
49
|
+
|
|
39
50
|
this.accessKey = awsDeployment === 'Other' ? '**Insert Access Key**' : '';
|
|
40
51
|
this.secretKey = awsDeployment === 'Other' ? '**Insert Secret Key**' : '';
|
|
41
52
|
this.logGroup = '';
|
|
@@ -47,12 +58,15 @@ class AWSAgentValues {
|
|
|
47
58
|
this.traceabilityConfig = new _types.TraceabilityConfig();
|
|
48
59
|
this.cloudFormationConfig = new _types.CloudFormationConfig();
|
|
49
60
|
}
|
|
50
|
-
}
|
|
51
61
|
|
|
62
|
+
}
|
|
52
63
|
/**
|
|
53
64
|
* @description Generates the AWS TA env vars file.
|
|
54
65
|
*/
|
|
66
|
+
|
|
67
|
+
|
|
55
68
|
exports.AWSAgentValues = AWSAgentValues;
|
|
69
|
+
|
|
56
70
|
const awsTAEnvVarTemplate = () => {
|
|
57
71
|
return `# AWS configs
|
|
58
72
|
AWS_REGION={{region}}
|
|
@@ -103,11 +117,13 @@ LOG_OUTPUT=stdout
|
|
|
103
117
|
LOG_FILE_PATH=logs
|
|
104
118
|
`;
|
|
105
119
|
};
|
|
106
|
-
|
|
107
120
|
/**
|
|
108
121
|
* @description Generates the AWS DA env vars file.
|
|
109
122
|
*/
|
|
123
|
+
|
|
124
|
+
|
|
110
125
|
exports.awsTAEnvVarTemplate = awsTAEnvVarTemplate;
|
|
126
|
+
|
|
111
127
|
const awsDAEnvVarTemplate = () => {
|
|
112
128
|
return `# AWS configs
|
|
113
129
|
AWS_REGION={{region}}
|
|
@@ -142,4 +158,5 @@ LOG_OUTPUT=stdout
|
|
|
142
158
|
LOG_FILE_PATH=logs
|
|
143
159
|
`;
|
|
144
160
|
};
|
|
161
|
+
|
|
145
162
|
exports.awsDAEnvVarTemplate = awsDAEnvVarTemplate;
|
|
@@ -4,27 +4,40 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.azureTAEnvVarTemplate = exports.azureDAEnvVarTemplate = exports.AzureAgentValues = void 0;
|
|
7
|
+
|
|
7
8
|
var _types = require("../../../../common/types");
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* @description Parameters to provide to the Azure handlebars templates.
|
|
13
14
|
*/
|
|
14
15
|
class AzureAgentValues {
|
|
15
16
|
constructor() {
|
|
16
17
|
_defineProperty(this, "apiManagementServiceName", void 0);
|
|
18
|
+
|
|
17
19
|
_defineProperty(this, "eventHubName", void 0);
|
|
20
|
+
|
|
18
21
|
_defineProperty(this, "eventHubNamespace", void 0);
|
|
22
|
+
|
|
19
23
|
_defineProperty(this, "policyKey", void 0);
|
|
24
|
+
|
|
20
25
|
_defineProperty(this, "policyName", void 0);
|
|
26
|
+
|
|
21
27
|
_defineProperty(this, "resourceGroupName", void 0);
|
|
28
|
+
|
|
22
29
|
_defineProperty(this, "servicePrincipalClientId", void 0);
|
|
30
|
+
|
|
23
31
|
_defineProperty(this, "servicePrincipalClientSecret", void 0);
|
|
32
|
+
|
|
24
33
|
_defineProperty(this, "subscriptionId", void 0);
|
|
34
|
+
|
|
25
35
|
_defineProperty(this, "tenantId", void 0);
|
|
36
|
+
|
|
26
37
|
_defineProperty(this, "centralConfig", void 0);
|
|
38
|
+
|
|
27
39
|
_defineProperty(this, "traceabilityConfig", void 0);
|
|
40
|
+
|
|
28
41
|
this.apiManagementServiceName = '';
|
|
29
42
|
this.eventHubName = '';
|
|
30
43
|
this.eventHubNamespace = '';
|
|
@@ -38,12 +51,15 @@ class AzureAgentValues {
|
|
|
38
51
|
this.centralConfig = new _types.CentralAgentConfig();
|
|
39
52
|
this.traceabilityConfig = new _types.TraceabilityConfig();
|
|
40
53
|
}
|
|
41
|
-
}
|
|
42
54
|
|
|
55
|
+
}
|
|
43
56
|
/**
|
|
44
57
|
* @description Generates the Azure TA env vars file.
|
|
45
58
|
*/
|
|
59
|
+
|
|
60
|
+
|
|
46
61
|
exports.AzureAgentValues = AzureAgentValues;
|
|
62
|
+
|
|
47
63
|
const azureTAEnvVarTemplate = () => {
|
|
48
64
|
return `# Azure configs
|
|
49
65
|
AZURE_EVENTHUBNAME={{eventHubName}}
|
|
@@ -96,11 +112,13 @@ LOG_OUTPUT=stdout
|
|
|
96
112
|
LOG_FILE_PATH=logs
|
|
97
113
|
`;
|
|
98
114
|
};
|
|
99
|
-
|
|
100
115
|
/**
|
|
101
116
|
* @description Generates the Azure DA env vars file.
|
|
102
117
|
*/
|
|
118
|
+
|
|
119
|
+
|
|
103
120
|
exports.azureTAEnvVarTemplate = azureTAEnvVarTemplate;
|
|
121
|
+
|
|
104
122
|
const azureDAEnvVarTemplate = () => {
|
|
105
123
|
return `# Azure configs
|
|
106
124
|
AZURE_TENANTID={{tenantId}}
|
|
@@ -132,4 +150,5 @@ LOG_OUTPUT=stdout
|
|
|
132
150
|
LOG_FILE_PATH=logs
|
|
133
151
|
`;
|
|
134
152
|
};
|
|
153
|
+
|
|
135
154
|
exports.azureDAEnvVarTemplate = azureDAEnvVarTemplate;
|