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