@itentialopensource/adapter-f5_velos 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) 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 +170 -0
  7. package/CHANGELOG.md +9 -0
  8. package/CODE_OF_CONDUCT.md +43 -0
  9. package/CONTRIBUTING.md +172 -0
  10. package/ENHANCE.md +69 -0
  11. package/LICENSE +201 -0
  12. package/PROPERTIES.md +641 -0
  13. package/README.md +337 -0
  14. package/SUMMARY.md +9 -0
  15. package/SYSTEMINFO.md +11 -0
  16. package/TROUBLESHOOT.md +47 -0
  17. package/adapter.js +2381 -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/F5OpenconfigSystem/action.json +185 -0
  28. package/entities/F5OpenconfigSystem/schema.json +71 -0
  29. package/entities/F5UtilsFileTransfer/action.json +205 -0
  30. package/entities/F5UtilsFileTransfer/schema.json +72 -0
  31. package/error.json +190 -0
  32. package/package.json +88 -0
  33. package/pronghorn.json +1264 -0
  34. package/propertiesDecorators.json +14 -0
  35. package/propertiesSchema.json +1248 -0
  36. package/refs?service=git-upload-pack +0 -0
  37. package/report/F5 velos.json +1537 -0
  38. package/report/creationReport.json +324 -0
  39. package/sampleProperties.json +195 -0
  40. package/test/integration/adapterTestBasicGet.js +83 -0
  41. package/test/integration/adapterTestConnectivity.js +93 -0
  42. package/test/integration/adapterTestIntegration.js +837 -0
  43. package/test/unit/adapterBaseTestUnit.js +949 -0
  44. package/test/unit/adapterTestUnit.js +1794 -0
  45. package/utils/adapterInfo.js +206 -0
  46. package/utils/addAuth.js +94 -0
  47. package/utils/artifactize.js +146 -0
  48. package/utils/basicGet.js +50 -0
  49. package/utils/checkMigrate.js +63 -0
  50. package/utils/entitiesToDB.js +178 -0
  51. package/utils/findPath.js +74 -0
  52. package/utils/methodDocumentor.js +225 -0
  53. package/utils/modify.js +154 -0
  54. package/utils/packModificationScript.js +35 -0
  55. package/utils/patches2bundledDeps.js +90 -0
  56. package/utils/pre-commit.sh +32 -0
  57. package/utils/removeHooks.js +20 -0
  58. package/utils/setup.js +33 -0
  59. package/utils/tbScript.js +246 -0
  60. package/utils/tbUtils.js +490 -0
  61. package/utils/testRunner.js +298 -0
  62. package/utils/troubleshootingAdapter.js +195 -0
  63. package/workflows/README.md +3 -0
