@itentialopensource/adapter-drivenets_networkorchestrator 0.1.1

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 (72) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +18 -0
  3. package/.jshintrc +3 -0
  4. package/AUTH.md +39 -0
  5. package/BROKER.md +199 -0
  6. package/CALLS.md +314 -0
  7. package/CHANGELOG.md +9 -0
  8. package/CODE_OF_CONDUCT.md +43 -0
  9. package/CONTRIBUTING.md +172 -0
  10. package/ENHANCE.md +69 -0
  11. package/LICENSE +201 -0
  12. package/PROPERTIES.md +641 -0
  13. package/README.md +337 -0
  14. package/SUMMARY.md +9 -0
  15. package/SYSTEMINFO.md +11 -0
  16. package/TROUBLESHOOT.md +47 -0
  17. package/adapter.js +2778 -0
  18. package/adapterBase.js +1787 -0
  19. package/entities/.generic/action.json +214 -0
  20. package/entities/.generic/schema.json +28 -0
  21. package/entities/.system/action.json +50 -0
  22. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  23. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  24. package/entities/.system/schema.json +19 -0
  25. package/entities/.system/schemaTokenReq.json +53 -0
  26. package/entities/.system/schemaTokenResp.json +53 -0
  27. package/entities/MonitoringFaultManagementActiveAlarms/action.json +25 -0
  28. package/entities/MonitoringFaultManagementActiveAlarms/schema.json +19 -0
  29. package/entities/MonitoringFaultManagementAlarms/action.json +46 -0
  30. package/entities/MonitoringFaultManagementAlarms/schema.json +31 -0
  31. package/entities/NCEGroupManagement/action.json +85 -0
  32. package/entities/NCEGroupManagement/schema.json +33 -0
  33. package/entities/NCEManagement/action.json +144 -0
  34. package/entities/NCEManagement/schema.json +36 -0
  35. package/entities/Redundancy/action.json +64 -0
  36. package/entities/Redundancy/schema.json +21 -0
  37. package/entities/TaskManagement/action.json +146 -0
  38. package/entities/TaskManagement/schema.json +47 -0
  39. package/error.json +190 -0
  40. package/package.json +88 -0
  41. package/pronghorn.json +1598 -0
  42. package/propertiesDecorators.json +14 -0
  43. package/propertiesSchema.json +1248 -0
  44. package/refs?service=git-upload-pack +0 -0
  45. package/report/adapterInfo.json +10 -0
  46. package/report/creationReport.json +405 -0
  47. package/report/openapi_dnor.json +1634 -0
  48. package/sampleProperties.json +195 -0
  49. package/test/integration/adapterTestBasicGet.js +83 -0
  50. package/test/integration/adapterTestConnectivity.js +93 -0
  51. package/test/integration/adapterTestIntegration.js +963 -0
  52. package/test/unit/adapterBaseTestUnit.js +949 -0
  53. package/test/unit/adapterTestUnit.js +1888 -0
  54. package/utils/adapterInfo.js +206 -0
  55. package/utils/addAuth.js +94 -0
  56. package/utils/artifactize.js +146 -0
  57. package/utils/basicGet.js +50 -0
  58. package/utils/checkMigrate.js +63 -0
  59. package/utils/entitiesToDB.js +178 -0
  60. package/utils/findPath.js +74 -0
  61. package/utils/methodDocumentor.js +225 -0
  62. package/utils/modify.js +154 -0
  63. package/utils/packModificationScript.js +35 -0
  64. package/utils/patches2bundledDeps.js +90 -0
  65. package/utils/pre-commit.sh +32 -0
  66. package/utils/removeHooks.js +20 -0
  67. package/utils/setup.js +33 -0
  68. package/utils/tbScript.js +246 -0
  69. package/utils/tbUtils.js +490 -0
  70. package/utils/testRunner.js +298 -0
  71. package/utils/troubleshootingAdapter.js +195 -0
  72. package/workflows/README.md +3 -0
