@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.
Files changed (58) hide show
  1. package/dist/cli.js +28 -6
  2. package/dist/commands/apply/index.js +24 -9
  3. package/dist/commands/completion/index.js +9 -3
  4. package/dist/commands/config/common/index.js +11 -2
  5. package/dist/commands/config/index.js +7 -2
  6. package/dist/commands/config/list.js +6 -2
  7. package/dist/commands/config/set.js +31 -4
  8. package/dist/commands/config/unset.js +12 -2
  9. package/dist/commands/create/agentResource.js +32 -12
  10. package/dist/commands/create/environment.js +16 -6
  11. package/dist/commands/create/index.js +26 -9
  12. package/dist/commands/create/serviceAccount.js +6 -2
  13. package/dist/commands/delete/index.js +33 -15
  14. package/dist/commands/edit/environment.js +21 -6
  15. package/dist/commands/edit/index.js +8 -4
  16. package/dist/commands/get/index.js +44 -27
  17. package/dist/commands/install/agents.js +73 -44
  18. package/dist/commands/install/apigeexSaasAgents.js +98 -35
  19. package/dist/commands/install/awsAgents.js +139 -89
  20. package/dist/commands/install/awsSaasAgents.js +142 -50
  21. package/dist/commands/install/azureAgents.js +79 -39
  22. package/dist/commands/install/edgeAgents.js +110 -17
  23. package/dist/commands/install/helpers/creators.js +70 -17
  24. package/dist/commands/install/helpers/deleters.js +11 -2
  25. package/dist/commands/install/helpers/getters.js +30 -4
  26. package/dist/commands/install/helpers/index.js +48 -13
  27. package/dist/commands/install/helpers/inputs.js +98 -26
  28. package/dist/commands/install/helpers/regex.js +34 -29
  29. package/dist/commands/install/helpers/templates/awsTemplates.js +23 -6
  30. package/dist/commands/install/helpers/templates/azureTemplates.js +24 -5
  31. package/dist/commands/install/helpers/templates/edgeTemplates.js +38 -7
  32. package/dist/commands/install/helpers/templates/istioTemplates.js +16 -5
  33. package/dist/commands/install/index.js +10 -4
  34. package/dist/commands/install/istioAgents.js +117 -40
  35. package/dist/commands/install/platform.js +52 -20
  36. package/dist/commands/proxies/create.js +18 -2
  37. package/dist/commands/proxies/index.js +8 -4
  38. package/dist/commands/proxies/promote.js +21 -2
  39. package/dist/common/ApiServerClient.js +173 -64
  40. package/dist/common/CacheController.js +32 -11
  41. package/dist/common/CliConfigManager.js +27 -14
  42. package/dist/common/CompositeError.js +30 -6
  43. package/dist/common/CoreConfigController.js +40 -18
  44. package/dist/common/DefinitionsManager.js +76 -29
  45. package/dist/common/Kubectl.js +25 -2
  46. package/dist/common/PlatformClient.js +63 -19
  47. package/dist/common/Renderer.js +87 -25
  48. package/dist/common/TmpFile.js +28 -11
  49. package/dist/common/bashCommands.js +22 -3
  50. package/dist/common/basicPrompts.js +43 -8
  51. package/dist/common/dataService.js +50 -22
  52. package/dist/common/errorHandler.js +9 -0
  53. package/dist/common/resultsRenderers.js +42 -10
  54. package/dist/common/types.js +341 -116
  55. package/dist/common/utils.js +99 -37
  56. package/dist/main.js +2 -0
  57. package/package.json +2 -2
  58. package/dist/commands/install/gitHubSaasAgents.js +0 -283
