kong-admin-node-client
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "kong-admin-node-client", | ||
"version": "1.0.3", | ||
"description": "Kong admin API client in node", | ||
"main": "index.js", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ugolas/kong-admin-node-client.git" | ||
}, | ||
"keywords": [ | ||
"kong", | ||
"admin", | ||
"api", | ||
"node" | ||
], | ||
"author": "Alex Ugol <alex.ugol@gmail.com>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ugolas/kong-admin-node-client/issues" | ||
}, | ||
"homepage": "https://github.com/ugolas/kong-admin-node-client#readme", | ||
"dependencies": { | ||
"bunyan": "^1.8.12", | ||
"lodash": "^4.17.4", | ||
"pkginfo": "^0.4.1", | ||
"request": "^2.83.0", | ||
"request-promise": "^4.2.2" | ||
} | ||
"name": "kong-admin-node-client", | ||
"version": "1.0.4", | ||
"description": "Kong admin API client in node", | ||
"main": "index.js", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ugolas/kong-admin-node-client.git" | ||
}, | ||
"keywords": [ | ||
"kong", | ||
"admin", | ||
"api", | ||
"node" | ||
], | ||
"author": "Alex Ugol <alex.ugol@gmail.com>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ugolas/kong-admin-node-client/issues" | ||
}, | ||
"homepage": "https://github.com/ugolas/kong-admin-node-client#readme", | ||
"dependencies": { | ||
"bunyan": "^1.8.12", | ||
"lodash": "^4.17.4", | ||
"pkginfo": "^0.4.1", | ||
"request": "^2.83.0", | ||
"request-promise": "^4.2.2" | ||
} | ||
} |
@@ -19,2 +19,16 @@ let _ = require('lodash'), | ||
let deleteAPI = function ({ | ||
url, | ||
apiName | ||
}) { | ||
let options = { | ||
method: 'DELETE', | ||
uri: `${url}/apis/${apiName}`, | ||
body: body | ||
}; | ||
var requestOptions = _.assign(options, basicRequest); | ||
return sendRequestAndProcessError(requestOptions, [204]) | ||
}; | ||
let getAPI = function ({ | ||
@@ -81,3 +95,3 @@ url, | ||
if (!expectedStatuses.includes(res.statusCode)) { | ||
logger.error(`Error during get plugin, expected status ${expectedStatuses}, got: ${res.statusCode}`) | ||
logger.error(`Error during operation, expected status ${expectedStatuses}, got: ${res.statusCode}`) | ||
logger.error(`Error body: ${JSON.stringify(res.body)}`) | ||
@@ -84,0 +98,0 @@ throw new Error(`Error in ${options.method}, ${options.uri}`) |
@@ -74,2 +74,17 @@ let httpHelper = require('./http-helper'), | ||
async removeAPIs(apis) { | ||
logger.info(`Removing apis from kong, ${apis.length} in total`); | ||
for (let api of apis) { | ||
logger.info(`Removing api: ${api.name}, ${apis.indexOf(api) + 1} out of ${apis.length} apis`); | ||
// Check if exists | ||
let removeResponse = await httpHelper.deleteAPI({ | ||
url: this.kongAdminUrl, | ||
apiName: api.name | ||
}) | ||
logger.info(`Configuration for api: ${api.name} was removed successfully`); | ||
} | ||
} | ||
async createPlugins(plugins, apiName) { | ||
@@ -76,0 +91,0 @@ logger.info(apiName ? `Setting up plugins in api: ${apiName}, ${plugins.length} in total` : `Setting up plugins, ${plugins.length} in total`); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32147
11
799
1