@itentialopensource/adapter-onap_sdc 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/AUTH.md +39 -0
  4. package/BROKER.md +199 -0
  5. package/CALLS.md +169 -0
  6. package/CHANGELOG.md +52 -13
  7. package/CODE_OF_CONDUCT.md +12 -17
  8. package/CONTRIBUTING.md +88 -74
  9. package/ENHANCE.md +69 -0
  10. package/PROPERTIES.md +641 -0
  11. package/README.md +244 -392
  12. package/SUMMARY.md +9 -0
  13. package/SYSTEMINFO.md +11 -0
  14. package/TROUBLESHOOT.md +47 -0
  15. package/adapter.js +778 -55
  16. package/adapterBase.js +1331 -50
  17. package/entities/.generic/action.json +214 -0
  18. package/entities/.generic/schema.json +28 -0
  19. package/entities/.system/action.json +1 -1
  20. package/error.json +12 -0
  21. package/package.json +47 -23
  22. package/pronghorn.json +642 -0
  23. package/propertiesDecorators.json +14 -0
  24. package/propertiesSchema.json +505 -11
  25. package/refs?service=git-upload-pack +0 -0
  26. package/report/SDC_OpenApi3Json.json +5265 -0
  27. package/report/adapterInfo.json +10 -0
  28. package/report/updateReport1594254898658.json +95 -0
  29. package/report/updateReport1615488697214.json +95 -0
  30. package/report/updateReport1653173655574.json +120 -0
  31. package/sampleProperties.json +110 -6
  32. package/test/integration/adapterTestBasicGet.js +85 -0
  33. package/test/integration/adapterTestConnectivity.js +93 -0
  34. package/test/integration/adapterTestIntegration.js +33 -96
  35. package/test/unit/adapterBaseTestUnit.js +949 -0
  36. package/test/unit/adapterTestUnit.js +643 -104
  37. package/utils/adapterInfo.js +206 -0
  38. package/utils/addAuth.js +94 -0
  39. package/utils/artifactize.js +9 -14
  40. package/utils/basicGet.js +50 -0
  41. package/utils/checkMigrate.js +63 -0
  42. package/utils/entitiesToDB.js +179 -0
  43. package/utils/findPath.js +74 -0
  44. package/utils/modify.js +154 -0
  45. package/utils/packModificationScript.js +1 -1
  46. package/utils/patches2bundledDeps.js +90 -0
  47. package/utils/pre-commit.sh +4 -1
  48. package/utils/removeHooks.js +20 -0
  49. package/utils/tbScript.js +184 -0
  50. package/utils/tbUtils.js +469 -0
  51. package/utils/testRunner.js +16 -16
  52. package/utils/troubleshootingAdapter.js +190 -0
  53. package/gl-code-quality-report.json +0 -1
package/adapter.js CHANGED
@@ -10,12 +10,10 @@
10
10
 
11
11
  /* Required libraries. */
12
12
  const path = require('path');
13
- // const xmldom = require('xmldom');
14
13
 
15
14
  /* Fetch in the other needed components for the this Adaptor */
16
15
  const AdapterBaseCl = require(path.join(__dirname, 'adapterBase.js'));
17
16
 
18
-
19
17
  /**
20
18
  * This is the adapter/interface into Onap_sdc
21
19
  */
@@ -25,69 +23,303 @@ class OnapSdc extends AdapterBaseCl {
25
23
  /**
26
24
  * OnapSdc Adapter
27
25
  * @constructor
26
+ */
27
+ /* Working on changing the way we do Emit methods due to size and time constrainsts
28
28
  constructor(prongid, properties) {
29
29
  // Instantiate the AdapterBase super class
30
30
  super(prongid, properties);
31
31
 
32
+ const restFunctionNames = this.getWorkflowFunctions();
33
+
34
+ // Dynamically bind emit functions
35
+ for (let i = 0; i < restFunctionNames.length; i += 1) {
36
+ // Bind function to have name fnNameEmit for fnName
37
+ const version = restFunctionNames[i].match(/__v[0-9]+/);
38
+ const baseFnName = restFunctionNames[i].replace(/__v[0-9]+/, '');
39
+ const fnNameEmit = version ? `${baseFnName}Emit${version}` : `${baseFnName}Emit`;
40
+ this[fnNameEmit] = function (...args) {
41
+ // extract the callback
42
+ const callback = args[args.length - 1];
43
+ // slice the callback from args so we can insert our own
44
+ const functionArgs = args.slice(0, args.length - 1);
45
+ // create a random name for the listener
46
+ const eventName = `${restFunctionNames[i]}:${Math.random().toString(36)}`;
47
+ // tell the calling class to start listening
48
+ callback({ event: eventName, status: 'received' });
49
+ // store parent for use of this context later
50
+ const parent = this;
51
+ // store emission function
52
+ const func = function (val, err) {
53
+ parent.removeListener(eventName, func);
54
+ parent.emit(eventName, val, err);
55
+ };
56
+ // Use apply to call the function in a specific context
57
+ this[restFunctionNames[i]].apply(this, functionArgs.concat([func])); // eslint-disable-line prefer-spread
58
+ };
59
+ }
60
+
32
61
  // Uncomment if you have things to add to the constructor like using your own properties.
33
62
  // Otherwise the constructor in the adapterBase will be used.
34
63
  // Capture my own properties - they need to be defined in propertiesSchema.json
35
- if (this.allProps && this.allProps.myownproperty) {
36
- mypropvariable = this.allProps.myownproperty;
37
- }
64
+ // if (this.allProps && this.allProps.myownproperty) {
65
+ // mypropvariable = this.allProps.myownproperty;
66
+ // }
38
67
  }
39
68
  */
40
69
 
41
-
42
70
  /**
43
71
  * @callback healthCallback
44
- * @param {Object} result - the result of the get request (contains an id and a status)
72
+ * @param {Object} reqObj - the request to send into the healthcheck
73
+ * @param {Callback} callback - The results of the call
45
74
  */
75
+ healthCheck(reqObj, callback) {
76
+ // you can modify what is passed into the healthcheck by changing things in the newReq
77
+ let newReq = null;
78
+ if (reqObj) {
79
+ newReq = Object.assign(...reqObj);
80
+ }
81
+ super.healthCheck(newReq, callback);
82
+ }
83
+
46
84
  /**
47
- * @callback getCallback
48
- * @param {Object} result - the result of the get request (entity/ies)
49
- * @param {String} error - any error that occurred
85
+ * @iapGetAdapterWorkflowFunctions
50
86
  */
87
+ iapGetAdapterWorkflowFunctions(inIgnore) {
88
+ let myIgnore = [
89
+ 'healthCheck',
90
+ 'iapGetAdapterWorkflowFunctions',
91
+ 'iapHasAdapterEntity',
92
+ 'iapVerifyAdapterCapability',
93
+ 'iapUpdateAdapterEntityCache',
94
+ 'hasEntities',
95
+ 'getAuthorization'
96
+ ];
97
+ if (!inIgnore && Array.isArray(inIgnore)) {
98
+ myIgnore = inIgnore;
99
+ } else if (!inIgnore && typeof inIgnore === 'string') {
100
+ myIgnore = [inIgnore];
101
+ }
102
+
103
+ // The generic adapter functions should already be ignored (e.g. healthCheck)
104
+ // you can add specific methods that you do not want to be workflow functions to ignore like below
105
+ // myIgnore.push('myMethodNotInWorkflow');
106
+
107
+ return super.iapGetAdapterWorkflowFunctions(myIgnore);
108
+ }
109
+
51
110
  /**
52
- * @callback createCallback
53
- * @param {Object} item - the newly created entity
54
- * @param {String} error - any error that occurred
111
+ * iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
112
+ * allows customers to make changes to adapter configuration without having to be on the
113
+ * file system.
114
+ *
115
+ * @function iapUpdateAdapterConfiguration
116
+ * @param {string} configFile - the name of the file being updated (required)
117
+ * @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
118
+ * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
119
+ * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
120
+ * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
121
+ * @param {Callback} callback - The results of the call
55
122
  */
123
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
124
+ const meth = 'adapter-iapUpdateAdapterConfiguration';
125
+ const origin = `${this.id}-${meth}`;
126
+ log.trace(origin);
127
+
128
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
129
+ }
130
+
56
131
  /**
57
- * @callback updateCallback
58
- * @param {String} status - the status of the update action
59
- * @param {String} error - any error that occurred
132
+ * See if the API path provided is found in this adapter
133
+ *
134
+ * @function iapFindAdapterPath
135
+ * @param {string} apiPath - the api path to check on
136
+ * @param {Callback} callback - The results of the call
60
137
  */
