@axway/axway-central-cli 4.5.0 → 4.6.0-rc.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 (83) hide show
  1. package/.security-profile-branches.json +18 -0
  2. package/package.json +1 -1
  3. package/dist/cli.js +0 -71
  4. package/dist/commands/apply/index.js +0 -112
  5. package/dist/commands/completion/index.js +0 -100
  6. package/dist/commands/config/common/index.js +0 -28
  7. package/dist/commands/config/index.js +0 -20
  8. package/dist/commands/config/list.js +0 -24
  9. package/dist/commands/config/set.js +0 -102
  10. package/dist/commands/config/unset.js +0 -48
  11. package/dist/commands/create/agentResource.js +0 -108
  12. package/dist/commands/create/environment.js +0 -62
  13. package/dist/commands/create/index.js +0 -109
  14. package/dist/commands/create/serviceAccount.js +0 -15
  15. package/dist/commands/delete/index.js +0 -196
  16. package/dist/commands/edit/environment.js +0 -101
  17. package/dist/commands/edit/index.js +0 -28
  18. package/dist/commands/get/index.js +0 -272
  19. package/dist/commands/install/agents.js +0 -290
  20. package/dist/commands/install/apigeexAgents.js +0 -223
  21. package/dist/commands/install/apigeexSaasAgents.js +0 -300
  22. package/dist/commands/install/awsAgents.js +0 -525
  23. package/dist/commands/install/awsSaasAgents.js +0 -508
  24. package/dist/commands/install/azureAgents.js +0 -242
  25. package/dist/commands/install/azureSaasAgents.js +0 -519
  26. package/dist/commands/install/backstageAgents.js +0 -167
  27. package/dist/commands/install/edgeAgents.js +0 -409
  28. package/dist/commands/install/gitHubSaasAgents.js +0 -294
  29. package/dist/commands/install/gitLabAgents.js +0 -178
  30. package/dist/commands/install/graylogAgent.js +0 -147
  31. package/dist/commands/install/helpers/creators.js +0 -359
  32. package/dist/commands/install/helpers/deleters.js +0 -36
  33. package/dist/commands/install/helpers/getters.js +0 -95
  34. package/dist/commands/install/helpers/index.js +0 -267
  35. package/dist/commands/install/helpers/inputs.js +0 -593
  36. package/dist/commands/install/helpers/regex.js +0 -67
  37. package/dist/commands/install/helpers/templates/apigeexTemplates.js +0 -109
  38. package/dist/commands/install/helpers/templates/awsTemplates.js +0 -129
  39. package/dist/commands/install/helpers/templates/azureTemplates.js +0 -125
  40. package/dist/commands/install/helpers/templates/backstageTemplates.js +0 -95
  41. package/dist/commands/install/helpers/templates/edgeTemplates.js +0 -360
  42. package/dist/commands/install/helpers/templates/gitLabTemplates.js +0 -66
  43. package/dist/commands/install/helpers/templates/graylogTemplates.js +0 -75
  44. package/dist/commands/install/helpers/templates/ibmAPIConnectTemplates.js +0 -116
  45. package/dist/commands/install/helpers/templates/istioTemplates.js +0 -214
  46. package/dist/commands/install/helpers/templates/kafkaTemplates.js +0 -194
  47. package/dist/commands/install/helpers/templates/sapApiPortalTemplates.js +0 -114
  48. package/dist/commands/install/helpers/templates/softwareAGWebMethodsTemplates.js +0 -93
  49. package/dist/commands/install/helpers/templates/traceableTemplates.js +0 -135
  50. package/dist/commands/install/helpers/templates/wso2Templates.js +0 -85
  51. package/dist/commands/install/helpers/util.js +0 -26
  52. package/dist/commands/install/ibmAPIConnectAgents.js +0 -213
  53. package/dist/commands/install/index.js +0 -36
  54. package/dist/commands/install/istioAgents.js +0 -346
  55. package/dist/commands/install/kafkaAgents.js +0 -303
  56. package/dist/commands/install/platform.js +0 -175
  57. package/dist/commands/install/sapApiPortalAgents.js +0 -198
  58. package/dist/commands/install/softwareAGWebMethodsAgents.js +0 -161
  59. package/dist/commands/install/swaggerHubSaasAgents.js +0 -272
  60. package/dist/commands/install/traceableAgents.js +0 -257
  61. package/dist/commands/install/traceableSaasAgents.js +0 -275
  62. package/dist/commands/install/wso2Agents.js +0 -163
  63. package/dist/commands/productize/helpers/productizationHelper.js +0 -408
  64. package/dist/commands/productize/index.js +0 -99
  65. package/dist/common/ApiServerClient.js +0 -1109
  66. package/dist/common/CacheController.js +0 -146
  67. package/dist/common/CliConfigManager.js +0 -76
  68. package/dist/common/CompositeError.js +0 -95
  69. package/dist/common/CoreConfigController.js +0 -174
  70. package/dist/common/DefinitionsManager.js +0 -298
  71. package/dist/common/Kubectl.js +0 -68
  72. package/dist/common/PlatformClient.js +0 -128
  73. package/dist/common/Renderer.js +0 -409
  74. package/dist/common/TmpFile.js +0 -96
  75. package/dist/common/bashCommands.js +0 -97
  76. package/dist/common/basicPrompts.js +0 -160
  77. package/dist/common/dataService.js +0 -312
  78. package/dist/common/errorHandler.js +0 -46
  79. package/dist/common/modules.d.js +0 -1
  80. package/dist/common/resultsRenderers.js +0 -164
  81. package/dist/common/types.js +0 -746
  82. package/dist/common/utils.js +0 -476
  83. package/dist/main.js +0 -8
