@itentialopensource/adapter-aruba_airwave 0.2.1 → 0.3.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 (60) hide show
  1. package/.eslintignore +0 -1
  2. package/.jshintrc +3 -0
  3. package/AUTH.md +39 -0
  4. package/BROKER.md +199 -0
  5. package/CALLS.md +349 -0
  6. package/CHANGELOG.md +8 -0
  7. package/CODE_OF_CONDUCT.md +12 -17
  8. package/CONTRIBUTING.md +3 -148
  9. package/ENHANCE.md +69 -0
  10. package/LICENSE +0 -0
  11. package/PROPERTIES.md +641 -0
  12. package/README.md +240 -438
  13. package/SUMMARY.md +9 -0
  14. package/SYSTEMINFO.md +11 -0
  15. package/TROUBLESHOOT.md +47 -0
  16. package/adapter.js +482 -226
  17. package/adapterBase.js +883 -337
  18. package/changelogs/changelog.md +24 -0
  19. package/entities/.generic/action.json +214 -0
  20. package/entities/.generic/schema.json +28 -0
  21. package/error.json +6 -0
  22. package/metadata.json +47 -0
  23. package/package.json +23 -25
  24. package/pronghorn.json +774 -34
  25. package/propertiesDecorators.json +14 -0
  26. package/propertiesSchema.json +866 -6
  27. package/refs?service=git-upload-pack +0 -0
  28. package/report/adapter-openapi.json +1583 -0
  29. package/report/adapter-openapi.yaml +1300 -0
  30. package/report/adapterInfo.json +10 -0
  31. package/report/updateReport1691507584816.json +120 -0
  32. package/report/updateReport1692202582785.json +120 -0
  33. package/report/updateReport1694461838457.json +120 -0
  34. package/report/updateReport1698420960460.json +120 -0
  35. package/sampleProperties.json +163 -4
  36. package/test/integration/adapterTestBasicGet.js +3 -5
  37. package/test/integration/adapterTestConnectivity.js +91 -42
  38. package/test/integration/adapterTestIntegration.js +157 -98
  39. package/test/unit/adapterBaseTestUnit.js +400 -305
  40. package/test/unit/adapterTestUnit.js +917 -158
  41. package/utils/adapterInfo.js +206 -0
  42. package/utils/addAuth.js +94 -0
  43. package/utils/artifactize.js +1 -1
  44. package/utils/basicGet.js +1 -14
  45. package/utils/checkMigrate.js +63 -0
  46. package/utils/entitiesToDB.js +179 -0
  47. package/utils/findPath.js +74 -0
  48. package/utils/methodDocumentor.js +273 -0
  49. package/utils/modify.js +152 -0
  50. package/utils/packModificationScript.js +1 -1
  51. package/utils/patches2bundledDeps.js +90 -0
  52. package/utils/pre-commit.sh +5 -0
  53. package/utils/removeHooks.js +20 -0
  54. package/utils/setup.js +0 -0
  55. package/utils/taskMover.js +309 -0
  56. package/utils/tbScript.js +129 -53
  57. package/utils/tbUtils.js +152 -35
  58. package/utils/testRunner.js +17 -17
  59. package/utils/troubleshootingAdapter.js +17 -43
  60. package/workflows/README.md +0 -3
package/adapter.js CHANGED
@@ -80,10 +80,15 @@ class ArubaAirwave extends AdapterBaseCl {
80
80
  }
81
81
 
82
82
  /**
83
- * @getWorkflowFunctions
83
+ * @iapGetAdapterWorkflowFunctions
84
84
  */