138
+ iapFindAdapterPath(apiPath, callback) {
139
+ const meth = 'adapter-iapFindAdapterPath';
140
+ const origin = `${this.id}-${meth}`;
141
+ log.trace(origin);
142
+
143
+ super.iapFindAdapterPath(apiPath, callback);
144
+ }
145
+
61
146
  /**
62
- * @callback deleteCallback
63
- * @param {String} status - the status of the delete action
64
- * @param {String} error - any error that occurred
147
+ * @summary Suspends adapter
148
+ *
149
+ * @function iapSuspendAdapter
150
+ * @param {Callback} callback - callback function
151
+ */
152
+ iapSuspendAdapter(mode, callback) {
153
+ const meth = 'adapter-iapSuspendAdapter';
154
+ const origin = `${this.id}-${meth}`;
155
+ log.trace(origin);
156
+
157
+ try {
158
+ return super.iapSuspendAdapter(mode, callback);
159
+ } catch (error) {
160
+ log.error(`${origin}: ${error}`);
161
+ return callback(null, error);
162
+ }
163
+ }
164
+
165
+ /**
166
+ * @summary Unsuspends adapter
167
+ *
168
+ * @function iapUnsuspendAdapter
169
+ * @param {Callback} callback - callback function
170
+ */
171
+ iapUnsuspendAdapter(callback) {
172
+ const meth = 'adapter-iapUnsuspendAdapter';
173
+ const origin = `${this.id}-${meth}`;
174
+ log.trace(origin);
175
+
176
+ try {
177
+ return super.iapUnsuspendAdapter(callback);
178
+ } catch (error) {
179
+ log.error(`${origin}: ${error}`);
180
+ return callback(null, error);
181
+ }
182
+ }
183
+
184
+ /**
185
+ * @summary Get the Adaoter Queue
186
+ *
187
+ * @function iapGetAdapterQueue
188
+ * @param {Callback} callback - callback function
189
+ */
190
+ iapGetAdapterQueue(callback) {
191
+ const meth = 'adapter-iapGetAdapterQueue';
192
+ const origin = `${this.id}-${meth}`;
193
+ log.trace(origin);
194
+
195
+ return super.iapGetAdapterQueue(callback);
196
+ }
197
+
198
+ /**
199
+ * @summary Runs troubleshoot scripts for adapter
200
+ *
201
+ * @function iapTroubleshootAdapter
202
+ * @param {Object} props - the connection, healthcheck and authentication properties
203
+ *
204
+ * @param {boolean} persistFlag - whether the adapter properties should be updated
205
+ * @param {Callback} callback - The results of the call
206
+ */
207
+ iapTroubleshootAdapter(props, persistFlag, callback) {
208
+ const meth = 'adapter-iapTroubleshootAdapter';
209
+ const origin = `${this.id}-${meth}`;
210
+ log.trace(origin);
211
+
212
+ try {
213
+ return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
214
+ } catch (error) {
215
+ log.error(`${origin}: ${error}`);
216
+ return callback(null, error);
217
+ }
218
+ }
219
+
220
+ /**
221
+ * @summary runs healthcheck script for adapter
222
+ *
223
+ * @function iapRunAdapterHealthcheck
224
+ * @param {Adapter} adapter - adapter instance to troubleshoot
225
+ * @param {Callback} callback - callback function
226
+ */
227
+ iapRunAdapterHealthcheck(callback) {
228
+ const meth = 'adapter-iapRunAdapterHealthcheck';
229
+ const origin = `${this.id}-${meth}`;
230
+ log.trace(origin);
231
+
232
+ try {
233
+ return super.iapRunAdapterHealthcheck(this, callback);
234
+ } catch (error) {
235
+ log.error(`${origin}: ${error}`);
236
+ return callback(null, error);
237
+ }
238
+ }
239
+
240
+ /**
241
+ * @summary runs connectivity check script for adapter
242
+ *
243
+ * @function iapRunAdapterConnectivity
244
+ * @param {Callback} callback - callback function
245
+ */
246
+ iapRunAdapterConnectivity(callback) {
247
+ const meth = 'adapter-iapRunAdapterConnectivity';
248
+ const origin = `${this.id}-${meth}`;
249
+ log.trace(origin);
250
+
251
+ try {
252
+ return super.iapRunAdapterConnectivity(callback);
253
+ } catch (error) {
254
+ log.error(`${origin}: ${error}`);
255
+ return callback(null, error);
256
+ }
257
+ }
258
+
259
+ /**
260
+ * @summary runs basicGet script for adapter
261
+ *
262
+ * @function iapRunAdapterBasicGet
263
+ * @param {Callback} callback - callback function
264
+ */
265
+ iapRunAdapterBasicGet(callback) {
266
+ const meth = 'adapter-iapRunAdapterBasicGet';
267
+ const origin = `${this.id}-${meth}`;
268
+ log.trace(origin);
269
+
270
+ try {
271
+ return super.iapRunAdapterBasicGet(callback);
272
+ } catch (error) {
273
+ log.error(`${origin}: ${error}`);
274
+ return callback(null, error);
275
+ }
276
+ }
277
+
278
+ /**
279
+ * @summary moves entites into Mongo DB
280
+ *
281
+ * @function iapMoveAdapterEntitiesToDB
282
+ * @param {getCallback} callback - a callback function to return the result (Generics)
283
+ * or the error
65
284
  */
