@axway/axway-central-cli 2.17.0 → 2.18.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 +6 -28
- package/dist/commands/apply/index.js +9 -24
- package/dist/commands/completion/index.js +3 -9
- package/dist/commands/config/common/index.js +2 -11
- package/dist/commands/config/index.js +2 -7
- package/dist/commands/config/list.js +2 -6
- package/dist/commands/config/set.js +4 -31
- package/dist/commands/config/unset.js +2 -12
- package/dist/commands/create/agentResource.js +12 -32
- package/dist/commands/create/environment.js +6 -16
- package/dist/commands/create/index.js +9 -26
- package/dist/commands/create/serviceAccount.js +2 -6
- package/dist/commands/delete/index.js +15 -33
- package/dist/commands/edit/environment.js +6 -21
- package/dist/commands/edit/index.js +4 -8
- package/dist/commands/get/index.js +27 -44
- package/dist/commands/install/agents.js +41 -70
- package/dist/commands/install/apigeexSaasAgents.js +33 -96
- package/dist/commands/install/awsAgents.js +87 -137
- package/dist/commands/install/awsSaasAgents.js +48 -140
- package/dist/commands/install/azureAgents.js +37 -77
- package/dist/commands/install/edgeAgents.js +15 -108
- package/dist/commands/install/gitHubSaasAgents.js +286 -0
- package/dist/commands/install/helpers/creators.js +17 -70
- package/dist/commands/install/helpers/deleters.js +2 -11
- package/dist/commands/install/helpers/getters.js +4 -30
- package/dist/commands/install/helpers/index.js +13 -48
- package/dist/commands/install/helpers/inputs.js +26 -98
- package/dist/commands/install/helpers/regex.js +29 -34
- package/dist/commands/install/helpers/templates/awsTemplates.js +6 -23
- package/dist/commands/install/helpers/templates/azureTemplates.js +5 -24
- package/dist/commands/install/helpers/templates/edgeTemplates.js +7 -38
- package/dist/commands/install/helpers/templates/istioTemplates.js +5 -16
- package/dist/commands/install/index.js +4 -10
- package/dist/commands/install/istioAgents.js +38 -115
- package/dist/commands/install/platform.js +18 -50
- package/dist/commands/proxies/create.js +2 -18
- package/dist/commands/proxies/index.js +4 -8
- package/dist/commands/proxies/promote.js +2 -21
- package/dist/common/ApiServerClient.js +64 -173
- package/dist/common/CacheController.js +11 -32
- package/dist/common/CliConfigManager.js +14 -27
- package/dist/common/CompositeError.js +6 -30
- package/dist/common/CoreConfigController.js +18 -40
- package/dist/common/DefinitionsManager.js +29 -76
- package/dist/common/Kubectl.js +2 -25
- package/dist/common/PlatformClient.js +19 -63
- package/dist/common/Renderer.js +25 -87
- package/dist/common/TmpFile.js +11 -28
- package/dist/common/bashCommands.js +3 -22
- package/dist/common/basicPrompts.js +8 -43
- package/dist/common/dataService.js +22 -50
- package/dist/common/errorHandler.js +0 -9
- package/dist/common/resultsRenderers.js +10 -42
- package/dist/common/types.js +117 -342
- package/dist/common/utils.js +37 -99
- package/dist/main.js +0 -2
- package/package.json +2 -2
|
@@ -4,27 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.testables = exports.gatewayConnectivity = exports.defaultLogFiles = exports.completeInstall = exports.askConfigType = exports.askBundleType = exports.ConfigFiles = exports.AzureInstallMethods = void 0;
|
|
7
|
-
|
|
8
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
-
|
|
10
8
|
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
11
|
-
|
|
12
9
|
var _basicPrompts = require("../../common/basicPrompts");
|
|
13
|
-
|
|
14
10
|
var _types = require("../../common/types");
|
|
15
|
-
|
|
16
11
|
var _utils = require("../../common/utils");
|
|
17
|
-
|
|
18
12
|
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
19
|
-
|
|
20
13
|
var _azureTemplates = require("./helpers/templates/azureTemplates");
|
|
21
|
-
|
|
22
14
|
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); }
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
17
|
// @ts-ignore
|
|
29
18
|
const {
|
|
30
19
|
log
|
|
@@ -34,19 +23,19 @@ const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgent
|
|
|
34
23
|
const InvalidMessages = {
|
|
35
24
|
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.`
|
|
36
25
|
};
|
|
37
|
-
const defaultLogFiles = '/group-*_instance-*.log';
|
|
26
|
+
const defaultLogFiles = exports.defaultLogFiles = '/group-*_instance-*.log';
|
|
38
27
|
|
|
39
|
-
|
|
40
|
-
const ConfigFiles = {
|
|
28
|
+
// ConfigFiles - all the config file that are used in the setup
|
|
29
|
+
const ConfigFiles = exports.ConfigFiles = {
|
|
41
30
|
DAEnvVars: `${helpers.configFiles.DA_ENV_VARS}`,
|
|
42
31
|
TAEnvVars: `${helpers.configFiles.TA_ENV_VARS}`,
|
|
43
32
|
AzureDABinaryFile: 'discovery_agent',
|
|
44
33
|
AzureDAYaml: 'discovery_agent.yml',
|
|
45
34
|
AzureTABinaryFile: 'traceability_agent',
|
|
46
35
|
AzureTAYaml: 'traceability_agent.yml'
|
|
47
|
-
};
|
|
36
|
+
};
|
|
48
37
|
|
|
49
|
-
|
|
38
|
+
// AzurePrompts - prompts for user inputs
|
|
50
39
|
const AzurePrompts = {
|
|
51
40
|
configTypeMsg: 'Select the mode of installation',
|
|
52
41
|
enterEventHubName: 'Enter the Azure Event Hub Name',
|
|
@@ -60,101 +49,83 @@ const AzurePrompts = {
|
|
|
60
49
|
enterResourceGroupName: 'Enter the Azure Resource Group Name',
|
|
61
50
|
enterApiManagementServiceName: 'Enter the Azure API Management Service Name'
|
|
62
51
|
};
|
|
63
|
-
|
|
64
52
|
const askBundleType = async () => {
|
|
65
53
|
return await (0, _basicPrompts.askList)({
|
|
66
54
|
msg: helpers.agentMessages.selectAgentType,
|
|
67
55
|
choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
|
|
68
56
|
});
|
|
69
57
|
};
|
|
70
|
-
|
|
71
58
|
exports.askBundleType = askBundleType;
|
|
72
|
-
|
|
73
59
|
const askConfigType = async () => {
|
|
74
60
|
return _types.AgentConfigTypes.DOCKERIZED;
|
|
75
|
-
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//
|
|
76
64
|
// Questions for the configuration of Azure agents
|
|
77
65
|
//
|
|
78
|
-
|
|
79
|
-
|
|
80
66
|
exports.askConfigType = askConfigType;
|
|
81
|
-
|
|
82
67
|
const askAzureTenantId = async () => await (0, _basicPrompts.askInput)({
|
|
83
68
|
msg: AzurePrompts.enterTenantId
|
|
84
69
|
});
|
|
85
|
-
|
|
86
70
|
const askAzureSubscriptionId = async () => await (0, _basicPrompts.askInput)({
|
|
87
71
|
msg: AzurePrompts.enterSubscriptionId
|
|
88
72
|
});
|
|
89
|
-
|
|
90
73
|
const askAzureServicePrincipalClientId = async () => await (0, _basicPrompts.askInput)({
|
|
91
74
|
msg: AzurePrompts.enterServicePrincipalClientId
|
|
92
75
|
});
|
|
93
|
-
|
|
94
76
|
const askAzureServicePrincipalClientSecret = async () => await (0, _basicPrompts.askInput)({
|
|
95
77
|
msg: AzurePrompts.enterServicePrincipalClientSecret
|
|
96
78
|
});
|
|
97
|
-
|
|
98
79
|
const askAzureResourceGroupName = async () => await (0, _basicPrompts.askInput)({
|
|
99
80
|
msg: AzurePrompts.enterResourceGroupName
|
|
100
81
|
});
|
|
101
|
-
|
|
102
82
|
const askAzureapiManagementServiceName = async () => await (0, _basicPrompts.askInput)({
|
|
103
83
|
msg: AzurePrompts.enterApiManagementServiceName,
|
|
104
84
|
validate: (0, _basicPrompts.validateRegex)(helpers.AzureRegexPatterns.azureApiManagementServiceNameRegex, InvalidMessages.enterApiManagementServiceName)
|
|
105
85
|
});
|
|
106
|
-
|
|
107
86
|
const askAzureEventHubNamespace = async () => await (0, _basicPrompts.askInput)({
|
|
108
87
|
msg: AzurePrompts.enterEventHubNamespace
|
|
109
88
|
});
|
|
110
|
-
|
|
111
89
|
const askAzureEventHubName = async () => await (0, _basicPrompts.askInput)({
|
|
112
90
|
msg: AzurePrompts.enterEventHubName
|
|
113
91
|
});
|
|
114
|
-
|
|
115
92
|
const askAzurePolicyName = async () => await (0, _basicPrompts.askInput)({
|
|
116
93
|
msg: AzurePrompts.enterPolicyName,
|
|
117
94
|
defaultValue: 'RootManageSharedAccessKey'
|
|
118
95
|
});
|
|
119
|
-
|
|
120
96
|
const askAzurePolicyKey = async () => await (0, _basicPrompts.askInput)({
|
|
121
97
|
msg: AzurePrompts.enterPolicyKey
|
|
122
98
|
});
|
|
123
|
-
|
|
124
99
|
const gatewayConnectivity = async installConfig => {
|
|
125
100
|
const azureAgentValues = new _azureTemplates.AzureAgentValues();
|
|
126
101
|
console.log('\nCONNECTION TO AZURE:');
|
|
127
|
-
console.log(_chalk.default.gray(`The discovery agent needs to connect to the Azure API Gateway to discover API's for publishing to Amplify Central and/or the Unified Catalog.\nThe traceability agent needs to connect to an Azure Event Hub for collecting APIs transactions. These will be forwarded to the Amplify Central Observer.\n`));
|
|
102
|
+
console.log(_chalk.default.gray(`The discovery agent needs to connect to the Azure API Gateway to discover API's for publishing to Amplify Central and/or the Unified Catalog.\nThe traceability agent needs to connect to an Azure Event Hub for collecting APIs transactions. These will be forwarded to the Amplify Central Observer.\n`));
|
|
128
103
|
|
|
104
|
+
// Azure Discovery Agent Prompts
|
|
129
105
|
if (installConfig.switches.isDaEnabled) {
|
|
130
106
|
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.`));
|
|
131
107
|
await askDiscoveryPrompts(azureAgentValues);
|
|
132
|
-
}
|
|
133
|
-
|
|
108
|
+
}
|
|
134
109
|
|
|
110
|
+
// Azure Traceability Agent Prompts
|
|
135
111
|
if (installConfig.switches.isTaEnabled) {
|
|
136
112
|
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.`));
|
|
137
|
-
await askTraceabilityPrompts(azureAgentValues);
|
|
138
|
-
|
|
113
|
+
await askTraceabilityPrompts(azureAgentValues);
|
|
114
|
+
// ask discovery prompts without asking for an agent name, or displaying the Discovery Configuration message
|
|
139
115
|
if (installConfig.switches.isTaEnabled && !installConfig.switches.isDaEnabled) {
|
|
140
116
|
await askDiscoveryPrompts(azureAgentValues);
|
|
141
117
|
}
|
|
142
118
|
}
|
|
143
|
-
|
|
144
119
|
return azureAgentValues;
|
|
145
120
|
};
|
|
146
|
-
|
|
147
121
|
exports.gatewayConnectivity = gatewayConnectivity;
|
|
148
|
-
|
|
149
122
|
const generateSuccessHelpMsg = installConfig => {
|
|
150
123
|
if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
|
|
151
124
|
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.'));
|
|
152
125
|
}
|
|
153
|
-
|
|
154
126
|
dockerSuccessMsg(installConfig);
|
|
155
127
|
console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.AZURE}`));
|
|
156
128
|
};
|
|
157
|
-
|
|
158
129
|
const dockerSuccessMsg = installConfig => {
|
|
159
130
|
let dockerInfo;
|
|
160
131
|
const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
|
|
@@ -165,7 +136,6 @@ const dockerSuccessMsg = installConfig => {
|
|
|
165
136
|
const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
|
|
166
137
|
const startTaLinuxMsg = `\nStart the Traceability Agent on a Linux based machine`;
|
|
167
138
|
const startTaWinMsg = `\nStart the Traceability Agent on a Windows machine`;
|
|
168
|
-
|
|
169
139
|
if (installConfig.switches.isDaEnabled && installConfig.switches.isTaEnabled) {
|
|
170
140
|
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}):`;
|
|
171
141
|
} else if (installConfig.switches.isDaEnabled) {
|
|
@@ -173,9 +143,7 @@ const dockerSuccessMsg = installConfig => {
|
|
|
173
143
|
} else {
|
|
174
144
|
dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
|
|
175
145
|
}
|
|
176
|
-
|
|
177
146
|
console.log(_chalk.default.whiteBright(dockerInfo), '\n');
|
|
178
|
-
|
|
179
147
|
if (installConfig.switches.isDaEnabled) {
|
|
180
148
|
const daImageVersion = `${daImage}:${installConfig.daVersion}`;
|
|
181
149
|
console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
|
|
@@ -184,7 +152,6 @@ const dockerSuccessMsg = installConfig => {
|
|
|
184
152
|
console.log(_chalk.default.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
|
|
185
153
|
console.log('\t', _chalk.default.cyan(`-v /data ${daImageVersion}`), '\n');
|
|
186
154
|
}
|
|
187
|
-
|
|
188
155
|
if (installConfig.switches.isTaEnabled) {
|
|
189
156
|
const taImageVersion = `${taImage}:${installConfig.taVersion}`;
|
|
190
157
|
console.log(_chalk.default.white('Pull the latest image of the Traceability Agent:'));
|
|
@@ -193,59 +160,54 @@ const dockerSuccessMsg = installConfig => {
|
|
|
193
160
|
console.log(_chalk.default.cyan(_utils.isWindows ? runTaWinMsg : runTaLinuxMsg));
|
|
194
161
|
console.log('\t', _chalk.default.cyan(`-v /data ${taImageVersion}`), '\n');
|
|
195
162
|
}
|
|
196
|
-
};
|
|
197
|
-
|
|
163
|
+
};
|
|
198
164
|
|
|
165
|
+
// Azure DA prompts
|
|
199
166
|
async function askDiscoveryPrompts(azureAgentValues) {
|
|
200
167
|
// Azure Tenant Id
|
|
201
|
-
azureAgentValues.tenantId = await askAzureTenantId();
|
|
202
|
-
|
|
203
|
-
azureAgentValues.subscriptionId = await askAzureSubscriptionId();
|
|
204
|
-
|
|
205
|
-
azureAgentValues.servicePrincipalClientId = await askAzureServicePrincipalClientId();
|
|
206
|
-
|
|
207
|
-
azureAgentValues.servicePrincipalClientSecret = await askAzureServicePrincipalClientSecret();
|
|
208
|
-
|
|
209
|
-
azureAgentValues.resourceGroupName = await askAzureResourceGroupName();
|
|
210
|
-
|
|
168
|
+
azureAgentValues.tenantId = await askAzureTenantId();
|
|
169
|
+
// Azure Subscription Id
|
|
170
|
+
azureAgentValues.subscriptionId = await askAzureSubscriptionId();
|
|
171
|
+
// Azure Service Principal Client Id
|
|
172
|
+
azureAgentValues.servicePrincipalClientId = await askAzureServicePrincipalClientId();
|
|
173
|
+
// Azure Service Principal Client Secret
|
|
174
|
+
azureAgentValues.servicePrincipalClientSecret = await askAzureServicePrincipalClientSecret();
|
|
175
|
+
// Azure Resource Group Name
|
|
176
|
+
azureAgentValues.resourceGroupName = await askAzureResourceGroupName();
|
|
177
|
+
// Azure API Management Service Name
|
|
211
178
|
azureAgentValues.apiManagementServiceName = await askAzureapiManagementServiceName();
|
|
212
179
|
}
|
|
213
|
-
|
|
214
180
|
async function askTraceabilityPrompts(azureAgentValues) {
|
|
215
181
|
// Azure Event Hub Namespace
|
|
216
|
-
azureAgentValues.eventHubNamespace = await askAzureEventHubNamespace();
|
|
217
|
-
|
|
218
|
-
azureAgentValues.eventHubName = await askAzureEventHubName();
|
|
219
|
-
|
|
220
|
-
azureAgentValues.policyName = await askAzurePolicyName();
|
|
221
|
-
|
|
182
|
+
azureAgentValues.eventHubNamespace = await askAzureEventHubNamespace();
|
|
183
|
+
// Azure Event Hub Name
|
|
184
|
+
azureAgentValues.eventHubName = await askAzureEventHubName();
|
|
185
|
+
// Azure Policy Name
|
|
186
|
+
azureAgentValues.policyName = await askAzurePolicyName();
|
|
187
|
+
// Azure Policy Key
|
|
222
188
|
azureAgentValues.policyKey = await askAzurePolicyKey();
|
|
223
189
|
}
|
|
224
|
-
|
|
225
190
|
const completeInstall = async installConfig => {
|
|
226
191
|
/**
|
|
227
192
|
* Create agent resources
|
|
228
193
|
*/
|
|
229
|
-
const azureAgentValues = installConfig.gatewayConfig;
|
|
194
|
+
const azureAgentValues = installConfig.gatewayConfig;
|
|
230
195
|
|
|
196
|
+
// Add final settings to azureAgentsValues
|
|
231
197
|
azureAgentValues.centralConfig = installConfig.centralConfig;
|
|
232
198
|
azureAgentValues.traceabilityConfig = installConfig.traceabilityConfig;
|
|
233
199
|
console.log('Generating the configuration file(s)...');
|
|
234
|
-
|
|
235
200
|
if (installConfig.switches.isDaEnabled) {
|
|
236
201
|
(0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, azureAgentValues, helpers.azureDAEnvVarTemplate);
|
|
237
202
|
}
|
|
238
|
-
|
|
239
203
|
if (installConfig.switches.isTaEnabled) {
|
|
240
204
|
(0, _utils.writeTemplates)(ConfigFiles.TAEnvVars, azureAgentValues, helpers.azureTAEnvVarTemplate);
|
|
241
205
|
}
|
|
242
|
-
|
|
243
206
|
console.log('Configuration file(s) have been successfully created.\n');
|
|
244
207
|
generateSuccessHelpMsg(installConfig);
|
|
245
208
|
};
|
|
246
|
-
|
|
247
209
|
exports.completeInstall = completeInstall;
|
|
248
|
-
const AzureInstallMethods = {
|
|
210
|
+
const AzureInstallMethods = exports.AzureInstallMethods = {
|
|
249
211
|
GetBundleType: askBundleType,
|
|
250
212
|
GetDeploymentType: askConfigType,
|
|
251
213
|
AskGatewayQuestions: gatewayConnectivity,
|
|
@@ -257,10 +219,8 @@ const AzureInstallMethods = {
|
|
|
257
219
|
},
|
|
258
220
|
GatewayDisplay: _types.GatewayTypes.AZURE_GATEWAY
|
|
259
221
|
};
|
|
260
|
-
exports.
|
|
261
|
-
const testables = {
|
|
222
|
+
const testables = exports.testables = {
|
|
262
223
|
AzurePrompts,
|
|
263
224
|
ConfigFiles,
|
|
264
225
|
defaultLogFiles
|
|
265
|
-
};
|
|
266
|
-
exports.testables = testables;
|
|
226
|
+
};
|