@@ -4,35 +4,51 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.testables = exports.prompts = exports.installPreprocess = exports.gatewayConnectivity = exports.dockerPublicKey = exports.dockerPrivateKey = exports.completeInstall = exports.askOrganizationReplication = exports.askIsGatewayOnlyMode = exports.askConfigType = exports.askBundleTypeGWOnly = exports.askBundleType = exports.EdgeInstallMethods = exports.EdgeGWOnlyInstallMethods = exports.ConfigFiles = void 0;
7
+
7
8
  var _cliKit = require("cli-kit");
9
+
8
10
  var _fs = _interopRequireDefault(require("fs"));
11
+
9
12
  var _snooplogg = _interopRequireDefault(require("snooplogg"));
13
+
10
14
  var _basicPrompts = require("../../common/basicPrompts");
15
+
11
16
  var _dataService = require("../../common/dataService");
17
+
12
18
  var _Kubectl = require("../../common/Kubectl");
19
+
13
20
  var _types = require("../../common/types");
21
+
14
22
  var _utils = require("../../common/utils");
23
+
15
24
  var _agents = require("./agents");
25
+
16
26
  var helpers = _interopRequireWildcard(require("./helpers"));
27
+
17
28
  var _edgeTemplates = require("./helpers/templates/edgeTemplates");
29
+
18
30
  var _istioAgents = require("./istioAgents");
19
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
31
+
32
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
+
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
+
21
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
+
22
38
  const defaultLogFiles = '/group-*_instance-*.log';
23
39
  const defaultOTLogFiles = '/group-*_instance-*_traffic*.log';
24
- const dockerPrivateKey = exports.dockerPrivateKey = '/keys/private_key.pem';
25
- const dockerPublicKey = exports.dockerPublicKey = '/keys/public_key.pem';
40
+ const dockerPrivateKey = '/keys/private_key.pem';
41
+ exports.dockerPrivateKey = dockerPrivateKey;
42
+ const dockerPublicKey = '/keys/public_key.pem'; // @ts-ignore
26
43
 
27
- // @ts-ignore
44
+ exports.dockerPublicKey = dockerPublicKey;
28
45
  const {
29
46
  log
30
47
  } = (0, _snooplogg.default)('central: install: agents: edge');
