Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit 0a508af

Browse files
author
Chris Wiechmann
committed
Added support for API-Gateway only
1 parent a378e0f commit 0a508af

26 files changed

+190
-40
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
- Added a warning when running Logstash or Elasticsearch with default minimal parameters (when using docker-compose) [#163](https://github.com/Axway-API-Management-Plus/apigateway-openlogging-elk/issues/163)
1111
- Added a new visualization: Status by API to all API-Overview dashboards showing Success, Failure/Blocked and Failed status per API
1212
- Added tag kpis to the KPI-Dashboard
13+
- Added new parameter: `API_MANAGER_ENABLED` to allow running the solution without an API-Manager at all
1314

1415
### Security
1516
- Mocha in API-Builder4Elastic updated to version 9.2.0 to solve https://nvd.nist.gov/vuln/detail/CVE-2021-23566

UPDATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ On the other hand, the API builder Docker image, as a central component of the s
3737

3838
| Ver | API-Builder | Logstash | Memcached | Filebeat | ANM-Config | Dashboards | Params |Elastic-Config | ELK-Ver.| Notes |
3939
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |:---: | :---: | :--- |
40-
| 4.2.0 | - | - | - | - | - | [X](#dashboards)| - |- | [7.16.3](#update-elastic-stack-version) | Unreleased |
40+
| 4.2.0 | - | - | - | - | - | [X](#dashboards)| [X](#parameters)|- | [7.16.3](#update-elastic-stack-version) | Unreleased |
4141
| 4.1.0 | [X](#api-builderlogstashmemcached) | - | - | - | - | - | [X](#parameters)|[X](#elastic-config)| [7.16.3](#update-elastic-stack-version) | |
4242
| 4.0.3 | - | - | - | - | - | - | - |- | [7.16.2](#update-elastic-stack-version) | |
4343
| 4.0.2 | - | - | - | - | - | - | - |- | [7.16.1](#update-elastic-stack-version) | See #154 |

apibuilder4elastic/conf/axway-api-utils.default.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module.exports = {
99
'apimanager': {
1010
url: process.env.API_MANAGER, // If not set, the Admin-Node-Manager hostname is used
1111
username: process.env.API_MANAGER_USERNAME, // User with Admin-Privileges required
12-
password: process.env.API_MANAGER_PASSWORD
12+
password: process.env.API_MANAGER_PASSWORD,
13+
enabled: ("false" == process.env.API_MANAGER_ENABLED) ? false : true // Makes it possible to use the solution without an API-Manager at all
1314
},
1415
// Which file to use for the local API-Lookup
1516
localLookupFile: process.env.API_BUILDER_LOCAL_API_LOOKUP_FILE,

apibuilder4elastic/conf/default.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ module.exports = {
3131

3232
// The interval in milliseconds in which API-Builder will poll all configured API-Managers for their KPIs. Defaults to 3600000 (which is 1 hour)
3333
managementKPIsInterval: process.env.MANAGEMENT_KPIS_INTERVAL || '3600000',
34-
managementKPIsEnabled: ("false" == process.env.MANAGEMENT_KPIS_ENABLED) ? false : true,
34+
// Management KPI will be disabled also, if the API-Manager is disabled
35+
managementKPIsEnabled: ("false" == process.env.MANAGEMENT_KPIS_ENABLED || "false" == process.env.API_MANAGER_ENABLED) ? false : true,
3536

3637
// This path is optional and if given used to adjust the ILM-Configuration.
3738
retentionPeriodConfigFile: process.env.RETENTION_PERIOD_CONFIG || 'NotSet',

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/config/axway-api-utils.default.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module.exports = {
99
'apimanager': {
1010
url: process.env.API_MANAGER, // If not set, the API-Gateway hostname is used
1111
username: process.env.API_MANAGER_USERNAME, // User with Admin-Privileges required
12-
password: process.env.API_MANAGER_PASSWORD
12+
password: process.env.API_MANAGER_PASSWORD,
13+
enabled: (!process.env.API_MANAGER_ENABLED) ? process.env.API_MANAGER_ENABLED : true // Makes it possible to use the solution without an API-Manager at all
1314
},
1415
// This is true, when running as part of the CI-Pipeline (GitHub Actions)
1516
// If true, some test API-Requests are then mocked

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@axway/api-builder-test-utils": "^1.3.0",
2828
"chai": "^4.3.4",
2929
"decache": "^4.6.0",
30-
"dotenv": "^10.0.0",
30+
"dotenv": "^14.2.0",
3131
"mocha": "^9.1.2",
3232
"nock": "^13.1.1",
3333
"simple-mock": "^0.8.0"

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/src/actions.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ async function lookupCurrentUser(params, options) {
101101
cache.set( VIDUSR, user);
102102
}
103103
return user;
104-
} else if(getApiManagerUser==false) {
104+
// getApiManagerUser is set by the flow based on the userAuthorization toggle
105+
} else if(getApiManagerUser == false || pluginConfig.apimanager.enabled == false) {
105106
logger.debug(`Current user is: '${user.loginName}'. Unrestricted Traffic-Monitor access: ${user.gatewayManager.isUnrestricted}. Don't try to get user on API-Manager.`);
106107
if(VIDUSR) {
107108
cache.set( VIDUSR, user);
@@ -198,7 +199,7 @@ async function lookupAPIDetails(params, options) {
198199
} catch (ex) {
199200
logger.warn(`Error looking up API locally. ${JSON.stringify(ex)}`);
200201
}
201-
if(proxies == undefined) {
202+
if(proxies == undefined) { // Nothing configured locally ... trying to lookup API at API-Manager
202203
// To lookup the API in API-Manager the API-Name is required
203204
if (!apiName) {
204205
logger.info(`API not configured locally, based on path: ${apiPath}. The API cannot be queried at the API Manager as no API name is given. Please configure this API path locally.`);
@@ -345,6 +346,7 @@ async function getCustomPropertiesConfig(params, options) {
345346
params.region = params.region.toLowerCase();
346347
}
347348
pluginConfig = options.pluginConfig;
349+
if(pluginConfig.apimanager.enabled == false) return {}; // API-Manager is disabled, nothing to do
348350
const { logger } = options;
349351
cache = options.pluginContext.cache;
350352
let apiManagerConfig;
@@ -660,6 +662,7 @@ async function _getManagerUser(user, groupId) {
660662
}
661663

662664
async function _getAPIProxy(apiName, groupId, region) {
665+
if(pluginConfig.apimanager.enabled == false) return;
663666
const apiManagerConfig = getManagerConfig(pluginConfig.apimanager, groupId, region);
664667
var options = {
665668
path: `/api/portal/v1.3/proxies?field=name&op=eq&value=${apiName}`,
@@ -679,6 +682,7 @@ async function _getAPIProxy(apiName, groupId, region) {
679682
}
680683

681684
async function _getApplication(applicationId, groupId, region) {
685+
if(pluginConfig.apimanager.enabled == false) return undefined; // No lookup
682686
const apiManagerConfig = getManagerConfig(pluginConfig.apimanager, groupId, region);
683687
var options = {
684688
path: `/api/portal/v1.3/applications/${applicationId}`,

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/src/apiManagerAdapter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ async function getAPIManagerConfig(params, options) {
2525
let { } = params;
2626
const { logger } = options;
2727
var pluginConfig = options.pluginConfig;
28+
if(pluginConfig.apimanager.enabled == false) return [];
2829
var cache = options.pluginContext.cache;
2930
const apiManagerConfigs = [];
3031
const apiManagerNames = {};

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ async function getPlugin(pluginConfig, options) {
4141
if(!result.isValid) {
4242
throw new Error(`Error checking configured API-Manager(s). ${JSON.stringify(result)}`);
4343
} else {
44-
options.logger.info("Connection to API-Manager(s) successfully validated.");
44+
options.logger.info(result.message);
4545
}
4646
} else {
47-
options.logger.warn("Config validation is skipped, as parameter: pluginConfig.validateConfig=true");
47+
options.logger.warn("Config validation is skipped, as parameter: pluginConfig.validateConfig=false");
4848
}
4949
}
5050

0 commit comments

Comments
 (0)