@itentialopensource/adapter-zscaler 0.6.7 → 0.8.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.
Files changed (54) hide show
  1. package/AUTH.md +39 -0
  2. package/BROKER.md +199 -0
  3. package/CALLS.md +511 -0
  4. package/CHANGELOG.md +3 -94
  5. package/CODE_OF_CONDUCT.md +12 -17
  6. package/CONTRIBUTING.md +3 -148
  7. package/ENHANCE.md +69 -0
  8. package/PROPERTIES.md +641 -0
  9. package/README.md +235 -576
  10. package/SUMMARY.md +9 -0
  11. package/SYSTEMINFO.md +11 -0
  12. package/TROUBLESHOOT.md +47 -0
  13. package/adapter.js +292 -640
  14. package/adapterBase.js +843 -419
  15. package/changelogs/CHANGELOG.md +118 -0
  16. package/entities/.generic/action.json +105 -0
  17. package/entities/.generic/schema.json +6 -1
  18. package/error.json +6 -0
  19. package/metadata.json +49 -0
  20. package/package.json +25 -24
  21. package/pronghorn.json +527 -116
  22. package/propertiesDecorators.json +14 -0
  23. package/propertiesSchema.json +827 -6
  24. package/refs?service=git-upload-pack +0 -0
  25. package/report/adapter-openapi.json +1828 -0
  26. package/report/adapter-openapi.yaml +1462 -0
  27. package/report/adapterInfo.json +10 -0
  28. package/report/updateReport1653331963274.json +120 -0
  29. package/report/updateReport1691508819418.json +120 -0
  30. package/report/updateReport1692203278243.json +120 -0
  31. package/report/updateReport1694468959859.json +120 -0
  32. package/report/updateReport1698422816279.json +120 -0
  33. package/sampleProperties.json +153 -3
  34. package/test/integration/adapterTestBasicGet.js +3 -5
  35. package/test/integration/adapterTestConnectivity.js +91 -42
  36. package/test/integration/adapterTestIntegration.js +155 -109
  37. package/test/unit/adapterBaseTestUnit.js +388 -308
  38. package/test/unit/adapterTestUnit.js +399 -260
  39. package/utils/adapterInfo.js +206 -0
  40. package/utils/addAuth.js +1 -1
  41. package/utils/artifactize.js +1 -1
  42. package/utils/checkMigrate.js +1 -1
  43. package/utils/entitiesToDB.js +12 -57
  44. package/utils/findPath.js +1 -1
  45. package/utils/methodDocumentor.js +273 -0
  46. package/utils/modify.js +13 -15
  47. package/utils/packModificationScript.js +1 -1
  48. package/utils/pre-commit.sh +5 -0
  49. package/utils/taskMover.js +309 -0
  50. package/utils/tbScript.js +123 -53
  51. package/utils/tbUtils.js +87 -49
  52. package/utils/testRunner.js +17 -17
  53. package/utils/troubleshootingAdapter.js +9 -6
  54. package/workflows/README.md +0 -3
package/adapter.js CHANGED
@@ -82,10 +82,16 @@ class Zscaler extends AdapterBaseCl {
82
82
  }
83
83
 
84
84
  /**
85
- * @getWorkflowFunctions
85
+ * @iapGetAdapterWorkflowFunctions
86
86
  */
