@axway/axway-central-cli 2.24.0 → 2.25.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.
@@ -24,6 +24,7 @@ var apigeeSaaSAgents = _interopRequireWildcard(require("./apigeexSaasAgents"));
24
24
  var helpers = _interopRequireWildcard(require("./helpers"));
25
25
  var istioAgents = _interopRequireWildcard(require("./istioAgents"));
26
26
  var saasAgents = _interopRequireWildcard(require("./awsSaasAgents"));
27
+ var kafkaAgents = _interopRequireWildcard(require("./kafkaAgents"));
27
28
  var platform = _interopRequireWildcard(require("./platform"));
28
29
  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); }
29
30
  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; }
@@ -44,7 +45,8 @@ const agentInstallFlows = {
44
45
  [_types.GatewayTypes.GITLAB]: gitLabAgents.GitLabInstallMethods,
45
46
  [_types.GatewayTypes.APIGEEX_GATEWAY]: apigeeSaaSAgents.APIGEEXSaaSInstallMethods,
46
47
  [_types.GatewayTypes.AZURE_GATEWAY]: azureAgents.AzureInstallMethods,
47
- [_types.GatewayTypes.ISTIO]: istioAgents.IstioInstallMethods
48
+ [_types.GatewayTypes.ISTIO]: istioAgents.IstioInstallMethods,
49
+ [_types.GatewayTypes.KAFKA]: kafkaAgents.KafkaInstallMethods
48
50
  };
49
51
  const saasAgentInstallFlows = {
50
52
  [_types.GatewayTypes.AWS_GATEWAY]: saasAgents.AWSSaaSInstallMethods,
@@ -52,7 +52,7 @@ const askForGitLabToken = async () => await (0, _basicPrompts.askInput)({
52
52
  });
53
53
  const askForGitLabBaseURL = async () => await (0, _basicPrompts.askInput)({
54
54
  msg: gitLabPrompts.BASE_URL,
55
- validate: (0, _basicPrompts.validateRegex)(helpers.GitLabRegexPatterns.gitLabBaseURLRegex, helpers.invalidValueExampleErrMsg('BaseURL', 'htpps://www.testdomain.com'))
55
+ validate: (0, _basicPrompts.validateRegex)(helpers.GitLabRegexPatterns.gitLabBaseURLRegex, helpers.invalidValueExampleErrMsg('BaseURL', 'https://www.testdomain.com'))
56
56
  });
57
57
  const askForGitLabRepositoryID = async () => await (0, _basicPrompts.askInput)({
58
58
  msg: gitLabPrompts.REPOSITORY_ID,
@@ -140,6 +140,18 @@ Object.keys(_gitLabTemplates).forEach(function (key) {
140
140
  }
141
141
  });
142
142
  });
143
+ var _kafkaTemplates = require("./templates/kafkaTemplates");
144
+ Object.keys(_kafkaTemplates).forEach(function (key) {
145
+ if (key === "default" || key === "__esModule") return;
146
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
147
+ if (key in exports && exports[key] === _kafkaTemplates[key]) return;
148
+ Object.defineProperty(exports, key, {
149
+ enumerable: true,
150
+ get: function () {
151
+ return _kafkaTemplates[key];
152
+ }
153
+ });
154
+ });
143
155
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
144
156
  const streamPipeline = exports.streamPipeline = _util.default.promisify(_stream.default.pipeline);