85
- getWorkflowFunctions(inIgnore) {
86
- let myIgnore = [];
85
+ iapGetAdapterWorkflowFunctions(inIgnore) {
86
+ let myIgnore = [
87
+ 'healthCheck',
88
+ 'iapGetAdapterWorkflowFunctions',
89
+ 'hasEntities',
90
+ 'getAuthorization'
91
+ ];
87
92
  if (!inIgnore && Array.isArray(inIgnore)) {
88
93
  myIgnore = inIgnore;
89
94
  } else if (!inIgnore && typeof inIgnore === 'string') {
@@ -94,231 +99,44 @@ class ArubaAirwave extends AdapterBaseCl {
94
99
  // you can add specific methods that you do not want to be workflow functions to ignore like below
95
100
  // myIgnore.push('myMethodNotInWorkflow');
96
101
 
97
- return super.getWorkflowFunctions(myIgnore);
102
+ return super.iapGetAdapterWorkflowFunctions(myIgnore);
98
103
  }
99
104
 
100
105
  /**
101
- * @callback healthCallback
102
- * @param {Object} result - the result of the get request (contains an id and a status)
103
- */
104
- /**
105
- * @callback getCallback
106
- * @param {Object} result - the result of the get request (entity/ies)
107
- * @param {String} error - any error that occurred
108
- */
109
- /**
110
- * @callback createCallback
111
- * @param {Object} item - the newly created entity
112
- * @param {String} error - any error that occurred
113
- */
114
- /**
115
- * @callback updateCallback
116
- * @param {String} status - the status of the update action
117
- * @param {String} error - any error that occurred
118
- */
119
- /**
120
- * @callback deleteCallback
121
- * @param {String} status - the status of the delete action
122
- * @param {String} error - any error that occurred
123
- */
124
-
125
- /**
126
- * @summary Determines if this adapter supports the specific entity
127
- *
128
- * @function hasEntity
129
- * @param {String} entityType - the entity type to check for
130
- * @param {String/Array} entityId - the specific entity we are looking for
131
- *
132
- * @param {Callback} callback - An array of whether the adapter can has the
133
- * desired capability or an error
134
- */
135
- hasEntity(entityType, entityId, callback) {
136
- const origin = `${this.id}-adapter-hasEntity`;
137
- log.trace(origin);
138
-
139
- // Make the call -
140
- // verifyCapability(entityType, actionType, entityId, callback)
141
- return this.verifyCapability(entityType, null, entityId, callback);
142
- }
143
-
144
- /**
145
- * @summary Provides a way for the adapter to tell north bound integrations
146
- * whether the adapter supports type, action and specific entity
147
- *
148
- * @function verifyCapability
149
- * @param {String} entityType - the entity type to check for
150
- * @param {String} actionType - the action type to check for
151
- * @param {String/Array} entityId - the specific entity we are looking for
152
- *
153
- * @param {Callback} callback - An array of whether the adapter can has the
154
- * desired capability or an error
155
- */
156
- verifyCapability(entityType, actionType, entityId, callback) {
157
- const meth = 'adapterBase-verifyCapability';
158
- const origin = `${this.id}-${meth}`;
159
- log.trace(origin);
160
-
161
- // if caching
162
- if (this.caching) {
163
- // Make the call - verifyCapability(entityType, actionType, entityId, callback)
164
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (results, error) => {
165
- if (error) {
166
- return callback(null, error);
167
- }
168
-
169
- // if the cache needs to be updated, update and try again
170
- if (results && results[0] === 'needupdate') {
171
- switch (entityType) {
172
- case 'template_entity': {
173
- // if the cache is invalid, update the cache
174
- return this.getEntities(null, null, null, null, (data, err) => {
175
- if (err) {
176
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
177
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
178
- return callback(null, errorObj);
179
- }
180
-
181
- // need to check the cache again since it has been updated
182
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
183
- if (verror) {
184
- return callback(null, verror);
185
- }
186
-
187
- return this.capabilityResults(vcapable, callback);
188
- });
189
- });
190
- }
191
- default: {
192
- // unsupported entity type
193
- const result = [false];
194
-
195
- // put false in array for all entities
196
- if (Array.isArray(entityId)) {
197
- for (let e = 1; e < entityId.length; e += 1) {
198
- result.push(false);
199
- }
200
- }
201
-
202
- return callback(result);
203
- }
204
- }
205
- }
206
-
207
- // return the results
208
- return this.capabilityResults(results, callback);
209
- });
210
- }
211
-
212
- // if no entity id
213
- if (!entityId) {
214
- // need to check the cache again since it has been updated
215
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
216
- if (verror) {
217
- return callback(null, verror);
218
- }
219
-
220
- return this.capabilityResults(vcapable, callback);
221
- });
222
- }
223
-
224
- // if not caching
225
- switch (entityType) {
226
- case 'template_entity': {
227
- // need to get the entities to check
228
- return this.getEntities(null, null, null, null, (data, err) => {
229
- if (err) {
230
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
231
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
232
- return callback(null, errorObj);
233
- }
234
-
235
- // need to check the cache again since it has been updated
236
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
237
- if (verror) {
238
- return callback(null, verror);
239
- }
240
-
241
- // is the entity in the list?
242
- const isEntity = this.entityInList(entityId, data.response, callback);
243
- const res = [];
244
-
245
- // not found
246
- for (let i = 0; i < isEntity.length; i += 1) {
247
- if (vcapable) {
248
- res.push(isEntity[i]);
249
- } else {
250
- res.push(false);
251
- }
252
- }
253
-
254
- return callback(res);
255
- });
256
- });
257
- }
258
- default: {
259
- // unsupported entity type
260
- const result = [false];
261
-
262
- // put false in array for all entities
263
- if (Array.isArray(entityId)) {
264
- for (let e = 1; e < entityId.length; e += 1) {
265
- result.push(false);
266
- }
267
- }
268
-
269
- return callback(result);
270
- }
271
- }
272
- }
273
-
274
- /**
275
- * @summary Updates the cache for all entities by call the get All entity method
276
- *
277
- * @function updateEntityCache
278
- *
279
- */
280
- updateEntityCache() {
281
- const origin = `${this.id}-adapter-updateEntityCache`;
282
- log.trace(origin);
283
-
284
- if (this.caching) {
285
- // if the cache is invalid, update the cache
286
- this.getEntities(null, null, null, null, (data, err) => {
287
- if (err) {
288
- log.trace(`${origin}: Could not load template_entity into cache - ${err}`);
289
- }
290
- });
291
- }
292
- }
293
-
294
- /**
295
- * updateAdapterConfiguration is used to update any of the adapter configuration files. This
106
+ * iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
296
107
  * allows customers to make changes to adapter configuration without having to be on the
297
108
  * file system.
298
109
  *
299
- * @function updateAdapterConfiguration
110
+ * @function iapUpdateAdapterConfiguration
300
111
  * @param {string} configFile - the name of the file being updated (required)
301
112
  * @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
302
113
  * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
303
114
  * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
304
115
  * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
116
+ * @param {boolean} replace - true to replace entire mock data, false to merge/append
305
117
  * @param {Callback} callback - The results of the call
306
118
  */
