@itentialopensource/adapter-nokia_nsp_device_administrator 0.1.4

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 (70) 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 +326 -0
  7. package/CHANGELOG.md +32 -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 +3059 -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/NeControlDiscovery/action.json +125 -0
  28. package/entities/NeControlDiscovery/schema.json +24 -0
  29. package/entities/NeControlDiscoveryRule/action.json +167 -0
  30. package/entities/NeControlDiscoveryRule/schema.json +26 -0
  31. package/entities/NeMediationPolicy/action.json +127 -0
  32. package/entities/NeMediationPolicy/schema.json +24 -0
  33. package/entities/NeProtocol/action.json +64 -0
  34. package/entities/NeProtocol/schema.json +21 -0
  35. package/entities/NeUser/action.json +64 -0
  36. package/entities/NeUser/schema.json +21 -0
  37. package/error.json +190 -0
  38. package/package.json +86 -0
  39. package/pronghorn.json +1616 -0
  40. package/propertiesDecorators.json +14 -0
  41. package/propertiesSchema.json +1248 -0
  42. package/refs?service=git-upload-pack +0 -0
  43. package/report/adapterInfo.json +10 -0
  44. package/report/creationReport.json +400 -0
  45. package/report/device-administrator-22.11-v1.json-OpenApi3Json.json +1358 -0
  46. package/sampleProperties.json +195 -0
  47. package/test/integration/adapterTestBasicGet.js +83 -0
  48. package/test/integration/adapterTestConnectivity.js +93 -0
  49. package/test/integration/adapterTestIntegration.js +1018 -0
  50. package/test/unit/adapterBaseTestUnit.js +949 -0
  51. package/test/unit/adapterTestUnit.js +2150 -0
  52. package/utils/adapterInfo.js +206 -0
  53. package/utils/addAuth.js +94 -0
  54. package/utils/artifactize.js +146 -0
  55. package/utils/basicGet.js +50 -0
  56. package/utils/checkMigrate.js +63 -0
  57. package/utils/entitiesToDB.js +178 -0
  58. package/utils/findPath.js +74 -0
  59. package/utils/methodDocumentor.js +225 -0
  60. package/utils/modify.js +154 -0
  61. package/utils/packModificationScript.js +35 -0
  62. package/utils/patches2bundledDeps.js +90 -0
  63. package/utils/pre-commit.sh +32 -0
  64. package/utils/removeHooks.js +20 -0
  65. package/utils/setup.js +33 -0
  66. package/utils/tbScript.js +246 -0
  67. package/utils/tbUtils.js +490 -0
  68. package/utils/testRunner.js +298 -0
  69. package/utils/troubleshootingAdapter.js +195 -0
  70. package/workflows/README.md +3 -0