31
48
  const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.EDGE_DA}`;
32
- const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.EDGE_TA}`;
49
+ const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.EDGE_TA}`; // ConfigFiles - all the config file that are used in the setup
33
50
 
34
- // ConfigFiles - all the config file that are used in the setup
35
- const ConfigFiles = exports.ConfigFiles = {
51
+ const ConfigFiles = {
36
52
  DAEnvVars: `${helpers.configFiles.DA_ENV_VARS}`,
37
53
  DAHelmOverride: 'da-overrides.yaml',
38
54
  EdgeDABinaryFile: 'discovery_agent',
@@ -42,7 +58,8 @@ const ConfigFiles = exports.ConfigFiles = {
42
58
  TAEnvVars: `${helpers.configFiles.TA_ENV_VARS}`,
43
59
  TAHelmOverride: 'ta-overrides.yaml'
44
60
  };
45
- const prompts = exports.prompts = {
61
+ exports.ConfigFiles = ConfigFiles;
62
+ const prompts = {
46
63
  configTypeMsg: 'Select the mode of installation',
47
64
  askApiGatewayHost: 'Enter the API Gateway hostname',
48
65
  askApiGatewayPort: 'Enter the API Gateway port',
@@ -55,6 +72,8 @@ const prompts = exports.prompts = {
55
72
  enterGatewayManagerMode: 'Do you want to use API Manager with the API Gateway',
56
73
  askIfOrgReplication: 'Do you want to replicate your original organization structure for your newly discovered APIs? If yes, make sure the organization names match the team names that are created in Amplify platform'
57
74
  };
75
+ exports.prompts = prompts;
76
+
58
77
  const downloadV7AgentBundle = async (type, version) => {
59
78
  const fileName = type === _types.BundleType.DISCOVERY ? `discovery_agent-${version}.zip` : `traceability_agent-${version}.zip`;
60
79
  const url = type === _types.BundleType.DISCOVERY ? `/v7_discovery_agent/${version}/discovery_agent-${version}.zip` : `/v7_traceability_agent/${version}/traceability_agent-${version}.zip`;
@@ -62,6 +81,7 @@ const downloadV7AgentBundle = async (type, version) => {
62
81
  baseUrl: _types.PublicRepoUrl,
63
82
  basePath: _types.BasePaths.V7Agents
64
83
  });
84
+
65
85
  try {
66
86
  const {
67
87
  stream
@@ -72,21 +92,28 @@ const downloadV7AgentBundle = async (type, version) => {
72
92
  throw new Error(`Failed to download the agent: ${err.message}`);
73
93
  }
74
94
  };
95
+
75
96
  const downloadBinary = async (bundleType, version) => {
76
97
  const fileName = await downloadV7AgentBundle(bundleType, version);
77
98
  await helpers.unzip(fileName);
99
+
78
100
  _fs.default.unlinkSync(fileName);
79
101
  };
102
+
80
103
  const downloadBinaries = async installConfig => {
81
104
  console.log('Downloading and unpacking binary files...');
105
+
82
106
  if (installConfig.switches.isDaEnabled) {
83
107
  await downloadBinary(_types.BundleType.DISCOVERY, installConfig.daVersion);
84
108
  }
109
+
85
110
  if (installConfig.switches.isTaEnabled) {
86
111
  await downloadBinary(_types.BundleType.TRACEABILITY, installConfig.taVersion);
87
112
  }
113
+
88
114
  console.log('Downloading and unpacking is complete.');
89
115
  };
116
+
90
117
  const askIsGatewayOnlyMode = async () => {
91
118
  const mode = await (0, _basicPrompts.askList)({
92
119
  msg: prompts.enterGatewayManagerMode,
@@ -95,7 +122,9 @@ const askIsGatewayOnlyMode = async () => {
95
122
  });
96
123
  return mode == _types.YesNo.Yes ? _types.GatewayTypes.EDGE_GATEWAY : _types.GatewayTypes.EDGE_GATEWAY_ONLY;
97
124
  };
125
+
98
126
  exports.askIsGatewayOnlyMode = askIsGatewayOnlyMode;
127
+
99
128
  const askOrganizationReplication = async () => {
100
129
  const mode = await (0, _basicPrompts.askList)({
101
130
  msg: prompts.askIfOrgReplication,
@@ -104,28 +133,36 @@ const askOrganizationReplication = async () => {
104
133
  });
105
134
  return mode == _types.YesNo.Yes;
106
135
  };
136
+
107
137
  exports.askOrganizationReplication = askOrganizationReplication;
138
+
108
139
  const askBundleType = async () => {
109
140
  return await (0, _basicPrompts.askList)({
110
141
  msg: helpers.agentMessages.selectAgentType,
111
142
  choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
112
143
  });
113
144
  };
145
+
114
146
  exports.askBundleType = askBundleType;
147
+
115
148
  const askBundleTypeGWOnly = async () => {
116
149
  return await (0, _basicPrompts.askList)({
117
150
  msg: helpers.agentMessages.selectAgentType,
118
151
  choices: [_types.BundleType.TRACEABILITY, _types.BundleType.TRACEABILITY_OFFLINE]
119
152
  });
120
153
  };
154
+
121
155
  exports.askBundleTypeGWOnly = askBundleTypeGWOnly;
156
+
122
157
  const askConfigType = async () => {
123
158
  return await (0, _basicPrompts.askList)({
124
159
  msg: prompts.configTypeMsg,
125
160
  choices: [_types.AgentConfigTypes.BINARIES, _types.AgentConfigTypes.DOCKERIZED, _types.AgentConfigTypes.HELM]
126
161
  });
127
162
  };
163
+
128
164
  exports.askConfigType = askConfigType;
165
+
129
166
  const askLoggingSource = async () => {
130
167
  console.log(_cliKit.chalk.white(`\nThe API Gateway can provide the API traffic either within event logs or open traffic logs.`));
131
168
  return (await (0, _basicPrompts.askList)({
@@ -134,6 +171,7 @@ const askLoggingSource = async () => {
134
171
  choices: [_types.LoggingSource.Event, _types.LoggingSource.OpenTraffic]
135
172
  })) === _types.LoggingSource.OpenTraffic;
136
173
  };
174
+
137
175
  const askEventsPath = async isOpenTraffic => {
138
176
  return await (0, _basicPrompts.askInput)({
139
177
  msg: isOpenTraffic ? prompts.askOpenTrafficPath : prompts.askEventsPath,
@@ -141,12 +179,14 @@ const askEventsPath = async isOpenTraffic => {
141
179
  type: 'string'
142
180
  });
143
181
  };
182
+
144
183
  const askApiManagerHost = async () => {
145
184
  return await (0, _basicPrompts.askInput)({
146
185
  msg: prompts.askApiManagerHost,
147
186
  defaultValue: _agents.localhost
148
187
  });
149
188
  };
189
+
150
190
  const askApiManagerPort = async () => {
151
191
  return await (0, _basicPrompts.askInput)({
152
192
  msg: prompts.askApiManagerPort,
@@ -154,12 +194,14 @@ const askApiManagerPort = async () => {
154
194
  type: 'number'
155
195
  });
156
196
  };
197
+
157
198
  const askApiGatewayHost = async () => {
158
199
  return await (0, _basicPrompts.askInput)({
159
200
  msg: prompts.askApiGatewayHost,
160
201
  defaultValue: _agents.localhost
161
202
  });
162
203
  };
204
+
163
205
  const askApiGatewayPort = async () => {
164
206
  return await (0, _basicPrompts.askInput)({
165
207
  msg: prompts.askApiGatewayPort,
@@ -167,42 +209,53 @@ const askApiGatewayPort = async () => {
167
209
  type: 'number'
168
210
  });
169
211
  };
212
+
170
213
  const gatewayConnectivity = async installConfig => {
171
214
  let v7AgentValues = new _edgeTemplates.V7AgentValues();
215
+
172
216
  if (installConfig.switches.isHelmInstall) {
173
217
  const {
174
218
  error
175
219
  } = await _Kubectl.kubectl.isInstalled();
220
+
176
221
  if (error) {
177
222
  throw new Error(`Kubectl is required to fill out the following prompts. It appears to be missing or misconfigured.\n${error}`);
178
223
  }
179
224
  }
225
+
180
226
  if (!installConfig.switches.isGatewayOnly || installConfig.switches.isDaEnabled) {
181
227
  console.log('\nCONNECTION TO API MANAGER:');
182
228
  console.log(_cliKit.chalk.gray(`The agents need to connect to the Axway API Manager to discover APIs for publishing to Amplify Central and/or the Unified Catalog.\n` + `Use the credentials of an API Manager Administrator user or an Organization Administrator user.`));
229
+
183
230
  if (installConfig.switches.isHelmInstall) {
184
231
  console.log(_cliKit.chalk.white(`Please use the name of the API Manager Service as hostname.`));
185
232
  }
233
+
186
234
  v7AgentValues.apiManagerHost = await askApiManagerHost();
187
235
  v7AgentValues.apiManagerPort = await askApiManagerPort();
188
236
  const apimCreds = await (0, _basicPrompts.askUsernameAndPassword)('the API Manager', 'apiadmin');
189
237
  v7AgentValues.apiManagerAuthUser = apimCreds.username;
190
238
  v7AgentValues.apiManagerAuthPass = apimCreds.password;
191
239
  }
240
+
192
241
  if (installConfig.switches.isTaEnabled) {
193
242
  v7AgentValues.isOpenTraffic = await askLoggingSource();
243
+
194
244
  if (!v7AgentValues.isOpenTraffic) {
195
245
  console.log('\nCONNECTION TO API GATEWAY:');
196
246
  console.log(_cliKit.chalk.gray(`The traceability agent needs to connect to Axway API Gateway.\n` + `Use the credentials of an Operator user.`));
247
+
197
248
  if (installConfig.switches.isHelmInstall) {
198
249
  console.log(_cliKit.chalk.white(`Please use the name of the API Gateway Service as hostname.`));
199
250
  }
251
+
200
252
  v7AgentValues.apiGatewayHost = await askApiGatewayHost();
201
253
  v7AgentValues.apiGatewayPort = await askApiGatewayPort();
202
254
  const apigwCreds = await (0, _basicPrompts.askUsernameAndPassword)('the API Gateway', 'admin');
203
255
  v7AgentValues.apiGatewayAuthUser = apigwCreds.username;
204
256
  v7AgentValues.apiGatewayAuthPass = apigwCreds.password;
205
257
  }
258
+
206
259
  if (installConfig.switches.isBinaryInstall || installConfig.switches.isDockerInstall) {
207
260
  const eventLogPaths = await askEventsPath(v7AgentValues.isOpenTraffic);
208
261
  const trimmedDir = eventLogPaths.trim();
@@ -210,21 +263,28 @@ const gatewayConnectivity = async installConfig => {
210
263
  v7AgentValues.eventLogPathTemplate = installConfig.switches.isBinaryInstall ? `${v7AgentValues.eventLogPath}${v7AgentValues.isOpenTraffic ? defaultOTLogFiles : defaultLogFiles}` : '';
211
264
  }
212
265
  }
266
+
213
267
  if (installConfig.switches.isHelmInstall) {
214
268
  v7AgentValues.namespace = await helpers.askNamespace(prompts.enterGatewayAgentNs, _istioAgents.amplifyAgentsNs);
215
269
  }
270
+
216
271
  return v7AgentValues;
217
272
  };
273
+
218
274
  exports.gatewayConnectivity = gatewayConnectivity;
275
+
219
276
  const generateSuccessHelpMsg = installConfig => {
220
277
  var _v7AgentValues$eventL;
278
+
221
279
  const v7AgentValues = installConfig.gatewayConfig;
222
280
  const configType = installConfig.deploymentType;
223
281
  const trimmedDir = (_v7AgentValues$eventL = v7AgentValues.eventLogPath) === null || _v7AgentValues$eventL === void 0 ? void 0 : _v7AgentValues$eventL.trim();
224
282
  const verifiedEventsPath = v7AgentValues.eventLogPath ? trimmedDir[trimmedDir.length - 1] === '/' ? `${trimmedDir.slice(0, -1)}:/events` : `${trimmedDir}:/events` : '';
283
+
225
284
  if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
226
285
  console.log(_cliKit.chalk.yellow('\nPlease make sure to copy the "private_key.pem" and "public_key.pem" files for the existing service account you selected.'));
227
286
  }
287
+
228
288
  if (configType === _types.AgentConfigTypes.BINARIES) {
229
289
  binarySuccessMsg(installConfig.centralConfig.ampcDosaInfo.isNew, installConfig.switches.isDaEnabled, installConfig.switches.isTaEnabled);
230
290
  } else if (configType === _types.AgentConfigTypes.DOCKERIZED) {
@@ -232,52 +292,62 @@ const generateSuccessHelpMsg = installConfig => {
232
292
  } else if (installConfig.switches.isHelmInstall) {
233
293
  helmSuccessMsg(v7AgentValues.namespace.name, installConfig.switches.isDaEnabled, installConfig.switches.isTaEnabled);
234
294
  }
295
+
235
296
  console.log(_cliKit.chalk.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.V7}`));