145
157
  const unzip = async filePath => {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.resourceRegex = exports.percentageRegex = exports.namespaceRegex = exports.maskingRegex = exports.invalidResourceMsg = exports.invalidPercentage = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.GitLabRegexPatterns = exports.GitHubRegexPatterns = exports.AzureRegexPatterns = exports.AWSRegexPatterns = exports.APIGEEXRegexPatterns = void 0;
6
+ exports.resourceRegex = exports.percentageRegex = exports.namespaceRegex = exports.maskingRegex = exports.invalidResourceMsg = exports.invalidPercentage = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.KafkaRegexPatterns = exports.GitLabRegexPatterns = exports.GitHubRegexPatterns = exports.AzureRegexPatterns = exports.AWSRegexPatterns = exports.APIGEEXRegexPatterns = void 0;
7
7
  const resourceRegex = exports.resourceRegex = '^(?:[a-z0-9]*(?:\\.(?=[a-z0-9])|-+(?=[a-z0-9]))?)+[a-z0-9]$';
8
8
  const namespaceRegex = exports.namespaceRegex = '^[a-z0-9]?(?:[-a-z0-9]*[a-z0-9]){1,100}?$';
9
9
  const domainNameRegex = exports.domainNameRegex = '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)+([A-Za-z]){2,}$';
@@ -57,4 +57,8 @@ const GitLabRegexPatterns = exports.GitLabRegexPatterns = {
57
57
  gitLabBaseURLRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$',
58
58
  gitHubRepositoryIDRegex: '^[0-9]*$',
59
59
  gitLabPathRegex: '^\/.*$'
60
+ };
61
+ const KafkaRegexPatterns = exports.KafkaRegexPatterns = {
62
+ bootstrapServerRegex: '^(SASL_SSL:\/\/|SASL_PLAINTEXT:\/\/|PLAINTEXT:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z0-9]{1,5}(:[0-9]{1,5})$',
63
+ schemaRegistryURLRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$'
60
64
  };
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.kafkaTAEnvVarTemplate = exports.kafkaDAEnvVarTemplate = exports.KafkaAgentValues = void 0;
7
+ var _types = require("../../../../common/types");
8
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
10
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
+ /**
12
+ * @description Parameters to provide to the Kafka handlebars templates.
13
+ */
14
+ class KafkaAgentValues {
15
+ constructor() {
16
+ _defineProperty(this, "cloudEnabled", void 0);
17
+ _defineProperty(this, "cloudEnvironmentId", void 0);
18
+ _defineProperty(this, "cloudAPIKey", void 0);
19
+ _defineProperty(this, "cloudAPISecret", void 0);
20
+ _defineProperty(this, "cloudClusterId", void 0);
21
+ _defineProperty(this, "clusterServer", void 0);
22
+ _defineProperty(this, "clusterAPIKey", void 0);
23
+ _defineProperty(this, "clusterAPISecret", void 0);
24
+ _defineProperty(this, "clusterSaslMechanism", void 0);
25
+ _defineProperty(this, "clusterSaslUser", void 0);
26
+ _defineProperty(this, "clusterSaslPassword", void 0);
27
+ _defineProperty(this, "schemaRegistryEnabled", void 0);
28
+ _defineProperty(this, "schemaRegistryUrl", void 0);
29
+ _defineProperty(this, "schemaRegistryAuthEnabled", void 0);
30
+ _defineProperty(this, "schemaRegistryAPIKey", void 0);
31
+ _defineProperty(this, "schemaRegistryAPISecret", void 0);
32
+ _defineProperty(this, "centralConfig", void 0);
33
+ _defineProperty(this, "traceabilityConfig", void 0);
34
+ this.cloudEnabled = false;
35
+ this.cloudEnvironmentId = '';
36
+ this.cloudAPIKey = '';
37
+ this.cloudAPISecret = '';
38
+ this.cloudClusterId = '';
39
+ this.clusterServer = '';
40
+ this.clusterAPIKey = '';
41
+ this.clusterAPISecret = '';
42
+ this.clusterSaslMechanism = '';
43
+ this.clusterSaslUser = '';
44
+ this.clusterSaslPassword = '';
45
+ this.schemaRegistryEnabled = false;
46
+ this.schemaRegistryUrl = '';
47
+ this.schemaRegistryAuthEnabled = true;
48
+ this.schemaRegistryAPIKey = '';
49
+ this.schemaRegistryAPISecret = '';
50
+ this.centralConfig = new _types.CentralAgentConfig();
51
+ this.traceabilityConfig = new _types.TraceabilityConfig();
52
+ }
53
+ }
54
+
55
+ /**
56
+ * @description Generates the Kafka DA env vars file.
57
+ */
58
+ exports.KafkaAgentValues = KafkaAgentValues;
59
+ const kafkaDAEnvVarTemplate = () => {
60
+ return `# Kafka cluster configs
61
+ {{#if cloudEnabled}}
62
+ KAFKA_CLOUD_ENABLED={{cloudEnabled}}
63
+ KAFKA_CLOUD_ENVIRONMENT={{cloudEnvironmentId}}
64
+ KAFKA_CLOUD_AUTH_APIKEY_ID={{cloudAPIKey}}
65
+ KAFKA_CLOUD_AUTH_APIKEY_SECRET={{cloudAPISecret}}
66
+ KAFKA_CLUSTER_ID={{cloudClusterId}}
67
+ KAFKA_CLUSTER_AUTH_APIKEY_ID={{clusterAPIKey}}
68
+ KAFKA_CLUSTER_AUTH_APIKEY_SECRET={{clusterAPISecret}}
69
+ {{else}}
70
+ KAFKA_CLUSTER_SERVERS={{clusterServer}}
71
+ {{#compare . clusterSaslMechanism "NONE" operator="!="}}
72
+ KAFKA_CLUSTER_AUTH_SASL_MECHANISM={{clusterSaslMechanism}}
73
+ KAFKA_CLUSTER_AUTH_SASL_USERNAME={{clusterSaslUser}}
74
+ KAFKA_CLUSTER_AUTH_SASL_PASSWORD={{clusterSaslPassword}}
75
+ {{/compare}}
76
+ {{/if}}
77
+
78
+ {{#if cloudEnabled}}
79
+ KAFKA_SCHEMAREGISTRY_ENABLED=true
80
+ KAFKA_SCHEMAREGISTRY_AUTH_APIKEY_ID={{schemaRegistryAPIKey}}
81
+ KAFKA_SCHEMAREGISTRY_AUTH_APIKEY_SECRET={{schemaRegistryAPISecret}}
82
+ {{else}}
83
+ {{#if schemaRegistryEnabled}}
84
+ KAFKA_SCHEMAREGISTRY_ENABLED=true
85
+ KAFKA_SCHEMAREGISTRY_URL={{schemaRegistryUrl}}
86
+ {{#if schemaRegistryAuthEnabled}}
87
+ KAFKA_SCHEMAREGISTRY_AUTH_SASL_MECHANISM={{clusterSaslMechanism}}
88
+ KAFKA_SCHEMAREGISTRY_AUTH_SASL_USERNAME={{clusterSaslUser}}
89
+ KAFKA_SCHEMAREGISTRY_AUTH_SASL_PASSWORD={{clusterSaslPassword}}
90
+ {{/if}}
91
+ {{/if}}
92
+ {{/if}}
93
+
94
+ # Amplify Central configs
95
+ CENTRAL_AGENTNAME={{centralConfig.daAgentName}}
96
+ CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
97
+ CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
98
+ CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
99
+ CENTRAL_ENVIRONMENT={{centralConfig.environment}}
100
+ CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
101
+ CENTRAL_TEAM={{centralConfig.ampcTeamName}}
102
+ CENTRAL_SINGLEURL={{centralConfig.singleEntryPointUrl}}
103
+ {{#compare . centralConfig.region "US" operator="!="}}
104
+ CENTRAL_URL={{centralConfig.url}}
105
+ {{/compare}}
106
+
107
+ # Logging configs
108
+ # Define the logging level: info, debug, error
109
+ LOG_LEVEL=info
110
+ # Specify where to send the log: stdout, file, both
111
+ LOG_OUTPUT=stdout
112
+ # Define where the log files are written
113
+ LOG_FILE_PATH=logs
114
+ `;
115
+ };
116
+
117
+ /**
118
+ * @description Generates the Kafka TA env vars file.
119
+ */
120
+ exports.kafkaDAEnvVarTemplate = kafkaDAEnvVarTemplate;
121
+ const kafkaTAEnvVarTemplate = () => {
122
+ return `# Kafka cluster configs
123
+ {{#if cloudEnabled}}
124
+ KAFKA_CLOUD_ENABLED={{cloudEnabled}}
125
+ KAFKA_CLOUD_ENVIRONMENT={{cloudEnvironmentId}}
126
+ KAFKA_CLOUD_AUTH_APIKEY_ID={{cloudAPIKey}}
127
+ KAFKA_CLOUD_AUTH_APIKEY_SECRET={{cloudAPISecret}}
128
+ KAFKA_CLUSTER_ID={{cloudClusterId}}
129
+ KAFKA_CLUSTER_AUTH_APIKEY_ID={{clusterAPIKey}}
130
+ KAFKA_CLUSTER_AUTH_APIKEY_SECRET={{clusterAPISecret}}
131
+ {{else}}
132
+ KAFKA_CLUSTER_SERVERS={{clusterServer}}
133
+ {{#compare . clusterSaslMechanism "NONE" operator="!="}}
134
+ KAFKA_CLUSTER_AUTH_SASL_MECHANISM={{clusterSaslMechanism}}
135
+ KAFKA_CLUSTER_AUTH_SASL_USERNAME={{clusterSaslUser}}
136
+ KAFKA_CLUSTER_AUTH_SASL_PASSWORD={{clusterSaslPassword}}
137
+ {{/compare}}
138
+ {{/if}}
139
+
140
+ # Amplify Central configs
141
+ CENTRAL_AGENTNAME={{centralConfig.taAgentName}}
142
+ CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
143
+ CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
144
+ CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
145
+ CENTRAL_ENVIRONMENT={{centralConfig.environment}}
146
+ CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
147
+ CENTRAL_TEAM={{centralConfig.ampcTeamName}}
148
+ CENTRAL_SINGLEURL={{centralConfig.singleEntryPointUrl}}
149
+ {{#compare . centralConfig.region "US" operator="!="}}
150
+ CENTRAL_URL={{centralConfig.url}}
151
+ CENTRAL_DEPLOYMENT={{centralConfig.deployment}}
152
+
153
+ TRACEABILITY_HOST={{traceabilityConfig.host}}
154
+ {{/compare}}
155
+ {{#compare . centralConfig.region "US"}}
156
+
157
+ {{/compare}}
158
+ {{#compare . traceabilityConfig.protocol "https"}}
159
+ TRACEABILITY_PROTOCOL={{traceabilityConfig.protocol}}
160
+ {{/compare}}
161
+
162
+ # Logging configs
163
+ # Define the logging level: info, debug, error
164
+ LOG_LEVEL=info
165
+ # Specify where to send the log: stdout, file, both
166
+ LOG_OUTPUT=stdout
167
+ # Define where the log files are written
168
+ LOG_FILE_PATH=logs
169
+ `;
170
+ };
171
+ exports.kafkaTAEnvVarTemplate = kafkaTAEnvVarTemplate;
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.testables = exports.gatewayConnectivity = exports.completeInstall = exports.askSaslMechanism = exports.askIsSchemaRegistryAuthEnabled = exports.askIsCloudEnabled = exports.askConfigType = exports.askBundleType = exports.SaslMechanismTypes = exports.KafkaInstallMethods = exports.DeploymentTypes = 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 _kafkaTemplates = require("./helpers/templates/kafkaTemplates");
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); }
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; }
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ // @ts-ignore
18
+ const {
19
+ log
20
+ } = (0, _snooplogg.default)('central: install: agents: kafka');
21
+ const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.KAFKA_DA}`;
22
+ const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.KAFKA_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
+ // DeploymentTypes - types of Kafka cluster deployments
31
+ let DeploymentTypes = exports.DeploymentTypes = /*#__PURE__*/function (DeploymentTypes) {
32
+ DeploymentTypes["CONFLUENT_CLOUD"] = "Confluent Cloud";
33
+ DeploymentTypes["CONFLUENT_PLATFORM"] = "Confluent Platform";
34
+ return DeploymentTypes;
35
+ }({}); // SaslMechanismTypes - SASL authentication mechanism types
36
+ let SaslMechanismTypes = exports.SaslMechanismTypes = /*#__PURE__*/function (SaslMechanismTypes) {
37
+ SaslMechanismTypes["SCRAM_SHA_256"] = "SCRAM-SHA-256";
38
+ SaslMechanismTypes["SCRAM_SHA_512"] = "SCRAM-SHA-512";
39
+ SaslMechanismTypes["PLAIN"] = "PLAIN";
40
+ SaslMechanismTypes["NONE"] = "NONE";
41
+ return SaslMechanismTypes;
42
+ }({}); // KafkaPrompts - prompts for user inputs
43
+ const prompts = {
44
+ deploymentTypeMsg: 'Select the type of deployment you wish to configure',
45
+ enterEnvironmentId: 'Enter the Environment Id',
46
+ enterClusterId: 'Enter the Cluster Id',
47
+ enterCloudAPIKey: 'Enter the Cloud API Key Id',
48
+ enterCloudAPISecret: 'Enter the Cloud API Key Secret',
49
+ enterClusterServer: 'Enter the Bootstrap Server Name',
50
+ enterClusterAPIKey: 'Enter the Cluster API Key Id',
51
+ enterClusterAPISecret: 'Enter the Cluster API Key Secret',
52
+ saslMechanismMsg: "Select the SASL Mechanism you wish to use for authentication",
53
+ enterSaslUsername: "Enter the SASL Username",
54
+ enterSaslPassword: "Enter the SASL Password",
55
+ schemaRegistryEnabledMsg: 'Do you want to use Schema Registry with Kafka cluster?',
56
+ enterSchemaRegistryUrl: 'Enter the Schema Registry Url',
57
+ schemaRegistryAuthEnabled: 'Do you want to authenticate Schema Registry with SASL User?',
58
+ enterSchemaRegistryAPIKey: 'Enter the Schema Registry API Key Id',
59
+ enterSchemaRegistryAPISecret: 'Enter the Schema Registry API Key Secret'
60
+ };
61
+ const askBundleType = async () => {
62
+ return await (0, _basicPrompts.askList)({
63
+ msg: helpers.agentMessages.selectAgentType,
64
+ choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
65
+ });
66
+ };
67
+ exports.askBundleType = askBundleType;
68
+ const askConfigType = async () => {
69
+ return _types.AgentConfigTypes.DOCKERIZED;
70
+ };
71
+
72
+ //
73
+ // Questions for the configuration of Kafka agents
74
+ //
75
+ exports.askConfigType = askConfigType;
76
+ const askIsCloudEnabled = async () => {
77
+ const deploymentType = await (0, _basicPrompts.askList)({
78
+ msg: prompts.deploymentTypeMsg,
79
+ default: DeploymentTypes.CONFLUENT_CLOUD,
80
+ choices: [{
81
+ name: DeploymentTypes.CONFLUENT_CLOUD,
82
+ value: DeploymentTypes.CONFLUENT_CLOUD
83
+ }, {
84
+ name: DeploymentTypes.CONFLUENT_PLATFORM,
85
+ value: DeploymentTypes.CONFLUENT_PLATFORM
86
+ }]
87
+ });
88
+ return deploymentType == DeploymentTypes.CONFLUENT_CLOUD;
89
+ };
90
+ exports.askIsCloudEnabled = askIsCloudEnabled;
91
+ const askEnvironmentId = async () => await (0, _basicPrompts.askInput)({
92
+ msg: prompts.enterEnvironmentId
93
+ });
94
+ const askClusterId = async () => await (0, _basicPrompts.askInput)({
95
+ msg: prompts.enterClusterId
96
+ });
97
+ const askCloudAPIKey = async () => await (0, _basicPrompts.askInput)({
98
+ msg: prompts.enterCloudAPIKey
99
+ });
100
+ const askCloudAPISecret = async () => await (0, _basicPrompts.askInput)({
101
+ msg: prompts.enterCloudAPISecret
102
+ });
103
+ const askClusterServer = async () => await (0, _basicPrompts.askInput)({
104
+ msg: prompts.enterClusterServer,
105
+ validate: (0, _basicPrompts.validateRegex)(helpers.KafkaRegexPatterns.bootstrapServerRegex, helpers.invalidValueExampleErrMsg('Bootstrap Server Name', 'SASL_SSL://somehost.testdomain.com:9092'))
106
+ });
107
+ const askClusterAPIKey = async () => await (0, _basicPrompts.askInput)({
108
+ msg: prompts.enterClusterAPIKey
109
+ });
110
+ const askClusterAPISecret = async () => await (0, _basicPrompts.askInput)({
111
+ msg: prompts.enterClusterAPISecret
112
+ });
113
+ const askSaslMechanism = async () => {
114
+ return await (0, _basicPrompts.askList)({
115
+ msg: prompts.saslMechanismMsg,
116
+ default: SaslMechanismTypes.PLAIN,
117
+ choices: [{
118
+ name: SaslMechanismTypes.NONE,
119
+ value: SaslMechanismTypes.NONE
120
+ }, {
121
+ name: SaslMechanismTypes.PLAIN,
122
+ value: SaslMechanismTypes.PLAIN
123
+ }, {
124
+ name: SaslMechanismTypes.SCRAM_SHA_256,
125
+ value: SaslMechanismTypes.SCRAM_SHA_256
126
+ }, {
127
+ name: SaslMechanismTypes.SCRAM_SHA_512,
128
+ value: SaslMechanismTypes.SCRAM_SHA_512
129
+ }]
130
+ });
131
+ };
132
+ exports.askSaslMechanism = askSaslMechanism;
133
+ const askSaslUsername = async () => await (0, _basicPrompts.askInput)({
134
+ msg: prompts.enterSaslUsername
135
+ });
136
+ const askSaslPassword = async () => await (0, _basicPrompts.askInput)({
137
+ msg: prompts.enterSaslPassword
138
+ });
139
+ const askIsSchemaRegistryEnabled = async () => {
140
+ const enabled = await (0, _basicPrompts.askList)({
141
+ msg: prompts.schemaRegistryEnabledMsg,
142
+ default: _types.YesNo.Yes,
143
+ choices: _types.YesNoChoices
144
+ });
145
+ return enabled == _types.YesNo.Yes;
146
+ };
147
+ const askIsSchemaRegistryAuthEnabled = async () => {
148
+ const enabled = await (0, _basicPrompts.askList)({
149
+ msg: prompts.schemaRegistryAuthEnabled,
150
+ default: _types.YesNo.Yes,
151
+ choices: _types.YesNoChoices
152
+ });
153
+ return enabled == _types.YesNo.Yes;
154
+ };
155
+ exports.askIsSchemaRegistryAuthEnabled = askIsSchemaRegistryAuthEnabled;
156
+ const askSchemaRegistryUrl = async () => await (0, _basicPrompts.askInput)({
157
+ msg: prompts.enterSchemaRegistryUrl,
158
+ validate: (0, _basicPrompts.validateRegex)(helpers.KafkaRegexPatterns.schemaRegistryURLRegex, helpers.invalidValueExampleErrMsg('Schema Registry Url', 'https://www.testdomain.com'))
159
+ });
160
+ const askSchemaRegistryAPIKey = async () => await (0, _basicPrompts.askInput)({
161
+ msg: prompts.enterSchemaRegistryAPIKey
162
+ });
163
+ const askSchemaRegistryAPISecret = async () => await (0, _basicPrompts.askInput)({
164
+ msg: prompts.enterSchemaRegistryAPISecret
165
+ });
166
+ const gatewayConnectivity = async installConfig => {
167
+ const kafkaAgentValues = new _kafkaTemplates.KafkaAgentValues();
168
+ kafkaAgentValues.cloudEnabled = await askIsCloudEnabled();
169
+ if (kafkaAgentValues.cloudEnabled) {
170
+ kafkaAgentValues.cloudEnvironmentId = await askEnvironmentId();
171
+ kafkaAgentValues.cloudClusterId = await askClusterId();
172
+ kafkaAgentValues.cloudAPIKey = await askCloudAPIKey();
173
+ kafkaAgentValues.cloudAPISecret = await askCloudAPISecret();
174
+ kafkaAgentValues.clusterAPIKey = await askClusterAPIKey();
175
+ kafkaAgentValues.clusterAPISecret = await askClusterAPISecret();
176
+ } else {
177
+ kafkaAgentValues.clusterServer = await askClusterServer();
178
+ kafkaAgentValues.clusterSaslMechanism = await askSaslMechanism();
179
+ if (kafkaAgentValues.clusterSaslMechanism !== SaslMechanismTypes.NONE) {
180
+ kafkaAgentValues.clusterSaslUser = await askSaslUsername();
181
+ kafkaAgentValues.clusterSaslPassword = await askSaslPassword();
182
+ }
183
+ }
184
+ if (installConfig.switches.isDaEnabled) {
185
+ if (kafkaAgentValues.cloudEnabled) {
186
+ kafkaAgentValues.schemaRegistryAPIKey = await askSchemaRegistryAPIKey();
187
+ kafkaAgentValues.schemaRegistryAPISecret = await askSchemaRegistryAPISecret();
188
+ } else {
189
+ kafkaAgentValues.schemaRegistryEnabled = await askIsSchemaRegistryEnabled();
190
+ if (kafkaAgentValues.schemaRegistryEnabled) {
191
+ kafkaAgentValues.schemaRegistryUrl = await askSchemaRegistryUrl();
192
+ kafkaAgentValues.schemaRegistryAuthEnabled = await askIsSchemaRegistryAuthEnabled();
193
+ }
194
+ }
195
+ }
196
+ return kafkaAgentValues;
197
+ };
198
+ exports.gatewayConnectivity = gatewayConnectivity;
199
+ const generateSuccessHelpMsg = installConfig => {
200
+ if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
201
+ 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.'));
202
+ }
203
+ dockerSuccessMsg(installConfig);
204
+ console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.AZURE}`));
205
+ };
206
+ const dockerSuccessMsg = installConfig => {
207
+ let dockerInfo;
208
+ const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
209
+ const runDaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
210
+ const runTaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
211
+ const runTaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
212
+ const startDaLinuxMsg = `\nStart the Discovery Agent on a Linux based machine`;
213
+ const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
214
+ const startTaLinuxMsg = `\nStart the Traceability Agent on a Linux based machine`;
215
+ const startTaWinMsg = `\nStart the Traceability Agent on a Windows machine`;
216
+ if (installConfig.switches.isDaEnabled && installConfig.switches.isTaEnabled) {
217
+ 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}):`;
218
+ } else if (installConfig.switches.isDaEnabled) {
219
+ dockerInfo = `To utilize the discovery agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.DA_ENV_VARS}):`;
220
+ } else {
221
+ dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
222
+ }
223
+ console.log(_chalk.default.whiteBright(dockerInfo), '\n');
224
+ if (installConfig.switches.isDaEnabled) {
225
+ const daImageVersion = `${daImage}:${installConfig.daVersion}`;
226
+ console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
227
+ console.log(_chalk.default.cyan(`docker pull ${daImageVersion}`));
228
+ console.log(_chalk.default.white(_utils.isWindows ? startDaWinMsg : startDaLinuxMsg));
229
+ console.log(_chalk.default.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
230
+ console.log('\t', _chalk.default.cyan(`-v /data ${daImageVersion}`), '\n');
231
+ }
232
+ if (installConfig.switches.isTaEnabled) {
233
+ const taImageVersion = `${taImage}:${installConfig.taVersion}`;
234
+ console.log(_chalk.default.white('Pull the latest image of the Traceability Agent:'));
235
+ console.log(_chalk.default.cyan(`docker pull ${taImageVersion}`));
236
+ console.log(_chalk.default.white(_utils.isWindows ? startTaWinMsg : startTaLinuxMsg));
237
+ console.log(_chalk.default.cyan(_utils.isWindows ? runTaWinMsg : runTaLinuxMsg));
238
+ console.log('\t', _chalk.default.cyan(`-v /data ${taImageVersion}`), '\n');
239
+ }
240
+ };
241
+ const completeInstall = async installConfig => {
242
+ // Add final settings to kafkaAgentsValues
243
+ const kafkaAgentValues = installConfig.gatewayConfig;
244
+ kafkaAgentValues.centralConfig = installConfig.centralConfig;
245
+ kafkaAgentValues.traceabilityConfig = installConfig.traceabilityConfig;
246
+ console.log('Generating the configuration file(s)...');
247
+ if (installConfig.switches.isDaEnabled) {
248
+ (0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, kafkaAgentValues, helpers.kafkaDAEnvVarTemplate);
249
+ }
250
+ if (installConfig.switches.isTaEnabled) {
251
+ (0, _utils.writeTemplates)(ConfigFiles.TAEnvVars, kafkaAgentValues, helpers.kafkaTAEnvVarTemplate);
252
+ }
253
+ console.log('Configuration file(s) have been successfully created.\n');
254
+ generateSuccessHelpMsg(installConfig);
255
+ };
256
+ exports.completeInstall = completeInstall;
257
+ const KafkaInstallMethods = exports.KafkaInstallMethods = {
258
+ GetBundleType: askBundleType,
259
+ GetDeploymentType: askConfigType,
260
+ AskGatewayQuestions: gatewayConnectivity,
261
+ FinalizeGatewayInstall: completeInstall,
262
+ ConfigFiles: Object.values(ConfigFiles),
263
+ AgentNameMap: {
264
+ [_types.AgentTypes.da]: _types.AgentNames.KAFKA_DA,
265
+ [_types.AgentTypes.ta]: _types.AgentNames.KAFKA_TA
266
+ },
267
+ GatewayDisplay: _types.GatewayTypes.KAFKA
268
+ };
269
+ const testables = exports.testables = {
270
+ prompts,
271
+ ConfigFiles
272
+ };
@@ -47,14 +47,16 @@ const getTraceabilityConfig = async installConfig => {
47
47
  // Do not ask Traceability questions in offline mode
48
48
  if (!traceabilityConfig.usageReportingOffline) {
49
49
  console.log('\nCONNECTION TO TRACEABILITY MODULE:');
50
- const {
51
- enabled,
52
- samplingPercentage,
53
- shouldReportAllErrors
54
- } = await helpers.askToEnableTransactionLogging();
55
- traceabilityConfig.enabled = enabled;
56
- traceabilityConfig.samplingPercentage = samplingPercentage;
57
- traceabilityConfig.samplingReportAllErrors = shouldReportAllErrors;
50
+ if (installConfig.gatewayType !== _types.GatewayTypes.KAFKA) {
51
+ const {
52
+ enabled,
53
+ samplingPercentage,
54
+ shouldReportAllErrors
55
+ } = await helpers.askToEnableTransactionLogging();
56
+ traceabilityConfig.enabled = enabled;
57
+ traceabilityConfig.samplingPercentage = samplingPercentage;
58
+ traceabilityConfig.samplingReportAllErrors = shouldReportAllErrors;
59
+ }
58
60
  const traceabilityProtocol = await helpers.askIngestionProtocol();
59
61
  traceabilityConfig.protocol = traceabilityProtocol;
60
62
  traceabilityConfig.host = helpers.getIngestionHost(installConfig.centralConfig.region, _CoreConfigController.CoreConfigController.getEnv(), installConfig.centralConfig.deployment, traceabilityProtocol);
@@ -64,7 +64,7 @@ const getBaseUrl = async (baseUrl, basePath, region, orgRegion) => {
64
64
  const configuredRegion = String(region || configRegion || orgRegion || _types.Regions.US).toUpperCase();
65
65
  log(`Using region "${configuredRegion}" from ${region ? '--region' : configRegion ? 'config' : orgRegion ? 'org' : 'default'}`);
66
66
  const prodBaseurl = _types.ProdBaseUrls[configuredRegion];
67
- if (!prodBaseurl) throw Error('Unknown region provided, check your region config, should be one of: US, EU');
67
+ if (!prodBaseurl) throw Error('Unknown region provided, check your region config, should be one of: ' + Object.keys(_types.ProdBaseUrls).join(", "));
68
68
  return basePath ? prodBaseurl + basePath : prodBaseurl;
69
69
  }
70
70
  };
@@ -221,6 +221,8 @@ let AgentNames = exports.AgentNames = /*#__PURE__*/function (AgentNames) {
221
221
  AgentNames["AZURE_TA"] = "azure-traceability-agent";
222
222
  AgentNames["EDGE_DA"] = "v7-discovery-agent";
223
223
  AgentNames["EDGE_TA"] = "v7-traceability-agent";
224
+ AgentNames["KAFKA_DA"] = "kafka-discovery-agent";
225
+ AgentNames["KAFKA_TA"] = "kafka-traceability-agent";
224
226
  return AgentNames;
225
227
  }({});
226
228
  let GatewayTypes = exports.GatewayTypes = /*#__PURE__*/function (GatewayTypes) {
@@ -232,6 +234,7 @@ let GatewayTypes = exports.GatewayTypes = /*#__PURE__*/function (GatewayTypes) {
232
234
  GatewayTypes["GITLAB"] = "GitLab";
233
235
  GatewayTypes["ISTIO"] = "Istio";
234
236
  GatewayTypes["EDGE_GATEWAY_ONLY"] = "Amplify API Gateway only";
237
+ GatewayTypes["KAFKA"] = "Kafka";
235
238
  return GatewayTypes;
236
239
  }({});
237
240
  let SaaSGatewayTypes = exports.SaaSGatewayTypes = /*#__PURE__*/function (SaaSGatewayTypes) {
@@ -247,6 +250,7 @@ let DataPlaneNames = exports.DataPlaneNames = /*#__PURE__*/function (DataPlaneNa
247
250
  DataPlaneNames["GITLAB"] = "GitLab";
248
251
  DataPlaneNames["AZURE"] = "Azure";
249
252
  DataPlaneNames["EDGE"] = "Edge";
253
+ DataPlaneNames["KAFKA"] = "Kafka";
250
254
  DataPlaneNames["KONG"] = "Kong";
251
255
  DataPlaneNames["MULESOFT"] = "Mulesoft";
252
256
  DataPlaneNames["WSO2"] = "WSO2";
@@ -261,7 +265,8 @@ const GatewayTypeToDataPlane = exports.GatewayTypeToDataPlane = {
261
265
  [GatewayTypes.GITLAB]: DataPlaneNames.GITLAB,
262
266
  [GatewayTypes.AZURE_GATEWAY]: DataPlaneNames.AZURE,
263
267
  [GatewayTypes.ISTIO]: 'Istio',
264
- [GatewayTypes.APIGEEX_GATEWAY]: DataPlaneNames.APIGEE
268
+ [GatewayTypes.APIGEEX_GATEWAY]: DataPlaneNames.APIGEE,
269
+ [GatewayTypes.KAFKA]: DataPlaneNames.KAFKA
265
270
  };
266
271
  let AgentResourceKind = exports.AgentResourceKind = /*#__PURE__*/function (AgentResourceKind) {
267
272
  AgentResourceKind["da"] = "DiscoveryAgent";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axway/axway-central-cli",
3
- "version": "2.24.0",
3
+ "version": "2.25.0",
4
4
  "description": "Manage APIs, services and publish to the Unified Catalog",
5
5
  "homepage": "https://platform.axway.com",
6
6
  "author": {
package/da.yaml DELETED
@@ -1,47 +0,0 @@
1
-
2
- ---
3
- group: management
4
- apiVersion: v1alpha1
5
- kind: DiscoveryAgent
6
- name: aws-discovery-agent
7
- title: AWS Discovery Agent
8
- metadata:
9
- id: 8ac989a48947da6401894b06933a0008
10
- audit:
11
- createTimestamp: 2023-07-12T16:54:29.434+0000
12
- createUserId: 821ba748-459f-45b0-ab87-82d11052975a
13
- modifyTimestamp: 2023-07-12T16:54:30.276+0000
14
- scope:
15
- id: 8ac989a48947da6401894b068b940000
16
- kind: Environment
17
- name: aws-cli
18
- title: aws-cli
19
- selfLink: /management/v1alpha1/environments/aws-cli
20
- acl: []
21
- accessRights:
22
- canChangeOwner: true
23
- canDelete: true
24
- canWrite: true
25
- canRead: true
26
- resourceVersion: '3'
27
- references:
28
- - id: 8ac989a48947da6401894b068d870002
29
- kind: Dataplane
30
- name: aws-dataplane
31
- scopeKind: Environment
32
- scopeName: aws-cli
33
- selfLink: /management/v1alpha1/environments/aws-cli/dataplanes/aws-dataplane
34
- type: soft
35
- group: management
36
- selfLink: >-
37
- /management/v1alpha1/environments/aws-cli/discoveryagents/aws-discovery-agent
38
- attributes: {}
39
- finalizers: []
40
- tags: []
41
- spec:
42
- config:
43
- owningTeam: Default Team
44
- dataplaneType: AWS
45
- dataplane:
46
- name: aws-dataplane
47
- queueDiscovery: true