package/adapter.js ADDED
@@ -0,0 +1,3059 @@
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 Nokia_nsp_device_administrator
17
+ */
18
+
19
+ /* GENERAL ADAPTER FUNCTIONS */
20
+ class NokiaNspDeviceAdministrator extends AdapterBaseCl {
21
+ /**
22
+ * NokiaNspDeviceAdministrator 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 alarmDictionaryCheckerUsingPOST
846
+ * @pronghornType method
847
+ * @name alarmDictionaryCheckerUsingPOST
848
+ * @summary alarmDictionaryCheckerUsingPOST
849
+ *
850
+ * @param {string} alarmDictName - alarmDictName
851
+ * @param {string} body - aInAlarmDictionaryCheckerInfo
852
+ * @param {getCallback} callback - a callback function to return the result
853
+ * @return {object} results - An object containing the response of the action
854
+ *
855
+ * @route {POST} /alarmDictionaryCheckerUsingPOST
856
+ * @roles admin
857
+ * @task true
858
+ */
859
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
860
+ alarmDictionaryCheckerUsingPOST(alarmDictName, body, callback) {
861
+ const meth = 'adapter-alarmDictionaryCheckerUsingPOST';
862
+ const origin = `${this.id}-${meth}`;
863
+ log.trace(origin);
864
+
865
+ if (this.suspended && this.suspendMode === 'error') {
866
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
867
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
868
+ return callback(null, errorObj);
869
+ }
870
+
871
+ /* HERE IS WHERE YOU VALIDATE DATA */
872
+ if (alarmDictName === undefined || alarmDictName === null || alarmDictName === '') {
873
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['alarmDictName'], null, null, null);
874
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
875
+ return callback(null, errorObj);
876
+ }
877
+ if (body === undefined || body === null || body === '') {
878
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
879
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
880
+ return callback(null, errorObj);
881
+ }
882
+
883
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
884
+ const queryParamsAvailable = {};
885
+ const queryParams = {};
886
+ const pathVars = [alarmDictName];
887
+ const bodyVars = { body };
888
+
889
+ // loop in template. long callback arg name to avoid identifier conflicts
890
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
891
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
892
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
893
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
894
+ }
895
+ });
896
+
897
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
898
+ // see adapter code documentation for more information on the request object's fields
899
+ const reqObj = {
900
+ payload: bodyVars,
901
+ uriPathVars: pathVars,
902
+ uriQuery: queryParams
903
+ };
904
+
905
+ try {
906
+ // Make the call -
907
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
908
+ return this.requestHandlerInst.identifyRequest('NeControlDiscovery', 'alarmDictionaryCheckerUsingPOST', reqObj, true, (irReturnData, irReturnError) => {
909
+ // if we received an error or their is no response on the results
910
+ // return an error
911
+ if (irReturnError) {
912
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
913
+ return callback(null, irReturnError);
914
+ }
915
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
916
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['alarmDictionaryCheckerUsingPOST'], null, null, null);
917
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
918
+ return callback(null, errorObj);
919
+ }
920
+
921
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
922
+ // return the response
923
+ return callback(irReturnData, null);
924
+ });
925
+ } catch (ex) {
926
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
927
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
928
+ return callback(null, errorObj);
929
+ }
930
+ }
931
+
932
+ /**
933
+ * @function discoverNesUsingPOST
934
+ * @pronghornType method
935
+ * @name discoverNesUsingPOST
936
+ * @summary discoverNesUsingPOST
937
+ *
938
+ * @param {object} body - discRuleJson
939
+ * @param {getCallback} callback - a callback function to return the result
940
+ * @return {object} results - An object containing the response of the action
941
+ *
942
+ * @route {POST} /discoverNesUsingPOST
943
+ * @roles admin
944
+ * @task true
945
+ */
946
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
947
+ discoverNesUsingPOST(body, callback) {
948
+ const meth = 'adapter-discoverNesUsingPOST';
949
+ const origin = `${this.id}-${meth}`;
950
+ log.trace(origin);
951
+
952
+ if (this.suspended && this.suspendMode === 'error') {
953
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
954
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
955
+ return callback(null, errorObj);
956
+ }
957
+
958
+ /* HERE IS WHERE YOU VALIDATE DATA */
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 = [];
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('NeControlDiscovery', 'discoverNesUsingPOST', reqObj, true, (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', ['discoverNesUsingPOST'], 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 listDiscoveredNesUsingGET
1016
+ * @pronghornType method
1017
+ * @name listDiscoveredNesUsingGET
1018
+ * @summary listDiscoveredNesUsingGET
1019
+ *
1020
+ * @param {getCallback} callback - a callback function to return the result
1021
+ * @return {object} results - An object containing the response of the action
1022
+ *
1023
+ * @route {GET} /listDiscoveredNesUsingGET
1024
+ * @roles admin
1025
+ * @task true
1026
+ */
1027
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1028
+ listDiscoveredNesUsingGET(callback) {
1029
+ const meth = 'adapter-listDiscoveredNesUsingGET';
1030
+ const origin = `${this.id}-${meth}`;
1031
+ log.trace(origin);
1032
+
1033
+ if (this.suspended && this.suspendMode === 'error') {
1034
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1035
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1036
+ return callback(null, errorObj);
1037
+ }
1038
+
1039
+ /* HERE IS WHERE YOU VALIDATE DATA */
1040
+
1041
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1042
+ const queryParamsAvailable = {};
1043
+ const queryParams = {};
1044
+ const pathVars = [];
1045
+ const bodyVars = {};
1046
+
1047
+ // loop in template. long callback arg name to avoid identifier conflicts
1048
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1049
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1050
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1051
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1052
+ }
1053
+ });
1054
+
1055
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1056
+ // see adapter code documentation for more information on the request object's fields
1057
+ const reqObj = {
1058
+ payload: bodyVars,
1059
+ uriPathVars: pathVars,
1060
+ uriQuery: queryParams
1061
+ };
1062
+
1063
+ try {
1064
+ // Make the call -
1065
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1066
+ return this.requestHandlerInst.identifyRequest('NeControlDiscovery', 'listDiscoveredNesUsingGET', reqObj, true, (irReturnData, irReturnError) => {
1067
+ // if we received an error or their is no response on the results
1068
+ // return an error
1069
+ if (irReturnError) {
1070
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1071
+ return callback(null, irReturnError);
1072
+ }
1073
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1074
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['listDiscoveredNesUsingGET'], null, null, null);
1075
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1076
+ return callback(null, errorObj);
1077
+ }
1078
+
1079
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1080
+ // return the response
1081
+ return callback(irReturnData, null);
1082
+ });
1083
+ } catch (ex) {
1084
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1085
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1086
+ return callback(null, errorObj);
1087
+ }
1088
+ }
1089
+
1090
+ /**
1091
+ * @function fullNeResyncUsingPUT
1092
+ * @pronghornType method
1093
+ * @name fullNeResyncUsingPUT
1094
+ * @summary fullNeResyncUsingPUT
1095
+ *
1096
+ * @param {string} fdn - fdn
1097
+ * @param {getCallback} callback - a callback function to return the result
1098
+ * @return {object} results - An object containing the response of the action
1099
+ *
1100
+ * @route {POST} /fullNeResyncUsingPUT
1101
+ * @roles admin
1102
+ * @task true
1103
+ */
1104
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1105
+ fullNeResyncUsingPUT(fdn, callback) {
1106
+ const meth = 'adapter-fullNeResyncUsingPUT';
1107
+ const origin = `${this.id}-${meth}`;
1108
+ log.trace(origin);
1109
+
1110
+ if (this.suspended && this.suspendMode === 'error') {
1111
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1112
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1113
+ return callback(null, errorObj);
1114
+ }
1115
+
1116
+ /* HERE IS WHERE YOU VALIDATE DATA */
1117
+ if (fdn === undefined || fdn === null || fdn === '') {
1118
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
1119
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1120
+ return callback(null, errorObj);
1121
+ }
1122
+
1123
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1124
+ const queryParamsAvailable = {};
1125
+ const queryParams = {};
1126
+ const pathVars = [fdn];
1127
+ const bodyVars = {};
1128
+
1129
+ // loop in template. long callback arg name to avoid identifier conflicts
1130
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1131
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1132
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1133
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1134
+ }
1135
+ });
1136
+
1137
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
1138
+ let thisHeaderData = null;
1139
+ // if the additional headers was passed in as a string parse the json into an object
1140
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
1141
+ try {
1142
+ // parse the additional headers object that was passed in
1143
+ thisHeaderData = JSON.parse(thisHeaderData);
1144
+ } catch (err) {
1145
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
1146
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1147
+ return callback(null, errorObj);
1148
+ }
1149
+ } else if (thisHeaderData === null) {
1150
+ thisHeaderData = { contentType: '' };
1151
+ }
1152
+
1153
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1154
+ // see adapter code documentation for more information on the request object's fields
1155
+ const reqObj = {
1156
+ payload: bodyVars,
1157
+ uriPathVars: pathVars,
1158
+ uriQuery: queryParams,
1159
+ addlHeaders: thisHeaderData
1160
+ };
1161
+
1162
+ try {
1163
+ // Make the call -
1164
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1165
+ return this.requestHandlerInst.identifyRequest('NeControlDiscovery', 'fullNeResyncUsingPUT', reqObj, false, (irReturnData, irReturnError) => {
1166
+ // if we received an error or their is no response on the results
1167
+ // return an error
1168
+ if (irReturnError) {
1169
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1170
+ return callback(null, irReturnError);
1171
+ }
1172
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1173
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['fullNeResyncUsingPUT'], null, null, null);
1174
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1175
+ return callback(null, errorObj);
1176
+ }
1177
+
1178
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1179
+ // return the response
1180
+ return callback(irReturnData, null);
1181
+ });
1182
+ } catch (ex) {
1183
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1184
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1185
+ return callback(null, errorObj);
1186
+ }
1187
+ }
1188
+
1189
+ /**
1190
+ * @function discoverNesUsingPOST1
1191
+ * @pronghornType method
1192
+ * @name discoverNesUsingPOST1
1193
+ * @summary discoverNesUsingPOST_1
1194
+ *
1195
+ * @param {string} fdn - fdn
1196
+ * @param {getCallback} callback - a callback function to return the result
1197
+ * @return {object} results - An object containing the response of the action
1198
+ *
1199
+ * @route {POST} /discoverNesUsingPOST1
1200
+ * @roles admin
1201
+ * @task true
1202
+ */
1203
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1204
+ discoverNesUsingPOST1(fdn, callback) {
1205
+ const meth = 'adapter-discoverNesUsingPOST1';
1206
+ const origin = `${this.id}-${meth}`;
1207
+ log.trace(origin);
1208
+
1209
+ if (this.suspended && this.suspendMode === 'error') {
1210
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1211
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1212
+ return callback(null, errorObj);
1213
+ }
1214
+
1215
+ /* HERE IS WHERE YOU VALIDATE DATA */
1216
+ if (fdn === undefined || fdn === null || fdn === '') {
1217
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
1218
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1219
+ return callback(null, errorObj);
1220
+ }
1221
+
1222
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1223
+ const queryParamsAvailable = {};
1224
+ const queryParams = {};
1225
+ const pathVars = [fdn];
1226
+ const bodyVars = {};
1227
+
1228
+ // loop in template. long callback arg name to avoid identifier conflicts
1229
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1230
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1231
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1232
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1233
+ }
1234
+ });
1235
+
1236
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
1237
+ let thisHeaderData = null;
1238
+ // if the additional headers was passed in as a string parse the json into an object
1239
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
1240
+ try {
1241
+ // parse the additional headers object that was passed in
1242
+ thisHeaderData = JSON.parse(thisHeaderData);
1243
+ } catch (err) {
1244
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
1245
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1246
+ return callback(null, errorObj);
1247
+ }
1248
+ } else if (thisHeaderData === null) {
1249
+ thisHeaderData = { contentType: '' };
1250
+ }
1251
+
1252
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1253
+ // see adapter code documentation for more information on the request object's fields
1254
+ const reqObj = {
1255
+ payload: bodyVars,
1256
+ uriPathVars: pathVars,
1257
+ uriQuery: queryParams,
1258
+ addlHeaders: thisHeaderData
1259
+ };
1260
+
1261
+ try {
1262
+ // Make the call -
1263
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1264
+ return this.requestHandlerInst.identifyRequest('NeControlDiscovery', 'discoverNesUsingPOST1', reqObj, true, (irReturnData, irReturnError) => {
1265
+ // if we received an error or their is no response on the results
1266
+ // return an error
1267
+ if (irReturnError) {
1268
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1269
+ return callback(null, irReturnError);
1270
+ }
1271
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1272
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['discoverNesUsingPOST1'], null, null, null);
1273
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1274
+ return callback(null, errorObj);
1275
+ }
1276
+
1277
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1278
+ // return the response
1279
+ return callback(irReturnData, null);
1280
+ });
1281
+ } catch (ex) {
1282
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1283
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1284
+ return callback(null, errorObj);
1285
+ }
1286
+ }
1287
+
1288
+ /**
1289
+ * @function unmanageNesUsingPUT
1290
+ * @pronghornType method
1291
+ * @name unmanageNesUsingPUT
1292
+ * @summary unmanageNesUsingPUT
1293
+ *
1294
+ * @param {string} fdn - fdn
1295
+ * @param {getCallback} callback - a callback function to return the result
1296
+ * @return {object} results - An object containing the response of the action
1297
+ *
1298
+ * @route {POST} /unmanageNesUsingPUT
1299
+ * @roles admin
1300
+ * @task true
1301
+ */
1302
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1303
+ unmanageNesUsingPUT(fdn, callback) {
1304
+ const meth = 'adapter-unmanageNesUsingPUT';
1305
+ const origin = `${this.id}-${meth}`;
1306
+ log.trace(origin);
1307
+
1308
+ if (this.suspended && this.suspendMode === 'error') {
1309
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1310
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1311
+ return callback(null, errorObj);
1312
+ }
1313
+
1314
+ /* HERE IS WHERE YOU VALIDATE DATA */
1315
+ if (fdn === undefined || fdn === null || fdn === '') {
1316
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
1317
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1318
+ return callback(null, errorObj);
1319
+ }
1320
+
1321
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1322
+ const queryParamsAvailable = {};
1323
+ const queryParams = {};
1324
+ const pathVars = [fdn];
1325
+ const bodyVars = {};
1326
+
1327
+ // loop in template. long callback arg name to avoid identifier conflicts
1328
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1329
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1330
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1331
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1332
+ }
1333
+ });
1334
+
1335
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
1336
+ let thisHeaderData = null;
1337
+ // if the additional headers was passed in as a string parse the json into an object
1338
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
1339
+ try {
1340
+ // parse the additional headers object that was passed in
1341
+ thisHeaderData = JSON.parse(thisHeaderData);
1342
+ } catch (err) {
1343
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
1344
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1345
+ return callback(null, errorObj);
1346
+ }
1347
+ } else if (thisHeaderData === null) {
1348
+ thisHeaderData = { contentType: '' };
1349
+ }
1350
+
1351
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1352
+ // see adapter code documentation for more information on the request object's fields
1353
+ const reqObj = {
1354
+ payload: bodyVars,
1355
+ uriPathVars: pathVars,
1356
+ uriQuery: queryParams,
1357
+ addlHeaders: thisHeaderData
1358
+ };
1359
+
1360
+ try {
1361
+ // Make the call -
1362
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1363
+ return this.requestHandlerInst.identifyRequest('NeControlDiscovery', 'unmanageNesUsingPUT', reqObj, false, (irReturnData, irReturnError) => {
1364
+ // if we received an error or their is no response on the results
1365
+ // return an error
1366
+ if (irReturnError) {
1367
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1368
+ return callback(null, irReturnError);
1369
+ }
1370
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1371
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['unmanageNesUsingPUT'], null, null, null);
1372
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1373
+ return callback(null, errorObj);
1374
+ }
1375
+
1376
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1377
+ // return the response
1378
+ return callback(irReturnData, null);
1379
+ });
1380
+ } catch (ex) {
1381
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1382
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1383
+ return callback(null, errorObj);
1384
+ }
1385
+ }
1386
+
1387
+ /**
1388
+ * @function createUsingPOST
1389
+ * @pronghornType method
1390
+ * @name createUsingPOST
1391
+ * @summary createUsingPOST
1392
+ *
1393
+ * @param {object} body - aInJson
1394
+ * @param {getCallback} callback - a callback function to return the result
1395
+ * @return {object} results - An object containing the response of the action
1396
+ *
1397
+ * @route {POST} /createUsingPOST
1398
+ * @roles admin
1399
+ * @task true
1400
+ */
1401
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1402
+ createUsingPOST(body, callback) {
1403
+ const meth = 'adapter-createUsingPOST';
1404
+ const origin = `${this.id}-${meth}`;
1405
+ log.trace(origin);
1406
+
1407
+ if (this.suspended && this.suspendMode === 'error') {
1408
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1409
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1410
+ return callback(null, errorObj);
1411
+ }
1412
+
1413
+ /* HERE IS WHERE YOU VALIDATE DATA */
1414
+ if (body === undefined || body === null || body === '') {
1415
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1416
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1417
+ return callback(null, errorObj);
1418
+ }
1419
+
1420
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1421
+ const queryParamsAvailable = {};
1422
+ const queryParams = {};
1423
+ const pathVars = [];
1424
+ const bodyVars = body;
1425
+
1426
+ // loop in template. long callback arg name to avoid identifier conflicts
1427
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1428
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1429
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1430
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1431
+ }
1432
+ });
1433
+
1434
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1435
+ // see adapter code documentation for more information on the request object's fields
1436
+ const reqObj = {
1437
+ payload: bodyVars,
1438
+ uriPathVars: pathVars,
1439
+ uriQuery: queryParams
1440
+ };
1441
+
1442
+ try {
1443
+ // Make the call -
1444
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1445
+ return this.requestHandlerInst.identifyRequest('NeControlDiscoveryRule', 'createUsingPOST', reqObj, true, (irReturnData, irReturnError) => {
1446
+ // if we received an error or their is no response on the results
1447
+ // return an error
1448
+ if (irReturnError) {
1449
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1450
+ return callback(null, irReturnError);
1451
+ }
1452
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1453
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createUsingPOST'], null, null, null);
1454
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1455
+ return callback(null, errorObj);
1456
+ }
1457
+
1458
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1459
+ // return the response
1460
+ return callback(irReturnData, null);
1461
+ });
1462
+ } catch (ex) {
1463
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1464
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1465
+ return callback(null, errorObj);
1466
+ }
1467
+ }
1468
+
1469
+ /**
1470
+ * @function addAllUsingPUT
1471
+ * @pronghornType method
1472
+ * @name addAllUsingPUT
1473
+ * @summary addAllUsingPUT
1474
+ *
1475
+ * @param {string} fdn - fdn
1476
+ * @param {object} body - aInJson
1477
+ * @param {getCallback} callback - a callback function to return the result
1478
+ * @return {object} results - An object containing the response of the action
1479
+ *
1480
+ * @route {POST} /addAllUsingPUT
1481
+ * @roles admin
1482
+ * @task true
1483
+ */
1484
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1485
+ addAllUsingPUT(fdn, body, callback) {
1486
+ const meth = 'adapter-addAllUsingPUT';
1487
+ const origin = `${this.id}-${meth}`;
1488
+ log.trace(origin);
1489
+
1490
+ if (this.suspended && this.suspendMode === 'error') {
1491
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1492
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1493
+ return callback(null, errorObj);
1494
+ }
1495
+
1496
+ /* HERE IS WHERE YOU VALIDATE DATA */
1497
+ if (fdn === undefined || fdn === null || fdn === '') {
1498
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
1499
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1500
+ return callback(null, errorObj);
1501
+ }
1502
+ if (body === undefined || body === null || body === '') {
1503
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1504
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1505
+ return callback(null, errorObj);
1506
+ }
1507
+
1508
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1509
+ const queryParamsAvailable = {};
1510
+ const queryParams = {};
1511
+ const pathVars = [fdn];
1512
+ const bodyVars = body;
1513
+
1514
+ // loop in template. long callback arg name to avoid identifier conflicts
1515
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1516
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1517
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1518
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1519
+ }
1520
+ });
1521
+
1522
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1523
+ // see adapter code documentation for more information on the request object's fields
1524
+ const reqObj = {
1525
+ payload: bodyVars,
1526
+ uriPathVars: pathVars,
1527
+ uriQuery: queryParams
1528
+ };
1529
+
1530
+ try {
1531
+ // Make the call -
1532
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1533
+ return this.requestHandlerInst.identifyRequest('NeControlDiscoveryRule', 'addAllUsingPUT', reqObj, false, (irReturnData, irReturnError) => {
1534
+ // if we received an error or their is no response on the results
1535
+ // return an error
1536
+ if (irReturnError) {
1537
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1538
+ return callback(null, irReturnError);
1539
+ }
1540
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1541
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addAllUsingPUT'], null, null, null);
1542
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1543
+ return callback(null, errorObj);
1544
+ }
1545
+
1546
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1547
+ // return the response
1548
+ return callback(irReturnData, null);
1549
+ });
1550
+ } catch (ex) {
1551
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1552
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1553
+ return callback(null, errorObj);
1554
+ }
1555
+ }
1556
+
1557
+ /**
1558
+ * @function getAllDiscoveredNesUsingGET
1559
+ * @pronghornType method
1560
+ * @name getAllDiscoveredNesUsingGET
1561
+ * @summary getAllDiscoveredNesUsingGET
1562
+ *
1563
+ * @param {getCallback} callback - a callback function to return the result
1564
+ * @return {object} results - An object containing the response of the action
1565
+ *
1566
+ * @route {GET} /getAllDiscoveredNesUsingGET
1567
+ * @roles admin
1568
+ * @task true
1569
+ */
1570
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1571
+ getAllDiscoveredNesUsingGET(callback) {
1572
+ const meth = 'adapter-getAllDiscoveredNesUsingGET';
1573
+ const origin = `${this.id}-${meth}`;
1574
+ log.trace(origin);
1575
+
1576
+ if (this.suspended && this.suspendMode === 'error') {
1577
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1578
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1579
+ return callback(null, errorObj);
1580
+ }
1581
+
1582
+ /* HERE IS WHERE YOU VALIDATE DATA */
1583
+
1584
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1585
+ const queryParamsAvailable = {};
1586
+ const queryParams = {};
1587
+ const pathVars = [];
1588
+ const bodyVars = {};
1589
+
1590
+ // loop in template. long callback arg name to avoid identifier conflicts
1591
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1592
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1593
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1594
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1595
+ }
1596
+ });
1597
+
1598
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1599
+ // see adapter code documentation for more information on the request object's fields
1600
+ const reqObj = {
1601
+ payload: bodyVars,
1602
+ uriPathVars: pathVars,
1603
+ uriQuery: queryParams
1604
+ };
1605
+
1606
+ try {
1607
+ // Make the call -
1608
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1609
+ return this.requestHandlerInst.identifyRequest('NeControlDiscoveryRule', 'getAllDiscoveredNesUsingGET', reqObj, true, (irReturnData, irReturnError) => {
1610
+ // if we received an error or their is no response on the results
1611
+ // return an error
1612
+ if (irReturnError) {
1613
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1614
+ return callback(null, irReturnError);
1615
+ }
1616
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1617
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllDiscoveredNesUsingGET'], null, null, null);
1618
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1619
+ return callback(null, errorObj);
1620
+ }
1621
+
1622
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1623
+ // return the response
1624
+ return callback(irReturnData, null);
1625
+ });
1626
+ } catch (ex) {
1627
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1628
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1629
+ return callback(null, errorObj);
1630
+ }
1631
+ }
1632
+
1633
+ /**
1634
+ * @function findNeDiscoveryRuleByFDNUsingGET
1635
+ * @pronghornType method
1636
+ * @name findNeDiscoveryRuleByFDNUsingGET
1637
+ * @summary findNeDiscoveryRuleByFDNUsingGET
1638
+ *
1639
+ * @param {string} fdn - fdn
1640
+ * @param {getCallback} callback - a callback function to return the result
1641
+ * @return {object} results - An object containing the response of the action
1642
+ *
1643
+ * @route {POST} /findNeDiscoveryRuleByFDNUsingGET
1644
+ * @roles admin
1645
+ * @task true
1646
+ */
1647
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1648
+ findNeDiscoveryRuleByFDNUsingGET(fdn, callback) {
1649
+ const meth = 'adapter-findNeDiscoveryRuleByFDNUsingGET';
1650
+ const origin = `${this.id}-${meth}`;
1651
+ log.trace(origin);
1652
+
1653
+ if (this.suspended && this.suspendMode === 'error') {
1654
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1655
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1656
+ return callback(null, errorObj);
1657
+ }
1658
+
1659
+ /* HERE IS WHERE YOU VALIDATE DATA */
1660
+ if (fdn === undefined || fdn === null || fdn === '') {
1661
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
1662
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1663
+ return callback(null, errorObj);
1664
+ }
1665
+
1666
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1667
+ const queryParamsAvailable = { fdn };
1668
+ const queryParams = {};
1669
+ const pathVars = [];
1670
+ const bodyVars = {};
1671
+
1672
+ // loop in template. long callback arg name to avoid identifier conflicts
1673
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1674
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1675
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1676
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1677
+ }
1678
+ });
1679
+
1680
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1681
+ // see adapter code documentation for more information on the request object's fields
1682
+ const reqObj = {
1683
+ payload: bodyVars,
1684
+ uriPathVars: pathVars,
1685
+ uriQuery: queryParams
1686
+ };
1687
+
1688
+ try {
1689
+ // Make the call -
1690
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1691
+ return this.requestHandlerInst.identifyRequest('NeControlDiscoveryRule', 'findNeDiscoveryRuleByFDNUsingGET', reqObj, true, (irReturnData, irReturnError) => {
1692
+ // if we received an error or their is no response on the results
1693
+ // return an error
1694
+ if (irReturnError) {
1695
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1696
+ return callback(null, irReturnError);
1697
+ }
1698
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1699
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['findNeDiscoveryRuleByFDNUsingGET'], null, null, null);
1700
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1701
+ return callback(null, errorObj);
1702
+ }
1703
+
1704
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1705
+ // return the response
1706
+ return callback(irReturnData, null);
1707
+ });
1708
+ } catch (ex) {
1709
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1710
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1711
+ return callback(null, errorObj);
1712
+ }
1713
+ }
1714
+
1715
+ /**
1716
+ * @function removeAllUsingPUT
1717
+ * @pronghornType method
1718
+ * @name removeAllUsingPUT
1719
+ * @summary removeAllUsingPUT
1720
+ *
1721
+ * @param {string} fdn - fdn
1722
+ * @param {object} body - aInJson
1723
+ * @param {getCallback} callback - a callback function to return the result
1724
+ * @return {object} results - An object containing the response of the action
1725
+ *
1726
+ * @route {POST} /removeAllUsingPUT
1727
+ * @roles admin
1728
+ * @task true
1729
+ */
1730
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1731
+ removeAllUsingPUT(fdn, body, callback) {
1732
+ const meth = 'adapter-removeAllUsingPUT';
1733
+ const origin = `${this.id}-${meth}`;
1734
+ log.trace(origin);
1735
+
1736
+ if (this.suspended && this.suspendMode === 'error') {
1737
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1738
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1739
+ return callback(null, errorObj);
1740
+ }
1741
+
1742
+ /* HERE IS WHERE YOU VALIDATE DATA */
1743
+ if (fdn === undefined || fdn === null || fdn === '') {
1744
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
1745
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1746
+ return callback(null, errorObj);
1747
+ }
1748
+ if (body === undefined || body === null || body === '') {
1749
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1750
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1751
+ return callback(null, errorObj);
1752
+ }
1753
+
1754
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1755
+ const queryParamsAvailable = {};
1756
+ const queryParams = {};
1757
+ const pathVars = [fdn];
1758
+ const bodyVars = body;
1759
+
1760
+ // loop in template. long callback arg name to avoid identifier conflicts
1761
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1762
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1763
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1764
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1765
+ }
1766
+ });
1767
+
1768
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1769
+ // see adapter code documentation for more information on the request object's fields
1770
+ const reqObj = {
1771
+ payload: bodyVars,
1772
+ uriPathVars: pathVars,
1773
+ uriQuery: queryParams
1774
+ };
1775
+
1776
+ try {
1777
+ // Make the call -
1778
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1779
+ return this.requestHandlerInst.identifyRequest('NeControlDiscoveryRule', 'removeAllUsingPUT', reqObj, false, (irReturnData, irReturnError) => {
1780
+ // if we received an error or their is no response on the results
1781
+ // return an error
1782
+ if (irReturnError) {
1783
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1784
+ return callback(null, irReturnError);
1785
+ }
1786
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1787
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['removeAllUsingPUT'], null, null, null);
1788
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1789
+ return callback(null, errorObj);
1790
+ }
1791
+
1792
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1793
+ // return the response
1794
+ return callback(irReturnData, null);
1795
+ });
1796
+ } catch (ex) {
1797
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1798
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1799
+ return callback(null, errorObj);
1800
+ }
1801
+ }
1802
+
1803
+ /**
1804
+ * @function updateUsingPUT
1805
+ * @pronghornType method
1806
+ * @name updateUsingPUT
1807
+ * @summary updateUsingPUT
1808
+ *
1809
+ * @param {string} fdn - fdn
1810
+ * @param {object} body - aInJson
1811
+ * @param {getCallback} callback - a callback function to return the result
1812
+ * @return {object} results - An object containing the response of the action
1813
+ *
1814
+ * @route {POST} /updateUsingPUT
1815
+ * @roles admin
1816
+ * @task true
1817
+ */
1818
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1819
+ updateUsingPUT(fdn, body, callback) {
1820
+ const meth = 'adapter-updateUsingPUT';
1821
+ const origin = `${this.id}-${meth}`;
1822
+ log.trace(origin);
1823
+
1824
+ if (this.suspended && this.suspendMode === 'error') {
1825
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1826
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1827
+ return callback(null, errorObj);
1828
+ }
1829
+
1830
+ /* HERE IS WHERE YOU VALIDATE DATA */
1831
+ if (fdn === undefined || fdn === null || fdn === '') {
1832
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
1833
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1834
+ return callback(null, errorObj);
1835
+ }
1836
+ if (body === undefined || body === null || body === '') {
1837
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1838
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1839
+ return callback(null, errorObj);
1840
+ }
1841
+
1842
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1843
+ const queryParamsAvailable = {};
1844
+ const queryParams = {};
1845
+ const pathVars = [fdn];
1846
+ const bodyVars = body;
1847
+
1848
+ // loop in template. long callback arg name to avoid identifier conflicts
1849
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1850
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1851
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1852
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1853
+ }
1854
+ });
1855
+
1856
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1857
+ // see adapter code documentation for more information on the request object's fields
1858
+ const reqObj = {
1859
+ payload: bodyVars,
1860
+ uriPathVars: pathVars,
1861
+ uriQuery: queryParams
1862
+ };
1863
+
1864
+ try {
1865
+ // Make the call -
1866
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1867
+ return this.requestHandlerInst.identifyRequest('NeControlDiscoveryRule', 'updateUsingPUT', reqObj, false, (irReturnData, irReturnError) => {
1868
+ // if we received an error or their is no response on the results
1869
+ // return an error
1870
+ if (irReturnError) {
1871
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1872
+ return callback(null, irReturnError);
1873
+ }
1874
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1875
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateUsingPUT'], null, null, null);
1876
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1877
+ return callback(null, errorObj);
1878
+ }
1879
+
1880
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1881
+ // return the response
1882
+ return callback(irReturnData, null);
1883
+ });
1884
+ } catch (ex) {
1885
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1886
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1887
+ return callback(null, errorObj);
1888
+ }
1889
+ }
1890
+
1891
+ /**
1892
+ * @function deleteUsingDELETE
1893
+ * @pronghornType method
1894
+ * @name deleteUsingDELETE
1895
+ * @summary deleteUsingDELETE
1896
+ *
1897
+ * @param {string} fdn - fdn
1898
+ * @param {getCallback} callback - a callback function to return the result
1899
+ * @return {object} results - An object containing the response of the action
1900
+ *
1901
+ * @route {POST} /deleteUsingDELETE
1902
+ * @roles admin
1903
+ * @task true
1904
+ */
1905
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1906
+ deleteUsingDELETE(fdn, callback) {
1907
+ const meth = 'adapter-deleteUsingDELETE';
1908
+ const origin = `${this.id}-${meth}`;
1909
+ log.trace(origin);
1910
+
1911
+ if (this.suspended && this.suspendMode === 'error') {
1912
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1913
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1914
+ return callback(null, errorObj);
1915
+ }
1916
+
1917
+ /* HERE IS WHERE YOU VALIDATE DATA */
1918
+ if (fdn === undefined || fdn === null || fdn === '') {
1919
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
1920
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1921
+ return callback(null, errorObj);
1922
+ }
1923
+
1924
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1925
+ const queryParamsAvailable = {};
1926
+ const queryParams = {};
1927
+ const pathVars = [fdn];
1928
+ const bodyVars = {};
1929
+
1930
+ // loop in template. long callback arg name to avoid identifier conflicts
1931
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1932
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1933
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1934
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1935
+ }
1936
+ });
1937
+
1938
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1939
+ // see adapter code documentation for more information on the request object's fields
1940
+ const reqObj = {
1941
+ payload: bodyVars,
1942
+ uriPathVars: pathVars,
1943
+ uriQuery: queryParams
1944
+ };
1945
+
1946
+ try {
1947
+ // Make the call -
1948
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1949
+ return this.requestHandlerInst.identifyRequest('NeControlDiscoveryRule', 'deleteUsingDELETE', reqObj, false, (irReturnData, irReturnError) => {
1950
+ // if we received an error or their is no response on the results
1951
+ // return an error
1952
+ if (irReturnError) {
1953
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1954
+ return callback(null, irReturnError);
1955
+ }
1956
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1957
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteUsingDELETE'], null, null, null);
1958
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1959
+ return callback(null, errorObj);
1960
+ }
1961
+
1962
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1963
+ // return the response
1964
+ return callback(irReturnData, null);
1965
+ });
1966
+ } catch (ex) {
1967
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1968
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1969
+ return callback(null, errorObj);
1970
+ }
1971
+ }
1972
+
1973
+ /**
1974
+ * @function getDataUsingGET
1975
+ * @pronghornType method
1976
+ * @name getDataUsingGET
1977
+ * @summary getDataUsingGET
1978
+ *
1979
+ * @param {string} fdn - fdn
1980
+ * @param {string} requestType - requestType
1981
+ * @param {getCallback} callback - a callback function to return the result
1982
+ * @return {object} results - An object containing the response of the action
1983
+ *
1984
+ * @route {POST} /getDataUsingGET
1985
+ * @roles admin
1986
+ * @task true
1987
+ */
1988
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1989
+ getDataUsingGET(fdn, requestType, callback) {
1990
+ const meth = 'adapter-getDataUsingGET';
1991
+ const origin = `${this.id}-${meth}`;
1992
+ log.trace(origin);
1993
+
1994
+ if (this.suspended && this.suspendMode === 'error') {
1995
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1996
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1997
+ return callback(null, errorObj);
1998
+ }
1999
+
2000
+ /* HERE IS WHERE YOU VALIDATE DATA */
2001
+ if (fdn === undefined || fdn === null || fdn === '') {
2002
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
2003
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2004
+ return callback(null, errorObj);
2005
+ }
2006
+ if (requestType === undefined || requestType === null || requestType === '') {
2007
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['requestType'], null, null, null);
2008
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2009
+ return callback(null, errorObj);
2010
+ }
2011
+
2012
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2013
+ const queryParamsAvailable = {};
2014
+ const queryParams = {};
2015
+ const pathVars = [fdn, requestType];
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('NeControlDiscoveryRule', 'getDataUsingGET', 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', ['getDataUsingGET'], 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 addPolicyUsingPOST
2063
+ * @pronghornType method
2064
+ * @name addPolicyUsingPOST
2065
+ * @summary addPolicyUsingPOST
2066
+ *
2067
+ * @param {object} body - nePolicyJson
2068
+ * @param {getCallback} callback - a callback function to return the result
2069
+ * @return {object} results - An object containing the response of the action
2070
+ *
2071
+ * @route {POST} /addPolicyUsingPOST
2072
+ * @roles admin
2073
+ * @task true
2074
+ */
2075
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2076
+ addPolicyUsingPOST(body, callback) {
2077
+ const meth = 'adapter-addPolicyUsingPOST';
2078
+ const origin = `${this.id}-${meth}`;
2079
+ log.trace(origin);
2080
+
2081
+ if (this.suspended && this.suspendMode === 'error') {
2082
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2083
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2084
+ return callback(null, errorObj);
2085
+ }
2086
+
2087
+ /* HERE IS WHERE YOU VALIDATE DATA */
2088
+ if (body === undefined || body === null || body === '') {
2089
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2090
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2091
+ return callback(null, errorObj);
2092
+ }
2093
+
2094
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2095
+ const queryParamsAvailable = {};
2096
+ const queryParams = {};
2097
+ const pathVars = [];
2098
+ const bodyVars = body;
2099
+
2100
+ // loop in template. long callback arg name to avoid identifier conflicts
2101
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2102
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2103
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2104
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2105
+ }
2106
+ });
2107
+
2108
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2109
+ // see adapter code documentation for more information on the request object's fields
2110
+ const reqObj = {
2111
+ payload: bodyVars,
2112
+ uriPathVars: pathVars,
2113
+ uriQuery: queryParams
2114
+ };
2115
+
2116
+ try {
2117
+ // Make the call -
2118
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2119
+ return this.requestHandlerInst.identifyRequest('NeMediationPolicy', 'addPolicyUsingPOST', reqObj, true, (irReturnData, irReturnError) => {
2120
+ // if we received an error or their is no response on the results
2121
+ // return an error
2122
+ if (irReturnError) {
2123
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2124
+ return callback(null, irReturnError);
2125
+ }
2126
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2127
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addPolicyUsingPOST'], null, null, null);
2128
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2129
+ return callback(null, errorObj);
2130
+ }
2131
+
2132
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2133
+ // return the response
2134
+ return callback(irReturnData, null);
2135
+ });
2136
+ } catch (ex) {
2137
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2138
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2139
+ return callback(null, errorObj);
2140
+ }
2141
+ }
2142
+
2143
+ /**
2144
+ * @function updatePolicyUsingPUT
2145
+ * @pronghornType method
2146
+ * @name updatePolicyUsingPUT
2147
+ * @summary updatePolicyUsingPUT
2148
+ *
2149
+ * @param {string} fdn - fdn
2150
+ * @param {object} body - nePolicyJson
2151
+ * @param {getCallback} callback - a callback function to return the result
2152
+ * @return {object} results - An object containing the response of the action
2153
+ *
2154
+ * @route {POST} /updatePolicyUsingPUT
2155
+ * @roles admin
2156
+ * @task true
2157
+ */
2158
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2159
+ updatePolicyUsingPUT(fdn, body, callback) {
2160
+ const meth = 'adapter-updatePolicyUsingPUT';
2161
+ const origin = `${this.id}-${meth}`;
2162
+ log.trace(origin);
2163
+
2164
+ if (this.suspended && this.suspendMode === 'error') {
2165
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2166
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2167
+ return callback(null, errorObj);
2168
+ }
2169
+
2170
+ /* HERE IS WHERE YOU VALIDATE DATA */
2171
+ if (fdn === undefined || fdn === null || fdn === '') {
2172
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
2173
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2174
+ return callback(null, errorObj);
2175
+ }
2176
+ if (body === undefined || body === null || body === '') {
2177
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2178
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2179
+ return callback(null, errorObj);
2180
+ }
2181
+
2182
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2183
+ const queryParamsAvailable = {};
2184
+ const queryParams = {};
2185
+ const pathVars = [fdn];
2186
+ const bodyVars = body;
2187
+
2188
+ // loop in template. long callback arg name to avoid identifier conflicts
2189
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2190
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2191
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2192
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2193
+ }
2194
+ });
2195
+
2196
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2197
+ // see adapter code documentation for more information on the request object's fields
2198
+ const reqObj = {
2199
+ payload: bodyVars,
2200
+ uriPathVars: pathVars,
2201
+ uriQuery: queryParams
2202
+ };
2203
+
2204
+ try {
2205
+ // Make the call -
2206
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2207
+ return this.requestHandlerInst.identifyRequest('NeMediationPolicy', 'updatePolicyUsingPUT', reqObj, false, (irReturnData, irReturnError) => {
2208
+ // if we received an error or their is no response on the results
2209
+ // return an error
2210
+ if (irReturnError) {
2211
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2212
+ return callback(null, irReturnError);
2213
+ }
2214
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2215
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updatePolicyUsingPUT'], null, null, null);
2216
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2217
+ return callback(null, errorObj);
2218
+ }
2219
+
2220
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2221
+ // return the response
2222
+ return callback(irReturnData, null);
2223
+ });
2224
+ } catch (ex) {
2225
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2226
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2227
+ return callback(null, errorObj);
2228
+ }
2229
+ }
2230
+
2231
+ /**
2232
+ * @function deletePolicyUsingDELETE
2233
+ * @pronghornType method
2234
+ * @name deletePolicyUsingDELETE
2235
+ * @summary deletePolicyUsingDELETE
2236
+ *
2237
+ * @param {string} fdn - fdn
2238
+ * @param {getCallback} callback - a callback function to return the result
2239
+ * @return {object} results - An object containing the response of the action
2240
+ *
2241
+ * @route {POST} /deletePolicyUsingDELETE
2242
+ * @roles admin
2243
+ * @task true
2244
+ */
2245
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2246
+ deletePolicyUsingDELETE(fdn, callback) {
2247
+ const meth = 'adapter-deletePolicyUsingDELETE';
2248
+ const origin = `${this.id}-${meth}`;
2249
+ log.trace(origin);
2250
+
2251
+ if (this.suspended && this.suspendMode === 'error') {
2252
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2253
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2254
+ return callback(null, errorObj);
2255
+ }
2256
+
2257
+ /* HERE IS WHERE YOU VALIDATE DATA */
2258
+ if (fdn === undefined || fdn === null || fdn === '') {
2259
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
2260
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2261
+ return callback(null, errorObj);
2262
+ }
2263
+
2264
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2265
+ const queryParamsAvailable = {};
2266
+ const queryParams = {};
2267
+ const pathVars = [fdn];
2268
+ const bodyVars = {};
2269
+
2270
+ // loop in template. long callback arg name to avoid identifier conflicts
2271
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2272
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2273
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2274
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2275
+ }
2276
+ });
2277
+
2278
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2279
+ // see adapter code documentation for more information on the request object's fields
2280
+ const reqObj = {
2281
+ payload: bodyVars,
2282
+ uriPathVars: pathVars,
2283
+ uriQuery: queryParams
2284
+ };
2285
+
2286
+ try {
2287
+ // Make the call -
2288
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2289
+ return this.requestHandlerInst.identifyRequest('NeMediationPolicy', 'deletePolicyUsingDELETE', reqObj, false, (irReturnData, irReturnError) => {
2290
+ // if we received an error or their is no response on the results
2291
+ // return an error
2292
+ if (irReturnError) {
2293
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2294
+ return callback(null, irReturnError);
2295
+ }
2296
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2297
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletePolicyUsingDELETE'], null, null, null);
2298
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2299
+ return callback(null, errorObj);
2300
+ }
2301
+
2302
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2303
+ // return the response
2304
+ return callback(irReturnData, null);
2305
+ });
2306
+ } catch (ex) {
2307
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2308
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2309
+ return callback(null, errorObj);
2310
+ }
2311
+ }
2312
+
2313
+ /**
2314
+ * @function getNesUsingGET
2315
+ * @pronghornType method
2316
+ * @name getNesUsingGET
2317
+ * @summary getNesUsingGET
2318
+ *
2319
+ * @param {string} fdn - fdn
2320
+ * @param {getCallback} callback - a callback function to return the result
2321
+ * @return {object} results - An object containing the response of the action
2322
+ *
2323
+ * @route {POST} /getNesUsingGET
2324
+ * @roles admin
2325
+ * @task true
2326
+ */
2327
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2328
+ getNesUsingGET(fdn, callback) {
2329
+ const meth = 'adapter-getNesUsingGET';
2330
+ const origin = `${this.id}-${meth}`;
2331
+ log.trace(origin);
2332
+
2333
+ if (this.suspended && this.suspendMode === 'error') {
2334
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2335
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2336
+ return callback(null, errorObj);
2337
+ }
2338
+
2339
+ /* HERE IS WHERE YOU VALIDATE DATA */
2340
+ if (fdn === undefined || fdn === null || fdn === '') {
2341
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
2342
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2343
+ return callback(null, errorObj);
2344
+ }
2345
+
2346
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2347
+ const queryParamsAvailable = {};
2348
+ const queryParams = {};
2349
+ const pathVars = [fdn];
2350
+ const bodyVars = {};
2351
+
2352
+ // loop in template. long callback arg name to avoid identifier conflicts
2353
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2354
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2355
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2356
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2357
+ }
2358
+ });
2359
+
2360
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2361
+ // see adapter code documentation for more information on the request object's fields
2362
+ const reqObj = {
2363
+ payload: bodyVars,
2364
+ uriPathVars: pathVars,
2365
+ uriQuery: queryParams
2366
+ };
2367
+
2368
+ try {
2369
+ // Make the call -
2370
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2371
+ return this.requestHandlerInst.identifyRequest('NeMediationPolicy', 'getNesUsingGET', reqObj, true, (irReturnData, irReturnError) => {
2372
+ // if we received an error or their is no response on the results
2373
+ // return an error
2374
+ if (irReturnError) {
2375
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2376
+ return callback(null, irReturnError);
2377
+ }
2378
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2379
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getNesUsingGET'], null, null, null);
2380
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2381
+ return callback(null, errorObj);
2382
+ }
2383
+
2384
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2385
+ // return the response
2386
+ return callback(irReturnData, null);
2387
+ });
2388
+ } catch (ex) {
2389
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2390
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2391
+ return callback(null, errorObj);
2392
+ }
2393
+ }
2394
+
2395
+ /**
2396
+ * @function getNesUsingGET1
2397
+ * @pronghornType method
2398
+ * @name getNesUsingGET1
2399
+ * @summary getNesUsingGET_1
2400
+ *
2401
+ * @param {string} accessType - accessType
2402
+ * @param {string} fdn - fdn
2403
+ * @param {getCallback} callback - a callback function to return the result
2404
+ * @return {object} results - An object containing the response of the action
2405
+ *
2406
+ * @route {POST} /getNesUsingGET1
2407
+ * @roles admin
2408
+ * @task true
2409
+ */
2410
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2411
+ getNesUsingGET1(accessType, fdn, callback) {
2412
+ const meth = 'adapter-getNesUsingGET1';
2413
+ const origin = `${this.id}-${meth}`;
2414
+ log.trace(origin);
2415
+
2416
+ if (this.suspended && this.suspendMode === 'error') {
2417
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2418
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2419
+ return callback(null, errorObj);
2420
+ }
2421
+
2422
+ /* HERE IS WHERE YOU VALIDATE DATA */
2423
+ if (accessType === undefined || accessType === null || accessType === '') {
2424
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['accessType'], null, null, null);
2425
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2426
+ return callback(null, errorObj);
2427
+ }
2428
+ if (fdn === undefined || fdn === null || fdn === '') {
2429
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
2430
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2431
+ return callback(null, errorObj);
2432
+ }
2433
+
2434
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2435
+ const queryParamsAvailable = {};
2436
+ const queryParams = {};
2437
+ const pathVars = [fdn, accessType];
2438
+ const bodyVars = {};
2439
+
2440
+ // loop in template. long callback arg name to avoid identifier conflicts
2441
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2442
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2443
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2444
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2445
+ }
2446
+ });
2447
+
2448
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2449
+ // see adapter code documentation for more information on the request object's fields
2450
+ const reqObj = {
2451
+ payload: bodyVars,
2452
+ uriPathVars: pathVars,
2453
+ uriQuery: queryParams
2454
+ };
2455
+
2456
+ try {
2457
+ // Make the call -
2458
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2459
+ return this.requestHandlerInst.identifyRequest('NeMediationPolicy', 'getNesUsingGET1', reqObj, true, (irReturnData, irReturnError) => {
2460
+ // if we received an error or their is no response on the results
2461
+ // return an error
2462
+ if (irReturnError) {
2463
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2464
+ return callback(null, irReturnError);
2465
+ }
2466
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2467
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getNesUsingGET1'], null, null, null);
2468
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2469
+ return callback(null, errorObj);
2470
+ }
2471
+
2472
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2473
+ // return the response
2474
+ return callback(irReturnData, null);
2475
+ });
2476
+ } catch (ex) {
2477
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2478
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2479
+ return callback(null, errorObj);
2480
+ }
2481
+ }
2482
+
2483
+ /**
2484
+ * @function getPoliciesForReadOnlyNeUsingGET
2485
+ * @pronghornType method
2486
+ * @name getPoliciesForReadOnlyNeUsingGET
2487
+ * @summary getPoliciesForReadOnlyNeUsingGET
2488
+ *
2489
+ * @param {string} neid - neid
2490
+ * @param {string} [type] - type
2491
+ * @param {getCallback} callback - a callback function to return the result
2492
+ * @return {object} results - An object containing the response of the action
2493
+ *
2494
+ * @route {POST} /getPoliciesForReadOnlyNeUsingGET
2495
+ * @roles admin
2496
+ * @task true
2497
+ */
2498
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2499
+ getPoliciesForReadOnlyNeUsingGET(neid, type, callback) {
2500
+ const meth = 'adapter-getPoliciesForReadOnlyNeUsingGET';
2501
+ const origin = `${this.id}-${meth}`;
2502
+ log.trace(origin);
2503
+
2504
+ if (this.suspended && this.suspendMode === 'error') {
2505
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2506
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2507
+ return callback(null, errorObj);
2508
+ }
2509
+
2510
+ /* HERE IS WHERE YOU VALIDATE DATA */
2511
+ if (neid === undefined || neid === null || neid === '') {
2512
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['neid'], null, null, null);
2513
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2514
+ return callback(null, errorObj);
2515
+ }
2516
+
2517
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2518
+ const queryParamsAvailable = { type };
2519
+ const queryParams = {};
2520
+ const pathVars = [neid];
2521
+ const bodyVars = {};
2522
+
2523
+ // loop in template. long callback arg name to avoid identifier conflicts
2524
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2525
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2526
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2527
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2528
+ }
2529
+ });
2530
+
2531
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2532
+ // see adapter code documentation for more information on the request object's fields
2533
+ const reqObj = {
2534
+ payload: bodyVars,
2535
+ uriPathVars: pathVars,
2536
+ uriQuery: queryParams
2537
+ };
2538
+
2539
+ try {
2540
+ // Make the call -
2541
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2542
+ return this.requestHandlerInst.identifyRequest('NeMediationPolicy', 'getPoliciesForReadOnlyNeUsingGET', reqObj, true, (irReturnData, irReturnError) => {
2543
+ // if we received an error or their is no response on the results
2544
+ // return an error
2545
+ if (irReturnError) {
2546
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2547
+ return callback(null, irReturnError);
2548
+ }
2549
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2550
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getPoliciesForReadOnlyNeUsingGET'], null, null, null);
2551
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2552
+ return callback(null, errorObj);
2553
+ }
2554
+
2555
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2556
+ // return the response
2557
+ return callback(irReturnData, null);
2558
+ });
2559
+ } catch (ex) {
2560
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2561
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2562
+ return callback(null, errorObj);
2563
+ }
2564
+ }
2565
+
2566
+ /**
2567
+ * @function addNeProtocolUsingPOST
2568
+ * @pronghornType method
2569
+ * @name addNeProtocolUsingPOST
2570
+ * @summary addNeProtocolUsingPOST
2571
+ *
2572
+ * @param {object} body - neUserJson
2573
+ * @param {getCallback} callback - a callback function to return the result
2574
+ * @return {object} results - An object containing the response of the action
2575
+ *
2576
+ * @route {POST} /addNeProtocolUsingPOST
2577
+ * @roles admin
2578
+ * @task true
2579
+ */
2580
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2581
+ addNeProtocolUsingPOST(body, callback) {
2582
+ const meth = 'adapter-addNeProtocolUsingPOST';
2583
+ const origin = `${this.id}-${meth}`;
2584
+ log.trace(origin);
2585
+
2586
+ if (this.suspended && this.suspendMode === 'error') {
2587
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2588
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2589
+ return callback(null, errorObj);
2590
+ }
2591
+
2592
+ /* HERE IS WHERE YOU VALIDATE DATA */
2593
+ if (body === undefined || body === null || body === '') {
2594
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2595
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2596
+ return callback(null, errorObj);
2597
+ }
2598
+
2599
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2600
+ const queryParamsAvailable = {};
2601
+ const queryParams = {};
2602
+ const pathVars = [];
2603
+ const bodyVars = body;
2604
+
2605
+ // loop in template. long callback arg name to avoid identifier conflicts
2606
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2607
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2608
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2609
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2610
+ }
2611
+ });
2612
+
2613
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2614
+ // see adapter code documentation for more information on the request object's fields
2615
+ const reqObj = {
2616
+ payload: bodyVars,
2617
+ uriPathVars: pathVars,
2618
+ uriQuery: queryParams
2619
+ };
2620
+
2621
+ try {
2622
+ // Make the call -
2623
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2624
+ return this.requestHandlerInst.identifyRequest('NeProtocol', 'addNeProtocolUsingPOST', reqObj, true, (irReturnData, irReturnError) => {
2625
+ // if we received an error or their is no response on the results
2626
+ // return an error
2627
+ if (irReturnError) {
2628
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2629
+ return callback(null, irReturnError);
2630
+ }
2631
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2632
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addNeProtocolUsingPOST'], null, null, null);
2633
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2634
+ return callback(null, errorObj);
2635
+ }
2636
+
2637
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2638
+ // return the response
2639
+ return callback(irReturnData, null);
2640
+ });
2641
+ } catch (ex) {
2642
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2643
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2644
+ return callback(null, errorObj);
2645
+ }
2646
+ }
2647
+
2648
+ /**
2649
+ * @function updateProtocolUsingPUT
2650
+ * @pronghornType method
2651
+ * @name updateProtocolUsingPUT
2652
+ * @summary updateProtocolUsingPUT
2653
+ *
2654
+ * @param {object} body - neProtocolJson
2655
+ * @param {getCallback} callback - a callback function to return the result
2656
+ * @return {object} results - An object containing the response of the action
2657
+ *
2658
+ * @route {POST} /updateProtocolUsingPUT
2659
+ * @roles admin
2660
+ * @task true
2661
+ */
2662
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2663
+ updateProtocolUsingPUT(body, callback) {
2664
+ const meth = 'adapter-updateProtocolUsingPUT';
2665
+ const origin = `${this.id}-${meth}`;
2666
+ log.trace(origin);
2667
+
2668
+ if (this.suspended && this.suspendMode === 'error') {
2669
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2670
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2671
+ return callback(null, errorObj);
2672
+ }
2673
+
2674
+ /* HERE IS WHERE YOU VALIDATE DATA */
2675
+ if (body === undefined || body === null || body === '') {
2676
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2677
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2678
+ return callback(null, errorObj);
2679
+ }
2680
+
2681
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2682
+ const queryParamsAvailable = {};
2683
+ const queryParams = {};
2684
+ const pathVars = [];
2685
+ const bodyVars = body;
2686
+
2687
+ // loop in template. long callback arg name to avoid identifier conflicts
2688
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2689
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2690
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2691
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2692
+ }
2693
+ });
2694
+
2695
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2696
+ // see adapter code documentation for more information on the request object's fields
2697
+ const reqObj = {
2698
+ payload: bodyVars,
2699
+ uriPathVars: pathVars,
2700
+ uriQuery: queryParams
2701
+ };
2702
+
2703
+ try {
2704
+ // Make the call -
2705
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2706
+ return this.requestHandlerInst.identifyRequest('NeProtocol', 'updateProtocolUsingPUT', reqObj, false, (irReturnData, irReturnError) => {
2707
+ // if we received an error or their is no response on the results
2708
+ // return an error
2709
+ if (irReturnError) {
2710
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2711
+ return callback(null, irReturnError);
2712
+ }
2713
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2714
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateProtocolUsingPUT'], null, null, null);
2715
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2716
+ return callback(null, errorObj);
2717
+ }
2718
+
2719
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2720
+ // return the response
2721
+ return callback(irReturnData, null);
2722
+ });
2723
+ } catch (ex) {
2724
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2725
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2726
+ return callback(null, errorObj);
2727
+ }
2728
+ }
2729
+
2730
+ /**
2731
+ * @function deletePolicyUsingDELETE1
2732
+ * @pronghornType method
2733
+ * @name deletePolicyUsingDELETE1
2734
+ * @summary deletePolicyUsingDELETE_1
2735
+ *
2736
+ * @param {string} fdn - fdn
2737
+ * @param {getCallback} callback - a callback function to return the result
2738
+ * @return {object} results - An object containing the response of the action
2739
+ *
2740
+ * @route {POST} /deletePolicyUsingDELETE1
2741
+ * @roles admin
2742
+ * @task true
2743
+ */
2744
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2745
+ deletePolicyUsingDELETE1(fdn, callback) {
2746
+ const meth = 'adapter-deletePolicyUsingDELETE1';
2747
+ const origin = `${this.id}-${meth}`;
2748
+ log.trace(origin);
2749
+
2750
+ if (this.suspended && this.suspendMode === 'error') {
2751
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2752
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2753
+ return callback(null, errorObj);
2754
+ }
2755
+
2756
+ /* HERE IS WHERE YOU VALIDATE DATA */
2757
+ if (fdn === undefined || fdn === null || fdn === '') {
2758
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
2759
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2760
+ return callback(null, errorObj);
2761
+ }
2762
+
2763
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2764
+ const queryParamsAvailable = {};
2765
+ const queryParams = {};
2766
+ const pathVars = [fdn];
2767
+ const bodyVars = {};
2768
+
2769
+ // loop in template. long callback arg name to avoid identifier conflicts
2770
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2771
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2772
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2773
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2774
+ }
2775
+ });
2776
+
2777
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2778
+ // see adapter code documentation for more information on the request object's fields
2779
+ const reqObj = {
2780
+ payload: bodyVars,
2781
+ uriPathVars: pathVars,
2782
+ uriQuery: queryParams
2783
+ };
2784
+
2785
+ try {
2786
+ // Make the call -
2787
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2788
+ return this.requestHandlerInst.identifyRequest('NeProtocol', 'deletePolicyUsingDELETE1', reqObj, false, (irReturnData, irReturnError) => {
2789
+ // if we received an error or their is no response on the results
2790
+ // return an error
2791
+ if (irReturnError) {
2792
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2793
+ return callback(null, irReturnError);
2794
+ }
2795
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2796
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletePolicyUsingDELETE1'], null, null, null);
2797
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2798
+ return callback(null, errorObj);
2799
+ }
2800
+
2801
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2802
+ // return the response
2803
+ return callback(irReturnData, null);
2804
+ });
2805
+ } catch (ex) {
2806
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2807
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2808
+ return callback(null, errorObj);
2809
+ }
2810
+ }
2811
+
2812
+ /**
2813
+ * @function addNeUserUsingPOST
2814
+ * @pronghornType method
2815
+ * @name addNeUserUsingPOST
2816
+ * @summary addNeUserUsingPOST
2817
+ *
2818
+ * @param {object} body - neUserJson
2819
+ * @param {getCallback} callback - a callback function to return the result
2820
+ * @return {object} results - An object containing the response of the action
2821
+ *
2822
+ * @route {POST} /addNeUserUsingPOST
2823
+ * @roles admin
2824
+ * @task true
2825
+ */
2826
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2827
+ addNeUserUsingPOST(body, callback) {
2828
+ const meth = 'adapter-addNeUserUsingPOST';
2829
+ const origin = `${this.id}-${meth}`;
2830
+ log.trace(origin);
2831
+
2832
+ if (this.suspended && this.suspendMode === 'error') {
2833
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2834
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2835
+ return callback(null, errorObj);
2836
+ }
2837
+
2838
+ /* HERE IS WHERE YOU VALIDATE DATA */
2839
+ if (body === undefined || body === null || body === '') {
2840
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2841
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2842
+ return callback(null, errorObj);
2843
+ }
2844
+
2845
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2846
+ const queryParamsAvailable = {};
2847
+ const queryParams = {};
2848
+ const pathVars = [];
2849
+ const bodyVars = body;
2850
+
2851
+ // loop in template. long callback arg name to avoid identifier conflicts
2852
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2853
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2854
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2855
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2856
+ }
2857
+ });
2858
+
2859
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2860
+ // see adapter code documentation for more information on the request object's fields
2861
+ const reqObj = {
2862
+ payload: bodyVars,
2863
+ uriPathVars: pathVars,
2864
+ uriQuery: queryParams
2865
+ };
2866
+
2867
+ try {
2868
+ // Make the call -
2869
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2870
+ return this.requestHandlerInst.identifyRequest('NeUser', 'addNeUserUsingPOST', reqObj, true, (irReturnData, irReturnError) => {
2871
+ // if we received an error or their is no response on the results
2872
+ // return an error
2873
+ if (irReturnError) {
2874
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2875
+ return callback(null, irReturnError);
2876
+ }
2877
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2878
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addNeUserUsingPOST'], null, null, null);
2879
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2880
+ return callback(null, errorObj);
2881
+ }
2882
+
2883
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2884
+ // return the response
2885
+ return callback(irReturnData, null);
2886
+ });
2887
+ } catch (ex) {
2888
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2889
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2890
+ return callback(null, errorObj);
2891
+ }
2892
+ }
2893
+
2894
+ /**
2895
+ * @function updateNeUserUsingPUT
2896
+ * @pronghornType method
2897
+ * @name updateNeUserUsingPUT
2898
+ * @summary updateNeUserUsingPUT
2899
+ *
2900
+ * @param {object} body - neUserJson
2901
+ * @param {getCallback} callback - a callback function to return the result
2902
+ * @return {object} results - An object containing the response of the action
2903
+ *
2904
+ * @route {POST} /updateNeUserUsingPUT
2905
+ * @roles admin
2906
+ * @task true
2907
+ */
2908
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2909
+ updateNeUserUsingPUT(body, callback) {
2910
+ const meth = 'adapter-updateNeUserUsingPUT';
2911
+ const origin = `${this.id}-${meth}`;
2912
+ log.trace(origin);
2913
+
2914
+ if (this.suspended && this.suspendMode === 'error') {
2915
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2916
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2917
+ return callback(null, errorObj);
2918
+ }
2919
+
2920
+ /* HERE IS WHERE YOU VALIDATE DATA */
2921
+ if (body === undefined || body === null || body === '') {
2922
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2923
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2924
+ return callback(null, errorObj);
2925
+ }
2926
+
2927
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2928
+ const queryParamsAvailable = {};
2929
+ const queryParams = {};
2930
+ const pathVars = [];
2931
+ const bodyVars = body;
2932
+
2933
+ // loop in template. long callback arg name to avoid identifier conflicts
2934
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2935
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2936
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2937
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2938
+ }
2939
+ });
2940
+
2941
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2942
+ // see adapter code documentation for more information on the request object's fields
2943
+ const reqObj = {
2944
+ payload: bodyVars,
2945
+ uriPathVars: pathVars,
2946
+ uriQuery: queryParams
2947
+ };
2948
+
2949
+ try {
2950
+ // Make the call -
2951
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2952
+ return this.requestHandlerInst.identifyRequest('NeUser', 'updateNeUserUsingPUT', reqObj, false, (irReturnData, irReturnError) => {
2953
+ // if we received an error or their is no response on the results
2954
+ // return an error
2955
+ if (irReturnError) {
2956
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2957
+ return callback(null, irReturnError);
2958
+ }
2959
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2960
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateNeUserUsingPUT'], null, null, null);
2961
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2962
+ return callback(null, errorObj);
2963
+ }
2964
+
2965
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2966
+ // return the response
2967
+ return callback(irReturnData, null);
2968
+ });
2969
+ } catch (ex) {
2970
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2971
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2972
+ return callback(null, errorObj);
2973
+ }
2974
+ }
2975
+
2976
+ /**
2977
+ * @function deletePolicyUsingDELETE2
2978
+ * @pronghornType method
2979
+ * @name deletePolicyUsingDELETE2
2980
+ * @summary deletePolicyUsingDELETE_2
2981
+ *
2982
+ * @param {string} fdn - fdn
2983
+ * @param {getCallback} callback - a callback function to return the result
2984
+ * @return {object} results - An object containing the response of the action
2985
+ *
2986
+ * @route {POST} /deletePolicyUsingDELETE2
2987
+ * @roles admin
2988
+ * @task true
2989
+ */
2990
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2991
+ deletePolicyUsingDELETE2(fdn, callback) {
2992
+ const meth = 'adapter-deletePolicyUsingDELETE2';
2993
+ const origin = `${this.id}-${meth}`;
2994
+ log.trace(origin);
2995
+
2996
+ if (this.suspended && this.suspendMode === 'error') {
2997
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2998
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2999
+ return callback(null, errorObj);
3000
+ }
3001
+
3002
+ /* HERE IS WHERE YOU VALIDATE DATA */
3003
+ if (fdn === undefined || fdn === null || fdn === '') {
3004
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fdn'], null, null, null);
3005
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3006
+ return callback(null, errorObj);
3007
+ }
3008
+
3009
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
3010
+ const queryParamsAvailable = {};
3011
+ const queryParams = {};
3012
+ const pathVars = [fdn];
3013
+ const bodyVars = {};
3014
+
3015
+ // loop in template. long callback arg name to avoid identifier conflicts
3016
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
3017
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
3018
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3019
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
3020
+ }
3021
+ });
3022
+
3023
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
3024
+ // see adapter code documentation for more information on the request object's fields
3025
+ const reqObj = {
3026
+ payload: bodyVars,
3027
+ uriPathVars: pathVars,
3028
+ uriQuery: queryParams
3029
+ };
3030
+
3031
+ try {
3032
+ // Make the call -
3033
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
3034
+ return this.requestHandlerInst.identifyRequest('NeUser', 'deletePolicyUsingDELETE2', reqObj, false, (irReturnData, irReturnError) => {
3035
+ // if we received an error or their is no response on the results
3036
+ // return an error
3037
+ if (irReturnError) {
3038
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
3039
+ return callback(null, irReturnError);
3040
+ }
3041
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
3042
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletePolicyUsingDELETE2'], null, null, null);
3043
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3044
+ return callback(null, errorObj);
3045
+ }
3046
+
3047
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
3048
+ // return the response
3049
+ return callback(irReturnData, null);
3050
+ });
3051
+ } catch (ex) {
3052
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
3053
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3054
+ return callback(null, errorObj);
3055
+ }
3056
+ }
3057
+ }
3058
+
3059
+ module.exports = NokiaNspDeviceAdministrator;