236
297
  };
298
+
237
299
  const installPreprocess = async installConfig => {
238
300
  // Ask for key paths if HELM, and dosa NOT new
239
301
  if (installConfig.deploymentType === _types.AgentConfigTypes.HELM && !installConfig.centralConfig.ampcDosaInfo.isNew) {
240
302
  [installConfig.centralConfig.dosaAccount.publicKey, installConfig.centralConfig.dosaAccount.privateKey] = await helpers.askPublicAndPrivateKeysPath();
241
- }
303
+ } // attempt to download the binaries prior to creating resources
304
+
242
305
 
243
- // attempt to download the binaries prior to creating resources
244
306
  if (installConfig.switches.isBinaryInstall) {
245
307
  await downloadBinaries(installConfig);
246
308
  }
309
+
247
310
  return installConfig;
248
311
  };
312
+
249
313
  exports.installPreprocess = installPreprocess;
314
+
250
315
  const completeInstall = async installConfig => {
251
316
  /**
252
317
  * Create agent resources
253
318
  */
254
- const v7AgentValues = installConfig.gatewayConfig;
319
+ const v7AgentValues = installConfig.gatewayConfig; // Add final settings to v7AgentsValues
255
320
 
256
- // Add final settings to v7AgentsValues
257
321
  v7AgentValues.centralConfig = installConfig.centralConfig;
258
322
  v7AgentValues.traceabilityConfig = installConfig.traceabilityConfig;
259
323
  v7AgentValues.isGatewayOnly = installConfig.switches.isGatewayOnly;
260
324
  v7AgentValues.daVersion = installConfig.daVersion;
261
325
  v7AgentValues.taVersion = installConfig.taVersion;
326
+
262
327
  if (installConfig.switches.isHelmInstall) {
263
328
  if (v7AgentValues.namespace.isNew) {
264
329
  await helpers.createNamespace(v7AgentValues.namespace.name);
265
330
  }
331
+
266
332
  await helpers.createSecret(v7AgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, async () => {
267
333
  if (installConfig.centralConfig.ampcDosaInfo.isNew) {
268
334
  console.log(_cliKit.chalk.yellow(`The secret '${helpers.amplifyAgentsKeysSecret}' will be created with the same "private_key.pem" and "public_key.pem" that was auto generated to create the Service Account.`));
269
335
  }
336
+
270
337
  await helpers.createAmplifyAgentKeysSecret(v7AgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, 'public_key', v7AgentValues.centralConfig.dosaAccount.publicKey, 'private_key', v7AgentValues.centralConfig.dosaAccount.privateKey);
271
338
  });
272
339
  await helpers.createSecret(v7AgentValues.namespace.name, helpers.amplifyAgentsCredsSecret, async () => {
273
340
  await helpers.createGatewayAgentCredsSecret(v7AgentValues.namespace.name, helpers.amplifyAgentsCredsSecret, v7AgentValues.apiManagerAuthUser, v7AgentValues.apiManagerAuthPass, v7AgentValues.apiGatewayAuthUser, v7AgentValues.apiGatewayAuthPass);
274
341
  });
275
342
  }
343
+
276
344
  console.log('Generating the configuration file(s)...');
345
+
277
346
  if (installConfig.switches.isHelmInstall) {
278
347
  if (installConfig.switches.isDaEnabled) {
279
348
  (0, _utils.writeTemplates)(ConfigFiles.DAHelmOverride, v7AgentValues, helpers.v7DAHelmOverrideTemplate);
280
349
  }
350
+
281
351
  if (installConfig.switches.isTaEnabled) {
282
352
  (0, _utils.writeTemplates)(ConfigFiles.TAHelmOverride, v7AgentValues, helpers.v7TAHelmOverrideTemplate);
283
353
  }
@@ -285,14 +355,18 @@ const completeInstall = async installConfig => {
285
355
  if (installConfig.switches.isDaEnabled) {
286
356
  (0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, v7AgentValues, helpers.v7DAEnvVarTemplate);
287
357
  }
358
+
288
359
  if (installConfig.switches.isTaEnabled) {
289
360
  (0, _utils.writeTemplates)(ConfigFiles.TAEnvVars, v7AgentValues, helpers.v7TAEnvVarTemplate);
290
361
  }
291
362
  }
363
+
292
364
  console.log('Configuration file(s) have been successfully created.\n');
293
365
  generateSuccessHelpMsg(installConfig);
294
366
  };
367
+
295
368
  exports.completeInstall = completeInstall;
369
+
296
370
  const dockerSuccessMsg = (installConfig, eventLogPath) => {
297
371
  let dockerInfo;
298
372
  const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
@@ -303,6 +377,7 @@ const dockerSuccessMsg = (installConfig, eventLogPath) => {
303
377
  const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
304
378
  const startTaLinuxMsg = `\nStart the Traceability Agent on a Linux based machine`;
305
379
  const startTaWinMsg = `\nStart the Traceability Agent on a Windows machine`;
380
+
306
381
  if (installConfig.switches.isDaEnabled && installConfig.switches.isTaEnabled) {
307
382
  dockerInfo = `To utilize the agents, pull the latest Docker images and run them using the appropriate supplied environment files, (${helpers.configFiles.DA_ENV_VARS} & ${helpers.configFiles.TA_ENV_VARS}):`;
308
383
  } else if (installConfig.switches.isDaEnabled) {
@@ -310,7 +385,9 @@ const dockerSuccessMsg = (installConfig, eventLogPath) => {
310
385
  } else {
311
386
  dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
312
387
  }
388
+
313
389
  console.log(_cliKit.chalk.whiteBright(dockerInfo), '\n');
390
+
314
391
  if (installConfig.switches.isDaEnabled) {
315
392
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
316
393
  console.log(_cliKit.chalk.white('Pull the latest image of the Discovery Agent:'));
@@ -319,6 +396,7 @@ const dockerSuccessMsg = (installConfig, eventLogPath) => {
319
396
  console.log(_cliKit.chalk.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
320
397
  console.log('\t', _cliKit.chalk.cyan(`-v /data ${daImageVersion}`));
321
398
  }
399
+
322
400
  if (installConfig.switches.isTaEnabled) {
323
401
  const taImageVersion = `${taImage}:${installConfig.taVersion}`;
324
402
  console.log(_cliKit.chalk.white('Pull the latest image of the Traceability Agent:'));
@@ -328,51 +406,63 @@ const dockerSuccessMsg = (installConfig, eventLogPath) => {
328
406
  console.log('\t', _cliKit.chalk.cyan(`-v ${eventLogPath} -v /data ${taImageVersion}`));
329
407
  }
330
408
  };
409
+
331
410
  const binarySuccessMsg = (isNewDosa, isDaEnabled, isTaEnabled) => {
332
411
  const daFiles = [ConfigFiles.DAEnvVars, ConfigFiles.EdgeDABinaryFile, ConfigFiles.EdgeDAYaml];
333
412
  const taFiles = [ConfigFiles.TAEnvVars, ConfigFiles.EdgeTABinaryFile, ConfigFiles.EdgeTAYaml];
334
413
  const keys = ['private_key.pem', 'public_key.pem'];
335
414
  let files = [];
415
+
336
416
  if (isNewDosa) {
337
417
  files = files.concat(keys);
338
418
  }
419
+
339
420
  if (isDaEnabled) {
340
421
  files = files.concat(daFiles);
341
422
  }
423
+
342
424
  if (isTaEnabled) {
343
425
  files = files.concat(taFiles);
344
426
  }
427
+
345
428
  const agents = isDaEnabled && isTaEnabled ? 'agents' : 'agent';
346
429
  console.log(_cliKit.chalk.whiteBright('Please copy following files from current folder to API Gateway machine:'));
347
430
  console.log(_cliKit.chalk.cyan(files.join('\n')));
348
431
  console.log(_cliKit.chalk.whiteBright('for example'), _cliKit.chalk.cyan(`scp ${files.join(' ')} root@host:~/some_folder/`));
349
432
  console.log(_cliKit.chalk.whiteBright(`\nTo start the ${agents}:`));
433
+
350
434
  if (isDaEnabled) {
351
435
  console.log(_cliKit.chalk.cyan(`./discovery_agent --envFile ./${helpers.configFiles.DA_ENV_VARS}`));
352
436
  }
437
+
353
438
  if (isTaEnabled) {
354
439
  console.log(_cliKit.chalk.cyan(`./traceability_agent --envFile ./${helpers.configFiles.TA_ENV_VARS}`));
355
440
  }
356
441
  };
442
+
357
443
  const helmSuccessMsg = (namespace, isDaEnabled, isTaEnabled) => {
358
444
  let finishUp = 'helm repo update\n';
445
+
359
446
  if (isDaEnabled) {
360
447
  console.log(_cliKit.chalk.white(`Discovery Agent override file has been placed at ${process.cwd()}/${ConfigFiles.DAHelmOverride}`));
361
448
  finishUp += `helm upgrade --install --namespace ${namespace} v7-discovery axway/v7-discovery -f ${ConfigFiles.DAHelmOverride}\n`;
362
449
  }
450
+
363
451
  if (isTaEnabled) {
364
452
  console.log(_cliKit.chalk.white(`Traceability Agent override file has been placed at ${process.cwd()}/${ConfigFiles.TAHelmOverride}`));
365
453
  finishUp += `helm upgrade --install --namespace ${namespace} v7-traceability axway/v7-traceability -f ${ConfigFiles.TAHelmOverride}`;
366
454
  }
455
+
367
456
  console.log(_cliKit.chalk.white('\nTo deploy the Agents run the following commands\n'));
368
457
  console.log(_cliKit.chalk.cyan('helm repo add axway https://charts.axway.com/charts'));
369
458
  console.log(_cliKit.chalk.cyan(finishUp));
370
459
  };
460
+
371
461
  const edgeAgentNameMap = {
372
462
  [_types.AgentTypes.da]: _types.AgentNames.EDGE_DA,
373
463
  [_types.AgentTypes.ta]: _types.AgentNames.EDGE_TA
374
464
  };
375
- const EdgeInstallMethods = exports.EdgeInstallMethods = {
465
+ const EdgeInstallMethods = {
376
466
  GetBundleType: askBundleType,
377
467
  GetDeploymentType: askConfigType,
378
468
  AskGatewayQuestions: gatewayConnectivity,
@@ -382,7 +472,8 @@ const EdgeInstallMethods = exports.EdgeInstallMethods = {
382
472
  AgentNameMap: edgeAgentNameMap,
383
473
  GatewayDisplay: _types.GatewayTypes.EDGE_GATEWAY
384
474
  };
385
- const EdgeGWOnlyInstallMethods = exports.EdgeGWOnlyInstallMethods = {
475
+ exports.EdgeInstallMethods = EdgeInstallMethods;
476
+ const EdgeGWOnlyInstallMethods = {
386
477
  GetBundleType: askBundleTypeGWOnly,
387
478
  GetDeploymentType: askConfigType,
388
479
  AskGatewayQuestions: gatewayConnectivity,
@@ -392,9 +483,11 @@ const EdgeGWOnlyInstallMethods = exports.EdgeGWOnlyInstallMethods = {
392
483
  AgentNameMap: edgeAgentNameMap,
393
484
  GatewayDisplay: _types.GatewayTypes.EDGE_GATEWAY
394
485
  };
395
- const testables = exports.testables = {
486
+ exports.EdgeGWOnlyInstallMethods = EdgeGWOnlyInstallMethods;
487
+ const testables = {
396
488
  prompts,
397
489
  ConfigFiles,
398
490
  defaultLogFiles,
399
491
  defaultOTLogFiles
400
- };
492
+ };
493
+ exports.testables = testables;