87
- getWorkflowFunctions(inIgnore) {
88
- let myIgnore = ['hasEntities', 'hasDevices', 'getObfuscatedKey'];
87
+ iapGetAdapterWorkflowFunctions(inIgnore) {
88
+ let myIgnore = [
89
+ 'healthCheck',
90
+ 'iapGetAdapterWorkflowFunctions',
91
+ 'hasEntities',
92
+ 'getAuthorization',
93
+ 'getObfuscatedKey'
94
+ ];
89
95
  if (!inIgnore && Array.isArray(inIgnore)) {
90
96
  myIgnore = inIgnore;
91
97
  } else if (!inIgnore && typeof inIgnore === 'string') {
@@ -96,52 +102,44 @@ class Zscaler extends AdapterBaseCl {
96
102
  // you can add specific methods that you do not want to be workflow functions to ignore like below
97
103
  // myIgnore.push('myMethodNotInWorkflow');
98
104
 
99
- return super.getWorkflowFunctions(myIgnore);
105
+ return super.iapGetAdapterWorkflowFunctions(myIgnore);
100
106
  }
101
107
 
102
108
  /**
103
- * updateAdapterConfiguration is used to update any of the adapter configuration files. This
109
+ * iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
104
110
  * allows customers to make changes to adapter configuration without having to be on the
105
111
  * file system.
106
112
  *
107
- * @function updateAdapterConfiguration
113
+ * @function iapUpdateAdapterConfiguration
108
114
  * @param {string} configFile - the name of the file being updated (required)
109
115
  * @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
110
116
  * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
111
117
  * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
112
118
  * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
119
+ * @param {boolean} replace - true to replace entire mock data, false to merge/append
113
120
  * @param {Callback} callback - The results of the call
114
121
  */
115
- updateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
116
- const origin = `${this.id}-adapter-updateAdapterConfiguration`;
122
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
123
+ const meth = 'adapter-iapUpdateAdapterConfiguration';
124
+ const origin = `${this.id}-${meth}`;
117
125
  log.trace(origin);
118
- super.updateAdapterConfiguration(configFile, changes, entity, type, action, callback);
119
- }
120
126
 
121
- /**
122
- * See if the API path provided is found in this adapter
123
- *
124
- * @function findPath
125
- * @param {string} apiPath - the api path to check on
126
- * @param {Callback} callback - The results of the call
127
- */
128
- findPath(apiPath, callback) {
129
- const origin = `${this.id}-adapter-findPath`;
130
- log.trace(origin);
131
- super.findPath(apiPath, callback);
127
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
132
128
  }
133
129
 
134
130
  /**
135
131
  * @summary Suspends adapter
136
132
  *
137
- * @function suspend
133
+ * @function iapSuspendAdapter
138
134
  * @param {Callback} callback - callback function
139
135
  */
140
- suspend(mode, callback) {
141
- const origin = `${this.id}-adapter-suspend`;
136
+ iapSuspendAdapter(mode, callback) {
137
+ const meth = 'adapter-iapSuspendAdapter';
138
+ const origin = `${this.id}-${meth}`;
142
139
  log.trace(origin);
140
+
143
141
  try {
144
- return super.suspend(mode, callback);
142
+ return super.iapSuspendAdapter(mode, callback);
145
143
  } catch (error) {
146
144
  log.error(`${origin}: ${error}`);
147
145
  return callback(null, error);
@@ -151,14 +149,16 @@ class Zscaler extends AdapterBaseCl {
151
149
  /**
152
150
  * @summary Unsuspends adapter
153
151
  *
154
- * @function unsuspend
152
+ * @function iapUnsuspendAdapter
155
153
  * @param {Callback} callback - callback function
156
154
  */
157
- unsuspend(callback) {
158
- const origin = `${this.id}-adapter-unsuspend`;
155
+ iapUnsuspendAdapter(callback) {
156
+ const meth = 'adapter-iapUnsuspendAdapter';
157
+ const origin = `${this.id}-${meth}`;
159
158
  log.trace(origin);
159
+
160
160
  try {
161
- return super.unsuspend(callback);
161
+ return super.iapUnsuspendAdapter(callback);
162
162
  } catch (error) {
163
163
  log.error(`${origin}: ${error}`);
164
164
  return callback(null, error);
@@ -166,31 +166,51 @@ class Zscaler extends AdapterBaseCl {
166
166
  }
167
167
 
168
168
  /**
169
- * @summary Get the Adaoter Queue
169
+ * @summary Get the Adapter Queue
170
170
  *
171
- * @function getQueue
171
+ * @function iapGetAdapterQueue
172
172
  * @param {Callback} callback - callback function
173
173
  */
174
- getQueue(callback) {
175
- const origin = `${this.id}-adapter-getQueue`;
174
+ iapGetAdapterQueue(callback) {
175
+ const meth = 'adapter-iapGetAdapterQueue';
176
+ const origin = `${this.id}-${meth}`;
176
177
  log.trace(origin);
177
- return super.getQueue(callback);
178
+
179
+ return super.iapGetAdapterQueue(callback);
180
+ }
181
+
182
+ /* SCRIPT CALLS */
183
+ /**
184
+ * See if the API path provided is found in this adapter
185
+ *
186
+ * @function iapFindAdapterPath
187
+ * @param {string} apiPath - the api path to check on
188
+ * @param {Callback} callback - The results of the call
189
+ */
190
+ iapFindAdapterPath(apiPath, callback) {
191
+ const meth = 'adapter-iapFindAdapterPath';
192
+ const origin = `${this.id}-${meth}`;
193
+ log.trace(origin);
194
+
195
+ super.iapFindAdapterPath(apiPath, callback);
178
196
  }
179
197
 
180
198
  /**
181
199
  * @summary Runs troubleshoot scripts for adapter
182
200
  *
183
- * @function troubleshoot
201
+ * @function iapTroubleshootAdapter
184
202
  * @param {Object} props - the connection, healthcheck and authentication properties
185
203
  *
186
204
  * @param {boolean} persistFlag - whether the adapter properties should be updated
187
205
  * @param {Callback} callback - The results of the call
188
206
  */
189
- troubleshoot(props, persistFlag, callback) {
190
- const origin = `${this.id}-adapter-troubleshoot`;
207
+ iapTroubleshootAdapter(props, persistFlag, callback) {
208
+ const meth = 'adapter-iapTroubleshootAdapter';
209
+ const origin = `${this.id}-${meth}`;
191
210
  log.trace(origin);
211
+
192
212
  try {
193
- return super.troubleshoot(props, persistFlag, this, callback);
213
+ return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
194
214
  } catch (error) {
195
215
  log.error(`${origin}: ${error}`);
196
216
  return callback(null, error);
@@ -200,15 +220,17 @@ class Zscaler extends AdapterBaseCl {
200
220
  /**
201
221
  * @summary runs healthcheck script for adapter
202
222
  *
203
- * @function runHealthcheck
223
+ * @function iapRunAdapterHealthcheck
204
224
  * @param {Adapter} adapter - adapter instance to troubleshoot
205
225
  * @param {Callback} callback - callback function
206
226
  */
207
- runHealthcheck(callback) {
208
- const origin = `${this.id}-adapter-runHealthcheck`;
227
+ iapRunAdapterHealthcheck(callback) {
228
+ const meth = 'adapter-iapRunAdapterHealthcheck';
229
+ const origin = `${this.id}-${meth}`;
209
230
  log.trace(origin);
231
+
210
232
  try {
211
- return super.runHealthcheck(this, callback);
233
+ return super.iapRunAdapterHealthcheck(this, callback);
212
234
  } catch (error) {
213
235
  log.error(`${origin}: ${error}`);
214
236
  return callback(null, error);
@@ -218,14 +240,16 @@ class Zscaler extends AdapterBaseCl {
218
240
  /**
219
241
  * @summary runs connectivity check script for adapter
220
242
  *
221
- * @function runConnectivity
243
+ * @function iapRunAdapterConnectivity
222
244
  * @param {Callback} callback - callback function
223
245
  */
224
- runConnectivity(callback) {
225
- const origin = `${this.id}-adapter-runConnectivity`;
246
+ iapRunAdapterConnectivity(callback) {
247
+ const meth = 'adapter-iapRunAdapterConnectivity';
248
+ const origin = `${this.id}-${meth}`;
226
249
  log.trace(origin);
250
+
227
251
  try {
228
- return super.runConnectivity(callback);
252
+ return super.iapRunAdapterConnectivity(callback);
229
253
  } catch (error) {
230
254
  log.error(`${origin}: ${error}`);
231
255
  return callback(null, error);
@@ -235,14 +259,16 @@ class Zscaler extends AdapterBaseCl {
235
259
  /**
236
260
  * @summary runs basicGet script for adapter
237
261
  *
238
- * @function runBasicGet
262
+ * @function iapRunAdapterBasicGet
239
263
  * @param {Callback} callback - callback function
240
264
  */
241
- runBasicGet(callback) {
242
- const origin = `${this.id}-adapter-runBasicGet`;
265
+ iapRunAdapterBasicGet(callback) {
266
+ const meth = 'adapter-iapRunAdapterBasicGet';
267
+ const origin = `${this.id}-${meth}`;
243
268
  log.trace(origin);
269
+
244
270
  try {
245
- return super.runBasicGet(callback);
271
+ return super.iapRunAdapterBasicGet(callback);
246
272
  } catch (error) {
247
273
  log.error(`${origin}: ${error}`);
248
274
  return callback(null, error);
@@ -252,15 +278,17 @@ class Zscaler extends AdapterBaseCl {
252
278
  /**
253
279
  * @summary moves entites into Mongo DB
254
280
  *
255
- * @function moveEntitiesToDB
281
+ * @function iapMoveAdapterEntitiesToDB
256
282
  * @param {getCallback} callback - a callback function to return the result (Generics)
257
283
  * or the error
258
284
  */
259
- moveEntitiesToDB(callback) {
260
- const origin = `${this.id}-adapter-moveEntitiesToDB`;
285
+ iapMoveAdapterEntitiesToDB(callback) {
286
+ const meth = 'adapter-iapMoveAdapterEntitiesToDB';
287
+ const origin = `${this.id}-${meth}`;
261
288
  log.trace(origin);
289
+
262
290
  try {
263
- return super.moveEntitiesToDB(callback);
291
+ return super.iapMoveAdapterEntitiesToDB(callback);
264
292
  } catch (err) {
265
293
  log.error(`${origin}: ${err}`);
266
294
  return callback(null, err);
@@ -268,281 +296,88 @@ class Zscaler extends AdapterBaseCl {
268
296
  }
269
297
 
270
298
  /**
271
- * @summary Determines if this adapter supports the specific entity
299
+ * @summary Deactivate adapter tasks
272
300
  *
273
- * @function hasEntity
274
- * @param {String} entityType - the entity type to check for
275
- * @param {String/Array} entityId - the specific entity we are looking for
301
+ * @function iapDeactivateTasks
276
302
  *
277
- * @param {Callback} callback - An array of whether the adapter can has the
278
- * desired capability or an error
303
+ * @param {Array} tasks - List of tasks to deactivate
304
+ * @param {Callback} callback
279
305
  */
280
- hasEntity(entityType, entityId, callback) {
281
- const origin = `${this.id}-adapter-hasEntity`;
306
+ iapDeactivateTasks(tasks, callback) {
307
+ const meth = 'adapter-iapDeactivateTasks';
308
+ const origin = `${this.id}-${meth}`;
282
309
  log.trace(origin);
283
310
 
284
- // Make the call -
285
- // verifyCapability(entityType, actionType, entityId, callback)
286
- return this.verifyCapability(entityType, null, entityId, callback);
311
+ try {
312
+ return super.iapDeactivateTasks(tasks, callback);
313
+ } catch (err) {
314
+ log.error(`${origin}: ${err}`);
315
+ return callback(null, err);
316
+ }
287
317
  }
288
318
 
289
319
  /**
290
- * @summary Provides a way for the adapter to tell north bound integrations
291
- * whether the adapter supports type, action and specific entity
320
+ * @summary Activate adapter tasks that have previously been deactivated
292
321
  *
293
- * @function verifyCapability
294
- * @param {String} entityType - the entity type to check for
295
- * @param {String} actionType - the action type to check for
296
- * @param {String/Array} entityId - the specific entity we are looking for
322
+ * @function iapActivateTasks
297
323
  *
298
- * @param {Callback} callback - An array of whether the adapter can has the
299
- * desired capability or an error
324
+ * @param {Array} tasks - List of tasks to activate
325
+ * @param {Callback} callback
300
326
  */
301
- verifyCapability(entityType, actionType, entityId, callback) {
302
- const meth = 'adapterBase-verifyCapability';
327
+ iapActivateTasks(tasks, callback) {
328
+ const meth = 'adapter-iapActivateTasks';
303
329
  const origin = `${this.id}-${meth}`;
304
330
  log.trace(origin);
305
331
 
306
- // if caching
307
- if (this.caching) {
308
- // Make the call - verifyCapability(entityType, actionType, entityId, callback)
309
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (results, error) => {
310
- if (error) {
311
- return callback(null, error);
312
- }
313
-
314
- // if the cache needs to be updated, update and try again
315
- if (results && results[0] === 'needupdate') {
316
- switch (entityType) {
317
- case 'template_entity': {
318
- // if the cache is invalid, update the cache
319
- return this.getEntities(null, null, null, null, (data, err) => {
320
- if (err) {
321
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
322
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
323
- return callback(null, errorObj);
324
- }
325
-
326
- // need to check the cache again since it has been updated
327
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
328
- if (verror) {
329
- return callback(null, verror);
330
- }
331
-
332
- return this.capabilityResults(vcapable, callback);
333
- });
334
- });
335
- }
336
- default: {
337
- // unsupported entity type
338
- const result = [false];
339
-
340
- // put false in array for all entities
341
- if (Array.isArray(entityId)) {
342
- for (let e = 1; e < entityId.length; e += 1) {
343
- result.push(false);
344
- }
345
- }
346
-
347
- return callback(result);
348
- }
349
- }
350
- }
351
-
352
- // return the results
353
- return this.capabilityResults(results, callback);
354
- });
355
- }
356
-
357
- // if no entity id
358
- if (!entityId) {
359
- // need to check the cache again since it has been updated
360
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
361
- if (verror) {
362
- return callback(null, verror);
363
- }
364
-
365
- return this.capabilityResults(vcapable, callback);
366
- });
367
- }
368
-
369
- // if not caching
370
- switch (entityType) {
371
- case 'template_entity': {
372
- // need to get the entities to check
373
- return this.getEntities(null, null, null, null, (data, err) => {
374
- if (err) {
375
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
376
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
377
- return callback(null, errorObj);
378
- }
379
-
380
- // need to check the cache again since it has been updated
381
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
382
- if (verror) {
383
- return callback(null, verror);
384
- }
385
-
386
- // is the entity in the list?
387
- const isEntity = this.entityInList(entityId, data.response, callback);
388
- const res = [];
389
-
390
- // not found
391
- for (let i = 0; i < isEntity.length; i += 1) {
392
- if (vcapable) {
393
- res.push(isEntity[i]);
394
- } else {
395
- res.push(false);
396
- }
397
- }
398
-
399
- return callback(res);
400
- });
401
- });
402
- }
403
- default: {
404
- // unsupported entity type
405
- const result = [false];
406
-
407
- // put false in array for all entities
408
- if (Array.isArray(entityId)) {
409
- for (let e = 1; e < entityId.length; e += 1) {
410
- result.push(false);
411
- }
412
- }
413
-
414
- return callback(result);
415
- }
332
+ try {
333
+ return super.iapActivateTasks(tasks, callback);
334
+ } catch (err) {
335
+ log.error(`${origin}: ${err}`);
336
+ return callback(null, err);
416
337
  }
417
338
  }
418
339
 
340
+ /* CACHE CALLS */
419
341
  /**
420
- * @summary Updates the cache for all entities by call the get All entity method
342
+ * @summary Populate the cache for the given entities
421
343
  *
422
- * @function updateEntityCache
344
+ * @function iapPopulateEntityCache
345
+ * @param {String/Array of Strings} entityType - the entity type(s) to populate
346
+ * @param {Callback} callback - whether the cache was updated or not for each entity type
423
347
  *
348
+ * @returns status of the populate
424
349
  */
425
- updateEntityCache() {
426
- const origin = `${this.id}-adapter-updateEntityCache`;
350
+ iapPopulateEntityCache(entityTypes, callback) {
351
+ const meth = 'adapter-iapPopulateEntityCache';
352
+ const origin = `${this.id}-${meth}`;
427
353
  log.trace(origin);
428
354
 
429
- if (this.caching) {
430
- // if the cache is invalid, update the cache
431
- this.getEntities(null, null, null, null, (data, err) => {
432
- if (err) {
433
- log.trace(`${origin}: Could not load template_entity into cache - ${err}`);
434
- }
435
- });
355
+ try {
356
+ return super.iapPopulateEntityCache(entityTypes, callback);
357
+ } catch (err) {
358
+ log.error(`${origin}: ${err}`);
359
+ return callback(null, err);
436
360
  }
437
361
  }
438
362
 
439
363
  /**
440
- * Makes the requested generic call
364
+ * @summary Retrieves data from cache for specified entity type
441
365
  *
442
- * @function genericAdapterRequest
443
- * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
444
- * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
445
- * @param {Object} queryData - the parameters to be put on the url (optional).
446
- * Can be a stringified Object.
447
- * @param {Object} requestBody - the body to add to the request (optional).
448
- * Can be a stringified Object.
449
- * @param {Object} addlHeaders - additional headers to be put on the call (optional).
450
- * Can be a stringified Object.
451
- * @param {getCallback} callback - a callback function to return the result (Generics)
452
- * or the error
366
+ * @function iapRetrieveEntitiesCache
367
+ * @param {String} entityType - entity of which to retrieve
368
+ * @param {Object} options - settings of which data to return and how to return it
369
+ * @param {Callback} callback - the data if it was retrieved
453
370
  */
454
- genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
455
- const meth = 'adapter-genericAdapterRequest';
371
+ iapRetrieveEntitiesCache(entityType, options, callback) {
372
+ const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
456
373
  const origin = `${this.id}-${meth}`;
457
374
  log.trace(origin);
458
375
 
459
- if (this.suspended && this.suspendMode === 'error') {
460
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
461
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
462
- return callback(null, errorObj);
463
- }
464
-
465
- /* HERE IS WHERE YOU VALIDATE DATA */
466
- if (uriPath === undefined || uriPath === null || uriPath === '') {
467
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
468
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
469
- return callback(null, errorObj);
470
- }
471
- if (restMethod === undefined || restMethod === null || restMethod === '') {
472
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
473
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
474
- return callback(null, errorObj);
475
- }
476
-
477
- /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
478
- // remove any leading / and split the uripath into path variables
479
- let myPath = uriPath;
480
- while (myPath.indexOf('/') === 0) {
481
- myPath = myPath.substring(1);
482
- }
483
- const pathVars = myPath.split('/');
484
- const queryParamsAvailable = queryData;
485
- const queryParams = {};
486
- const bodyVars = requestBody;
487
-
488
- // loop in template. long callback arg name to avoid identifier conflicts
489
- Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
490
- if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
491
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
492
- queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
493
- }
494
- });
495
-
496
- // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
497
- const reqObj = {
498
- payload: bodyVars,
499
- uriPathVars: pathVars,
500
- uriQuery: queryParams,
501
- uriOptions: {}
502
- };
503
- // add headers if provided
504
- if (addlHeaders) {
505
- reqObj.addlHeaders = addlHeaders;
506
- }
507
-
508
- // determine the call and return flag
509
- let action = 'getGenerics';
510
- let returnF = true;
511
- if (restMethod.toUpperCase() === 'POST') {
512
- action = 'createGeneric';
513
- } else if (restMethod.toUpperCase() === 'PUT') {
514
- action = 'updateGeneric';
515
- } else if (restMethod.toUpperCase() === 'PATCH') {
516
- action = 'patchGeneric';
517
- } else if (restMethod.toUpperCase() === 'DELETE') {
518
- action = 'deleteGeneric';
519
- returnF = false;
520
- }
521
-
522
376
  try {
523
- // Make the call -
524
- // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
525
- return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
526
- // if we received an error or their is no response on the results
527
- // return an error
528
- if (irReturnError) {
529
- /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
530
- return callback(null, irReturnError);
531
- }
532
- if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
533
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
534
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
535
- return callback(null, errorObj);
536
- }
537
-
538
- /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
539
- // return the response
540
- return callback(irReturnData, null);
541
- });
542
- } catch (ex) {
543
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
544
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
545
- return callback(null, errorObj);
377
+ return super.iapRetrieveEntitiesCache(entityType, options, callback);
378
+ } catch (err) {
379
+ log.error(`${origin}: ${err}`);
380
+ return callback(null, err);
546
381
  }
547
382
  }
548
383
 
@@ -558,56 +393,18 @@ class Zscaler extends AdapterBaseCl {
558
393
  * value is true or false
559
394
  */
560
395
  hasEntities(entityType, entityList, callback) {
561
- const origin = `${this.id}-adapter-hasEntities`;
396
+ const meth = 'adapter-hasEntities';
397
+ const origin = `${this.id}-${meth}`;
562
398
  log.trace(origin);
563
399
 
564
- switch (entityType) {
565
- case 'Device':
566
- return this.hasDevices(entityList, callback);
567
- default:
568
- return callback(null, `${this.id} does not support entity ${entityType}`);
400
+ try {
401
+ return super.hasEntities(entityType, entityList, callback);
402
+ } catch (err) {
403
+ log.error(`${origin}: ${err}`);
404
+ return callback(null, err);
569
405
  }
570
406
  }
571
407
 
572
- /**
573
- * @summary Helper method for hasEntities for the specific device case
574
- *
575
- * @param {Array} deviceList - array of unique device identifiers
576
- * @param {Callback} callback - A map where the device is the key and the
577
- * value is true or false
578
- */
579
- hasDevices(deviceList, callback) {
580
- const origin = `${this.id}-adapter-hasDevices`;
581
- log.trace(origin);
582
-
583
- const findings = deviceList.reduce((map, device) => {
584
- // eslint-disable-next-line no-param-reassign
585
- map[device] = false;
586
- log.debug(`In reduce: ${JSON.stringify(map)}`);
587
- return map;
588
- }, {});
589
- const apiCalls = deviceList.map((device) => new Promise((resolve) => {
590
- this.getDevice(device, (result, error) => {
591
- if (error) {
592
- log.debug(`In map error: ${JSON.stringify(device)}`);
593
- return resolve({ name: device, found: false });
594
- }
595
- log.debug(`In map: ${JSON.stringify(device)}`);
596
- return resolve({ name: device, found: true });
597
- });
598
- }));
599
- Promise.all(apiCalls).then((results) => {
600
- results.forEach((device) => {
601
- findings[device.name] = device.found;
602
- });
603
- log.debug(`FINDINGS: ${JSON.stringify(findings)}`);
604
- return callback(findings);
605
- }).catch((errors) => {
606
- log.error('Unable to do device lookup.');
607
- return callback(null, { code: 503, message: 'Unable to do device lookup.', error: errors });
608
- });
609
- }
610
-
611
408
  /**
612
409
  * @summary Get Appliance that match the deviceName
613
410
  *
@@ -622,69 +419,11 @@ class Zscaler extends AdapterBaseCl {
622
419
  const origin = `${this.id}-${meth}`;
623
420
  log.trace(origin);
624
421
 
625
- if (this.suspended && this.suspendMode === 'error') {
626
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
627
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
628
- return callback(null, errorObj);
629
- }
630
-
631
- /* HERE IS WHERE YOU VALIDATE DATA */
632
- if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
633
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
634
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
635
- return callback(null, errorObj);
636
- }
637
-
638
422
  try {
639
- // need to get the device so we can convert the deviceName to an id
640
- // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
641
- const opts = {
642
- filter: {
643
- name: deviceName
644
- }
645
- };
646
- return this.getDevicesFiltered(opts, (devs, ferr) => {
647
- // if we received an error or their is no response on the results return an error
648
- if (ferr) {
649
- return callback(null, ferr);
650
- }
651
- if (devs.list.length < 1) {
652
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
653
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
654
- return callback(null, errorObj);
655
- }
656
- // get the uuid from the device
657
- const { uuid } = devs.list[0];
658
-
659
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
660
- // !! you can also replace with a specific call if that is easier
661
- const uriPath = `/call/toget/device/${uuid}`;
662
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
663
- // if we received an error or their is no response on the results return an error
664
- if (error) {
665
- return callback(null, error);
666
- }
667
- if (!result.response || !result.response.applianceMo) {
668
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevice'], null, null, null);
669
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
670
- return callback(null, errorObj);
671
- }
672
-
673
- // return the response
674
- // !! format the data we send back
675
- // !! these fields are config manager fields you need to map to the data we receive
676
- const thisDevice = result.response;
677
- thisDevice.name = thisDevice.systemName;
678
- thisDevice.ostype = `System-${thisDevice.systemType}`;
679
- thisDevice.port = thisDevice.systemPort;
680
- thisDevice.ipaddress = thisDevice.systemIP;
681
- return callback(thisDevice);
682
- });
683
- });
684
- } catch (ex) {
685
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
686
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
687
- return callback(null, errorObj);
423
+ return super.getDevice(deviceName, callback);
424
+ } catch (err) {
425
+ log.error(`${origin}: ${err}`);
426
+ return callback(null, err);
688
427
  }
689
428
  }
690
429
 
@@ -702,128 +441,11 @@ class Zscaler extends AdapterBaseCl {
702
441
  const origin = `${this.id}-${meth}`;
703
442
  log.trace(origin);
704
443
 
705
- // verify the required fields have been provided
706
- if (options === undefined || options === null || options === '' || options.length === 0) {
707
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['options'], null, null, null);
708
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
709
- return callback(null, errorObj);
710
- }
711
- log.debug(`Device Filter Options: ${JSON.stringify(options)}`);
712
-
713
- // TODO - get pagination working
714
- // const nextToken = options.start;
715
- // const maxResults = options.limit;
716
-
717
- // set up the filter of Device Names
718
- let filterName = [];
719
- if (options && options.filter && options.filter.name) {
720
- // when this hack is removed, remove the lint ignore above
721
- if (Array.isArray(options.filter.name)) {
722
- // eslint-disable-next-line prefer-destructuring
723
- filterName = options.filter.name;
724
- } else {
725
- filterName = [options.filter.name];
726
- }
727
- }
728
-
729
- // TODO - get sort and order working
730
- /*
731
- if (options && options.sort) {
732
- reqObj.uriOptions.sort = JSON.stringify(options.sort);
733
- }
734
- if (options && options.order) {
735
- reqObj.uriOptions.order = options.order;
736
- }
737
- */
738
444
  try {
739
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
740
- // !! you can also replace with a specific call if that is easier
741
- const uriPath = '/call/toget/devices';
742
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
743
- // if we received an error or their is no response on the results return an error
744
- if (error) {
745
- return callback(null, error);
746
- }
747
- if (!result.response) {
748
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevicesFiltered'], null, null, null);
749
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
750
- return callback(null, errorObj);
751
- }
752
-
753
- // !! go through the response - may have to look for sub object
754
- // handle an array of devices
755
- if (Array.isArray(result.response)) {
756
- const myDevices = [];
757
-
758
- for (let d = 0; d < result.response.length; d += 1) {
759
- // !! format the data we send back
760
- // !! these fields are config manager fields you need to map to the data we receive
761
- const thisDevice = result.response;
762
- thisDevice.name = thisDevice.systemName;
763
- thisDevice.ostype = `System-${thisDevice.systemType}`;
764
- thisDevice.port = thisDevice.systemPort;
765
- thisDevice.ipaddress = thisDevice.systemIP;
766
-
767
- // if there is no filter - return the device
768
- if (filterName.length === 0) {
769
- myDevices.push(thisDevice);
770
- } else {
771
- // if we have to match a filter
772
- let found = false;
773
- for (let f = 0; f < filterName.length; f += 1) {
774
- if (thisDevice.name.indexOf(filterName[f]) >= 0) {
775
- found = true;
776
- break;
777
- }
778
- }
779
- // matching device
780
- if (found) {
781
- myDevices.push(thisDevice);
782
- }
783
- }
784
- }
785
- log.debug(`${origin}: Found #${myDevices.length} devices.`);
786
- log.debug(`Devices: ${JSON.stringify(myDevices)}`);
787
- return callback({ total: myDevices.length, list: myDevices });
788
- }
789
- // handle a single device response
790
- // !! format the data we send back
791
- // !! these fields are config manager fields you need to map to the data we receive
792
- const thisDevice = result.response;
793
- thisDevice.name = thisDevice.systemName;
794
- thisDevice.ostype = `System-${thisDevice.systemType}`;
795
- thisDevice.port = thisDevice.systemPort;
796
- thisDevice.ipaddress = thisDevice.systemIP;
797
-
798
- // if there is no filter - return the device
799
- if (filterName.length === 0) {
800
- log.debug(`${origin}: Found #1 device.`);
801
- log.debug(`Device: ${JSON.stringify(thisDevice)}`);
802
- return callback({ total: 1, list: [thisDevice] });
803
- }
804
-
805
- // if there is a filter need to check for matching device
806
- let found = false;
807
- for (let f = 0; f < filterName.length; f += 1) {
808
- if (thisDevice.name.indexOf(filterName[f]) >= 0) {
809
- found = true;
810
- break;
811
- }
812
- }
813
- // matching device
814
- if (found) {
815
- log.debug(`${origin}: Found #1 device.`);
816
- log.debug(`Device Found: ${JSON.stringify(thisDevice)}`);
817
- return callback({ total: 1, list: [thisDevice] });
818
- }
819
- // not a matching device
820
- log.debug(`${origin}: No matching device found.`);
821
- return callback({ total: 0, list: [] });
822
- });
823
- } catch (ex) {
824
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
825
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
826
- return callback(null, errorObj);
445
+ return super.getDevicesFiltered(options, callback);
446
+ } catch (err) {
447
+ log.error(`${origin}: ${err}`);
448
+ return callback(null, err);
827
449
  }
828
450
  }
829
451
 
@@ -841,57 +463,11 @@ class Zscaler extends AdapterBaseCl {
841
463
  const origin = `${this.id}-${meth}`;
842
464
  log.trace(origin);
843
465
 
844
- // verify the required fields have been provided
845
- if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
846
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
847
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
848
- return callback(null, errorObj);
849
- }
850
-
851
466
  try {
852
- // need to get the device so we can convert the deviceName to an id
853
- // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
854
- const opts = {
855
- filter: {
856
- name: deviceName
857
- }
858
- };
859
- return this.getDevicesFiltered(opts, (devs, ferr) => {
860
- // if we received an error or their is no response on the results return an error
861
- if (ferr) {
862
- return callback(null, ferr);
863
- }
864
- if (devs.list.length < 1) {
865
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
866
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
867
- return callback(null, errorObj);
868
- }
869
- // get the uuid from the device
870
- const { uuid } = devs.list[0];
871
-
872
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
873
- // !! you can also replace with a specific call if that is easier
874
- const uriPath = `/call/toget/status/${uuid}`;
875
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
876
- // if we received an error or their is no response on the results return an error
877
- if (error) {
878
- return callback(null, error);
879
- }
880
- // !! should update this to make sure we are checking for the appropriate object/field
881
- if (!result.response || !result.response.returnObj || !Object.hasOwnProperty.call(result.response.returnObj, 'statusField')) {
882
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['isAlive'], null, null, null);
883
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
884
- return callback(null, errorObj);
885
- }
886
-
887
- // !! return the response - Update to the appropriate object/field
888
- return callback(!result.response.returnObj.statusField);
889
- });
890
- });
891
- } catch (ex) {
892
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
893
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
894
- return callback(null, errorObj);
467
+ return super.isAlive(deviceName, callback);
468
+ } catch (err) {
469
+ log.error(`${origin}: ${err}`);
470
+ return callback(null, err);
895
471
  }
896
472
  }
897
473
 
@@ -910,92 +486,168 @@ class Zscaler extends AdapterBaseCl {
910
486
  const origin = `${this.id}-${meth}`;
911
487
  log.trace(origin);
912
488
 
913
- // verify the required fields have been provided
914
- if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
915
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
916
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
917
- return callback(null, errorObj);
918
- }
919
-
920
489
  try {
921
- // need to get the device so we can convert the deviceName to an id
922
- // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
923
- const opts = {
924
- filter: {
925
- name: deviceName
926
- }
927
- };
928
- return this.getDevicesFiltered(opts, (devs, ferr) => {
929
- // if we received an error or their is no response on the results return an error
930
- if (ferr) {
931
- return callback(null, ferr);
932
- }
933
- if (devs.list.length < 1) {
934
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
935
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
936
- return callback(null, errorObj);
937
- }
938
- // get the uuid from the device
939
- const { uuid } = devs.list[0];
940
-
941
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
942
- // !! you can also replace with a specific call if that is easier
943
- const uriPath = `/call/toget/config/${uuid}`;
944
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
945
- // if we received an error or their is no response on the results return an error
946
- if (error) {
947
- return callback(null, error);
948
- }
949
-
950
- // return the result
951
- const newResponse = {
952
- response: JSON.stringify(result.response, null, 2)
953
- };
954
- return callback(newResponse);
955
- });
956
- });
957
- } catch (ex) {
958
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
959
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
960
- return callback(null, errorObj);
490
+ return super.getConfig(deviceName, format, callback);
491
+ } catch (err) {
492
+ log.error(`${origin}: ${err}`);
493
+ return callback(null, err);
961
494
  }
962
495
  }
963
496
 
964
497
  /**
965
498
  * @summary Gets the device count from the system
966
499
  *
967
- * @function getCount
500
+ * @function iapGetDeviceCount
968
501
  *
969
502
  * @param {getCallback} callback - callback function to return the result
970
503
  * (count) or the error
971
504
  */
972
- getCount(callback) {
973
- const meth = 'adapter-getCount';
505
+ iapGetDeviceCount(callback) {
506
+ const meth = 'adapter-iapGetDeviceCount';
507
+ const origin = `${this.id}-${meth}`;
508
+ log.trace(origin);
509
+
510
+ try {
511
+ return super.iapGetDeviceCount(callback);
512
+ } catch (err) {
513
+ log.error(`${origin}: ${err}`);
514
+ return callback(null, err);
515
+ }
516
+ }
517
+
518
+ /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
519
+ /**
520
+ * Makes the requested generic call
521
+ *
522
+ * @function iapExpandedGenericAdapterRequest
523
+ * @param {Object} metadata - metadata for the call (optional).
524
+ * Can be a stringified Object.
525
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
526
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
527
+ * @param {Object} pathVars - the parameters to be put within the url path (optional).
528
+ * Can be a stringified Object.
529
+ * @param {Object} queryData - the parameters to be put on the url (optional).
530
+ * Can be a stringified Object.
531
+ * @param {Object} requestBody - the body to add to the request (optional).
532
+ * Can be a stringified Object.
533
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
534
+ * Can be a stringified Object.
535
+ * @param {getCallback} callback - a callback function to return the result (Generics)
536
+ * or the error
537
+ */
538
+ iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
539
+ const meth = 'adapter-iapExpandedGenericAdapterRequest';
974
540
  const origin = `${this.id}-${meth}`;
975
541
  log.trace(origin);
976
542
 
977
- // verify the required fields have been provided
543
+ try {
544
+ return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
545
+ } catch (err) {
546
+ log.error(`${origin}: ${err}`);
547
+ return callback(null, err);
548
+ }
549
+ }
550
+
551
+ /**
552
+ * Makes the requested generic call
553
+ *
554
+ * @function genericAdapterRequest
555
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
556
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
557
+ * @param {Object} queryData - the parameters to be put on the url (optional).
558
+ * Can be a stringified Object.
559
+ * @param {Object} requestBody - the body to add to the request (optional).
560
+ * Can be a stringified Object.
561
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
562
+ * Can be a stringified Object.
563
+ * @param {getCallback} callback - a callback function to return the result (Generics)
564
+ * or the error
565
+ */
566
+ genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
567
+ const meth = 'adapter-genericAdapterRequest';
568
+ const origin = `${this.id}-${meth}`;
569
+ log.trace(origin);
978
570
 
979
571
  try {
980
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
981
- // !! you can also replace with a specific call if that is easier
982
- const uriPath = '/call/toget/count';
983
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
984
- // if we received an error or their is no response on the results return an error
985
- if (error) {
986
- return callback(null, error);
987
- }
572
+ return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
573
+ } catch (err) {
574
+ log.error(`${origin}: ${err}`);
575
+ return callback(null, err);
576
+ }
577
+ }
988
578
 
989
- // return the result
990
- return callback({ count: result.response });
991
- });
992
- } catch (ex) {
993
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
994
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
995
- return callback(null, errorObj);
579
+ /**
580
+ * Makes the requested generic call with no base path or version
581
+ *
582
+ * @function genericAdapterRequestNoBasePath
583
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
584
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
585
+ * @param {Object} queryData - the parameters to be put on the url (optional).
586
+ * Can be a stringified Object.
587
+ * @param {Object} requestBody - the body to add to the request (optional).
588
+ * Can be a stringified Object.
589
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
590
+ * Can be a stringified Object.
591
+ * @param {getCallback} callback - a callback function to return the result (Generics)
592
+ * or the error
593
+ */
594
+ genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
595
+ const meth = 'adapter-genericAdapterRequestNoBasePath';
596
+ const origin = `${this.id}-${meth}`;
597
+ log.trace(origin);
598
+
599
+ try {
600
+ return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
601
+ } catch (err) {
602
+ log.error(`${origin}: ${err}`);
603
+ return callback(null, err);
996
604
  }
997
605
  }
998
606
 
607
+ /* INVENTORY CALLS */
608
+ /**
609
+ * @summary run the adapter lint script to return the results.
610
+ *
611
+ * @function iapRunAdapterLint
612
+ * @param {Callback} callback - callback function
613
+ */
614
+ iapRunAdapterLint(callback) {
615
+ const meth = 'adapter-iapRunAdapterLint';
616
+ const origin = `${this.id}-${meth}`;
617
+ log.trace(origin);
618
+
619
+ return super.iapRunAdapterLint(callback);
620
+ }
621
+
622
+ /**
623
+ * @summary run the adapter test scripts (baseunit and unit) to return the results.
624
+ * can not run integration as there can be implications with that.
625
+ *
626
+ * @function iapRunAdapterTests
627
+ * @param {Callback} callback - callback function
628
+ */
629
+ iapRunAdapterTests(callback) {
630
+ const meth = 'adapter-iapRunAdapterTests';
631
+ const origin = `${this.id}-${meth}`;
632
+ log.trace(origin);
633
+
634
+ return super.iapRunAdapterTests(callback);
635
+ }
636
+
637
+ /**
638
+ * @summary provide inventory information abbout the adapter
639
+ *
640
+ * @function iapGetAdapterInventory
641
+ * @param {Callback} callback - callback function
642
+ */
643
+ iapGetAdapterInventory(callback) {
644
+ const meth = 'adapter-iapGetAdapterInventory';
645
+ const origin = `${this.id}-${meth}`;
646
+ log.trace(origin);
647
+
648
+ return super.iapGetAdapterInventory(callback);
649
+ }
650
+
999
651
  /**
1000
652
  * @callback healthCallback
1001
653
  * @param {Object} result - the result of the get request (contains an id and a status)