285
+ iapMoveAdapterEntitiesToDB(callback) {
286
+ const meth = 'adapter-iapMoveAdapterEntitiesToDB';
287
+ const origin = `${this.id}-${meth}`;
288
+ log.trace(origin);
66
289
 
290
+ try {
291
+ return super.iapMoveAdapterEntitiesToDB(callback);
292
+ } catch (err) {
293
+ log.error(`${origin}: ${err}`);
294
+ return callback(null, err);
295
+ }
296
+ }
297
+
298
+ /* BROKER CALLS */
67
299
  /**
68
300
  * @summary Determines if this adapter supports the specific entity
69
301
  *
70
- * @function hasEntity
302
+ * @function iapHasAdapterEntity
71
303
  * @param {String} entityType - the entity type to check for
72
304
  * @param {String/Array} entityId - the specific entity we are looking for
73
305
  *
74
306
  * @param {Callback} callback - An array of whether the adapter can has the
75
307
  * desired capability or an error
76
308
  */
77
- hasEntity(entityType, entityId, callback) {
78
- const origin = `${this.id}-adapter-hasEntity`;
309
+ iapHasAdapterEntity(entityType, entityId, callback) {
310
+ const origin = `${this.id}-adapter-iapHasAdapterEntity`;
79
311
  log.trace(origin);
80
312
 
81
313
  // Make the call -
82
- // verifyCapability(entityType, actionType, entityId, callback)
83
- return this.verifyCapability(entityType, null, entityId, callback);
314
+ // iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
315
+ return this.iapVerifyAdapterCapability(entityType, null, entityId, callback);
84
316
  }
85
317
 
86
318
  /**
87
319
  * @summary Provides a way for the adapter to tell north bound integrations
88
320
  * whether the adapter supports type, action and specific entity
89
321
  *
90
- * @function verifyCapability
322
+ * @function iapVerifyAdapterCapability
91
323
  * @param {String} entityType - the entity type to check for
92
324
  * @param {String} actionType - the action type to check for
93
325
  * @param {String/Array} entityId - the specific entity we are looking for
@@ -95,15 +327,15 @@ class OnapSdc extends AdapterBaseCl {
95
327
  * @param {Callback} callback - An array of whether the adapter can has the
96
328
  * desired capability or an error
97
329
  */
98
- verifyCapability(entityType, actionType, entityId, callback) {
99
- const meth = 'adapterBase-verifyCapability';
330
+ iapVerifyAdapterCapability(entityType, actionType, entityId, callback) {
331
+ const meth = 'adapterBase-iapVerifyAdapterCapability';
100
332
  const origin = `${this.id}-${meth}`;
101
333
  log.trace(origin);
102
334
 
103
335
  // if caching
104
336
  if (this.caching) {
105
- // Make the call - verifyCapability(entityType, actionType, entityId, callback)
106
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (results, error) => {
337
+ // Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
338
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
107
339
  if (error) {
108
340
  return callback(null, error);
109
341
  }
@@ -121,7 +353,7 @@ class OnapSdc extends AdapterBaseCl {
121
353
  }
122
354
 
123
355
  // need to check the cache again since it has been updated
124
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
356
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
125
357
  if (verror) {
126
358
  return callback(null, verror);
127
359
  }
@@ -154,7 +386,7 @@ class OnapSdc extends AdapterBaseCl {
154
386
  // if no entity id
155
387
  if (!entityId) {
156
388
  // need to check the cache again since it has been updated
157
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
389
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
158
390
  if (verror) {
159
391
  return callback(null, verror);
160
392
  }
@@ -175,7 +407,7 @@ class OnapSdc extends AdapterBaseCl {
175
407
  }
176
408
 
177
409
  // need to check the cache again since it has been updated
178
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
410
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
179
411
  if (verror) {
180
412
  return callback(null, verror);
181
413
  }
@@ -216,11 +448,11 @@ class OnapSdc extends AdapterBaseCl {
216
448
  /**
217
449
  * @summary Updates the cache for all entities by call the get All entity method
218
450
  *
219
- * @function updateEntityCache
451
+ * @function iapUpdateAdapterEntityCache
220
452
  *
221
453
  */
222
- updateEntityCache() {
223
- const origin = `${this.id}-adapter-updateEntityCache`;
454
+ iapUpdateAdapterEntityCache() {
455
+ const origin = `${this.id}-adapter-iapUpdateAdapterEntityCache`;
224
456
  log.trace(origin);
225
457
 
226
458
  if (this.caching) {
@@ -233,6 +465,385 @@ class OnapSdc extends AdapterBaseCl {
233
465
  }
234
466
  }
235
467
 
468
+ /**
469
+ * @summary Determines if this adapter supports any in a list of entities
470
+ *
471
+ * @function hasEntities
472
+ * @param {String} entityType - the entity type to check for
473
+ * @param {Array} entityList - the list of entities we are looking for
474
+ *
475
+ * @param {Callback} callback - A map where the entity is the key and the
476
+ * value is true or false
477
+ */
478
+ hasEntities(entityType, entityList, callback) {
479
+ const meth = 'adapter-hasEntities';
480
+ const origin = `${this.id}-${meth}`;
481
+ log.trace(origin);
482
+
483
+ try {
484
+ return super.hasEntities(entityType, entityList, callback);
485
+ } catch (err) {
486
+ log.error(`${origin}: ${err}`);
487
+ return callback(null, err);
488
+ }
489
+ }
490
+
491
+ /**
492
+ * @summary Get Appliance that match the deviceName
493
+ *
494
+ * @function getDevice
495
+ * @param {String} deviceName - the deviceName to find (required)
496
+ *
497
+ * @param {getCallback} callback - a callback function to return the result
498
+ * (appliance) or the error
499
+ */
500
+ getDevice(deviceName, callback) {
501
+ const meth = 'adapter-getDevice';
502
+ const origin = `${this.id}-${meth}`;
503
+ log.trace(origin);
504
+
505
+ try {
506
+ return super.getDevice(deviceName, callback);
507
+ } catch (err) {
508
+ log.error(`${origin}: ${err}`);
509
+ return callback(null, err);
510
+ }
511
+ }
512
+
513
+ /**
514
+ * @summary Get Appliances that match the filter
515
+ *
516
+ * @function getDevicesFiltered
517
+ * @param {Object} options - the data to use to filter the appliances (optional)
518
+ *
519
+ * @param {getCallback} callback - a callback function to return the result
520
+ * (appliances) or the error
521
+ */
522
+ getDevicesFiltered(options, callback) {
523
+ const meth = 'adapter-getDevicesFiltered';
524
+ const origin = `${this.id}-${meth}`;
525
+ log.trace(origin);
526
+
527
+ try {
528
+ return super.getDevicesFiltered(options, callback);
529
+ } catch (err) {
530
+ log.error(`${origin}: ${err}`);
531
+ return callback(null, err);
532
+ }
533
+ }
534
+
535
+ /**
536
+ * @summary Gets the status for the provided appliance
537
+ *
538
+ * @function isAlive
539
+ * @param {String} deviceName - the deviceName of the appliance. (required)
540
+ *
541
+ * @param {configCallback} callback - callback function to return the result
542
+ * (appliance isAlive) or the error
543
+ */
544
+ isAlive(deviceName, callback) {
545
+ const meth = 'adapter-isAlive';
546
+ const origin = `${this.id}-${meth}`;
547
+ log.trace(origin);
548
+
549
+ try {
550
+ return super.isAlive(deviceName, callback);
551
+ } catch (err) {
552
+ log.error(`${origin}: ${err}`);
553
+ return callback(null, err);
554
+ }
555
+ }
556
+
557
+ /**
558
+ * @summary Gets a config for the provided Appliance
559
+ *
560
+ * @function getConfig
561
+ * @param {String} deviceName - the deviceName of the appliance. (required)
562
+ * @param {String} format - the desired format of the config. (optional)
563
+ *
564
+ * @param {configCallback} callback - callback function to return the result
565
+ * (appliance config) or the error
566
+ */
567
+ getConfig(deviceName, format, callback) {
568
+ const meth = 'adapter-getConfig';
569
+ const origin = `${this.id}-${meth}`;
570
+ log.trace(origin);
571
+
572
+ try {
573
+ return super.getConfig(deviceName, format, callback);
574
+ } catch (err) {
575
+ log.error(`${origin}: ${err}`);
576
+ return callback(null, err);
577
+ }
578
+ }
579
+
580
+ /**
581
+ * @summary Gets the device count from the system
582
+ *
583
+ * @function iapGetDeviceCount
584
+ *
585
+ * @param {getCallback} callback - callback function to return the result
586
+ * (count) or the error
587
+ */
588
+ iapGetDeviceCount(callback) {
589
+ const meth = 'adapter-iapGetDeviceCount';
590
+ const origin = `${this.id}-${meth}`;
591
+ log.trace(origin);
592
+
593
+ try {
594
+ return super.iapGetDeviceCount(callback);
595
+ } catch (err) {
596
+ log.error(`${origin}: ${err}`);
597
+ return callback(null, err);
598
+ }
599
+ }
600
+
601
+ /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
602
+ /**
603
+ * Makes the requested generic call
604
+ *
605
+ * @function genericAdapterRequest
606
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
607
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
608
+ * @param {Object} queryData - the parameters to be put on the url (optional).
609
+ * Can be a stringified Object.
610
+ * @param {Object} requestBody - the body to add to the request (optional).
611
+ * Can be a stringified Object.
612
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
613
+ * Can be a stringified Object.
614
+ * @param {getCallback} callback - a callback function to return the result (Generics)
615
+ * or the error
616
+ */
617
+ genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
618
+ const meth = 'adapter-genericAdapterRequest';
619
+ const origin = `${this.id}-${meth}`;
620
+ log.trace(origin);
621
+
622
+ if (this.suspended && this.suspendMode === 'error') {
623
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
624
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
625
+ return callback(null, errorObj);
626
+ }
627
+
628
+ /* HERE IS WHERE YOU VALIDATE DATA */
629
+ if (uriPath === undefined || uriPath === null || uriPath === '') {
630
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
631
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
632
+ return callback(null, errorObj);
633
+ }
634
+ if (restMethod === undefined || restMethod === null || restMethod === '') {
635
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
636
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
637
+ return callback(null, errorObj);
638
+ }
639
+
640
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
641
+ // remove any leading / and split the uripath into path variables
642
+ let myPath = uriPath;
643
+ while (myPath.indexOf('/') === 0) {
644
+ myPath = myPath.substring(1);
645
+ }
646
+ const pathVars = myPath.split('/');
647
+ const queryParamsAvailable = queryData;
648
+ const queryParams = {};
649
+ const bodyVars = requestBody;
650
+
651
+ // loop in template. long callback arg name to avoid identifier conflicts
652
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
653
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
654
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
655
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
656
+ }
657
+ });
658
+
659
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
660
+ const reqObj = {
661
+ payload: bodyVars,
662
+ uriPathVars: pathVars,
663
+ uriQuery: queryParams,
664
+ uriOptions: {}
665
+ };
666
+ // add headers if provided
667
+ if (addlHeaders) {
668
+ reqObj.addlHeaders = addlHeaders;
669
+ }
670
+
671
+ // determine the call and return flag
672
+ let action = 'getGenerics';
673
+ let returnF = true;
674
+ if (restMethod.toUpperCase() === 'POST') {
675
+ action = 'createGeneric';
676
+ } else if (restMethod.toUpperCase() === 'PUT') {
677
+ action = 'updateGeneric';
678
+ } else if (restMethod.toUpperCase() === 'PATCH') {
679
+ action = 'patchGeneric';
680
+ } else if (restMethod.toUpperCase() === 'DELETE') {
681
+ action = 'deleteGeneric';
682
+ returnF = false;
683
+ }
684
+
685
+ try {
686
+ // Make the call -
687
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
688
+ return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
689
+ // if we received an error or their is no response on the results
690
+ // return an error
691
+ if (irReturnError) {
692
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
693
+ return callback(null, irReturnError);
694
+ }
695
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
696
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
697
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
698
+ return callback(null, errorObj);
699
+ }
700
+
701
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
702
+ // return the response
703
+ return callback(irReturnData, null);
704
+ });
705
+ } catch (ex) {
706
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
707
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
708
+ return callback(null, errorObj);
709
+ }
710
+ }
711
+
712
+ /**
713
+ * Makes the requested generic call with no base path or version
714
+ *
715
+ * @function genericAdapterRequestNoBasePath
716
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
717
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
718
+ * @param {Object} queryData - the parameters to be put on the url (optional).
719
+ * Can be a stringified Object.
720
+ * @param {Object} requestBody - the body to add to the request (optional).
721
+ * Can be a stringified Object.
722
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
723
+ * Can be a stringified Object.
724
+ * @param {getCallback} callback - a callback function to return the result (Generics)
725
+ * or the error
726
+ */
727
+ genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
728
+ const meth = 'adapter-genericAdapterRequestNoBasePath';
729
+ const origin = `${this.id}-${meth}`;
730
+ log.trace(origin);
731
+
732
+ if (this.suspended && this.suspendMode === 'error') {
733
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
734
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
735
+ return callback(null, errorObj);
736
+ }
737
+
738
+ /* HERE IS WHERE YOU VALIDATE DATA */
739
+ if (uriPath === undefined || uriPath === null || uriPath === '') {
740
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
741
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
742
+ return callback(null, errorObj);
743
+ }
744
+ if (restMethod === undefined || restMethod === null || restMethod === '') {
745
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
746
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
747
+ return callback(null, errorObj);
748
+ }
749
+
750
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
751
+ // remove any leading / and split the uripath into path variables
752
+ let myPath = uriPath;
753
+ while (myPath.indexOf('/') === 0) {
754
+ myPath = myPath.substring(1);
755
+ }
756
+ const pathVars = myPath.split('/');
757
+ const queryParamsAvailable = queryData;
758
+ const queryParams = {};
759
+ const bodyVars = requestBody;
760
+
761
+ // loop in template. long callback arg name to avoid identifier conflicts
762
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
763
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
764
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
765
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
766
+ }
767
+ });
768
+
769
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
770
+ const reqObj = {
771
+ payload: bodyVars,
772
+ uriPathVars: pathVars,
773
+ uriQuery: queryParams,
774
+ uriOptions: {}
775
+ };
776
+ // add headers if provided
777
+ if (addlHeaders) {
778
+ reqObj.addlHeaders = addlHeaders;
779
+ }
780
+
781
+ // determine the call and return flag
782
+ let action = 'getGenericsNoBase';
783
+ let returnF = true;
784
+ if (restMethod.toUpperCase() === 'POST') {
785
+ action = 'createGenericNoBase';
786
+ } else if (restMethod.toUpperCase() === 'PUT') {
787
+ action = 'updateGenericNoBase';
788
+ } else if (restMethod.toUpperCase() === 'PATCH') {
789
+ action = 'patchGenericNoBase';
790
+ } else if (restMethod.toUpperCase() === 'DELETE') {
791
+ action = 'deleteGenericNoBase';
792
+ returnF = false;
793
+ }
794
+
795
+ try {
796
+ // Make the call -
797
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
798
+ return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
799
+ // if we received an error or their is no response on the results
800
+ // return an error
801
+ if (irReturnError) {
802
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
803
+ return callback(null, irReturnError);
804
+ }
805
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
806
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
807
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
808
+ return callback(null, errorObj);
809
+ }
810
+
811
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
812
+ // return the response
813
+ return callback(irReturnData, null);
814
+ });
815
+ } catch (ex) {
816
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
817
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
818
+ return callback(null, errorObj);
819
+ }
820
+ }
821
+
822
+ /**
823
+ * @callback healthCallback
824
+ * @param {Object} result - the result of the get request (contains an id and a status)
825
+ */
826
+ /**
827
+ * @callback getCallback
828
+ * @param {Object} result - the result of the get request (entity/ies)
829
+ * @param {String} error - any error that occurred
830
+ */
831
+ /**
832
+ * @callback createCallback
833
+ * @param {Object} item - the newly created entity
834
+ * @param {String} error - any error that occurred
835
+ */
836
+ /**
837
+ * @callback updateCallback
838
+ * @param {String} status - the status of the update action
839
+ * @param {String} error - any error that occurred
840
+ */
841
+ /**
842
+ * @callback deleteCallback
843
+ * @param {String} status - the status of the delete action
844
+ * @param {String} error - any error that occurred
845
+ */
846
+
236
847
  /**
237
848
  * @summary Download service artifact
238
849
  *
@@ -248,6 +859,12 @@ class OnapSdc extends AdapterBaseCl {
248
859
  const origin = `${this.id}-${meth}`;
249
860
  log.trace(origin);
250
861
 
862
+ if (this.suspended && this.suspendMode === 'error') {
863
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
864
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
865
+ return callback(null, errorObj);
866
+ }
867
+
251
868
  /* HERE IS WHERE YOU VALIDATE DATA */
