@axway/axway-central-cli 3.10.0-rc.1 → 3.10.0-rc.3

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.
@@ -15,6 +15,7 @@ var _CliConfigManager = require("../../common/CliConfigManager");
15
15
  var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
16
16
  var _types = require("../../common/types");
17
17
  var _utils = require("../../common/utils");
18
+ var apigeeXAgents = _interopRequireWildcard(require("./apigeexAgents"));
18
19
  var awsAgents = _interopRequireWildcard(require("./awsAgents"));
19
20
  var awsSaaSAgents = _interopRequireWildcard(require("./awsSaasAgents"));
20
21
  var gitHubAgents = _interopRequireWildcard(require("./gitHubSaasAgents"));
@@ -48,6 +49,7 @@ const agentInstallFlows = {
48
49
  [_types.GatewayTypes.EDGE_GATEWAY]: edgeAgents.EdgeInstallMethods,
49
50
  [_types.GatewayTypes.EDGE_GATEWAY_ONLY]: edgeAgents.EdgeGWOnlyInstallMethods,
50
51
  [_types.GatewayTypes.AWS_GATEWAY]: awsAgents.AWSInstallMethods,
52
+ [_types.GatewayTypes.APIGEEX_GATEWAY]: apigeeXAgents.ApigeeXInstallMethods,
51
53
  [_types.GatewayTypes.GITLAB]: gitLabAgents.GitLabInstallMethods,
52
54
  [_types.GatewayTypes.AZURE_GATEWAY]: azureAgents.AzureInstallMethods,
53
55
  [_types.GatewayTypes.AZURE_EVENTHUB]: azureAgents.AzureInstallMethods,
@@ -134,7 +136,7 @@ const agents = exports.agents = {
134
136
  installConfig.centralConfig.singleEntryPointUrl = _types.SingleEntryPointUrls[installConfig.centralConfig.region];
135
137
  let gatewayTypeChoices = [];
136
138
  Object.values(_types.GatewayTypes).forEach(v => gatewayTypeChoices.push(v));
137
- Object.values(_types.SaaSGatewayTypes).filter(v => v !== _types.SaaSGatewayTypes.AWS_GATEWAY).forEach(v => gatewayTypeChoices.push(v));
139
+ Object.values(_types.SaaSGatewayTypes).filter(v => v !== _types.SaaSGatewayTypes.AWS_GATEWAY && v !== _types.SaaSGatewayTypes.APIGEEX_GATEWAY).forEach(v => gatewayTypeChoices.push(v));
138
140
  let gatewayChoices = gatewayTypeChoices.sort().filter(v => v !== _types.GatewayTypes.EDGE_GATEWAY_ONLY);
139
141
  let gatewayType = await (0, _basicPrompts.askList)({
140
142
  msg: prompts.selectGatewayType,
@@ -142,7 +144,7 @@ const agents = exports.agents = {
142
144
  });
143
145
 
144
146
  // if this check gets bigger, may think about an array of agents that can be both ground and embedded until ground agents become obsolete
145
- if (gatewayType === _types.GatewayTypes.AWS_GATEWAY || gatewayType === _types.GatewayTypes.AZURE_GATEWAY || gatewayType === _types.GatewayTypes.AZURE_EVENTHUB) {
147
+ if (gatewayType === _types.GatewayTypes.AWS_GATEWAY || gatewayType === _types.GatewayTypes.AZURE_GATEWAY || gatewayType === _types.GatewayTypes.AZURE_EVENTHUB || gatewayType === _types.GatewayTypes.APIGEEX_GATEWAY) {
146
148
  // hosted vs on premise
147
149
  installConfig.switches.isHostedInstall = (await (0, _basicPrompts.askList)({
148
150
  msg: prompts.hostedAgentOption,
@@ -150,7 +152,7 @@ const agents = exports.agents = {
150
152
  default: _types.YesNo.Yes
151
153
  })) === _types.YesNo.Yes;
152
154
  }
153
- if (gatewayType === _types.SaaSGatewayTypes.APIGEEX_GATEWAY || gatewayType === _types.SaaSGatewayTypes.GITHUB || gatewayType === _types.SaaSGatewayTypes.SWAGGERHUB) {
155
+ if (gatewayType === _types.SaaSGatewayTypes.GITHUB || gatewayType === _types.SaaSGatewayTypes.SWAGGERHUB) {
154
156
  installConfig.switches.isHostedInstall = true;
155
157
  }
156
158
 
@@ -0,0 +1,224 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.testables = exports.gatewayConnectivity = exports.defaultLogFiles = exports.completeInstall = exports.askConfigType = exports.askBundleType = exports.ConfigFiles = exports.ApigeeXInstallMethods = 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 _apigeexTemplates = require("./helpers/templates/apigeexTemplates");
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: apigeeX');
21
+ const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.APIGEEX_DA}`;
22
+ const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.APIGEEX_TA}`;
23
+ const defaultLogFiles = exports.defaultLogFiles = '/group-*_instance-*.log';
24
+
25
+ // ConfigFiles - all the config file that are used in the setup
26
+ const ConfigFiles = exports.ConfigFiles = {
27
+ DAEnvVars: `${helpers.configFiles.DA_ENV_VARS}`,
28
+ TAEnvVars: `${helpers.configFiles.TA_ENV_VARS}`,
29
+ ApigeeXDABinaryFile: 'discovery_agent',
30
+ ApigeeXDAYaml: 'discovery_agent.yml',
31
+ ApigeeXTABinaryFile: 'traceability_agent',
32
+ ApigeeXTAYaml: 'traceability_agent.yml'
33
+ };
34
+
35
+ // ApigeeXPrompts - prompts for user inputs
36
+ const ApigeeXPrompts = {
37
+ AUTHENTICATION_TYPE: 'Authenticate with an Impersonation of a Service Account or by providing a Credential File',
38
+ PROJECT_ID: 'Enter the APIGEE X Project ID the agent will use',
39
+ DEVELOPER_EMAIL_ADDRESS: 'Enter the APIGEE X Developer Email Address the agent will use',
40
+ AUTH_FILE_NAME: 'Enter the GCP key file name (place in the same directory as your Axway public and private keys)',
41
+ UPLOAD_CREDENTIAL_FILE: 'Upload a JSON Credential file to be used for APIGEE X Authentication',
42
+ DA_FREQUENCY: 'How often should the discovery run, leave blank for integrating in CI/CD process',
43
+ TA_FREQUENCY: 'How often should the traffic collection run, leave blank for manual trigger only',
44
+ QUEUE: 'Do you want to discover immediately after installation',
45
+ ENTER_MORE: 'Do you want to enter another {0} for {1}',
46
+ FILTER_METRICS: 'Do you want metrics filtering?',
47
+ FILTERED_APIS: 'Enter APIs to filter metrics for',
48
+ ENTER_MORE_APIS: 'Do you want to add another API?',
49
+ ENVIRONMENT: 'Enter the Apigee Envirnoment to filter discovered APIs/metrics'
50
+ };
51
+ const askBundleType = async gateway => {
52
+ console.log(gateway);
53
+ if (gateway === _types.GatewayTypes.APIGEEX_GATEWAY) {
54
+ return await (0, _basicPrompts.askList)({
55
+ msg: helpers.agentMessages.selectAgentType,
56
+ choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY]
57
+ });
58
+ } else {
59
+ return _types.BundleType.DISCOVERY;
60
+ }
61
+ };
62
+ exports.askBundleType = askBundleType;
63
+ const askConfigType = async () => {
64
+ return _types.AgentConfigTypes.DOCKERIZED;
65
+ };
66
+
67
+ //
68
+ // Questions for the configuration of Apigee X agents
69
+ //
70
+ exports.askConfigType = askConfigType;
71
+ const askApigeeXProjectId = async () => await (0, _basicPrompts.askInput)({
72
+ msg: ApigeeXPrompts.PROJECT_ID,
73
+ validate: (0, _basicPrompts.validateRegex)(helpers.APIGEEXRegexPatterns.APIGEEX_REGEXP_PROJECT_ID, helpers.invalidValueExampleErrMsg('Project ID', 'rd-amplify-apigee-x'))
74
+ });
75
+ const askApigeeXDeveloperEmailAddress = async () => await (0, _basicPrompts.askInput)({
76
+ msg: ApigeeXPrompts.DEVELOPER_EMAIL_ADDRESS
77
+ });
78
+ const askApigeeXAuthFileName = async () => await (0, _basicPrompts.askInput)({
79
+ msg: ApigeeXPrompts.AUTH_FILE_NAME
80
+ });
81
+ const askApigeeXEnvironment = async () => await (0, _basicPrompts.askInput)({
82
+ msg: ApigeeXPrompts.ENVIRONMENT,
83
+ defaultValue: '',
84
+ allowEmptyInput: true
85
+ });
86
+ const askApigeeXMetricFilterConfig = async () => {
87
+ let filteredAPIs = [];
88
+ let filterMetricsEnabled = (await (0, _basicPrompts.askList)({
89
+ msg: ApigeeXPrompts.FILTER_METRICS,
90
+ default: _types.YesNo.No,
91
+ choices: _types.YesNoChoices
92
+ })) === _types.YesNo.Yes;
93
+ if (filterMetricsEnabled) {
94
+ let askFilteredAPIs = true;
95
+ console.log(_chalk.default.gray("An array of APIs to filter metrics for"));
96
+ while (askFilteredAPIs) {
97
+ const api = await (0, _basicPrompts.askInput)({
98
+ msg: ApigeeXPrompts.FILTERED_APIS,
99
+ allowEmptyInput: true
100
+ });
101
+ filteredAPIs.push(api);
102
+ askFilteredAPIs = (await (0, _basicPrompts.askList)({
103
+ msg: ApigeeXPrompts.ENTER_MORE_APIS,
104
+ default: _types.YesNo.No,
105
+ choices: _types.YesNoChoices
106
+ })) === _types.YesNo.Yes;
107
+ }
108
+ }
109
+ return new _types.ApigeeMetricsFilterConfig(filterMetricsEnabled, filteredAPIs);
110
+ };
111
+ const gatewayConnectivity = async installConfig => {
112
+ const apigeeXAgentValues = new _apigeexTemplates.ApigeeXAgentValues();
113
+ console.log('\nCONNECTION TO APIGEE X API GATEWAY:');
114
+ console.log(_chalk.default.gray(`The discovery agent needs to connect to the APIGEE X API Gateway to discover API's for publishing to Amplify.\n`));
115
+
116
+ // Apigee X Discovery Agent Prompts
117
+ if (installConfig.switches.isDaEnabled) {
118
+ console.log(_chalk.default.gray(`\nDiscovery Agent Configuration\n`));
119
+ await askDiscoveryPrompts(apigeeXAgentValues);
120
+ }
121
+
122
+ // Apigee X Traceability Agent Prompts
123
+ if (installConfig.switches.isTaEnabled) {
124
+ console.log(_chalk.default.gray(`\nTraceability Agent Configuration\n`));
125
+ await askTraceabilityPrompts(apigeeXAgentValues);
126
+ }
127
+ return apigeeXAgentValues;
128
+ };
129
+ exports.gatewayConnectivity = gatewayConnectivity;
130
+ const generateSuccessHelpMsg = installConfig => {
131
+ if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
132
+ 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.'));
133
+ }
134
+ dockerSuccessMsg(installConfig);
135
+ console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.APIGEEX}`));
136
+ };
137
+ const dockerSuccessMsg = installConfig => {
138
+ let dockerInfo;
139
+ const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
140
+ const runDaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
141
+ const runTaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
142
+ const runTaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
143
+ const startDaLinuxMsg = `\nStart the Discovery Agent on a Linux based machine`;
144
+ const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
145
+ const startTaLinuxMsg = `\nStart the Traceability Agent on a Linux based machine`;
146
+ const startTaWinMsg = `\nStart the Traceability Agent on a Windows machine`;
147
+ if (installConfig.switches.isDaEnabled && installConfig.switches.isTaEnabled) {
148
+ 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}):`;
149
+ } else if (installConfig.switches.isDaEnabled) {
150
+ dockerInfo = `To utilize the discovery agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.DA_ENV_VARS}):`;
151
+ } else {
152
+ dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
153
+ }
154
+ console.log(_chalk.default.whiteBright(dockerInfo), '\n');
155
+ if (installConfig.switches.isDaEnabled) {
156
+ const daImageVersion = `${daImage}:${installConfig.daVersion}`;
157
+ console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
158
+ console.log(_chalk.default.cyan(`docker pull ${daImageVersion}`));
159
+ console.log(_chalk.default.white(_utils.isWindows ? startDaWinMsg : startDaLinuxMsg));
160
+ console.log(_chalk.default.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
161
+ console.log('\t', _chalk.default.cyan(`-v /data ${daImageVersion}`), '\n');
162
+ }
163
+ if (installConfig.switches.isTaEnabled) {
164
+ const taImageVersion = `${taImage}:${installConfig.taVersion}`;
165
+ console.log(_chalk.default.white('Pull the latest image of the Traceability Agent:'));
166
+ console.log(_chalk.default.cyan(`docker pull ${taImageVersion}`));
167
+ console.log(_chalk.default.white(_utils.isWindows ? startTaWinMsg : startTaLinuxMsg));
168
+ console.log(_chalk.default.cyan(_utils.isWindows ? runTaWinMsg : runTaLinuxMsg));
169
+ console.log('\t', _chalk.default.cyan(`-v /data ${taImageVersion}`), '\n');
170
+ }
171
+ };
172
+
173
+ // ApigeeX DA prompts
174
+ async function askDiscoveryPrompts(apigeeXAgentValues) {
175
+ // Apigee X ProjectId
176
+ apigeeXAgentValues.projectId = await askApigeeXProjectId();
177
+ // Apigee X Developer Email Address
178
+ apigeeXAgentValues.developerEmailAddress = await askApigeeXDeveloperEmailAddress();
179
+ // Apigee X Auth File Path
180
+ apigeeXAgentValues.fileName = await askApigeeXAuthFileName();
181
+ // Apigee X Environment
182
+ apigeeXAgentValues.environment = await askApigeeXEnvironment();
183
+ }
184
+ async function askTraceabilityPrompts(apigeeXAgentValues) {
185
+ // Apigee X Filter metrics
186
+ apigeeXAgentValues.metricsFilter = await askApigeeXMetricFilterConfig();
187
+ }
188
+ const completeInstall = async installConfig => {
189
+ /**
190
+ * Create agent resources
191
+ */
192
+ const apigeeXAgentValues = installConfig.gatewayConfig;
193
+
194
+ // Add final settings to apigeeXAgentValues
195
+ apigeeXAgentValues.centralConfig = installConfig.centralConfig;
196
+ apigeeXAgentValues.traceabilityConfig = installConfig.traceabilityConfig;
197
+ console.log('Generating the configuration file(s)...');
198
+ if (installConfig.switches.isDaEnabled) {
199
+ (0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, apigeeXAgentValues, helpers.apigeeXDAEnvVarTemplate);
200
+ }
201
+ if (installConfig.switches.isTaEnabled) {
202
+ (0, _utils.writeTemplates)(ConfigFiles.TAEnvVars, apigeeXAgentValues, helpers.apigeeXTAEnvVarTemplate);
203
+ }
204
+ console.log('Configuration file(s) have been successfully created.\n');
205
+ generateSuccessHelpMsg(installConfig);
206
+ };
207
+ exports.completeInstall = completeInstall;
208
+ const ApigeeXInstallMethods = exports.ApigeeXInstallMethods = {
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.APIGEEX_DA,
216
+ [_types.AgentTypes.ta]: _types.AgentNames.APIGEEX_TA
217
+ },
218
+ GatewayDisplay: _types.GatewayTypes.APIGEEX_GATEWAY
219
+ };
220
+ const testables = exports.testables = {
221
+ ApigeeXPrompts,
222
+ ConfigFiles,
223
+ defaultLogFiles
224
+ };
@@ -40,14 +40,6 @@ class APIGEEXDataplaneConfig extends DataplaneConfig {
40
40
  this.environment = environment;
41
41
  }
42
42
  }
