@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,242 +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.ConfigFiles = exports.AzureInstallMethods = 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 _azureTemplates = require("./helpers/templates/azureTemplates");
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)('engage: install: agents: azure');
20
- const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.AZURE_DA}`;
21
- const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.AZURE_TA}`;
22
- const InvalidMessages = {
23
- enterApiManagementServiceName: `The API Management Service Name can contain only letters, numbers and hyphens. The first character must be a letter and last character must be a letter or a number.`
24
- };
25
- const defaultLogFiles = exports.defaultLogFiles = '/group-*_instance-*.log';
26
-
27
- // ConfigFiles - all the config file that are used in the setup
28
- const ConfigFiles = exports.ConfigFiles = {
29
- DAEnvVars: `${helpers.configFiles.DA_ENV_VARS}`,
30
- TAEnvVars: `${helpers.configFiles.TA_ENV_VARS}`,
31
- AzureDABinaryFile: 'discovery_agent',
32
- AzureDAYaml: 'discovery_agent.yml',
33
- AzureTABinaryFile: 'traceability_agent',
34
- AzureTAYaml: 'traceability_agent.yml'
35
- };
36
-
37
- // AzurePrompts - prompts for user inputs
38
- const AzurePrompts = {
39
- configTypeMsg: 'Select the mode of installation',
40
- enterEventHubName: 'Enter the Azure Event Hub Name',
41
- enterEventHubNamespace: 'Enter the Azure Event Hub Namespace',
42
- enterPolicyKey: 'Enter the Azure Policy Key',
43
- enterPolicyName: 'Enter the Azure Policy Name',
44
- enterTenantId: 'Enter the Azure Tenant ID',
45
- enterSubscriptionId: 'Enter the Azure Subscription ID',
46
- enterServicePrincipalClientId: 'Enter the Azure Service Principal Client ID',
47
- enterServicePrincipalClientSecret: 'Enter the Azure Service Principal Client Secret',
48
- enterResourceGroupName: 'Enter the Azure Resource Group Name',
49
- enterApiManagementServiceName: 'Enter the Azure API Management Service Name'
50
- };
51
- const askBundleType = async gateway => {
52
- console.log(gateway);
53
- if (gateway === _types.GatewayTypes.AZURE_GATEWAY) {
54
- return await (0, _basicPrompts.askList)({
55
- msg: helpers.agentMessages.selectAgentType,
56
- choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
57
- });
58
- } else {
59
- return _types.BundleType.DISCOVERY;
60
- }
61
- };
62
- exports.askBundleType = askBundleType;
63
- const askConfigType = async () => {
64
- return _types.AgentConfigTypes.DOCKERIZED;
65
- };
66
-
67
- //
68
- // Questions for the configuration of Azure agents
69
- //
70
- exports.askConfigType = askConfigType;
71
- const askAzureTenantId = async () => await (0, _basicPrompts.askInput)({
72
- msg: AzurePrompts.enterTenantId
73
- });
74
- const askAzureSubscriptionId = async () => await (0, _basicPrompts.askInput)({
75
- msg: AzurePrompts.enterSubscriptionId
76
- });
77
- const askAzureServicePrincipalClientId = async () => await (0, _basicPrompts.askInput)({
78
- msg: AzurePrompts.enterServicePrincipalClientId
79
- });
80
- const askAzureServicePrincipalClientSecret = async () => await (0, _basicPrompts.askInput)({
81
- msg: AzurePrompts.enterServicePrincipalClientSecret
82
- });
83
- const askAzureResourceGroupName = async () => await (0, _basicPrompts.askInput)({
84
- msg: AzurePrompts.enterResourceGroupName
85
- });
86
- const askAzureapiManagementServiceName = async () => await (0, _basicPrompts.askInput)({
87
- msg: AzurePrompts.enterApiManagementServiceName,
88
- validate: (0, _basicPrompts.validateRegex)(helpers.AzureRegexPatterns.azureApiManagementServiceNameRegex, InvalidMessages.enterApiManagementServiceName)
89
- });
90
- const askAzureEventHubNamespace = async () => await (0, _basicPrompts.askInput)({
91
- msg: AzurePrompts.enterEventHubNamespace
92
- });
93
- const askAzureEventHubName = async () => await (0, _basicPrompts.askInput)({
94
- msg: AzurePrompts.enterEventHubName
95
- });
96
- const askAzurePolicyName = async () => await (0, _basicPrompts.askInput)({
97
- msg: AzurePrompts.enterPolicyName,
98
- defaultValue: 'RootManageSharedAccessKey'
99
- });
100
- const askAzurePolicyKey = async () => await (0, _basicPrompts.askInput)({
101
- msg: AzurePrompts.enterPolicyKey
102
- });
103
- const gatewayConnectivity = async installConfig => {
104
- const azureAgentValues = new _azureTemplates.AzureAgentValues();
105
- if (installConfig.gatewayType === _types.GatewayTypes.AZURE_EVENTHUB) {
106
- azureAgentValues.isAzureEventHub = true;
107
- console.log('\nCONNECTION TO AZURE EVENTHUB:');
108
- console.log(_chalk.default.gray(`The discovery agent needs to connect to the Azure EventHub to discover API's for publishing to Amplify.\n`));
109
- } else {
110
- console.log('\nCONNECTION TO AZURE:');
111
- console.log(_chalk.default.gray(`The discovery agent needs to connect to the Azure API Gateway to discover API's for publishing to Amplify.\nThe traceability agent needs to connect to an Azure Event Hub for collecting APIs transactions. These will be forwarded to the Business Insights.\n`));
112
- }
113
-
114
- // Azure Discovery Agent Prompts
115
- if (installConfig.switches.isDaEnabled) {
116
- console.log(_chalk.default.gray(`\nDiscovery Agent Configuration\nThe discovery agent needs to connect to Azure using a service principal with password based authentication. Refer to https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli for creating such service principal using Azure CLI.`));
117
- await askDiscoveryPrompts(azureAgentValues, installConfig.gatewayType);
118
- }
119
-
120
- // Azure Traceability Agent Prompts
121
- if (installConfig.switches.isTaEnabled) {
122
- console.log(_chalk.default.gray(`\nTraceability Agent Configuration\nThe traceability agent needs to connect to Azure Event Hub using a Policy. Refer to https://docs.microsoft.com/en-us/azure/event-hubs/authorize-access-shared-access-signature.`));
123
- await askTraceabilityPrompts(azureAgentValues);
124
- // ask discovery prompts without asking for an agent name, or displaying the Discovery Configuration message
125
- if (installConfig.switches.isTaEnabled && !installConfig.switches.isDaEnabled) {
126
- await askDiscoveryPrompts(azureAgentValues, installConfig.gatewayType);
127
- }
128
- }
129
- return azureAgentValues;
130
- };
131
- exports.gatewayConnectivity = gatewayConnectivity;
132
- const generateSuccessHelpMsg = installConfig => {
133
- if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
134
- 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.'));
135
- }
136
- dockerSuccessMsg(installConfig);
137
- console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.AZURE}`));
138
- };
139
- const dockerSuccessMsg = installConfig => {
140
- let dockerInfo;
141
- const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
142
- const runDaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
143
- const runTaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
144
- const runTaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
145
- const startDaLinuxMsg = `\nStart the Discovery Agent on a Linux based machine`;
146
- const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
147
- const startTaLinuxMsg = `\nStart the Traceability Agent on a Linux based machine`;
148
- const startTaWinMsg = `\nStart the Traceability Agent on a Windows machine`;
149
- if (installConfig.switches.isDaEnabled && installConfig.switches.isTaEnabled) {
150
- 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}):`;
151
- } else if (installConfig.switches.isDaEnabled) {
152
- dockerInfo = `To utilize the discovery agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.DA_ENV_VARS}):`;
153
- } else {
154
- dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
155
- }
156
- console.log(_chalk.default.whiteBright(dockerInfo), '\n');
157
- if (installConfig.switches.isDaEnabled) {
158
- const daImageVersion = `${daImage}:${installConfig.daVersion}`;
159
- console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
160
- console.log(_chalk.default.cyan(`docker pull ${daImageVersion}`));
161
- console.log(_chalk.default.white(_utils.isWindows ? startDaWinMsg : startDaLinuxMsg));
162
- console.log(_chalk.default.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
163
- console.log('\t', _chalk.default.cyan(`-v /data ${daImageVersion}`), '\n');
164
- }
165
- if (installConfig.switches.isTaEnabled) {
166
- const taImageVersion = `${taImage}:${installConfig.taVersion}`;
167
- console.log(_chalk.default.white('Pull the latest image of the Traceability Agent:'));
168
- console.log(_chalk.default.cyan(`docker pull ${taImageVersion}`));
169
- console.log(_chalk.default.white(_utils.isWindows ? startTaWinMsg : startTaLinuxMsg));
170
- console.log(_chalk.default.cyan(_utils.isWindows ? runTaWinMsg : runTaLinuxMsg));
171
- console.log('\t', _chalk.default.cyan(`-v /data ${taImageVersion}`), '\n');
172
- }
173
- };
174
-
175
- // Azure DA prompts
176
- async function askDiscoveryPrompts(azureAgentValues, gatewayType) {
177
- // Azure Tenant Id
178
- azureAgentValues.tenantId = await askAzureTenantId();
179
- // Azure Subscription Id
180
- azureAgentValues.subscriptionId = await askAzureSubscriptionId();
181
- // Azure Service Principal Client Id
182
- azureAgentValues.servicePrincipalClientId = await askAzureServicePrincipalClientId();
183
- // Azure Service Principal Client Secret
184
- azureAgentValues.servicePrincipalClientSecret = await askAzureServicePrincipalClientSecret();
185
- // Azure Resource Group Name
186
- azureAgentValues.resourceGroupName = await askAzureResourceGroupName();
187
- if (gatewayType === _types.GatewayTypes.AZURE_GATEWAY) {
188
- // Azure API Management Service Name
189
- azureAgentValues.apiManagementServiceName = await askAzureapiManagementServiceName();
190
- }
191
- if (gatewayType === _types.GatewayTypes.AZURE_EVENTHUB) {
192
- // Azure Event Hub Namespace
193
- azureAgentValues.eventHubNamespace = await askAzureEventHubNamespace();
194
- }
195
- }
196
- async function askTraceabilityPrompts(azureAgentValues) {
197
- // Azure Event Hub Namespace
198
- azureAgentValues.eventHubNamespace = await askAzureEventHubNamespace();
199
- // Azure Event Hub Name
200
- azureAgentValues.eventHubName = await askAzureEventHubName();
201
- // Azure Policy Name
202
- azureAgentValues.policyName = await askAzurePolicyName();
203
- // Azure Policy Key
204
- azureAgentValues.policyKey = await askAzurePolicyKey();
205
- }
206
- const completeInstall = async installConfig => {
207
- /**
208
- * Create agent resources
209
- */
210
- const azureAgentValues = installConfig.gatewayConfig;
211
-
212
- // Add final settings to azureAgentsValues
213
- azureAgentValues.centralConfig = installConfig.centralConfig;
214
- azureAgentValues.traceabilityConfig = installConfig.traceabilityConfig;
215
- console.log('Generating the configuration file(s)...');
216
- if (installConfig.switches.isDaEnabled) {
217
- (0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, azureAgentValues, helpers.azureDAEnvVarTemplate);
218
- }
219
- if (installConfig.switches.isTaEnabled) {
220
- (0, _utils.writeTemplates)(ConfigFiles.TAEnvVars, azureAgentValues, helpers.azureTAEnvVarTemplate);
221
- }
222
- console.log('Configuration file(s) have been successfully created.\n');
223
- generateSuccessHelpMsg(installConfig);
224
- };
225
- exports.completeInstall = completeInstall;
226
- const AzureInstallMethods = exports.AzureInstallMethods = {
227
- GetBundleType: askBundleType,
228
- GetDeploymentType: askConfigType,
229
- AskGatewayQuestions: gatewayConnectivity,
230
- FinalizeGatewayInstall: completeInstall,
231
- ConfigFiles: Object.values(ConfigFiles),
232
- AgentNameMap: {
233
- [_types.AgentTypes.da]: _types.AgentNames.AZURE_DA,
234
- [_types.AgentTypes.ta]: _types.AgentNames.AZURE_TA
235
- },
236
- GatewayDisplay: _types.GatewayTypes.AZURE_GATEWAY
237
- };
238
- const testables = exports.testables = {
239
- AzurePrompts,
240
- ConfigFiles,
241
- defaultLogFiles
242
- };