@itentialopensource/adapter-gcp_compute 1.3.3 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/adapter.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  /* eslint import/no-dynamic-require: warn */
4
4
  /* eslint object-curly-newline: warn */
5
+ /* eslint default-param-last:warn */
5
6
 
6
7
  // Set globals
7
8
  /* global log */
@@ -84,7 +85,6 @@ class GcpCompute extends AdapterBaseCl {
84
85
  * @param {Object} reqObj - the request to send into the healthcheck
85
86
  * @param {Callback} callback - The results of the call
86
87
  */
87
-
88
88
  healthCheck(reqObj, callback) {
89
89
  // you can modify what is passed into the healthcheck by changing things in the newReq
90
90
  let newReq = null;
@@ -121,9 +121,6 @@ class GcpCompute extends AdapterBaseCl {
121
121
  let myIgnore = [
122
122
  'healthCheck',
123
123
  'iapGetAdapterWorkflowFunctions',
124
- 'iapHasAdapterEntity',
125
- 'iapVerifyAdapterCapability',
126
- 'iapUpdateAdapterEntityCache',
127
124
  'hasEntities',
128
125
  'getAuthorization',
129
126
  'configureGtoken',
@@ -163,29 +160,15 @@ class GcpCompute extends AdapterBaseCl {
163
160
  * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
164
161
  * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
165
162
  * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
163
+ * @param {boolean} replace - true to replace entire mock data, false to merge/append
166
164
  * @param {Callback} callback - The results of the call
167
165
  */
168
- iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
166
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
169
167
  const meth = 'adapter-iapUpdateAdapterConfiguration';
170
168
  const origin = `${this.id}-${meth}`;
171
169
  log.trace(origin);
172
170
 
173
- super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
174
- }
175
-
176
- /**
177
- * See if the API path provided is found in this adapter
178
- *
179
- * @function iapFindAdapterPath
180
- * @param {string} apiPath - the api path to check on
181
- * @param {Callback} callback - The results of the call
182
- */
183
- iapFindAdapterPath(apiPath, callback) {
184
- const meth = 'adapter-iapFindAdapterPath';
185
- const origin = `${this.id}-${meth}`;
186
- log.trace(origin);
187
-
188
- super.iapFindAdapterPath(apiPath, callback);
171
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
189
172
  }
190
173
 
191
174
  /**
@@ -227,7 +210,7 @@ class GcpCompute extends AdapterBaseCl {
227
210
  }
228
211
 
229
212
  /**
230
- * @summary Get the Adaoter Queue
213
+ * @summary Get the Adapter Queue
231
214
  *
232
215
  * @function iapGetAdapterQueue
233
216
  * @param {Callback} callback - callback function
@@ -240,6 +223,22 @@ class GcpCompute extends AdapterBaseCl {
240
223
  return super.iapGetAdapterQueue(callback);
241
224
  }
242
225
 
226
+ /* SCRIPT CALLS */
227
+ /**
228
+ * See if the API path provided is found in this adapter
229
+ *
230
+ * @function iapFindAdapterPath
231
+ * @param {string} apiPath - the api path to check on
232
+ * @param {Callback} callback - The results of the call
233
+ */
234
+ iapFindAdapterPath(apiPath, callback) {
235
+ const meth = 'adapter-iapFindAdapterPath';
236
+ const origin = `${this.id}-${meth}`;
237
+ log.trace(origin);
238
+
239
+ super.iapFindAdapterPath(apiPath, callback);
240
+ }
241
+
243
242
  /**
244
243
  * @summary Runs troubleshoot scripts for adapter
245
244
  *
@@ -340,176 +339,93 @@ class GcpCompute extends AdapterBaseCl {
340
339
  }
341
340
  }
342
341
 
343
- /* BROKER CALLS */
344
342
  /**
345
- * @summary Determines if this adapter supports the specific entity
343
+ * @summary Deactivate adapter tasks
346
344
  *
347
- * @function iapHasAdapterEntity
348
- * @param {String} entityType - the entity type to check for
349
- * @param {String/Array} entityId - the specific entity we are looking for
345
+ * @function iapDeactivateTasks
350
346
  *
351
- * @param {Callback} callback - An array of whether the adapter can has the
352
- * desired capability or an error
347
+ * @param {Array} tasks - List of tasks to deactivate
348
+ * @param {Callback} callback
353
349
  */
354
- iapHasAdapterEntity(entityType, entityId, callback) {
355
- const origin = `${this.id}-adapter-iapHasAdapterEntity`;
350
+ iapDeactivateTasks(tasks, callback) {
351
+ const meth = 'adapter-iapDeactivateTasks';
352
+ const origin = `${this.id}-${meth}`;
356
353
  log.trace(origin);
357
354
 
358
- // Make the call -
359
- // iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
360
- return this.iapVerifyAdapterCapability(entityType, null, entityId, callback);
355
+ try {
356
+ return super.iapDeactivateTasks(tasks, callback);
357
+ } catch (err) {
358
+ log.error(`${origin}: ${err}`);
359
+ return callback(null, err);
360
+ }
361
361
  }
362
362
 
363
363
  /**
364
- * @summary Provides a way for the adapter to tell north bound integrations
365
- * whether the adapter supports type, action and specific entity
364
+ * @summary Activate adapter tasks that have previously been deactivated
366
365
  *
367
- * @function iapVerifyAdapterCapability
368
- * @param {String} entityType - the entity type to check for
369
- * @param {String} actionType - the action type to check for
370
- * @param {String/Array} entityId - the specific entity we are looking for
371
- *
372
- * @param {Callback} callback - An array of whether the adapter can has the
373
- * desired capability or an error
374
- */
375
- iapVerifyAdapterCapability(entityType, actionType, entityId, callback) {
376
- const meth = 'adapterBase-iapVerifyAdapterCapability';
377
- const origin = `${this.id}-${meth}`;
378
- log.trace(origin);
379
-
380
- // if caching
381
- if (this.caching) {
382
- // Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
383
- return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
384
- if (error) {
385
- return callback(null, error);
386
- }
387
-
388
- // if the cache needs to be updated, update and try again
389
- if (results && results[0] === 'needupdate') {
390
- switch (entityType) {
391
- case 'template_entity': {
392
- // if the cache is invalid, update the cache
393
- return this.getEntities(null, null, null, null, (data, err) => {
394
- if (err) {
395
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
396
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
397
- return callback(null, errorObj);
398
- }
399
-
400
- // need to check the cache again since it has been updated
401
- return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
402
- if (verror) {
403
- return callback(null, verror);
404
- }
405
-
406
- return this.capabilityResults(vcapable, callback);
407
- });
408
- });
409
- }
410
- default: {
411
- // unsupported entity type
412
- const result = [false];
413
-
414
- // put false in array for all entities
415
- if (Array.isArray(entityId)) {
416
- for (let e = 1; e < entityId.length; e += 1) {
417
- result.push(false);
418
- }
419
- }
420
-
421
- return callback(result);
422
- }
423
- }
424
- }
425
-
426
- // return the results
427
- return this.capabilityResults(results, callback);
428
- });
429
- }
430
-
431
- // if no entity id
432
- if (!entityId) {
433
- // need to check the cache again since it has been updated
434
- return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
435
- if (verror) {
436
- return callback(null, verror);
437
- }
366
+ * @function iapActivateTasks
367
+ *
368
+ * @param {Array} tasks - List of tasks to activate
369
+ * @param {Callback} callback
370
+ */
371
+ iapActivateTasks(tasks, callback) {
372
+ const meth = 'adapter-iapActivateTasks';
373
+ const origin = `${this.id}-${meth}`;
374
+ log.trace(origin);
438
375
 
439
- return this.capabilityResults(vcapable, callback);
440
- });
376
+ try {
377
+ return super.iapActivateTasks(tasks, callback);
378
+ } catch (err) {
379
+ log.error(`${origin}: ${err}`);
380
+ return callback(null, err);
441
381
  }
382
+ }
442
383
 
443
- // if not caching
444
- switch (entityType) {
445
- case 'template_entity': {
446
- // need to get the entities to check
447
- return this.getEntities(null, null, null, null, (data, err) => {
448
- if (err) {
449
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
450
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
451
- return callback(null, errorObj);
452
- }
453
-
454
- // need to check the cache again since it has been updated
455
- return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
456
- if (verror) {
457
- return callback(null, verror);
458
- }
459
-
460
- // is the entity in the list?
461
- const isEntity = this.entityInList(entityId, data.response, callback);
462
- const res = [];
463
-
464
- // not found
465
- for (let i = 0; i < isEntity.length; i += 1) {
466
- if (vcapable) {
467
- res.push(isEntity[i]);
468
- } else {
469
- res.push(false);
470
- }
471
- }
472
-
473
- return callback(res);
474
- });
475
- });
476
- }
477
- default: {
478
- // unsupported entity type
479
- const result = [false];
480
-
481
- // put false in array for all entities
482
- if (Array.isArray(entityId)) {
483
- for (let e = 1; e < entityId.length; e += 1) {
484
- result.push(false);
485
- }
486
- }
384
+ /* CACHE CALLS */
385
+ /**
386
+ * @summary Populate the cache for the given entities
387
+ *
388
+ * @function iapPopulateEntityCache
389
+ * @param {String/Array of Strings} entityType - the entity type(s) to populate
390
+ * @param {Callback} callback - whether the cache was updated or not for each entity type
391
+ *
392
+ * @returns status of the populate
393
+ */
394
+ iapPopulateEntityCache(entityTypes, callback) {
395
+ const meth = 'adapter-iapPopulateEntityCache';
396
+ const origin = `${this.id}-${meth}`;
397
+ log.trace(origin);
487
398
 
488
- return callback(result);
489
- }
399
+ try {
400
+ return super.iapPopulateEntityCache(entityTypes, callback);
401
+ } catch (err) {
402
+ log.error(`${origin}: ${err}`);
403
+ return callback(null, err);
490
404
  }
491
405
  }