@@ -1,175 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTraceabilityConfig = exports.getCentralConfig = exports.getApicDeployment = exports.finalizeCentralInstall = void 0;
7
- var _chalk = _interopRequireDefault(require("chalk"));
8
- var _basicPrompts = require("../../common/basicPrompts");
9
- var _CliConfigManager = require("../../common/CliConfigManager");
10
- var _CoreConfigController = require("../../common/CoreConfigController");
11
- var _types = require("../../common/types");
12
- var _awsAgents = require("./awsAgents");
13
- var helpers = _interopRequireWildcard(require("./helpers"));
14
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- //
17
- // Complex prompts
18
- //
19
- const askTeamName = async client => {
20
- var _teams$find;
21
- const teams = await client.getTeams();
22
- if (!(teams !== null && teams !== void 0 && teams.length)) {
23
- throw new Error('Account has no teams!');
24
- }
25
- return (0, _basicPrompts.askList)({
26
- msg: helpers.envMessages.selectTeam,
27
- choices: teams.map(t => t.name).sort((name1, name2) => name1.localeCompare(name2)),
28
- default: (_teams$find = teams.find(t => t.default)) === null || _teams$find === void 0 ? void 0 : _teams$find.name
29
- });
30
- };
31
- const askIsProductionEnvironment = async () => {
32
- return (await (0, _basicPrompts.askList)({
33
- msg: helpers.envMessages.isProduction,
34
- choices: _types.YesNoChoices,
35
- default: _types.YesNo.Yes
36
- })) === _types.YesNo.Yes;
37
- };
38
- const getTraceabilityConfig = async installConfig => {
39
- let traceabilityConfig = new _types.TraceabilityConfig();
40
- if (installConfig.gatewayType === _types.GatewayTypes.AWS_GATEWAY && installConfig.gatewayConfig.cloudFormationConfig.DeploymentType === _awsAgents.DeploymentTypes.ECS_FARGATE) {
41
- return traceabilityConfig;
42
- }
43
- traceabilityConfig.usageReportingOffline = installConfig.bundleType === _types.BundleType.TRACEABILITY_OFFLINE;
44
- return traceabilityConfig;
45
- };
46
- exports.getTraceabilityConfig = getTraceabilityConfig;
47
- const getCentralConfig = async (apiServerClient, platformClient, defsManager, apicDeployment, installConfig) => {
48
- // initiate CentralAgentConfig
49
- let centralConfig = installConfig.centralConfig;
50
- centralConfig.deployment = apicDeployment || getApicDeployment(centralConfig.region, _CoreConfigController.CoreConfigController.getEnv());
51
-
52
- // apic config
53
- console.log('\nCONNECTION TO AMPLIFY PLATFORM:');
54
- console.log(_chalk.default.gray(`The agents need access to the Amplify Platform to register services.`));
55
-
56
- // create/find environment
57
- centralConfig.orgId = await helpers.getCurrentUserOrgId();
58
- centralConfig.ampcEnvInfo = await helpers.askEnvironmentName(apiServerClient, defsManager, centralConfig.axwayManaged, installConfig.gatewayType);
59
- centralConfig.production = centralConfig.ampcEnvInfo.isNew ? await askIsProductionEnvironment() : false;
60
- if (installConfig.gatewayType === _types.GatewayTypes.GRAYLOG) {
61
- const updatedRefEnvs = await helpers.askReferencedEnvironments(apiServerClient, defsManager, centralConfig.ampcEnvInfo);
62
- const compareRefs = (a, b) => {
63
- return (a === null || a === void 0 ? void 0 : a.length) === (b === null || b === void 0 ? void 0 : b.length) && (a === null || a === void 0 ? void 0 : a.every(element => b === null || b === void 0 ? void 0 : b.includes(element)));
64
- };
65
- if (!compareRefs(updatedRefEnvs, centralConfig.ampcEnvInfo.referencedEnvironments)) {
66
- centralConfig.ampcEnvInfo.referencedEnvironments = updatedRefEnvs;
67
- centralConfig.ampcEnvInfo.isUpdated = true;
68
- }
69
- }
70
- if (!installConfig.switches.isOrgRep) {
71
- centralConfig.ampcTeamName = await askTeamName(platformClient);
72
- }
73
- centralConfig.ampcDosaInfo = {
74
- clientId: '',
75
- name: '',
76
- isNew: false
77
- };
78
- if (installConfig.bundleType !== _types.BundleType.TRACEABILITY_OFFLINE && !installConfig.switches.isHostedInstall) {
79
- centralConfig.ampcDosaInfo = await helpers.askDosaClientId(platformClient);
80
- }
81
-
82
- // Get the DA Agent name
83
- centralConfig.daAgentName = '';
84
- // Istio will not prompt for agent name. Remove when that ability exists
85
- if (installConfig.switches.isDaEnabled && !installConfig.switches.isHostedInstall) {
86
- centralConfig.daAgentName = await helpers.askAgentName(apiServerClient, defsManager, _types.AgentTypes.da, centralConfig.ampcEnvInfo.name);
87
- }
88
-
89
- // Initialize agent names
90
- centralConfig.taAgentName = '';
91
- centralConfig.caAgentName = '';
92
-
93
- // Determine if we should use CA (compliance) or TA agent. Compliance is good for TRACEABLE and GRAYLOG (atm)
94
- const isCaType = installConfig.gatewayType === _types.GatewayTypes.TRACEABLE || installConfig.gatewayType === _types.GatewayTypes.GRAYLOG;
95
- const agentType = isCaType ? _types.AgentTypes.ca : _types.AgentTypes.ta;
96
- const agentNameProperty = isCaType ? 'caAgentName' : 'taAgentName';
97
- if (installConfig.switches.isTaEnabled && !installConfig.switches.isHostedInstall) {
98
- const agentName = await helpers.askAgentName(apiServerClient, defsManager, agentType, centralConfig.ampcEnvInfo.name);
99
- centralConfig[agentNameProperty] = agentName;
100
- }
101
- return centralConfig;
102
- };
103
- exports.getCentralConfig = getCentralConfig;
104
- const finalizeCentralInstall = async (apiServerClient, platformClient, defsManager, installConfig) => {
105
- /**
106
- * Create agent resources
107
- */
108
- console.log('Creating agent resources');
109
- if (installConfig.centralConfig.ampcDosaInfo.isNew) {
110
- installConfig.centralConfig.dosaAccount = await helpers.createDosaAndCerts(platformClient, installConfig.centralConfig.ampcDosaInfo.name);
111
- } else {
112
- installConfig.centralConfig.dosaAccount.clientId = installConfig.centralConfig.ampcDosaInfo.clientId;
113
- }
114
- installConfig.centralConfig.dosaAccount.updateKeyTemplateValues(installConfig.deploymentType);
115
- let refEnvSubResource;
116
- if (installConfig.centralConfig.ampcEnvInfo.referencedEnvironments) {
117
- refEnvSubResource = {
118
- references: {
119
- managedEnvironments: installConfig.centralConfig.ampcEnvInfo.referencedEnvironments
120
- }
121
- };
122
- }
123
-
124
- // environment name
125
- installConfig.centralConfig.environment = installConfig.centralConfig.ampcEnvInfo.isNew ? await helpers.createByResourceType(apiServerClient, defsManager, installConfig.centralConfig.ampcEnvInfo.name, 'Environment', 'env', {
126
- axwayManaged: installConfig.centralConfig.axwayManaged,
127
- production: installConfig.centralConfig.production
128
- }, '', refEnvSubResource) : installConfig.centralConfig.ampcEnvInfo.name;
129
- if (installConfig.centralConfig.ampcEnvInfo.isUpdated) {
130
- await helpers.updateSubResourceType(apiServerClient, defsManager, installConfig.centralConfig.ampcEnvInfo.name, 'Environment', 'env', '', refEnvSubResource);
131
- }
132
-
133
- // Create DiscoveryAgent Resource unless gateway type is Istio. This can be removed when this is available for Istio
134
- if (installConfig.centralConfig.daAgentName != '') {
135
- installConfig.centralConfig.daAgentName = await helpers.createNewAgentResource(apiServerClient, defsManager, installConfig.centralConfig.environment, _types.GatewayTypeToDataPlane[installConfig.gatewayType], _types.AgentResourceKind.da, _types.AgentTypes.da, installConfig.centralConfig.ampcTeamName, installConfig.centralConfig.daAgentName);
136
- }
137
-
138
- // Create TraceabilityAgent Resource
139
- if (installConfig.centralConfig.taAgentName != '') {
140
- installConfig.centralConfig.taAgentName = await helpers.createNewAgentResource(apiServerClient, defsManager, installConfig.centralConfig.environment, _types.GatewayTypeToDataPlane[installConfig.gatewayType], _types.AgentResourceKind.ta, _types.AgentTypes.ta, installConfig.centralConfig.ampcTeamName, installConfig.centralConfig.taAgentName);
141
- }
142
-
143
- // Create ComplianceAgent Resource
144
- if (installConfig.centralConfig.caAgentName != '') {
145
- installConfig.centralConfig.caAgentName = await helpers.createNewAgentResource(apiServerClient, defsManager, installConfig.centralConfig.environment, _types.GatewayTypeToDataPlane[installConfig.gatewayType], _types.AgentResourceKind.ca, _types.AgentTypes.ca, installConfig.centralConfig.ampcTeamName, installConfig.centralConfig.caAgentName, undefined, undefined, undefined, {
146
- managedEnvironment: installConfig.gatewayConfig.centralEnvironments
147
- } // cast applied here
148
- );
149
- }
150
- if (installConfig.bundleType === _types.BundleType.TRACEABILITY_OFFLINE || installConfig.gatewayType === _types.GatewayTypes.ISTIO) {
151
- installConfig.centralConfig.environmentId = await helpers.getEnvironmentId(apiServerClient, defsManager, installConfig.centralConfig.environment);
152
- }
153
- return installConfig;
154
- };
155
- exports.finalizeCentralInstall = finalizeCentralInstall;
156
- const getApicDeployment = (region, env) => {
157
- var _deployments$region;
158
- const deployments = {
159
- [_types.Regions.US]: {
160
- [_types.Platforms.prod]: _types.APICDeployments.US,
161
- [_types.Platforms.staging]: _types.APICDeployments.TEAMS
162
- },
163
- [_types.Regions.EU]: {
164
- [_types.Platforms.prod]: _types.APICDeployments.EU,
165
- [_types.Platforms.staging]: _types.APICDeployments.EUStaging
166
- },
167
- [_types.Regions.AP]: {
168
- [_types.Platforms.prod]: _types.APICDeployments.AP,
169
- [_types.Platforms.staging]: _types.APICDeployments.APStaging
170
- }
171
- };
172
- const savedDeployment = new _CliConfigManager.CliConfigManager().getAll()['apic-deployment'];
173
- return savedDeployment || (deployments === null || deployments === void 0 ? void 0 : (_deployments$region = deployments[region]) === null || _deployments$region === void 0 ? void 0 : _deployments$region[env]) || _types.APICDeployments.US;
174
- };
175
- exports.getApicDeployment = getApicDeployment;
@@ -1,198 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.testables = exports.gatewayConnectivity = exports.defaultLogFiles = exports.completeInstall = exports.askConfigType = exports.askBundleType = exports.SAPAPIPortalInstallMethods = exports.ConfigFiles = void 0;
7
- var _chalk = _interopRequireDefault(require("chalk"));
8
- var _snooplogg = _interopRequireDefault(require("snooplogg"));
9
- var _basicPrompts = require("../../common/basicPrompts");
10
- var _types = require("../../common/types");
11
- var _utils = require("../../common/utils");
12
- var helpers = _interopRequireWildcard(require("./helpers"));
13
- var _sapApiPortalTemplates = require("./helpers/templates/sapApiPortalTemplates");
14
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- // @ts-ignore
17
- const {
18
- log
19
- } = (0, _snooplogg.default)('central: install: agents: SAP API Portal');
20
- const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.SAPAPIPORTAL_DA}`;
21
- const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.SAPAPIPORTAL_TA}`;
22
- const defaultLogFiles = exports.defaultLogFiles = '/group-*_instance-*.log';
23
-
24
- // ConfigFiles - all the config file that are used in the setup
25
- const ConfigFiles = exports.ConfigFiles = {
26
- DAEnvVars: `${helpers.configFiles.DA_ENV_VARS}`,
27
- TAEnvVars: `${helpers.configFiles.TA_ENV_VARS}`,
28
- SAPAPIPortalDABinaryFile: 'discovery_agent',
29
- SAPAPIPortalDAYaml: 'discovery_agent.yml',
30
- SAPAPIPortalTABinaryFile: 'traceability_agent',
31
- SAPAPIPortalTAYaml: 'traceability_agent.yml'
32
- };
33
-
34
- // SAPAPIPortalPrompts - prompts for user inputs
35
- const SAPAPIPortalPrompts = {
36
- configTypeMsg: 'Select the mode of installation',
37
- enterAuthTokenURL: 'Enter the token URL used for agent authentication to SAP',
38
- enterAuthAPIPortalBaseURL: 'Enter the SAP API Portal baseURL',
39
- enterAuthAPIPortalClientID: 'Enter the SAP API Portal ClientID',
40
- enterAuthAPIPortalClientSecret: 'Enter the SAP API Portal ClientSecret',
41
- enterAuthDevPortalBaseURL: 'Enter the SAP Dev Portal baseURL',
42
- enterAuthDevPortalClientID: 'Enter the SAP Dev Portal ClientID',
43
- enterAuthDevPortalClientSecret: 'Enter the SAP Dev Portal ClientSecret',
44
- enterDeveloperEmail: 'Enter the SAP developer email',
45
- selectSpecCreateUnstructuredAPI: 'Select whether to create unstructured APIs for invalid/unknown API specs'
46
- };
47
- const askBundleType = async () => {
48
- return await (0, _basicPrompts.askList)({
49
- msg: helpers.agentMessages.selectAgentType,
50
- choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
51
- });
52
- };
53
- exports.askBundleType = askBundleType;
54
- const askConfigType = async () => {
55
- return _types.AgentConfigTypes.DOCKERIZED;
56
- };
57
-
58
- //
59
- // Questions for the configuration of SAP API Portal agents
60
- //
61
- exports.askConfigType = askConfigType;
62
- const askAuthTokenURL = async () => await (0, _basicPrompts.askInput)({
63
- msg: SAPAPIPortalPrompts.enterAuthTokenURL
64
- });
65
- const askAuthAPIPortalBaseURL = async () => await (0, _basicPrompts.askInput)({
66
- msg: SAPAPIPortalPrompts.enterAuthAPIPortalBaseURL
67
- });
68
- const askAuthAPIPortalClientID = async () => await (0, _basicPrompts.askInput)({
69
- msg: SAPAPIPortalPrompts.enterAuthAPIPortalClientID
70
- });
71
- const askAuthAPIPortalClientSecret = async () => await (0, _basicPrompts.askInput)({
72
- msg: SAPAPIPortalPrompts.enterAuthAPIPortalClientSecret
73
- });
74
- const askAuthDevPortalBaseURL = async () => await (0, _basicPrompts.askInput)({
75
- msg: SAPAPIPortalPrompts.enterAuthDevPortalBaseURL
76
- });
77
- const askAuthDevPortalClientID = async () => await (0, _basicPrompts.askInput)({
78
- msg: SAPAPIPortalPrompts.enterAuthDevPortalClientID
79
- });
80
- const askAuthDevPortalClientSecret = async () => await (0, _basicPrompts.askInput)({
81
- msg: SAPAPIPortalPrompts.enterAuthDevPortalClientSecret
82
- });
83
- const askDeveloperEmail = async () => await (0, _basicPrompts.askInput)({
84
- msg: SAPAPIPortalPrompts.enterDeveloperEmail
85
- });
86
- const askSpecCreateUnstructuredAPI = async () => (await (0, _basicPrompts.askList)({
87
- msg: SAPAPIPortalPrompts.selectSpecCreateUnstructuredAPI,
88
- default: _types.YesNo.No,
89
- choices: _types.YesNoChoices
90
- })) === _types.YesNo.Yes;
91
- const gatewayConnectivity = async installConfig => {
92
- const agentValues = new _sapApiPortalTemplates.SAPApiPortalAgentValues();
93
- console.log('\nCONNECTION TO SAP API Portal:');
94
- console.log(_chalk.default.gray(`The discovery agent needs to connect to the SAP API Portal Gateway to discover API's for publishing to Amplify.\nThe traceability agent needs to connect to SAP API Portal for collecting APIs transactions. These will be forwarded to the Business Insights.\n`));
95
- await askCommonPrompts(agentValues);
96
-
97
- // SAP API Portal Discovery Agent Prompts
98
- if (installConfig.switches.isDaEnabled) {
99
- console.log(_chalk.default.gray(`\nDiscovery Agent Configuration\n`));
100
- await askDiscoveryPrompts(agentValues);
101
- }
102
- return agentValues;
103
- };
104
- exports.gatewayConnectivity = gatewayConnectivity;
105
- const generateSuccessHelpMsg = installConfig => {
106
- if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
107
- console.log(_chalk.default.yellow('\nPlease make sure to copy the "private_key.pem" and "public_key.pem" files for the existing service account you selected.'));
108
- }
109
- dockerSuccessMsg(installConfig);
110
- console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.SAPAPIPORTAL}`));
111
- };
112
- const dockerSuccessMsg = installConfig => {
113
- let dockerInfo;
114
- const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
115
- const runDaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
116
- const runTaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
117
- const runTaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
118
- const startDaLinuxMsg = `\nStart the Discovery Agent on a Linux based machine`;
119
- const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
120
- const startTaLinuxMsg = `\nStart the Traceability Agent on a Linux based machine`;
121
- const startTaWinMsg = `\nStart the Traceability Agent on a Windows machine`;
122
- if (installConfig.switches.isDaEnabled && installConfig.switches.isTaEnabled) {
123
- 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}):`;
124
- } else if (installConfig.switches.isDaEnabled) {
125
- dockerInfo = `To utilize the discovery agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.DA_ENV_VARS}):`;
126
- } else {
127
- dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
128
- }
129
- console.log(_chalk.default.whiteBright(dockerInfo), '\n');
130
- if (installConfig.switches.isDaEnabled) {
131
- const daImageVersion = `${daImage}:${installConfig.daVersion}`;
132
- console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
133
- console.log(_chalk.default.cyan(`docker pull ${daImageVersion}`));
134
- console.log(_chalk.default.white(_utils.isWindows ? startDaWinMsg : startDaLinuxMsg));
135
- console.log(_chalk.default.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
136
- console.log('\t', _chalk.default.cyan(`-v /data ${daImageVersion}`), '\n');
137
- }
138
- if (installConfig.switches.isTaEnabled) {
139
- const taImageVersion = `${taImage}:${installConfig.taVersion}`;
140
- console.log(_chalk.default.white('Pull the latest image of the Traceability Agent:'));
141
- console.log(_chalk.default.cyan(`docker pull ${taImageVersion}`));
142
- console.log(_chalk.default.white(_utils.isWindows ? startTaWinMsg : startTaLinuxMsg));
143
- console.log(_chalk.default.cyan(_utils.isWindows ? runTaWinMsg : runTaLinuxMsg));
144
- console.log('\t', _chalk.default.cyan(`-v /data ${taImageVersion}`), '\n');
145
- }
146
- };
147
- async function askCommonPrompts(agentValues) {
148
- agentValues.authTokenURL = await askAuthTokenURL();
149
- agentValues.authAPIPortalBaseURL = await askAuthAPIPortalBaseURL();
150
- agentValues.authAPIPortalClientID = await askAuthAPIPortalClientID();
151
- agentValues.authAPIPortalClientSecret = await askAuthAPIPortalClientSecret();
152
- }
153
-
154
- // SAP API Portal DA prompts
155
- async function askDiscoveryPrompts(agentValues) {
156
- agentValues.authDevPortalBaseURL = await askAuthDevPortalBaseURL();
157
- agentValues.authDevPortalClientID = await askAuthDevPortalClientID();
158
- agentValues.authDevPortalClientSecret = await askAuthDevPortalClientSecret();
159
- agentValues.developerEmail = await askDeveloperEmail();
160
- agentValues.specCreateUnstructuredAPI = await askSpecCreateUnstructuredAPI();
161
- }
162
- const completeInstall = async installConfig => {
163
- /**
164
- * Create agent resources
165
- */
166
- const agentValues = installConfig.gatewayConfig;
167
-
168
- // Add final settings to SAP API Portal agentValues
169
- agentValues.centralConfig = installConfig.centralConfig;
170
- agentValues.traceabilityConfig = installConfig.traceabilityConfig;
171
- console.log('Generating the configuration file(s)...');
172
- if (installConfig.switches.isDaEnabled) {
173
- (0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, agentValues, _sapApiPortalTemplates.sapAPIPortalDAEnvVarTemplate);
174
- }
175
- if (installConfig.switches.isTaEnabled) {
176
- (0, _utils.writeTemplates)(ConfigFiles.TAEnvVars, agentValues, _sapApiPortalTemplates.sapAPIPortalTAEnvVarTemplate);
177
- }
178
- console.log('Configuration file(s) have been successfully created.\n');
179
- generateSuccessHelpMsg(installConfig);
180
- };
181
- exports.completeInstall = completeInstall;
182
- const SAPAPIPortalInstallMethods = exports.SAPAPIPortalInstallMethods = {
183
- GetBundleType: askBundleType,
184
- GetDeploymentType: askConfigType,
185
- AskGatewayQuestions: gatewayConnectivity,
186
- FinalizeGatewayInstall: completeInstall,
187
- ConfigFiles: Object.values(ConfigFiles),
188
- AgentNameMap: {
189
- [_types.AgentTypes.da]: _types.AgentNames.SAPAPIPORTAL_DA,
190
- [_types.AgentTypes.ta]: _types.AgentNames.SAPAPIPORTAL_TA
191
- },
192
- GatewayDisplay: _types.GatewayTypes.SAPAPIPORTAL
193
- };
194
- const testables = exports.testables = {
195
- SAPAPIPortalPrompts,
196
- ConfigFiles,
197
- defaultLogFiles
198
- };
@@ -1,161 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.testables = exports.gatewayConnectivity = exports.completeInstall = exports.askConfigType = exports.askBundleType = exports.SoftwareAGWebMethodsInstallMethods = exports.ConfigFiles = void 0;
7
- var _chalk = _interopRequireDefault(require("chalk"));
8
- var _snooplogg = _interopRequireDefault(require("snooplogg"));
9
- var _basicPrompts = require("../../common/basicPrompts");
10
- var _types = require("../../common/types");
11
- var _utils = require("../../common/utils");
12
- var helpers = _interopRequireWildcard(require("./helpers"));
13
- var _softwareAGWebMethodsTemplates = require("./helpers/templates/softwareAGWebMethodsTemplates");
14
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- // @ts-ignore
17
- const {
18
- log
19
- } = (0, _snooplogg.default)('central: install: agents: Software AG Web Methods');
20
- const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.SOFTWAREAGWEBMETHODS_DA}`;
21
- const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.SOFTWAREAGWEBMETHODS_TA}`;
22
-
23
- // ConfigFiles - all the config file that are used in the setup
24
- const ConfigFiles = exports.ConfigFiles = {
25
- DAEnvVars: `${helpers.configFiles.DA_ENV_VARS}`,
26
- TAEnvVars: `${helpers.configFiles.TA_ENV_VARS}`
27
- };
28
-
29
- // WebMethods - prompts for user inputs
30
- const prompts = {
31
- pathURL: 'Enter the base URL to connect to your Software AG WebMethods API service',
32
- pathUsername: 'Enter the username to authenticate to Software AG WebMethods',
33
- pathPassword: 'Enter the password to authenticate to Software AG WebMethods',
34
- pathOauth2Server: 'Enter the OAuth2 server to authenticate. Defaults to local gateway auth'
35
- };
36
- const askBundleType = async () => {
37
- return await (0, _basicPrompts.askList)({
38
- msg: helpers.agentMessages.selectAgentType,
39
- choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
40
- });
41
- };
42
- exports.askBundleType = askBundleType;
43
- const askConfigType = async () => {
44
- return _types.AgentConfigTypes.DOCKERIZED;
45
- };
46
-
47
- //
48
- // Questions for the configuration of Software AG WebMethods agents
49
- //
50
- exports.askConfigType = askConfigType;
51
- async function askCommonPrompts(webMethodsAgentValues) {
52
- // Software AG WebMethods Path URL
53
- webMethodsAgentValues.pathURL = await askPathURL();
54
- // Software AG WebMethods Path Username
55
- webMethodsAgentValues.pathUsername = await askPathUsername();
56
- // Software AG WebMethods Path Password
57
- webMethodsAgentValues.pathPassword = await askPathPassword();
58
- // Software AG WebMethods Path Oauth2Server
59
- webMethodsAgentValues.pathOauth2Server = await askPathOauth2Server();
60
- if (webMethodsAgentValues.pathOauth2Server.trim() === '') {
61
- webMethodsAgentValues.pathOauth2Server = 'local';
62
- }
63
- }
64
- const askPathURL = async () => await (0, _basicPrompts.askInput)({
65
- msg: prompts.pathURL
66
- });
67
- const askPathUsername = async () => await (0, _basicPrompts.askInput)({
68
- msg: prompts.pathUsername
69
- });
70
- const askPathPassword = async () => await (0, _basicPrompts.askInput)({
71
- msg: prompts.pathPassword
72
- });
73
- const askPathOauth2Server = async () => await (0, _basicPrompts.askInput)({
74
- msg: prompts.pathOauth2Server,
75
- allowEmptyInput: true,
76
- defaultValue: "local"
77
- });
78
- const gatewayConnectivity = async installConfig => {
79
- const webMethodsAgentValues = new _softwareAGWebMethodsTemplates.SoftwareAGWebMethodsAgentValues();
80
- console.log('\nCONNECTION TO Software AG WebMethods:');
81
- console.log(_chalk.default.gray(`The discovery agent needs to connect to the Software AG WebMethods Gateway to discover API's for publishing to Amplify.\nThe traceability agent needs to connect to Software AG WebMethods for collecting APIs transactions. These will be forwarded to the Business Insights.\n`));
82
- if (installConfig.switches.isDaEnabled || installConfig.switches.isTaEnabled) {
83
- await askCommonPrompts(webMethodsAgentValues);
84
- }
85
- return webMethodsAgentValues;
86
- };
87
- exports.gatewayConnectivity = gatewayConnectivity;
88
- const generateSuccessHelpMsg = installConfig => {
89
- if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
90
- console.log(_chalk.default.yellow('\nPlease make sure to copy the "private_key.pem" and "public_key.pem" files for the existing service account you selected.'));
91
- }
92
- dockerSuccessMsg(installConfig);
93
- console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.SOFTWAREAGWEBMETHODS}`));
94
- };
95
- const dockerSuccessMsg = installConfig => {
96
- let dockerInfo;
97
- const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
98
- const runDaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
99
- const runTaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
100
- const runTaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
101
- const startDaLinuxMsg = `\nStart the Discovery Agent on a Linux based machine`;
102
- const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
103
- const startTaLinuxMsg = `\nStart the Traceability Agent on a Linux based machine`;
104
- const startTaWinMsg = `\nStart the Traceability Agent on a Windows machine`;
105
- if (installConfig.switches.isDaEnabled && installConfig.switches.isTaEnabled) {
106
- 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}):`;
107
- } else if (installConfig.switches.isDaEnabled) {
108
- dockerInfo = `To utilize the discovery agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.DA_ENV_VARS}):`;
109
- } else {
110
- dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
111
- }
112
- console.log(_chalk.default.whiteBright(dockerInfo), '\n');
113
- if (installConfig.switches.isDaEnabled) {
114
- const daImageVersion = `${daImage}:${installConfig.daVersion}`;
115
- console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
116
- console.log(_chalk.default.cyan(`docker pull ${daImageVersion}`));
117
- console.log(_chalk.default.white(_utils.isWindows ? startDaWinMsg : startDaLinuxMsg));
118
- console.log(_chalk.default.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
119
- console.log('\t', _chalk.default.cyan(`-v /data ${daImageVersion}`), '\n');
120
- }
121
- if (installConfig.switches.isTaEnabled) {
122
- const taImageVersion = `${taImage}:${installConfig.taVersion}`;
123
- console.log(_chalk.default.white('Pull the latest image of the Traceability Agent:'));
124
- console.log(_chalk.default.cyan(`docker pull ${taImageVersion}`));
125
- console.log(_chalk.default.white(_utils.isWindows ? startTaWinMsg : startTaLinuxMsg));
126
- console.log(_chalk.default.cyan(_utils.isWindows ? runTaWinMsg : runTaLinuxMsg));
127
- console.log('\t', _chalk.default.cyan(`-v /data ${taImageVersion}`), '\n');
128
- }
129
- };
130
- const completeInstall = async installConfig => {
131
- // Add final settings to softwareAGWebMethodsAgentValues
132
- const softwareAGWebMethodsAgentValues = installConfig.gatewayConfig;
133
- softwareAGWebMethodsAgentValues.centralConfig = installConfig.centralConfig;
134
- softwareAGWebMethodsAgentValues.traceabilityConfig = installConfig.traceabilityConfig;
135
- console.log('Generating the configuration file(s)...');
136
- if (installConfig.switches.isDaEnabled) {
137
- (0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, softwareAGWebMethodsAgentValues, helpers.softwareAGWebMethodsDAEnvVarTemplate);
138
- }
139
- if (installConfig.switches.isTaEnabled) {
140
- (0, _utils.writeTemplates)(ConfigFiles.TAEnvVars, softwareAGWebMethodsAgentValues, helpers.softwareAGWebMethodsTAEnvVarTemplate);
141
- }
142
- console.log('Configuration file(s) have been successfully created.\n');
143
- generateSuccessHelpMsg(installConfig);
144
- };
145
- exports.completeInstall = completeInstall;
146
- const SoftwareAGWebMethodsInstallMethods = exports.SoftwareAGWebMethodsInstallMethods = {
147
- GetBundleType: askBundleType,
148
- GetDeploymentType: askConfigType,
149
- AskGatewayQuestions: gatewayConnectivity,
150
- FinalizeGatewayInstall: completeInstall,
151
- ConfigFiles: Object.values(ConfigFiles),
152
- AgentNameMap: {
153
- [_types.AgentTypes.da]: _types.AgentNames.SOFTWAREAGWEBMETHODS_DA,
154
- [_types.AgentTypes.ta]: _types.AgentNames.SOFTWAREAGWEBMETHODS_TA
155
- },
156
- GatewayDisplay: _types.GatewayTypes.SOFTWAREAGWEBMETHODS
157
- };
158
- const testables = exports.testables = {
159
- prompts,
160
- ConfigFiles
161
- };