package/adapter.js ADDED
@@ -0,0 +1,2778 @@
1
+ /* @copyright Itential, LLC 2019 (pre-modifications) */
2
+
3
+ /* eslint import/no-dynamic-require: warn */
4
+ /* eslint object-curly-newline: warn */
5
+
6
+ // Set globals
7
+ /* global log */
8
+
9
+ /* Required libraries. */
10
+ const path = require('path');
11
+
12
+ /* Fetch in the other needed components for the this Adaptor */
13
+ const AdapterBaseCl = require(path.join(__dirname, 'adapterBase.js'));
14
+
15
+ /**
16
+ * This is the adapter/interface into DriveNetsNetworkOrchestrator
17
+ */
18
+
19
+ /* GENERAL ADAPTER FUNCTIONS */
20
+ class DriveNetsNetworkOrchestrator extends AdapterBaseCl {
21
+ /**
22
+ * DriveNetsNetworkOrchestrator Adapter
23
+ * @constructor
24
+ */
25
+ /* Working on changing the way we do Emit methods due to size and time constrainsts
26
+ constructor(prongid, properties) {
27
+ // Instantiate the AdapterBase super class
28
+ super(prongid, properties);
29
+
30
+ const restFunctionNames = this.iapGetAdapterWorkflowFunctions();
31
+
32
+ // Dynamically bind emit functions
33
+ for (let i = 0; i < restFunctionNames.length; i += 1) {
34
+ // Bind function to have name fnNameEmit for fnName
35
+ const version = restFunctionNames[i].match(/__v[0-9]+/);
36
+ const baseFnName = restFunctionNames[i].replace(/__v[0-9]+/, '');
37
+ const fnNameEmit = version ? `${baseFnName}Emit${version}` : `${baseFnName}Emit`;
38
+ this[fnNameEmit] = function (...args) {
39
+ // extract the callback
40
+ const callback = args[args.length - 1];
41
+ // slice the callback from args so we can insert our own
42
+ const functionArgs = args.slice(0, args.length - 1);
43
+ // create a random name for the listener
44
+ const eventName = `${restFunctionNames[i]}:${Math.random().toString(36)}`;
45
+ // tell the calling class to start listening
46
+ callback({ event: eventName, status: 'received' });
47
+ // store parent for use of this context later
48
+ const parent = this;
49
+ // store emission function
50
+ const func = function (val, err) {
51
+ parent.removeListener(eventName, func);
52
+ parent.emit(eventName, val, err);
53
+ };
54
+ // Use apply to call the function in a specific context
55
+ this[restFunctionNames[i]].apply(this, functionArgs.concat([func])); // eslint-disable-line prefer-spread
56
+ };
57
+ }
58
+
59
+ // Uncomment if you have things to add to the constructor like using your own properties.
60
+ // Otherwise the constructor in the adapterBase will be used.
61
+ // Capture my own properties - they need to be defined in propertiesSchema.json
62
+ // if (this.allProps && this.allProps.myownproperty) {
63
+ // mypropvariable = this.allProps.myownproperty;
64
+ // }
65
+ }
66
+ */
67
+
68
+ /**
69
+ * @callback healthCallback
70
+ * @param {Object} reqObj - the request to send into the healthcheck
71
+ * @param {Callback} callback - The results of the call
72
+ */
73
+ healthCheck(reqObj, callback) {
74
+ // you can modify what is passed into the healthcheck by changing things in the newReq
75
+ let newReq = null;
76
+ if (reqObj) {
77
+ newReq = Object.assign(...reqObj);
78
+ }
79
+ super.healthCheck(newReq, callback);
80
+ }
81
+
82
+ /**
83
+ * @iapGetAdapterWorkflowFunctions
84
+ */
85
+ iapGetAdapterWorkflowFunctions(inIgnore) {
86
+ let myIgnore = [
87
+ 'healthCheck',
88
+ 'iapGetAdapterWorkflowFunctions',
89
+ 'iapHasAdapterEntity',
90
+ 'iapVerifyAdapterCapability',
91
+ 'iapUpdateAdapterEntityCache',
92
+ 'hasEntities'
93
+ ];
94
+ if (!inIgnore && Array.isArray(inIgnore)) {
95
+ myIgnore = inIgnore;
96
+ } else if (!inIgnore && typeof inIgnore === 'string') {
97
+ myIgnore = [inIgnore];
98
+ }
99
+
100
+ // The generic adapter functions should already be ignored (e.g. healthCheck)
101
+ // you can add specific methods that you do not want to be workflow functions to ignore like below
102
+ // myIgnore.push('myMethodNotInWorkflow');
103
+
104
+ return super.iapGetAdapterWorkflowFunctions(myIgnore);
105
+ }
106
+
107
+ /**
108
+ * iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
109
+ * allows customers to make changes to adapter configuration without having to be on the
110
+ * file system.
111
+ *
112
+ * @function iapUpdateAdapterConfiguration
113
+ * @param {string} configFile - the name of the file being updated (required)
114
+ * @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
115
+ * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
116
+ * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
117
+ * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
118
+ * @param {Callback} callback - The results of the call
119
+ */
120
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
121
+ const meth = 'adapter-iapUpdateAdapterConfiguration';
122
+ const origin = `${this.id}-${meth}`;
123
+ log.trace(origin);
124
+
125
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
126
+ }
127
+
128
+ /**
129
+ * See if the API path provided is found in this adapter
130
+ *
131
+ * @function iapFindAdapterPath
132
+ * @param {string} apiPath - the api path to check on
133
+ * @param {Callback} callback - The results of the call
134
+ */
135
+ iapFindAdapterPath(apiPath, callback) {
136
+ const meth = 'adapter-iapFindAdapterPath';
137
+ const origin = `${this.id}-${meth}`;
138
+ log.trace(origin);
139
+
140
+ super.iapFindAdapterPath(apiPath, callback);
141
+ }
142
+
143
+ /**
144
+ * @summary Suspends adapter
145
+ *
146
+ * @function iapSuspendAdapter
147
+ * @param {Callback} callback - callback function
148
+ */
149
+ iapSuspendAdapter(mode, callback) {
150
+ const meth = 'adapter-iapSuspendAdapter';
151
+ const origin = `${this.id}-${meth}`;
152
+ log.trace(origin);
153
+
154
+ try {
155
+ return super.iapSuspendAdapter(mode, callback);
156
+ } catch (error) {
157
+ log.error(`${origin}: ${error}`);
158
+ return callback(null, error);
159
+ }
160
+ }
161
+
162
+ /**
163
+ * @summary Unsuspends adapter
164
+ *
165
+ * @function iapUnsuspendAdapter
166
+ * @param {Callback} callback - callback function
167
+ */
168
+ iapUnsuspendAdapter(callback) {
169
+ const meth = 'adapter-iapUnsuspendAdapter';
170
+ const origin = `${this.id}-${meth}`;
171
+ log.trace(origin);
172
+
173
+ try {
174
+ return super.iapUnsuspendAdapter(callback);
175
+ } catch (error) {
176
+ log.error(`${origin}: ${error}`);
177
+ return callback(null, error);
178
+ }
179
+ }
180
+
181
+ /**
182
+ * @summary Get the Adaoter Queue
183
+ *
184
+ * @function iapGetAdapterQueue
185
+ * @param {Callback} callback - callback function
186
+ */
187
+ iapGetAdapterQueue(callback) {
188
+ const meth = 'adapter-iapGetAdapterQueue';
189
+ const origin = `${this.id}-${meth}`;
190
+ log.trace(origin);
191
+
192
+ return super.iapGetAdapterQueue(callback);
193
+ }
194
+
195
+ /**
196
+ * @summary Runs troubleshoot scripts for adapter
197
+ *
198
+ * @function iapTroubleshootAdapter
199
+ * @param {Object} props - the connection, healthcheck and authentication properties
200
+ *
201
+ * @param {boolean} persistFlag - whether the adapter properties should be updated
202
+ * @param {Callback} callback - The results of the call
203
+ */
204
+ iapTroubleshootAdapter(props, persistFlag, callback) {
205
+ const meth = 'adapter-iapTroubleshootAdapter';
206
+ const origin = `${this.id}-${meth}`;
207
+ log.trace(origin);
208
+
209
+ try {
210
+ return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
211
+ } catch (error) {
212
+ log.error(`${origin}: ${error}`);
213
+ return callback(null, error);
214
+ }
215
+ }
216
+
217
+ /**
218
+ * @summary runs healthcheck script for adapter
219
+ *
220
+ * @function iapRunAdapterHealthcheck
221
+ * @param {Adapter} adapter - adapter instance to troubleshoot
222
+ * @param {Callback} callback - callback function
223
+ */
224
+ iapRunAdapterHealthcheck(callback) {
225
+ const meth = 'adapter-iapRunAdapterHealthcheck';
226
+ const origin = `${this.id}-${meth}`;
227
+ log.trace(origin);
228
+
229
+ try {
230
+ return super.iapRunAdapterHealthcheck(this, callback);
231
+ } catch (error) {
232
+ log.error(`${origin}: ${error}`);
233
+ return callback(null, error);
234
+ }
235
+ }
236
+
237
+ /**
238
+ * @summary runs connectivity check script for adapter
239
+ *
240
+ * @function iapRunAdapterConnectivity
241
+ * @param {Callback} callback - callback function
242
+ */
243
+ iapRunAdapterConnectivity(callback) {
244
+ const meth = 'adapter-iapRunAdapterConnectivity';
245
+ const origin = `${this.id}-${meth}`;
246
+ log.trace(origin);
247
+
248
+ try {
249
+ return super.iapRunAdapterConnectivity(callback);
250
+ } catch (error) {
251
+ log.error(`${origin}: ${error}`);
252
+ return callback(null, error);
253
+ }
254
+ }
255
+
256
+ /**
257
+ * @summary runs basicGet script for adapter
258
+ *
259
+ * @function iapRunAdapterBasicGet
260
+ * @param {Callback} callback - callback function
261
+ */
262
+ iapRunAdapterBasicGet(callback) {
263
+ const meth = 'adapter-iapRunAdapterBasicGet';
264
+ const origin = `${this.id}-${meth}`;
265
+ log.trace(origin);
266
+
267
+ try {
268
+ return super.iapRunAdapterBasicGet(callback);
269
+ } catch (error) {
270
+ log.error(`${origin}: ${error}`);
271
+ return callback(null, error);
272
+ }
273
+ }
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
+ /* BROKER CALLS */
296
+ /**
297
+ * @summary Determines if this adapter supports the specific entity
298
+ *
299
+ * @function iapHasAdapterEntity
300
+ * @param {String} entityType - the entity type to check for
301
+ * @param {String/Array} entityId - the specific entity we are looking for
302
+ *
303
+ * @param {Callback} callback - An array of whether the adapter can has the
304
+ * desired capability or an error
305
+ */
306
+ iapHasAdapterEntity(entityType, entityId, callback) {
307
+ const origin = `${this.id}-adapter-iapHasAdapterEntity`;
308
+ log.trace(origin);
309
+
310
+ // Make the call -
311
+ // iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
312
+ return this.iapVerifyAdapterCapability(entityType, null, entityId, callback);
313
+ }
314
+
315
+ /**
316
+ * @summary Provides a way for the adapter to tell north bound integrations
317
+ * whether the adapter supports type, action and specific entity
318
+ *
319
+ * @function iapVerifyAdapterCapability
320
+ * @param {String} entityType - the entity type to check for
321
+ * @param {String} actionType - the action type to check for
322
+ * @param {String/Array} entityId - the specific entity we are looking for
323
+ *
324
+ * @param {Callback} callback - An array of whether the adapter can has the
325
+ * desired capability or an error
326
+ */
327
+ iapVerifyAdapterCapability(entityType, actionType, entityId, callback) {
328
+ const meth = 'adapterBase-iapVerifyAdapterCapability';
329
+ const origin = `${this.id}-${meth}`;
330
+ log.trace(origin);
331
+
332
+ // if caching
333
+ if (this.caching) {
334
+ // Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
335
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
336
+ if (error) {
337
+ return callback(null, error);
338
+ }
339
+
340
+ // if the cache needs to be updated, update and try again
341
+ if (results && results[0] === 'needupdate') {
342
+ switch (entityType) {
343
+ case 'template_entity': {
344
+ // if the cache is invalid, update the cache
345
+ return this.getEntities(null, null, null, null, (data, err) => {
346
+ if (err) {
347
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
348
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
349
+ return callback(null, errorObj);
350
+ }
351
+
352
+ // need to check the cache again since it has been updated
353
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
354
+ if (verror) {
355
+ return callback(null, verror);
356
+ }
357
+
358
+ return this.capabilityResults(vcapable, callback);
359
+ });
360
+ });
361
+ }
362
+ default: {
363
+ // unsupported entity type
364
+ const result = [false];
365
+
366
+ // put false in array for all entities
367
+ if (Array.isArray(entityId)) {
368
+ for (let e = 1; e < entityId.length; e += 1) {
369
+ result.push(false);
370
+ }
371
+ }
372
+
373
+ return callback(result);
374
+ }
375
+ }
376
+ }
377
+
378
+ // return the results
379
+ return this.capabilityResults(results, callback);
380
+ });
381
+ }
382
+
383
+ // if no entity id
384
+ if (!entityId) {
385
+ // need to check the cache again since it has been updated
386
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
387
+ if (verror) {
388
+ return callback(null, verror);
389
+ }
390
+
391
+ return this.capabilityResults(vcapable, callback);
392
+ });
393
+ }
394
+
395
+ // if not caching
396
+ switch (entityType) {
397
+ case 'template_entity': {
398
+ // need to get the entities to check
399
+ return this.getEntities(null, null, null, null, (data, err) => {
400
+ if (err) {
401
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
402
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
403
+ return callback(null, errorObj);
404
+ }
405
+
406
+ // need to check the cache again since it has been updated
407
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
408
+ if (verror) {
409
+ return callback(null, verror);
410
+ }
411
+
412
+ // is the entity in the list?
413
+ const isEntity = this.entityInList(entityId, data.response, callback);
414
+ const res = [];
415
+
416
+ // not found
417
+ for (let i = 0; i < isEntity.length; i += 1) {
418
+ if (vcapable) {
419
+ res.push(isEntity[i]);
420
+ } else {
421
+ res.push(false);
422
+ }
423
+ }
424
+
425
+ return callback(res);
426
+ });
427
+ });
428
+ }
429
+ default: {
430
+ // unsupported entity type
431
+ const result = [false];
432
+
433
+ // put false in array for all entities
434
+ if (Array.isArray(entityId)) {
435
+ for (let e = 1; e < entityId.length; e += 1) {
436
+ result.push(false);
437
+ }
438
+ }
439
+
440
+ return callback(result);
441
+ }
442
+ }
443
+ }
444
+
445
+ /**
446
+ * @summary Updates the cache for all entities by call the get All entity method
447
+ *
448
+ * @function iapUpdateAdapterEntityCache
449
+ *
450
+ */
451
+ iapUpdateAdapterEntityCache() {
452
+ const origin = `${this.id}-adapter-iapUpdateAdapterEntityCache`;
453
+ log.trace(origin);
454
+
455
+ if (this.caching) {
456
+ // if the cache is invalid, update the cache
457
+ this.getEntities(null, null, null, null, (data, err) => {
458
+ if (err) {
459
+ log.trace(`${origin}: Could not load template_entity into cache - ${err}`);
460
+ }
461
+ });
462
+ }
463
+ }
464
+
465
+ /**
466
+ * @summary Determines if this adapter supports any in a list of entities
467
+ *
468
+ * @function hasEntities
469
+ * @param {String} entityType - the entity type to check for
470
+ * @param {Array} entityList - the list of entities we are looking for
471
+ *
472
+ * @param {Callback} callback - A map where the entity is the key and the
473
+ * value is true or false
474
+ */
475
+ hasEntities(entityType, entityList, callback) {
476
+ const meth = 'adapter-hasEntities';
477
+ const origin = `${this.id}-${meth}`;
478
+ log.trace(origin);
479
+
480
+ try {
481
+ return super.hasEntities(entityType, entityList, callback);
482
+ } catch (err) {
483
+ log.error(`${origin}: ${err}`);
484
+ return callback(null, err);
485
+ }
486
+ }
487
+
488
+ /**
489
+ * @summary Get Appliance that match the deviceName
490
+ *
491
+ * @function getDevice
492
+ * @param {String} deviceName - the deviceName to find (required)
493
+ *
494
+ * @param {getCallback} callback - a callback function to return the result
495
+ * (appliance) or the error
496
+ */
497
+ getDevice(deviceName, callback) {
498
+ const meth = 'adapter-getDevice';
499
+ const origin = `${this.id}-${meth}`;
500
+ log.trace(origin);
501
+
502
+ try {
503
+ return super.getDevice(deviceName, callback);
504
+ } catch (err) {
505
+ log.error(`${origin}: ${err}`);
506
+ return callback(null, err);
507
+ }
508
+ }
509
+
510
+ /**
511
+ * @summary Get Appliances that match the filter
512
+ *
513
+ * @function getDevicesFiltered
514
+ * @param {Object} options - the data to use to filter the appliances (optional)
515
+ *
516
+ * @param {getCallback} callback - a callback function to return the result
517
+ * (appliances) or the error
518
+ */
519
+ getDevicesFiltered(options, callback) {
520
+ const meth = 'adapter-getDevicesFiltered';
521
+ const origin = `${this.id}-${meth}`;
522
+ log.trace(origin);
523
+
524
+ try {
525
+ return super.getDevicesFiltered(options, callback);
526
+ } catch (err) {
527
+ log.error(`${origin}: ${err}`);
528
+ return callback(null, err);
529
+ }
530
+ }
531
+
532
+ /**
533
+ * @summary Gets the status for the provided appliance
534
+ *
535
+ * @function isAlive
536
+ * @param {String} deviceName - the deviceName of the appliance. (required)
537
+ *
538
+ * @param {configCallback} callback - callback function to return the result
539
+ * (appliance isAlive) or the error
540
+ */
541
+ isAlive(deviceName, callback) {
542
+ const meth = 'adapter-isAlive';
543
+ const origin = `${this.id}-${meth}`;
544
+ log.trace(origin);
545
+
546
+ try {
547
+ return super.isAlive(deviceName, callback);
548
+ } catch (err) {
549
+ log.error(`${origin}: ${err}`);
550
+ return callback(null, err);
551
+ }
552
+ }
553
+
554
+ /**
555
+ * @summary Gets a config for the provided Appliance
556
+ *
557
+ * @function getConfig
558
+ * @param {String} deviceName - the deviceName of the appliance. (required)
559
+ * @param {String} format - the desired format of the config. (optional)
560
+ *
561
+ * @param {configCallback} callback - callback function to return the result
562
+ * (appliance config) or the error
563
+ */
564
+ getConfig(deviceName, format, callback) {
565
+ const meth = 'adapter-getConfig';
566
+ const origin = `${this.id}-${meth}`;
567
+ log.trace(origin);
568
+
569
+ try {
570
+ return super.getConfig(deviceName, format, callback);
571
+ } catch (err) {
572
+ log.error(`${origin}: ${err}`);
573
+ return callback(null, err);
574
+ }
575
+ }
576
+
577
+ /**
578
+ * @summary Gets the device count from the system
579
+ *
580
+ * @function iapGetDeviceCount
581
+ *
582
+ * @param {getCallback} callback - callback function to return the result
583
+ * (count) or the error
584
+ */
585
+ iapGetDeviceCount(callback) {
586
+ const meth = 'adapter-iapGetDeviceCount';
587
+ const origin = `${this.id}-${meth}`;
588
+ log.trace(origin);
589
+
590
+ try {
591
+ return super.iapGetDeviceCount(callback);
592
+ } catch (err) {
593
+ log.error(`${origin}: ${err}`);
594
+ return callback(null, err);
595
+ }
596
+ }
597
+
598
+ /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
599
+ /**
600
+ * Makes the requested generic call
601
+ *
602
+ * @function genericAdapterRequest
603
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
604
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
605
+ * @param {Object} queryData - the parameters to be put on the url (optional).
606
+ * Can be a stringified Object.
607
+ * @param {Object} requestBody - the body to add to the request (optional).
608
+ * Can be a stringified Object.
609
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
610
+ * Can be a stringified Object.
611
+ * @param {getCallback} callback - a callback function to return the result (Generics)
612
+ * or the error
613
+ */
614
+ genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
615
+ const meth = 'adapter-genericAdapterRequest';
616
+ const origin = `${this.id}-${meth}`;
617
+ log.trace(origin);
618
+
619
+ if (this.suspended && this.suspendMode === 'error') {
620
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
621
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
622
+ return callback(null, errorObj);
623
+ }
624
+
625
+ /* HERE IS WHERE YOU VALIDATE DATA */
626
+ if (uriPath === undefined || uriPath === null || uriPath === '') {
627
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
628
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
629
+ return callback(null, errorObj);
630
+ }
631
+ if (restMethod === undefined || restMethod === null || restMethod === '') {
632
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
633
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
634
+ return callback(null, errorObj);
635
+ }
636
+
637
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
638
+ // remove any leading / and split the uripath into path variables
639
+ let myPath = uriPath;
640
+ while (myPath.indexOf('/') === 0) {
641
+ myPath = myPath.substring(1);
642
+ }
643
+ const pathVars = myPath.split('/');
644
+ const queryParamsAvailable = queryData;
645
+ const queryParams = {};
646
+ const bodyVars = requestBody;
647
+
648
+ // loop in template. long callback arg name to avoid identifier conflicts
649
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
650
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
651
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
652
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
653
+ }
654
+ });
655
+
656
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
657
+ const reqObj = {
658
+ payload: bodyVars,
659
+ uriPathVars: pathVars,
660
+ uriQuery: queryParams,
661
+ uriOptions: {}
662
+ };
663
+ // add headers if provided
664
+ if (addlHeaders) {
665
+ reqObj.addlHeaders = addlHeaders;
666
+ }
667
+
668
+ // determine the call and return flag
669
+ let action = 'getGenerics';
670
+ let returnF = true;
671
+ if (restMethod.toUpperCase() === 'POST') {
672
+ action = 'createGeneric';
673
+ } else if (restMethod.toUpperCase() === 'PUT') {
674
+ action = 'updateGeneric';
675
+ } else if (restMethod.toUpperCase() === 'PATCH') {
676
+ action = 'patchGeneric';
677
+ } else if (restMethod.toUpperCase() === 'DELETE') {
678
+ action = 'deleteGeneric';
679
+ returnF = false;
680
+ }
681
+
682
+ try {
683
+ // Make the call -
684
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
685
+ return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
686
+ // if we received an error or their is no response on the results
687
+ // return an error
688
+ if (irReturnError) {
689
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
690
+ return callback(null, irReturnError);
691
+ }
692
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
693
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
694
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
695
+ return callback(null, errorObj);
696
+ }
697
+
698
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
699
+ // return the response
700
+ return callback(irReturnData, null);
701
+ });
702
+ } catch (ex) {
703
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
704
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
705
+ return callback(null, errorObj);
706
+ }
707
+ }
708
+
709
+ /**
710
+ * Makes the requested generic call with no base path or version
711
+ *
712
+ * @function genericAdapterRequestNoBasePath
713
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
714
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
715
+ * @param {Object} queryData - the parameters to be put on the url (optional).
716
+ * Can be a stringified Object.
717
+ * @param {Object} requestBody - the body to add to the request (optional).
718
+ * Can be a stringified Object.
719
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
720
+ * Can be a stringified Object.
721
+ * @param {getCallback} callback - a callback function to return the result (Generics)
722
+ * or the error
723
+ */
724
+ genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
725
+ const meth = 'adapter-genericAdapterRequestNoBasePath';
726
+ const origin = `${this.id}-${meth}`;
727
+ log.trace(origin);
728
+
729
+ if (this.suspended && this.suspendMode === 'error') {
730
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
731
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
732
+ return callback(null, errorObj);
733
+ }
734
+
735
+ /* HERE IS WHERE YOU VALIDATE DATA */
736
+ if (uriPath === undefined || uriPath === null || uriPath === '') {
737
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
738
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
739
+ return callback(null, errorObj);
740
+ }
741
+ if (restMethod === undefined || restMethod === null || restMethod === '') {
742
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
743
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
744
+ return callback(null, errorObj);
745
+ }
746
+
747
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
748
+ // remove any leading / and split the uripath into path variables
749
+ let myPath = uriPath;
750
+ while (myPath.indexOf('/') === 0) {
751
+ myPath = myPath.substring(1);
752
+ }
753
+ const pathVars = myPath.split('/');
754
+ const queryParamsAvailable = queryData;
755
+ const queryParams = {};
756
+ const bodyVars = requestBody;
757
+
758
+ // loop in template. long callback arg name to avoid identifier conflicts
759
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
760
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
761
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
762
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
763
+ }
764
+ });
765
+
766
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
767
+ const reqObj = {
768
+ payload: bodyVars,
769
+ uriPathVars: pathVars,
770
+ uriQuery: queryParams,
771
+ uriOptions: {}
772
+ };
773
+ // add headers if provided
774
+ if (addlHeaders) {
775
+ reqObj.addlHeaders = addlHeaders;
776
+ }
777
+
778
+ // determine the call and return flag
779
+ let action = 'getGenericsNoBase';
780
+ let returnF = true;
781
+ if (restMethod.toUpperCase() === 'POST') {
782
+ action = 'createGenericNoBase';
783
+ } else if (restMethod.toUpperCase() === 'PUT') {
784
+ action = 'updateGenericNoBase';
785
+ } else if (restMethod.toUpperCase() === 'PATCH') {
786
+ action = 'patchGenericNoBase';
787
+ } else if (restMethod.toUpperCase() === 'DELETE') {
788
+ action = 'deleteGenericNoBase';
789
+ returnF = false;
790
+ }
791
+
792
+ try {
793
+ // Make the call -
794
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
795
+ return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
796
+ // if we received an error or their is no response on the results
797
+ // return an error
798
+ if (irReturnError) {
799
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
800
+ return callback(null, irReturnError);
801
+ }
802
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
803
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
804
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
805
+ return callback(null, errorObj);
806
+ }
807
+
808
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
809
+ // return the response
810
+ return callback(irReturnData, null);
811
+ });
812
+ } catch (ex) {
813
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
814
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
815
+ return callback(null, errorObj);
816
+ }
817
+ }
818
+
819
+ /**
820
+ * @callback healthCallback
821
+ * @param {Object} result - the result of the get request (contains an id and a status)
822
+ */
823
+ /**
824
+ * @callback getCallback
825
+ * @param {Object} result - the result of the get request (entity/ies)
826
+ * @param {String} error - any error that occurred
827
+ */
828
+ /**
829
+ * @callback createCallback
830
+ * @param {Object} item - the newly created entity
831
+ * @param {String} error - any error that occurred
832
+ */
833
+ /**
834
+ * @callback updateCallback
835
+ * @param {String} status - the status of the update action
836
+ * @param {String} error - any error that occurred
837
+ */
838
+ /**
839
+ * @callback deleteCallback
840
+ * @param {String} status - the status of the delete action
841
+ * @param {String} error - any error that occurred
842
+ */
843
+
844
+ /**
845
+ * @function deploy
846
+ * @pronghornType method
847
+ * @name deploy
848
+ * @summary deploy
849
+ *
850
+ * @param {object} body - body param
851
+ * @param {getCallback} callback - a callback function to return the result
852
+ * @return {object} results - An object containing the response of the action
853
+ *
854
+ * @route {POST} /deploy
855
+ * @roles admin
856
+ * @task true
857
+ */
858
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
859
+ deploy(body, callback) {
860
+ const meth = 'adapter-deploy';
861
+ const origin = `${this.id}-${meth}`;
862
+ log.trace(origin);
863
+
864
+ if (this.suspended && this.suspendMode === 'error') {
865
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
866
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
867
+ return callback(null, errorObj);
868
+ }
869
+
870
+ /* HERE IS WHERE YOU VALIDATE DATA */
871
+ if (body === undefined || body === null || body === '') {
872
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
873
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
874
+ return callback(null, errorObj);
875
+ }
876
+
877
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
878
+ const queryParamsAvailable = {};
879
+ const queryParams = {};
880
+ const pathVars = [];
881
+ const bodyVars = body;
882
+
883
+ // loop in template. long callback arg name to avoid identifier conflicts
884
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
885
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
886
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
887
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
888
+ }
889
+ });
890
+
891
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
892
+ // see adapter code documentation for more information on the request object's fields
893
+ const reqObj = {
894
+ payload: bodyVars,
895
+ uriPathVars: pathVars,
896
+ uriQuery: queryParams
897
+ };
898
+
899
+ try {
900
+ // Make the call -
901
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
902
+ return this.requestHandlerInst.identifyRequest('NCEManagement', 'deploy', reqObj, true, (irReturnData, irReturnError) => {
903
+ // if we received an error or their is no response on the results
904
+ // return an error
905
+ if (irReturnError) {
906
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
907
+ return callback(null, irReturnError);
908
+ }
909
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
910
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deploy'], null, null, null);
911
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
912
+ return callback(null, errorObj);
913
+ }
914
+
915
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
916
+ // return the response
917
+ return callback(irReturnData, null);
918
+ });
919
+ } catch (ex) {
920
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
921
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
922
+ return callback(null, errorObj);
923
+ }
924
+ }
925
+
926
+ /**
927
+ * @function updateNCEbyClusterID
928
+ * @pronghornType method
929
+ * @name updateNCEbyClusterID
930
+ * @summary updateNCEbyClusterID
931
+ *
932
+ * @param {string} clusterId - System-ID of the NCE
933
+ * @param {object} body - body param
934
+ * @param {getCallback} callback - a callback function to return the result
935
+ * @return {object} results - An object containing the response of the action
936
+ *
937
+ * @route {POST} /updateNCEbyClusterID
938
+ * @roles admin
939
+ * @task true
940
+ */
941
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
942
+ updateNCEbyClusterID(clusterId, body, callback) {
943
+ const meth = 'adapter-updateNCEbyClusterID';
944
+ const origin = `${this.id}-${meth}`;
945
+ log.trace(origin);
946
+
947
+ if (this.suspended && this.suspendMode === 'error') {
948
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
949
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
950
+ return callback(null, errorObj);
951
+ }
952
+
953
+ /* HERE IS WHERE YOU VALIDATE DATA */
954
+ if (clusterId === undefined || clusterId === null || clusterId === '') {
955
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['clusterId'], null, null, null);
956
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
957
+ return callback(null, errorObj);
958
+ }
959
+ if (body === undefined || body === null || body === '') {
960
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
961
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
962
+ return callback(null, errorObj);
963
+ }
964
+
965
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
966
+ const queryParamsAvailable = {};
967
+ const queryParams = {};
968
+ const pathVars = [clusterId];
969
+ const bodyVars = body;
970
+
971
+ // loop in template. long callback arg name to avoid identifier conflicts
972
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
973
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
974
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
975
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
976
+ }
977
+ });
978
+
979
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
980
+ // see adapter code documentation for more information on the request object's fields
981
+ const reqObj = {
982
+ payload: bodyVars,
983
+ uriPathVars: pathVars,
984
+ uriQuery: queryParams
985
+ };
986
+
987
+ try {
988
+ // Make the call -
989
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
990
+ return this.requestHandlerInst.identifyRequest('NCEManagement', 'updateNCEbyClusterID', reqObj, false, (irReturnData, irReturnError) => {
991
+ // if we received an error or their is no response on the results
992
+ // return an error
993
+ if (irReturnError) {
994
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
995
+ return callback(null, irReturnError);
996
+ }
997
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
998
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateNCEbyClusterID'], null, null, null);
999
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1000
+ return callback(null, errorObj);
1001
+ }
1002
+
1003
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1004
+ // return the response
1005
+ return callback(irReturnData, null);
1006
+ });
1007
+ } catch (ex) {
1008
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1009
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1010
+ return callback(null, errorObj);
1011
+ }
1012
+ }
1013
+
1014
+ /**
1015
+ * @function deleteNCEbyClusterID
1016
+ * @pronghornType method
1017
+ * @name deleteNCEbyClusterID
1018
+ * @summary deleteNCEbyClusterID
1019
+ *
1020
+ * @param {string} clusterId - clusterId param
1021
+ * @param {getCallback} callback - a callback function to return the result
1022
+ * @return {object} results - An object containing the response of the action
1023
+ *
1024
+ * @route {POST} /deleteNCEbyClusterID
1025
+ * @roles admin
1026
+ * @task true
1027
+ */
1028
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1029
+ deleteNCEbyClusterID(clusterId, callback) {
1030
+ const meth = 'adapter-deleteNCEbyClusterID';
1031
+ const origin = `${this.id}-${meth}`;
1032
+ log.trace(origin);
1033
+
1034
+ if (this.suspended && this.suspendMode === 'error') {
1035
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1036
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1037
+ return callback(null, errorObj);
1038
+ }
1039
+
1040
+ /* HERE IS WHERE YOU VALIDATE DATA */
1041
+ if (clusterId === undefined || clusterId === null || clusterId === '') {
1042
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['clusterId'], null, null, null);
1043
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1044
+ return callback(null, errorObj);
1045
+ }
1046
+
1047
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1048
+ const queryParamsAvailable = {};
1049
+ const queryParams = {};
1050
+ const pathVars = [clusterId];
1051
+ const bodyVars = {};
1052
+
1053
+ // loop in template. long callback arg name to avoid identifier conflicts
1054
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1055
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1056
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1057
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1058
+ }
1059
+ });
1060
+
1061
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1062
+ // see adapter code documentation for more information on the request object's fields
1063
+ const reqObj = {
1064
+ payload: bodyVars,
1065
+ uriPathVars: pathVars,
1066
+ uriQuery: queryParams
1067
+ };
1068
+
1069
+ try {
1070
+ // Make the call -
1071
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1072
+ return this.requestHandlerInst.identifyRequest('NCEManagement', 'deleteNCEbyClusterID', reqObj, false, (irReturnData, irReturnError) => {
1073
+ // if we received an error or their is no response on the results
1074
+ // return an error
1075
+ if (irReturnError) {
1076
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1077
+ return callback(null, irReturnError);
1078
+ }
1079
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1080
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteNCEbyClusterID'], null, null, null);
1081
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1082
+ return callback(null, errorObj);
1083
+ }
1084
+
1085
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1086
+ // return the response
1087
+ return callback(irReturnData, null);
1088
+ });
1089
+ } catch (ex) {
1090
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1091
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1092
+ return callback(null, errorObj);
1093
+ }
1094
+ }
1095
+
1096
+ /**
1097
+ * @function nceManagementDownload
1098
+ * @pronghornType method
1099
+ * @name nceManagementDownload
1100
+ * @summary download
1101
+ *
1102
+ * @param {string} clusterId - System-ID of the NCE
1103
+ * @param {object} body - Download values
1104
+ * @param {getCallback} callback - a callback function to return the result
1105
+ * @return {object} results - An object containing the response of the action
1106
+ *
1107
+ * @route {POST} /nceManagementDownload
1108
+ * @roles admin
1109
+ * @task true
1110
+ */
1111
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1112
+ nceManagementDownload(clusterId, body, callback) {
1113
+ const meth = 'adapter-nceManagementDownload';
1114
+ const origin = `${this.id}-${meth}`;
1115
+ log.trace(origin);
1116
+
1117
+ if (this.suspended && this.suspendMode === 'error') {
1118
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1119
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1120
+ return callback(null, errorObj);
1121
+ }
1122
+
1123
+ /* HERE IS WHERE YOU VALIDATE DATA */
1124
+ if (clusterId === undefined || clusterId === null || clusterId === '') {
1125
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['clusterId'], null, null, null);
1126
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1127
+ return callback(null, errorObj);
1128
+ }
1129
+ if (body === undefined || body === null || body === '') {
1130
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1131
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1132
+ return callback(null, errorObj);
1133
+ }
1134
+
1135
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1136
+ const queryParamsAvailable = {};
1137
+ const queryParams = {};
1138
+ const pathVars = [clusterId];
1139
+ const bodyVars = body;
1140
+
1141
+ // loop in template. long callback arg name to avoid identifier conflicts
1142
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1143
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1144
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1145
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1146
+ }
1147
+ });
1148
+
1149
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1150
+ // see adapter code documentation for more information on the request object's fields
1151
+ const reqObj = {
1152
+ payload: bodyVars,
1153
+ uriPathVars: pathVars,
1154
+ uriQuery: queryParams
1155
+ };
1156
+
1157
+ try {
1158
+ // Make the call -
1159
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1160
+ return this.requestHandlerInst.identifyRequest('NCEManagement', 'nceManagementDownload', reqObj, true, (irReturnData, irReturnError) => {
1161
+ // if we received an error or their is no response on the results
1162
+ // return an error
1163
+ if (irReturnError) {
1164
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1165
+ return callback(null, irReturnError);
1166
+ }
1167
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1168
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['nceManagementDownload'], null, null, null);
1169
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1170
+ return callback(null, errorObj);
1171
+ }
1172
+
1173
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1174
+ // return the response
1175
+ return callback(irReturnData, null);
1176
+ });
1177
+ } catch (ex) {
1178
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1179
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1180
+ return callback(null, errorObj);
1181
+ }
1182
+ }
1183
+
1184
+ /**
1185
+ * @function nceManagementUpgrade
1186
+ * @pronghornType method
1187
+ * @name nceManagementUpgrade
1188
+ * @summary Upgrade
1189
+ *
1190
+ * @param {string} clusterId - System-ID of the NCE
1191
+ * @param {object} body - Upgrade deatil
1192
+ * @param {getCallback} callback - a callback function to return the result
1193
+ * @return {object} results - An object containing the response of the action
1194
+ *
1195
+ * @route {POST} /nceManagementUpgrade
1196
+ * @roles admin
1197
+ * @task true
1198
+ */
1199
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1200
+ nceManagementUpgrade(clusterId, body, callback) {
1201
+ const meth = 'adapter-nceManagementUpgrade';
1202
+ const origin = `${this.id}-${meth}`;
1203
+ log.trace(origin);
1204
+
1205
+ if (this.suspended && this.suspendMode === 'error') {
1206
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1207
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1208
+ return callback(null, errorObj);
1209
+ }
1210
+
1211
+ /* HERE IS WHERE YOU VALIDATE DATA */
1212
+ if (clusterId === undefined || clusterId === null || clusterId === '') {
1213
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['clusterId'], null, null, null);
1214
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1215
+ return callback(null, errorObj);
1216
+ }
1217
+ if (body === undefined || body === null || body === '') {
1218
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1219
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1220
+ return callback(null, errorObj);
1221
+ }
1222
+
1223
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1224
+ const queryParamsAvailable = {};
1225
+ const queryParams = {};
1226
+ const pathVars = [clusterId];
1227
+ const bodyVars = body;
1228
+
1229
+ // loop in template. long callback arg name to avoid identifier conflicts
1230
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1231
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1232
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1233
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1234
+ }
1235
+ });
1236
+
1237
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1238
+ // see adapter code documentation for more information on the request object's fields
1239
+ const reqObj = {
1240
+ payload: bodyVars,
1241
+ uriPathVars: pathVars,
1242
+ uriQuery: queryParams
1243
+ };
1244
+
1245
+ try {
1246
+ // Make the call -
1247
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1248
+ return this.requestHandlerInst.identifyRequest('NCEManagement', 'nceManagementUpgrade', reqObj, true, (irReturnData, irReturnError) => {
1249
+ // if we received an error or their is no response on the results
1250
+ // return an error
1251
+ if (irReturnError) {
1252
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1253
+ return callback(null, irReturnError);
1254
+ }
1255
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1256
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['nceManagementUpgrade'], null, null, null);
1257
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1258
+ return callback(null, errorObj);
1259
+ }
1260
+
1261
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1262
+ // return the response
1263
+ return callback(irReturnData, null);
1264
+ });
1265
+ } catch (ex) {
1266
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1267
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1268
+ return callback(null, errorObj);
1269
+ }
1270
+ }
1271
+
1272
+ /**
1273
+ * @function nceManagementCancel
1274
+ * @pronghornType method
1275
+ * @name nceManagementCancel
1276
+ * @summary Cancel
1277
+ *
1278
+ * @param {string} clusterId - System-ID of the NCE
1279
+ * @param {getCallback} callback - a callback function to return the result
1280
+ * @return {object} results - An object containing the response of the action
1281
+ *
1282
+ * @route {POST} /nceManagementCancel
1283
+ * @roles admin
1284
+ * @task true
1285
+ */
1286
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1287
+ nceManagementCancel(clusterId, callback) {
1288
+ const meth = 'adapter-nceManagementCancel';
1289
+ const origin = `${this.id}-${meth}`;
1290
+ log.trace(origin);
1291
+
1292
+ if (this.suspended && this.suspendMode === 'error') {
1293
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1294
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1295
+ return callback(null, errorObj);
1296
+ }
1297
+
1298
+ /* HERE IS WHERE YOU VALIDATE DATA */
1299
+ if (clusterId === undefined || clusterId === null || clusterId === '') {
1300
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['clusterId'], null, null, null);
1301
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1302
+ return callback(null, errorObj);
1303
+ }
1304
+
1305
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1306
+ const queryParamsAvailable = {};
1307
+ const queryParams = {};
1308
+ const pathVars = [clusterId];
1309
+ const bodyVars = {};
1310
+
1311
+ // loop in template. long callback arg name to avoid identifier conflicts
1312
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1313
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1314
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1315
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1316
+ }
1317
+ });
1318
+
1319
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1320
+ // see adapter code documentation for more information on the request object's fields
1321
+ const reqObj = {
1322
+ payload: bodyVars,
1323
+ uriPathVars: pathVars,
1324
+ uriQuery: queryParams
1325
+ };
1326
+
1327
+ try {
1328
+ // Make the call -
1329
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1330
+ return this.requestHandlerInst.identifyRequest('NCEManagement', 'nceManagementCancel', reqObj, true, (irReturnData, irReturnError) => {
1331
+ // if we received an error or their is no response on the results
1332
+ // return an error
1333
+ if (irReturnError) {
1334
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1335
+ return callback(null, irReturnError);
1336
+ }
1337
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1338
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['nceManagementCancel'], null, null, null);
1339
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1340
+ return callback(null, errorObj);
1341
+ }
1342
+
1343
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1344
+ // return the response
1345
+ return callback(irReturnData, null);
1346
+ });
1347
+ } catch (ex) {
1348
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1349
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1350
+ return callback(null, errorObj);
1351
+ }
1352
+ }
1353
+
1354
+ /**
1355
+ * @function nceManagementPrecheck
1356
+ * @pronghornType method
1357
+ * @name nceManagementPrecheck
1358
+ * @summary Preupgrade validation
1359
+ *
1360
+ * @param {string} clusterId - System-ID of the NCE
1361
+ * @param {getCallback} callback - a callback function to return the result
1362
+ * @return {object} results - An object containing the response of the action
1363
+ *
1364
+ * @route {POST} /nceManagementPrecheck
1365
+ * @roles admin
1366
+ * @task true
1367
+ */
1368
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1369
+ nceManagementPrecheck(clusterId, callback) {
1370
+ const meth = 'adapter-nceManagementPrecheck';
1371
+ const origin = `${this.id}-${meth}`;
1372
+ log.trace(origin);
1373
+
1374
+ if (this.suspended && this.suspendMode === 'error') {
1375
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1376
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1377
+ return callback(null, errorObj);
1378
+ }
1379
+
1380
+ /* HERE IS WHERE YOU VALIDATE DATA */
1381
+ if (clusterId === undefined || clusterId === null || clusterId === '') {
1382
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['clusterId'], null, null, null);
1383
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1384
+ return callback(null, errorObj);
1385
+ }
1386
+
1387
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1388
+ const queryParamsAvailable = {};
1389
+ const queryParams = {};
1390
+ const pathVars = [clusterId];
1391
+ const bodyVars = {};
1392
+
1393
+ // loop in template. long callback arg name to avoid identifier conflicts
1394
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1395
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1396
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1397
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1398
+ }
1399
+ });
1400
+
1401
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1402
+ // see adapter code documentation for more information on the request object's fields
1403
+ const reqObj = {
1404
+ payload: bodyVars,
1405
+ uriPathVars: pathVars,
1406
+ uriQuery: queryParams
1407
+ };
1408
+
1409
+ try {
1410
+ // Make the call -
1411
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1412
+ return this.requestHandlerInst.identifyRequest('NCEManagement', 'nceManagementPrecheck', reqObj, true, (irReturnData, irReturnError) => {
1413
+ // if we received an error or their is no response on the results
1414
+ // return an error
1415
+ if (irReturnError) {
1416
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1417
+ return callback(null, irReturnError);
1418
+ }
1419
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1420
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['nceManagementPrecheck'], null, null, null);
1421
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1422
+ return callback(null, errorObj);
1423
+ }
1424
+
1425
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1426
+ // return the response
1427
+ return callback(irReturnData, null);
1428
+ });
1429
+ } catch (ex) {
1430
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1431
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1432
+ return callback(null, errorObj);
1433
+ }
1434
+ }
1435
+
1436
+ /**
1437
+ * @function redundancyDisable
1438
+ * @pronghornType method
1439
+ * @name redundancyDisable
1440
+ * @summary Disable all DNOR services on a node
1441
+ *
1442
+ * @param {object} [body] - body param
1443
+ * @param {getCallback} callback - a callback function to return the result
1444
+ * @return {object} results - An object containing the response of the action
1445
+ *
1446
+ * @route {POST} /redundancyDisable
1447
+ * @roles admin
1448
+ * @task true
1449
+ */
1450
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1451
+ redundancyDisable(body, callback) {
1452
+ const meth = 'adapter-redundancyDisable';
1453
+ const origin = `${this.id}-${meth}`;
1454
+ log.trace(origin);
1455
+
1456
+ if (this.suspended && this.suspendMode === 'error') {
1457
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1458
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1459
+ return callback(null, errorObj);
1460
+ }
1461
+
1462
+ /* HERE IS WHERE YOU VALIDATE DATA */
1463
+
1464
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1465
+ const queryParamsAvailable = {};
1466
+ const queryParams = {};
1467
+ const pathVars = [];
1468
+ const bodyVars = body;
1469
+
1470
+ // loop in template. long callback arg name to avoid identifier conflicts
1471
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1472
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1473
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1474
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1475
+ }
1476
+ });
1477
+
1478
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1479
+ // see adapter code documentation for more information on the request object's fields
1480
+ const reqObj = {
1481
+ payload: bodyVars,
1482
+ uriPathVars: pathVars,
1483
+ uriQuery: queryParams
1484
+ };
1485
+
1486
+ try {
1487
+ // Make the call -
1488
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1489
+ return this.requestHandlerInst.identifyRequest('Redundancy', 'redundancyDisable', reqObj, false, (irReturnData, irReturnError) => {
1490
+ // if we received an error or their is no response on the results
1491
+ // return an error
1492
+ if (irReturnError) {
1493
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1494
+ return callback(null, irReturnError);
1495
+ }
1496
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1497
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['redundancyDisable'], null, null, null);
1498
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1499
+ return callback(null, errorObj);
1500
+ }
1501
+
1502
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1503
+ // return the response
1504
+ return callback(irReturnData, null);
1505
+ });
1506
+ } catch (ex) {
1507
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1508
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1509
+ return callback(null, errorObj);
1510
+ }
1511
+ }
1512
+
1513
+ /**
1514
+ * @function redundancyEnable
1515
+ * @pronghornType method
1516
+ * @name redundancyEnable
1517
+ * @summary Enable all DNOR services on a node
1518
+ *
1519
+ * @param {object} [body] - body param
1520
+ * @param {getCallback} callback - a callback function to return the result
1521
+ * @return {object} results - An object containing the response of the action
1522
+ *
1523
+ * @route {POST} /redundancyEnable
1524
+ * @roles admin
1525
+ * @task true
1526
+ */
1527
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1528
+ redundancyEnable(body, callback) {
1529
+ const meth = 'adapter-redundancyEnable';
1530
+ const origin = `${this.id}-${meth}`;
1531
+ log.trace(origin);
1532
+
1533
+ if (this.suspended && this.suspendMode === 'error') {
1534
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1535
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1536
+ return callback(null, errorObj);
1537
+ }
1538
+
1539
+ /* HERE IS WHERE YOU VALIDATE DATA */
1540
+
1541
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1542
+ const queryParamsAvailable = {};
1543
+ const queryParams = {};
1544
+ const pathVars = [];
1545
+ const bodyVars = body;
1546
+
1547
+ // loop in template. long callback arg name to avoid identifier conflicts
1548
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1549
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1550
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1551
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1552
+ }
1553
+ });
1554
+
1555
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1556
+ // see adapter code documentation for more information on the request object's fields
1557
+ const reqObj = {
1558
+ payload: bodyVars,
1559
+ uriPathVars: pathVars,
1560
+ uriQuery: queryParams
1561
+ };
1562
+
1563
+ try {
1564
+ // Make the call -
1565
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1566
+ return this.requestHandlerInst.identifyRequest('Redundancy', 'redundancyEnable', reqObj, false, (irReturnData, irReturnError) => {
1567
+ // if we received an error or their is no response on the results
1568
+ // return an error
1569
+ if (irReturnError) {
1570
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1571
+ return callback(null, irReturnError);
1572
+ }
1573
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1574
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['redundancyEnable'], null, null, null);
1575
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1576
+ return callback(null, errorObj);
1577
+ }
1578
+
1579
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1580
+ // return the response
1581
+ return callback(irReturnData, null);
1582
+ });
1583
+ } catch (ex) {
1584
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1585
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1586
+ return callback(null, errorObj);
1587
+ }
1588
+ }
1589
+
1590
+ /**
1591
+ * @function redundancy
1592
+ * @pronghornType method
1593
+ * @name redundancy
1594
+ * @summary Manual switchover
1595
+ *
1596
+ * @param {object} [body] - Manual switchover
1597
+ * @param {getCallback} callback - a callback function to return the result
1598
+ * @return {object} results - An object containing the response of the action
1599
+ *
1600
+ * @route {POST} /redundancy
1601
+ * @roles admin
1602
+ * @task true
1603
+ */
1604
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1605
+ redundancy(body, callback) {
1606
+ const meth = 'adapter-redundancy';
1607
+ const origin = `${this.id}-${meth}`;
1608
+ log.trace(origin);
1609
+
1610
+ if (this.suspended && this.suspendMode === 'error') {
1611
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1612
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1613
+ return callback(null, errorObj);
1614
+ }
1615
+
1616
+ /* HERE IS WHERE YOU VALIDATE DATA */
1617
+
1618
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1619
+ const queryParamsAvailable = {};
1620
+ const queryParams = {};
1621
+ const pathVars = [];
1622
+ const bodyVars = body;
1623
+
1624
+ // loop in template. long callback arg name to avoid identifier conflicts
1625
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1626
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1627
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1628
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1629
+ }
1630
+ });
1631
+
1632
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1633
+ // see adapter code documentation for more information on the request object's fields
1634
+ const reqObj = {
1635
+ payload: bodyVars,
1636
+ uriPathVars: pathVars,
1637
+ uriQuery: queryParams
1638
+ };
1639
+
1640
+ try {
1641
+ // Make the call -
1642
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1643
+ return this.requestHandlerInst.identifyRequest('Redundancy', 'redundancy', reqObj, false, (irReturnData, irReturnError) => {
1644
+ // if we received an error or their is no response on the results
1645
+ // return an error
1646
+ if (irReturnError) {
1647
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1648
+ return callback(null, irReturnError);
1649
+ }
1650
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1651
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['redundancy'], null, null, null);
1652
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1653
+ return callback(null, errorObj);
1654
+ }
1655
+
1656
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1657
+ // return the response
1658
+ return callback(irReturnData, null);
1659
+ });
1660
+ } catch (ex) {
1661
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1662
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1663
+ return callback(null, errorObj);
1664
+ }
1665
+ }
1666
+
1667
+ /**
1668
+ * @function targetGroupGroups
1669
+ * @pronghornType method
1670
+ * @name targetGroupGroups
1671
+ * @summary Get all existing target groups
1672
+ *
1673
+ * @param {getCallback} callback - a callback function to return the result
1674
+ * @return {object} results - An object containing the response of the action
1675
+ *
1676
+ * @route {GET} /targetGroupGroups
1677
+ * @roles admin
1678
+ * @task true
1679
+ */
1680
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1681
+ targetGroupGroups(callback) {
1682
+ const meth = 'adapter-targetGroupGroups';
1683
+ const origin = `${this.id}-${meth}`;
1684
+ log.trace(origin);
1685
+
1686
+ if (this.suspended && this.suspendMode === 'error') {
1687
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1688
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1689
+ return callback(null, errorObj);
1690
+ }
1691
+
1692
+ /* HERE IS WHERE YOU VALIDATE DATA */
1693
+
1694
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1695
+ const queryParamsAvailable = {};
1696
+ const queryParams = {};
1697
+ const pathVars = [];
1698
+ const bodyVars = {};
1699
+
1700
+ // loop in template. long callback arg name to avoid identifier conflicts
1701
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1702
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1703
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1704
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1705
+ }
1706
+ });
1707
+
1708
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1709
+ // see adapter code documentation for more information on the request object's fields
1710
+ const reqObj = {
1711
+ payload: bodyVars,
1712
+ uriPathVars: pathVars,
1713
+ uriQuery: queryParams
1714
+ };
1715
+
1716
+ try {
1717
+ // Make the call -
1718
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1719
+ return this.requestHandlerInst.identifyRequest('NCEGroupManagement', 'targetGroupGroups', reqObj, true, (irReturnData, irReturnError) => {
1720
+ // if we received an error or their is no response on the results
1721
+ // return an error
1722
+ if (irReturnError) {
1723
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1724
+ return callback(null, irReturnError);
1725
+ }
1726
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1727
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['targetGroupGroups'], null, null, null);
1728
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1729
+ return callback(null, errorObj);
1730
+ }
1731
+
1732
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1733
+ // return the response
1734
+ return callback(irReturnData, null);
1735
+ });
1736
+ } catch (ex) {
1737
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1738
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1739
+ return callback(null, errorObj);
1740
+ }
1741
+ }
1742
+
1743
+ /**
1744
+ * @function targetGroupCreateGroup
1745
+ * @pronghornType method
1746
+ * @name targetGroupCreateGroup
1747
+ * @summary Create new target group
1748
+ *
1749
+ * @param {object} [body] - Target group details
1750
+ * @param {getCallback} callback - a callback function to return the result
1751
+ * @return {object} results - An object containing the response of the action
1752
+ *
1753
+ * @route {POST} /targetGroupCreateGroup
1754
+ * @roles admin
1755
+ * @task true
1756
+ */
1757
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1758
+ targetGroupCreateGroup(body, callback) {
1759
+ const meth = 'adapter-targetGroupCreateGroup';
1760
+ const origin = `${this.id}-${meth}`;
1761
+ log.trace(origin);
1762
+
1763
+ if (this.suspended && this.suspendMode === 'error') {
1764
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1765
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1766
+ return callback(null, errorObj);
1767
+ }
1768
+
1769
+ /* HERE IS WHERE YOU VALIDATE DATA */
1770
+
1771
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1772
+ const queryParamsAvailable = {};
1773
+ const queryParams = {};
1774
+ const pathVars = [];
1775
+ const bodyVars = body;
1776
+
1777
+ // loop in template. long callback arg name to avoid identifier conflicts
1778
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1779
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1780
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1781
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1782
+ }
1783
+ });
1784
+
1785
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1786
+ // see adapter code documentation for more information on the request object's fields
1787
+ const reqObj = {
1788
+ payload: bodyVars,
1789
+ uriPathVars: pathVars,
1790
+ uriQuery: queryParams
1791
+ };
1792
+
1793
+ try {
1794
+ // Make the call -
1795
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1796
+ return this.requestHandlerInst.identifyRequest('NCEGroupManagement', 'targetGroupCreateGroup', reqObj, true, (irReturnData, irReturnError) => {
1797
+ // if we received an error or their is no response on the results
1798
+ // return an error
1799
+ if (irReturnError) {
1800
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1801
+ return callback(null, irReturnError);
1802
+ }
1803
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1804
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['targetGroupCreateGroup'], null, null, null);
1805
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1806
+ return callback(null, errorObj);
1807
+ }
1808
+
1809
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1810
+ // return the response
1811
+ return callback(irReturnData, null);
1812
+ });
1813
+ } catch (ex) {
1814
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1815
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1816
+ return callback(null, errorObj);
1817
+ }
1818
+ }
1819
+
1820
+ /**
1821
+ * @function targetGroupUpdateGroupGroupID
1822
+ * @pronghornType method
1823
+ * @name targetGroupUpdateGroupGroupID
1824
+ * @summary Update target group
1825
+ *
1826
+ * @param {string} groupId - Group id
1827
+ * @param {object} [body] - Target group details
1828
+ * @param {getCallback} callback - a callback function to return the result
1829
+ * @return {object} results - An object containing the response of the action
1830
+ *
1831
+ * @route {POST} /targetGroupUpdateGroupGroupID
1832
+ * @roles admin
1833
+ * @task true
1834
+ */
1835
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1836
+ targetGroupUpdateGroupGroupID(groupId, body, callback) {
1837
+ const meth = 'adapter-targetGroupUpdateGroupGroupID';
1838
+ const origin = `${this.id}-${meth}`;
1839
+ log.trace(origin);
1840
+
1841
+ if (this.suspended && this.suspendMode === 'error') {
1842
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1843
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1844
+ return callback(null, errorObj);
1845
+ }
1846
+
1847
+ /* HERE IS WHERE YOU VALIDATE DATA */
1848
+ if (groupId === undefined || groupId === null || groupId === '') {
1849
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['groupId'], null, null, null);
1850
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1851
+ return callback(null, errorObj);
1852
+ }
1853
+
1854
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1855
+ const queryParamsAvailable = {};
1856
+ const queryParams = {};
1857
+ const pathVars = [groupId];
1858
+ const bodyVars = body;
1859
+
1860
+ // loop in template. long callback arg name to avoid identifier conflicts
1861
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1862
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1863
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1864
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1865
+ }
1866
+ });
1867
+
1868
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1869
+ // see adapter code documentation for more information on the request object's fields
1870
+ const reqObj = {
1871
+ payload: bodyVars,
1872
+ uriPathVars: pathVars,
1873
+ uriQuery: queryParams
1874
+ };
1875
+
1876
+ try {
1877
+ // Make the call -
1878
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1879
+ return this.requestHandlerInst.identifyRequest('NCEGroupManagement', 'targetGroupUpdateGroupGroupID', reqObj, false, (irReturnData, irReturnError) => {
1880
+ // if we received an error or their is no response on the results
1881
+ // return an error
1882
+ if (irReturnError) {
1883
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1884
+ return callback(null, irReturnError);
1885
+ }
1886
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1887
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['targetGroupUpdateGroupGroupID'], null, null, null);
1888
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1889
+ return callback(null, errorObj);
1890
+ }
1891
+
1892
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1893
+ // return the response
1894
+ return callback(irReturnData, null);
1895
+ });
1896
+ } catch (ex) {
1897
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1898
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1899
+ return callback(null, errorObj);
1900
+ }
1901
+ }
1902
+
1903
+ /**
1904
+ * @function deleteTargetGroupGroupId
1905
+ * @pronghornType method
1906
+ * @name deleteTargetGroupGroupId
1907
+ * @summary Delete target group by id
1908
+ *
1909
+ * @param {string} groupId - Group id
1910
+ * @param {getCallback} callback - a callback function to return the result
1911
+ * @return {object} results - An object containing the response of the action
1912
+ *
1913
+ * @route {POST} /deleteTargetGroupGroupId
1914
+ * @roles admin
1915
+ * @task true
1916
+ */
1917
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1918
+ deleteTargetGroupGroupId(groupId, callback) {
1919
+ const meth = 'adapter-deleteTargetGroupGroupId';
1920
+ const origin = `${this.id}-${meth}`;
1921
+ log.trace(origin);
1922
+
1923
+ if (this.suspended && this.suspendMode === 'error') {
1924
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1925
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1926
+ return callback(null, errorObj);
1927
+ }
1928
+
1929
+ /* HERE IS WHERE YOU VALIDATE DATA */
1930
+ if (groupId === undefined || groupId === null || groupId === '') {
1931
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['groupId'], null, null, null);
1932
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1933
+ return callback(null, errorObj);
1934
+ }
1935
+
1936
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1937
+ const queryParamsAvailable = {};
1938
+ const queryParams = {};
1939
+ const pathVars = [groupId];
1940
+ const bodyVars = {};
1941
+
1942
+ // loop in template. long callback arg name to avoid identifier conflicts
1943
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1944
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1945
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1946
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1947
+ }
1948
+ });
1949
+
1950
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1951
+ // see adapter code documentation for more information on the request object's fields
1952
+ const reqObj = {
1953
+ payload: bodyVars,
1954
+ uriPathVars: pathVars,
1955
+ uriQuery: queryParams
1956
+ };
1957
+
1958
+ try {
1959
+ // Make the call -
1960
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1961
+ return this.requestHandlerInst.identifyRequest('NCEGroupManagement', 'deleteTargetGroupGroupId', reqObj, false, (irReturnData, irReturnError) => {
1962
+ // if we received an error or their is no response on the results
1963
+ // return an error
1964
+ if (irReturnError) {
1965
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1966
+ return callback(null, irReturnError);
1967
+ }
1968
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1969
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteTargetGroupGroupId'], null, null, null);
1970
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1971
+ return callback(null, errorObj);
1972
+ }
1973
+
1974
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1975
+ // return the response
1976
+ return callback(irReturnData, null);
1977
+ });
1978
+ } catch (ex) {
1979
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1980
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1981
+ return callback(null, errorObj);
1982
+ }
1983
+ }
1984
+
1985
+ /**
1986
+ * @function getTaskManagementTaskExecutions
1987
+ * @pronghornType method
1988
+ * @name getTaskManagementTaskExecutions
1989
+ * @summary Get all tasks executions
1990
+ *
1991
+ * @param {getCallback} callback - a callback function to return the result
1992
+ * @return {object} results - An object containing the response of the action
1993
+ *
1994
+ * @route {GET} /getTaskManagementTaskExecutions
1995
+ * @roles admin
1996
+ * @task true
1997
+ */
1998
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1999
+ getTaskManagementTaskExecutions(callback) {
2000
+ const meth = 'adapter-getTaskManagementTaskExecutions';
2001
+ const origin = `${this.id}-${meth}`;
2002
+ log.trace(origin);
2003
+
2004
+ if (this.suspended && this.suspendMode === 'error') {
2005
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2006
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2007
+ return callback(null, errorObj);
2008
+ }
2009
+
2010
+ /* HERE IS WHERE YOU VALIDATE DATA */
2011
+
2012
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2013
+ const queryParamsAvailable = {};
2014
+ const queryParams = {};
2015
+ const pathVars = [];
2016
+ const bodyVars = {};
2017
+
2018
+ // loop in template. long callback arg name to avoid identifier conflicts
2019
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2020
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2021
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2022
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2023
+ }
2024
+ });
2025
+
2026
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2027
+ // see adapter code documentation for more information on the request object's fields
2028
+ const reqObj = {
2029
+ payload: bodyVars,
2030
+ uriPathVars: pathVars,
2031
+ uriQuery: queryParams
2032
+ };
2033
+
2034
+ try {
2035
+ // Make the call -
2036
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2037
+ return this.requestHandlerInst.identifyRequest('TaskManagement', 'getTaskManagementTaskExecutions', reqObj, true, (irReturnData, irReturnError) => {
2038
+ // if we received an error or their is no response on the results
2039
+ // return an error
2040
+ if (irReturnError) {
2041
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2042
+ return callback(null, irReturnError);
2043
+ }
2044
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2045
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getTaskManagementTaskExecutions'], null, null, null);
2046
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2047
+ return callback(null, errorObj);
2048
+ }
2049
+
2050
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2051
+ // return the response
2052
+ return callback(irReturnData, null);
2053
+ });
2054
+ } catch (ex) {
2055
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2056
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2057
+ return callback(null, errorObj);
2058
+ }
2059
+ }
2060
+
2061
+ /**
2062
+ * @function getTaskManagementTasks
2063
+ * @pronghornType method
2064
+ * @name getTaskManagementTasks
2065
+ * @summary Get all tasks
2066
+ *
2067
+ * @param {getCallback} callback - a callback function to return the result
2068
+ * @return {object} results - An object containing the response of the action
2069
+ *
2070
+ * @route {GET} /getTaskManagementTasks
2071
+ * @roles admin
2072
+ * @task true
2073
+ */
2074
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2075
+ getTaskManagementTasks(callback) {
2076
+ const meth = 'adapter-getTaskManagementTasks';
2077
+ const origin = `${this.id}-${meth}`;
2078
+ log.trace(origin);
2079
+
2080
+ if (this.suspended && this.suspendMode === 'error') {
2081
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2082
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2083
+ return callback(null, errorObj);
2084
+ }
2085
+
2086
+ /* HERE IS WHERE YOU VALIDATE DATA */
2087
+
2088
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2089
+ const queryParamsAvailable = {};
2090
+ const queryParams = {};
2091
+ const pathVars = [];
2092
+ const bodyVars = {};
2093
+
2094
+ // loop in template. long callback arg name to avoid identifier conflicts
2095
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2096
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2097
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2098
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2099
+ }
2100
+ });
2101
+
2102
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2103
+ // see adapter code documentation for more information on the request object's fields
2104
+ const reqObj = {
2105
+ payload: bodyVars,
2106
+ uriPathVars: pathVars,
2107
+ uriQuery: queryParams
2108
+ };
2109
+
2110
+ try {
2111
+ // Make the call -
2112
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2113
+ return this.requestHandlerInst.identifyRequest('TaskManagement', 'getTaskManagementTasks', reqObj, true, (irReturnData, irReturnError) => {
2114
+ // if we received an error or their is no response on the results
2115
+ // return an error
2116
+ if (irReturnError) {
2117
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2118
+ return callback(null, irReturnError);
2119
+ }
2120
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2121
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getTaskManagementTasks'], null, null, null);
2122
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2123
+ return callback(null, errorObj);
2124
+ }
2125
+
2126
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2127
+ // return the response
2128
+ return callback(irReturnData, null);
2129
+ });
2130
+ } catch (ex) {
2131
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2132
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2133
+ return callback(null, errorObj);
2134
+ }
2135
+ }
2136
+
2137
+ /**
2138
+ * @function postTaskManagementCreateTask
2139
+ * @pronghornType method
2140
+ * @name postTaskManagementCreateTask
2141
+ * @summary Create new task
2142
+ *
2143
+ * @param {object} [body] - Task details
2144
+ * @param {getCallback} callback - a callback function to return the result
2145
+ * @return {object} results - An object containing the response of the action
2146
+ *
2147
+ * @route {POST} /postTaskManagementCreateTask
2148
+ * @roles admin
2149
+ * @task true
2150
+ */
2151
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2152
+ postTaskManagementCreateTask(body, callback) {
2153
+ const meth = 'adapter-postTaskManagementCreateTask';
2154
+ const origin = `${this.id}-${meth}`;
2155
+ log.trace(origin);
2156
+
2157
+ if (this.suspended && this.suspendMode === 'error') {
2158
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2159
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2160
+ return callback(null, errorObj);
2161
+ }
2162
+
2163
+ /* HERE IS WHERE YOU VALIDATE DATA */
2164
+
2165
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2166
+ const queryParamsAvailable = {};
2167
+ const queryParams = {};
2168
+ const pathVars = [];
2169
+ const bodyVars = body;
2170
+
2171
+ // loop in template. long callback arg name to avoid identifier conflicts
2172
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2173
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2174
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2175
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2176
+ }
2177
+ });
2178
+
2179
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2180
+ // see adapter code documentation for more information on the request object's fields
2181
+ const reqObj = {
2182
+ payload: bodyVars,
2183
+ uriPathVars: pathVars,
2184
+ uriQuery: queryParams
2185
+ };
2186
+
2187
+ try {
2188
+ // Make the call -
2189
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2190
+ return this.requestHandlerInst.identifyRequest('TaskManagement', 'postTaskManagementCreateTask', reqObj, true, (irReturnData, irReturnError) => {
2191
+ // if we received an error or their is no response on the results
2192
+ // return an error
2193
+ if (irReturnError) {
2194
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2195
+ return callback(null, irReturnError);
2196
+ }
2197
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2198
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postTaskManagementCreateTask'], null, null, null);
2199
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2200
+ return callback(null, errorObj);
2201
+ }
2202
+
2203
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2204
+ // return the response
2205
+ return callback(irReturnData, null);
2206
+ });
2207
+ } catch (ex) {
2208
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2209
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2210
+ return callback(null, errorObj);
2211
+ }
2212
+ }
2213
+
2214
+ /**
2215
+ * @function putTaskManagementUpdateTask
2216
+ * @pronghornType method
2217
+ * @name putTaskManagementUpdateTask
2218
+ * @summary Update task
2219
+ *
2220
+ * @param {string} taskId - Task id
2221
+ * @param {object} [body] - Task details
2222
+ * @param {getCallback} callback - a callback function to return the result
2223
+ * @return {object} results - An object containing the response of the action
2224
+ *
2225
+ * @route {POST} /putTaskManagementUpdateTask
2226
+ * @roles admin
2227
+ * @task true
2228
+ */
2229
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2230
+ putTaskManagementUpdateTask(taskId, body, callback) {
2231
+ const meth = 'adapter-putTaskManagementUpdateTask';
2232
+ const origin = `${this.id}-${meth}`;
2233
+ log.trace(origin);
2234
+
2235
+ if (this.suspended && this.suspendMode === 'error') {
2236
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2237
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2238
+ return callback(null, errorObj);
2239
+ }
2240
+
2241
+ /* HERE IS WHERE YOU VALIDATE DATA */
2242
+ if (taskId === undefined || taskId === null || taskId === '') {
2243
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['taskId'], null, null, null);
2244
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2245
+ return callback(null, errorObj);
2246
+ }
2247
+
2248
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2249
+ const queryParamsAvailable = {};
2250
+ const queryParams = {};
2251
+ const pathVars = [taskId];
2252
+ const bodyVars = body;
2253
+
2254
+ // loop in template. long callback arg name to avoid identifier conflicts
2255
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2256
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2257
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2258
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2259
+ }
2260
+ });
2261
+
2262
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2263
+ // see adapter code documentation for more information on the request object's fields
2264
+ const reqObj = {
2265
+ payload: bodyVars,
2266
+ uriPathVars: pathVars,
2267
+ uriQuery: queryParams
2268
+ };
2269
+
2270
+ try {
2271
+ // Make the call -
2272
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2273
+ return this.requestHandlerInst.identifyRequest('TaskManagement', 'putTaskManagementUpdateTask', reqObj, false, (irReturnData, irReturnError) => {
2274
+ // if we received an error or their is no response on the results
2275
+ // return an error
2276
+ if (irReturnError) {
2277
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2278
+ return callback(null, irReturnError);
2279
+ }
2280
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2281
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['putTaskManagementUpdateTask'], null, null, null);
2282
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2283
+ return callback(null, errorObj);
2284
+ }
2285
+
2286
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2287
+ // return the response
2288
+ return callback(irReturnData, null);
2289
+ });
2290
+ } catch (ex) {
2291
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2292
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2293
+ return callback(null, errorObj);
2294
+ }
2295
+ }
2296
+
2297
+ /**
2298
+ * @function postTaskManagementExecuteTask
2299
+ * @pronghornType method
2300
+ * @name postTaskManagementExecuteTask
2301
+ * @summary Execute task
2302
+ *
2303
+ * @param {string} taskId - Task id
2304
+ * @param {getCallback} callback - a callback function to return the result
2305
+ * @return {object} results - An object containing the response of the action
2306
+ *
2307
+ * @route {POST} /postTaskManagementExecuteTask
2308
+ * @roles admin
2309
+ * @task true
2310
+ */
2311
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2312
+ postTaskManagementExecuteTask(taskId, callback) {
2313
+ const meth = 'adapter-postTaskManagementExecuteTask';
2314
+ const origin = `${this.id}-${meth}`;
2315
+ log.trace(origin);
2316
+
2317
+ if (this.suspended && this.suspendMode === 'error') {
2318
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2319
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2320
+ return callback(null, errorObj);
2321
+ }
2322
+
2323
+ /* HERE IS WHERE YOU VALIDATE DATA */
2324
+ if (taskId === undefined || taskId === null || taskId === '') {
2325
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['taskId'], null, null, null);
2326
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2327
+ return callback(null, errorObj);
2328
+ }
2329
+
2330
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2331
+ const queryParamsAvailable = {};
2332
+ const queryParams = {};
2333
+ const pathVars = [taskId];
2334
+ const bodyVars = {};
2335
+
2336
+ // loop in template. long callback arg name to avoid identifier conflicts
2337
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2338
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2339
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2340
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2341
+ }
2342
+ });
2343
+
2344
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2345
+ // see adapter code documentation for more information on the request object's fields
2346
+ const reqObj = {
2347
+ payload: bodyVars,
2348
+ uriPathVars: pathVars,
2349
+ uriQuery: queryParams
2350
+ };
2351
+
2352
+ try {
2353
+ // Make the call -
2354
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2355
+ return this.requestHandlerInst.identifyRequest('TaskManagement', 'postTaskManagementExecuteTask', reqObj, true, (irReturnData, irReturnError) => {
2356
+ // if we received an error or their is no response on the results
2357
+ // return an error
2358
+ if (irReturnError) {
2359
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2360
+ return callback(null, irReturnError);
2361
+ }
2362
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2363
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postTaskManagementExecuteTask'], null, null, null);
2364
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2365
+ return callback(null, errorObj);
2366
+ }
2367
+
2368
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2369
+ // return the response
2370
+ return callback(irReturnData, null);
2371
+ });
2372
+ } catch (ex) {
2373
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2374
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2375
+ return callback(null, errorObj);
2376
+ }
2377
+ }
2378
+
2379
+ /**
2380
+ * @function postTaskManagementCancelTask
2381
+ * @pronghornType method
2382
+ * @name postTaskManagementCancelTask
2383
+ * @summary Cancel running task
2384
+ *
2385
+ * @param {string} taskExecutionId - Task execution id
2386
+ * @param {getCallback} callback - a callback function to return the result
2387
+ * @return {object} results - An object containing the response of the action
2388
+ *
2389
+ * @route {POST} /postTaskManagementCancelTask
2390
+ * @roles admin
2391
+ * @task true
2392
+ */
2393
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2394
+ postTaskManagementCancelTask(taskExecutionId, callback) {
2395
+ const meth = 'adapter-postTaskManagementCancelTask';
2396
+ const origin = `${this.id}-${meth}`;
2397
+ log.trace(origin);
2398
+
2399
+ if (this.suspended && this.suspendMode === 'error') {
2400
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2401
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2402
+ return callback(null, errorObj);
2403
+ }
2404
+
2405
+ /* HERE IS WHERE YOU VALIDATE DATA */
2406
+ if (taskExecutionId === undefined || taskExecutionId === null || taskExecutionId === '') {
2407
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['taskExecutionId'], null, null, null);
2408
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2409
+ return callback(null, errorObj);
2410
+ }
2411
+
2412
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2413
+ const queryParamsAvailable = {};
2414
+ const queryParams = {};
2415
+ const pathVars = [taskExecutionId];
2416
+ const bodyVars = {};
2417
+
2418
+ // loop in template. long callback arg name to avoid identifier conflicts
2419
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2420
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2421
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2422
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2423
+ }
2424
+ });
2425
+
2426
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2427
+ // see adapter code documentation for more information on the request object's fields
2428
+ const reqObj = {
2429
+ payload: bodyVars,
2430
+ uriPathVars: pathVars,
2431
+ uriQuery: queryParams
2432
+ };
2433
+
2434
+ try {
2435
+ // Make the call -
2436
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2437
+ return this.requestHandlerInst.identifyRequest('TaskManagement', 'postTaskManagementCancelTask', reqObj, true, (irReturnData, irReturnError) => {
2438
+ // if we received an error or their is no response on the results
2439
+ // return an error
2440
+ if (irReturnError) {
2441
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2442
+ return callback(null, irReturnError);
2443
+ }
2444
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2445
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postTaskManagementCancelTask'], null, null, null);
2446
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2447
+ return callback(null, errorObj);
2448
+ }
2449
+
2450
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2451
+ // return the response
2452
+ return callback(irReturnData, null);
2453
+ });
2454
+ } catch (ex) {
2455
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2456
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2457
+ return callback(null, errorObj);
2458
+ }
2459
+ }
2460
+
2461
+ /**
2462
+ * @function taskManagementDeleteTask
2463
+ * @pronghornType method
2464
+ * @name taskManagementDeleteTask
2465
+ * @summary Delete task by task id
2466
+ *
2467
+ * @param {string} taskId - Task id
2468
+ * @param {getCallback} callback - a callback function to return the result
2469
+ * @return {object} results - An object containing the response of the action
2470
+ *
2471
+ * @route {POST} /taskManagementDeleteTask
2472
+ * @roles admin
2473
+ * @task true
2474
+ */
2475
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2476
+ taskManagementDeleteTask(taskId, callback) {
2477
+ const meth = 'adapter-taskManagementDeleteTask';
2478
+ const origin = `${this.id}-${meth}`;
2479
+ log.trace(origin);
2480
+
2481
+ if (this.suspended && this.suspendMode === 'error') {
2482
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2483
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2484
+ return callback(null, errorObj);
2485
+ }
2486
+
2487
+ /* HERE IS WHERE YOU VALIDATE DATA */
2488
+ if (taskId === undefined || taskId === null || taskId === '') {
2489
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['taskId'], null, null, null);
2490
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2491
+ return callback(null, errorObj);
2492
+ }
2493
+
2494
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2495
+ const queryParamsAvailable = {};
2496
+ const queryParams = {};
2497
+ const pathVars = [taskId];
2498
+ const bodyVars = {};
2499
+
2500
+ // loop in template. long callback arg name to avoid identifier conflicts
2501
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2502
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2503
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2504
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2505
+ }
2506
+ });
2507
+
2508
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2509
+ // see adapter code documentation for more information on the request object's fields
2510
+ const reqObj = {
2511
+ payload: bodyVars,
2512
+ uriPathVars: pathVars,
2513
+ uriQuery: queryParams
2514
+ };
2515
+
2516
+ try {
2517
+ // Make the call -
2518
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2519
+ return this.requestHandlerInst.identifyRequest('TaskManagement', 'taskManagementDeleteTask', reqObj, false, (irReturnData, irReturnError) => {
2520
+ // if we received an error or their is no response on the results
2521
+ // return an error
2522
+ if (irReturnError) {
2523
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2524
+ return callback(null, irReturnError);
2525
+ }
2526
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2527
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['taskManagementDeleteTask'], null, null, null);
2528
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2529
+ return callback(null, errorObj);
2530
+ }
2531
+
2532
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2533
+ // return the response
2534
+ return callback(irReturnData, null);
2535
+ });
2536
+ } catch (ex) {
2537
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2538
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2539
+ return callback(null, errorObj);
2540
+ }
2541
+ }
2542
+
2543
+ /**
2544
+ * @function getFaultManagementAlarmConfiguration
2545
+ * @pronghornType method
2546
+ * @name getFaultManagementAlarmConfiguration
2547
+ * @summary Get alarm configuration by alarm name.
2548
+ *
2549
+ * @param {string} alarmName - Alarm name
2550
+ * @param {getCallback} callback - a callback function to return the result
2551
+ * @return {object} results - An object containing the response of the action
2552
+ *
2553
+ * @route {POST} /getFaultManagementAlarmConfiguration
2554
+ * @roles admin
2555
+ * @task true
2556
+ */
2557
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2558
+ getFaultManagementAlarmConfiguration(alarmName, callback) {
2559
+ const meth = 'adapter-getFaultManagementAlarmConfiguration';
2560
+ const origin = `${this.id}-${meth}`;
2561
+ log.trace(origin);
2562
+
2563
+ if (this.suspended && this.suspendMode === 'error') {
2564
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2565
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2566
+ return callback(null, errorObj);
2567
+ }
2568
+
2569
+ /* HERE IS WHERE YOU VALIDATE DATA */
2570
+ if (alarmName === undefined || alarmName === null || alarmName === '') {
2571
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['alarmName'], null, null, null);
2572
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2573
+ return callback(null, errorObj);
2574
+ }
2575
+
2576
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2577
+ const queryParamsAvailable = {};
2578
+ const queryParams = {};
2579
+ const pathVars = [alarmName];
2580
+ const bodyVars = {};
2581
+
2582
+ // loop in template. long callback arg name to avoid identifier conflicts
2583
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2584
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2585
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2586
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2587
+ }
2588
+ });
2589
+
2590
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2591
+ // see adapter code documentation for more information on the request object's fields
2592
+ const reqObj = {
2593
+ payload: bodyVars,
2594
+ uriPathVars: pathVars,
2595
+ uriQuery: queryParams
2596
+ };
2597
+
2598
+ try {
2599
+ // Make the call -
2600
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2601
+ return this.requestHandlerInst.identifyRequest('MonitoringFaultManagementAlarms', 'getFaultManagementAlarmConfiguration', reqObj, true, (irReturnData, irReturnError) => {
2602
+ // if we received an error or their is no response on the results
2603
+ // return an error
2604
+ if (irReturnError) {
2605
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2606
+ return callback(null, irReturnError);
2607
+ }
2608
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2609
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getFaultManagementAlarmConfiguration'], null, null, null);
2610
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2611
+ return callback(null, errorObj);
2612
+ }
2613
+
2614
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2615
+ // return the response
2616
+ return callback(irReturnData, null);
2617
+ });
2618
+ } catch (ex) {
2619
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2620
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2621
+ return callback(null, errorObj);
2622
+ }
2623
+ }
2624
+
2625
+ /**
2626
+ * @function getAllFaultManagementAlarmConfiguration
2627
+ * @pronghornType method
2628
+ * @name getAllFaultManagementAlarmConfiguration
2629
+ * @summary Get all alarms configuration.
2630
+ *
2631
+ * @param {getCallback} callback - a callback function to return the result
2632
+ * @return {object} results - An object containing the response of the action
2633
+ *
2634
+ * @route {GET} /getAllFaultManagementAlarmConfiguration
2635
+ * @roles admin
2636
+ * @task true
2637
+ */
2638
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2639
+ getAllFaultManagementAlarmConfiguration(callback) {
2640
+ const meth = 'adapter-getAllFaultManagementAlarmConfiguration';
2641
+ const origin = `${this.id}-${meth}`;
2642
+ log.trace(origin);
2643
+
2644
+ if (this.suspended && this.suspendMode === 'error') {
2645
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2646
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2647
+ return callback(null, errorObj);
2648
+ }
2649
+
2650
+ /* HERE IS WHERE YOU VALIDATE DATA */
2651
+
2652
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2653
+ const queryParamsAvailable = {};
2654
+ const queryParams = {};
2655
+ const pathVars = [];
2656
+ const bodyVars = {};
2657
+
2658
+ // loop in template. long callback arg name to avoid identifier conflicts
2659
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2660
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2661
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2662
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2663
+ }
2664
+ });
2665
+
2666
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2667
+ // see adapter code documentation for more information on the request object's fields
2668
+ const reqObj = {
2669
+ payload: bodyVars,
2670
+ uriPathVars: pathVars,
2671
+ uriQuery: queryParams
2672
+ };
2673
+
2674
+ try {
2675
+ // Make the call -
2676
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2677
+ return this.requestHandlerInst.identifyRequest('MonitoringFaultManagementAlarms', 'getAllFaultManagementAlarmConfiguration', reqObj, true, (irReturnData, irReturnError) => {
2678
+ // if we received an error or their is no response on the results
2679
+ // return an error
2680
+ if (irReturnError) {
2681
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2682
+ return callback(null, irReturnError);
2683
+ }
2684
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2685
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllFaultManagementAlarmConfiguration'], null, null, null);
2686
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2687
+ return callback(null, errorObj);
2688
+ }
2689
+
2690
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2691
+ // return the response
2692
+ return callback(irReturnData, null);
2693
+ });
2694
+ } catch (ex) {
2695
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2696
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2697
+ return callback(null, errorObj);
2698
+ }
2699
+ }
2700
+
2701
+ /**
2702
+ * @function getAllFaultManagementActiveAlarms
2703
+ * @pronghornType method
2704
+ * @name getAllFaultManagementActiveAlarms
2705
+ * @summary Get all active alarms.
2706
+ *
2707
+ * @param {getCallback} callback - a callback function to return the result
2708
+ * @return {object} results - An object containing the response of the action
2709
+ *
2710
+ * @route {GET} /getAllFaultManagementActiveAlarms
2711
+ * @roles admin
2712
+ * @task true
2713
+ */
2714
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2715
+ getAllFaultManagementActiveAlarms(callback) {
2716
+ const meth = 'adapter-getAllFaultManagementActiveAlarms';
2717
+ const origin = `${this.id}-${meth}`;
2718
+ log.trace(origin);
2719
+
2720
+ if (this.suspended && this.suspendMode === 'error') {
2721
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2722
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2723
+ return callback(null, errorObj);
2724
+ }
2725
+
2726
+ /* HERE IS WHERE YOU VALIDATE DATA */
2727
+
2728
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2729
+ const queryParamsAvailable = {};
2730
+ const queryParams = {};
2731
+ const pathVars = [];
2732
+ const bodyVars = {};
2733
+
2734
+ // loop in template. long callback arg name to avoid identifier conflicts
2735
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2736
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2737
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2738
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2739
+ }
2740
+ });
2741
+
2742
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2743
+ // see adapter code documentation for more information on the request object's fields
2744
+ const reqObj = {
2745
+ payload: bodyVars,
2746
+ uriPathVars: pathVars,
2747
+ uriQuery: queryParams
2748
+ };
2749
+
2750
+ try {
2751
+ // Make the call -
2752
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2753
+ return this.requestHandlerInst.identifyRequest('MonitoringFaultManagementActiveAlarms', 'getAllFaultManagementActiveAlarms', reqObj, true, (irReturnData, irReturnError) => {
2754
+ // if we received an error or their is no response on the results
2755
+ // return an error
2756
+ if (irReturnError) {
2757
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2758
+ return callback(null, irReturnError);
2759
+ }
2760
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2761
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllFaultManagementActiveAlarms'], null, null, null);
2762
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2763
+ return callback(null, errorObj);
2764
+ }
2765
+
2766
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2767
+ // return the response
2768
+ return callback(irReturnData, null);
2769
+ });
2770
+ } catch (ex) {
2771
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2772
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2773
+ return callback(null, errorObj);
2774
+ }
2775
+ }
2776
+ }
2777
+
2778
+ module.exports = DriveNetsNetworkOrchestrator;