492
406
 
493
407
  /**
494
- * @summary Updates the cache for all entities by call the get All entity method
495
- *
496
- * @function iapUpdateAdapterEntityCache
408
+ * @summary Retrieves data from cache for specified entity type
497
409
  *
410
+ * @function iapRetrieveEntitiesCache
411
+ * @param {String} entityType - entity of which to retrieve
412
+ * @param {Object} options - settings of which data to return and how to return it
413
+ * @param {Callback} callback - the data if it was retrieved
498
414
  */
499
- iapUpdateAdapterEntityCache() {
500
- const origin = `${this.id}-adapter-iapUpdateAdapterEntityCache`;
415
+ iapRetrieveEntitiesCache(entityType, options, callback) {
416
+ const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
417
+ const origin = `${this.id}-${meth}`;
501
418
  log.trace(origin);
502
419
 
503
- if (this.caching) {
504
- // if the cache is invalid, update the cache
505
- this.getEntities(null, null, null, null, (data, err) => {
506
- if (err) {
507
- log.trace(`${origin}: Could not load template_entity into cache - ${err}`);
508
- }
509
- });
420
+ try {
421
+ return super.iapRetrieveEntitiesCache(entityType, options, callback);
422
+ } catch (err) {
423
+ log.error(`${origin}: ${err}`);
424
+ return callback(null, err);
510
425
  }
511
426
  }
512
427
 
428
+ /* BROKER CALLS */
513
429
  /**
514
430
  * @summary Determines if this adapter supports any in a list of entities
515
431
  *
@@ -644,6 +560,38 @@ class GcpCompute extends AdapterBaseCl {
644
560
  }
645
561
 
646
562
  /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
563
+ /**
564
+ * Makes the requested generic call
565
+ *
566
+ * @function iapExpandedGenericAdapterRequest
567
+ * @param {Object} metadata - metadata for the call (optional).
568
+ * Can be a stringified Object.
569
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
570
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
571
+ * @param {Object} pathVars - the parameters to be put within the url path (optional).
572
+ * Can be a stringified Object.
573
+ * @param {Object} queryData - the parameters to be put on the url (optional).
574
+ * Can be a stringified Object.
575
+ * @param {Object} requestBody - the body to add to the request (optional).
576
+ * Can be a stringified Object.
577
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
578
+ * Can be a stringified Object.
579
+ * @param {getCallback} callback - a callback function to return the result (Generics)
580
+ * or the error
581
+ */
582
+ iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
583
+ const meth = 'adapter-iapExpandedGenericAdapterRequest';
584
+ const origin = `${this.id}-${meth}`;
585
+ log.trace(origin);
586
+
587
+ try {
588
+ return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
589
+ } catch (err) {
590
+ log.error(`${origin}: ${err}`);
591
+ return callback(null, err);
592
+ }
593
+ }
594
+
647
595
  /**
648
596
  * Makes the requested generic call
649
597
  *
@@ -664,93 +612,11 @@ class GcpCompute extends AdapterBaseCl {
664
612
  const origin = `${this.id}-${meth}`;
665
613
  log.trace(origin);
666
614
 
667
- if (this.suspended && this.suspendMode === 'error') {
668
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
669
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
670
- return callback(null, errorObj);
671
- }
672
-
673
- /* HERE IS WHERE YOU VALIDATE DATA */
674
- if (uriPath === undefined || uriPath === null || uriPath === '') {
675
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
676
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
677
- return callback(null, errorObj);
678
- }
679
- if (restMethod === undefined || restMethod === null || restMethod === '') {
680
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
681
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
682
- return callback(null, errorObj);
683
- }
684
-
685
- /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
686
- // remove any leading / and split the uripath into path variables
687
- let myPath = uriPath;
688
- while (myPath.indexOf('/') === 0) {
689
- myPath = myPath.substring(1);
690
- }
691
- const pathVars = myPath.split('/');
692
- const queryParamsAvailable = queryData;
693
- const queryParams = {};
694
- const bodyVars = requestBody;
695
-
696
- // loop in template. long callback arg name to avoid identifier conflicts
697
- Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
698
- if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
699
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
700
- queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
701
- }
702
- });
703
-
704
- // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
705
- const reqObj = {
706
- payload: bodyVars,
707
- uriPathVars: pathVars,
708
- uriQuery: queryParams,
709
- uriOptions: {}
710
- };
711
- // add headers if provided
712
- if (addlHeaders) {
713
- reqObj.addlHeaders = addlHeaders;
714
- }
715
-
716
- // determine the call and return flag
717
- let action = 'getGenerics';
718
- let returnF = true;
719
- if (restMethod.toUpperCase() === 'POST') {
720
- action = 'createGeneric';
721
- } else if (restMethod.toUpperCase() === 'PUT') {
722
- action = 'updateGeneric';
723
- } else if (restMethod.toUpperCase() === 'PATCH') {
724
- action = 'patchGeneric';
725
- } else if (restMethod.toUpperCase() === 'DELETE') {
726
- action = 'deleteGeneric';
727
- returnF = false;
728
- }
729
-
730
615
  try {
731
- // Make the call -
732
- // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
733
- return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
734
- // if we received an error or their is no response on the results
735
- // return an error
736
- if (irReturnError) {
737
- /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
738
- return callback(null, irReturnError);
739
- }
740
- if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
741
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
742
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
743
- return callback(null, errorObj);
744
- }
745
-
746
- /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
747
- // return the response
748
- return callback(irReturnData, null);
749
- });
750
- } catch (ex) {
751
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
752
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
753
- return callback(null, errorObj);
616
+ return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
617
+ } catch (err) {
618
+ log.error(`${origin}: ${err}`);
619
+ return callback(null, err);
754
620
  }