package/adapter.js ADDED
@@ -0,0 +1,2381 @@
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 F5_velos
17
+ */
18
+
19
+ /* GENERAL ADAPTER FUNCTIONS */
20
+ class F5Velos extends AdapterBaseCl {
21
+ /**
22
+ * F5Velos 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 getDataF5UtilsFileTransferFile
846
+ * @pronghornType method
847
+ * @name getDataF5UtilsFileTransferFile
848
+ * @summary File utility commands.
849
+ *
850
+ * @param {getCallback} callback - a callback function to return the result
851
+ * @return {object} results - An object containing the response of the action
852
+ *
853
+ * @route {GET} /getDataF5UtilsFileTransferFile
854
+ * @roles admin
855
+ * @task true
856
+ */
857
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
858
+ getDataF5UtilsFileTransferFile(callback) {
859
+ const meth = 'adapter-getDataF5UtilsFileTransferFile';
860
+ const origin = `${this.id}-${meth}`;
861
+ log.trace(origin);
862
+
863
+ if (this.suspended && this.suspendMode === 'error') {
864
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
865
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
866
+ return callback(null, errorObj);
867
+ }
868
+
869
+ /* HERE IS WHERE YOU VALIDATE DATA */
870
+
871
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
872
+ const queryParamsAvailable = {};
873
+ const queryParams = {};
874
+ const pathVars = [];
875
+ const bodyVars = {};
876
+
877
+ // loop in template. long callback arg name to avoid identifier conflicts
878
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
879
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
880
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
881
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
882
+ }
883
+ });
884
+
885
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
886
+ // see adapter code documentation for more information on the request object's fields
887
+ const reqObj = {
888
+ payload: bodyVars,
889
+ uriPathVars: pathVars,
890
+ uriQuery: queryParams
891
+ };
892
+
893
+ try {
894
+ // Make the call -
895
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
896
+ return this.requestHandlerInst.identifyRequest('F5UtilsFileTransfer', 'getDataF5UtilsFileTransferFile', reqObj, true, (irReturnData, irReturnError) => {
897
+ // if we received an error or their is no response on the results
898
+ // return an error
899
+ if (irReturnError) {
900
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
901
+ return callback(null, irReturnError);
902
+ }
903
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
904
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDataF5UtilsFileTransferFile'], null, null, null);
905
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
906
+ return callback(null, errorObj);
907
+ }
908
+
909
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
910
+ // return the response
911
+ return callback(irReturnData, null);
912
+ });
913
+ } catch (ex) {
914
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
915
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
916
+ return callback(null, errorObj);
917
+ }
918
+ }
919
+
920
+ /**
921
+ * @function postDataF5UtilsFileTransferFile
922
+ * @pronghornType method
923
+ * @name postDataF5UtilsFileTransferFile
924
+ * @summary File utility commands.
925
+ *
926
+ * @param {object} file - File utility commands.
927
+ * @param {getCallback} callback - a callback function to return the result
928
+ * @return {object} results - An object containing the response of the action
929
+ *
930
+ * @route {POST} /postDataF5UtilsFileTransferFile
931
+ * @roles admin
932
+ * @task true
933
+ */
934
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
935
+ postDataF5UtilsFileTransferFile(file, callback) {
936
+ const meth = 'adapter-postDataF5UtilsFileTransferFile';
937
+ const origin = `${this.id}-${meth}`;
938
+ log.trace(origin);
939
+
940
+ if (this.suspended && this.suspendMode === 'error') {
941
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
942
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
943
+ return callback(null, errorObj);
944
+ }
945
+
946
+ /* HERE IS WHERE YOU VALIDATE DATA */
947
+ if (file === undefined || file === null || file === '') {
948
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['file'], null, null, null);
949
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
950
+ return callback(null, errorObj);
951
+ }
952
+
953
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
954
+ const queryParamsAvailable = {};
955
+ const queryParams = {};
956
+ const pathVars = [];
957
+ const bodyVars = file;
958
+
959
+ // loop in template. long callback arg name to avoid identifier conflicts
960
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
961
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
962
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
963
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
964
+ }
965
+ });
966
+
967
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
968
+ // see adapter code documentation for more information on the request object's fields
969
+ const reqObj = {
970
+ payload: bodyVars,
971
+ uriPathVars: pathVars,
972
+ uriQuery: queryParams
973
+ };
974
+
975
+ try {
976
+ // Make the call -
977
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
978
+ return this.requestHandlerInst.identifyRequest('F5UtilsFileTransfer', 'postDataF5UtilsFileTransferFile', reqObj, true, (irReturnData, irReturnError) => {
979
+ // if we received an error or their is no response on the results
980
+ // return an error
981
+ if (irReturnError) {
982
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
983
+ return callback(null, irReturnError);
984
+ }
985
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
986
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postDataF5UtilsFileTransferFile'], null, null, null);
987
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
988
+ return callback(null, errorObj);
989
+ }
990
+
991
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
992
+ // return the response
993
+ return callback(irReturnData, null);
994
+ });
995
+ } catch (ex) {
996
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
997
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
998
+ return callback(null, errorObj);
999
+ }
1000
+ }
1001
+
1002
+ /**
1003
+ * @function putDataF5UtilsFileTransferFile
1004
+ * @pronghornType method
1005
+ * @name putDataF5UtilsFileTransferFile
1006
+ * @summary File utility commands.
1007
+ *
1008
+ * @param {object} file - File utility commands.
1009
+ * @param {getCallback} callback - a callback function to return the result
1010
+ * @return {object} results - An object containing the response of the action
1011
+ *
1012
+ * @route {POST} /putDataF5UtilsFileTransferFile
1013
+ * @roles admin
1014
+ * @task true
1015
+ */
1016
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1017
+ putDataF5UtilsFileTransferFile(file, callback) {
1018
+ const meth = 'adapter-putDataF5UtilsFileTransferFile';
1019
+ const origin = `${this.id}-${meth}`;
1020
+ log.trace(origin);
1021
+
1022
+ if (this.suspended && this.suspendMode === 'error') {
1023
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1024
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1025
+ return callback(null, errorObj);
1026
+ }
1027
+
1028
+ /* HERE IS WHERE YOU VALIDATE DATA */
1029
+ if (file === undefined || file === null || file === '') {
1030
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['file'], null, null, null);
1031
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1032
+ return callback(null, errorObj);
1033
+ }
1034
+
1035
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1036
+ const queryParamsAvailable = {};
1037
+ const queryParams = {};
1038
+ const pathVars = [];
1039
+ const bodyVars = file;
1040
+
1041
+ // loop in template. long callback arg name to avoid identifier conflicts
1042
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1043
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1044
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1045
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1046
+ }
1047
+ });
1048
+
1049
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1050
+ // see adapter code documentation for more information on the request object's fields
1051
+ const reqObj = {
1052
+ payload: bodyVars,
1053
+ uriPathVars: pathVars,
1054
+ uriQuery: queryParams
1055
+ };
1056
+
1057
+ try {
1058
+ // Make the call -
1059
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1060
+ return this.requestHandlerInst.identifyRequest('F5UtilsFileTransfer', 'putDataF5UtilsFileTransferFile', reqObj, false, (irReturnData, irReturnError) => {
1061
+ // if we received an error or their is no response on the results
1062
+ // return an error
1063
+ if (irReturnError) {
1064
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1065
+ return callback(null, irReturnError);
1066
+ }
1067
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1068
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['putDataF5UtilsFileTransferFile'], null, null, null);
1069
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1070
+ return callback(null, errorObj);
1071
+ }
1072
+
1073
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1074
+ // return the response
1075
+ return callback(irReturnData, null);
1076
+ });
1077
+ } catch (ex) {
1078
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1079
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1080
+ return callback(null, errorObj);
1081
+ }
1082
+ }
1083
+
1084
+ /**
1085
+ * @function patchDataF5UtilsFileTransferFile
1086
+ * @pronghornType method
1087
+ * @name patchDataF5UtilsFileTransferFile
1088
+ * @summary File utility commands.
1089
+ *
1090
+ * @param {object} file - File utility commands.
1091
+ * @param {getCallback} callback - a callback function to return the result
1092
+ * @return {object} results - An object containing the response of the action
1093
+ *
1094
+ * @route {POST} /patchDataF5UtilsFileTransferFile
1095
+ * @roles admin
1096
+ * @task true
1097
+ */
1098
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1099
+ patchDataF5UtilsFileTransferFile(file, callback) {
1100
+ const meth = 'adapter-patchDataF5UtilsFileTransferFile';
1101
+ const origin = `${this.id}-${meth}`;
1102
+ log.trace(origin);
1103
+
1104
+ if (this.suspended && this.suspendMode === 'error') {
1105
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1106
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1107
+ return callback(null, errorObj);
1108
+ }
1109
+
1110
+ /* HERE IS WHERE YOU VALIDATE DATA */
1111
+ if (file === undefined || file === null || file === '') {
1112
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['file'], null, null, null);
1113
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1114
+ return callback(null, errorObj);
1115
+ }
1116
+
1117
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1118
+ const queryParamsAvailable = {};
1119
+ const queryParams = {};
1120
+ const pathVars = [];
1121
+ const bodyVars = file;
1122
+
1123
+ // loop in template. long callback arg name to avoid identifier conflicts
1124
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1125
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1126
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1127
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1128
+ }
1129
+ });
1130
+
1131
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1132
+ // see adapter code documentation for more information on the request object's fields
1133
+ const reqObj = {
1134
+ payload: bodyVars,
1135
+ uriPathVars: pathVars,
1136
+ uriQuery: queryParams
1137
+ };
1138
+
1139
+ try {
1140
+ // Make the call -
1141
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1142
+ return this.requestHandlerInst.identifyRequest('F5UtilsFileTransfer', 'patchDataF5UtilsFileTransferFile', reqObj, false, (irReturnData, irReturnError) => {
1143
+ // if we received an error or their is no response on the results
1144
+ // return an error
1145
+ if (irReturnError) {
1146
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1147
+ return callback(null, irReturnError);
1148
+ }
1149
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1150
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['patchDataF5UtilsFileTransferFile'], null, null, null);
1151
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1152
+ return callback(null, errorObj);
1153
+ }
1154
+
1155
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1156
+ // return the response
1157
+ return callback(irReturnData, null);
1158
+ });
1159
+ } catch (ex) {
1160
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1161
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1162
+ return callback(null, errorObj);
1163
+ }
1164
+ }
1165
+
1166
+ /**
1167
+ * @function deleteDataF5UtilsFileTransferFile
1168
+ * @pronghornType method
1169
+ * @name deleteDataF5UtilsFileTransferFile
1170
+ * @summary File utility commands.
1171
+ *
1172
+ * @param {getCallback} callback - a callback function to return the result
1173
+ * @return {object} results - An object containing the response of the action
1174
+ *
1175
+ * @route {GET} /deleteDataF5UtilsFileTransferFile
1176
+ * @roles admin
1177
+ * @task true
1178
+ */
1179
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1180
+ deleteDataF5UtilsFileTransferFile(callback) {
1181
+ const meth = 'adapter-deleteDataF5UtilsFileTransferFile';
1182
+ const origin = `${this.id}-${meth}`;
1183
+ log.trace(origin);
1184
+
1185
+ if (this.suspended && this.suspendMode === 'error') {
1186
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1187
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1188
+ return callback(null, errorObj);
1189
+ }
1190
+
1191
+ /* HERE IS WHERE YOU VALIDATE DATA */
1192
+
1193
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1194
+ const queryParamsAvailable = {};
1195
+ const queryParams = {};
1196
+ const pathVars = [];
1197
+ const bodyVars = {};
1198
+
1199
+ // loop in template. long callback arg name to avoid identifier conflicts
1200
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1201
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1202
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1203
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1204
+ }
1205
+ });
1206
+
1207
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1208
+ // see adapter code documentation for more information on the request object's fields
1209
+ const reqObj = {
1210
+ payload: bodyVars,
1211
+ uriPathVars: pathVars,
1212
+ uriQuery: queryParams
1213
+ };
1214
+
1215
+ try {
1216
+ // Make the call -
1217
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1218
+ return this.requestHandlerInst.identifyRequest('F5UtilsFileTransfer', 'deleteDataF5UtilsFileTransferFile', reqObj, false, (irReturnData, irReturnError) => {
1219
+ // if we received an error or their is no response on the results
1220
+ // return an error
1221
+ if (irReturnError) {
1222
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1223
+ return callback(null, irReturnError);
1224
+ }
1225
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1226
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteDataF5UtilsFileTransferFile'], null, null, null);
1227
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1228
+ return callback(null, errorObj);
1229
+ }
1230
+
1231
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1232
+ // return the response
1233
+ return callback(irReturnData, null);
1234
+ });
1235
+ } catch (ex) {
1236
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1237
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1238
+ return callback(null, errorObj);
1239
+ }
1240
+ }
1241
+
1242
+ /**
1243
+ * @function postDataF5UtilsFileTransferFileImport
1244
+ * @pronghornType method
1245
+ * @name postDataF5UtilsFileTransferFileImport
1246
+ * @summary Initiate an import of the remote file to the System.
1247
+ *
1248
+ * @param {object} importParam - Initiate an import of the remote file to the System.
1249
+ * @param {getCallback} callback - a callback function to return the result
1250
+ * @return {object} results - An object containing the response of the action
1251
+ *
1252
+ * @route {POST} /postDataF5UtilsFileTransferFileImport
1253
+ * @roles admin
1254
+ * @task true
1255
+ */
1256
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1257
+ postDataF5UtilsFileTransferFileImport(importParam, callback) {
1258
+ const meth = 'adapter-postDataF5UtilsFileTransferFileImport';
1259
+ const origin = `${this.id}-${meth}`;
1260
+ log.trace(origin);
1261
+
1262
+ if (this.suspended && this.suspendMode === 'error') {
1263
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1264
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1265
+ return callback(null, errorObj);
1266
+ }
1267
+
1268
+ /* HERE IS WHERE YOU VALIDATE DATA */
1269
+ if (importParam === undefined || importParam === null || importParam === '') {
1270
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['importParam'], null, null, null);
1271
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1272
+ return callback(null, errorObj);
1273
+ }
1274
+
1275
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1276
+ const queryParamsAvailable = {};
1277
+ const queryParams = {};
1278
+ const pathVars = [];
1279
+ const bodyVars = importParam;
1280
+
1281
+ // loop in template. long callback arg name to avoid identifier conflicts
1282
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1283
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1284
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1285
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1286
+ }
1287
+ });
1288
+
1289
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1290
+ // see adapter code documentation for more information on the request object's fields
1291
+ const reqObj = {
1292
+ payload: bodyVars,
1293
+ uriPathVars: pathVars,
1294
+ uriQuery: queryParams
1295
+ };
1296
+
1297
+ try {
1298
+ // Make the call -
1299
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1300
+ return this.requestHandlerInst.identifyRequest('F5UtilsFileTransfer', 'postDataF5UtilsFileTransferFileImport', reqObj, true, (irReturnData, irReturnError) => {
1301
+ // if we received an error or their is no response on the results
1302
+ // return an error
1303
+ if (irReturnError) {
1304
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1305
+ return callback(null, irReturnError);
1306
+ }
1307
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1308
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postDataF5UtilsFileTransferFileImport'], null, null, null);
1309
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1310
+ return callback(null, errorObj);
1311
+ }
1312
+
1313
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1314
+ // return the response
1315
+ return callback(irReturnData, null);
1316
+ });
1317
+ } catch (ex) {
1318
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1319
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1320
+ return callback(null, errorObj);
1321
+ }
1322
+ }
1323
+
1324
+ /**
1325
+ * @function postDataF5UtilsFileTransferFileExport
1326
+ * @pronghornType method
1327
+ * @name postDataF5UtilsFileTransferFileExport
1328
+ * @summary Initiate an export of the file to the remote system.
1329
+ *
1330
+ * @param {object} exportParam - Initiate an export of the file to the remote system.
1331
+ * @param {getCallback} callback - a callback function to return the result
1332
+ * @return {object} results - An object containing the response of the action
1333
+ *
1334
+ * @route {POST} /postDataF5UtilsFileTransferFileExport
1335
+ * @roles admin
1336
+ * @task true
1337
+ */
1338
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1339
+ postDataF5UtilsFileTransferFileExport(exportParam, callback) {
1340
+ const meth = 'adapter-postDataF5UtilsFileTransferFileExport';
1341
+ const origin = `${this.id}-${meth}`;
1342
+ log.trace(origin);
1343
+
1344
+ if (this.suspended && this.suspendMode === 'error') {
1345
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1346
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1347
+ return callback(null, errorObj);
1348
+ }
1349
+
1350
+ /* HERE IS WHERE YOU VALIDATE DATA */
1351
+ if (exportParam === undefined || exportParam === null || exportParam === '') {
1352
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['exportParam'], null, null, null);
1353
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1354
+ return callback(null, errorObj);
1355
+ }
1356
+
1357
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1358
+ const queryParamsAvailable = {};
1359
+ const queryParams = {};
1360
+ const pathVars = [];
1361
+ const bodyVars = exportParam;
1362
+
1363
+ // loop in template. long callback arg name to avoid identifier conflicts
1364
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1365
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1366
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1367
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1368
+ }
1369
+ });
1370
+
1371
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1372
+ // see adapter code documentation for more information on the request object's fields
1373
+ const reqObj = {
1374
+ payload: bodyVars,
1375
+ uriPathVars: pathVars,
1376
+ uriQuery: queryParams
1377
+ };
1378
+
1379
+ try {
1380
+ // Make the call -
1381
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1382
+ return this.requestHandlerInst.identifyRequest('F5UtilsFileTransfer', 'postDataF5UtilsFileTransferFileExport', reqObj, true, (irReturnData, irReturnError) => {
1383
+ // if we received an error or their is no response on the results
1384
+ // return an error
1385
+ if (irReturnError) {
1386
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1387
+ return callback(null, irReturnError);
1388
+ }
1389
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1390
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postDataF5UtilsFileTransferFileExport'], null, null, null);
1391
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1392
+ return callback(null, errorObj);
1393
+ }
1394
+
1395
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1396
+ // return the response
1397
+ return callback(irReturnData, null);
1398
+ });
1399
+ } catch (ex) {
1400
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1401
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1402
+ return callback(null, errorObj);
1403
+ }
1404
+ }
1405
+
1406
+ /**
1407
+ * @function postDataF5UtilsFileTransferFileDelete
1408
+ * @pronghornType method
1409
+ * @name postDataF5UtilsFileTransferFileDelete
1410
+ * @summary Delete an existing file. The result will indicate a success or failure.
1411
+ *
1412
+ * @param {object} deleteParam - Delete an existing file. The result will indicate a success or failure.
1413
+ * @param {getCallback} callback - a callback function to return the result
1414
+ * @return {object} results - An object containing the response of the action
1415
+ *
1416
+ * @route {POST} /postDataF5UtilsFileTransferFileDelete
1417
+ * @roles admin
1418
+ * @task true
1419
+ */
1420
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1421
+ postDataF5UtilsFileTransferFileDelete(deleteParam, callback) {
1422
+ const meth = 'adapter-postDataF5UtilsFileTransferFileDelete';
1423
+ const origin = `${this.id}-${meth}`;
1424
+ log.trace(origin);
1425
+
1426
+ if (this.suspended && this.suspendMode === 'error') {
1427
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1428
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1429
+ return callback(null, errorObj);
1430
+ }
1431
+
1432
+ /* HERE IS WHERE YOU VALIDATE DATA */
1433
+ if (deleteParam === undefined || deleteParam === null || deleteParam === '') {
1434
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deleteParam'], null, null, null);
1435
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1436
+ return callback(null, errorObj);
1437
+ }
1438
+
1439
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1440
+ const queryParamsAvailable = {};
1441
+ const queryParams = {};
1442
+ const pathVars = [];
1443
+ const bodyVars = deleteParam;
1444
+
1445
+ // loop in template. long callback arg name to avoid identifier conflicts
1446
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1447
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1448
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1449
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1450
+ }
1451
+ });
1452
+
1453
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1454
+ // see adapter code documentation for more information on the request object's fields
1455
+ const reqObj = {
1456
+ payload: bodyVars,
1457
+ uriPathVars: pathVars,
1458
+ uriQuery: queryParams
1459
+ };
1460
+
1461
+ try {
1462
+ // Make the call -
1463
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1464
+ return this.requestHandlerInst.identifyRequest('F5UtilsFileTransfer', 'postDataF5UtilsFileTransferFileDelete', reqObj, true, (irReturnData, irReturnError) => {
1465
+ // if we received an error or their is no response on the results
1466
+ // return an error
1467
+ if (irReturnError) {
1468
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1469
+ return callback(null, irReturnError);
1470
+ }
1471
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1472
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postDataF5UtilsFileTransferFileDelete'], null, null, null);
1473
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1474
+ return callback(null, errorObj);
1475
+ }
1476
+
1477
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1478
+ // return the response
1479
+ return callback(irReturnData, null);
1480
+ });
1481
+ } catch (ex) {
1482
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1483
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1484
+ return callback(null, errorObj);
1485
+ }
1486
+ }
1487
+
1488
+ /**
1489
+ * @function postDataF5UtilsFileTransferFileList
1490
+ * @pronghornType method
1491
+ * @name postDataF5UtilsFileTransferFileList
1492
+ * @summary Display list of directories/files in the given path.
1493
+ *
1494
+ * @param {object} list - Display list of directories/files in the given path.
1495
+ * @param {getCallback} callback - a callback function to return the result
1496
+ * @return {object} results - An object containing the response of the action
1497
+ *
1498
+ * @route {POST} /postDataF5UtilsFileTransferFileList
1499
+ * @roles admin
1500
+ * @task true
1501
+ */
1502
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1503
+ postDataF5UtilsFileTransferFileList(list, callback) {
1504
+ const meth = 'adapter-postDataF5UtilsFileTransferFileList';
1505
+ const origin = `${this.id}-${meth}`;
1506
+ log.trace(origin);
1507
+
1508
+ if (this.suspended && this.suspendMode === 'error') {
1509
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1510
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1511
+ return callback(null, errorObj);
1512
+ }
1513
+
1514
+ /* HERE IS WHERE YOU VALIDATE DATA */
1515
+ if (list === undefined || list === null || list === '') {
1516
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['list'], null, null, null);
1517
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1518
+ return callback(null, errorObj);
1519
+ }
1520
+
1521
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1522
+ const queryParamsAvailable = {};
1523
+ const queryParams = {};
1524
+ const pathVars = [];
1525
+ const bodyVars = list;
1526
+
1527
+ // loop in template. long callback arg name to avoid identifier conflicts
1528
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1529
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1530
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1531
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1532
+ }
1533
+ });
1534
+
1535
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1536
+ // see adapter code documentation for more information on the request object's fields
1537
+ const reqObj = {
1538
+ payload: bodyVars,
1539
+ uriPathVars: pathVars,
1540
+ uriQuery: queryParams
1541
+ };
1542
+
1543
+ try {
1544
+ // Make the call -
1545
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1546
+ return this.requestHandlerInst.identifyRequest('F5UtilsFileTransfer', 'postDataF5UtilsFileTransferFileList', reqObj, true, (irReturnData, irReturnError) => {
1547
+ // if we received an error or their is no response on the results
1548
+ // return an error
1549
+ if (irReturnError) {
1550
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1551
+ return callback(null, irReturnError);
1552
+ }
1553
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1554
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postDataF5UtilsFileTransferFileList'], null, null, null);
1555
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1556
+ return callback(null, errorObj);
1557
+ }
1558
+
1559
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1560
+ // return the response
1561
+ return callback(irReturnData, null);
1562
+ });
1563
+ } catch (ex) {
1564
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1565
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1566
+ return callback(null, errorObj);
1567
+ }
1568
+ }
1569
+
1570
+ /**
1571
+ * @function postDataF5UtilsFileTransferFileTransferStatus
1572
+ * @pronghornType method
1573
+ * @name postDataF5UtilsFileTransferFileTransferStatus
1574
+ * @summary Display the status of file operation.
1575
+ The result will indicate an error, or percent complete.
1576
+ *
1577
+ * @param {object} transferStatus - Display the status of file operation.
1578
+ The result will indicate an error, or percent complete.
1579
+ * @param {getCallback} callback - a callback function to return the result
1580
+ * @return {object} results - An object containing the response of the action
1581
+ *
1582
+ * @route {POST} /postDataF5UtilsFileTransferFileTransferStatus
1583
+ * @roles admin
1584
+ * @task true
1585
+ */
1586
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1587
+ postDataF5UtilsFileTransferFileTransferStatus(transferStatus, callback) {
1588
+ const meth = 'adapter-postDataF5UtilsFileTransferFileTransferStatus';
1589
+ const origin = `${this.id}-${meth}`;
1590
+ log.trace(origin);
1591
+
1592
+ if (this.suspended && this.suspendMode === 'error') {
1593
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1594
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1595
+ return callback(null, errorObj);
1596
+ }
1597
+
1598
+ /* HERE IS WHERE YOU VALIDATE DATA */
1599
+ if (transferStatus === undefined || transferStatus === null || transferStatus === '') {
1600
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['transferStatus'], null, null, null);
1601
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1602
+ return callback(null, errorObj);
1603
+ }
1604
+
1605
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1606
+ const queryParamsAvailable = {};
1607
+ const queryParams = {};
1608
+ const pathVars = [];
1609
+ const bodyVars = transferStatus;
1610
+
1611
+ // loop in template. long callback arg name to avoid identifier conflicts
1612
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1613
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1614
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1615
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1616
+ }
1617
+ });
1618
+
1619
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1620
+ // see adapter code documentation for more information on the request object's fields
1621
+ const reqObj = {
1622
+ payload: bodyVars,
1623
+ uriPathVars: pathVars,
1624
+ uriQuery: queryParams
1625
+ };
1626
+
1627
+ try {
1628
+ // Make the call -
1629
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1630
+ return this.requestHandlerInst.identifyRequest('F5UtilsFileTransfer', 'postDataF5UtilsFileTransferFileTransferStatus', reqObj, true, (irReturnData, irReturnError) => {
1631
+ // if we received an error or their is no response on the results
1632
+ // return an error
1633
+ if (irReturnError) {
1634
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1635
+ return callback(null, irReturnError);
1636
+ }
1637
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1638
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postDataF5UtilsFileTransferFileTransferStatus'], null, null, null);
1639
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1640
+ return callback(null, errorObj);
1641
+ }
1642
+
1643
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1644
+ // return the response
1645
+ return callback(irReturnData, null);
1646
+ });
1647
+ } catch (ex) {
1648
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1649
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1650
+ return callback(null, errorObj);
1651
+ }
1652
+ }
1653
+
1654
+ /**
1655
+ * @function getOpenconfigSystemF5Database
1656
+ * @pronghornType method
1657
+ * @name getOpenconfigSystemF5Database
1658
+ * @summary data_openconfig_system_system_f5_database_database_get
1659
+ *
1660
+ * @param {getCallback} callback - a callback function to return the result
1661
+ * @return {object} results - An object containing the response of the action
1662
+ *
1663
+ * @route {GET} /getOpenconfigSystemF5Database
1664
+ * @roles admin
1665
+ * @task true
1666
+ */
1667
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1668
+ getOpenconfigSystemF5Database(callback) {
1669
+ const meth = 'adapter-getOpenconfigSystemF5Database';
1670
+ const origin = `${this.id}-${meth}`;
1671
+ log.trace(origin);
1672
+
1673
+ if (this.suspended && this.suspendMode === 'error') {
1674
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1675
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1676
+ return callback(null, errorObj);
1677
+ }
1678
+
1679
+ /* HERE IS WHERE YOU VALIDATE DATA */
1680
+
1681
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1682
+ const queryParamsAvailable = {};
1683
+ const queryParams = {};
1684
+ const pathVars = [];
1685
+ const bodyVars = {};
1686
+
1687
+ // loop in template. long callback arg name to avoid identifier conflicts
1688
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1689
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1690
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1691
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1692
+ }
1693
+ });
1694
+
1695
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1696
+ // see adapter code documentation for more information on the request object's fields
1697
+ const reqObj = {
1698
+ payload: bodyVars,
1699
+ uriPathVars: pathVars,
1700
+ uriQuery: queryParams
1701
+ };
1702
+
1703
+ try {
1704
+ // Make the call -
1705
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1706
+ return this.requestHandlerInst.identifyRequest('F5OpenconfigSystem', 'getOpenconfigSystemF5Database', reqObj, true, (irReturnData, irReturnError) => {
1707
+ // if we received an error or their is no response on the results
1708
+ // return an error
1709
+ if (irReturnError) {
1710
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1711
+ return callback(null, irReturnError);
1712
+ }
1713
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1714
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getOpenconfigSystemF5Database'], null, null, null);
1715
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1716
+ return callback(null, errorObj);
1717
+ }
1718
+
1719
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1720
+ // return the response
1721
+ return callback(irReturnData, null);
1722
+ });
1723
+ } catch (ex) {
1724
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1725
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1726
+ return callback(null, errorObj);
1727
+ }
1728
+ }
1729
+
1730
+ /**
1731
+ * @function postOpenconfigSystemF5Database
1732
+ * @pronghornType method
1733
+ * @name postOpenconfigSystemF5Database
1734
+ * @summary data_openconfig_system_system_f5_database_database_post
1735
+ *
1736
+ * @param {object} database - database param
1737
+ * @param {getCallback} callback - a callback function to return the result
1738
+ * @return {object} results - An object containing the response of the action
1739
+ *
1740
+ * @route {POST} /postOpenconfigSystemF5Database
1741
+ * @roles admin
1742
+ * @task true
1743
+ */
1744
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1745
+ postOpenconfigSystemF5Database(database, callback) {
1746
+ const meth = 'adapter-postOpenconfigSystemF5Database';
1747
+ const origin = `${this.id}-${meth}`;
1748
+ log.trace(origin);
1749
+
1750
+ if (this.suspended && this.suspendMode === 'error') {
1751
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1752
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1753
+ return callback(null, errorObj);
1754
+ }
1755
+
1756
+ /* HERE IS WHERE YOU VALIDATE DATA */
1757
+ if (database === undefined || database === null || database === '') {
1758
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['database'], null, null, null);
1759
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1760
+ return callback(null, errorObj);
1761
+ }
1762
+
1763
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1764
+ const queryParamsAvailable = {};
1765
+ const queryParams = {};
1766
+ const pathVars = [];
1767
+ const bodyVars = database;
1768
+
1769
+ // loop in template. long callback arg name to avoid identifier conflicts
1770
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1771
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1772
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1773
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1774
+ }
1775
+ });
1776
+
1777
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1778
+ // see adapter code documentation for more information on the request object's fields
1779
+ const reqObj = {
1780
+ payload: bodyVars,
1781
+ uriPathVars: pathVars,
1782
+ uriQuery: queryParams
1783
+ };
1784
+
1785
+ try {
1786
+ // Make the call -
1787
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1788
+ return this.requestHandlerInst.identifyRequest('F5OpenconfigSystem', 'postOpenconfigSystemF5Database', reqObj, true, (irReturnData, irReturnError) => {
1789
+ // if we received an error or their is no response on the results
1790
+ // return an error
1791
+ if (irReturnError) {
1792
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1793
+ return callback(null, irReturnError);
1794
+ }
1795
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1796
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postOpenconfigSystemF5Database'], null, null, null);
1797
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1798
+ return callback(null, errorObj);
1799
+ }
1800
+
1801
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1802
+ // return the response
1803
+ return callback(irReturnData, null);
1804
+ });
1805
+ } catch (ex) {
1806
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1807
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1808
+ return callback(null, errorObj);
1809
+ }
1810
+ }
1811
+
1812
+ /**
1813
+ * @function putOpenconfigSystemF5Database
1814
+ * @pronghornType method
1815
+ * @name putOpenconfigSystemF5Database
1816
+ * @summary data_openconfig_system_system_f5_database_database_put
1817
+ *
1818
+ * @param {object} database - database param
1819
+ * @param {getCallback} callback - a callback function to return the result
1820
+ * @return {object} results - An object containing the response of the action
1821
+ *
1822
+ * @route {POST} /putOpenconfigSystemF5Database
1823
+ * @roles admin
1824
+ * @task true
1825
+ */
1826
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1827
+ putOpenconfigSystemF5Database(database, callback) {
1828
+ const meth = 'adapter-putOpenconfigSystemF5Database';
1829
+ const origin = `${this.id}-${meth}`;
1830
+ log.trace(origin);
1831
+
1832
+ if (this.suspended && this.suspendMode === 'error') {
1833
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1834
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1835
+ return callback(null, errorObj);
1836
+ }
1837
+
1838
+ /* HERE IS WHERE YOU VALIDATE DATA */
1839
+ if (database === undefined || database === null || database === '') {
1840
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['database'], null, null, null);
1841
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1842
+ return callback(null, errorObj);
1843
+ }
1844
+
1845
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1846
+ const queryParamsAvailable = {};
1847
+ const queryParams = {};
1848
+ const pathVars = [];
1849
+ const bodyVars = database;
1850
+
1851
+ // loop in template. long callback arg name to avoid identifier conflicts
1852
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1853
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1854
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1855
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1856
+ }
1857
+ });
1858
+
1859
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1860
+ // see adapter code documentation for more information on the request object's fields
1861
+ const reqObj = {
1862
+ payload: bodyVars,
1863
+ uriPathVars: pathVars,
1864
+ uriQuery: queryParams
1865
+ };
1866
+
1867
+ try {
1868
+ // Make the call -
1869
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1870
+ return this.requestHandlerInst.identifyRequest('F5OpenconfigSystem', 'putOpenconfigSystemF5Database', reqObj, false, (irReturnData, irReturnError) => {
1871
+ // if we received an error or their is no response on the results
1872
+ // return an error
1873
+ if (irReturnError) {
1874
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1875
+ return callback(null, irReturnError);
1876
+ }
1877
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1878
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['putOpenconfigSystemF5Database'], null, null, null);
1879
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1880
+ return callback(null, errorObj);
1881
+ }
1882
+
1883
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1884
+ // return the response
1885
+ return callback(irReturnData, null);
1886
+ });
1887
+ } catch (ex) {
1888
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1889
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1890
+ return callback(null, errorObj);
1891
+ }
1892
+ }
1893
+
1894
+ /**
1895
+ * @function patchOpenconfigSystemF5Database
1896
+ * @pronghornType method
1897
+ * @name patchOpenconfigSystemF5Database
1898
+ * @summary data_openconfig_system_system_f5_database_database_patch
1899
+ *
1900
+ * @param {object} database - database param
1901
+ * @param {getCallback} callback - a callback function to return the result
1902
+ * @return {object} results - An object containing the response of the action
1903
+ *
1904
+ * @route {POST} /patchOpenconfigSystemF5Database
1905
+ * @roles admin
1906
+ * @task true
1907
+ */
1908
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1909
+ patchOpenconfigSystemF5Database(database, callback) {
1910
+ const meth = 'adapter-patchOpenconfigSystemF5Database';
1911
+ const origin = `${this.id}-${meth}`;
1912
+ log.trace(origin);
1913
+
1914
+ if (this.suspended && this.suspendMode === 'error') {
1915
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1916
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1917
+ return callback(null, errorObj);
1918
+ }
1919
+
1920
+ /* HERE IS WHERE YOU VALIDATE DATA */
1921
+ if (database === undefined || database === null || database === '') {
1922
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['database'], null, null, null);
1923
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1924
+ return callback(null, errorObj);
1925
+ }
1926
+
1927
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1928
+ const queryParamsAvailable = {};
1929
+ const queryParams = {};
1930
+ const pathVars = [];
1931
+ const bodyVars = database;
1932
+
1933
+ // loop in template. long callback arg name to avoid identifier conflicts
1934
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1935
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1936
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1937
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1938
+ }
1939
+ });
1940
+
1941
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1942
+ // see adapter code documentation for more information on the request object's fields
1943
+ const reqObj = {
1944
+ payload: bodyVars,
1945
+ uriPathVars: pathVars,
1946
+ uriQuery: queryParams
1947
+ };
1948
+
1949
+ try {
1950
+ // Make the call -
1951
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1952
+ return this.requestHandlerInst.identifyRequest('F5OpenconfigSystem', 'patchOpenconfigSystemF5Database', reqObj, false, (irReturnData, irReturnError) => {
1953
+ // if we received an error or their is no response on the results
1954
+ // return an error
1955
+ if (irReturnError) {
1956
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1957
+ return callback(null, irReturnError);
1958
+ }
1959
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1960
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['patchOpenconfigSystemF5Database'], null, null, null);
1961
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1962
+ return callback(null, errorObj);
1963
+ }
1964
+
1965
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1966
+ // return the response
1967
+ return callback(irReturnData, null);
1968
+ });
1969
+ } catch (ex) {
1970
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1971
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1972
+ return callback(null, errorObj);
1973
+ }
1974
+ }
1975
+
1976
+ /**
1977
+ * @function deleteOpenconfigSystemF5Database
1978
+ * @pronghornType method
1979
+ * @name deleteOpenconfigSystemF5Database
1980
+ * @summary data_openconfig_system_system_f5_database_database_delete
1981
+ *
1982
+ * @param {getCallback} callback - a callback function to return the result
1983
+ * @return {object} results - An object containing the response of the action
1984
+ *
1985
+ * @route {GET} /deleteOpenconfigSystemF5Database
1986
+ * @roles admin
1987
+ * @task true
1988
+ */
1989
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1990
+ deleteOpenconfigSystemF5Database(callback) {
1991
+ const meth = 'adapter-deleteOpenconfigSystemF5Database';
1992
+ const origin = `${this.id}-${meth}`;
1993
+ log.trace(origin);
1994
+
1995
+ if (this.suspended && this.suspendMode === 'error') {
1996
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1997
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1998
+ return callback(null, errorObj);
1999
+ }
2000
+
2001
+ /* HERE IS WHERE YOU VALIDATE DATA */
2002
+
2003
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2004
+ const queryParamsAvailable = {};
2005
+ const queryParams = {};
2006
+ const pathVars = [];
2007
+ const bodyVars = {};
2008
+
2009
+ // loop in template. long callback arg name to avoid identifier conflicts
2010
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2011
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2012
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2013
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2014
+ }
2015
+ });
2016
+
2017
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2018
+ // see adapter code documentation for more information on the request object's fields
2019
+ const reqObj = {
2020
+ payload: bodyVars,
2021
+ uriPathVars: pathVars,
2022
+ uriQuery: queryParams
2023
+ };
2024
+
2025
+ try {
2026
+ // Make the call -
2027
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2028
+ return this.requestHandlerInst.identifyRequest('F5OpenconfigSystem', 'deleteOpenconfigSystemF5Database', reqObj, false, (irReturnData, irReturnError) => {
2029
+ // if we received an error or their is no response on the results
2030
+ // return an error
2031
+ if (irReturnError) {
2032
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2033
+ return callback(null, irReturnError);
2034
+ }
2035
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2036
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteOpenconfigSystemF5Database'], null, null, null);
2037
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2038
+ return callback(null, errorObj);
2039
+ }
2040
+
2041
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2042
+ // return the response
2043
+ return callback(irReturnData, null);
2044
+ });
2045
+ } catch (ex) {
2046
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2047
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2048
+ return callback(null, errorObj);
2049
+ }
2050
+ }
2051
+
2052
+ /**
2053
+ * @function postOpenconfigSystemF5DatabaseConfigBackup
2054
+ * @pronghornType method
2055
+ * @name postOpenconfigSystemF5DatabaseConfigBackup
2056
+ * @summary data_openconfig_system_system_f5_database_database_f5_database_config_backup_post
2057
+ *
2058
+ * @param {object} configBackup - configBackup param
2059
+ * @param {getCallback} callback - a callback function to return the result
2060
+ * @return {object} results - An object containing the response of the action
2061
+ *
2062
+ * @route {POST} /postOpenconfigSystemF5DatabaseConfigBackup
2063
+ * @roles admin
2064
+ * @task true
2065
+ */
2066
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2067
+ postOpenconfigSystemF5DatabaseConfigBackup(configBackup, callback) {
2068
+ const meth = 'adapter-postOpenconfigSystemF5DatabaseConfigBackup';
2069
+ const origin = `${this.id}-${meth}`;
2070
+ log.trace(origin);
2071
+
2072
+ if (this.suspended && this.suspendMode === 'error') {
2073
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2074
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2075
+ return callback(null, errorObj);
2076
+ }
2077
+
2078
+ /* HERE IS WHERE YOU VALIDATE DATA */
2079
+ if (configBackup === undefined || configBackup === null || configBackup === '') {
2080
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['configBackup'], null, null, null);
2081
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2082
+ return callback(null, errorObj);
2083
+ }
2084
+
2085
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2086
+ const queryParamsAvailable = {};
2087
+ const queryParams = {};
2088
+ const pathVars = [];
2089
+ const bodyVars = configBackup;
2090
+
2091
+ // loop in template. long callback arg name to avoid identifier conflicts
2092
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2093
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2094
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2095
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2096
+ }
2097
+ });
2098
+
2099
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2100
+ // see adapter code documentation for more information on the request object's fields
2101
+ const reqObj = {
2102
+ payload: bodyVars,
2103
+ uriPathVars: pathVars,
2104
+ uriQuery: queryParams
2105
+ };
2106
+
2107
+ try {
2108
+ // Make the call -
2109
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2110
+ return this.requestHandlerInst.identifyRequest('F5OpenconfigSystem', 'postOpenconfigSystemF5DatabaseConfigBackup', reqObj, true, (irReturnData, irReturnError) => {
2111
+ // if we received an error or their is no response on the results
2112
+ // return an error
2113
+ if (irReturnError) {
2114
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2115
+ return callback(null, irReturnError);
2116
+ }
2117
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2118
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postOpenconfigSystemF5DatabaseConfigBackup'], null, null, null);
2119
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2120
+ return callback(null, errorObj);
2121
+ }
2122
+
2123
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2124
+ // return the response
2125
+ return callback(irReturnData, null);
2126
+ });
2127
+ } catch (ex) {
2128
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2129
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2130
+ return callback(null, errorObj);
2131
+ }
2132
+ }
2133
+
2134
+ /**
2135
+ * @function postOpenconfigSystemF5DatabaseCdbBackup
2136
+ * @pronghornType method
2137
+ * @name postOpenconfigSystemF5DatabaseCdbBackup
2138
+ * @summary data_openconfig_system_system_f5_database_database_f5_database_cdb_backup_post
2139
+ *
2140
+ * @param {object} cdbBackup - cdbBackup param
2141
+ * @param {getCallback} callback - a callback function to return the result
2142
+ * @return {object} results - An object containing the response of the action
2143
+ *
2144
+ * @route {POST} /postOpenconfigSystemF5DatabaseCdbBackup
2145
+ * @roles admin
2146
+ * @task true
2147
+ */
2148
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2149
+ postOpenconfigSystemF5DatabaseCdbBackup(cdbBackup, callback) {
2150
+ const meth = 'adapter-postOpenconfigSystemF5DatabaseCdbBackup';
2151
+ const origin = `${this.id}-${meth}`;
2152
+ log.trace(origin);
2153
+
2154
+ if (this.suspended && this.suspendMode === 'error') {
2155
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2156
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2157
+ return callback(null, errorObj);
2158
+ }
2159
+
2160
+ /* HERE IS WHERE YOU VALIDATE DATA */
2161
+ if (cdbBackup === undefined || cdbBackup === null || cdbBackup === '') {
2162
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['cdbBackup'], null, null, null);
2163
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2164
+ return callback(null, errorObj);
2165
+ }
2166
+
2167
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2168
+ const queryParamsAvailable = {};
2169
+ const queryParams = {};
2170
+ const pathVars = [];
2171
+ const bodyVars = cdbBackup;
2172
+
2173
+ // loop in template. long callback arg name to avoid identifier conflicts
2174
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2175
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2176
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2177
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2178
+ }
2179
+ });
2180
+
2181
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2182
+ // see adapter code documentation for more information on the request object's fields
2183
+ const reqObj = {
2184
+ payload: bodyVars,
2185
+ uriPathVars: pathVars,
2186
+ uriQuery: queryParams
2187
+ };
2188
+
2189
+ try {
2190
+ // Make the call -
2191
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2192
+ return this.requestHandlerInst.identifyRequest('F5OpenconfigSystem', 'postOpenconfigSystemF5DatabaseCdbBackup', reqObj, true, (irReturnData, irReturnError) => {
2193
+ // if we received an error or their is no response on the results
2194
+ // return an error
2195
+ if (irReturnError) {
2196
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2197
+ return callback(null, irReturnError);
2198
+ }
2199
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2200
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postOpenconfigSystemF5DatabaseCdbBackup'], null, null, null);
2201
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2202
+ return callback(null, errorObj);
2203
+ }
2204
+
2205
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2206
+ // return the response
2207
+ return callback(irReturnData, null);
2208
+ });
2209
+ } catch (ex) {
2210
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2211
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2212
+ return callback(null, errorObj);
2213
+ }
2214
+ }
2215
+
2216
+ /**
2217
+ * @function postOpenconfigSystemF5DatabaseConfigRestore
2218
+ * @pronghornType method
2219
+ * @name postOpenconfigSystemF5DatabaseConfigRestore
2220
+ * @summary data_openconfig_system_system_f5_database_database_f5_database_config_restore_post
2221
+ *
2222
+ * @param {object} configRestore - configRestore param
2223
+ * @param {getCallback} callback - a callback function to return the result
2224
+ * @return {object} results - An object containing the response of the action
2225
+ *
2226
+ * @route {POST} /postOpenconfigSystemF5DatabaseConfigRestore
2227
+ * @roles admin
2228
+ * @task true
2229
+ */
2230
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2231
+ postOpenconfigSystemF5DatabaseConfigRestore(configRestore, callback) {
2232
+ const meth = 'adapter-postOpenconfigSystemF5DatabaseConfigRestore';
2233
+ const origin = `${this.id}-${meth}`;
2234
+ log.trace(origin);
2235
+
2236
+ if (this.suspended && this.suspendMode === 'error') {
2237
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2238
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2239
+ return callback(null, errorObj);
2240
+ }
2241
+
2242
+ /* HERE IS WHERE YOU VALIDATE DATA */
2243
+ if (configRestore === undefined || configRestore === null || configRestore === '') {
2244
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['configRestore'], null, null, null);
2245
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2246
+ return callback(null, errorObj);
2247
+ }
2248
+
2249
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2250
+ const queryParamsAvailable = {};
2251
+ const queryParams = {};
2252
+ const pathVars = [];
2253
+ const bodyVars = configRestore;
2254
+
2255
+ // loop in template. long callback arg name to avoid identifier conflicts
2256
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2257
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2258
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2259
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2260
+ }
2261
+ });
2262
+
2263
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2264
+ // see adapter code documentation for more information on the request object's fields
2265
+ const reqObj = {
2266
+ payload: bodyVars,
2267
+ uriPathVars: pathVars,
2268
+ uriQuery: queryParams
2269
+ };
2270
+
2271
+ try {
2272
+ // Make the call -
2273
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2274
+ return this.requestHandlerInst.identifyRequest('F5OpenconfigSystem', 'postOpenconfigSystemF5DatabaseConfigRestore', reqObj, true, (irReturnData, irReturnError) => {
2275
+ // if we received an error or their is no response on the results
2276
+ // return an error
2277
+ if (irReturnError) {
2278
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2279
+ return callback(null, irReturnError);
2280
+ }
2281
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2282
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postOpenconfigSystemF5DatabaseConfigRestore'], null, null, null);
2283
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2284
+ return callback(null, errorObj);
2285
+ }
2286
+
2287
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2288
+ // return the response
2289
+ return callback(irReturnData, null);
2290
+ });
2291
+ } catch (ex) {
2292
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2293
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2294
+ return callback(null, errorObj);
2295
+ }
2296
+ }
2297
+
2298
+ /**
2299
+ * @function postOpenconfigSystemF5DatabaseResetToDefault
2300
+ * @pronghornType method
2301
+ * @name postOpenconfigSystemF5DatabaseResetToDefault
2302
+ * @summary data_openconfig_system_system_f5_database_database_f5_database_reset_to_default_post
2303
+ *
2304
+ * @param {object} resetToDefault - resetToDefault param
2305
+ * @param {getCallback} callback - a callback function to return the result
2306
+ * @return {object} results - An object containing the response of the action
2307
+ *
2308
+ * @route {POST} /postOpenconfigSystemF5DatabaseResetToDefault
2309
+ * @roles admin
2310
+ * @task true
2311
+ */
2312
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2313
+ postOpenconfigSystemF5DatabaseResetToDefault(resetToDefault, callback) {
2314
+ const meth = 'adapter-postOpenconfigSystemF5DatabaseResetToDefault';
2315
+ const origin = `${this.id}-${meth}`;
2316
+ log.trace(origin);
2317
+
2318
+ if (this.suspended && this.suspendMode === 'error') {
2319
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2320
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2321
+ return callback(null, errorObj);
2322
+ }
2323
+
2324
+ /* HERE IS WHERE YOU VALIDATE DATA */
2325
+ if (resetToDefault === undefined || resetToDefault === null || resetToDefault === '') {
2326
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['resetToDefault'], null, null, null);
2327
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2328
+ return callback(null, errorObj);
2329
+ }
2330
+
2331
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2332
+ const queryParamsAvailable = {};
2333
+ const queryParams = {};
2334
+ const pathVars = [];
2335
+ const bodyVars = resetToDefault;
2336
+
2337
+ // loop in template. long callback arg name to avoid identifier conflicts
2338
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2339
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2340
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2341
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2342
+ }
2343
+ });
2344
+
2345
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2346
+ // see adapter code documentation for more information on the request object's fields
2347
+ const reqObj = {
2348
+ payload: bodyVars,
2349
+ uriPathVars: pathVars,
2350
+ uriQuery: queryParams
2351
+ };
2352
+
2353
+ try {
2354
+ // Make the call -
2355
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2356
+ return this.requestHandlerInst.identifyRequest('F5OpenconfigSystem', 'postOpenconfigSystemF5DatabaseResetToDefault', reqObj, true, (irReturnData, irReturnError) => {
2357
+ // if we received an error or their is no response on the results
2358
+ // return an error
2359
+ if (irReturnError) {
2360
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2361
+ return callback(null, irReturnError);
2362
+ }
2363
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2364
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postOpenconfigSystemF5DatabaseResetToDefault'], null, null, null);
2365
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2366
+ return callback(null, errorObj);
2367
+ }
2368
+
2369
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2370
+ // return the response
2371
+ return callback(irReturnData, null);
2372
+ });
2373
+ } catch (ex) {
2374
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2375
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2376
+ return callback(null, errorObj);
2377
+ }
2378
+ }
2379
+ }
2380
+
2381
+ module.exports = F5Velos;