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