755
621
  }
756
622
 
@@ -774,94 +640,56 @@ class GcpCompute extends AdapterBaseCl {
774
640
  const origin = `${this.id}-${meth}`;
775
641
  log.trace(origin);
776
642
 
777
- if (this.suspended && this.suspendMode === 'error') {
778
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
779
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
780
- return callback(null, errorObj);
781
- }
782
-
783
- /* HERE IS WHERE YOU VALIDATE DATA */
784
- if (uriPath === undefined || uriPath === null || uriPath === '') {
785
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
786
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
787
- return callback(null, errorObj);
788
- }
789
- if (restMethod === undefined || restMethod === null || restMethod === '') {
790
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
791
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
792
- return callback(null, errorObj);
643
+ try {
644
+ return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
645
+ } catch (err) {
646
+ log.error(`${origin}: ${err}`);
647
+ return callback(null, err);
793
648
  }
649
+ }
794
650
 
795
- /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
796
- // remove any leading / and split the uripath into path variables
797
- let myPath = uriPath;
798
- while (myPath.indexOf('/') === 0) {
799
- myPath = myPath.substring(1);
800
- }
801
- const pathVars = myPath.split('/');
802
- const queryParamsAvailable = queryData;
803
- const queryParams = {};
804
- const bodyVars = requestBody;
651
+ /* INVENTORY CALLS */
652
+ /**
653
+ * @summary run the adapter lint script to return the results.
654
+ *
655
+ * @function iapRunAdapterLint
656
+ * @param {Callback} callback - callback function
657
+ */
658
+ iapRunAdapterLint(callback) {
659
+ const meth = 'adapter-iapRunAdapterLint';
660
+ const origin = `${this.id}-${meth}`;
661
+ log.trace(origin);
805
662
 
806
- // loop in template. long callback arg name to avoid identifier conflicts
807
- Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
808
- if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
809
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
810
- queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
811
- }
812
- });
663
+ return super.iapRunAdapterLint(callback);
664
+ }
813
665
 