252
869
  if (serviceName === undefined || serviceName === null || serviceName === '') {
253
870
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['serviceName'], null, null, null);
@@ -301,7 +918,6 @@ class OnapSdc extends AdapterBaseCl {
301
918
  uriQuery: queryParams,
302
919
  addlHeaders: thisHeaderData };
303
920
 
304
-
305
921
  try {
306
922
  // Make the call -
307
923
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -345,6 +961,12 @@ class OnapSdc extends AdapterBaseCl {
345
961
  const origin = `${this.id}-${meth}`;
346
962
  log.trace(origin);
347
963
 
964
+ if (this.suspended && this.suspendMode === 'error') {
965
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
966
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
967
+ return callback(null, errorObj);
968
+ }
969
+
348
970
  /* HERE IS WHERE YOU VALIDATE DATA */
349
971
  if (serviceName === undefined || serviceName === null || serviceName === '') {
350
972
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['serviceName'], null, null, null);
@@ -403,7 +1025,6 @@ class OnapSdc extends AdapterBaseCl {
403
1025
  uriQuery: queryParams,
404
1026
  addlHeaders: thisHeaderData };
405
1027
 
406
-
407
1028
  try {
408
1029
  // Make the call -
409
1030
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -448,6 +1069,12 @@ class OnapSdc extends AdapterBaseCl {
448
1069
  const origin = `${this.id}-${meth}`;
449
1070
  log.trace(origin);
450
1071
 
1072
+ if (this.suspended && this.suspendMode === 'error') {
1073
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1074
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1075
+ return callback(null, errorObj);
1076
+ }
1077
+
451
1078
  /* HERE IS WHERE YOU VALIDATE DATA */
452
1079
  if (serviceName === undefined || serviceName === null || serviceName === '') {
453
1080
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['serviceName'], null, null, null);
@@ -511,7 +1138,6 @@ class OnapSdc extends AdapterBaseCl {
511
1138
  uriQuery: queryParams,
512
1139
  addlHeaders: thisHeaderData };
513
1140
 
514
-
515
1141
  try {
516
1142
  // Make the call -
517
1143
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -552,6 +1178,12 @@ class OnapSdc extends AdapterBaseCl {
552
1178
  const origin = `${this.id}-${meth}`;
553
1179
  log.trace(origin);
554
1180
 
1181
+ if (this.suspended && this.suspendMode === 'error') {
1182
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1183
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1184
+ return callback(null, errorObj);
1185
+ }
1186
+
555
1187
  /* HERE IS WHERE YOU VALIDATE DATA */
556
1188
  if (requestJson === undefined || requestJson === null || requestJson === '') {
557
1189
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['requestJson'], null, null, null);
@@ -595,7 +1227,6 @@ class OnapSdc extends AdapterBaseCl {
595
1227
  uriQuery: queryParams,
596
1228
  addlHeaders: thisHeaderData };
597
1229
 
598
-
599
1230
  try {
600
1231
  // Make the call -
601
1232
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -635,6 +1266,12 @@ class OnapSdc extends AdapterBaseCl {
635
1266
  const origin = `${this.id}-${meth}`;
636
1267
  log.trace(origin);
637
1268
 
1269
+ if (this.suspended && this.suspendMode === 'error') {
1270
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1271
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1272
+ return callback(null, errorObj);
1273
+ }
1274
+
638
1275
  /* HERE IS WHERE YOU VALIDATE DATA */
639
1276
 
640
1277
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -681,6 +1318,12 @@ class OnapSdc extends AdapterBaseCl {
681
1318
  const origin = `${this.id}-${meth}`;
682
1319
  log.trace(origin);
683
1320
 
1321
+ if (this.suspended && this.suspendMode === 'error') {
1322
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1323
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1324
+ return callback(null, errorObj);
1325
+ }
1326
+
684
1327
  /* HERE IS WHERE YOU VALIDATE DATA */
685
1328
  if (requestJson === undefined || requestJson === null || requestJson === '') {
686
1329
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['requestJson'], null, null, null);
@@ -724,7 +1367,6 @@ class OnapSdc extends AdapterBaseCl {
724
1367
  uriQuery: queryParams,
725
1368
  addlHeaders: thisHeaderData };
726
1369
 
727
-
728
1370
  try {
729
1371
  // Make the call -
730
1372
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -764,6 +1406,12 @@ class OnapSdc extends AdapterBaseCl {
764
1406
  const origin = `${this.id}-${meth}`;
765
1407
  log.trace(origin);
766
1408
 
1409
+ if (this.suspended && this.suspendMode === 'error') {
1410
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1411
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1412
+ return callback(null, errorObj);
1413
+ }
1414
+
767
1415
  /* HERE IS WHERE YOU VALIDATE DATA */
768
1416
 
769
1417
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -812,6 +1460,12 @@ class OnapSdc extends AdapterBaseCl {
812
1460
  const origin = `${this.id}-${meth}`;
813
1461
  log.trace(origin);
814
1462
 
1463
+ if (this.suspended && this.suspendMode === 'error') {
1464
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1465
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1466
+ return callback(null, errorObj);
1467
+ }
1468
+
815
1469
  /* HERE IS WHERE YOU VALIDATE DATA */
816
1470
  if (assetType === undefined || assetType === null || assetType === '') {
817
1471
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -865,7 +1519,6 @@ class OnapSdc extends AdapterBaseCl {
865
1519
  uriQuery: queryParams,
866
1520
  addlHeaders: thisHeaderData };
867
1521
 
868
-
869
1522
  try {
870
1523
  // Make the call -
871
1524
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -908,6 +1561,12 @@ class OnapSdc extends AdapterBaseCl {
908
1561
  const origin = `${this.id}-${meth}`;
909
1562
  log.trace(origin);
910
1563
 
1564
+ if (this.suspended && this.suspendMode === 'error') {
1565
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1566
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1567
+ return callback(null, errorObj);
1568
+ }
1569
+
911
1570
  /* HERE IS WHERE YOU VALIDATE DATA */
912
1571
  if (assetType === undefined || assetType === null || assetType === '') {
913
1572
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -961,7 +1620,6 @@ class OnapSdc extends AdapterBaseCl {
961
1620
  uriQuery: queryParams,
962
1621
  addlHeaders: thisHeaderData };
963
1622
 
964
-
965
1623
  try {
966
1624
  // Make the call -
967
1625
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1005,6 +1663,12 @@ class OnapSdc extends AdapterBaseCl {
1005
1663
  const origin = `${this.id}-${meth}`;
1006
1664
  log.trace(origin);
1007
1665
 
1666
+ if (this.suspended && this.suspendMode === 'error') {
1667
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1668
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1669
+ return callback(null, errorObj);
1670
+ }
1671
+
1008
1672
  /* HERE IS WHERE YOU VALIDATE DATA */
1009
1673
  if (assetType === undefined || assetType === null || assetType === '') {
1010
1674
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -1063,7 +1727,6 @@ class OnapSdc extends AdapterBaseCl {
1063
1727
  uriQuery: queryParams,
1064
1728
  addlHeaders: thisHeaderData };
1065
1729
 
1066
-
1067
1730
  try {
1068
1731
  // Make the call -
1069
1732
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1106,6 +1769,12 @@ class OnapSdc extends AdapterBaseCl {
1106
1769
  const origin = `${this.id}-${meth}`;
1107
1770
  log.trace(origin);
1108
1771
 
1772
+ if (this.suspended && this.suspendMode === 'error') {
1773
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1774
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1775
+ return callback(null, errorObj);
1776
+ }
1777
+
1109
1778
  /* HERE IS WHERE YOU VALIDATE DATA */
1110
1779
  if (assetType === undefined || assetType === null || assetType === '') {
1111
1780
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -1159,7 +1828,6 @@ class OnapSdc extends AdapterBaseCl {
1159
1828
  uriQuery: queryParams,
1160
1829
  addlHeaders: thisHeaderData };
1161
1830
 
1162
-
1163
1831
  try {
1164
1832
  // Make the call -
1165
1833
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1203,6 +1871,12 @@ class OnapSdc extends AdapterBaseCl {
1203
1871
  const origin = `${this.id}-${meth}`;
1204
1872
  log.trace(origin);
1205
1873
 
1874
+ if (this.suspended && this.suspendMode === 'error') {
1875
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1876
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1877
+ return callback(null, errorObj);
1878
+ }
1879
+
1206
1880
  /* HERE IS WHERE YOU VALIDATE DATA */
1207
1881
  if (assetType === undefined || assetType === null || assetType === '') {
1208
1882
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -1261,7 +1935,6 @@ class OnapSdc extends AdapterBaseCl {
1261
1935
  uriQuery: queryParams,
1262
1936
  addlHeaders: thisHeaderData };
1263
1937
 
1264
-
1265
1938
  try {
1266
1939
  // Make the call -
1267
1940
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1305,6 +1978,12 @@ class OnapSdc extends AdapterBaseCl {
1305
1978
  const origin = `${this.id}-${meth}`;
1306
1979
  log.trace(origin);
1307
1980
 
1981
+ if (this.suspended && this.suspendMode === 'error') {
1982
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1983
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1984
+ return callback(null, errorObj);
1985
+ }
1986
+
1308
1987
  /* HERE IS WHERE YOU VALIDATE DATA */
1309
1988
  if (assetType === undefined || assetType === null || assetType === '') {
1310
1989
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -1363,7 +2042,6 @@ class OnapSdc extends AdapterBaseCl {
1363
2042
  uriQuery: queryParams,
1364
2043
  addlHeaders: thisHeaderData };
1365
2044
 
1366
-
1367
2045
  try {
1368
2046
  // Make the call -
1369
2047
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1408,6 +2086,12 @@ class OnapSdc extends AdapterBaseCl {
1408
2086
  const origin = `${this.id}-${meth}`;
1409
2087
  log.trace(origin);
1410
2088
 
2089
+ if (this.suspended && this.suspendMode === 'error') {
2090
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2091
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2092
+ return callback(null, errorObj);
2093
+ }
2094
+
1411
2095
  /* HERE IS WHERE YOU VALIDATE DATA */
1412
2096
  if (assetType === undefined || assetType === null || assetType === '') {
1413
2097
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -1471,7 +2155,6 @@ class OnapSdc extends AdapterBaseCl {
1471
2155
  uriQuery: queryParams,
1472
2156
  addlHeaders: thisHeaderData };
1473
2157
 
1474
-
1475
2158
  try {
1476
2159
  // Make the call -
1477
2160
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1515,6 +2198,12 @@ class OnapSdc extends AdapterBaseCl {
1515
2198
  const origin = `${this.id}-${meth}`;
1516
2199
  log.trace(origin);
1517
2200
 
2201
+ if (this.suspended && this.suspendMode === 'error') {
2202
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2203
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2204
+ return callback(null, errorObj);
2205
+ }
2206
+
1518
2207
  /* HERE IS WHERE YOU VALIDATE DATA */
1519
2208
  if (assetType === undefined || assetType === null || assetType === '') {
1520
2209
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -1573,7 +2262,6 @@ class OnapSdc extends AdapterBaseCl {
1573
2262
  uriQuery: queryParams,
1574
2263
  addlHeaders: thisHeaderData };
1575
2264
 
1576
-
1577
2265
  try {
1578
2266
  // Make the call -
1579
2267
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1617,6 +2305,12 @@ class OnapSdc extends AdapterBaseCl {
1617
2305
  const origin = `${this.id}-${meth}`;
1618
2306
  log.trace(origin);
1619
2307
 
2308
+ if (this.suspended && this.suspendMode === 'error') {
2309
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2310
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2311
+ return callback(null, errorObj);
2312
+ }
2313
+
1620
2314
  /* HERE IS WHERE YOU VALIDATE DATA */
1621
2315
  if (uuid === undefined || uuid === null || uuid === '') {
1622
2316
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uuid'], null, null, null);
@@ -1675,7 +2369,6 @@ class OnapSdc extends AdapterBaseCl {
1675
2369
  uriQuery: queryParams,
1676
2370
  addlHeaders: thisHeaderData };
1677
2371
 
1678
-
1679
2372
  try {
1680
2373
  // Make the call -
1681
2374
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1720,6 +2413,12 @@ class OnapSdc extends AdapterBaseCl {
1720
2413
  const origin = `${this.id}-${meth}`;
1721
2414
  log.trace(origin);
1722
2415
 
2416
+ if (this.suspended && this.suspendMode === 'error') {
2417
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2418
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2419
+ return callback(null, errorObj);
2420
+ }
2421
+
1723
2422
  /* HERE IS WHERE YOU VALIDATE DATA */
1724
2423
  if (assetType === undefined || assetType === null || assetType === '') {
1725
2424
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -1763,7 +2462,6 @@ class OnapSdc extends AdapterBaseCl {
1763
2462
  uriQuery: queryParams,
1764
2463
  addlHeaders: thisHeaderData };
1765
2464
 
1766
-
1767
2465
  try {
1768
2466
  // Make the call -
1769
2467
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1805,6 +2503,12 @@ class OnapSdc extends AdapterBaseCl {
1805
2503
  const origin = `${this.id}-${meth}`;
1806
2504
  log.trace(origin);
1807
2505
 
2506
+ if (this.suspended && this.suspendMode === 'error') {
2507
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2508
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2509
+ return callback(null, errorObj);
2510
+ }
2511
+
1808
2512
  /* HERE IS WHERE YOU VALIDATE DATA */
1809
2513
  if (assetType === undefined || assetType === null || assetType === '') {
1810
2514
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -1853,7 +2557,6 @@ class OnapSdc extends AdapterBaseCl {
1853
2557
  uriQuery: queryParams,
1854
2558
  addlHeaders: thisHeaderData };
1855
2559
 
1856
-
1857
2560
  try {
1858
2561
  // Make the call -
1859
2562
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1895,6 +2598,12 @@ class OnapSdc extends AdapterBaseCl {
1895
2598
  const origin = `${this.id}-${meth}`;
1896
2599
  log.trace(origin);
1897
2600
 
2601
+ if (this.suspended && this.suspendMode === 'error') {
2602
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2603
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2604
+ return callback(null, errorObj);
2605
+ }
2606
+
1898
2607
  /* HERE IS WHERE YOU VALIDATE DATA */
1899
2608
  if (assetType === undefined || assetType === null || assetType === '') {
1900
2609
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -1943,7 +2652,6 @@ class OnapSdc extends AdapterBaseCl {
1943
2652
  uriQuery: queryParams,
1944
2653
  addlHeaders: thisHeaderData };
1945
2654
 
1946
-
1947
2655
  try {
1948
2656
  // Make the call -
1949
2657
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -1985,6 +2693,12 @@ class OnapSdc extends AdapterBaseCl {
1985
2693
  const origin = `${this.id}-${meth}`;
1986
2694
  log.trace(origin);
1987
2695
 
2696
+ if (this.suspended && this.suspendMode === 'error') {
2697
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2698
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2699
+ return callback(null, errorObj);
2700
+ }
2701
+
1988
2702
  /* HERE IS WHERE YOU VALIDATE DATA */
1989
2703
  if (assetType === undefined || assetType === null || assetType === '') {
1990
2704
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['assetType'], null, null, null);
@@ -2033,7 +2747,6 @@ class OnapSdc extends AdapterBaseCl {
2033
2747
  uriQuery: queryParams,
2034
2748
  addlHeaders: thisHeaderData };
2035
2749
 
2036
-
2037
2750
  try {
2038
2751
  // Make the call -
2039
2752
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -2077,6 +2790,12 @@ class OnapSdc extends AdapterBaseCl {
2077
2790
  const origin = `${this.id}-${meth}`;
2078
2791
  log.trace(origin);
2079
2792
 
2793
+ if (this.suspended && this.suspendMode === 'error') {
2794
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2795
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2796
+ return callback(null, errorObj);
2797
+ }
2798
+
2080
2799
  /* HERE IS WHERE YOU VALIDATE DATA */
2081
2800
  if (lifecycleOperation === undefined || lifecycleOperation === null || lifecycleOperation === '') {
2082
2801
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['lifecycleOperation'], null, null, null);
@@ -2135,7 +2854,6 @@ class OnapSdc extends AdapterBaseCl {
2135
2854
  uriQuery: queryParams,
2136
2855
  addlHeaders: thisHeaderData };
2137
2856
 
2138
-
2139
2857
  try {
2140
2858
  // Make the call -
2141
2859
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
@@ -2178,6 +2896,12 @@ class OnapSdc extends AdapterBaseCl {
2178
2896
  const origin = `${this.id}-${meth}`;
2179
2897
  log.trace(origin);
2180
2898
 
2899
+ if (this.suspended && this.suspendMode === 'error') {
2900
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2901
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2902
+ return callback(null, errorObj);
2903
+ }
2904
+
2181
2905
  /* HERE IS WHERE YOU VALIDATE DATA */
2182
2906
  if (serviceUUID === undefined || serviceUUID === null || serviceUUID === '') {
2183
2907
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['serviceUUID'], null, null, null);
@@ -2226,7 +2950,6 @@ class OnapSdc extends AdapterBaseCl {
2226
2950
  uriQuery: queryParams,
2227
2951
  addlHeaders: thisHeaderData };
2228
2952
 
2229
-
2230
2953
  try {
2231
2954
  // Make the call -
2232
2955
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)