@axway/axway-central-cli 3.2.0-rc.2 → 3.2.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/commands/get/index.js +5 -18
- package/dist/commands/install/agents.js +6 -2
- package/dist/commands/install/azureSaasAgents.js +1 -0
- package/dist/commands/install/helpers/index.js +29 -2
- package/dist/commands/install/helpers/inputs.js +1 -48
- package/dist/commands/install/helpers/regex.js +2 -1
- package/dist/commands/install/helpers/templates/awsTemplates.js +0 -1
- package/dist/commands/install/helpers/templates/azureTemplates.js +0 -1
- package/dist/commands/install/helpers/templates/edgeTemplates.js +0 -2
- package/dist/commands/install/helpers/templates/ibmAPIConnectTemplates.js +0 -1
- package/dist/commands/install/helpers/templates/istioTemplates.js +0 -1
- package/dist/commands/install/helpers/templates/softwareAGWebMethodsTemplates.js +93 -0
- package/dist/commands/install/helpers/templates/traceableTemplates.js +104 -0
- package/dist/commands/install/platform.js +2 -9
- package/dist/commands/install/softwareAGWebMethodsAgents.js +162 -0
- package/dist/commands/install/traceableAgents.js +223 -0
- package/dist/common/ApiServerClient.js +6 -48
- package/dist/common/types.js +18 -7
- package/package.json +1 -1
|
@@ -16,22 +16,20 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
16
16
|
const {
|
|
17
17
|
log
|
|
18
18
|
} = (0, _snooplogg.default)('central: get');
|
|
19
|
-
const getListOrByName = async (resourceDef, client, scopeName, resourceName, scopeDef, query, progressListener, expand
|
|
19
|
+
const getListOrByName = async (resourceDef, client, scopeName, resourceName, scopeDef, query, progressListener, expand) => {
|
|
20
20
|
return resourceName ? await client.getResourceByName({
|
|
21
21
|
resourceDef,
|
|
22
22
|
resourceName,
|
|
23
23
|
scopeDef,
|
|
24
24
|
scopeName,
|
|
25
|
-
expand
|
|
26
|
-
langDef
|
|
25
|
+
expand
|
|
27
26
|
}) : await client.getResourcesList({
|
|
28
27
|
resourceDef,
|
|
29
28
|
scopeDef,
|
|
30
29
|
scopeName,
|
|
31
30
|
query,
|
|
32
31
|
progressListener,
|
|
33
|
-
expand
|
|
34
|
-
langDef
|
|
32
|
+
expand
|
|
35
33
|
});
|
|
36
34
|
};
|
|
37
35
|
const get = exports.get = {
|
|
@@ -75,16 +73,8 @@ const get = exports.get = {
|
|
|
75
73
|
const defsManager = await new _DefinitionsManager.DefinitionsManager(client).init();
|
|
76
74
|
const scope = (0, _utils.parseScopeParam)(argv.scope);
|
|
77
75
|
let languageExpand = argv.language;
|
|
78
|
-
const languageDefinition = argv.languageDefinition;
|
|
79
76
|
const formattedFilter = (0, _utils.transformSimpleFilters)(title, attribute, tag);
|
|
80
77
|
const query = argv.query ? argv.query : formattedFilter;
|
|
81
|
-
// verify either "--language" or "--languageDefinition" argument is passed and error when both are passed
|
|
82
|
-
if (languageExpand && languageDefinition) {
|
|
83
|
-
throw Error('You must specify either of the "--language" or "--languageDefinition" argument and not both.');
|
|
84
|
-
}
|
|
85
|
-
if (languageDefinition && !argv.output) {
|
|
86
|
-
throw Error('The "--languageDefinition" argument can only be used with output(-o,--output) argument');
|
|
87
|
-
}
|
|
88
78
|
if (languageExpand) {
|
|
89
79
|
// when "*" is provided, expand all supported languages
|
|
90
80
|
let lang = "";
|
|
@@ -159,7 +149,7 @@ ${defsManager.getDefsTableForHelpMsg()}`);
|
|
|
159
149
|
*/
|
|
160
150
|
if (scope) {
|
|
161
151
|
const results = await Promise.all(defs.filter(defs => !scope.kind || !defs.scope || defs.scope.spec.kind === scope.kind).map(async defs => ({
|
|
162
|
-
response: await getListOrByName(defs.resource, client, scope.name, resourceName, defs.scope, query, progressListener, languageExpand
|
|
152
|
+
response: await getListOrByName(defs.resource, client, scope.name, resourceName, defs.scope, query, progressListener, languageExpand),
|
|
163
153
|
cli: defs.cli
|
|
164
154
|
})));
|
|
165
155
|
results.forEach(({
|
|
@@ -179,7 +169,7 @@ ${defsManager.getDefsTableForHelpMsg()}`);
|
|
|
179
169
|
}
|
|
180
170
|
});
|
|
181
171
|
const results = await Promise.all(Object.values(defsMatchingGroup).map(async defs => ({
|
|
182
|
-
response: await getListOrByName(defs.resource, client, undefined, resourceName, undefined, query, progressListener, languageExpand
|
|
172
|
+
response: await getListOrByName(defs.resource, client, undefined, resourceName, undefined, query, progressListener, languageExpand),
|
|
183
173
|
cli: defs.cli
|
|
184
174
|
})));
|
|
185
175
|
results.forEach(({
|
|
@@ -243,9 +233,6 @@ ${defsManager.getDefsTableForHelpMsg()}`);
|
|
|
243
233
|
'--no-owner': 'Returns resources which do not have an owner',
|
|
244
234
|
'--language [langCode]': {
|
|
245
235
|
desc: `Show the language detail of the retruned object. One of: * | Comma Separated values of ${_types.LanguageTypes.French} | ${_types.LanguageTypes.US} | ${_types.LanguageTypes.German} | ${_types.LanguageTypes.Portugese}`
|
|
246
|
-
},
|
|
247
|
-
'--languageDefinition [langCode]': {
|
|
248
|
-
desc: `Sow the language definition constraint of the returned object. One of: * | Comma Separated values of ${_types.LanguageTypes.French} | ${_types.LanguageTypes.US} | ${_types.LanguageTypes.German} | ${_types.LanguageTypes.Portugese}`
|
|
249
236
|
}
|
|
250
237
|
}
|
|
251
238
|
};
|
|
@@ -29,6 +29,8 @@ var kafkaAgents = _interopRequireWildcard(require("./kafkaAgents"));
|
|
|
29
29
|
var swaggerHubAgents = _interopRequireWildcard(require("./swaggerHubSaasAgents"));
|
|
30
30
|
var graylogAgent = _interopRequireWildcard(require("./graylogAgent"));
|
|
31
31
|
var ibmAPIConnectAgent = _interopRequireWildcard(require("./ibmAPIConnectAgents"));
|
|
32
|
+
var softwareAGWebMethodsAgent = _interopRequireWildcard(require("./softwareAGWebMethodsAgents"));
|
|
33
|
+
var traceableAgent = _interopRequireWildcard(require("./traceableAgents"));
|
|
32
34
|
var platform = _interopRequireWildcard(require("./platform"));
|
|
33
35
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
34
36
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -50,7 +52,9 @@ const agentInstallFlows = {
|
|
|
50
52
|
[_types.GatewayTypes.ISTIO]: istioAgents.IstioInstallMethods,
|
|
51
53
|
[_types.GatewayTypes.KAFKA]: kafkaAgents.KafkaInstallMethods,
|
|
52
54
|
[_types.GatewayTypes.GRAYLOG]: graylogAgent.GraylogInstallMethods,
|
|
53
|
-
[_types.GatewayTypes.IBMAPICONNECT]: ibmAPIConnectAgent.IBMAPIConnectInstallMethods
|
|
55
|
+
[_types.GatewayTypes.IBMAPICONNECT]: ibmAPIConnectAgent.IBMAPIConnectInstallMethods,
|
|
56
|
+
[_types.GatewayTypes.SOFTWAREAGWEBMETHODS]: softwareAGWebMethodsAgent.SoftwareAGWebMethodsInstallMethods,
|
|
57
|
+
[_types.GatewayTypes.TRACEABLE]: traceableAgent.TraceableInstallMethods
|
|
54
58
|
};
|
|
55
59
|
const saasAgentInstallFlows = {
|
|
56
60
|
[_types.SaaSGatewayTypes.AWS_GATEWAY]: awsSaaSAgents.AWSSaaSInstallMethods,
|
|
@@ -212,7 +216,7 @@ const agents = exports.agents = {
|
|
|
212
216
|
process.exit(0);
|
|
213
217
|
}
|
|
214
218
|
},
|
|
215
|
-
desc: 'Amplify API Gateway / Amazon API Gateway / Azure API Gateway / Istio / Apigee X Gateway / GitHub / GitLab / Kafka / SwaggerHub',
|
|
219
|
+
desc: 'Amplify API Gateway / Amazon API Gateway / Azure API Gateway / Istio / Apigee X Gateway / GitHub / GitLab / Kafka / SwaggerHub/ Software AG WebMethods',
|
|
216
220
|
options: {
|
|
217
221
|
..._types.commonCmdArgsDescription
|
|
218
222
|
}
|
|
@@ -336,6 +336,7 @@ const gatewayConnectivity = async installConfig => {
|
|
|
336
336
|
});
|
|
337
337
|
hostedAgentValues.eventHubConsumerGroup = await (0, _basicPrompts.askInput)({
|
|
338
338
|
msg: SaasPrompts.EVENT_HUB_CONSUMER_GROUP,
|
|
339
|
+
validate: (0, _basicPrompts.validateRegex)(helpers.AzureRegexPatterns.azureEventHubConsumerGroupRegex, helpers.invalidValueExampleErrMsg('Event Hub Consumer Group', 'azure-event-hub-c-group')),
|
|
339
340
|
defaultValue: '$Default'
|
|
340
341
|
});
|
|
341
342
|
}
|
|
@@ -176,6 +176,30 @@ Object.keys(_ibmAPIConnectTemplates).forEach(function (key) {
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
});
|
|
179
|
+
var _softwareAGWebMethodsTemplates = require("./templates/softwareAGWebMethodsTemplates");
|
|
180
|
+
Object.keys(_softwareAGWebMethodsTemplates).forEach(function (key) {
|
|
181
|
+
if (key === "default" || key === "__esModule") return;
|
|
182
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
183
|
+
if (key in exports && exports[key] === _softwareAGWebMethodsTemplates[key]) return;
|
|
184
|
+
Object.defineProperty(exports, key, {
|
|
185
|
+
enumerable: true,
|
|
186
|
+
get: function () {
|
|
187
|
+
return _softwareAGWebMethodsTemplates[key];
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
var _traceableTemplates = require("./templates/traceableTemplates");
|
|
192
|
+
Object.keys(_traceableTemplates).forEach(function (key) {
|
|
193
|
+
if (key === "default" || key === "__esModule") return;
|
|
194
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
195
|
+
if (key in exports && exports[key] === _traceableTemplates[key]) return;
|
|
196
|
+
Object.defineProperty(exports, key, {
|
|
197
|
+
enumerable: true,
|
|
198
|
+
get: function () {
|
|
199
|
+
return _traceableTemplates[key];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
179
203
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
180
204
|
const streamPipeline = exports.streamPipeline = _util.default.promisify(_stream.default.pipeline);
|
|
181
205
|
const unzip = async filePath => {
|
|
@@ -198,7 +222,8 @@ const amplifyAgentsCredsSecret = exports.amplifyAgentsCredsSecret = 'amplify-age
|
|
|
198
222
|
// configFiles - the agent config file names
|
|
199
223
|
const configFiles = exports.configFiles = {
|
|
200
224
|
DA_ENV_VARS: 'da_env_vars.env',
|
|
201
|
-
TA_ENV_VARS: 'ta_env_vars.env'
|
|
225
|
+
TA_ENV_VARS: 'ta_env_vars.env',
|
|
226
|
+
AGENT_ENV_VARS: 'agent_env_vars.env'
|
|
202
227
|
};
|
|
203
228
|
const agentsDocsUrl = exports.agentsDocsUrl = {
|
|
204
229
|
V7: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/connect_api_manager/index.html',
|
|
@@ -206,7 +231,9 @@ const agentsDocsUrl = exports.agentsDocsUrl = {
|
|
|
206
231
|
AZURE: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/connect_azure_gateway/index.html',
|
|
207
232
|
ISTIO: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/mesh_management/index.html',
|
|
208
233
|
GRAYLOG: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/mesh_management/index.html',
|
|
209
|
-
IBMAPICONNECT: ''
|
|
234
|
+
IBMAPICONNECT: '',
|
|
235
|
+
SOFTWAREAGWEBMETHODS: '',
|
|
236
|
+
TRACEABLE: ''
|
|
210
237
|
};
|
|
211
238
|
|
|
212
239
|
// export * from './updaters';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.serviceAccountNameAlreadyExists = exports.selectServiceAccount = exports.selectIngestionProtocol = exports.selectAWSRegion = exports.secretAlreadyExists = exports.namespaceAlreadyExists = exports.k8sClusterMessages = exports.idpTestables = exports.idpMessages = exports.envMessages = exports.enterServiceAccountName = exports.enterPublicKeyPath = exports.enterPrivateKeyPath = exports.enterNamespaceName = exports.enterAWSRegion = exports.createNamespace = exports.createGatewayAgentCredsSecret = exports.createAmplifyAgentKeysSecret = exports.askServiceAccountName = exports.askReferencedEnvironments = exports.askPublicKeyPath = exports.askPublicAndPrivateKeysPath = exports.askPrivateKeyPath = exports.askNamespace = exports.askKeyValuePairLoop = exports.askK8sClusterName = exports.askIngestionProtocol = exports.askForSecretName = exports.askForIDPConfiguration = exports.askForIDPAuthConfiguration = exports.askEnvironmentName = exports.askDosaClientId = exports.askBundleType = exports.askArrayLoop = exports.askAgentName = exports.askAWSRegion = exports.agentMessages = exports.addIdentityProvider = void 0;
|
|
7
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
8
|
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
9
|
var _inquirer = _interopRequireDefault(require("inquirer"));
|
|
@@ -60,14 +60,6 @@ const idpMessages = exports.idpMessages = {
|
|
|
60
60
|
provideReqHeadersForTokenFetch: "Enter the request headers used for the token fetch call as key-value pairs. Stops when empty input is provided",
|
|
61
61
|
provideQueryParamsForTokenFetch: "Enter the query parameters used for the token fetch call as key-value pairs. Stops when empty input is provided"
|
|
62
62
|
};
|
|
63
|
-
const transactionLoggingMessages = exports.transactionLoggingMessages = {
|
|
64
|
-
askToEnableLogging: 'Would you like to enable transaction logging?',
|
|
65
|
-
transactionLoggingInfoMsg: 'Transaction logging is optional and not required for usage and metrics logging.\nTurning on transaction logging can have an impact on performance.',
|
|
66
|
-
enterSamplingPercentage: 'What sampling rate would you like to use? (1-10)',
|
|
67
|
-
samplingPercentageInfoMsg: 'A sampling rate of 1 will log 1% of transactions, a sampling rate of 10 will log 10% of all transactions.\nWe recommend a sampling rate of 1% which can be increased if needed.',
|
|
68
|
-
askReportAllErrors: 'Would you like to report all errors?',
|
|
69
|
-
reportAllErrorsMsg: 'The agents can take out the error transactions from the sampling rate.'
|
|
70
|
-
};
|
|
71
63
|
const namespaceAlreadyExists = exports.namespaceAlreadyExists = 'Namespace already exists. Please enter a new name.';
|
|
72
64
|
const secretAlreadyExists = exports.secretAlreadyExists = 'Secret already exists. Please enter a new name.';
|
|
73
65
|
const enterNamespaceName = exports.enterNamespaceName = 'Enter a new namespace name';
|
|
@@ -432,46 +424,7 @@ const askPublicAndPrivateKeysPath = async () => {
|
|
|
432
424
|
const privateKey = await askPrivateKeyPath();
|
|
433
425
|
return [publicKey, privateKey];
|
|
434
426
|
};
|
|
435
|
-
|
|
436
|
-
// askToEnableTransactionLogging - asks Yes/No question to enable transaction logging, if Yes, configure values for environment variables.
|
|
437
427
|
exports.askPublicAndPrivateKeysPath = askPublicAndPrivateKeysPath;
|
|
438
|
-
const askToEnableTransactionLogging = async () => {
|
|
439
|
-
console.log(_chalk.default.gray(transactionLoggingMessages.transactionLoggingInfoMsg));
|
|
440
|
-
const enable = await (0, _basicPrompts.askList)({
|
|
441
|
-
msg: transactionLoggingMessages.askToEnableLogging,
|
|
442
|
-
choices: _types.YesNoChoices,
|
|
443
|
-
default: _types.YesNo.No
|
|
444
|
-
});
|
|
445
|
-
if (enable === _types.YesNo.Yes) {
|
|
446
|
-
console.log(_chalk.default.gray(transactionLoggingMessages.samplingPercentageInfoMsg));
|
|
447
|
-
const samplingPercentage = await (0, _basicPrompts.askInput)({
|
|
448
|
-
msg: transactionLoggingMessages.enterSamplingPercentage,
|
|
449
|
-
defaultValue: 1,
|
|
450
|
-
validate: (0, _basicPrompts.runValidations)((0, _basicPrompts.validateRegex)(_regex.percentageRegex, _regex.invalidPercentage))
|
|
451
|
-
});
|
|
452
|
-
let shouldReportAllErrors = _types.YesNo.Yes;
|
|
453
|
-
if (samplingPercentage < 10) {
|
|
454
|
-
console.log(_chalk.default.gray(transactionLoggingMessages.reportAllErrorsMsg));
|
|
455
|
-
shouldReportAllErrors = await (0, _basicPrompts.askList)({
|
|
456
|
-
msg: transactionLoggingMessages.askReportAllErrors,
|
|
457
|
-
choices: _types.YesNoChoices,
|
|
458
|
-
default: _types.YesNo.Yes
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
return {
|
|
462
|
-
enabled: true,
|
|
463
|
-
samplingPercentage: samplingPercentage,
|
|
464
|
-
shouldReportAllErrors: shouldReportAllErrors === _types.YesNo.Yes ? true : false
|
|
465
|
-
};
|
|
466
|
-
} else {
|
|
467
|
-
return {
|
|
468
|
-
enabled: false,
|
|
469
|
-
samplingPercentage: 0,
|
|
470
|
-
shouldReportAllErrors: false
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
exports.askToEnableTransactionLogging = askToEnableTransactionLogging;
|
|
475
428
|
const askKeyValuePairLoop = async (msg, keyLabel, validateFunc) => {
|
|
476
429
|
let key = "non-empty";
|
|
477
430
|
let map = new Map();
|
|
@@ -43,7 +43,8 @@ const APIGEEXRegexPatterns = exports.APIGEEXRegexPatterns = {
|
|
|
43
43
|
|
|
44
44
|
// AzureRegexPatterns - regex patters to validate user inputs
|
|
45
45
|
const AzureRegexPatterns = exports.AzureRegexPatterns = {
|
|
46
|
-
azureApiManagementServiceNameRegex: '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'
|
|
46
|
+
azureApiManagementServiceNameRegex: '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$',
|
|
47
|
+
azureEventHubConsumerGroupRegex: '^[a-zA-Z0-9$][a-zA-Z0-9._\-]{0,48}[a-zA-Z0-9]$'
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
// GitHubRegexPatterns - regex patters to validate user inputs
|
|
@@ -81,7 +81,6 @@ CENTRAL_REGION={{centralConfig.region}}
|
|
|
81
81
|
TRACEABILITY_PROTOCOL={{traceabilityConfig.protocol}}
|
|
82
82
|
{{/compare}}
|
|
83
83
|
TRACEABILITY_SAMPLING_PERCENTAGE={{traceabilityConfig.samplingPercentage}}
|
|
84
|
-
TRACEABILITY_SAMPLING_REPORTALLERRORS={{traceabilityConfig.samplingReportAllErrors}}
|
|
85
84
|
{{/if}}
|
|
86
85
|
|
|
87
86
|
# Logging configs
|
|
@@ -76,7 +76,6 @@ CENTRAL_REGION={{centralConfig.region}}
|
|
|
76
76
|
TRACEABILITY_PROTOCOL={{traceabilityConfig.protocol}}
|
|
77
77
|
{{/compare}}
|
|
78
78
|
TRACEABILITY_SAMPLING_PERCENTAGE={{traceabilityConfig.samplingPercentage}}
|
|
79
|
-
TRACEABILITY_SAMPLING_REPORTALLERRORS={{traceabilityConfig.samplingReportAllErrors}}
|
|
80
79
|
{{/if}}
|
|
81
80
|
|
|
82
81
|
# Logging configs
|
|
@@ -117,7 +117,6 @@ CENTRAL_REGION={{centralConfig.region}}
|
|
|
117
117
|
TRACEABILITY_PROTOCOL={{traceabilityConfig.protocol}}
|
|
118
118
|
{{/compare}}
|
|
119
119
|
TRACEABILITY_SAMPLING_PERCENTAGE={{traceabilityConfig.samplingPercentage}}
|
|
120
|
-
TRACEABILITY_SAMPLING_REPORTALLERRORS={{traceabilityConfig.samplingReportAllErrors}}
|
|
121
120
|
{{/if}}
|
|
122
121
|
|
|
123
122
|
# Logging configs
|
|
@@ -172,7 +171,6 @@ env:
|
|
|
172
171
|
{{/if}}
|
|
173
172
|
TRACEABILITY_PROTOCOL: {{traceabilityConfig.protocol}}
|
|
174
173
|
TRACEABILITY_SAMPLING_PERCENTAGE: {{traceabilityConfig.samplingPercentage}}
|
|
175
|
-
TRACEABILITY_SAMPLING_REPORTALLERRORS: {{traceabilityConfig.samplingReportAllErrors}}
|
|
176
174
|
|
|
177
175
|
{{#if isGatewayOnly}}
|
|
178
176
|
APIGATEWAY_ONLY: {{isGatewayOnly}}
|
|
@@ -106,7 +106,6 @@ CENTRAL_REGION={{centralConfig.region}}
|
|
|
106
106
|
TRACEABILITY_PROTOCOL={{traceabilityConfig.protocol}}
|
|
107
107
|
{{/compare}}
|
|
108
108
|
TRACEABILITY_SAMPLING_PERCENTAGE={{traceabilityConfig.samplingPercentage}}
|
|
109
|
-
TRACEABILITY_SAMPLING_REPORTALLERRORS={{traceabilityConfig.samplingReportAllErrors}}
|
|
110
109
|
{{/if}}
|
|
111
110
|
|
|
112
111
|
# Logging configs
|
|
@@ -71,7 +71,6 @@ const istioAgentsTemplate = () => {
|
|
|
71
71
|
sampling:
|
|
72
72
|
percentage: {{traceabilityConfig.samplingPercentage}}
|
|
73
73
|
per_api: true
|
|
74
|
-
reportAllErrors: {{traceabilityConfig.samplingReportAllErrors}}
|
|
75
74
|
# Name of the secret containing the public & private keys used by the provided service account client ID
|
|
76
75
|
keysSecretName: {{istioAgentValues.keysSecretName}}
|
|
77
76
|
publishHeaders: true
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.softwareAGWebMethodsTAEnvVarTemplate = exports.softwareAGWebMethodsDAEnvVarTemplate = exports.SoftwareAGWebMethodsAgentValues = void 0;
|
|
7
|
+
var _types = require("../../../../common/types");
|
|
8
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
/**
|
|
12
|
+
* @description Values to provide to the Software AG WebMethods handlebars templates.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
class SoftwareAGWebMethodsAgentValues {
|
|
16
|
+
constructor() {
|
|
17
|
+
_defineProperty(this, "pathURL", void 0);
|
|
18
|
+
_defineProperty(this, "pathUsername", void 0);
|
|
19
|
+
_defineProperty(this, "pathPassword", void 0);
|
|
20
|
+
_defineProperty(this, "pathOauth2Server", void 0);
|
|
21
|
+
_defineProperty(this, "centralConfig", void 0);
|
|
22
|
+
_defineProperty(this, "traceabilityConfig", void 0);
|
|
23
|
+
this.pathURL = '';
|
|
24
|
+
this.pathUsername = '';
|
|
25
|
+
this.pathPassword = '';
|
|
26
|
+
this.pathOauth2Server = 'local';
|
|
27
|
+
this.centralConfig = new _types.CentralAgentConfig();
|
|
28
|
+
this.traceabilityConfig = new _types.TraceabilityConfig();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @description Generates the Software AG WebMethods TA env vars file.
|
|
34
|
+
*/
|
|
35
|
+
exports.SoftwareAGWebMethodsAgentValues = SoftwareAGWebMethodsAgentValues;
|
|
36
|
+
const softwareAGWebMethodsTAEnvVarTemplate = () => {
|
|
37
|
+
return `# Software AG WebMethods configs
|
|
38
|
+
WEBMETHODS_URL={{pathURL}}
|
|
39
|
+
WEBMETHODS_AUTH_USERNAME={{pathUsername}}
|
|
40
|
+
WEBMETHODS_AUTH_PASSWORD={{pathPassword}}
|
|
41
|
+
WEBMETHODS_OAUTH2SERVER={{pathOauth2Server}}
|
|
42
|
+
|
|
43
|
+
# Amplify Central configs
|
|
44
|
+
CENTRAL_AGENTNAME={{centralConfig.taAgentName}}
|
|
45
|
+
CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
|
|
46
|
+
CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
|
|
47
|
+
CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
|
|
48
|
+
CENTRAL_ENVIRONMENT={{centralConfig.environment}}
|
|
49
|
+
CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
|
|
50
|
+
CENTRAL_TEAM={{centralConfig.ampcTeamName}}
|
|
51
|
+
CENTRAL_REGION={{centralConfig.region}}
|
|
52
|
+
|
|
53
|
+
# Logging configs
|
|
54
|
+
# Define the logging level: info, debug, error
|
|
55
|
+
LOG_LEVEL=info
|
|
56
|
+
# Specify where to send the log: stdout, file, both
|
|
57
|
+
LOG_OUTPUT=stdout
|
|
58
|
+
# Define where the log files are written
|
|
59
|
+
LOG_FILE_PATH=logs
|
|
60
|
+
`;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @description Generates the Software AG WebMethods DA env vars file.
|
|
65
|
+
*/
|
|
66
|
+
exports.softwareAGWebMethodsTAEnvVarTemplate = softwareAGWebMethodsTAEnvVarTemplate;
|
|
67
|
+
const softwareAGWebMethodsDAEnvVarTemplate = () => {
|
|
68
|
+
return `# Software AG WebMethods configs
|
|
69
|
+
WEBMETHODS_URL={{pathURL}}
|
|
70
|
+
WEBMETHODS_AUTH_USERNAME={{pathUsername}}
|
|
71
|
+
WEBMETHODS_AUTH_PASSWORD={{pathPassword}}
|
|
72
|
+
WEBMETHODS_OAUTH2SERVER={{pathOauth2Server}}
|
|
73
|
+
|
|
74
|
+
# Amplify Central configs
|
|
75
|
+
CENTRAL_AGENTNAME={{centralConfig.daAgentName}}
|
|
76
|
+
CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
|
|
77
|
+
CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
|
|
78
|
+
CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
|
|
79
|
+
CENTRAL_ENVIRONMENT={{centralConfig.environment}}
|
|
80
|
+
CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
|
|
81
|
+
CENTRAL_TEAM={{centralConfig.ampcTeamName}}
|
|
82
|
+
CENTRAL_REGION={{centralConfig.region}}
|
|
83
|
+
|
|
84
|
+
# Logging configs
|
|
85
|
+
# Define the logging level: info, debug, error
|
|
86
|
+
LOG_LEVEL=info
|
|
87
|
+
# Specify where to send the log: stdout, file, both
|
|
88
|
+
LOG_OUTPUT=stdout
|
|
89
|
+
# Define where the log files are written
|
|
90
|
+
LOG_FILE_PATH=logs
|
|
91
|
+
`;
|
|
92
|
+
};
|
|
93
|
+
exports.softwareAGWebMethodsDAEnvVarTemplate = softwareAGWebMethodsDAEnvVarTemplate;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.traceableHelmOverrideTemplate = exports.traceableEnvVarTemplate = exports.TraceableAgentValues = void 0;
|
|
7
|
+
var _types = require("../../../../common/types");
|
|
8
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
/**
|
|
12
|
+
* @description Parameters to provide to the Traceable handlebars templates.
|
|
13
|
+
*/
|
|
14
|
+
class TraceableAgentValues {
|
|
15
|
+
constructor() {
|
|
16
|
+
_defineProperty(this, "namespace", void 0);
|
|
17
|
+
_defineProperty(this, "traceableToken", void 0);
|
|
18
|
+
_defineProperty(this, "traceableRegion", void 0);
|
|
19
|
+
_defineProperty(this, "environments", void 0);
|
|
20
|
+
_defineProperty(this, "internalDomains", void 0);
|
|
21
|
+
_defineProperty(this, "basePathSegmentLen", void 0);
|
|
22
|
+
_defineProperty(this, "centralConfig", void 0);
|
|
23
|
+
_defineProperty(this, "traceabilityConfig", void 0);
|
|
24
|
+
this.namespace = {
|
|
25
|
+
name: '',
|
|
26
|
+
isNew: false
|
|
27
|
+
};
|
|
28
|
+
this.traceableToken = '';
|
|
29
|
+
this.traceableRegion = _types.TraceableRegionType.US;
|
|
30
|
+
this.environments = [];
|
|
31
|
+
this.internalDomains = false;
|
|
32
|
+
this.basePathSegmentLen = 2;
|
|
33
|
+
this.centralConfig = new _types.CentralAgentConfig();
|
|
34
|
+
this.traceabilityConfig = new _types.TraceabilityConfig();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @description Generates the helm override file for the Amplify Traceable Agent.
|
|
40
|
+
*/
|
|
41
|
+
exports.TraceableAgentValues = TraceableAgentValues;
|
|
42
|
+
const traceableHelmOverrideTemplate = () => {
|
|
43
|
+
return `---
|
|
44
|
+
traceable:
|
|
45
|
+
token: {{traceableToken}}
|
|
46
|
+
{{#compare . environments.length 0 operator="!=" }}
|
|
47
|
+
environments: {{environments}}
|
|
48
|
+
{{/compare}}
|
|
49
|
+
region: {{traceableRegion}}
|
|
50
|
+
{{#if internalDomains}}
|
|
51
|
+
internalDomains: {{internalDomains}}
|
|
52
|
+
{{/if}}
|
|
53
|
+
basePathSegmentLen: {{basePathSegmentLen}}
|
|
54
|
+
|
|
55
|
+
env:
|
|
56
|
+
CENTRAL_REGION: {{centralConfig.region}}
|
|
57
|
+
CENTRAL_ORGANIZATIONID: "{{centralConfig.orgId}}"
|
|
58
|
+
CENTRAL_TEAM: {{centralConfig.ampcTeamName}}
|
|
59
|
+
CENTRAL_ENVIRONMENT: {{centralConfig.environment}}
|
|
60
|
+
CENTRAL_AGENTNAME: {{centralConfig.taAgentName}}
|
|
61
|
+
CENTRAL_AUTH_CLIENTID: {{centralConfig.dosaAccount.clientId}}
|
|
62
|
+
TRACEABILITY_PROTOCOL: {{traceabilityConfig.protocol}}
|
|
63
|
+
`;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @description Generates the Amplify Traceable Agent env vars file.
|
|
68
|
+
*/
|
|
69
|
+
exports.traceableHelmOverrideTemplate = traceableHelmOverrideTemplate;
|
|
70
|
+
const traceableEnvVarTemplate = () => {
|
|
71
|
+
return `# Traceable configs
|
|
72
|
+
TRACEABLE_TOKEN={{traceableToken}}
|
|
73
|
+
TRACEABLE_REGION={{traceableRegion}}
|
|
74
|
+
{{#compare . environments.length 0 operator="!=" }}
|
|
75
|
+
TRACEABLE_ENVIRONMENTS={{environments}}
|
|
76
|
+
{{/compare}}
|
|
77
|
+
{{#if internalDomains}}
|
|
78
|
+
TRACEABLE_INTERNAL_DOMAINS={{internalDomains}}
|
|
79
|
+
{{/if}}
|
|
80
|
+
TRACEABLE_BASE_PATH_SEGMENT_LENGTH={{basePathSegmentLen}}
|
|
81
|
+
|
|
82
|
+
# Amplify Central configs
|
|
83
|
+
CENTRAL_AGENTNAME={{centralConfig.taAgentName}}
|
|
84
|
+
CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
|
|
85
|
+
CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
|
|
86
|
+
CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
|
|
87
|
+
CENTRAL_ENVIRONMENT={{centralConfig.environment}}
|
|
88
|
+
CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
|
|
89
|
+
CENTRAL_TEAM={{centralConfig.ampcTeamName}}
|
|
90
|
+
CENTRAL_REGION={{centralConfig.region}}
|
|
91
|
+
{{#compare . traceabilityConfig.protocol "https"}}
|
|
92
|
+
TRACEABILITY_PROTOCOL={{traceabilityConfig.protocol}}
|
|
93
|
+
{{/compare}}
|
|
94
|
+
|
|
95
|
+
# Logging configs
|
|
96
|
+
# Define the logging level: info, debug, error
|
|
97
|
+
LOG_LEVEL=info
|
|
98
|
+
# Specify where to send the log: stdout, file, both
|
|
99
|
+
LOG_OUTPUT=stdout
|
|
100
|
+
# Define where the log files are written
|
|
101
|
+
LOG_FILE_PATH=logs
|
|
102
|
+
`;
|
|
103
|
+
};
|
|
104
|
+
exports.traceableEnvVarTemplate = traceableEnvVarTemplate;
|
|
@@ -46,15 +46,8 @@ const getTraceabilityConfig = async installConfig => {
|
|
|
46
46
|
// Do not ask Traceability questions in offline mode
|
|
47
47
|
if (!traceabilityConfig.usageReportingOffline) {
|
|
48
48
|
console.log('\nCONNECTION TO TRACEABILITY MODULE:');
|
|
49
|
-
if (installConfig.gatewayType !== _types.GatewayTypes.KAFKA && installConfig.gatewayType !== _types.GatewayTypes.GRAYLOG) {
|
|
50
|
-
|
|
51
|
-
enabled,
|
|
52
|
-
samplingPercentage,
|
|
53
|
-
shouldReportAllErrors
|
|
54
|
-
} = await helpers.askToEnableTransactionLogging();
|
|
55
|
-
traceabilityConfig.enabled = enabled;
|
|
56
|
-
traceabilityConfig.samplingPercentage = samplingPercentage;
|
|
57
|
-
traceabilityConfig.samplingReportAllErrors = shouldReportAllErrors;
|
|
49
|
+
if (installConfig.gatewayType !== _types.GatewayTypes.KAFKA && installConfig.gatewayType !== _types.GatewayTypes.GRAYLOG && installConfig.gatewayType !== _types.GatewayTypes.TRACEABLE) {
|
|
50
|
+
traceabilityConfig.samplingPercentage = 0;
|
|
58
51
|
}
|
|
59
52
|
const traceabilityProtocol = await helpers.askIngestionProtocol();
|
|
60
53
|
traceabilityConfig.protocol = traceabilityProtocol;
|
|
@@ -0,0 +1,162 @@
|
|
|
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 _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
const {
|
|
19
|
+
log
|
|
20
|
+
} = (0, _snooplogg.default)('central: install: agents: Software AG Web Methods');
|
|
21
|
+
const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.SOFTWAREAGWEBMETHODS_DA}`;
|
|
22
|
+
const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.SOFTWAREAGWEBMETHODS_TA}`;
|
|
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
|
+
};
|
|
29
|
+
|
|
30
|
+
// WebMethods - prompts for user inputs
|
|
31
|
+
const prompts = {
|
|
32
|
+
pathURL: 'Enter the base URL to connect to your Software AG WebMethods API service',
|
|
33
|
+
pathUsername: 'Enter the username to authenticate to Software AG WebMethods',
|
|
34
|
+
pathPassword: 'Enter the password to authenticate to Software AG WebMethods',
|
|
35
|
+
pathOauth2Server: 'Enter the OAuth2 server to authenticate. Defaults to local gateway auth'
|
|
36
|
+
};
|
|
37
|
+
const askBundleType = async () => {
|
|
38
|
+
return await (0, _basicPrompts.askList)({
|
|
39
|
+
msg: helpers.agentMessages.selectAgentType,
|
|
40
|
+
choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
exports.askBundleType = askBundleType;
|
|
44
|
+
const askConfigType = async () => {
|
|
45
|
+
return _types.AgentConfigTypes.DOCKERIZED;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//
|
|
49
|
+
// Questions for the configuration of Software AG WebMethods agents
|
|
50
|
+
//
|
|
51
|
+
exports.askConfigType = askConfigType;
|
|
52
|
+
async function askCommonPrompts(webMethodsAgentValues) {
|
|
53
|
+
// Software AG WebMethods Path URL
|
|
54
|
+
webMethodsAgentValues.pathURL = await askPathURL();
|
|
55
|
+
// Software AG WebMethods Path Username
|
|
56
|
+
webMethodsAgentValues.pathUsername = await askPathUsername();
|
|
57
|
+
// Software AG WebMethods Path Password
|
|
58
|
+
webMethodsAgentValues.pathPassword = await askPathPassword();
|
|
59
|
+
// Software AG WebMethods Path Oauth2Server
|
|
60
|
+
webMethodsAgentValues.pathOauth2Server = await askPathOauth2Server();
|
|
61
|
+
if (webMethodsAgentValues.pathOauth2Server.trim() === '') {
|
|
62
|
+
webMethodsAgentValues.pathOauth2Server = 'local';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const askPathURL = async () => await (0, _basicPrompts.askInput)({
|
|
66
|
+
msg: prompts.pathURL
|
|
67
|
+
});
|
|
68
|
+
const askPathUsername = async () => await (0, _basicPrompts.askInput)({
|
|
69
|
+
msg: prompts.pathUsername
|
|
70
|
+
});
|
|
71
|
+
const askPathPassword = async () => await (0, _basicPrompts.askInput)({
|
|
72
|
+
msg: prompts.pathPassword
|
|
73
|
+
});
|
|
74
|
+
const askPathOauth2Server = async () => await (0, _basicPrompts.askInput)({
|
|
75
|
+
msg: prompts.pathOauth2Server,
|
|
76
|
+
allowEmptyInput: true,
|
|
77
|
+
defaultValue: "local"
|
|
78
|
+
});
|
|
79
|
+
const gatewayConnectivity = async installConfig => {
|
|
80
|
+
const webMethodsAgentValues = new _softwareAGWebMethodsTemplates.SoftwareAGWebMethodsAgentValues();
|
|
81
|
+
console.log('\nCONNECTION TO Software AG WebMethods:');
|
|
82
|
+
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`));
|
|
83
|
+
if (installConfig.switches.isDaEnabled || installConfig.switches.isTaEnabled) {
|
|
84
|
+
await askCommonPrompts(webMethodsAgentValues);
|
|
85
|
+
}
|
|
86
|
+
return webMethodsAgentValues;
|
|
87
|
+
};
|
|
88
|
+
exports.gatewayConnectivity = gatewayConnectivity;
|
|
89
|
+
const generateSuccessHelpMsg = installConfig => {
|
|
90
|
+
if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
|
|
91
|
+
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.'));
|
|
92
|
+
}
|
|
93
|
+
dockerSuccessMsg(installConfig);
|
|
94
|
+
console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.SOFTWAREAGWEBMETHODS}`));
|
|
95
|
+
};
|
|
96
|
+
const dockerSuccessMsg = installConfig => {
|
|
97
|
+
let dockerInfo;
|
|
98
|
+
const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
|
|
99
|
+
const runDaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
|
|
100
|
+
const runTaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
|
|
101
|
+
const runTaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
|
|
102
|
+
const startDaLinuxMsg = `\nStart the Discovery Agent on a Linux based machine`;
|
|
103
|
+
const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
|
|
104
|
+
const startTaLinuxMsg = `\nStart the Traceability Agent on a Linux based machine`;
|
|
105
|
+
const startTaWinMsg = `\nStart the Traceability Agent on a Windows machine`;
|
|
106
|
+
if (installConfig.switches.isDaEnabled && installConfig.switches.isTaEnabled) {
|
|
107
|
+
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}):`;
|
|
108
|
+
} else if (installConfig.switches.isDaEnabled) {
|
|
109
|
+
dockerInfo = `To utilize the discovery agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.DA_ENV_VARS}):`;
|
|
110
|
+
} else {
|
|
111
|
+
dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
|
|
112
|
+
}
|
|
113
|
+
console.log(_chalk.default.whiteBright(dockerInfo), '\n');
|
|
114
|
+
if (installConfig.switches.isDaEnabled) {
|
|
115
|
+
const daImageVersion = `${daImage}:${installConfig.daVersion}`;
|
|
116
|
+
console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
|
|
117
|
+
console.log(_chalk.default.cyan(`docker pull ${daImageVersion}`));
|
|
118
|
+
console.log(_chalk.default.white(_utils.isWindows ? startDaWinMsg : startDaLinuxMsg));
|
|
119
|
+
console.log(_chalk.default.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
|
|
120
|
+
console.log('\t', _chalk.default.cyan(`-v /data ${daImageVersion}`), '\n');
|
|
121
|
+
}
|
|
122
|
+
if (installConfig.switches.isTaEnabled) {
|
|
123
|
+
const taImageVersion = `${taImage}:${installConfig.taVersion}`;
|
|
124
|
+
console.log(_chalk.default.white('Pull the latest image of the Traceability Agent:'));
|
|
125
|
+
console.log(_chalk.default.cyan(`docker pull ${taImageVersion}`));
|
|
126
|
+
console.log(_chalk.default.white(_utils.isWindows ? startTaWinMsg : startTaLinuxMsg));
|
|
127
|
+
console.log(_chalk.default.cyan(_utils.isWindows ? runTaWinMsg : runTaLinuxMsg));
|
|
128
|
+
console.log('\t', _chalk.default.cyan(`-v /data ${taImageVersion}`), '\n');
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const completeInstall = async installConfig => {
|
|
132
|
+
// Add final settings to softwareAGWebMethodsAgentValues
|
|
133
|
+
const softwareAGWebMethodsAgentValues = installConfig.gatewayConfig;
|
|
134
|
+
softwareAGWebMethodsAgentValues.centralConfig = installConfig.centralConfig;
|
|
135
|
+
softwareAGWebMethodsAgentValues.traceabilityConfig = installConfig.traceabilityConfig;
|
|
136
|
+
console.log('Generating the configuration file(s)...');
|
|
137
|
+
if (installConfig.switches.isDaEnabled) {
|
|
138
|
+
(0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, softwareAGWebMethodsAgentValues, helpers.softwareAGWebMethodsDAEnvVarTemplate);
|
|
139
|
+
}
|
|
140
|
+
if (installConfig.switches.isTaEnabled) {
|
|
141
|
+
(0, _utils.writeTemplates)(ConfigFiles.TAEnvVars, softwareAGWebMethodsAgentValues, helpers.softwareAGWebMethodsTAEnvVarTemplate);
|
|
142
|
+
}
|
|
143
|
+
console.log('Configuration file(s) have been successfully created.\n');
|
|
144
|
+
generateSuccessHelpMsg(installConfig);
|
|
145
|
+
};
|
|
146
|
+
exports.completeInstall = completeInstall;
|
|
147
|
+
const SoftwareAGWebMethodsInstallMethods = exports.SoftwareAGWebMethodsInstallMethods = {
|
|
148
|
+
GetBundleType: askBundleType,
|
|
149
|
+
GetDeploymentType: askConfigType,
|
|
150
|
+
AskGatewayQuestions: gatewayConnectivity,
|
|
151
|
+
FinalizeGatewayInstall: completeInstall,
|
|
152
|
+
ConfigFiles: Object.values(ConfigFiles),
|
|
153
|
+
AgentNameMap: {
|
|
154
|
+
[_types.AgentTypes.da]: _types.AgentNames.SOFTWAREAGWEBMETHODS_DA,
|
|
155
|
+
[_types.AgentTypes.ta]: _types.AgentNames.SOFTWAREAGWEBMETHODS_TA
|
|
156
|
+
},
|
|
157
|
+
GatewayDisplay: _types.GatewayTypes.SOFTWAREAGWEBMETHODS
|
|
158
|
+
};
|
|
159
|
+
const testables = exports.testables = {
|
|
160
|
+
prompts,
|
|
161
|
+
ConfigFiles
|
|
162
|
+
};
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.testables = exports.gatewayConnectivity = exports.completeInstall = exports.askTraceableRegion = exports.askConfigType = exports.askBundleType = exports.amplifyAgentsNs = exports.TraceableInstallMethods = exports.ConfigFiles = void 0;
|
|
7
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
+
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
|
+
var _Kubectl = require("../../common/Kubectl");
|
|
10
|
+
var _basicPrompts = require("../../common/basicPrompts");
|
|
11
|
+
var _inputs = require("./helpers/inputs");
|
|
12
|
+
var _types = require("../../common/types");
|
|
13
|
+
var _utils = require("../../common/utils");
|
|
14
|
+
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
15
|
+
var _traceableTemplates = require("./helpers/templates/traceableTemplates");
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
const {
|
|
21
|
+
log
|
|
22
|
+
} = (0, _snooplogg.default)('central: install: agents: Traceable');
|
|
23
|
+
const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.TRACEABLE_TA}`;
|
|
24
|
+
const amplifyAgentsNs = exports.amplifyAgentsNs = 'amplify-agents';
|
|
25
|
+
|
|
26
|
+
// ConfigFiles - all the config file that are used in the setup
|
|
27
|
+
const ConfigFiles = exports.ConfigFiles = {
|
|
28
|
+
helmOverride: 'agent-overrides.yaml',
|
|
29
|
+
agentEnvVars: `${helpers.configFiles.AGENT_ENV_VARS}`
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// TraceablePrompts - prompts for user inputs
|
|
33
|
+
const prompts = {
|
|
34
|
+
configTypeMsg: 'Select the mode of installation',
|
|
35
|
+
agentNamespace: 'Enter the namespace to use for the Amplify Traceable Agents',
|
|
36
|
+
enterToken: 'Enter the token that the agent will use',
|
|
37
|
+
enterRegion: 'Enter the region that the agent will use',
|
|
38
|
+
enterEnvironments: 'Enter an environment that the agent will use',
|
|
39
|
+
enterInternalDomains: 'Enter if the internal domains should be used by the agent',
|
|
40
|
+
enterBasePathSegmentLen: 'Enter the base path segment length that agent will use for lookup',
|
|
41
|
+
enterMoreEnviroments: 'Do you want to enter another environment ?'
|
|
42
|
+
};
|
|
43
|
+
const askBundleType = async () => {
|
|
44
|
+
return _types.BundleType.TRACEABILITY;
|
|
45
|
+
};
|
|
46
|
+
exports.askBundleType = askBundleType;
|
|
47
|
+
const askConfigType = async () => {
|
|
48
|
+
return await (0, _basicPrompts.askList)({
|
|
49
|
+
msg: prompts.configTypeMsg,
|
|
50
|
+
choices: [_types.AgentConfigTypes.DOCKERIZED, _types.AgentConfigTypes.HELM]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
//
|
|
55
|
+
// Questions for the configuration of Traceable agent
|
|
56
|
+
//
|
|
57
|
+
exports.askConfigType = askConfigType;
|
|
58
|
+
const askToken = async () => await (0, _basicPrompts.askInput)({
|
|
59
|
+
msg: prompts.enterToken,
|
|
60
|
+
allowEmptyInput: false
|
|
61
|
+
});
|
|
62
|
+
const askTraceableRegion = async () => {
|
|
63
|
+
return await (0, _basicPrompts.askList)({
|
|
64
|
+
msg: prompts.enterRegion,
|
|
65
|
+
choices: Object.entries(_types.TraceableRegionType).reduce((accumulator, curr) => {
|
|
66
|
+
return accumulator.concat({
|
|
67
|
+
name: curr[0],
|
|
68
|
+
value: curr[1]
|
|
69
|
+
});
|
|
70
|
+
}, []),
|
|
71
|
+
default: _types.TraceableRegionType.US
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
exports.askTraceableRegion = askTraceableRegion;
|
|
75
|
+
const askEnvironments = async () => {
|
|
76
|
+
let askEnvs = true;
|
|
77
|
+
let envs = [];
|
|
78
|
+
console.log(_chalk.default.gray("An array of environments that the agent will use"));
|
|
79
|
+
while (askEnvs) {
|
|
80
|
+
const env = await (0, _basicPrompts.askInput)({
|
|
81
|
+
msg: prompts.enterEnvironments,
|
|
82
|
+
allowEmptyInput: true
|
|
83
|
+
});
|
|
84
|
+
if (envs.length === 0 && env.toString().trim() === "") {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
if (env && env.toString().trim() !== "") {
|
|
88
|
+
envs.push(env);
|
|
89
|
+
}
|
|
90
|
+
askEnvs = (await (0, _basicPrompts.askList)({
|
|
91
|
+
msg: prompts.enterMoreEnviroments,
|
|
92
|
+
default: _types.YesNo.No,
|
|
93
|
+
choices: _types.YesNoChoices
|
|
94
|
+
})) === _types.YesNo.Yes;
|
|
95
|
+
}
|
|
96
|
+
return envs;
|
|
97
|
+
};
|
|
98
|
+
const askInternalDomains = async () => (await (0, _basicPrompts.askList)({
|
|
99
|
+
msg: prompts.enterInternalDomains,
|
|
100
|
+
default: _types.YesNo.No,
|
|
101
|
+
choices: _types.YesNoChoices
|
|
102
|
+
})) === _types.YesNo.Yes;
|
|
103
|
+
const askBasePathSegmentLen = async () => await (0, _basicPrompts.askInput)({
|
|
104
|
+
msg: prompts.enterBasePathSegmentLen,
|
|
105
|
+
type: 'number',
|
|
106
|
+
defaultValue: 2
|
|
107
|
+
});
|
|
108
|
+
const gatewayConnectivity = async installConfig => {
|
|
109
|
+
let traceableAgentValues = new _traceableTemplates.TraceableAgentValues();
|
|
110
|
+
if (installConfig.switches.isHelmInstall) {
|
|
111
|
+
console.log(_chalk.default.gray(`The Amplify Traceable Agent needs to be deployed to your Kubernetes cluster to discover APIs for publishing to Amplify Central.`));
|
|
112
|
+
const {
|
|
113
|
+
error
|
|
114
|
+
} = await _Kubectl.kubectl.isInstalled();
|
|
115
|
+
if (error) {
|
|
116
|
+
throw new Error(`Kubectl is required to fill out the following prompts. It appears to be missing or misconfigured.\n${error}`);
|
|
117
|
+
}
|
|
118
|
+
traceableAgentValues.namespace = await (0, _inputs.askNamespace)(prompts.agentNamespace, amplifyAgentsNs);
|
|
119
|
+
}
|
|
120
|
+
if (installConfig.switches.isDockerInstall) {
|
|
121
|
+
console.log('\nCONNECTION TO TRACEABLE API GATEWAY:');
|
|
122
|
+
console.log(_chalk.default.gray("The Discovery Agent needs to connect to the Traceable API Gateway to discover API's for publishing to Amplify Central."));
|
|
123
|
+
}
|
|
124
|
+
traceableAgentValues.traceableToken = await askToken();
|
|
125
|
+
traceableAgentValues.traceableRegion = await askTraceableRegion();
|
|
126
|
+
traceableAgentValues.environments = await askEnvironments();
|
|
127
|
+
traceableAgentValues.internalDomains = await askInternalDomains();
|
|
128
|
+
traceableAgentValues.basePathSegmentLen = await askBasePathSegmentLen();
|
|
129
|
+
return traceableAgentValues;
|
|
130
|
+
};
|
|
131
|
+
exports.gatewayConnectivity = gatewayConnectivity;
|
|
132
|
+
const dockerSuccessMsg = installConfig => {
|
|
133
|
+
let dockerInfo;
|
|
134
|
+
const runAgentLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.AGENT_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
|
|
135
|
+
const runAgentWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.AGENT_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
|
|
136
|
+
const startAgentLinuxMsg = `\nStart the Traceable Agent on a Linux based machine`;
|
|
137
|
+
const startAgentWinMsg = `\nStart the Traceable Agent on a Windows machine`;
|
|
138
|
+
if (installConfig.switches.isTaEnabled) {
|
|
139
|
+
dockerInfo = `To utilize the agent, pull the latest Docker image and run it using the appropriate supplied environment file, (${helpers.configFiles.AGENT_ENV_VARS}):`;
|
|
140
|
+
console.log(_chalk.default.whiteBright(dockerInfo), '\n');
|
|
141
|
+
const taImageVersion = `${taImage}:${installConfig.taVersion}`;
|
|
142
|
+
console.log(_chalk.default.white('Pull the latest image of the Agent:'));
|
|
143
|
+
console.log(_chalk.default.cyan(`docker pull ${taImageVersion}`));
|
|
144
|
+
console.log(_chalk.default.white(_utils.isWindows ? startAgentWinMsg : startAgentLinuxMsg));
|
|
145
|
+
console.log(_chalk.default.cyan(_utils.isWindows ? runAgentWinMsg : runAgentLinuxMsg));
|
|
146
|
+
console.log('\t', _chalk.default.cyan(`-v /data ${taImageVersion}`), '\n');
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const helmSuccessMsg = namespace => {
|
|
150
|
+
console.log(`Traceable Agent override file has been placed at ${process.cwd()}/${ConfigFiles.helmOverride}`);
|
|
151
|
+
const installCmd = `helm upgrade --install --namespace ${namespace} Traceable-agent axway/Traceable-agent -f ${ConfigFiles.helmOverride}`;
|
|
152
|
+
console.log('To complete the Traceable Agent installation run the following commands:', _chalk.default.cyan('\n helm repo add axway https://helm.repository.axway.com --username=<client_id> --password=<client_secret>'), _chalk.default.cyan(`\n helm repo update\n ${installCmd}`), _chalk.default.cyan(`\n`), _chalk.default.white(`\n* client_id - service account id for your Amplify Platform organization`), _chalk.default.white(`\n* client_secret - service account secret for your Amplify Platform organization`));
|
|
153
|
+
};
|
|
154
|
+
const generateSuccessHelpMsg = installConfig => {
|
|
155
|
+
const traceableAgentValues = installConfig.gatewayConfig;
|
|
156
|
+
const configType = installConfig.deploymentType;
|
|
157
|
+
if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
|
|
158
|
+
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.'));
|
|
159
|
+
}
|
|
160
|
+
if (configType === _types.AgentConfigTypes.DOCKERIZED) {
|
|
161
|
+
dockerSuccessMsg(installConfig);
|
|
162
|
+
} else if (configType === _types.AgentConfigTypes.HELM) {
|
|
163
|
+
helmSuccessMsg(traceableAgentValues.namespace.name);
|
|
164
|
+
}
|
|
165
|
+
console.log('Configuration file(s) have been successfully created.\n');
|
|
166
|
+
console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.TRACEABLE}`));
|
|
167
|
+
};
|
|
168
|
+
const completeInstall = async installConfig => {
|
|
169
|
+
// Add final settings to TraceableAgentValues
|
|
170
|
+
const traceableAgentValues = installConfig.gatewayConfig;
|
|
171
|
+
traceableAgentValues.centralConfig = installConfig.centralConfig;
|
|
172
|
+
traceableAgentValues.traceabilityConfig = installConfig.traceabilityConfig;
|
|
173
|
+
if (installConfig.switches.isHelmInstall) {
|
|
174
|
+
if (traceableAgentValues.namespace.isNew) {
|
|
175
|
+
await helpers.createNamespace(traceableAgentValues.namespace.name);
|
|
176
|
+
}
|
|
177
|
+
await helpers.createSecret(traceableAgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, async () => {
|
|
178
|
+
if (installConfig.centralConfig.ampcDosaInfo.isNew) {
|
|
179
|
+
console.log(_chalk.default.yellow(`The secret '${helpers.amplifyAgentsKeysSecret}' will be created with the same "private_key.pem" and "public_key.pem" that was auto generated to create the Service Account.`));
|
|
180
|
+
}
|
|
181
|
+
await helpers.createAmplifyAgentKeysSecret(traceableAgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, 'publicKey', traceableAgentValues.centralConfig.dosaAccount.publicKey, 'privateKey', traceableAgentValues.centralConfig.dosaAccount.privateKey);
|
|
182
|
+
});
|
|
183
|
+
await helpers.createSecret(traceableAgentValues.namespace.name, helpers.amplifyAgentsCredsSecret, async () => {
|
|
184
|
+
await createTraceableCredsSecret(traceableAgentValues.namespace.name, helpers.amplifyAgentsCredsSecret, traceableAgentValues.traceableToken);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
console.log('Generating the configuration file(s)...');
|
|
188
|
+
if (installConfig.switches.isDockerInstall) {
|
|
189
|
+
if (installConfig.switches.isTaEnabled) {
|
|
190
|
+
(0, _utils.writeTemplates)(ConfigFiles.agentEnvVars, traceableAgentValues, helpers.traceableEnvVarTemplate);
|
|
191
|
+
}
|
|
192
|
+
} else if (installConfig.switches.isHelmInstall) {
|
|
193
|
+
(0, _utils.writeTemplates)(ConfigFiles.helmOverride, traceableAgentValues, helpers.traceableHelmOverrideTemplate);
|
|
194
|
+
}
|
|
195
|
+
generateSuccessHelpMsg(installConfig);
|
|
196
|
+
};
|
|
197
|
+
exports.completeInstall = completeInstall;
|
|
198
|
+
const createTraceableCredsSecret = async (namespace, secretName, token) => {
|
|
199
|
+
const {
|
|
200
|
+
error
|
|
201
|
+
} = await _Kubectl.kubectl.create('secret', `-n ${namespace} generic ${secretName} \
|
|
202
|
+
--from-literal=token=${token} `);
|
|
203
|
+
if (error) {
|
|
204
|
+
throw Error(error);
|
|
205
|
+
}
|
|
206
|
+
console.log(`Created ${secretName} in the ${namespace} namespace.`);
|
|
207
|
+
};
|
|
208
|
+
const TraceableInstallMethods = exports.TraceableInstallMethods = {
|
|
209
|
+
GetBundleType: askBundleType,
|
|
210
|
+
GetDeploymentType: askConfigType,
|
|
211
|
+
AskGatewayQuestions: gatewayConnectivity,
|
|
212
|
+
FinalizeGatewayInstall: completeInstall,
|
|
213
|
+
ConfigFiles: Object.values(ConfigFiles),
|
|
214
|
+
AgentNameMap: {
|
|
215
|
+
[_types.AgentTypes.da]: _types.AgentNames.TRACEABLE_TA,
|
|
216
|
+
[_types.AgentTypes.ta]: _types.AgentNames.TRACEABLE_TA
|
|
217
|
+
},
|
|
218
|
+
GatewayDisplay: _types.GatewayTypes.TRACEABLE
|
|
219
|
+
};
|
|
220
|
+
const testables = exports.testables = {
|
|
221
|
+
prompts,
|
|
222
|
+
ConfigFiles
|
|
223
|
+
};
|
|
@@ -65,52 +65,14 @@ class ApiServerClient {
|
|
|
65
65
|
scopeDef,
|
|
66
66
|
scopeName,
|
|
67
67
|
version = ApiServerVersions.v1alpha1,
|
|
68
|
-
expand
|
|
69
|
-
langDef
|
|
68
|
+
expand
|
|
70
69
|
}) {
|
|
71
70
|
const groupUrl = `/${resourceDef.metadata.scope.name}/${version}`;
|
|
72
71
|
const scopeUrl = scopeName && scopeDef ? `/${scopeDef.spec.plural}/${encodeURIComponent(scopeName)}` : '';
|
|
73
72
|
const resourceUrl = `/${resourceDef.spec.plural}`;
|
|
74
73
|
const nameUrl = resourceName ? `/${encodeURIComponent(resourceName)}` : '';
|
|
75
74
|
const expandUrl = expand ? `?expand=${expand}` : '';
|
|
76
|
-
|
|
77
|
-
langCode: langDef
|
|
78
|
-
}) : '';
|
|
79
|
-
if (expand) {
|
|
80
|
-
return `${groupUrl}${scopeUrl}${resourceUrl}${nameUrl}${expandUrl}`;
|
|
81
|
-
} else if (langDef) {
|
|
82
|
-
return `${groupUrl}${scopeUrl}${resourceUrl}${nameUrl}${langDefUrl}`;
|
|
83
|
-
} else {
|
|
84
|
-
return `${groupUrl}${scopeUrl}${resourceUrl}${nameUrl}`;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Build language definition url based on the language code.
|
|
90
|
-
*/
|
|
91
|
-
buildLanguageDefinitionUrl({
|
|
92
|
-
langCode
|
|
93
|
-
}) {
|
|
94
|
-
let langDefUrl = '';
|
|
95
|
-
let i = 0;
|
|
96
|
-
let embed = '?embed=';
|
|
97
|
-
let expand = '&expand=languages,';
|
|
98
|
-
let fields = '&fields=';
|
|
99
|
-
const langCodeArr = langCode.split(',');
|
|
100
|
-
langCodeArr.forEach(code => {
|
|
101
|
-
if (i < langCodeArr.length - 1) {
|
|
102
|
-
embed = embed + `languages-${code.trim()}.resource` + ",";
|
|
103
|
-
expand = expand + `languages-${code.trim()}` + ",";
|
|
104
|
-
fields = fields + `languages-${code.trim()}.values` + ",";
|
|
105
|
-
} else {
|
|
106
|
-
embed = embed + `languages-${code.trim()}.resource`;
|
|
107
|
-
expand = expand + `languages-${code.trim()}`;
|
|
108
|
-
fields = fields + `languages-${code.trim()}.values`;
|
|
109
|
-
}
|
|
110
|
-
i++;
|
|
111
|
-
});
|
|
112
|
-
langDefUrl = `${embed}${expand}${fields}`;
|
|
113
|
-
return langDefUrl;
|
|
75
|
+
return `${groupUrl}${scopeUrl}${resourceUrl}${nameUrl}${expandUrl}`;
|
|
114
76
|
}
|
|
115
77
|
|
|
116
78
|
/**
|
|
@@ -514,8 +476,7 @@ class ApiServerClient {
|
|
|
514
476
|
version = ApiServerVersions.v1alpha1,
|
|
515
477
|
query,
|
|
516
478
|
progressListener,
|
|
517
|
-
expand
|
|
518
|
-
langDef
|
|
479
|
+
expand
|
|
519
480
|
}) {
|
|
520
481
|
log(`getResourcesList, spec.kind = ${resourceDef.spec.kind}`);
|
|
521
482
|
const result = {
|
|
@@ -534,8 +495,7 @@ class ApiServerClient {
|
|
|
534
495
|
scopeDef,
|
|
535
496
|
scopeName,
|
|
536
497
|
version,
|
|
537
|
-
expand
|
|
538
|
-
langDef
|
|
498
|
+
expand
|
|
539
499
|
});
|
|
540
500
|
const response = await service.getWithPagination(url, query, 50, {}, progressListener);
|
|
541
501
|
result.data = response;
|
|
@@ -566,8 +526,7 @@ class ApiServerClient {
|
|
|
566
526
|
scopeDef,
|
|
567
527
|
scopeName,
|
|
568
528
|
version = ApiServerVersions.v1alpha1,
|
|
569
|
-
expand
|
|
570
|
-
langDef
|
|
529
|
+
expand
|
|
571
530
|
}) {
|
|
572
531
|
log(`getResourceByName, spec.kind = ${resourceDef.spec.kind}, name = ${resourceName}`);
|
|
573
532
|
const result = {
|
|
@@ -587,8 +546,7 @@ class ApiServerClient {
|
|
|
587
546
|
scopeDef,
|
|
588
547
|
scopeName,
|
|
589
548
|
version,
|
|
590
|
-
expand
|
|
591
|
-
langDef
|
|
549
|
+
expand
|
|
592
550
|
});
|
|
593
551
|
const response = await service.get(url);
|
|
594
552
|
result.data = response;
|
package/dist/common/types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.docsUrl = exports.commonCmdArgsDescription = exports.cliVersionHeader = exports.YesNoChoices = exports.YesNo = exports.WAIT_TIMEOUT = exports.TrueFalseChoices = exports.TrueFalse = exports.TraceabilityConfig = exports.SingleEntryPointUrls = exports.SaaSGatewayTypes = exports.Regions = exports.PublicRepoUrl = exports.PublicDockerRepoBaseUrl = exports.Protocol = exports.ProdBaseUrls = exports.Platforms = exports.OutputTypes = exports.MAX_TABLE_STRING_LENGTH = exports.MAX_FILE_SIZE = exports.MAX_CACHE_FILE_SIZE = exports.LoggingSource = exports.LanguageTypes = exports.KindTypes = exports.Kind = exports.IstioProfileChoices = exports.IstioInstallValues = exports.IstioAgentValues = exports.IngestionProtocolToHosts = exports.IngestionProtocol = exports.IngestionHostsHTTP = exports.IngestionHosts = exports.IngestionHTTPHosts = exports.IDPType = exports.IDPConfiguration = exports.IDPClientSecretAuthMethod = exports.IDPAuthType = exports.IDPAuthConfiguration = exports.IDPAuthClientSecret = exports.IDPAuthAccessToken = exports.GatewayTypes = exports.GatewayTypeToDataPlane = exports.GatewayMode = exports.EnvironmentConfigInfo = exports.DosaAccount = exports.DataPlaneNames = exports.DOSAConfigInfo = exports.ConfigTypes = exports.CloudFormationConfig = exports.Certificate = exports.CentralAgentConfig = exports.CACHE_FILE_TTL_MILLISECONDS = exports.BundleType = exports.BasePaths = exports.AuthUrls = exports.AgentTypes = exports.AgentResourceKind = exports.AgentNames = exports.AgentInstallSwitches = exports.AgentInstallConfig = exports.AgentConfigTypes = exports.AWSRegions = exports.APIGEEXDISCOVERYMODES = exports.APICDeployments = exports.ABORT_TIMEOUT = void 0;
|
|
6
|
+
exports.docsUrl = exports.commonCmdArgsDescription = exports.cliVersionHeader = exports.YesNoChoices = exports.YesNo = exports.WAIT_TIMEOUT = exports.TrueFalseChoices = exports.TrueFalse = exports.TraceableRegionType = exports.TraceabilityConfig = exports.SingleEntryPointUrls = exports.SaaSGatewayTypes = exports.Regions = exports.PublicRepoUrl = exports.PublicDockerRepoBaseUrl = exports.Protocol = exports.ProdBaseUrls = exports.Platforms = exports.OutputTypes = exports.MAX_TABLE_STRING_LENGTH = exports.MAX_FILE_SIZE = exports.MAX_CACHE_FILE_SIZE = exports.LoggingSource = exports.LanguageTypes = exports.KindTypes = exports.Kind = exports.IstioProfileChoices = exports.IstioInstallValues = exports.IstioAgentValues = exports.IngestionProtocolToHosts = exports.IngestionProtocol = exports.IngestionHostsHTTP = exports.IngestionHosts = exports.IngestionHTTPHosts = exports.IDPType = exports.IDPConfiguration = exports.IDPClientSecretAuthMethod = exports.IDPAuthType = exports.IDPAuthConfiguration = exports.IDPAuthClientSecret = exports.IDPAuthAccessToken = exports.GatewayTypes = exports.GatewayTypeToDataPlane = exports.GatewayMode = exports.EnvironmentConfigInfo = exports.DosaAccount = exports.DataPlaneNames = exports.DOSAConfigInfo = exports.ConfigTypes = exports.CloudFormationConfig = exports.Certificate = exports.CentralAgentConfig = exports.CACHE_FILE_TTL_MILLISECONDS = exports.BundleType = exports.BasePaths = exports.AuthUrls = exports.AgentTypes = exports.AgentResourceKind = exports.AgentNames = exports.AgentInstallSwitches = exports.AgentInstallConfig = exports.AgentConfigTypes = exports.AWSRegions = exports.APIGEEXDISCOVERYMODES = exports.APICDeployments = exports.ABORT_TIMEOUT = void 0;
|
|
7
7
|
var _dataService = require("./dataService");
|
|
8
8
|
var _utils = require("./utils");
|
|
9
9
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -235,6 +235,9 @@ let AgentNames = exports.AgentNames = /*#__PURE__*/function (AgentNames) {
|
|
|
235
235
|
AgentNames["GRAYLOG_TA"] = "graylog-agent";
|
|
236
236
|
AgentNames["IBMAPICONNECT_DA"] = "ibm-apiconnect-discovery-agent";
|
|
237
237
|
AgentNames["IBMAPICONNECT_TA"] = "ibm-apiconnect-traceability-agent";
|
|
238
|
+
AgentNames["TRACEABLE_TA"] = "traceable-agent";
|
|
239
|
+
AgentNames["SOFTWAREAGWEBMETHODS_DA"] = "software-ag-web-methods-discovery-agent";
|
|
240
|
+
AgentNames["SOFTWAREAGWEBMETHODS_TA"] = "software-ag-web-methods-traceability-agent";
|
|
238
241
|
return AgentNames;
|
|
239
242
|
}({});
|
|
240
243
|
let GatewayTypes = exports.GatewayTypes = /*#__PURE__*/function (GatewayTypes) {
|
|
@@ -247,6 +250,8 @@ let GatewayTypes = exports.GatewayTypes = /*#__PURE__*/function (GatewayTypes) {
|
|
|
247
250
|
GatewayTypes["KAFKA"] = "Kafka";
|
|
248
251
|
GatewayTypes["GRAYLOG"] = "Graylog";
|
|
249
252
|
GatewayTypes["IBMAPICONNECT"] = "IBM API Connect";
|
|
253
|
+
GatewayTypes["SOFTWAREAGWEBMETHODS"] = "Software AG WebMethods";
|
|
254
|
+
GatewayTypes["TRACEABLE"] = "Traceable";
|
|
250
255
|
return GatewayTypes;
|
|
251
256
|
}({});
|
|
252
257
|
let SaaSGatewayTypes = exports.SaaSGatewayTypes = /*#__PURE__*/function (SaaSGatewayTypes) {
|
|
@@ -267,7 +272,9 @@ let DataPlaneNames = exports.DataPlaneNames = /*#__PURE__*/function (DataPlaneNa
|
|
|
267
272
|
DataPlaneNames["GRAYLOG"] = "Graylog";
|
|
268
273
|
DataPlaneNames["IBMAPICONNECT"] = "APIConnect";
|
|
269
274
|
DataPlaneNames["KONG"] = "Kong";
|
|
275
|
+
DataPlaneNames["SOFTWAREAGWEBMETHODS"] = "Software AG WebMethods";
|
|
270
276
|
DataPlaneNames["SWAGGERHUB"] = "SwaggerHub";
|
|
277
|
+
DataPlaneNames["TRACEABLE"] = "Traceable";
|
|
271
278
|
DataPlaneNames["MULESOFT"] = "Mulesoft";
|
|
272
279
|
DataPlaneNames["WSO2"] = "WSO2";
|
|
273
280
|
DataPlaneNames["OTHER"] = "Other";
|
|
@@ -283,9 +290,11 @@ const GatewayTypeToDataPlane = exports.GatewayTypeToDataPlane = {
|
|
|
283
290
|
[GatewayTypes.ISTIO]: 'Istio',
|
|
284
291
|
[SaaSGatewayTypes.APIGEEX_GATEWAY]: DataPlaneNames.APIGEE,
|
|
285
292
|
[GatewayTypes.KAFKA]: DataPlaneNames.KAFKA,
|
|
293
|
+
[GatewayTypes.SOFTWAREAGWEBMETHODS]: DataPlaneNames.SOFTWAREAGWEBMETHODS,
|
|
286
294
|
[SaaSGatewayTypes.SWAGGERHUB]: DataPlaneNames.SWAGGERHUB,
|
|
287
295
|
[GatewayTypes.GRAYLOG]: DataPlaneNames.GRAYLOG,
|
|
288
|
-
[GatewayTypes.IBMAPICONNECT]: DataPlaneNames.IBMAPICONNECT
|
|
296
|
+
[GatewayTypes.IBMAPICONNECT]: DataPlaneNames.IBMAPICONNECT,
|
|
297
|
+
[GatewayTypes.TRACEABLE]: DataPlaneNames.TRACEABLE
|
|
289
298
|
};
|
|
290
299
|
let AgentResourceKind = exports.AgentResourceKind = /*#__PURE__*/function (AgentResourceKind) {
|
|
291
300
|
AgentResourceKind["da"] = "DiscoveryAgent";
|
|
@@ -469,15 +478,11 @@ class TraceabilityConfig {
|
|
|
469
478
|
constructor() {
|
|
470
479
|
_defineProperty(this, "host", void 0);
|
|
471
480
|
_defineProperty(this, "protocol", void 0);
|
|
472
|
-
_defineProperty(this, "enabled", void 0);
|
|
473
481
|
_defineProperty(this, "samplingPercentage", void 0);
|
|
474
|
-
_defineProperty(this, "samplingReportAllErrors", void 0);
|
|
475
482
|
_defineProperty(this, "usageReportingOffline", void 0);
|
|
476
483
|
this.host = IngestionHosts.US;
|
|
477
484
|
this.protocol = IngestionProtocol.Lumberjack;
|
|
478
|
-
this.samplingPercentage =
|
|
479
|
-
this.enabled = true;
|
|
480
|
-
this.samplingReportAllErrors = true;
|
|
485
|
+
this.samplingPercentage = 0;
|
|
481
486
|
this.usageReportingOffline = false;
|
|
482
487
|
}
|
|
483
488
|
}
|
|
@@ -738,4 +743,10 @@ let IDPAuthType = exports.IDPAuthType = /*#__PURE__*/function (IDPAuthType) {
|
|
|
738
743
|
IDPAuthType["AccessToken"] = "AccessToken";
|
|
739
744
|
IDPAuthType["ClientSecret"] = "ClientSecret";
|
|
740
745
|
return IDPAuthType;
|
|
746
|
+
}({});
|
|
747
|
+
let TraceableRegionType = exports.TraceableRegionType = /*#__PURE__*/function (TraceableRegionType) {
|
|
748
|
+
TraceableRegionType["US"] = "US";
|
|
749
|
+
TraceableRegionType["EU"] = "EU";
|
|
750
|
+
TraceableRegionType["AP"] = "AP";
|
|
751
|
+
return TraceableRegionType;
|
|
741
752
|
}({});
|