307
- updateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
308
- super.updateAdapterConfiguration(configFile, changes, entity, type, action, callback);
119
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
120
+ const meth = 'adapter-iapUpdateAdapterConfiguration';
121
+ const origin = `${this.id}-${meth}`;
122
+ log.trace(origin);
123
+
124
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
309
125
  }
310
126
 
311
127
  /**
312
128
  * @summary Suspends adapter
313
129
  *
314
- * @function suspend
130
+ * @function iapSuspendAdapter
315
131
  * @param {Callback} callback - callback function
316
132
  */
317
- suspend(mode, callback) {
318
- const origin = `${this.id}-adapter-suspend`;
133
+ iapSuspendAdapter(mode, callback) {
134
+ const meth = 'adapter-iapSuspendAdapter';
135
+ const origin = `${this.id}-${meth}`;
319
136
  log.trace(origin);
137
+
320
138
  try {
321
- return super.suspend(mode, callback);
139
+ return super.iapSuspendAdapter(mode, callback);
322
140
  } catch (error) {
323
141
  log.error(`${origin}: ${error}`);
324
142
  return callback(null, error);
@@ -328,34 +146,68 @@ class ArubaAirwave extends AdapterBaseCl {
328
146
  /**
329
147
  * @summary Unsuspends adapter
330
148
  *
331
- * @function unsuspend
149
+ * @function iapUnsuspendAdapter
332
150
  * @param {Callback} callback - callback function
333
151
  */
334
- unsuspend(callback) {
335
- const origin = `${this.id}-adapter-unsuspend`;
152
+ iapUnsuspendAdapter(callback) {
153
+ const meth = 'adapter-iapUnsuspendAdapter';
154
+ const origin = `${this.id}-${meth}`;
336
155
  log.trace(origin);
156
+
337
157
  try {
338
- return super.unsuspend(callback);
158
+ return super.iapUnsuspendAdapter(callback);
339
159
  } catch (error) {
340
160
  log.error(`${origin}: ${error}`);
341
161
  return callback(null, error);
342
162
  }
343
163
  }
344
164
 
165
+ /**
166
+ * @summary Get the Adapter Queue
167
+ *
168
+ * @function iapGetAdapterQueue
169
+ * @param {Callback} callback - callback function
170
+ */
171
+ iapGetAdapterQueue(callback) {
172
+ const meth = 'adapter-iapGetAdapterQueue';
173
+ const origin = `${this.id}-${meth}`;
174
+ log.trace(origin);
175
+
176
+ return super.iapGetAdapterQueue(callback);
177
+ }
178
+
179
+ /* SCRIPT CALLS */
180
+ /**
181
+ * See if the API path provided is found in this adapter
182
+ *
183
+ * @function iapFindAdapterPath
184
+ * @param {string} apiPath - the api path to check on
185
+ * @param {Callback} callback - The results of the call
186
+ */
187
+ iapFindAdapterPath(apiPath, callback) {
188
+ const meth = 'adapter-iapFindAdapterPath';
189
+ const origin = `${this.id}-${meth}`;
190
+ log.trace(origin);
191
+
192
+ super.iapFindAdapterPath(apiPath, callback);
193
+ }
194
+
345
195
  /**
346
196
  * @summary Runs troubleshoot scripts for adapter
347
197
  *
348
- * @function troubleshoot
198
+ * @function iapTroubleshootAdapter
349
199
  * @param {Object} props - the connection, healthcheck and authentication properties
350
200
  *
351
201
  * @param {boolean} persistFlag - whether the adapter properties should be updated
352
202
  * @param {Callback} callback - The results of the call
353
203
  */
354
- troubleshoot(props, persistFlag, callback) {
355
- const origin = `${this.id}-adapter-troubleshoot`;
204
+ iapTroubleshootAdapter(props, persistFlag, callback) {
205
+ const meth = 'adapter-iapTroubleshootAdapter';
206
+ const origin = `${this.id}-${meth}`;
356
207
  log.trace(origin);
208
+
357
209
  try {
358
- return super.troubleshoot(props, persistFlag, this, callback);
210
+ return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
359
211
  } catch (error) {
360
212
  log.error(`${origin}: ${error}`);
361
213
  return callback(null, error);
@@ -365,15 +217,17 @@ class ArubaAirwave extends AdapterBaseCl {
365
217
  /**
366
218
  * @summary runs healthcheck script for adapter
367
219
  *
368
- * @function runHealthcheck
220
+ * @function iapRunAdapterHealthcheck
369
221
  * @param {Adapter} adapter - adapter instance to troubleshoot
370
222
  * @param {Callback} callback - callback function
371
223
  */
372
- runHealthcheck(callback) {
373
- const origin = `${this.id}-adapter-runHealthcheck`;
224
+ iapRunAdapterHealthcheck(callback) {
225
+ const meth = 'adapter-iapRunAdapterHealthcheck';
226
+ const origin = `${this.id}-${meth}`;
374
227
  log.trace(origin);
228
+
375
229
  try {
376
- return super.runHealthcheck(this, callback);
230
+ return super.iapRunAdapterHealthcheck(this, callback);
377
231
  } catch (error) {
378
232
  log.error(`${origin}: ${error}`);
379
233
  return callback(null, error);
@@ -383,14 +237,16 @@ class ArubaAirwave extends AdapterBaseCl {
383
237
  /**
384
238
  * @summary runs connectivity check script for adapter
385
239
  *
386
- * @function runConnectivity
240
+ * @function iapRunAdapterConnectivity
387
241
  * @param {Callback} callback - callback function
388
242
  */
389
- runConnectivity(callback) {
390
- const origin = `${this.id}-adapter-runConnectivity`;
243
+ iapRunAdapterConnectivity(callback) {
244
+ const meth = 'adapter-iapRunAdapterConnectivity';
245
+ const origin = `${this.id}-${meth}`;
391
246
  log.trace(origin);
247
+
392
248
  try {
393
- return super.runConnectivity(callback);
249
+ return super.iapRunAdapterConnectivity(callback);
394
250
  } catch (error) {
395
251
  log.error(`${origin}: ${error}`);
396
252
  return callback(null, error);
@@ -400,20 +256,420 @@ class ArubaAirwave extends AdapterBaseCl {
400
256
  /**
401
257
  * @summary runs basicGet script for adapter
402
258
  *
403
- * @function runBasicGet
259
+ * @function iapRunAdapterBasicGet
404
260
  * @param {Callback} callback - callback function
405
261
  */
406
- runBasicGet(callback) {
407
- const origin = `${this.id}-adapter-runBasicGet`;
262
+ iapRunAdapterBasicGet(callback) {
263
+ const meth = 'adapter-iapRunAdapterBasicGet';
264
+ const origin = `${this.id}-${meth}`;
408
265
  log.trace(origin);
266
+
409
267
  try {
410
- return super.runBasicGet(callback);
268
+ return super.iapRunAdapterBasicGet(callback);
411
269
  } catch (error) {
412
270
  log.error(`${origin}: ${error}`);
413
271
  return callback(null, error);
414
272
  }
415
273
  }
416
274
 
275
+ /**
276
+ * @summary moves entites into Mongo DB
277
+ *
278
+ * @function iapMoveAdapterEntitiesToDB
279
+ * @param {getCallback} callback - a callback function to return the result (Generics)
280
+ * or the error
281
+ */
282
+ iapMoveAdapterEntitiesToDB(callback) {
283
+ const meth = 'adapter-iapMoveAdapterEntitiesToDB';
284
+ const origin = `${this.id}-${meth}`;
285
+ log.trace(origin);
286
+
287
+ try {
288
+ return super.iapMoveAdapterEntitiesToDB(callback);
289
+ } catch (err) {
290
+ log.error(`${origin}: ${err}`);
291
+ return callback(null, err);
292
+ }
293
+ }
294
+
295
+ /**
296
+ * @summary Deactivate adapter tasks
297
+ *
298
+ * @function iapDeactivateTasks
299
+ *
300
+ * @param {Array} tasks - List of tasks to deactivate
301
+ * @param {Callback} callback
302
+ */
303
+ iapDeactivateTasks(tasks, callback) {
304
+ const meth = 'adapter-iapDeactivateTasks';
305
+ const origin = `${this.id}-${meth}`;
306
+ log.trace(origin);
307
+
308
+ try {
309
+ return super.iapDeactivateTasks(tasks, callback);
310
+ } catch (err) {
311
+ log.error(`${origin}: ${err}`);
312
+ return callback(null, err);
313
+ }
314
+ }
315
+
316
+ /**
317
+ * @summary Activate adapter tasks that have previously been deactivated
318
+ *
319
+ * @function iapActivateTasks
320
+ *
321
+ * @param {Array} tasks - List of tasks to activate
322
+ * @param {Callback} callback
323
+ */
324
+ iapActivateTasks(tasks, callback) {
325
+ const meth = 'adapter-iapActivateTasks';
326
+ const origin = `${this.id}-${meth}`;
327
+ log.trace(origin);
328
+
329
+ try {
330
+ return super.iapActivateTasks(tasks, callback);
331
+ } catch (err) {
332
+ log.error(`${origin}: ${err}`);
333
+ return callback(null, err);
334
+ }
335
+ }
336
+
337
+ /* CACHE CALLS */
338
+ /**
339
+ * @summary Populate the cache for the given entities
340
+ *
341
+ * @function iapPopulateEntityCache
342
+ * @param {String/Array of Strings} entityType - the entity type(s) to populate
343
+ * @param {Callback} callback - whether the cache was updated or not for each entity type
344
+ *
345
+ * @returns status of the populate
346
+ */
347
+ iapPopulateEntityCache(entityTypes, callback) {
348
+ const meth = 'adapter-iapPopulateEntityCache';
349
+ const origin = `${this.id}-${meth}`;
350
+ log.trace(origin);
351
+
352
+ try {
353
+ return super.iapPopulateEntityCache(entityTypes, callback);
354
+ } catch (err) {
355
+ log.error(`${origin}: ${err}`);
356
+ return callback(null, err);
357
+ }
358
+ }
359
+
360
+ /**
361
+ * @summary Retrieves data from cache for specified entity type
362
+ *
363
+ * @function iapRetrieveEntitiesCache
364
+ * @param {String} entityType - entity of which to retrieve
365
+ * @param {Object} options - settings of which data to return and how to return it
366
+ * @param {Callback} callback - the data if it was retrieved
367
+ */
368
+ iapRetrieveEntitiesCache(entityType, options, callback) {
369
+ const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
370
+ const origin = `${this.id}-${meth}`;
371
+ log.trace(origin);
372
+
373
+ try {
374
+ return super.iapRetrieveEntitiesCache(entityType, options, callback);
375
+ } catch (err) {
376
+ log.error(`${origin}: ${err}`);
377
+ return callback(null, err);
378
+ }
379
+ }
380
+
381
+ /* BROKER CALLS */
382
+ /**
383
+ * @summary Determines if this adapter supports any in a list of entities
384
+ *
385
+ * @function hasEntities
386
+ * @param {String} entityType - the entity type to check for
387
+ * @param {Array} entityList - the list of entities we are looking for
388
+ *
389
+ * @param {Callback} callback - A map where the entity is the key and the
390
+ * value is true or false
391
+ */
392
+ hasEntities(entityType, entityList, callback) {
393
+ const meth = 'adapter-hasEntities';
394
+ const origin = `${this.id}-${meth}`;
395
+ log.trace(origin);
396
+
397
+ try {
398
+ return super.hasEntities(entityType, entityList, callback);
399
+ } catch (err) {
400
+ log.error(`${origin}: ${err}`);
401
+ return callback(null, err);
402
+ }
403
+ }
404
+
405
+ /**
406
+ * @summary Get Appliance that match the deviceName
407
+ *
408
+ * @function getDevice
409
+ * @param {String} deviceName - the deviceName to find (required)
410
+ *
411
+ * @param {getCallback} callback - a callback function to return the result
412
+ * (appliance) or the error
413
+ */
414
+ getDevice(deviceName, callback) {
415
+ const meth = 'adapter-getDevice';
416
+ const origin = `${this.id}-${meth}`;
417
+ log.trace(origin);
418
+
419
+ try {
420
+ return super.getDevice(deviceName, callback);
421
+ } catch (err) {
422
+ log.error(`${origin}: ${err}`);
423
+ return callback(null, err);
424
+ }
425
+ }
426
+
427
+ /**
428
+ * @summary Get Appliances that match the filter
429
+ *
430
+ * @function getDevicesFiltered
431
+ * @param {Object} options - the data to use to filter the appliances (optional)
432
+ *
433
+ * @param {getCallback} callback - a callback function to return the result
434
+ * (appliances) or the error
435
+ */
436
+ getDevicesFiltered(options, callback) {
437
+ const meth = 'adapter-getDevicesFiltered';
438
+ const origin = `${this.id}-${meth}`;
439
+ log.trace(origin);
440
+
441
+ try {
442
+ return super.getDevicesFiltered(options, callback);
443
+ } catch (err) {
444
+ log.error(`${origin}: ${err}`);
445
+ return callback(null, err);
446
+ }
447
+ }
448
+
449
+ /**
450
+ * @summary Gets the status for the provided appliance
451
+ *
452
+ * @function isAlive
453
+ * @param {String} deviceName - the deviceName of the appliance. (required)
454
+ *
455
+ * @param {configCallback} callback - callback function to return the result
456
+ * (appliance isAlive) or the error
457
+ */
458
+ isAlive(deviceName, callback) {
459
+ const meth = 'adapter-isAlive';
460
+ const origin = `${this.id}-${meth}`;
461
+ log.trace(origin);
462
+
463
+ try {
464
+ return super.isAlive(deviceName, callback);
465
+ } catch (err) {
466
+ log.error(`${origin}: ${err}`);
467
+ return callback(null, err);
468
+ }
469
+ }
470
+
471
+ /**
472
+ * @summary Gets a config for the provided Appliance
473
+ *
474
+ * @function getConfig
475
+ * @param {String} deviceName - the deviceName of the appliance. (required)
476
+ * @param {String} format - the desired format of the config. (optional)
477
+ *
478
+ * @param {configCallback} callback - callback function to return the result
479
+ * (appliance config) or the error
480
+ */
481
+ getConfig(deviceName, format, callback) {
482
+ const meth = 'adapter-getConfig';
483
+ const origin = `${this.id}-${meth}`;
484
+ log.trace(origin);
485
+
486
+ try {
487
+ return super.getConfig(deviceName, format, callback);
488
+ } catch (err) {
489
+ log.error(`${origin}: ${err}`);
490
+ return callback(null, err);
491
+ }
492
+ }
493
+
494
+ /**
495
+ * @summary Gets the device count from the system
496
+ *
497
+ * @function iapGetDeviceCount
498
+ *
499
+ * @param {getCallback} callback - callback function to return the result
500
+ * (count) or the error
501
+ */
502
+ iapGetDeviceCount(callback) {
503
+ const meth = 'adapter-iapGetDeviceCount';
504
+ const origin = `${this.id}-${meth}`;
505
+ log.trace(origin);
506
+
507
+ try {
508
+ return super.iapGetDeviceCount(callback);
509
+ } catch (err) {
510
+ log.error(`${origin}: ${err}`);
511
+ return callback(null, err);
512
+ }
513
+ }
514
+
515
+ /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
516
+ /**
517
+ * Makes the requested generic call
518
+ *
519
+ * @function iapExpandedGenericAdapterRequest
520
+ * @param {Object} metadata - metadata for the call (optional).
521
+ * Can be a stringified Object.
522
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
523
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
524
+ * @param {Object} pathVars - the parameters to be put within the url path (optional).
525
+ * Can be a stringified Object.
526
+ * @param {Object} queryData - the parameters to be put on the url (optional).
527
+ * Can be a stringified Object.
528
+ * @param {Object} requestBody - the body to add to the request (optional).
529
+ * Can be a stringified Object.
530
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
531
+ * Can be a stringified Object.
532
+ * @param {getCallback} callback - a callback function to return the result (Generics)
533
+ * or the error
534
+ */
535
+ iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
536
+ const meth = 'adapter-iapExpandedGenericAdapterRequest';
537
+ const origin = `${this.id}-${meth}`;
538
+ log.trace(origin);
539
+
540
+ try {
541
+ return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
542
+ } catch (err) {
543
+ log.error(`${origin}: ${err}`);
544
+ return callback(null, err);
545
+ }
546
+ }
547
+
548
+ /**
549
+ * Makes the requested generic call
550
+ *
551
+ * @function genericAdapterRequest
552
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
553
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
554
+ * @param {Object} queryData - the parameters to be put on the url (optional).
555
+ * Can be a stringified Object.
556
+ * @param {Object} requestBody - the body to add to the request (optional).
557
+ * Can be a stringified Object.
558
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
559
+ * Can be a stringified Object.
560
+ * @param {getCallback} callback - a callback function to return the result (Generics)
561
+ * or the error
562
+ */
563
+ genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
564
+ const meth = 'adapter-genericAdapterRequest';
565
+ const origin = `${this.id}-${meth}`;
566
+ log.trace(origin);
567
+
568
+ try {
569
+ return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
570
+ } catch (err) {
571
+ log.error(`${origin}: ${err}`);
572
+ return callback(null, err);
573
+ }
574
+ }
575
+
576
+ /**
577
+ * Makes the requested generic call with no base path or version
578
+ *
579
+ * @function genericAdapterRequestNoBasePath
580
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
581
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
582
+ * @param {Object} queryData - the parameters to be put on the url (optional).
583
+ * Can be a stringified Object.
584
+ * @param {Object} requestBody - the body to add to the request (optional).
585
+ * Can be a stringified Object.
586
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
587
+ * Can be a stringified Object.
588
+ * @param {getCallback} callback - a callback function to return the result (Generics)
589
+ * or the error
590
+ */
591
+ genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
592
+ const meth = 'adapter-genericAdapterRequestNoBasePath';
593
+ const origin = `${this.id}-${meth}`;
594
+ log.trace(origin);
595
+
596
+ try {
597
+ return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
598
+ } catch (err) {
599
+ log.error(`${origin}: ${err}`);
600
+ return callback(null, err);
601
+ }
602
+ }
603
+
604
+ /* INVENTORY CALLS */
605
+ /**
606
+ * @summary run the adapter lint script to return the results.
607
+ *
608
+ * @function iapRunAdapterLint
609
+ * @param {Callback} callback - callback function
610
+ */
611
+ iapRunAdapterLint(callback) {
612
+ const meth = 'adapter-iapRunAdapterLint';
613
+ const origin = `${this.id}-${meth}`;
614
+ log.trace(origin);
615
+
616
+ return super.iapRunAdapterLint(callback);
617
+ }
618
+
619
+ /**
620
+ * @summary run the adapter test scripts (baseunit and unit) to return the results.
621
+ * can not run integration as there can be implications with that.
622
+ *
623
+ * @function iapRunAdapterTests
624
+ * @param {Callback} callback - callback function
625
+ */
626
+ iapRunAdapterTests(callback) {
627
+ const meth = 'adapter-iapRunAdapterTests';
628
+ const origin = `${this.id}-${meth}`;
629
+ log.trace(origin);
630
+
631
+ return super.iapRunAdapterTests(callback);
632
+ }
633
+
634
+ /**
635
+ * @summary provide inventory information abbout the adapter
636
+ *
637
+ * @function iapGetAdapterInventory
638
+ * @param {Callback} callback - callback function
639
+ */
640
+ iapGetAdapterInventory(callback) {
641
+ const meth = 'adapter-iapGetAdapterInventory';
642
+ const origin = `${this.id}-${meth}`;
643
+ log.trace(origin);
644
+
645
+ return super.iapGetAdapterInventory(callback);
646
+ }
647
+
648
+ /**
649
+ * @callback healthCallback
650
+ * @param {Object} result - the result of the get request (contains an id and a status)
651
+ */
652
+ /**
653
+ * @callback getCallback
654
+ * @param {Object} result - the result of the get request (entity/ies)
655
+ * @param {String} error - any error that occurred
656
+ */
657
+ /**
658
+ * @callback createCallback
659
+ * @param {Object} item - the newly created entity
660
+ * @param {String} error - any error that occurred
661
+ */
662
+ /**
663
+ * @callback updateCallback
664
+ * @param {String} status - the status of the update action
665
+ * @param {String} error - any error that occurred
666
+ */
667
+ /**
668
+ * @callback deleteCallback
669
+ * @param {String} status - the status of the delete action
670
+ * @param {String} error - any error that occurred
671
+ */
672
+
417
673
  /**
418
674
  * @function aMPStats
419
675
  * @pronghornType method