@itentialopensource/adapter-accedian_skylight
Advanced tools
Comparing version 0.1.1 to 0.1.2
module.exports = { | ||
'env': { | ||
'browser': true, | ||
'es6': true, | ||
'node': true, | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true | ||
}, | ||
'extends': 'airbnb-base', | ||
"plugins": [ | ||
"json" | ||
extends: 'airbnb-base', | ||
plugins: [ | ||
'json' | ||
], | ||
'parserOptions': { | ||
'sourceType': 'module', | ||
parserOptions: { | ||
sourceType: 'module' | ||
}, | ||
rules: { | ||
'max-len': 'warn', | ||
'comma-dangle': ['error', 'never'], | ||
}, | ||
}; | ||
'comma-dangle': ['error', 'never'] | ||
} | ||
}; |
@@ -9,2 +9,4 @@ /* @copyright Itential, LLC 2018-9 */ | ||
/* eslint no-cond-assign: warn */ | ||
/* eslint global-require: warn */ | ||
/* eslint no-unused-vars: warn */ | ||
@@ -15,2 +17,3 @@ /* Required libraries. */ | ||
const EventEmitterCl = require('events').EventEmitter; | ||
const { execSync } = require('child_process'); | ||
@@ -24,2 +27,119 @@ /* The schema validator */ | ||
let propUtil = null; | ||
/* | ||
* INTERNAL FUNCTION: force fail the adapter - generally done to cause restart | ||
*/ | ||
function forceFail(packChg) { | ||
if (packChg !== undefined && packChg !== null && packChg === true) { | ||
execSync(`rm -rf ${__dirname}/node modules`, { encoding: 'utf-8' }); | ||
execSync(`rm -rf ${__dirname}/package-lock.json`, { encoding: 'utf-8' }); | ||
execSync('npm install', { encoding: 'utf-8' }); | ||
} | ||
log.error('NEED TO RESTART ADAPTER - FORCE FAIL'); | ||
const errorObj = { | ||
origin: 'adapter-forceFail', | ||
type: 'Force Fail so adapter will restart', | ||
vars: [] | ||
}; | ||
setTimeout(() => { | ||
throw new Error(JSON.stringify(errorObj)); | ||
}, 1000); | ||
} | ||
/* | ||
* INTERNAL FUNCTION: update the action.json | ||
*/ | ||
function updateAction(entityPath, action, changes) { | ||
// if the action file does not exist - error | ||
const actionFile = path.join(entityPath, '/action.json'); | ||
if (!fs.existsSync(actionFile)) { | ||
return 'Missing Action File'; | ||
} | ||
// read in the file as a json object | ||
const ajson = require(path.resolve(entityPath, 'action.json')); | ||
let chgAct = {}; | ||
// get the action we need to change | ||
for (let a = 0; a < ajson.actions.length; a += 1) { | ||
if (ajson.actions[a].name === action) { | ||
chgAct = ajson.actions[a]; | ||
break; | ||
} | ||
} | ||
// merge the changes into the desired action | ||
chgAct = propUtil.mergeProperties(changes, chgAct); | ||
fs.writeFileSync(actionFile, JSON.stringify(ajson, null, 2)); | ||
return null; | ||
} | ||
/* | ||
* INTERNAL FUNCTION: update the schema file | ||
*/ | ||
function updateSchema(entityPath, configFile, changes) { | ||
// if the schema file does not exist - error | ||
const schemaFile = path.join(entityPath, `/${configFile}`); | ||
if (!fs.existsSync(schemaFile)) { | ||
return 'Missing Schema File'; | ||
} | ||
// read in the file as a json object | ||
let schema = require(path.resolve(entityPath, configFile)); | ||
// merge the changes into the schema file | ||
schema = propUtil.mergeProperties(changes, schema); | ||
fs.writeFileSync(schemaFile, JSON.stringify(schema, null, 2)); | ||
return null; | ||
} | ||
/* | ||
* INTERNAL FUNCTION: update the mock data file | ||
*/ | ||
function updateMock(mockPath, configFile, changes) { | ||
// if the mock file does not exist - create it | ||
const mockFile = path.join(mockPath, `/${configFile}`); | ||
if (!fs.existsSync(mockFile)) { | ||
const newMock = {}; | ||
fs.writeFileSync(mockFile, JSON.stringify(newMock, null, 2)); | ||
} | ||
// read in the file as a json object | ||
let mock = require(path.resolve(mockPath, configFile)); | ||
// merge the changes into the mock file | ||
mock = propUtil.mergeProperties(changes, mock); | ||
fs.writeFileSync(mockFile, JSON.stringify(mock, null, 2)); | ||
return null; | ||
} | ||
/* | ||
* INTERNAL FUNCTION: update the package dependencies | ||
*/ | ||
function updatePackage(changes) { | ||
// if the schema file does not exist - error | ||
const packFile = path.join(__dirname, '/package.json'); | ||
if (!fs.existsSync(packFile)) { | ||
return 'Missing Pacakge File'; | ||
} | ||
// read in the file as a json object | ||
const pack = require(path.resolve(__dirname, 'package.json')); | ||
// only certain changes are allowed | ||
if (changes.dependencies) { | ||
const keys = Object.keys(changes.dependencies); | ||
for (let k = 0; k < keys.length; k += 1) { | ||
pack.dependencies[keys[k]] = changes.dependencies[keys[k]]; | ||
} | ||
} | ||
fs.writeFileSync(packFile, JSON.stringify(pack, null, 2)); | ||
return null; | ||
} | ||
/* GENERAL ADAPTER FUNCTIONS THESE SHOULD NOT BE DIRECTLY MODIFIED */ | ||
@@ -40,2 +160,3 @@ /* IF YOU NEED MODIFICATIONS, REDEFINE THEM IN adapter.js!!! */ | ||
this.propUtilInst = new PropUtilCl(prongid, __dirname); | ||
propUtil = this.propUtilInst; | ||
@@ -61,3 +182,2 @@ this.alive = false; | ||
/** | ||
@@ -88,3 +208,2 @@ * @callback healthCallback | ||
/** | ||
@@ -161,2 +280,125 @@ * refreshProperties is used to set up all of the properties for the connector. | ||
/** | ||
* updateAdapterConfiguration is used to update any of the adapter configuration files. This | ||
* allows customers to make changes to adapter configuration without having to be on the | ||
* file system. | ||
* | ||
* @function updateAdapterConfiguration | ||
* @param {string} configFile - the name of the file being updated (required) | ||
* @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required) | ||
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional) | ||
* @param {string} type - the type of entity file to change, (action, schema, mock) (optional) | ||
* @param {string} action - the action to be changed, if an action, schema or mock data file (optional) | ||
* @param {Callback} callback - The results of the call | ||
*/ | ||
updateAdapterConfiguration(configFile, changes, entity, type, action, callback) { | ||
const meth = 'adapterBase-updateAdapterConfiguration'; | ||
const origin = `${this.id}-${meth}`; | ||
log.trace(origin); | ||
// verify the parameters are valid | ||
if (changes === undefined || changes === null || typeof changes !== 'object' | ||
|| Object.keys(changes).length === 0) { | ||
const result = { | ||
response: 'No configuration updates to make' | ||
}; | ||
log.info(result.response); | ||
return callback(result, null); | ||
} | ||
if (configFile === undefined || configFile === null || configFile === '') { | ||
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['configFile'], null, null, null); | ||
log.error(`${origin}: ${errorObj.IAPerror.displayString}`); | ||
return callback(null, errorObj); | ||
} | ||
// take action based on configFile being changed | ||
if (configFile === 'package.json') { | ||
const pres = updatePackage(changes); | ||
if (pres) { | ||
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Incomplete Configuration Change: ${pres}`, [], null, null, null); | ||
log.error(`${origin}: ${errorObj.IAPerror.displayString}`); | ||
return callback(null, errorObj); | ||
} | ||
const result = { | ||
response: 'Package updates completed - restarting adapter' | ||
}; | ||
log.info(result.response); | ||
forceFail(true); | ||
return callback(result, null); | ||
} | ||
if (entity === undefined || entity === null || entity === '') { | ||
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Unsupported Configuration Change or Missing Entity', [], null, null, null); | ||
log.error(`${origin}: ${errorObj.IAPerror.displayString}`); | ||
return callback(null, errorObj); | ||
} | ||
// this means we are changing an entity file so type is required | ||
if (type === undefined || type === null || type === '') { | ||
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['type'], null, null, null); | ||
log.error(`${origin}: ${errorObj.IAPerror.displayString}`); | ||
return callback(null, errorObj); | ||
} | ||
// if the entity does not exist - error | ||
const epath = `${__dirname}/entities/${entity}`; | ||
if (!fs.existsSync(epath)) { | ||
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Incomplete Configuration Change: Invalid Entity - ${entity}`, [], null, null, null); | ||
log.error(`${origin}: ${errorObj.IAPerror.displayString}`); | ||
return callback(null, errorObj); | ||
} | ||
// take action based on type of file being changed | ||
if (type === 'action') { | ||
// BACKUP??? | ||
const ares = updateAction(epath, action, changes); | ||
if (ares) { | ||
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Incomplete Configuration Change: ${ares}`, [], null, null, null); | ||
log.error(`${origin}: ${errorObj.IAPerror.displayString}`); | ||
return callback(null, errorObj); | ||
} | ||
// AJV CHECK??? | ||
// RESTORE IF NEEDED??? | ||
const result = { | ||
response: `Action updates completed to entity: ${entity} - ${action}` | ||
}; | ||
log.info(result.response); | ||
return callback(result, null); | ||
} | ||
if (type === 'schema') { | ||
const sres = updateSchema(epath, configFile, changes); | ||
if (sres) { | ||
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Incomplete Configuration Change: ${sres}`, [], null, null, null); | ||
log.error(`${origin}: ${errorObj.IAPerror.displayString}`); | ||
return callback(null, errorObj); | ||
} | ||
const result = { | ||
response: `Schema updates completed to entity: ${entity} - ${configFile}` | ||
}; | ||
log.info(result.response); | ||
return callback(result, null); | ||
} | ||
if (type === 'mock') { | ||
// if the mock directory does not exist - error | ||
const mpath = `${__dirname}/entities/${entity}/mockdatafiles`; | ||
if (!fs.existsSync(mpath)) { | ||
fs.mkdirSync(mpath); | ||
} | ||
const mres = updateMock(mpath, configFile, changes); | ||
if (mres) { | ||
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Incomplete Configuration Change: ${mres}`, [], null, null, null); | ||
log.error(`${origin}: ${errorObj.IAPerror.displayString}`); | ||
return callback(null, errorObj); | ||
} | ||
const result = { | ||
response: `Mock data updates completed to entity: ${entity} - ${configFile}` | ||
}; | ||
log.info(result.response); | ||
return callback(result, null); | ||
} | ||
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Incomplete Configuration Change: Unsupported Type - ${type}`, [], null, null, null); | ||
log.error(`${origin}: ${errorObj.IAPerror.displayString}`); | ||
return callback(null, errorObj); | ||
} | ||
/** | ||
* @summary Connect function is used during Pronghorn startup to provide instantiation feedback. | ||
@@ -163,0 +405,0 @@ * |
## 0.1.2 [07-02-2020] | ||
* Migration | ||
See merge request itentialopensource/adapters/telemetry-analytics/adapter-accedian_skylight!2 | ||
--- | ||
## 0.1.1 [05-07-2020] | ||
@@ -9,2 +17,1 @@ | ||
--- | ||
@@ -12,2 +12,3 @@ { | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -14,0 +15,0 @@ "responseDatatype": "JSON", |
@@ -33,2 +33,3 @@ { | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -54,2 +55,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -96,2 +98,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -117,2 +120,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -159,2 +163,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -201,2 +206,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -222,2 +228,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -264,2 +271,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -285,2 +293,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -306,2 +315,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -308,0 +318,0 @@ "responseDatatype": "JSON", |
@@ -33,2 +33,3 @@ { | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -54,2 +55,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -117,2 +119,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -138,2 +141,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -159,2 +163,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -180,2 +185,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -222,2 +228,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -264,2 +271,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -266,0 +274,0 @@ "responseDatatype": "JSON", |
@@ -12,2 +12,3 @@ { | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -54,2 +55,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -75,2 +77,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -117,2 +120,3 @@ "responseDatatype": "JSON", | ||
"sendEmpty": false, | ||
"sendGetBody": false, | ||
"requestDatatype": "JSON", | ||
@@ -119,0 +123,0 @@ "responseDatatype": "JSON", |
{ | ||
"name": "@itentialopensource/adapter-accedian_skylight", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "This adapter integrates with system described as: accedianSkylight.", | ||
"main": "adapter.js", | ||
"wizardVersion": "2.41.22", | ||
"engineVersion": "1.50.5", | ||
"wizardVersion": "2.41.25", | ||
"engineVersion": "1.52.2", | ||
"scripts": { | ||
@@ -35,3 +35,4 @@ "artifactize": "npm i && node utils/packModificationScript.js", | ||
"engines": { | ||
"node": ">= 0.12.7" | ||
"node": ">= 8.0.0", | ||
"npm": ">= 6.0.0" | ||
}, | ||
@@ -45,3 +46,3 @@ "repository": { | ||
"dependencies": { | ||
"@itentialopensource/adapter-utils": "^4.32.3", | ||
"@itentialopensource/adapter-utils": "^4.34.4", | ||
"ajv": "^6.12.0", | ||
@@ -54,9 +55,9 @@ "fs-extra": "^8.1.0", | ||
"chai": "^4.2.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-airbnb-base": "^14.1.0", | ||
"eslint-plugin-import": "^2.20.1", | ||
"eslint": "^7.2.0", | ||
"eslint-config-airbnb-base": "^14.2.0", | ||
"eslint-plugin-import": "^2.21.2", | ||
"eslint-plugin-json": "^2.1.1", | ||
"mocha": "^7.1.1", | ||
"nyc": "^15.0.0", | ||
"testdouble": "^3.13.1", | ||
"mocha": "^8.0.1", | ||
"nyc": "^15.1.0", | ||
"testdouble": "^3.16.0", | ||
"winston": "^3.2.1" | ||
@@ -63,0 +64,0 @@ }, |
@@ -12,2 +12,76 @@ { | ||
{ | ||
"name": "updateAdapterConfiguration", | ||
"summary": "Updates the adapter configuration", | ||
"description": "Updates the adapter configuration file with the provided changes", | ||
"input": [ | ||
{ | ||
"name": "configFile", | ||
"type": "string", | ||
"info": "The name of the file to change", | ||
"required": true, | ||
"schema": { | ||
"title": "configFile", | ||
"type": "string" | ||
} | ||
}, | ||
{ | ||
"name": "changes", | ||
"type": "object", | ||
"info": "JSON object containing the configuration changes", | ||
"required": true, | ||
"schema": { | ||
"title": "changes", | ||
"type": "object" | ||
} | ||
}, | ||
{ | ||
"name": "entity", | ||
"type": "string", | ||
"info": "The entity in which the changes are being made", | ||
"required": false, | ||
"schema": { | ||
"title": "entity", | ||
"type": "string" | ||
} | ||
}, | ||
{ | ||
"name": "type", | ||
"type": "string", | ||
"info": "The type of file to change - action, schema, or mock", | ||
"required": false, | ||
"schema": { | ||
"title": "type", | ||
"type": "string" | ||
} | ||
}, | ||
{ | ||
"name": "action", | ||
"type": "string", | ||
"info": "The action to be changed", | ||
"required": false, | ||
"schema": { | ||
"title": "action", | ||
"type": "string" | ||
} | ||
} | ||
], | ||
"output": { | ||
"name": "result", | ||
"type": "object", | ||
"description": "A JSON Object containing status, code and the result", | ||
"schema": { | ||
"title": "result", | ||
"type": "object" | ||
} | ||
}, | ||
"roles": [ | ||
"admin" | ||
], | ||
"route": { | ||
"verb": "POST", | ||
"path": "/updateAdapterConfiguration" | ||
}, | ||
"task": true | ||
}, | ||
{ | ||
"name": "getEndpoints", | ||
@@ -14,0 +88,0 @@ "summary": "Get endpoints", |
@@ -49,4 +49,12 @@ { | ||
}, | ||
"encode_pathvars": { | ||
"type": "boolean", | ||
"description": "When true the path variables are encoded in the url", | ||
"default": true | ||
}, | ||
"save_metric": { | ||
"type": ["boolean", "string"], | ||
"type": [ | ||
"boolean", | ||
"string" | ||
], | ||
"description": "When true the metrics collected by the adapter will be stored in mongo or on the filesystem", | ||
@@ -454,3 +462,6 @@ "default": false | ||
"limit_retry_error": { | ||
"type": ["integer", "array"], | ||
"type": [ | ||
"integer", | ||
"array" | ||
], | ||
"description": "http error status number which defines that no capacity was available and thus after waiting a short interval the adapter can retry the request. Supports an array of numbers or strings including a range provided as '###-###'", | ||
@@ -784,2 +795,2 @@ "default": 0 | ||
} | ||
} | ||
} |
113
README.md
@@ -25,2 +25,20 @@ # Accedian_skylight Adapter | ||
### Adapter Technical Resources | ||
There is adapter documentation available on the Itential Developer Site [HERE](https://developer.itential.io/adapters-resources/). This documentation includes information and examples that are helpful for: | ||
```text | ||
Authentication | ||
Properties | ||
Code Files | ||
Action Files | ||
Schema Files | ||
Mock Data Files | ||
Linting and Testing | ||
Troubleshooting | ||
``` | ||
Others will be added over time. | ||
Want to build a new adapter? Use the Adapter Builder [HERE](https://adapters.itential.io) | ||
### Environment Prerequisites | ||
@@ -30,4 +48,5 @@ | ||
```json | ||
```text | ||
Node.js | ||
npm | ||
Git | ||
@@ -51,3 +70,3 @@ ``` | ||
```json | ||
```text | ||
chai | ||
@@ -68,3 +87,3 @@ eslint | ||
```json | ||
```bash | ||
git clone git@gitlab.com:\@itentialopensource/adapters/adapter-accedian_skylight | ||
@@ -87,2 +106,3 @@ npm install | ||
"cache_location": "local", | ||
"encode_pathvars": true, | ||
"save_metric": true, | ||
@@ -95,8 +115,8 @@ "stub": false, | ||
"password": "password", | ||
"auth_field": "header.headers.X-AUTH-TOKEN", | ||
"auth_field_format": "{token}", | ||
"token": "token", | ||
"invalid_token_error": 401, | ||
"token_timeout": 0, | ||
"token_cache": "local" | ||
"token_cache": "local", | ||
"auth_field": "header.headers.X-AUTH-TOKEN", | ||
"auth_field_format": "{token}" | ||
}, | ||
@@ -140,3 +160,4 @@ "healthcheck": { | ||
"expire_timeout": 0, | ||
"avg_runtime": 200 | ||
"avg_runtime": 200, | ||
"priorities": [] | ||
}, | ||
@@ -180,2 +201,3 @@ "proxy": { | ||
| cache\_location | Optional. Used to define where the adapter cache is located. The cache is used to maintain an entity list to improve performance. Storage locally is lost when the adapter is restarted. Storage in Redis is preserved upon adapter restart. Default is none which means no caching of the entity list.| | ||
| encode\_pathvars | Optional. Used to tell the adapter to encode path variables or not. The default behavior is to encode them so this property can b e used to stop that behavior.| | ||
| save\_metric | Optional. Used to tell the adapter to save metric information (this does not impact metrics returned on calls). This allows the adapter to gather metrics over time. Metric data can be stored in a database or on the file system.| | ||
@@ -198,4 +220,2 @@ | stub | Optional. Indicates whether the stub should run instead of making calls to Accedian_skylight (very useful during basic testing). Default is false (which means connect to Accedian_skylight).| | ||
| password | Used to authenticate with Accedian_skylight on every request or when pulling a token that will be used in subsequent requests.| | ||
| auth\_field | Defines the request field the authentication (e.g., token are basic auth credentials) needs to be placed in order for the calls to work.| | ||
| auth\_field\_format | Defines the format of the auth\_field. See examples below. Items enclosed in {} inform the adapter to perofrm an action prior to sending the data. It may be to replace the item with a value or it may be to encode the item. | | ||
| token | Defines a static token that can be used on all requests. Only used with `static_token` as an authentication method (auth\_method).| | ||
@@ -205,2 +225,4 @@ | invalid\_token\_error | Defines the HTTP error that is received when the token is invalid. Notifies the adapter to pull a new token and retry the request. Default is 401.| | ||
| token\_cache | Used to determine where the token should be stored (local memory or in Redis).| | ||
| auth\_field | Defines the request field the authentication (e.g., token are basic auth credentials) needs to be placed in order for the calls to work.| | ||
| auth\_field\_format | Defines the format of the auth\_field. See examples below. Items enclosed in {} inform the adapter to perofrm an action prior to sending the data. It may be to replace the item with a value or it may be to encode the item. | | ||
@@ -210,5 +232,5 @@ #### Examples of authentication field format | ||
```json | ||
"{token}", | ||
"Token {token}", | ||
"{username}:{password}", | ||
"{token}" | ||
"Token {token}" | ||
"{username}:{password}" | ||
"Basic {b64}{username}:{password}{/b64}" | ||
@@ -278,2 +300,3 @@ ``` | ||
| average\_runtime | Represents the approximate average of how long it takes Accedian_skylight to handle each request. Measured in milliseconds (minimum = 50, maximum = 60000). Default is 200. This metric has performance implications. If the runtime number is set too low, it puts extra burden on the CPU and memory as the requests will continually try to run. If the runtime number is set too high, requests may wait longer than they need to before running. The number does not need to be exact but your throttling strategy depends heavily on this number being within reason. If averages range from 50 to 250 milliseconds you might pick an average run-time somewhere in the middle so that when Accedian_skylight performance is exceptional you might run a little slower than you might like, but when it is poor you still run efficiently.| | ||
| priorities | An array of priorities and how to handle them in relation to the throttle queue. Array of objects that include priority value and percent of queue to put the item ex { value: 1, percent: 10 }| | ||
@@ -319,3 +342,3 @@ ### Proxy Properties | ||
```json | ||
```bash | ||
node utils/testRunner --unit | ||
@@ -334,3 +357,3 @@ | ||
```json | ||
```bash | ||
node utils/testRunner | ||
@@ -350,3 +373,3 @@ answer no at the first prompt | ||
```json | ||
```bash | ||
node utils/testRunner | ||
@@ -367,3 +390,3 @@ answer yes at the first prompt | ||
```json | ||
```bash | ||
cd /opt/pronghorn/current/node_modules | ||
@@ -376,3 +399,3 @@ if the @itentialopensource directory does not exist, create it: | ||
```json | ||
```bash | ||
cd \@itentialopensource | ||
@@ -384,3 +407,3 @@ git clone git@gitlab.com:\@itentialopensource/adapters/adapter-accedian_skylight | ||
```json | ||
```bash | ||
cd adapter-accedian_skylight | ||
@@ -395,3 +418,3 @@ npm install | ||
```json | ||
```bash | ||
systemctl restart pronghorn | ||
@@ -406,3 +429,3 @@ ``` | ||
```json | ||
```text | ||
Depending on where your code is located, this process is different. | ||
@@ -423,50 +446,50 @@ Could be a tar, move, untar | ||
```json | ||
The `connect` call is run when the Adapter is first loaded by he Itential Platform. It validates the properties have been provided correctly. | ||
```js | ||
connect() | ||
The connect call is run when the Adapter is first loaded by he Itential Platform. It validates the properties have been provided correctly. | ||
``` | ||
```json | ||
The `healthCheck` call ensures that the adapter can communicate with Accedian_skylight. The actual call that is used is defined in the adapter properties. | ||
```js | ||
healthCheck(callback) | ||
Insures that the adapter can communicate with Accedian_skylight. The actual call that is used is defined in the adapter properties. | ||
``` | ||
```json | ||
The `refreshProperties` call provides the adapter the ability to accept property changes without having to restart the adapter. | ||
```js | ||
refreshProperties(properties) | ||
Provides the adapter the ability to accept property changes without having to restart the adapter. | ||
``` | ||
```json | ||
The `encryptProperty` call will take the provided property and technique, and return the property encrypted with the technique. This allows the property to be used in the adapterProps section for the credential password so that the password does not have to be in clear text. The adapter will decrypt the property as needed for communications with Accedian_skylight. | ||
```js | ||
encryptProperty(property, technique, callback) | ||
Will take the provided property and technique, and return the property encrypted with the technique. This allows the property to be used in the adapterProps section for the credential password so that the password does not have to be in clear text. The adapter will decrypt the property as needed for communications with Accedian_skylight. | ||
``` | ||
```json | ||
The `getQueue` call will return the requests that are waiting in the queue if throttling is enabled. | ||
```js | ||
getQueue(callback) | ||
Will return the requests that are waiting in the queue if throttling is enabled. | ||
``` | ||
```json | ||
The `addEntityCache` call will take the entities and add the list to the entity cache to expedite performance. | ||
```js | ||
addEntityCache(entityType, entities, key, callback) | ||
Will take the entities and add the list to the entity cache to expedite performance. | ||
``` | ||
```json | ||
The `capabilityResults` call will take the results from a verifyCompatibility and put them in the format to be passed back to the Itential Platform. | ||
```js | ||
capabilityResults(results, callback) | ||
Will take the results from a verifyCompatibility and put them in the format to be passed back to the Itential Platform. | ||
``` | ||
```json | ||
The `hasEntity` call verifies the adapter has the specific entity. | ||
```js | ||
hasEntity(entityType, entityId, callback) | ||
Verifies the adapter has the specific entity. | ||
``` | ||
```json | ||
The `verifyCapability` call verifies the adapter can perform the provided action on the specific entity. | ||
```js | ||
verifyCapability(entityType, actionType, entityId, callback) | ||
Verifies the adapter can perform the provided action on the specific entity. | ||
``` | ||
```json | ||
The `updateEntityCache` call will update the entity cache. | ||
```js | ||
updateEntityCache() | ||
Call to update the entity cache. | ||
``` | ||
@@ -484,3 +507,3 @@ | ||
```json | ||
```text | ||
Go into the Itential Platform GUI and verify/update the properties | ||
@@ -491,3 +514,3 @@ ``` | ||
```json | ||
```text | ||
ping the ip address of Accedian_skylight server | ||
@@ -499,3 +522,3 @@ try telnet to the ip address port of Accedian_skylight | ||
```json | ||
```text | ||
login to Accedian_skylight using the provided credentials | ||
@@ -506,3 +529,3 @@ ``` | ||
```json | ||
```text | ||
Go into the Itential Platform GUI and verify/update the properties | ||
@@ -523,3 +546,3 @@ ``` | ||
```json | ||
```text | ||
Itential Product Adapters are maintained by the Itential Adapter Team. | ||
@@ -526,0 +549,0 @@ Itential OpenSource Adapters are maintained by the community at large. |
@@ -10,2 +10,3 @@ { | ||
"cache_location": "none", | ||
"encode_pathvars": true, | ||
"save_metric": true, | ||
@@ -12,0 +13,0 @@ "stub": false, |
@@ -52,2 +52,3 @@ /* @copyright Itential, LLC 2019 (pre-modifications) */ | ||
cache_location: 'none', | ||
encode_pathvars: true, | ||
save_metric: false, | ||
@@ -307,3 +308,2 @@ stub, | ||
// require the adapter that we are going to be using | ||
@@ -310,0 +310,0 @@ const AccedianSkylight = require('../../adapter.js'); |
@@ -54,2 +54,3 @@ /* @copyright Itential, LLC 2019 (pre-modifications) */ | ||
cache_location: 'none', | ||
encode_pathvars: true, | ||
save_metric: false, | ||
@@ -195,3 +196,2 @@ stub, | ||
// require the adapter that we are going to be using | ||
@@ -198,0 +198,0 @@ const AccedianSkylight = require('../../adapter.js'); |
@@ -18,3 +18,2 @@ #!/usr/bin/env node | ||
const adapterNewDir = path.join(artifactDir, 'bundles', 'adapters', originalName); | ||
@@ -21,0 +20,0 @@ fs.ensureDirSync(adapterNewDir); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
524083
43
13349
530
12
4