814
- // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
815
- const reqObj = {
816
- payload: bodyVars,
817
- uriPathVars: pathVars,
818
- uriQuery: queryParams,
819
- uriOptions: {}
820
- };
821
- // add headers if provided
822
- if (addlHeaders) {
823
- reqObj.addlHeaders = addlHeaders;
824
- }
666
+ /**
667
+ * @summary run the adapter test scripts (baseunit and unit) to return the results.
668
+ * can not run integration as there can be implications with that.
669
+ *
670
+ * @function iapRunAdapterTests
671
+ * @param {Callback} callback - callback function
672
+ */
673
+ iapRunAdapterTests(callback) {
674
+ const meth = 'adapter-iapRunAdapterTests';
675
+ const origin = `${this.id}-${meth}`;
676
+ log.trace(origin);
825
677
 
826
- // determine the call and return flag
827
- let action = 'getGenericsNoBase';
828
- let returnF = true;
829
- if (restMethod.toUpperCase() === 'POST') {
830
- action = 'createGenericNoBase';
831
- } else if (restMethod.toUpperCase() === 'PUT') {
832
- action = 'updateGenericNoBase';
833
- } else if (restMethod.toUpperCase() === 'PATCH') {
834
- action = 'patchGenericNoBase';
835
- } else if (restMethod.toUpperCase() === 'DELETE') {
836
- action = 'deleteGenericNoBase';
837
- returnF = false;
838
- }
678
+ return super.iapRunAdapterTests(callback);
679
+ }
839
680
 
840
- try {
841
- // Make the call -
842
- // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
843
- return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
844
- // if we received an error or their is no response on the results
845
- // return an error
846
- if (irReturnError) {
847
- /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
848
- return callback(null, irReturnError);
849
- }
850
- if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
851
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
852
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
853
- return callback(null, errorObj);
854
- }
681
+ /**
682
+ * @summary provide inventory information abbout the adapter
683
+ *
684
+ * @function iapGetAdapterInventory
685
+ * @param {Callback} callback - callback function
686
+ */
687
+ iapGetAdapterInventory(callback) {
688
+ const meth = 'adapter-iapGetAdapterInventory';
689
+ const origin = `${this.id}-${meth}`;
690
+ log.trace(origin);
855
691
 
856
- /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
857
- // return the response
858
- return callback(irReturnData, null);
859
- });
860
- } catch (ex) {
861
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
862
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
863
- return callback(null, errorObj);
864
- }
692
+ return super.iapGetAdapterInventory(callback);
865
693
  }
866
694
 
867
695
  /**