43
- class ApigeeMetricsFilterConfig {
44
- constructor(filterMetrics, filteredAPIs) {
45
- _defineProperty(this, "filterMetrics", void 0);
46
- _defineProperty(this, "filteredAPIs", void 0);
47
- this.filterMetrics = filterMetrics;
48
- this.filteredAPIs = filteredAPIs;
49
- }
50
- }
51
43
  class SaasAgentValues {
52
44
  constructor() {
53
45
  _defineProperty(this, "frequencyDA", void 0);
@@ -73,20 +65,20 @@ class SaasAPIGEEXAgentValues extends SaasAgentValues {
73
65
  _defineProperty(this, "mode", void 0);
74
66
  _defineProperty(this, "metricsFilter", void 0);
75
67
  _defineProperty(this, "environment", void 0);
76
- this.authType = APIGEEXAuthType.IMP_SVC_ACC;
68
+ this.authType = _types.APIGEEXAuthType.IMP_SVC_ACC;
77
69
  this.clientEmailAddress = '';
78
70
  this.credentialJSON = '';
79
71
  this.projectId = '';
80
72
  this.developerEmailAddress = '';
81
73
  this.mode = _types.APIGEEXDISCOVERYMODES.PROXY;
82
- this.metricsFilter = new ApigeeMetricsFilterConfig(true, []);
74
+ this.metricsFilter = new _types.ApigeeMetricsFilterConfig(true, []);
83
75
  this.environment = '';
84
76
  }
85
77
  getAccessData() {
86
78
  let data = JSON.stringify({
87
79
  client_email: this.clientEmailAddress
88
80
  });
89
- if (this.authType == APIGEEXAuthType.ACCESS_CREDENTIAL) {
81
+ if (this.authType == _types.APIGEEXAuthType.ACCESS_CREDENTIAL) {
90
82
  data = JSON.stringify(this.credentialJSON);
91
83
  }
92
84
  return data;
@@ -96,12 +88,7 @@ class SaasAPIGEEXAgentValues extends SaasAgentValues {
96
88
  // ConfigFiles - all the config file that are used in the setup
97
89
  const ConfigFiles = {};
98
90
 
99
- // APIGEEXAuthType - how the agent will authenticate to APIGEEX
100
- var APIGEEXAuthType = /*#__PURE__*/function (APIGEEXAuthType) {
101
- APIGEEXAuthType["IMP_SVC_ACC"] = "Impersonate Service Account";
102
- APIGEEXAuthType["ACCESS_CREDENTIAL"] = "Access Credential";
103
- return APIGEEXAuthType;
104
- }(APIGEEXAuthType || {}); // APIGEEX SaaSPrompts - all APIGEEX Saas prompts to the user for input
91
+ // APIGEEX SaaSPrompts - all APIGEEX Saas prompts to the user for input
105
92
  const SaasPrompts = {
106
93
  AUTHENTICATION_TYPE: 'Authenticate with an Impersonation of a Service Account or by providing a Credential File',
107
94
  PROJECT_ID: 'Enter the APIGEE X Project ID the agent will use',
@@ -141,9 +128,9 @@ const askForAPIGEEXCredentials = async hostedAgentValues => {
141
128
  defaultValue: hostedAgentValues.developerEmailAddress !== '' ? hostedAgentValues.developerEmailAddress : undefined,
142
129
  allowEmptyInput: true
143
130
  });
144
- hostedAgentValues.authType = APIGEEXAuthType.IMP_SVC_ACC;
131
+ hostedAgentValues.authType = _types.APIGEEXAuthType.IMP_SVC_ACC;
145
132
  console.log(_chalk.default.gray("Please refer to docs.axway.com for information on creating the necessary APIGEE X IAM policies"));
146
- if (hostedAgentValues.authType === APIGEEXAuthType.IMP_SVC_ACC) {
133
+ if (hostedAgentValues.authType === _types.APIGEEXAuthType.IMP_SVC_ACC) {
147
134
  log("using impersonate service account authentication");
148
135
  // get client email address
149
136
  hostedAgentValues.clientEmailAddress = await (0, _basicPrompts.askInput)({
@@ -308,7 +295,7 @@ const APIGEEXSaaSInstallMethods = exports.APIGEEXSaaSInstallMethods = {
308
295
  const testables = exports.testables = {
309
296
  SaasAgentValues,
310
297
  SaasAPIGEEXAgentValues,
311
- APIGEEXAuthType,
298
+ APIGEEXAuthType: _types.APIGEEXAuthType,
312
299
  SaasPrompts,
313
300
  ConfigFiles
314
301
  };
@@ -80,6 +80,18 @@ Object.keys(_regex).forEach(function (key) {
80
80
  }
81
81
  });
82
82
  });
83
+ var _apigeexTemplates = require("./templates/apigeexTemplates");
84
+ Object.keys(_apigeexTemplates).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
87
+ if (key in exports && exports[key] === _apigeexTemplates[key]) return;
88
+ Object.defineProperty(exports, key, {
89
+ enumerable: true,
90
+ get: function () {
91
+ return _apigeexTemplates[key];
92
+ }
93
+ });
94
+ });
83
95
  var _awsTemplates = require("./templates/awsTemplates");
84
96
  Object.keys(_awsTemplates).forEach(function (key) {
85
97
  if (key === "default" || key === "__esModule") return;
@@ -239,6 +251,7 @@ const configFiles = exports.configFiles = {
239
251
  };
240
252
  const agentsDocsUrl = exports.agentsDocsUrl = {
241
253
  V7: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/connect_api_manager/index.html',
254
+ APIGEEX: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/connect_apigeex_gateway/index.html',
242
255
  AWS: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/connect_aws_gateway/index.html',
243
256
  AZURE: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/connect_azure_gateway/index.html',
244
257
  ISTIO: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/mesh_management/index.html',
@@ -37,8 +37,7 @@ const AWSRegexPatterns = exports.AWSRegexPatterns = {
37
37
 
38
38
  // APIGEEXRegexPatterns - regex patters to validate user inputs
39
39
  const APIGEEXRegexPatterns = exports.APIGEEXRegexPatterns = {
40
- APIGEEX_REGEXP_PROJECT_ID: '^[a-z][a-z0-9-]{4,28}[a-z0-9]$',
41
- AWS_REGEXP_EMAIL_ADDRESS: '^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
40
+ APIGEEX_REGEXP_PROJECT_ID: '^[a-z][a-z0-9-]{4,28}[a-z0-9]$'
42
41
  };
43
42
 
44
43
  // AzureRegexPatterns - regex patters to validate user inputs
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.apigeeXTAEnvVarTemplate = exports.apigeeXDAEnvVarTemplate = exports.ApigeeXAgentValues = 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 Apigee X handlebars templates.
13
+ */
14
+ class ApigeeXAgentValues {
15
+ constructor() {
16
+ _defineProperty(this, "projectId", void 0);
17
+ _defineProperty(this, "developerEmailAddress", void 0);
18
+ _defineProperty(this, "mode", void 0);
19
+ _defineProperty(this, "environment", void 0);
20
+ _defineProperty(this, "fileName", void 0);
21
+ _defineProperty(this, "metricsFilter", void 0);
22
+ _defineProperty(this, "centralConfig", void 0);
23
+ _defineProperty(this, "traceabilityConfig", void 0);
24
+ this.projectId = "";
25
+ this.developerEmailAddress = "";
26
+ this.mode = _types.APIGEEXDISCOVERYMODES.PROXY;
27
+ this.environment = "";
28
+ this.fileName = "";
29
+ this.metricsFilter = new _types.ApigeeMetricsFilterConfig(true, []);
30
+ this.centralConfig = new _types.CentralAgentConfig();
31
+ this.traceabilityConfig = new _types.TraceabilityConfig();
32
+ }
33
+ }
34
+
35
+ /**
36
+ * @description Generates the ApigeeX TA env vars file.
37
+ */
38
+ exports.ApigeeXAgentValues = ApigeeXAgentValues;
39
+ const apigeeXTAEnvVarTemplate = () => {
40
+ return `# ApigeeX configs
41
+ APIGEE_PROJECTID={{projectId}}
42
+ APIGEE_DEVELOPEREMAILADDRESS={{developerEmailAddress}}
43
+ APIGEE_MODE={{mode}}
44
+ APIGEE_ENVIRONMENT={{environment}}
45
+ APIGEE_AUTHFILEPATH=/keys/{{fileName}}
46
+ APIGEE_FILTERMETRICS={{metricsFilter.filterMetrics}}
47
+ {{#if metricsFilter.filterMetrics}}
48
+ APIGEE_FILTEREDAPIS={{metricsFilter.filteredAPIs}}
49
+ {{/if}}
50
+
51
+ # Amplify Central configs
52
+ {{#if traceabilityConfig.usageReportingOffline}}
53
+ CENTRAL_USAGEREPORTING_OFFLINE={{traceabilityConfig.usageReportingOffline}}
54
+ CENTRAL_ENVIRONMENTID={{centralConfig.environmentId}}
55
+ CENTRAL_AGENTNAME={{centralConfig.taAgentName}}
56
+ {{else}}
57
+ CENTRAL_AGENTNAME={{centralConfig.taAgentName}}
58
+ CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
59
+ CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
60
+ CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
61
+ CENTRAL_ENVIRONMENT={{centralConfig.environment}}
62
+ CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
63
+ CENTRAL_TEAM={{centralConfig.ampcTeamName}}
64
+ CENTRAL_REGION={{centralConfig.region}}
65
+
66
+ {{#compare . traceabilityConfig.protocol "https"}}
67
+ TRACEABILITY_PROTOCOL={{traceabilityConfig.protocol}}
68
+ {{/compare}}
69
+ TRACEABILITY_SAMPLING_PERCENTAGE={{traceabilityConfig.samplingPercentage}}
70
+ {{/if}}
71
+
72
+ # Logging configs
73
+ # Define the logging level: info, debug, error
74
+ LOG_LEVEL=info
75
+ # Specify where to send the log: stdout, file, both
76
+ LOG_OUTPUT=stdout
77
+ # Define where the log files are written
78
+ LOG_FILE_PATH=logs
79
+ `;
80
+ };
81
+
82
+ /**
83
+ * @description Generates the ApigeeX DA env vars file.
84
+ */
85
+ exports.apigeeXTAEnvVarTemplate = apigeeXTAEnvVarTemplate;
86
+ const apigeeXDAEnvVarTemplate = () => {
87
+ return `# Azure configs
88
+ APIGEE_PROJECTID={{projectId}}
89
+ APIGEE_DEVELOPEREMAILADDRESS={{developerEmailAddress}}
90
+ APIGEE_MODE={{mode}}
91
+ APIGEE_ENVIRONMENT={{environment}}
92
+ APIGEE_AUTHFILEPATH=/keys/{{filePath}}
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_REGION={{centralConfig.region}}
103
+
104
+ # Logging configs
105
+ # Define the logging level: info, debug, error
106
+ LOG_LEVEL=info
107
+ # Specify where to send the log: stdout, file, both
108
+ LOG_OUTPUT=stdout
109
+ # Define where the log files are written
110
+ LOG_FILE_PATH=logs
111
+ `;
112
+ };
113
+ exports.apigeeXDAEnvVarTemplate = apigeeXDAEnvVarTemplate;
@@ -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.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.AzureDataplaneMode = 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.AzureDataplaneMode = exports.AuthUrls = exports.ApigeeMetricsFilterConfig = exports.AgentTypes = exports.AgentResourceKind = exports.AgentNames = exports.AgentInstallSwitches = exports.AgentInstallConfig = exports.AgentConfigTypes = exports.AWSRegions = exports.APIGEEXDISCOVERYMODES = exports.APIGEEXAuthType = 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; }
@@ -244,6 +244,7 @@ let AgentNames = exports.AgentNames = /*#__PURE__*/function (AgentNames) {
244
244
  }({});
245
245
  let GatewayTypes = exports.GatewayTypes = /*#__PURE__*/function (GatewayTypes) {
246
246
  GatewayTypes["EDGE_GATEWAY"] = "Amplify API Gateway";
247
+ GatewayTypes["APIGEEX_GATEWAY"] = "Apigee X Gateway";
247
248
  GatewayTypes["AWS_GATEWAY"] = "Amazon API Gateway";
248
249
  GatewayTypes["AZURE_GATEWAY"] = "Azure API Gateway";
249
250
  GatewayTypes["AZURE_EVENTHUB"] = "Azure EventHub";
@@ -287,13 +288,13 @@ let DataPlaneNames = exports.DataPlaneNames = /*#__PURE__*/function (DataPlaneNa
287
288
  const GatewayTypeToDataPlane = exports.GatewayTypeToDataPlane = {
288
289
  [GatewayTypes.EDGE_GATEWAY]: DataPlaneNames.EDGE,
289
290
  [GatewayTypes.EDGE_GATEWAY_ONLY]: DataPlaneNames.EDGE,
291
+ [GatewayTypes.APIGEEX_GATEWAY]: DataPlaneNames.APIGEE,
290
292
  [GatewayTypes.AWS_GATEWAY]: DataPlaneNames.AWS,
291
293
  [SaaSGatewayTypes.GITHUB]: DataPlaneNames.GITHUB,
292
294
  [GatewayTypes.GITLAB]: DataPlaneNames.GITLAB,
293
295
  [GatewayTypes.AZURE_GATEWAY]: DataPlaneNames.AZURE,
294
296
  [GatewayTypes.AZURE_EVENTHUB]: DataPlaneNames.AZURE,
295
297
  [GatewayTypes.ISTIO]: 'Istio',
296
- [SaaSGatewayTypes.APIGEEX_GATEWAY]: DataPlaneNames.APIGEE,
297
298
  [GatewayTypes.KAFKA]: DataPlaneNames.KAFKA,
298
299
  [GatewayTypes.SOFTWAREAGWEBMETHODS]: DataPlaneNames.SOFTWAREAGWEBMETHODS,
299
300
  [SaaSGatewayTypes.SWAGGERHUB]: DataPlaneNames.SWAGGERHUB,
@@ -760,4 +761,18 @@ let TraceableRegionType = exports.TraceableRegionType = /*#__PURE__*/function (T
760
761
  TraceableRegionType["EU"] = "EU";
761
762
  TraceableRegionType["AP"] = "AP";
762
763
  return TraceableRegionType;
763
- }({});
764
+ }({}); // APIGEEXAuthType - how the agent will authenticate to APIGEEX
765
+ let APIGEEXAuthType = exports.APIGEEXAuthType = /*#__PURE__*/function (APIGEEXAuthType) {
766
+ APIGEEXAuthType["IMP_SVC_ACC"] = "Impersonate Service Account";
767
+ APIGEEXAuthType["ACCESS_CREDENTIAL"] = "Access Credential";
768
+ return APIGEEXAuthType;
769
+ }({});
770
+ class ApigeeMetricsFilterConfig {
771
+ constructor(filterMetrics, filteredAPIs) {
772
+ _defineProperty(this, "filterMetrics", void 0);
773
+ _defineProperty(this, "filteredAPIs", void 0);
774
+ this.filterMetrics = filterMetrics;
775
+ this.filteredAPIs = filteredAPIs;
776
+ }
777
+ }
778
+ exports.ApigeeMetricsFilterConfig = ApigeeMetricsFilterConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axway/axway-central-cli",
3
- "version": "3.10.0-rc.1",
3
+ "version": "3.10.0-rc.3",
4
4
  "description": "Manage APIs, services and publish to the Amplify Marketplace",
5
5
  "homepage": "https://platform.axway.com",
6
6
  "author": {