@itentialopensource/adapter-paragon_insights 0.1.2 → 0.1.3

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
@@ -46317,6 +46317,1986 @@ class ParagonInsights extends AdapterBaseCl {
46317
46317
  return callback(null, errorObj);
46318
46318
  }
46319
46319
  }
46320
+
46321
+ /**
46322
+ * @function retrieveDeviceTriggerInfo
46323
+ * @pronghornType method
46324
+ * @name retrieveDeviceTriggerInfo
46325
+ * @summary retrieve_device_trigger_info
46326
+ *
46327
+ * @param {string} deviceId - Name of device
46328
+ * @param {getCallback} callback - a callback function to return the result
46329
+ * @return {object} results - An object containing the response of the action
46330
+ *
46331
+ * @route {POST} /retrieveDeviceTriggerInfo
46332
+ * @roles admin
46333
+ * @task true
46334
+ */
46335
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
46336
+ retrieveDeviceTriggerInfo(deviceId, callback) {
46337
+ const meth = 'adapter-retrieveDeviceTriggerInfo';
46338
+ const origin = `${this.id}-${meth}`;
46339
+ log.trace(origin);
46340
+
46341
+ if (this.suspended && this.suspendMode === 'error') {
46342
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
46343
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46344
+ return callback(null, errorObj);
46345
+ }
46346
+
46347
+ /* HERE IS WHERE YOU VALIDATE DATA */
46348
+ if (deviceId === undefined || deviceId === null || deviceId === '') {
46349
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceId'], null, null, null);
46350
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46351
+ return callback(null, errorObj);
46352
+ }
46353
+
46354
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
46355
+ const queryParamsAvailable = {};
46356
+ const queryParams = {};
46357
+ const pathVars = [deviceId];
46358
+ const bodyVars = {};
46359
+
46360
+ // loop in template. long callback arg name to avoid identifier conflicts
46361
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
46362
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
46363
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
46364
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
46365
+ }
46366
+ });
46367
+
46368
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
46369
+ let thisHeaderData = null;
46370
+ // if the additional headers was passed in as a string parse the json into an object
46371
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
46372
+ try {
46373
+ // parse the additional headers object that was passed in
46374
+ thisHeaderData = JSON.parse(thisHeaderData);
46375
+ } catch (err) {
46376
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
46377
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46378
+ return callback(null, errorObj);
46379
+ }
46380
+ } else if (thisHeaderData === null) {
46381
+ thisHeaderData = { xIamToken: '' };
46382
+ }
46383
+
46384
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
46385
+ // see adapter code documentation for more information on the request object's fields
46386
+ const reqObj = {
46387
+ payload: bodyVars,
46388
+ uriPathVars: pathVars,
46389
+ uriQuery: queryParams,
46390
+ addlHeaders: thisHeaderData
46391
+ };
46392
+
46393
+ try {
46394
+ // Make the call -
46395
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
46396
+ return this.requestHandlerInst.identifyRequest('Configuration', 'retrieveDeviceTriggerInfo', reqObj, true, (irReturnData, irReturnError) => {
46397
+ // if we received an error or their is no response on the results
46398
+ // return an error
46399
+ if (irReturnError) {
46400
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
46401
+ return callback(null, irReturnError);
46402
+ }
46403
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
46404
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['retrieveDeviceTriggerInfo'], null, null, null);
46405
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46406
+ return callback(null, errorObj);
46407
+ }
46408
+
46409
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
46410
+ // return the response
46411
+ return callback(irReturnData, null);
46412
+ });
46413
+ } catch (ex) {
46414
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
46415
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46416
+ return callback(null, errorObj);
46417
+ }
46418
+ }
46419
+
46420
+ /**
46421
+ * @function removeIcebergDevicesFromGroup
46422
+ * @pronghornType method
46423
+ * @name removeIcebergDevicesFromGroup
46424
+ * @summary remove_iceberg_devices_from_group
46425
+ *
46426
+ * @param {string} deviceGroupName - ID of group
46427
+ * @param {getCallback} callback - a callback function to return the result
46428
+ * @return {object} results - An object containing the response of the action
46429
+ *
46430
+ * @route {POST} /removeIcebergDevicesFromGroup
46431
+ * @roles admin
46432
+ * @task true
46433
+ */
46434
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
46435
+ removeIcebergDevicesFromGroup(deviceGroupName, callback) {
46436
+ const meth = 'adapter-removeIcebergDevicesFromGroup';
46437
+ const origin = `${this.id}-${meth}`;
46438
+ log.trace(origin);
46439
+
46440
+ if (this.suspended && this.suspendMode === 'error') {
46441
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
46442
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46443
+ return callback(null, errorObj);
46444
+ }
46445
+
46446
+ /* HERE IS WHERE YOU VALIDATE DATA */
46447
+ if (deviceGroupName === undefined || deviceGroupName === null || deviceGroupName === '') {
46448
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceGroupName'], null, null, null);
46449
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46450
+ return callback(null, errorObj);
46451
+ }
46452
+
46453
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
46454
+ const queryParamsAvailable = {};
46455
+ const queryParams = {};
46456
+ const pathVars = [deviceGroupName];
46457
+ const bodyVars = {};
46458
+
46459
+ // loop in template. long callback arg name to avoid identifier conflicts
46460
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
46461
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
46462
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
46463
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
46464
+ }
46465
+ });
46466
+
46467
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
46468
+ let thisHeaderData = null;
46469
+ // if the additional headers was passed in as a string parse the json into an object
46470
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
46471
+ try {
46472
+ // parse the additional headers object that was passed in
46473
+ thisHeaderData = JSON.parse(thisHeaderData);
46474
+ } catch (err) {
46475
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
46476
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46477
+ return callback(null, errorObj);
46478
+ }
46479
+ } else if (thisHeaderData === null) {
46480
+ thisHeaderData = { xIamToken: '' };
46481
+ }
46482
+
46483
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
46484
+ // see adapter code documentation for more information on the request object's fields
46485
+ const reqObj = {
46486
+ payload: bodyVars,
46487
+ uriPathVars: pathVars,
46488
+ uriQuery: queryParams,
46489
+ addlHeaders: thisHeaderData
46490
+ };
46491
+
46492
+ try {
46493
+ // Make the call -
46494
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
46495
+ return this.requestHandlerInst.identifyRequest('Configuration', 'removeIcebergDevicesFromGroup', reqObj, false, (irReturnData, irReturnError) => {
46496
+ // if we received an error or their is no response on the results
46497
+ // return an error
46498
+ if (irReturnError) {
46499
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
46500
+ return callback(null, irReturnError);
46501
+ }
46502
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
46503
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['removeIcebergDevicesFromGroup'], null, null, null);
46504
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46505
+ return callback(null, errorObj);
46506
+ }
46507
+
46508
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
46509
+ // return the response
46510
+ return callback(irReturnData, null);
46511
+ });
46512
+ } catch (ex) {
46513
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
46514
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46515
+ return callback(null, errorObj);
46516
+ }
46517
+ }
46518
+
46519
+ /**
46520
+ * @function removeIcebergNetworkGroupNetworkGroupById
46521
+ * @pronghornType method
46522
+ * @name removeIcebergNetworkGroupNetworkGroupById
46523
+ * @summary remove_iceberg_network_group_network_group_by_id
46524
+ *
46525
+ * @param {string} networkGroupName - ID of network-group-name
46526
+ * @param {getCallback} callback - a callback function to return the result
46527
+ * @return {object} results - An object containing the response of the action
46528
+ *
46529
+ * @route {POST} /removeIcebergNetworkGroupNetworkGroupById
46530
+ * @roles admin
46531
+ * @task true
46532
+ */
46533
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
46534
+ removeIcebergNetworkGroupNetworkGroupById(networkGroupName, callback) {
46535
+ const meth = 'adapter-removeIcebergNetworkGroupNetworkGroupById';
46536
+ const origin = `${this.id}-${meth}`;
46537
+ log.trace(origin);
46538
+
46539
+ if (this.suspended && this.suspendMode === 'error') {
46540
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
46541
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46542
+ return callback(null, errorObj);
46543
+ }
46544
+
46545
+ /* HERE IS WHERE YOU VALIDATE DATA */
46546
+ if (networkGroupName === undefined || networkGroupName === null || networkGroupName === '') {
46547
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkGroupName'], null, null, null);
46548
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46549
+ return callback(null, errorObj);
46550
+ }
46551
+
46552
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
46553
+ const queryParamsAvailable = {};
46554
+ const queryParams = {};
46555
+ const pathVars = [networkGroupName];
46556
+ const bodyVars = {};
46557
+
46558
+ // loop in template. long callback arg name to avoid identifier conflicts
46559
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
46560
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
46561
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
46562
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
46563
+ }
46564
+ });
46565
+
46566
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
46567
+ let thisHeaderData = null;
46568
+ // if the additional headers was passed in as a string parse the json into an object
46569
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
46570
+ try {
46571
+ // parse the additional headers object that was passed in
46572
+ thisHeaderData = JSON.parse(thisHeaderData);
46573
+ } catch (err) {
46574
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
46575
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46576
+ return callback(null, errorObj);
46577
+ }
46578
+ } else if (thisHeaderData === null) {
46579
+ thisHeaderData = { xIamToken: '', contentType: '' };
46580
+ }
46581
+
46582
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
46583
+ // see adapter code documentation for more information on the request object's fields
46584
+ const reqObj = {
46585
+ payload: bodyVars,
46586
+ uriPathVars: pathVars,
46587
+ uriQuery: queryParams,
46588
+ addlHeaders: thisHeaderData
46589
+ };
46590
+
46591
+ try {
46592
+ // Make the call -
46593
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
46594
+ return this.requestHandlerInst.identifyRequest('Configuration', 'removeIcebergNetworkGroupNetworkGroupById', reqObj, false, (irReturnData, irReturnError) => {
46595
+ // if we received an error or their is no response on the results
46596
+ // return an error
46597
+ if (irReturnError) {
46598
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
46599
+ return callback(null, irReturnError);
46600
+ }
46601
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
46602
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['removeIcebergNetworkGroupNetworkGroupById'], null, null, null);
46603
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46604
+ return callback(null, errorObj);
46605
+ }
46606
+
46607
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
46608
+ // return the response
46609
+ return callback(irReturnData, null);
46610
+ });
46611
+ } catch (ex) {
46612
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
46613
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46614
+ return callback(null, errorObj);
46615
+ }
46616
+ }
46617
+
46618
+ /**
46619
+ * @function retrieveHealthbotIngestSettingsPaa
46620
+ * @pronghornType method
46621
+ * @name retrieveHealthbotIngestSettingsPaa
46622
+ * @summary retrieve_healthbot_ingest_settings_paa
46623
+ *
46624
+ * @param {boolean} [working] - true queries undeployed configuration
46625
+ * @param {getCallback} callback - a callback function to return the result
46626
+ * @return {object} results - An object containing the response of the action
46627
+ *
46628
+ * @route {POST} /retrieveHealthbotIngestSettingsPaa
46629
+ * @roles admin
46630
+ * @task true
46631
+ */
46632
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
46633
+ retrieveHealthbotIngestSettingsPaa(working, callback) {
46634
+ const meth = 'adapter-retrieveHealthbotIngestSettingsPaa';
46635
+ const origin = `${this.id}-${meth}`;
46636
+ log.trace(origin);
46637
+
46638
+ if (this.suspended && this.suspendMode === 'error') {
46639
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
46640
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46641
+ return callback(null, errorObj);
46642
+ }
46643
+
46644
+ /* HERE IS WHERE YOU VALIDATE DATA */
46645
+
46646
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
46647
+ const queryParamsAvailable = { working };
46648
+ const queryParams = {};
46649
+ const pathVars = [];
46650
+ const bodyVars = {};
46651
+
46652
+ // loop in template. long callback arg name to avoid identifier conflicts
46653
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
46654
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
46655
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
46656
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
46657
+ }
46658
+ });
46659
+
46660
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
46661
+ let thisHeaderData = null;
46662
+ // if the additional headers was passed in as a string parse the json into an object
46663
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
46664
+ try {
46665
+ // parse the additional headers object that was passed in
46666
+ thisHeaderData = JSON.parse(thisHeaderData);
46667
+ } catch (err) {
46668
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
46669
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46670
+ return callback(null, errorObj);
46671
+ }
46672
+ } else if (thisHeaderData === null) {
46673
+ thisHeaderData = { xIamToken: '', contentType: '' };
46674
+ }
46675
+
46676
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
46677
+ // see adapter code documentation for more information on the request object's fields
46678
+ const reqObj = {
46679
+ payload: bodyVars,
46680
+ uriPathVars: pathVars,
46681
+ uriQuery: queryParams,
46682
+ addlHeaders: thisHeaderData
46683
+ };
46684
+
46685
+ try {
46686
+ // Make the call -
46687
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
46688
+ return this.requestHandlerInst.identifyRequest('Config', 'retrieveHealthbotIngestSettingsPaa', reqObj, true, (irReturnData, irReturnError) => {
46689
+ // if we received an error or their is no response on the results
46690
+ // return an error
46691
+ if (irReturnError) {
46692
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
46693
+ return callback(null, irReturnError);
46694
+ }
46695
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
46696
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['retrieveHealthbotIngestSettingsPaa'], null, null, null);
46697
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46698
+ return callback(null, errorObj);
46699
+ }
46700
+
46701
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
46702
+ // return the response
46703
+ return callback(irReturnData, null);
46704
+ });
46705
+ } catch (ex) {
46706
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
46707
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46708
+ return callback(null, errorObj);
46709
+ }
46710
+ }
46711
+
46712
+ /**
46713
+ * @function deleteHealthbotIngestPaaByPaaName
46714
+ * @pronghornType method
46715
+ * @name deleteHealthbotIngestPaaByPaaName
46716
+ * @summary delete_healthbot_ingest_paa_by_paa_name
46717
+ *
46718
+ * @param {string} paaName - name of paa setup
46719
+ * @param {getCallback} callback - a callback function to return the result
46720
+ * @return {object} results - An object containing the response of the action
46721
+ *
46722
+ * @route {POST} /deleteHealthbotIngestPaaByPaaName
46723
+ * @roles admin
46724
+ * @task true
46725
+ */
46726
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
46727
+ deleteHealthbotIngestPaaByPaaName(paaName, callback) {
46728
+ const meth = 'adapter-deleteHealthbotIngestPaaByPaaName';
46729
+ const origin = `${this.id}-${meth}`;
46730
+ log.trace(origin);
46731
+
46732
+ if (this.suspended && this.suspendMode === 'error') {
46733
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
46734
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46735
+ return callback(null, errorObj);
46736
+ }
46737
+
46738
+ /* HERE IS WHERE YOU VALIDATE DATA */
46739
+ if (paaName === undefined || paaName === null || paaName === '') {
46740
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['paaName'], null, null, null);
46741
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46742
+ return callback(null, errorObj);
46743
+ }
46744
+
46745
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
46746
+ const queryParamsAvailable = {};
46747
+ const queryParams = {};
46748
+ const pathVars = [paaName];
46749
+ const bodyVars = {};
46750
+
46751
+ // loop in template. long callback arg name to avoid identifier conflicts
46752
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
46753
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
46754
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
46755
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
46756
+ }
46757
+ });
46758
+
46759
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
46760
+ let thisHeaderData = null;
46761
+ // if the additional headers was passed in as a string parse the json into an object
46762
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
46763
+ try {
46764
+ // parse the additional headers object that was passed in
46765
+ thisHeaderData = JSON.parse(thisHeaderData);
46766
+ } catch (err) {
46767
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
46768
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46769
+ return callback(null, errorObj);
46770
+ }
46771
+ } else if (thisHeaderData === null) {
46772
+ thisHeaderData = { xIamToken: '', contentType: '' };
46773
+ }
46774
+
46775
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
46776
+ // see adapter code documentation for more information on the request object's fields
46777
+ const reqObj = {
46778
+ payload: bodyVars,
46779
+ uriPathVars: pathVars,
46780
+ uriQuery: queryParams,
46781
+ addlHeaders: thisHeaderData
46782
+ };
46783
+
46784
+ try {
46785
+ // Make the call -
46786
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
46787
+ return this.requestHandlerInst.identifyRequest('Config', 'deleteHealthbotIngestPaaByPaaName', reqObj, false, (irReturnData, irReturnError) => {
46788
+ // if we received an error or their is no response on the results
46789
+ // return an error
46790
+ if (irReturnError) {
46791
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
46792
+ return callback(null, irReturnError);
46793
+ }
46794
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
46795
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteHealthbotIngestPaaByPaaName'], null, null, null);
46796
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46797
+ return callback(null, errorObj);
46798
+ }
46799
+
46800
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
46801
+ // return the response
46802
+ return callback(irReturnData, null);
46803
+ });
46804
+ } catch (ex) {
46805
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
46806
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46807
+ return callback(null, errorObj);
46808
+ }
46809
+ }
46810
+
46811
+ /**
46812
+ * @function retrieveHealthbotIngestPaaByPaaName
46813
+ * @pronghornType method
46814
+ * @name retrieveHealthbotIngestPaaByPaaName
46815
+ * @summary retrieve_healthbot_ingest_paa_by_paa_name
46816
+ *
46817
+ * @param {string} paaName - name of paa setup
46818
+ * @param {boolean} [working] - true queries undeployed configuration
46819
+ * @param {getCallback} callback - a callback function to return the result
46820
+ * @return {object} results - An object containing the response of the action
46821
+ *
46822
+ * @route {POST} /retrieveHealthbotIngestPaaByPaaName
46823
+ * @roles admin
46824
+ * @task true
46825
+ */
46826
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
46827
+ retrieveHealthbotIngestPaaByPaaName(paaName, working, callback) {
46828
+ const meth = 'adapter-retrieveHealthbotIngestPaaByPaaName';
46829
+ const origin = `${this.id}-${meth}`;
46830
+ log.trace(origin);
46831
+
46832
+ if (this.suspended && this.suspendMode === 'error') {
46833
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
46834
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46835
+ return callback(null, errorObj);
46836
+ }
46837
+
46838
+ /* HERE IS WHERE YOU VALIDATE DATA */
46839
+ if (paaName === undefined || paaName === null || paaName === '') {
46840
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['paaName'], null, null, null);
46841
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46842
+ return callback(null, errorObj);
46843
+ }
46844
+
46845
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
46846
+ const queryParamsAvailable = { working };
46847
+ const queryParams = {};
46848
+ const pathVars = [paaName];
46849
+ const bodyVars = {};
46850
+
46851
+ // loop in template. long callback arg name to avoid identifier conflicts
46852
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
46853
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
46854
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
46855
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
46856
+ }
46857
+ });
46858
+
46859
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
46860
+ let thisHeaderData = null;
46861
+ // if the additional headers was passed in as a string parse the json into an object
46862
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
46863
+ try {
46864
+ // parse the additional headers object that was passed in
46865
+ thisHeaderData = JSON.parse(thisHeaderData);
46866
+ } catch (err) {
46867
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
46868
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46869
+ return callback(null, errorObj);
46870
+ }
46871
+ } else if (thisHeaderData === null) {
46872
+ thisHeaderData = { xIamToken: '', contentType: '' };
46873
+ }
46874
+
46875
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
46876
+ // see adapter code documentation for more information on the request object's fields
46877
+ const reqObj = {
46878
+ payload: bodyVars,
46879
+ uriPathVars: pathVars,
46880
+ uriQuery: queryParams,
46881
+ addlHeaders: thisHeaderData
46882
+ };
46883
+
46884
+ try {
46885
+ // Make the call -
46886
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
46887
+ return this.requestHandlerInst.identifyRequest('Config', 'retrieveHealthbotIngestPaaByPaaName', reqObj, true, (irReturnData, irReturnError) => {
46888
+ // if we received an error or their is no response on the results
46889
+ // return an error
46890
+ if (irReturnError) {
46891
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
46892
+ return callback(null, irReturnError);
46893
+ }
46894
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
46895
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['retrieveHealthbotIngestPaaByPaaName'], null, null, null);
46896
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46897
+ return callback(null, errorObj);
46898
+ }
46899
+
46900
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
46901
+ // return the response
46902
+ return callback(irReturnData, null);
46903
+ });
46904
+ } catch (ex) {
46905
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
46906
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46907
+ return callback(null, errorObj);
46908
+ }
46909
+ }
46910
+
46911
+ /**
46912
+ * @function updateIngestPaaByPaaName
46913
+ * @pronghornType method
46914
+ * @name updateIngestPaaByPaaName
46915
+ * @summary update_ingest_paa_by_paa_name
46916
+ *
46917
+ * @param {string} paaName - name of paa setup
46918
+ * @param {object} body - paa body object
46919
+ * @param {getCallback} callback - a callback function to return the result
46920
+ * @return {object} results - An object containing the response of the action
46921
+ *
46922
+ * @route {POST} /updateIngestPaaByPaaName
46923
+ * @roles admin
46924
+ * @task true
46925
+ */
46926
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
46927
+ updateIngestPaaByPaaName(paaName, body, callback) {
46928
+ const meth = 'adapter-updateIngestPaaByPaaName';
46929
+ const origin = `${this.id}-${meth}`;
46930
+ log.trace(origin);
46931
+
46932
+ if (this.suspended && this.suspendMode === 'error') {
46933
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
46934
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46935
+ return callback(null, errorObj);
46936
+ }
46937
+
46938
+ /* HERE IS WHERE YOU VALIDATE DATA */
46939
+ if (paaName === undefined || paaName === null || paaName === '') {
46940
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['paaName'], null, null, null);
46941
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46942
+ return callback(null, errorObj);
46943
+ }
46944
+ if (body === undefined || body === null || body === '') {
46945
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
46946
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46947
+ return callback(null, errorObj);
46948
+ }
46949
+
46950
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
46951
+ const queryParamsAvailable = {};
46952
+ const queryParams = {};
46953
+ const pathVars = [paaName];
46954
+ const bodyVars = body;
46955
+
46956
+ // loop in template. long callback arg name to avoid identifier conflicts
46957
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
46958
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
46959
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
46960
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
46961
+ }
46962
+ });
46963
+
46964
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
46965
+ let thisHeaderData = null;
46966
+ // if the additional headers was passed in as a string parse the json into an object
46967
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
46968
+ try {
46969
+ // parse the additional headers object that was passed in
46970
+ thisHeaderData = JSON.parse(thisHeaderData);
46971
+ } catch (err) {
46972
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
46973
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
46974
+ return callback(null, errorObj);
46975
+ }
46976
+ } else if (thisHeaderData === null) {
46977
+ thisHeaderData = { xIamToken: '' };
46978
+ }
46979
+
46980
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
46981
+ // see adapter code documentation for more information on the request object's fields
46982
+ const reqObj = {
46983
+ payload: bodyVars,
46984
+ uriPathVars: pathVars,
46985
+ uriQuery: queryParams,
46986
+ addlHeaders: thisHeaderData
46987
+ };
46988
+
46989
+ try {
46990
+ // Make the call -
46991
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
46992
+ return this.requestHandlerInst.identifyRequest('Config', 'updateIngestPaaByPaaName', reqObj, false, (irReturnData, irReturnError) => {
46993
+ // if we received an error or their is no response on the results
46994
+ // return an error
46995
+ if (irReturnError) {
46996
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
46997
+ return callback(null, irReturnError);
46998
+ }
46999
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47000
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateIngestPaaByPaaName'], null, null, null);
47001
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47002
+ return callback(null, errorObj);
47003
+ }
47004
+
47005
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47006
+ // return the response
47007
+ return callback(irReturnData, null);
47008
+ });
47009
+ } catch (ex) {
47010
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47011
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47012
+ return callback(null, errorObj);
47013
+ }
47014
+ }
47015
+
47016
+ /**
47017
+ * @function createIngestPaaByPaaName
47018
+ * @pronghornType method
47019
+ * @name createIngestPaaByPaaName
47020
+ * @summary create_ingest_paa_by_paa_name
47021
+ *
47022
+ * @param {string} paaName - name of paa setup
47023
+ * @param {object} body - paa body object
47024
+ * @param {getCallback} callback - a callback function to return the result
47025
+ * @return {object} results - An object containing the response of the action
47026
+ *
47027
+ * @route {POST} /createIngestPaaByPaaName
47028
+ * @roles admin
47029
+ * @task true
47030
+ */
47031
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
47032
+ createIngestPaaByPaaName(paaName, body, callback) {
47033
+ const meth = 'adapter-createIngestPaaByPaaName';
47034
+ const origin = `${this.id}-${meth}`;
47035
+ log.trace(origin);
47036
+
47037
+ if (this.suspended && this.suspendMode === 'error') {
47038
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
47039
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47040
+ return callback(null, errorObj);
47041
+ }
47042
+
47043
+ /* HERE IS WHERE YOU VALIDATE DATA */
47044
+ if (paaName === undefined || paaName === null || paaName === '') {
47045
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['paaName'], null, null, null);
47046
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47047
+ return callback(null, errorObj);
47048
+ }
47049
+ if (body === undefined || body === null || body === '') {
47050
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
47051
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47052
+ return callback(null, errorObj);
47053
+ }
47054
+
47055
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
47056
+ const queryParamsAvailable = {};
47057
+ const queryParams = {};
47058
+ const pathVars = [paaName];
47059
+ const bodyVars = body;
47060
+
47061
+ // loop in template. long callback arg name to avoid identifier conflicts
47062
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
47063
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
47064
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
47065
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
47066
+ }
47067
+ });
47068
+
47069
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
47070
+ let thisHeaderData = null;
47071
+ // if the additional headers was passed in as a string parse the json into an object
47072
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
47073
+ try {
47074
+ // parse the additional headers object that was passed in
47075
+ thisHeaderData = JSON.parse(thisHeaderData);
47076
+ } catch (err) {
47077
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
47078
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47079
+ return callback(null, errorObj);
47080
+ }
47081
+ } else if (thisHeaderData === null) {
47082
+ thisHeaderData = { xIamToken: '' };
47083
+ }
47084
+
47085
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
47086
+ // see adapter code documentation for more information on the request object's fields
47087
+ const reqObj = {
47088
+ payload: bodyVars,
47089
+ uriPathVars: pathVars,
47090
+ uriQuery: queryParams,
47091
+ addlHeaders: thisHeaderData
47092
+ };
47093
+
47094
+ try {
47095
+ // Make the call -
47096
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
47097
+ return this.requestHandlerInst.identifyRequest('Config', 'createIngestPaaByPaaName', reqObj, true, (irReturnData, irReturnError) => {
47098
+ // if we received an error or their is no response on the results
47099
+ // return an error
47100
+ if (irReturnError) {
47101
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
47102
+ return callback(null, irReturnError);
47103
+ }
47104
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47105
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createIngestPaaByPaaName'], null, null, null);
47106
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47107
+ return callback(null, errorObj);
47108
+ }
47109
+
47110
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47111
+ // return the response
47112
+ return callback(irReturnData, null);
47113
+ });
47114
+ } catch (ex) {
47115
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47116
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47117
+ return callback(null, errorObj);
47118
+ }
47119
+ }
47120
+
47121
+ /**
47122
+ * @function deleteHealthbotIngestIfa
47123
+ * @pronghornType method
47124
+ * @name deleteHealthbotIngestIfa
47125
+ * @summary delete_healthbot_ingest_ifa
47126
+ *
47127
+ * @param {getCallback} callback - a callback function to return the result
47128
+ * @return {object} results - An object containing the response of the action
47129
+ *
47130
+ * @route {GET} /deleteHealthbotIngestIfa
47131
+ * @roles admin
47132
+ * @task true
47133
+ */
47134
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
47135
+ deleteHealthbotIngestIfa(callback) {
47136
+ const meth = 'adapter-deleteHealthbotIngestIfa';
47137
+ const origin = `${this.id}-${meth}`;
47138
+ log.trace(origin);
47139
+
47140
+ if (this.suspended && this.suspendMode === 'error') {
47141
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
47142
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47143
+ return callback(null, errorObj);
47144
+ }
47145
+
47146
+ /* HERE IS WHERE YOU VALIDATE DATA */
47147
+
47148
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
47149
+ const queryParamsAvailable = {};
47150
+ const queryParams = {};
47151
+ const pathVars = [];
47152
+ const bodyVars = {};
47153
+
47154
+ // loop in template. long callback arg name to avoid identifier conflicts
47155
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
47156
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
47157
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
47158
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
47159
+ }
47160
+ });
47161
+
47162
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
47163
+ let thisHeaderData = null;
47164
+ // if the additional headers was passed in as a string parse the json into an object
47165
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
47166
+ try {
47167
+ // parse the additional headers object that was passed in
47168
+ thisHeaderData = JSON.parse(thisHeaderData);
47169
+ } catch (err) {
47170
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
47171
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47172
+ return callback(null, errorObj);
47173
+ }
47174
+ } else if (thisHeaderData === null) {
47175
+ thisHeaderData = { xIamToken: '', contentType: '' };
47176
+ }
47177
+
47178
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
47179
+ // see adapter code documentation for more information on the request object's fields
47180
+ const reqObj = {
47181
+ payload: bodyVars,
47182
+ uriPathVars: pathVars,
47183
+ uriQuery: queryParams,
47184
+ addlHeaders: thisHeaderData
47185
+ };
47186
+
47187
+ try {
47188
+ // Make the call -
47189
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
47190
+ return this.requestHandlerInst.identifyRequest('Config', 'deleteHealthbotIngestIfa', reqObj, false, (irReturnData, irReturnError) => {
47191
+ // if we received an error or their is no response on the results
47192
+ // return an error
47193
+ if (irReturnError) {
47194
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
47195
+ return callback(null, irReturnError);
47196
+ }
47197
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47198
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteHealthbotIngestIfa'], null, null, null);
47199
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47200
+ return callback(null, errorObj);
47201
+ }
47202
+
47203
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47204
+ // return the response
47205
+ return callback(irReturnData, null);
47206
+ });
47207
+ } catch (ex) {
47208
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47209
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47210
+ return callback(null, errorObj);
47211
+ }
47212
+ }
47213
+
47214
+ /**
47215
+ * @function retrieveHealthbotIngestIfa
47216
+ * @pronghornType method
47217
+ * @name retrieveHealthbotIngestIfa
47218
+ * @summary retrieve_healthbot_ingest_ifa
47219
+ *
47220
+ * @param {boolean} [working] - true queries undeployed configuration
47221
+ * @param {getCallback} callback - a callback function to return the result
47222
+ * @return {object} results - An object containing the response of the action
47223
+ *
47224
+ * @route {POST} /retrieveHealthbotIngestIfa
47225
+ * @roles admin
47226
+ * @task true
47227
+ */
47228
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
47229
+ retrieveHealthbotIngestIfa(working, callback) {
47230
+ const meth = 'adapter-retrieveHealthbotIngestIfa';
47231
+ const origin = `${this.id}-${meth}`;
47232
+ log.trace(origin);
47233
+
47234
+ if (this.suspended && this.suspendMode === 'error') {
47235
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
47236
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47237
+ return callback(null, errorObj);
47238
+ }
47239
+
47240
+ /* HERE IS WHERE YOU VALIDATE DATA */
47241
+
47242
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
47243
+ const queryParamsAvailable = { working };
47244
+ const queryParams = {};
47245
+ const pathVars = [];
47246
+ const bodyVars = {};
47247
+
47248
+ // loop in template. long callback arg name to avoid identifier conflicts
47249
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
47250
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
47251
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
47252
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
47253
+ }
47254
+ });
47255
+
47256
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
47257
+ let thisHeaderData = null;
47258
+ // if the additional headers was passed in as a string parse the json into an object
47259
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
47260
+ try {
47261
+ // parse the additional headers object that was passed in
47262
+ thisHeaderData = JSON.parse(thisHeaderData);
47263
+ } catch (err) {
47264
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
47265
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47266
+ return callback(null, errorObj);
47267
+ }
47268
+ } else if (thisHeaderData === null) {
47269
+ thisHeaderData = { xIamToken: '', contentType: '' };
47270
+ }
47271
+
47272
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
47273
+ // see adapter code documentation for more information on the request object's fields
47274
+ const reqObj = {
47275
+ payload: bodyVars,
47276
+ uriPathVars: pathVars,
47277
+ uriQuery: queryParams,
47278
+ addlHeaders: thisHeaderData
47279
+ };
47280
+
47281
+ try {
47282
+ // Make the call -
47283
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
47284
+ return this.requestHandlerInst.identifyRequest('Config', 'retrieveHealthbotIngestIfa', reqObj, true, (irReturnData, irReturnError) => {
47285
+ // if we received an error or their is no response on the results
47286
+ // return an error
47287
+ if (irReturnError) {
47288
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
47289
+ return callback(null, irReturnError);
47290
+ }
47291
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47292
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['retrieveHealthbotIngestIfa'], null, null, null);
47293
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47294
+ return callback(null, errorObj);
47295
+ }
47296
+
47297
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47298
+ // return the response
47299
+ return callback(irReturnData, null);
47300
+ });
47301
+ } catch (ex) {
47302
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47303
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47304
+ return callback(null, errorObj);
47305
+ }
47306
+ }
47307
+
47308
+ /**
47309
+ * @function createHealthbotIngestIfa
47310
+ * @pronghornType method
47311
+ * @name createHealthbotIngestIfa
47312
+ * @summary create_healthbot_ingest_ifa
47313
+ *
47314
+ * @param {object} body - ifabody object
47315
+ * @param {getCallback} callback - a callback function to return the result
47316
+ * @return {object} results - An object containing the response of the action
47317
+ *
47318
+ * @route {POST} /createHealthbotIngestIfa
47319
+ * @roles admin
47320
+ * @task true
47321
+ */
47322
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
47323
+ createHealthbotIngestIfa(body, callback) {
47324
+ const meth = 'adapter-createHealthbotIngestIfa';
47325
+ const origin = `${this.id}-${meth}`;
47326
+ log.trace(origin);
47327
+
47328
+ if (this.suspended && this.suspendMode === 'error') {
47329
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
47330
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47331
+ return callback(null, errorObj);
47332
+ }
47333
+
47334
+ /* HERE IS WHERE YOU VALIDATE DATA */
47335
+ if (body === undefined || body === null || body === '') {
47336
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
47337
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47338
+ return callback(null, errorObj);
47339
+ }
47340
+
47341
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
47342
+ const queryParamsAvailable = {};
47343
+ const queryParams = {};
47344
+ const pathVars = [];
47345
+ const bodyVars = body;
47346
+
47347
+ // loop in template. long callback arg name to avoid identifier conflicts
47348
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
47349
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
47350
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
47351
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
47352
+ }
47353
+ });
47354
+
47355
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
47356
+ let thisHeaderData = null;
47357
+ // if the additional headers was passed in as a string parse the json into an object
47358
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
47359
+ try {
47360
+ // parse the additional headers object that was passed in
47361
+ thisHeaderData = JSON.parse(thisHeaderData);
47362
+ } catch (err) {
47363
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
47364
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47365
+ return callback(null, errorObj);
47366
+ }
47367
+ } else if (thisHeaderData === null) {
47368
+ thisHeaderData = { xIamToken: '' };
47369
+ }
47370
+
47371
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
47372
+ // see adapter code documentation for more information on the request object's fields
47373
+ const reqObj = {
47374
+ payload: bodyVars,
47375
+ uriPathVars: pathVars,
47376
+ uriQuery: queryParams,
47377
+ addlHeaders: thisHeaderData
47378
+ };
47379
+
47380
+ try {
47381
+ // Make the call -
47382
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
47383
+ return this.requestHandlerInst.identifyRequest('Config', 'createHealthbotIngestIfa', reqObj, true, (irReturnData, irReturnError) => {
47384
+ // if we received an error or their is no response on the results
47385
+ // return an error
47386
+ if (irReturnError) {
47387
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
47388
+ return callback(null, irReturnError);
47389
+ }
47390
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47391
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createHealthbotIngestIfa'], null, null, null);
47392
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47393
+ return callback(null, errorObj);
47394
+ }
47395
+
47396
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47397
+ // return the response
47398
+ return callback(irReturnData, null);
47399
+ });
47400
+ } catch (ex) {
47401
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47402
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47403
+ return callback(null, errorObj);
47404
+ }
47405
+ }
47406
+
47407
+ /**
47408
+ * @function updateHealthbotIngestIfa
47409
+ * @pronghornType method
47410
+ * @name updateHealthbotIngestIfa
47411
+ * @summary update_healthbot_ingest_ifa
47412
+ *
47413
+ * @param {object} body - ifabody object
47414
+ * @param {getCallback} callback - a callback function to return the result
47415
+ * @return {object} results - An object containing the response of the action
47416
+ *
47417
+ * @route {POST} /updateHealthbotIngestIfa
47418
+ * @roles admin
47419
+ * @task true
47420
+ */
47421
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
47422
+ updateHealthbotIngestIfa(body, callback) {
47423
+ const meth = 'adapter-updateHealthbotIngestIfa';
47424
+ const origin = `${this.id}-${meth}`;
47425
+ log.trace(origin);
47426
+
47427
+ if (this.suspended && this.suspendMode === 'error') {
47428
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
47429
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47430
+ return callback(null, errorObj);
47431
+ }
47432
+
47433
+ /* HERE IS WHERE YOU VALIDATE DATA */
47434
+ if (body === undefined || body === null || body === '') {
47435
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
47436
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47437
+ return callback(null, errorObj);
47438
+ }
47439
+
47440
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
47441
+ const queryParamsAvailable = {};
47442
+ const queryParams = {};
47443
+ const pathVars = [];
47444
+ const bodyVars = body;
47445
+
47446
+ // loop in template. long callback arg name to avoid identifier conflicts
47447
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
47448
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
47449
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
47450
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
47451
+ }
47452
+ });
47453
+
47454
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
47455
+ let thisHeaderData = null;
47456
+ // if the additional headers was passed in as a string parse the json into an object
47457
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
47458
+ try {
47459
+ // parse the additional headers object that was passed in
47460
+ thisHeaderData = JSON.parse(thisHeaderData);
47461
+ } catch (err) {
47462
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
47463
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47464
+ return callback(null, errorObj);
47465
+ }
47466
+ } else if (thisHeaderData === null) {
47467
+ thisHeaderData = { xIamToken: '' };
47468
+ }
47469
+
47470
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
47471
+ // see adapter code documentation for more information on the request object's fields
47472
+ const reqObj = {
47473
+ payload: bodyVars,
47474
+ uriPathVars: pathVars,
47475
+ uriQuery: queryParams,
47476
+ addlHeaders: thisHeaderData
47477
+ };
47478
+
47479
+ try {
47480
+ // Make the call -
47481
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
47482
+ return this.requestHandlerInst.identifyRequest('Config', 'updateHealthbotIngestIfa', reqObj, false, (irReturnData, irReturnError) => {
47483
+ // if we received an error or their is no response on the results
47484
+ // return an error
47485
+ if (irReturnError) {
47486
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
47487
+ return callback(null, irReturnError);
47488
+ }
47489
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47490
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateHealthbotIngestIfa'], null, null, null);
47491
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47492
+ return callback(null, errorObj);
47493
+ }
47494
+
47495
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47496
+ // return the response
47497
+ return callback(irReturnData, null);
47498
+ });
47499
+ } catch (ex) {
47500
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47501
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47502
+ return callback(null, errorObj);
47503
+ }
47504
+ }
47505
+
47506
+ /**
47507
+ * @function retrieveHealthbotIngestIfaDeviceIds
47508
+ * @pronghornType method
47509
+ * @name retrieveHealthbotIngestIfaDeviceIds
47510
+ * @summary retrieve_healthbot_ingest_ifa_device_ids
47511
+ *
47512
+ * @param {boolean} [working] - true queries undeployed configuration
47513
+ * @param {getCallback} callback - a callback function to return the result
47514
+ * @return {object} results - An object containing the response of the action
47515
+ *
47516
+ * @route {POST} /retrieveHealthbotIngestIfaDeviceIds
47517
+ * @roles admin
47518
+ * @task true
47519
+ */
47520
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
47521
+ retrieveHealthbotIngestIfaDeviceIds(working, callback) {
47522
+ const meth = 'adapter-retrieveHealthbotIngestIfaDeviceIds';
47523
+ const origin = `${this.id}-${meth}`;
47524
+ log.trace(origin);
47525
+
47526
+ if (this.suspended && this.suspendMode === 'error') {
47527
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
47528
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47529
+ return callback(null, errorObj);
47530
+ }
47531
+
47532
+ /* HERE IS WHERE YOU VALIDATE DATA */
47533
+
47534
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
47535
+ const queryParamsAvailable = { working };
47536
+ const queryParams = {};
47537
+ const pathVars = [];
47538
+ const bodyVars = {};
47539
+
47540
+ // loop in template. long callback arg name to avoid identifier conflicts
47541
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
47542
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
47543
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
47544
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
47545
+ }
47546
+ });
47547
+
47548
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
47549
+ let thisHeaderData = null;
47550
+ // if the additional headers was passed in as a string parse the json into an object
47551
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
47552
+ try {
47553
+ // parse the additional headers object that was passed in
47554
+ thisHeaderData = JSON.parse(thisHeaderData);
47555
+ } catch (err) {
47556
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
47557
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47558
+ return callback(null, errorObj);
47559
+ }
47560
+ } else if (thisHeaderData === null) {
47561
+ thisHeaderData = { xIamToken: '', contentType: '' };
47562
+ }
47563
+
47564
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
47565
+ // see adapter code documentation for more information on the request object's fields
47566
+ const reqObj = {
47567
+ payload: bodyVars,
47568
+ uriPathVars: pathVars,
47569
+ uriQuery: queryParams,
47570
+ addlHeaders: thisHeaderData
47571
+ };
47572
+
47573
+ try {
47574
+ // Make the call -
47575
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
47576
+ return this.requestHandlerInst.identifyRequest('Config', 'retrieveHealthbotIngestIfaDeviceIds', reqObj, true, (irReturnData, irReturnError) => {
47577
+ // if we received an error or their is no response on the results
47578
+ // return an error
47579
+ if (irReturnError) {
47580
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
47581
+ return callback(null, irReturnError);
47582
+ }
47583
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47584
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['retrieveHealthbotIngestIfaDeviceIds'], null, null, null);
47585
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47586
+ return callback(null, errorObj);
47587
+ }
47588
+
47589
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47590
+ // return the response
47591
+ return callback(irReturnData, null);
47592
+ });
47593
+ } catch (ex) {
47594
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47595
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47596
+ return callback(null, errorObj);
47597
+ }
47598
+ }
47599
+
47600
+ /**
47601
+ * @function retrieveHealthbotIngestIfaDevices
47602
+ * @pronghornType method
47603
+ * @name retrieveHealthbotIngestIfaDevices
47604
+ * @summary retrieve_healthbot_ingest_ifa_devices
47605
+ *
47606
+ * @param {boolean} [working] - true queries undeployed configuration
47607
+ * @param {getCallback} callback - a callback function to return the result
47608
+ * @return {object} results - An object containing the response of the action
47609
+ *
47610
+ * @route {POST} /retrieveHealthbotIngestIfaDevices
47611
+ * @roles admin
47612
+ * @task true
47613
+ */
47614
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
47615
+ retrieveHealthbotIngestIfaDevices(working, callback) {
47616
+ const meth = 'adapter-retrieveHealthbotIngestIfaDevices';
47617
+ const origin = `${this.id}-${meth}`;
47618
+ log.trace(origin);
47619
+
47620
+ if (this.suspended && this.suspendMode === 'error') {
47621
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
47622
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47623
+ return callback(null, errorObj);
47624
+ }
47625
+
47626
+ /* HERE IS WHERE YOU VALIDATE DATA */
47627
+
47628
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
47629
+ const queryParamsAvailable = { working };
47630
+ const queryParams = {};
47631
+ const pathVars = [];
47632
+ const bodyVars = {};
47633
+
47634
+ // loop in template. long callback arg name to avoid identifier conflicts
47635
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
47636
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
47637
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
47638
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
47639
+ }
47640
+ });
47641
+
47642
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
47643
+ let thisHeaderData = null;
47644
+ // if the additional headers was passed in as a string parse the json into an object
47645
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
47646
+ try {
47647
+ // parse the additional headers object that was passed in
47648
+ thisHeaderData = JSON.parse(thisHeaderData);
47649
+ } catch (err) {
47650
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
47651
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47652
+ return callback(null, errorObj);
47653
+ }
47654
+ } else if (thisHeaderData === null) {
47655
+ thisHeaderData = { xIamToken: '', contentType: '' };
47656
+ }
47657
+
47658
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
47659
+ // see adapter code documentation for more information on the request object's fields
47660
+ const reqObj = {
47661
+ payload: bodyVars,
47662
+ uriPathVars: pathVars,
47663
+ uriQuery: queryParams,
47664
+ addlHeaders: thisHeaderData
47665
+ };
47666
+
47667
+ try {
47668
+ // Make the call -
47669
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
47670
+ return this.requestHandlerInst.identifyRequest('Config', 'retrieveHealthbotIngestIfaDevices', reqObj, true, (irReturnData, irReturnError) => {
47671
+ // if we received an error or their is no response on the results
47672
+ // return an error
47673
+ if (irReturnError) {
47674
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
47675
+ return callback(null, irReturnError);
47676
+ }
47677
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47678
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['retrieveHealthbotIngestIfaDevices'], null, null, null);
47679
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47680
+ return callback(null, errorObj);
47681
+ }
47682
+
47683
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47684
+ // return the response
47685
+ return callback(irReturnData, null);
47686
+ });
47687
+ } catch (ex) {
47688
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47689
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47690
+ return callback(null, errorObj);
47691
+ }
47692
+ }
47693
+
47694
+ /**
47695
+ * @function deleteHealthbotIngestIfaDeviceById
47696
+ * @pronghornType method
47697
+ * @name deleteHealthbotIngestIfaDeviceById
47698
+ * @summary delete_healthbot_ingest_ifa_device_by_id
47699
+ *
47700
+ * @param {number} id - ID of ifa device
47701
+ * @param {getCallback} callback - a callback function to return the result
47702
+ * @return {object} results - An object containing the response of the action
47703
+ *
47704
+ * @route {POST} /deleteHealthbotIngestIfaDeviceById
47705
+ * @roles admin
47706
+ * @task true
47707
+ */
47708
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
47709
+ deleteHealthbotIngestIfaDeviceById(id, callback) {
47710
+ const meth = 'adapter-deleteHealthbotIngestIfaDeviceById';
47711
+ const origin = `${this.id}-${meth}`;
47712
+ log.trace(origin);
47713
+
47714
+ if (this.suspended && this.suspendMode === 'error') {
47715
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
47716
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47717
+ return callback(null, errorObj);
47718
+ }
47719
+
47720
+ /* HERE IS WHERE YOU VALIDATE DATA */
47721
+ if (id === undefined || id === null || id === '') {
47722
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
47723
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47724
+ return callback(null, errorObj);
47725
+ }
47726
+
47727
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
47728
+ const queryParamsAvailable = {};
47729
+ const queryParams = {};
47730
+ const pathVars = [id];
47731
+ const bodyVars = {};
47732
+
47733
+ // loop in template. long callback arg name to avoid identifier conflicts
47734
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
47735
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
47736
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
47737
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
47738
+ }
47739
+ });
47740
+
47741
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
47742
+ let thisHeaderData = null;
47743
+ // if the additional headers was passed in as a string parse the json into an object
47744
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
47745
+ try {
47746
+ // parse the additional headers object that was passed in
47747
+ thisHeaderData = JSON.parse(thisHeaderData);
47748
+ } catch (err) {
47749
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
47750
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47751
+ return callback(null, errorObj);
47752
+ }
47753
+ } else if (thisHeaderData === null) {
47754
+ thisHeaderData = { xIamToken: '', contentType: '' };
47755
+ }
47756
+
47757
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
47758
+ // see adapter code documentation for more information on the request object's fields
47759
+ const reqObj = {
47760
+ payload: bodyVars,
47761
+ uriPathVars: pathVars,
47762
+ uriQuery: queryParams,
47763
+ addlHeaders: thisHeaderData
47764
+ };
47765
+
47766
+ try {
47767
+ // Make the call -
47768
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
47769
+ return this.requestHandlerInst.identifyRequest('Config', 'deleteHealthbotIngestIfaDeviceById', reqObj, false, (irReturnData, irReturnError) => {
47770
+ // if we received an error or their is no response on the results
47771
+ // return an error
47772
+ if (irReturnError) {
47773
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
47774
+ return callback(null, irReturnError);
47775
+ }
47776
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47777
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteHealthbotIngestIfaDeviceById'], null, null, null);
47778
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47779
+ return callback(null, errorObj);
47780
+ }
47781
+
47782
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47783
+ // return the response
47784
+ return callback(irReturnData, null);
47785
+ });
47786
+ } catch (ex) {
47787
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47788
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47789
+ return callback(null, errorObj);
47790
+ }
47791
+ }
47792
+
47793
+ /**
47794
+ * @function retrieveHealthbotIngestIfaDeviceById
47795
+ * @pronghornType method
47796
+ * @name retrieveHealthbotIngestIfaDeviceById
47797
+ * @summary retrieve_healthbot_ingest_ifa_device_by_id
47798
+ *
47799
+ * @param {number} id - ID of ifa device
47800
+ * @param {boolean} [working] - true queries undeployed configuration
47801
+ * @param {getCallback} callback - a callback function to return the result
47802
+ * @return {object} results - An object containing the response of the action
47803
+ *
47804
+ * @route {POST} /retrieveHealthbotIngestIfaDeviceById
47805
+ * @roles admin
47806
+ * @task true
47807
+ */
47808
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
47809
+ retrieveHealthbotIngestIfaDeviceById(id, working, callback) {
47810
+ const meth = 'adapter-retrieveHealthbotIngestIfaDeviceById';
47811
+ const origin = `${this.id}-${meth}`;
47812
+ log.trace(origin);
47813
+
47814
+ if (this.suspended && this.suspendMode === 'error') {
47815
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
47816
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47817
+ return callback(null, errorObj);
47818
+ }
47819
+
47820
+ /* HERE IS WHERE YOU VALIDATE DATA */
47821
+ if (id === undefined || id === null || id === '') {
47822
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
47823
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47824
+ return callback(null, errorObj);
47825
+ }
47826
+
47827
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
47828
+ const queryParamsAvailable = { working };
47829
+ const queryParams = {};
47830
+ const pathVars = [id];
47831
+ const bodyVars = {};
47832
+
47833
+ // loop in template. long callback arg name to avoid identifier conflicts
47834
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
47835
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
47836
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
47837
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
47838
+ }
47839
+ });
47840
+
47841
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
47842
+ let thisHeaderData = null;
47843
+ // if the additional headers was passed in as a string parse the json into an object
47844
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
47845
+ try {
47846
+ // parse the additional headers object that was passed in
47847
+ thisHeaderData = JSON.parse(thisHeaderData);
47848
+ } catch (err) {
47849
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
47850
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47851
+ return callback(null, errorObj);
47852
+ }
47853
+ } else if (thisHeaderData === null) {
47854
+ thisHeaderData = { xIamToken: '', contentType: '' };
47855
+ }
47856
+
47857
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
47858
+ // see adapter code documentation for more information on the request object's fields
47859
+ const reqObj = {
47860
+ payload: bodyVars,
47861
+ uriPathVars: pathVars,
47862
+ uriQuery: queryParams,
47863
+ addlHeaders: thisHeaderData
47864
+ };
47865
+
47866
+ try {
47867
+ // Make the call -
47868
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
47869
+ return this.requestHandlerInst.identifyRequest('Config', 'retrieveHealthbotIngestIfaDeviceById', reqObj, true, (irReturnData, irReturnError) => {
47870
+ // if we received an error or their is no response on the results
47871
+ // return an error
47872
+ if (irReturnError) {
47873
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
47874
+ return callback(null, irReturnError);
47875
+ }
47876
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47877
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['retrieveHealthbotIngestIfaDeviceById'], null, null, null);
47878
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47879
+ return callback(null, errorObj);
47880
+ }
47881
+
47882
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47883
+ // return the response
47884
+ return callback(irReturnData, null);
47885
+ });
47886
+ } catch (ex) {
47887
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47888
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47889
+ return callback(null, errorObj);
47890
+ }
47891
+ }
47892
+
47893
+ /**
47894
+ * @function createHealthbotIngestIfaDeviceById
47895
+ * @pronghornType method
47896
+ * @name createHealthbotIngestIfaDeviceById
47897
+ * @summary create_healthbot_ingest_ifa_device_by_id
47898
+ *
47899
+ * @param {number} id - ID of ifa device
47900
+ * @param {object} body - devicebody object
47901
+ * @param {getCallback} callback - a callback function to return the result
47902
+ * @return {object} results - An object containing the response of the action
47903
+ *
47904
+ * @route {POST} /createHealthbotIngestIfaDeviceById
47905
+ * @roles admin
47906
+ * @task true
47907
+ */
47908
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
47909
+ createHealthbotIngestIfaDeviceById(id, body, callback) {
47910
+ const meth = 'adapter-createHealthbotIngestIfaDeviceById';
47911
+ const origin = `${this.id}-${meth}`;
47912
+ log.trace(origin);
47913
+
47914
+ if (this.suspended && this.suspendMode === 'error') {
47915
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
47916
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47917
+ return callback(null, errorObj);
47918
+ }
47919
+
47920
+ /* HERE IS WHERE YOU VALIDATE DATA */
47921
+ if (id === undefined || id === null || id === '') {
47922
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
47923
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47924
+ return callback(null, errorObj);
47925
+ }
47926
+ if (body === undefined || body === null || body === '') {
47927
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
47928
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47929
+ return callback(null, errorObj);
47930
+ }
47931
+
47932
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
47933
+ const queryParamsAvailable = {};
47934
+ const queryParams = {};
47935
+ const pathVars = [id];
47936
+ const bodyVars = body;
47937
+
47938
+ // loop in template. long callback arg name to avoid identifier conflicts
47939
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
47940
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
47941
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
47942
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
47943
+ }
47944
+ });
47945
+
47946
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
47947
+ let thisHeaderData = null;
47948
+ // if the additional headers was passed in as a string parse the json into an object
47949
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
47950
+ try {
47951
+ // parse the additional headers object that was passed in
47952
+ thisHeaderData = JSON.parse(thisHeaderData);
47953
+ } catch (err) {
47954
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
47955
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47956
+ return callback(null, errorObj);
47957
+ }
47958
+ } else if (thisHeaderData === null) {
47959
+ thisHeaderData = { xIamToken: '' };
47960
+ }
47961
+
47962
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
47963
+ // see adapter code documentation for more information on the request object's fields
47964
+ const reqObj = {
47965
+ payload: bodyVars,
47966
+ uriPathVars: pathVars,
47967
+ uriQuery: queryParams,
47968
+ addlHeaders: thisHeaderData
47969
+ };
47970
+
47971
+ try {
47972
+ // Make the call -
47973
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
47974
+ return this.requestHandlerInst.identifyRequest('Config', 'createHealthbotIngestIfaDeviceById', reqObj, true, (irReturnData, irReturnError) => {
47975
+ // if we received an error or their is no response on the results
47976
+ // return an error
47977
+ if (irReturnError) {
47978
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
47979
+ return callback(null, irReturnError);
47980
+ }
47981
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
47982
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createHealthbotIngestIfaDeviceById'], null, null, null);
47983
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47984
+ return callback(null, errorObj);
47985
+ }
47986
+
47987
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
47988
+ // return the response
47989
+ return callback(irReturnData, null);
47990
+ });
47991
+ } catch (ex) {
47992
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
47993
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
47994
+ return callback(null, errorObj);
47995
+ }
47996
+ }
47997
+
47998
+ /**
47999
+ * @function updateHealthbotIngestIfaDeviceById
48000
+ * @pronghornType method
48001
+ * @name updateHealthbotIngestIfaDeviceById
48002
+ * @summary update_healthbot_ingest_ifa_device_by_id
48003
+ *
48004
+ * @param {string} id - ID of ifa device
48005
+ * @param {object} body - devicebody object
48006
+ * @param {getCallback} callback - a callback function to return the result
48007
+ * @return {object} results - An object containing the response of the action
48008
+ *
48009
+ * @route {POST} /updateHealthbotIngestIfaDeviceById
48010
+ * @roles admin
48011
+ * @task true
48012
+ */
48013
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
48014
+ updateHealthbotIngestIfaDeviceById(id, body, callback) {
48015
+ const meth = 'adapter-updateHealthbotIngestIfaDeviceById';
48016
+ const origin = `${this.id}-${meth}`;
48017
+ log.trace(origin);
48018
+
48019
+ if (this.suspended && this.suspendMode === 'error') {
48020
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
48021
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48022
+ return callback(null, errorObj);
48023
+ }
48024
+
48025
+ /* HERE IS WHERE YOU VALIDATE DATA */
48026
+ if (id === undefined || id === null || id === '') {
48027
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
48028
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48029
+ return callback(null, errorObj);
48030
+ }
48031
+ if (body === undefined || body === null || body === '') {
48032
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
48033
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48034
+ return callback(null, errorObj);
48035
+ }
48036
+
48037
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
48038
+ const queryParamsAvailable = {};
48039
+ const queryParams = {};
48040
+ const pathVars = [id];
48041
+ const bodyVars = body;
48042
+
48043
+ // loop in template. long callback arg name to avoid identifier conflicts
48044
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
48045
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
48046
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
48047
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
48048
+ }
48049
+ });
48050
+
48051
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
48052
+ let thisHeaderData = null;
48053
+ // if the additional headers was passed in as a string parse the json into an object
48054
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
48055
+ try {
48056
+ // parse the additional headers object that was passed in
48057
+ thisHeaderData = JSON.parse(thisHeaderData);
48058
+ } catch (err) {
48059
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
48060
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48061
+ return callback(null, errorObj);
48062
+ }
48063
+ } else if (thisHeaderData === null) {
48064
+ thisHeaderData = { xIamToken: '' };
48065
+ }
48066
+
48067
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
48068
+ // see adapter code documentation for more information on the request object's fields
48069
+ const reqObj = {
48070
+ payload: bodyVars,
48071
+ uriPathVars: pathVars,
48072
+ uriQuery: queryParams,
48073
+ addlHeaders: thisHeaderData
48074
+ };
48075
+
48076
+ try {
48077
+ // Make the call -
48078
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
48079
+ return this.requestHandlerInst.identifyRequest('Config', 'updateHealthbotIngestIfaDeviceById', reqObj, false, (irReturnData, irReturnError) => {
48080
+ // if we received an error or their is no response on the results
48081
+ // return an error
48082
+ if (irReturnError) {
48083
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
48084
+ return callback(null, irReturnError);
48085
+ }
48086
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
48087
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateHealthbotIngestIfaDeviceById'], null, null, null);
48088
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48089
+ return callback(null, errorObj);
48090
+ }
48091
+
48092
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
48093
+ // return the response
48094
+ return callback(irReturnData, null);
48095
+ });
48096
+ } catch (ex) {
48097
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
48098
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48099
+ return callback(null, errorObj);
48100
+ }
48101
+ }
48102
+
48103
+ /**
48104
+ * @function postJunosEncode
48105
+ * @pronghornType method
48106
+ * @name postJunosEncode
48107
+ * @summary junosencode
48108
+ *
48109
+ * @param {object} body - String to Encode with Junos
48110
+ * @param {getCallback} callback - a callback function to return the result
48111
+ * @return {object} results - An object containing the response of the action
48112
+ *
48113
+ * @route {POST} /postJunosEncode
48114
+ * @roles admin
48115
+ * @task true
48116
+ */
48117
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
48118
+ postJunosEncode(body, callback) {
48119
+ const meth = 'adapter-postJunosEncode';
48120
+ const origin = `${this.id}-${meth}`;
48121
+ log.trace(origin);
48122
+
48123
+ if (this.suspended && this.suspendMode === 'error') {
48124
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
48125
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48126
+ return callback(null, errorObj);
48127
+ }
48128
+
48129
+ /* HERE IS WHERE YOU VALIDATE DATA */
48130
+ if (body === undefined || body === null || body === '') {
48131
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
48132
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48133
+ return callback(null, errorObj);
48134
+ }
48135
+
48136
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
48137
+ const queryParamsAvailable = {};
48138
+ const queryParams = {};
48139
+ const pathVars = [];
48140
+ const bodyVars = body;
48141
+
48142
+ // loop in template. long callback arg name to avoid identifier conflicts
48143
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
48144
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
48145
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
48146
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
48147
+ }
48148
+ });
48149
+
48150
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
48151
+ let thisHeaderData = null;
48152
+ // if the additional headers was passed in as a string parse the json into an object
48153
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
48154
+ try {
48155
+ // parse the additional headers object that was passed in
48156
+ thisHeaderData = JSON.parse(thisHeaderData);
48157
+ } catch (err) {
48158
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
48159
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48160
+ return callback(null, errorObj);
48161
+ }
48162
+ } else if (thisHeaderData === null) {
48163
+ thisHeaderData = { xIamToken: '' };
48164
+ }
48165
+
48166
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
48167
+ // see adapter code documentation for more information on the request object's fields
48168
+ const reqObj = {
48169
+ payload: bodyVars,
48170
+ uriPathVars: pathVars,
48171
+ uriQuery: queryParams,
48172
+ addlHeaders: thisHeaderData
48173
+ };
48174
+
48175
+ try {
48176
+ // Make the call -
48177
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
48178
+ return this.requestHandlerInst.identifyRequest('Utility', 'postJunosEncode', reqObj, true, (irReturnData, irReturnError) => {
48179
+ // if we received an error or their is no response on the results
48180
+ // return an error
48181
+ if (irReturnError) {
48182
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
48183
+ return callback(null, irReturnError);
48184
+ }
48185
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
48186
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postJunosEncode'], null, null, null);
48187
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48188
+ return callback(null, errorObj);
48189
+ }
48190
+
48191
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
48192
+ // return the response
48193
+ return callback(irReturnData, null);
48194
+ });
48195
+ } catch (ex) {
48196
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
48197
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48198
+ return callback(null, errorObj);
48199
+ }
48200
+ }
48201
+
48202
+ /**
48203
+ * @function postJunosDecode
48204
+ * @pronghornType method
48205
+ * @name postJunosDecode
48206
+ * @summary junosdecode
48207
+ *
48208
+ * @param {object} body - String to Encode with Junos
48209
+ * @param {getCallback} callback - a callback function to return the result
48210
+ * @return {object} results - An object containing the response of the action
48211
+ *
48212
+ * @route {POST} /postJunosDecode
48213
+ * @roles admin
48214
+ * @task true
48215
+ */
48216
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
48217
+ postJunosDecode(body, callback) {
48218
+ const meth = 'adapter-postJunosDecode';
48219
+ const origin = `${this.id}-${meth}`;
48220
+ log.trace(origin);
48221
+
48222
+ if (this.suspended && this.suspendMode === 'error') {
48223
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
48224
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48225
+ return callback(null, errorObj);
48226
+ }
48227
+
48228
+ /* HERE IS WHERE YOU VALIDATE DATA */
48229
+ if (body === undefined || body === null || body === '') {
48230
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
48231
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48232
+ return callback(null, errorObj);
48233
+ }
48234
+
48235
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
48236
+ const queryParamsAvailable = {};
48237
+ const queryParams = {};
48238
+ const pathVars = [];
48239
+ const bodyVars = body;
48240
+
48241
+ // loop in template. long callback arg name to avoid identifier conflicts
48242
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
48243
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
48244
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
48245
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
48246
+ }
48247
+ });
48248
+
48249
+ // if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
48250
+ let thisHeaderData = null;
48251
+ // if the additional headers was passed in as a string parse the json into an object
48252
+ if (thisHeaderData !== null && thisHeaderData.constructor === String) {
48253
+ try {
48254
+ // parse the additional headers object that was passed in
48255
+ thisHeaderData = JSON.parse(thisHeaderData);
48256
+ } catch (err) {
48257
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
48258
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48259
+ return callback(null, errorObj);
48260
+ }
48261
+ } else if (thisHeaderData === null) {
48262
+ thisHeaderData = { xIamToken: '' };
48263
+ }
48264
+
48265
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
48266
+ // see adapter code documentation for more information on the request object's fields
48267
+ const reqObj = {
48268
+ payload: bodyVars,
48269
+ uriPathVars: pathVars,
48270
+ uriQuery: queryParams,
48271
+ addlHeaders: thisHeaderData
48272
+ };
48273
+
48274
+ try {
48275
+ // Make the call -
48276
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
48277
+ return this.requestHandlerInst.identifyRequest('Utility', 'postJunosDecode', reqObj, true, (irReturnData, irReturnError) => {
48278
+ // if we received an error or their is no response on the results
48279
+ // return an error
48280
+ if (irReturnError) {
48281
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
48282
+ return callback(null, irReturnError);
48283
+ }
48284
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
48285
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postJunosDecode'], null, null, null);
48286
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48287
+ return callback(null, errorObj);
48288
+ }
48289
+
48290
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
48291
+ // return the response
48292
+ return callback(irReturnData, null);
48293
+ });
48294
+ } catch (ex) {
48295
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
48296
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
48297
+ return callback(null, errorObj);
48298
+ }
48299
+ }
46320
48300
  }
46321
48301
 
46322
48302
  module.exports = ParagonInsights;