@itentialopensource/adapter-nokia_altiplano 0.1.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTH.md +37 -0
- package/CALLS.md +95 -0
- package/CHANGELOG.md +24 -0
- package/ENHANCE.md +69 -0
- package/PROPERTIES.md +241 -0
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +12 -0
- package/TROUBLESHOOT.md +46 -0
- package/adapter.js +1135 -148
- package/adapterBase.js +1 -1
- package/entities/Intent/action.json +116 -0
- package/entities/Intent/schema.json +6 -1
- package/package.json +3 -3
- package/pronghorn.json +591 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1647623246588.json +95 -0
- package/sampleProperties.json +2 -2
- package/test/integration/adapterTestIntegration.js +154 -0
- package/test/unit/adapterTestUnit.js +287 -0
- package/utils/basicGet.js +0 -17
- package/utils/modify.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/tbScript.js +4 -4
- package/utils/tbUtils.js +51 -6
- package/utils/troubleshootingAdapter.js +2 -26
package/adapter.js
CHANGED
|
@@ -83,7 +83,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
83
83
|
* @getWorkflowFunctions
|
|
84
84
|
*/
|
|
85
85
|
getWorkflowFunctions(inIgnore) {
|
|
86
|
-
let myIgnore = [];
|
|
86
|
+
let myIgnore = ['hasEntities', 'hasDevices'];
|
|
87
87
|
if (!inIgnore && Array.isArray(inIgnore)) {
|
|
88
88
|
myIgnore = inIgnore;
|
|
89
89
|
} else if (!inIgnore && typeof inIgnore === 'string') {
|
|
@@ -247,6 +247,24 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
/**
|
|
251
|
+
* @summary moves entites into Mongo DB
|
|
252
|
+
*
|
|
253
|
+
* @function moveEntitiesToDB
|
|
254
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
255
|
+
* or the error
|
|
256
|
+
*/
|
|
257
|
+
moveEntitiesToDB(callback) {
|
|
258
|
+
const origin = `${this.id}-adapter-moveEntitiesToDB`;
|
|
259
|
+
log.trace(origin);
|
|
260
|
+
try {
|
|
261
|
+
return super.moveEntitiesToDB(callback);
|
|
262
|
+
} catch (err) {
|
|
263
|
+
log.error(`${origin}: ${err}`);
|
|
264
|
+
return callback(null, err);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
250
268
|
/**
|
|
251
269
|
* @summary Determines if this adapter supports the specific entity
|
|
252
270
|
*
|
|
@@ -526,6 +544,456 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
526
544
|
}
|
|
527
545
|
}
|
|
528
546
|
|
|
547
|
+
/* BROKER CALLS */
|
|
548
|
+
/**
|
|
549
|
+
* @summary Determines if this adapter supports any in a list of entities
|
|
550
|
+
*
|
|
551
|
+
* @function hasEntities
|
|
552
|
+
* @param {String} entityType - the entity type to check for
|
|
553
|
+
* @param {Array} entityList - the list of entities we are looking for
|
|
554
|
+
*
|
|
555
|
+
* @param {Callback} callback - A map where the entity is the key and the
|
|
556
|
+
* value is true or false
|
|
557
|
+
*/
|
|
558
|
+
hasEntities(entityType, entityList, callback) {
|
|
559
|
+
const origin = `${this.id}-adapter-hasEntities`;
|
|
560
|
+
log.trace(origin);
|
|
561
|
+
|
|
562
|
+
switch (entityType) {
|
|
563
|
+
case 'Device':
|
|
564
|
+
return this.hasDevices(entityList, callback);
|
|
565
|
+
default:
|
|
566
|
+
return callback(null, `${this.id} does not support entity ${entityType}`);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* @summary Helper method for hasEntities for the specific device case
|
|
572
|
+
*
|
|
573
|
+
* @param {Array} deviceList - array of unique device identifiers
|
|
574
|
+
* @param {Callback} callback - A map where the device is the key and the
|
|
575
|
+
* value is true or false
|
|
576
|
+
*/
|
|
577
|
+
hasDevices(deviceList, callback) {
|
|
578
|
+
const origin = `${this.id}-adapter-hasDevices`;
|
|
579
|
+
log.trace(origin);
|
|
580
|
+
|
|
581
|
+
const findings = deviceList.reduce((map, device) => {
|
|
582
|
+
// eslint-disable-next-line no-param-reassign
|
|
583
|
+
map[device] = false;
|
|
584
|
+
log.debug(`In reduce: ${JSON.stringify(map)}`);
|
|
585
|
+
return map;
|
|
586
|
+
}, {});
|
|
587
|
+
const apiCalls = deviceList.map((device) => new Promise((resolve) => {
|
|
588
|
+
this.getDevice(device, (result, error) => {
|
|
589
|
+
if (error) {
|
|
590
|
+
log.debug(`In map error: ${JSON.stringify(device)}`);
|
|
591
|
+
return resolve({ name: device, found: false });
|
|
592
|
+
}
|
|
593
|
+
log.debug(`In map: ${JSON.stringify(device)}`);
|
|
594
|
+
return resolve({ name: device, found: true });
|
|
595
|
+
});
|
|
596
|
+
}));
|
|
597
|
+
Promise.all(apiCalls).then((results) => {
|
|
598
|
+
results.forEach((device) => {
|
|
599
|
+
findings[device.name] = device.found;
|
|
600
|
+
});
|
|
601
|
+
log.debug(`FINDINGS: ${JSON.stringify(findings)}`);
|
|
602
|
+
return callback(findings);
|
|
603
|
+
}).catch((errors) => {
|
|
604
|
+
log.error('Unable to do device lookup.');
|
|
605
|
+
return callback(null, { code: 503, message: 'Unable to do device lookup.', error: errors });
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* @summary Get Appliance that match the deviceName
|
|
611
|
+
*
|
|
612
|
+
* @function getDevice
|
|
613
|
+
* @param {String} deviceName - the deviceName to find (required)
|
|
614
|
+
*
|
|
615
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
616
|
+
* (appliance) or the error
|
|
617
|
+
*/
|
|
618
|
+
getDevice(deviceName, callback) {
|
|
619
|
+
const meth = 'adapter-getDevice';
|
|
620
|
+
const origin = `${this.id}-${meth}`;
|
|
621
|
+
log.trace(origin);
|
|
622
|
+
|
|
623
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
624
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
625
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
626
|
+
return callback(null, errorObj);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
630
|
+
if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
|
|
631
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
|
|
632
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
633
|
+
return callback(null, errorObj);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
try {
|
|
637
|
+
// need to get the device so we can convert the deviceName to an id
|
|
638
|
+
// !! if we can do a lookup by name the getDevicesFiltered may not be necessary
|
|
639
|
+
const opts = {
|
|
640
|
+
filter: {
|
|
641
|
+
name: deviceName
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
return this.getDevicesFiltered(opts, (devs, ferr) => {
|
|
645
|
+
// if we received an error or their is no response on the results return an error
|
|
646
|
+
if (ferr) {
|
|
647
|
+
return callback(null, ferr);
|
|
648
|
+
}
|
|
649
|
+
if (devs.list.length < 1) {
|
|
650
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
|
|
651
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
652
|
+
return callback(null, errorObj);
|
|
653
|
+
}
|
|
654
|
+
// get the uuid from the device
|
|
655
|
+
const { uuid } = devs.list[0];
|
|
656
|
+
|
|
657
|
+
// !! using Generic makes it easier on the Adapter Builder (just need to change the path)
|
|
658
|
+
// !! you can also replace with a specific call if that is easier
|
|
659
|
+
const uriPath = `/call/toget/device/${uuid}`;
|
|
660
|
+
return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
|
|
661
|
+
// if we received an error or their is no response on the results return an error
|
|
662
|
+
if (error) {
|
|
663
|
+
return callback(null, error);
|
|
664
|
+
}
|
|
665
|
+
if (!result.response || !result.response.applianceMo) {
|
|
666
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevice'], null, null, null);
|
|
667
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
668
|
+
return callback(null, errorObj);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// return the response
|
|
672
|
+
// !! format the data we send back
|
|
673
|
+
// !! these fields are config manager fields you need to map to the data we receive
|
|
674
|
+
const thisDevice = result.response;
|
|
675
|
+
thisDevice.name = thisDevice.systemName;
|
|
676
|
+
thisDevice.ostype = `System-${thisDevice.systemType}`;
|
|
677
|
+
thisDevice.port = thisDevice.systemPort;
|
|
678
|
+
thisDevice.ipaddress = thisDevice.systemIP;
|
|
679
|
+
return callback(thisDevice);
|
|
680
|
+
});
|
|
681
|
+
});
|
|
682
|
+
} catch (ex) {
|
|
683
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
684
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
685
|
+
return callback(null, errorObj);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* @summary Get Appliances that match the filter
|
|
691
|
+
*
|
|
692
|
+
* @function getDevicesFiltered
|
|
693
|
+
* @param {Object} options - the data to use to filter the appliances (optional)
|
|
694
|
+
*
|
|
695
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
696
|
+
* (appliances) or the error
|
|
697
|
+
*/
|
|
698
|
+
getDevicesFiltered(options, callback) {
|
|
699
|
+
const meth = 'adapter-getDevicesFiltered';
|
|
700
|
+
const origin = `${this.id}-${meth}`;
|
|
701
|
+
log.trace(origin);
|
|
702
|
+
|
|
703
|
+
// verify the required fields have been provided
|
|
704
|
+
if (options === undefined || options === null || options === '' || options.length === 0) {
|
|
705
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['options'], null, null, null);
|
|
706
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
707
|
+
return callback(null, errorObj);
|
|
708
|
+
}
|
|
709
|
+
log.debug(`Device Filter Options: ${JSON.stringify(options)}`);
|
|
710
|
+
|
|
711
|
+
// TODO - get pagination working
|
|
712
|
+
// const nextToken = options.start;
|
|
713
|
+
// const maxResults = options.limit;
|
|
714
|
+
|
|
715
|
+
// set up the filter of Device Names
|
|
716
|
+
let filterName = [];
|
|
717
|
+
if (options && options.filter && options.filter.name) {
|
|
718
|
+
// when this hack is removed, remove the lint ignore above
|
|
719
|
+
if (Array.isArray(options.filter.name)) {
|
|
720
|
+
// eslint-disable-next-line prefer-destructuring
|
|
721
|
+
filterName = options.filter.name;
|
|
722
|
+
} else {
|
|
723
|
+
filterName = [options.filter.name];
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// TODO - get sort and order working
|
|
728
|
+
/*
|
|
729
|
+
if (options && options.sort) {
|
|
730
|
+
reqObj.uriOptions.sort = JSON.stringify(options.sort);
|
|
731
|
+
}
|
|
732
|
+
if (options && options.order) {
|
|
733
|
+
reqObj.uriOptions.order = options.order;
|
|
734
|
+
}
|
|
735
|
+
*/
|
|
736
|
+
try {
|
|
737
|
+
// !! using Generic makes it easier on the Adapter Builder (just need to change the path)
|
|
738
|
+
// !! you can also replace with a specific call if that is easier
|
|
739
|
+
const uriPath = '/call/toget/devices';
|
|
740
|
+
return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
|
|
741
|
+
// if we received an error or their is no response on the results return an error
|
|
742
|
+
if (error) {
|
|
743
|
+
return callback(null, error);
|
|
744
|
+
}
|
|
745
|
+
if (!result.response) {
|
|
746
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevicesFiltered'], null, null, null);
|
|
747
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
748
|
+
return callback(null, errorObj);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// !! go through the response - may have to look for sub object
|
|
752
|
+
// handle an array of devices
|
|
753
|
+
if (Array.isArray(result.response)) {
|
|
754
|
+
const myDevices = [];
|
|
755
|
+
|
|
756
|
+
for (let d = 0; d < result.response.length; d += 1) {
|
|
757
|
+
// !! format the data we send back
|
|
758
|
+
// !! these fields are config manager fields you need to map to the data we receive
|
|
759
|
+
const thisDevice = result.response;
|
|
760
|
+
thisDevice.name = thisDevice.systemName;
|
|
761
|
+
thisDevice.ostype = `System-${thisDevice.systemType}`;
|
|
762
|
+
thisDevice.port = thisDevice.systemPort;
|
|
763
|
+
thisDevice.ipaddress = thisDevice.systemIP;
|
|
764
|
+
|
|
765
|
+
// if there is no filter - return the device
|
|
766
|
+
if (filterName.length === 0) {
|
|
767
|
+
myDevices.push(thisDevice);
|
|
768
|
+
} else {
|
|
769
|
+
// if we have to match a filter
|
|
770
|
+
let found = false;
|
|
771
|
+
for (let f = 0; f < filterName.length; f += 1) {
|
|
772
|
+
if (thisDevice.name.indexOf(filterName[f]) >= 0) {
|
|
773
|
+
found = true;
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
// matching device
|
|
778
|
+
if (found) {
|
|
779
|
+
myDevices.push(thisDevice);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
log.debug(`${origin}: Found #${myDevices.length} devices.`);
|
|
784
|
+
log.debug(`Devices: ${JSON.stringify(myDevices)}`);
|
|
785
|
+
return callback({ total: myDevices.length, list: myDevices });
|
|
786
|
+
}
|
|
787
|
+
// handle a single device response
|
|
788
|
+
// !! format the data we send back
|
|
789
|
+
// !! these fields are config manager fields you need to map to the data we receive
|
|
790
|
+
const thisDevice = result.response;
|
|
791
|
+
thisDevice.name = thisDevice.systemName;
|
|
792
|
+
thisDevice.ostype = `System-${thisDevice.systemType}`;
|
|
793
|
+
thisDevice.port = thisDevice.systemPort;
|
|
794
|
+
thisDevice.ipaddress = thisDevice.systemIP;
|
|
795
|
+
|
|
796
|
+
// if there is no filter - return the device
|
|
797
|
+
if (filterName.length === 0) {
|
|
798
|
+
log.debug(`${origin}: Found #1 device.`);
|
|
799
|
+
log.debug(`Device: ${JSON.stringify(thisDevice)}`);
|
|
800
|
+
return callback({ total: 1, list: [thisDevice] });
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
// if there is a filter need to check for matching device
|
|
804
|
+
let found = false;
|
|
805
|
+
for (let f = 0; f < filterName.length; f += 1) {
|
|
806
|
+
if (thisDevice.name.indexOf(filterName[f]) >= 0) {
|
|
807
|
+
found = true;
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
// matching device
|
|
812
|
+
if (found) {
|
|
813
|
+
log.debug(`${origin}: Found #1 device.`);
|
|
814
|
+
log.debug(`Device Found: ${JSON.stringify(thisDevice)}`);
|
|
815
|
+
return callback({ total: 1, list: [thisDevice] });
|
|
816
|
+
}
|
|
817
|
+
// not a matching device
|
|
818
|
+
log.debug(`${origin}: No matching device found.`);
|
|
819
|
+
return callback({ total: 0, list: [] });
|
|
820
|
+
});
|
|
821
|
+
} catch (ex) {
|
|
822
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
823
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
824
|
+
return callback(null, errorObj);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* @summary Gets the status for the provided appliance
|
|
830
|
+
*
|
|
831
|
+
* @function isAlive
|
|
832
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
833
|
+
*
|
|
834
|
+
* @param {configCallback} callback - callback function to return the result
|
|
835
|
+
* (appliance isAlive) or the error
|
|
836
|
+
*/
|
|
837
|
+
isAlive(deviceName, callback) {
|
|
838
|
+
const meth = 'adapter-isAlive';
|
|
839
|
+
const origin = `${this.id}-${meth}`;
|
|
840
|
+
log.trace(origin);
|
|
841
|
+
|
|
842
|
+
// verify the required fields have been provided
|
|
843
|
+
if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
|
|
844
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
|
|
845
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
846
|
+
return callback(null, errorObj);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
try {
|
|
850
|
+
// need to get the device so we can convert the deviceName to an id
|
|
851
|
+
// !! if we can do a lookup by name the getDevicesFiltered may not be necessary
|
|
852
|
+
const opts = {
|
|
853
|
+
filter: {
|
|
854
|
+
name: deviceName
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
return this.getDevicesFiltered(opts, (devs, ferr) => {
|
|
858
|
+
// if we received an error or their is no response on the results return an error
|
|
859
|
+
if (ferr) {
|
|
860
|
+
return callback(null, ferr);
|
|
861
|
+
}
|
|
862
|
+
if (devs.list.length < 1) {
|
|
863
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
|
|
864
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
865
|
+
return callback(null, errorObj);
|
|
866
|
+
}
|
|
867
|
+
// get the uuid from the device
|
|
868
|
+
const { uuid } = devs.list[0];
|
|
869
|
+
|
|
870
|
+
// !! using Generic makes it easier on the Adapter Builder (just need to change the path)
|
|
871
|
+
// !! you can also replace with a specific call if that is easier
|
|
872
|
+
const uriPath = `/call/toget/status/${uuid}`;
|
|
873
|
+
return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
|
|
874
|
+
// if we received an error or their is no response on the results return an error
|
|
875
|
+
if (error) {
|
|
876
|
+
return callback(null, error);
|
|
877
|
+
}
|
|
878
|
+
// !! should update this to make sure we are checking for the appropriate object/field
|
|
879
|
+
if (!result.response || !result.response.returnObj || !Object.hasOwnProperty.call(result.response.returnObj, 'statusField')) {
|
|
880
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['isAlive'], null, null, null);
|
|
881
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
882
|
+
return callback(null, errorObj);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// !! return the response - Update to the appropriate object/field
|
|
886
|
+
return callback(!result.response.returnObj.statusField);
|
|
887
|
+
});
|
|
888
|
+
});
|
|
889
|
+
} catch (ex) {
|
|
890
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
891
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
892
|
+
return callback(null, errorObj);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* @summary Gets a config for the provided Appliance
|
|
898
|
+
*
|
|
899
|
+
* @function getConfig
|
|
900
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
901
|
+
* @param {String} format - the desired format of the config. (optional)
|
|
902
|
+
*
|
|
903
|
+
* @param {configCallback} callback - callback function to return the result
|
|
904
|
+
* (appliance config) or the error
|
|
905
|
+
*/
|
|
906
|
+
getConfig(deviceName, format, callback) {
|
|
907
|
+
const meth = 'adapter-getConfig';
|
|
908
|
+
const origin = `${this.id}-${meth}`;
|
|
909
|
+
log.trace(origin);
|
|
910
|
+
|
|
911
|
+
// verify the required fields have been provided
|
|
912
|
+
if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
|
|
913
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
|
|
914
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
915
|
+
return callback(null, errorObj);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
try {
|
|
919
|
+
// need to get the device so we can convert the deviceName to an id
|
|
920
|
+
// !! if we can do a lookup by name the getDevicesFiltered may not be necessary
|
|
921
|
+
const opts = {
|
|
922
|
+
filter: {
|
|
923
|
+
name: deviceName
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
return this.getDevicesFiltered(opts, (devs, ferr) => {
|
|
927
|
+
// if we received an error or their is no response on the results return an error
|
|
928
|
+
if (ferr) {
|
|
929
|
+
return callback(null, ferr);
|
|
930
|
+
}
|
|
931
|
+
if (devs.list.length < 1) {
|
|
932
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
|
|
933
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
934
|
+
return callback(null, errorObj);
|
|
935
|
+
}
|
|
936
|
+
// get the uuid from the device
|
|
937
|
+
const { uuid } = devs.list[0];
|
|
938
|
+
|
|
939
|
+
// !! using Generic makes it easier on the Adapter Builder (just need to change the path)
|
|
940
|
+
// !! you can also replace with a specific call if that is easier
|
|
941
|
+
const uriPath = `/call/toget/config/${uuid}`;
|
|
942
|
+
return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
|
|
943
|
+
// if we received an error or their is no response on the results return an error
|
|
944
|
+
if (error) {
|
|
945
|
+
return callback(null, error);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
// return the result
|
|
949
|
+
const newResponse = {
|
|
950
|
+
response: JSON.stringify(result.response, null, 2)
|
|
951
|
+
};
|
|
952
|
+
return callback(newResponse);
|
|
953
|
+
});
|
|
954
|
+
});
|
|
955
|
+
} catch (ex) {
|
|
956
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
957
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
958
|
+
return callback(null, errorObj);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* @summary Gets the device count from the system
|
|
964
|
+
*
|
|
965
|
+
* @function getCount
|
|
966
|
+
*
|
|
967
|
+
* @param {getCallback} callback - callback function to return the result
|
|
968
|
+
* (count) or the error
|
|
969
|
+
*/
|
|
970
|
+
getCount(callback) {
|
|
971
|
+
const meth = 'adapter-getCount';
|
|
972
|
+
const origin = `${this.id}-${meth}`;
|
|
973
|
+
log.trace(origin);
|
|
974
|
+
|
|
975
|
+
// verify the required fields have been provided
|
|
976
|
+
|
|
977
|
+
try {
|
|
978
|
+
// !! using Generic makes it easier on the Adapter Builder (just need to change the path)
|
|
979
|
+
// !! you can also replace with a specific call if that is easier
|
|
980
|
+
const uriPath = '/call/toget/count';
|
|
981
|
+
return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
|
|
982
|
+
// if we received an error or their is no response on the results return an error
|
|
983
|
+
if (error) {
|
|
984
|
+
return callback(null, error);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
// return the result
|
|
988
|
+
return callback({ count: result.response });
|
|
989
|
+
});
|
|
990
|
+
} catch (ex) {
|
|
991
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
992
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
993
|
+
return callback(null, errorObj);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
|
|
529
997
|
/**
|
|
530
998
|
* @callback healthCallback
|
|
531
999
|
* @param {Object} result - the result of the get request (contains an id and a status)
|
|
@@ -630,20 +1098,514 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
630
1098
|
/**
|
|
631
1099
|
* @function dependentsSummaryForDevice
|
|
632
1100
|
* @pronghornType method
|
|
633
|
-
* @name dependentsSummaryForDevice
|
|
634
|
-
* @summary Dependents-summary for device
|
|
1101
|
+
* @name dependentsSummaryForDevice
|
|
1102
|
+
* @summary Dependents-summary for device
|
|
1103
|
+
*
|
|
1104
|
+
* @param {string} intent - the intent
|
|
1105
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1106
|
+
* @return {object} results - An object containing the response of the action
|
|
1107
|
+
*
|
|
1108
|
+
* @route {POST} /dependentsSummaryForDevice
|
|
1109
|
+
* @roles admin
|
|
1110
|
+
* @task true
|
|
1111
|
+
*/
|
|
1112
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1113
|
+
dependentsSummaryForDevice(intent, callback) {
|
|
1114
|
+
const meth = 'adapter-dependentsSummaryForDevice';
|
|
1115
|
+
const origin = `${this.id}-${meth}`;
|
|
1116
|
+
log.trace(origin);
|
|
1117
|
+
|
|
1118
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1119
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1120
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1121
|
+
return callback(null, errorObj);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1125
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1126
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
1127
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1128
|
+
return callback(null, errorObj);
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1132
|
+
const queryParamsAvailable = {};
|
|
1133
|
+
const queryParams = {};
|
|
1134
|
+
const pathVars = [intent];
|
|
1135
|
+
const bodyVars = {};
|
|
1136
|
+
|
|
1137
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1138
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1139
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1140
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1141
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
|
|
1145
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1146
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1147
|
+
const reqObj = {
|
|
1148
|
+
payload: bodyVars,
|
|
1149
|
+
uriPathVars: pathVars,
|
|
1150
|
+
uriQuery: queryParams
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
try {
|
|
1154
|
+
// Make the call -
|
|
1155
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1156
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'dependentsSummaryForDevice', reqObj, true, (irReturnData, irReturnError) => {
|
|
1157
|
+
// if we received an error or their is no response on the results
|
|
1158
|
+
// return an error
|
|
1159
|
+
if (irReturnError) {
|
|
1160
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1161
|
+
return callback(null, irReturnError);
|
|
1162
|
+
}
|
|
1163
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1164
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['dependentsSummaryForDevice'], null, null, null);
|
|
1165
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1166
|
+
return callback(null, errorObj);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1170
|
+
// return the response
|
|
1171
|
+
return callback(irReturnData, null);
|
|
1172
|
+
});
|
|
1173
|
+
} catch (ex) {
|
|
1174
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1175
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1176
|
+
return callback(null, errorObj);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* @function getuplinkConnectionConfiguration
|
|
1182
|
+
* @pronghornType method
|
|
1183
|
+
* @name getuplinkConnectionConfiguration
|
|
1184
|
+
* @summary Get uplink-connection configuration
|
|
1185
|
+
*
|
|
1186
|
+
* @param {object} body - body param
|
|
1187
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1188
|
+
* @return {object} results - An object containing the response of the action
|
|
1189
|
+
*
|
|
1190
|
+
* @route {POST} /getuplinkConnectionConfiguration
|
|
1191
|
+
* @roles admin
|
|
1192
|
+
* @task true
|
|
1193
|
+
*/
|
|
1194
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1195
|
+
getuplinkConnectionConfiguration(body, callback) {
|
|
1196
|
+
const meth = 'adapter-getuplinkConnectionConfiguration';
|
|
1197
|
+
const origin = `${this.id}-${meth}`;
|
|
1198
|
+
log.trace(origin);
|
|
1199
|
+
|
|
1200
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1201
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1202
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1203
|
+
return callback(null, errorObj);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1207
|
+
if (body === undefined || body === null || body === '') {
|
|
1208
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1209
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1210
|
+
return callback(null, errorObj);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1214
|
+
const queryParamsAvailable = {};
|
|
1215
|
+
const queryParams = {};
|
|
1216
|
+
const pathVars = [];
|
|
1217
|
+
const bodyVars = body;
|
|
1218
|
+
|
|
1219
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1220
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1221
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1222
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1223
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1224
|
+
}
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1227
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1228
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1229
|
+
const reqObj = {
|
|
1230
|
+
payload: bodyVars,
|
|
1231
|
+
uriPathVars: pathVars,
|
|
1232
|
+
uriQuery: queryParams
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
try {
|
|
1236
|
+
// Make the call -
|
|
1237
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1238
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'getuplinkConnectionConfiguration', reqObj, true, (irReturnData, irReturnError) => {
|
|
1239
|
+
// if we received an error or their is no response on the results
|
|
1240
|
+
// return an error
|
|
1241
|
+
if (irReturnError) {
|
|
1242
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1243
|
+
return callback(null, irReturnError);
|
|
1244
|
+
}
|
|
1245
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1246
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getuplinkConnectionConfiguration'], null, null, null);
|
|
1247
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1248
|
+
return callback(null, errorObj);
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1252
|
+
// return the response
|
|
1253
|
+
return callback(irReturnData, null);
|
|
1254
|
+
});
|
|
1255
|
+
} catch (ex) {
|
|
1256
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1257
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1258
|
+
return callback(null, errorObj);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
/**
|
|
1263
|
+
* @function dependentsSummaryFiber
|
|
1264
|
+
* @pronghornType method
|
|
1265
|
+
* @name dependentsSummaryFiber
|
|
1266
|
+
* @summary Dependents summary fiber
|
|
1267
|
+
*
|
|
1268
|
+
* @param {string} intent - the intent
|
|
1269
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1270
|
+
* @return {object} results - An object containing the response of the action
|
|
1271
|
+
*
|
|
1272
|
+
* @route {POST} /dependentsSummaryFiber
|
|
1273
|
+
* @roles admin
|
|
1274
|
+
* @task true
|
|
1275
|
+
*/
|
|
1276
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1277
|
+
dependentsSummaryFiber(intent, callback) {
|
|
1278
|
+
const meth = 'adapter-dependentsSummaryFiber';
|
|
1279
|
+
const origin = `${this.id}-${meth}`;
|
|
1280
|
+
log.trace(origin);
|
|
1281
|
+
|
|
1282
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1283
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1284
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1285
|
+
return callback(null, errorObj);
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1289
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1290
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
1291
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1292
|
+
return callback(null, errorObj);
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1296
|
+
const queryParamsAvailable = {};
|
|
1297
|
+
const queryParams = {};
|
|
1298
|
+
const pathVars = [intent];
|
|
1299
|
+
const bodyVars = {};
|
|
1300
|
+
|
|
1301
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1302
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1303
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1304
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1305
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
|
|
1309
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1310
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1311
|
+
const reqObj = {
|
|
1312
|
+
payload: bodyVars,
|
|
1313
|
+
uriPathVars: pathVars,
|
|
1314
|
+
uriQuery: queryParams
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1317
|
+
try {
|
|
1318
|
+
// Make the call -
|
|
1319
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1320
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'dependentsSummaryFiber', reqObj, true, (irReturnData, irReturnError) => {
|
|
1321
|
+
// if we received an error or their is no response on the results
|
|
1322
|
+
// return an error
|
|
1323
|
+
if (irReturnError) {
|
|
1324
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1325
|
+
return callback(null, irReturnError);
|
|
1326
|
+
}
|
|
1327
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1328
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['dependentsSummaryFiber'], null, null, null);
|
|
1329
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1330
|
+
return callback(null, errorObj);
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1334
|
+
// return the response
|
|
1335
|
+
return callback(irReturnData, null);
|
|
1336
|
+
});
|
|
1337
|
+
} catch (ex) {
|
|
1338
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1339
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1340
|
+
return callback(null, errorObj);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* @function createOnt
|
|
1346
|
+
* @pronghornType method
|
|
1347
|
+
* @name createOnt
|
|
1348
|
+
* @summary Create ont
|
|
1349
|
+
*
|
|
1350
|
+
* @param {object} body - body param
|
|
1351
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1352
|
+
* @return {object} results - An object containing the response of the action
|
|
1353
|
+
*
|
|
1354
|
+
* @route {POST} /createOnt
|
|
1355
|
+
* @roles admin
|
|
1356
|
+
* @task true
|
|
1357
|
+
*/
|
|
1358
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1359
|
+
createOnt(body, callback) {
|
|
1360
|
+
const meth = 'adapter-createOnt';
|
|
1361
|
+
const origin = `${this.id}-${meth}`;
|
|
1362
|
+
log.trace(origin);
|
|
1363
|
+
|
|
1364
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1365
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1366
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1367
|
+
return callback(null, errorObj);
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1371
|
+
if (body === undefined || body === null || body === '') {
|
|
1372
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1373
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1374
|
+
return callback(null, errorObj);
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1378
|
+
const queryParamsAvailable = {};
|
|
1379
|
+
const queryParams = {};
|
|
1380
|
+
const pathVars = [];
|
|
1381
|
+
const bodyVars = body;
|
|
1382
|
+
|
|
1383
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1384
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1385
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1386
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1387
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
|
|
1391
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1392
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1393
|
+
const reqObj = {
|
|
1394
|
+
payload: bodyVars,
|
|
1395
|
+
uriPathVars: pathVars,
|
|
1396
|
+
uriQuery: queryParams
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
try {
|
|
1400
|
+
// Make the call -
|
|
1401
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1402
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'createOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
1403
|
+
// if we received an error or their is no response on the results
|
|
1404
|
+
// return an error
|
|
1405
|
+
if (irReturnError) {
|
|
1406
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1407
|
+
return callback(null, irReturnError);
|
|
1408
|
+
}
|
|
1409
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1410
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createOnt'], null, null, null);
|
|
1411
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1412
|
+
return callback(null, errorObj);
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1416
|
+
// return the response
|
|
1417
|
+
return callback(irReturnData, null);
|
|
1418
|
+
});
|
|
1419
|
+
} catch (ex) {
|
|
1420
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1421
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1422
|
+
return callback(null, errorObj);
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* @function createOntWithQuery
|
|
1428
|
+
* @pronghornType method
|
|
1429
|
+
* @name createOntWithQuery
|
|
1430
|
+
* @summary Create ont with query params
|
|
1431
|
+
*
|
|
1432
|
+
* @param {object} body - body param
|
|
1433
|
+
* @param {object} query - query param
|
|
1434
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1435
|
+
* @return {object} results - An object containing the response of the action
|
|
1436
|
+
*
|
|
1437
|
+
* @route {POST} /createOntWithQuery
|
|
1438
|
+
* @roles admin
|
|
1439
|
+
* @task true
|
|
1440
|
+
*/
|
|
1441
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1442
|
+
createOntWithQuery(body, query, callback) {
|
|
1443
|
+
const meth = 'adapter-createOntWithQuery';
|
|
1444
|
+
const origin = `${this.id}-${meth}`;
|
|
1445
|
+
log.trace(origin);
|
|
1446
|
+
|
|
1447
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1448
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1449
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1450
|
+
return callback(null, errorObj);
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1454
|
+
if (body === undefined || body === null || body === '') {
|
|
1455
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1456
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1457
|
+
return callback(null, errorObj);
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1461
|
+
const queryParamsAvailable = query;
|
|
1462
|
+
const queryParams = {};
|
|
1463
|
+
const pathVars = [];
|
|
1464
|
+
const bodyVars = body;
|
|
1465
|
+
|
|
1466
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1467
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1468
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1469
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1470
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1475
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1476
|
+
const reqObj = {
|
|
1477
|
+
payload: bodyVars,
|
|
1478
|
+
uriPathVars: pathVars,
|
|
1479
|
+
uriQuery: queryParams
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
try {
|
|
1483
|
+
// Make the call -
|
|
1484
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1485
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'createOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
1486
|
+
// if we received an error or their is no response on the results
|
|
1487
|
+
// return an error
|
|
1488
|
+
if (irReturnError) {
|
|
1489
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1490
|
+
return callback(null, irReturnError);
|
|
1491
|
+
}
|
|
1492
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1493
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createOntWithQuery'], null, null, null);
|
|
1494
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1495
|
+
return callback(null, errorObj);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1499
|
+
// return the response
|
|
1500
|
+
return callback(irReturnData, null);
|
|
1501
|
+
});
|
|
1502
|
+
} catch (ex) {
|
|
1503
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1504
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1505
|
+
return callback(null, errorObj);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* @function getOnt
|
|
1511
|
+
* @pronghornType method
|
|
1512
|
+
* @name getOnt
|
|
1513
|
+
* @summary GET ont
|
|
1514
|
+
*
|
|
1515
|
+
* @param {string} intent - the intent
|
|
1516
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1517
|
+
* @return {object} results - An object containing the response of the action
|
|
1518
|
+
*
|
|
1519
|
+
* @route {POST} /getOnt
|
|
1520
|
+
* @roles admin
|
|
1521
|
+
* @task true
|
|
1522
|
+
*/
|
|
1523
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1524
|
+
getOnt(intent, callback) {
|
|
1525
|
+
const meth = 'adapter-getOnt';
|
|
1526
|
+
const origin = `${this.id}-${meth}`;
|
|
1527
|
+
log.trace(origin);
|
|
1528
|
+
|
|
1529
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1530
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1531
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1532
|
+
return callback(null, errorObj);
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1536
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1537
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
1538
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1539
|
+
return callback(null, errorObj);
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1543
|
+
const queryParamsAvailable = {};
|
|
1544
|
+
const queryParams = {};
|
|
1545
|
+
const pathVars = [intent];
|
|
1546
|
+
const bodyVars = {};
|
|
1547
|
+
|
|
1548
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1549
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1550
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1551
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1552
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1555
|
+
|
|
1556
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1557
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1558
|
+
const reqObj = {
|
|
1559
|
+
payload: bodyVars,
|
|
1560
|
+
uriPathVars: pathVars,
|
|
1561
|
+
uriQuery: queryParams
|
|
1562
|
+
};
|
|
1563
|
+
|
|
1564
|
+
try {
|
|
1565
|
+
// Make the call -
|
|
1566
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1567
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'getOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
1568
|
+
// if we received an error or their is no response on the results
|
|
1569
|
+
// return an error
|
|
1570
|
+
if (irReturnError) {
|
|
1571
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1572
|
+
return callback(null, irReturnError);
|
|
1573
|
+
}
|
|
1574
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1575
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getOnt'], null, null, null);
|
|
1576
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1577
|
+
return callback(null, errorObj);
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1581
|
+
// return the response
|
|
1582
|
+
return callback(irReturnData, null);
|
|
1583
|
+
});
|
|
1584
|
+
} catch (ex) {
|
|
1585
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1586
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1587
|
+
return callback(null, errorObj);
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
/**
|
|
1592
|
+
* @function lockOnt
|
|
1593
|
+
* @pronghornType method
|
|
1594
|
+
* @name lockOnt
|
|
1595
|
+
* @summary Lock ont
|
|
635
1596
|
*
|
|
636
1597
|
* @param {string} intent - the intent
|
|
1598
|
+
* @param {object} body - body param
|
|
637
1599
|
* @param {getCallback} callback - a callback function to return the result
|
|
638
1600
|
* @return {object} results - An object containing the response of the action
|
|
639
1601
|
*
|
|
640
|
-
* @route {POST} /
|
|
1602
|
+
* @route {POST} /lockOnt
|
|
641
1603
|
* @roles admin
|
|
642
1604
|
* @task true
|
|
643
1605
|
*/
|
|
644
1606
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
645
|
-
|
|
646
|
-
const meth = 'adapter-
|
|
1607
|
+
lockOnt(intent, body, callback) {
|
|
1608
|
+
const meth = 'adapter-lockOnt';
|
|
647
1609
|
const origin = `${this.id}-${meth}`;
|
|
648
1610
|
log.trace(origin);
|
|
649
1611
|
|
|
@@ -659,12 +1621,17 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
659
1621
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
660
1622
|
return callback(null, errorObj);
|
|
661
1623
|
}
|
|
1624
|
+
if (body === undefined || body === null || body === '') {
|
|
1625
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1626
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1627
|
+
return callback(null, errorObj);
|
|
1628
|
+
}
|
|
662
1629
|
|
|
663
1630
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
664
1631
|
const queryParamsAvailable = {};
|
|
665
1632
|
const queryParams = {};
|
|
666
1633
|
const pathVars = [intent];
|
|
667
|
-
const bodyVars =
|
|
1634
|
+
const bodyVars = body;
|
|
668
1635
|
|
|
669
1636
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
670
1637
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -685,7 +1652,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
685
1652
|
try {
|
|
686
1653
|
// Make the call -
|
|
687
1654
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
688
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
1655
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'lockOnt', reqObj, false, (irReturnData, irReturnError) => {
|
|
689
1656
|
// if we received an error or their is no response on the results
|
|
690
1657
|
// return an error
|
|
691
1658
|
if (irReturnError) {
|
|
@@ -693,7 +1660,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
693
1660
|
return callback(null, irReturnError);
|
|
694
1661
|
}
|
|
695
1662
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
696
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
1663
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['lockOnt'], null, null, null);
|
|
697
1664
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
698
1665
|
return callback(null, errorObj);
|
|
699
1666
|
}
|
|
@@ -710,22 +1677,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
710
1677
|
}
|
|
711
1678
|
|
|
712
1679
|
/**
|
|
713
|
-
* @function
|
|
1680
|
+
* @function deleteOnt
|
|
714
1681
|
* @pronghornType method
|
|
715
|
-
* @name
|
|
716
|
-
* @summary
|
|
1682
|
+
* @name deleteOnt
|
|
1683
|
+
* @summary Delete ont
|
|
717
1684
|
*
|
|
718
|
-
* @param {
|
|
1685
|
+
* @param {string} intent - the intent
|
|
719
1686
|
* @param {getCallback} callback - a callback function to return the result
|
|
720
1687
|
* @return {object} results - An object containing the response of the action
|
|
721
1688
|
*
|
|
722
|
-
* @route {POST} /
|
|
1689
|
+
* @route {POST} /deleteOnt
|
|
723
1690
|
* @roles admin
|
|
724
1691
|
* @task true
|
|
725
1692
|
*/
|
|
726
1693
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
727
|
-
|
|
728
|
-
const meth = 'adapter-
|
|
1694
|
+
deleteOnt(intent, callback) {
|
|
1695
|
+
const meth = 'adapter-deleteOnt';
|
|
729
1696
|
const origin = `${this.id}-${meth}`;
|
|
730
1697
|
log.trace(origin);
|
|
731
1698
|
|
|
@@ -736,8 +1703,8 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
736
1703
|
}
|
|
737
1704
|
|
|
738
1705
|
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
739
|
-
if (
|
|
740
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['
|
|
1706
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1707
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
741
1708
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
742
1709
|
return callback(null, errorObj);
|
|
743
1710
|
}
|
|
@@ -745,8 +1712,8 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
745
1712
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
746
1713
|
const queryParamsAvailable = {};
|
|
747
1714
|
const queryParams = {};
|
|
748
|
-
const pathVars = [];
|
|
749
|
-
const bodyVars =
|
|
1715
|
+
const pathVars = [intent];
|
|
1716
|
+
const bodyVars = {};
|
|
750
1717
|
|
|
751
1718
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
752
1719
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -767,7 +1734,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
767
1734
|
try {
|
|
768
1735
|
// Make the call -
|
|
769
1736
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
770
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
1737
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'deleteOnt', reqObj, false, (irReturnData, irReturnError) => {
|
|
771
1738
|
// if we received an error or their is no response on the results
|
|
772
1739
|
// return an error
|
|
773
1740
|
if (irReturnError) {
|
|
@@ -775,7 +1742,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
775
1742
|
return callback(null, irReturnError);
|
|
776
1743
|
}
|
|
777
1744
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
778
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
1745
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteOnt'], null, null, null);
|
|
779
1746
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
780
1747
|
return callback(null, errorObj);
|
|
781
1748
|
}
|
|
@@ -792,22 +1759,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
792
1759
|
}
|
|
793
1760
|
|
|
794
1761
|
/**
|
|
795
|
-
* @function
|
|
1762
|
+
* @function synchronizeOnt
|
|
796
1763
|
* @pronghornType method
|
|
797
|
-
* @name
|
|
798
|
-
* @summary
|
|
1764
|
+
* @name synchronizeOnt
|
|
1765
|
+
* @summary Synchronize ont
|
|
799
1766
|
*
|
|
800
1767
|
* @param {string} intent - the intent
|
|
801
1768
|
* @param {getCallback} callback - a callback function to return the result
|
|
802
1769
|
* @return {object} results - An object containing the response of the action
|
|
803
1770
|
*
|
|
804
|
-
* @route {POST} /
|
|
1771
|
+
* @route {POST} /synchronizeOnt
|
|
805
1772
|
* @roles admin
|
|
806
1773
|
* @task true
|
|
807
1774
|
*/
|
|
808
1775
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
809
|
-
|
|
810
|
-
const meth = 'adapter-
|
|
1776
|
+
synchronizeOnt(intent, callback) {
|
|
1777
|
+
const meth = 'adapter-synchronizeOnt';
|
|
811
1778
|
const origin = `${this.id}-${meth}`;
|
|
812
1779
|
log.trace(origin);
|
|
813
1780
|
|
|
@@ -849,7 +1816,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
849
1816
|
try {
|
|
850
1817
|
// Make the call -
|
|
851
1818
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
852
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
1819
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'synchronizeOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
853
1820
|
// if we received an error or their is no response on the results
|
|
854
1821
|
// return an error
|
|
855
1822
|
if (irReturnError) {
|
|
@@ -857,7 +1824,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
857
1824
|
return callback(null, irReturnError);
|
|
858
1825
|
}
|
|
859
1826
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
860
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
1827
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizeOnt'], null, null, null);
|
|
861
1828
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
862
1829
|
return callback(null, errorObj);
|
|
863
1830
|
}
|
|
@@ -874,22 +1841,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
874
1841
|
}
|
|
875
1842
|
|
|
876
1843
|
/**
|
|
877
|
-
* @function
|
|
1844
|
+
* @function auditOnt
|
|
878
1845
|
* @pronghornType method
|
|
879
|
-
* @name
|
|
880
|
-
* @summary
|
|
1846
|
+
* @name auditOnt
|
|
1847
|
+
* @summary Audit ont
|
|
881
1848
|
*
|
|
882
|
-
* @param {
|
|
1849
|
+
* @param {string} intent - the intent
|
|
883
1850
|
* @param {getCallback} callback - a callback function to return the result
|
|
884
1851
|
* @return {object} results - An object containing the response of the action
|
|
885
1852
|
*
|
|
886
|
-
* @route {POST} /
|
|
1853
|
+
* @route {POST} /auditOnt
|
|
887
1854
|
* @roles admin
|
|
888
1855
|
* @task true
|
|
889
1856
|
*/
|
|
890
1857
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
891
|
-
|
|
892
|
-
const meth = 'adapter-
|
|
1858
|
+
auditOnt(intent, callback) {
|
|
1859
|
+
const meth = 'adapter-auditOnt';
|
|
893
1860
|
const origin = `${this.id}-${meth}`;
|
|
894
1861
|
log.trace(origin);
|
|
895
1862
|
|
|
@@ -900,8 +1867,8 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
900
1867
|
}
|
|
901
1868
|
|
|
902
1869
|
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
903
|
-
if (
|
|
904
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['
|
|
1870
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1871
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
905
1872
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
906
1873
|
return callback(null, errorObj);
|
|
907
1874
|
}
|
|
@@ -909,8 +1876,8 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
909
1876
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
910
1877
|
const queryParamsAvailable = {};
|
|
911
1878
|
const queryParams = {};
|
|
912
|
-
const pathVars = [];
|
|
913
|
-
const bodyVars =
|
|
1879
|
+
const pathVars = [intent];
|
|
1880
|
+
const bodyVars = {};
|
|
914
1881
|
|
|
915
1882
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
916
1883
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -931,7 +1898,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
931
1898
|
try {
|
|
932
1899
|
// Make the call -
|
|
933
1900
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
934
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
1901
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'auditOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
935
1902
|
// if we received an error or their is no response on the results
|
|
936
1903
|
// return an error
|
|
937
1904
|
if (irReturnError) {
|
|
@@ -939,7 +1906,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
939
1906
|
return callback(null, irReturnError);
|
|
940
1907
|
}
|
|
941
1908
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
942
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
1909
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditOnt'], null, null, null);
|
|
943
1910
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
944
1911
|
return callback(null, errorObj);
|
|
945
1912
|
}
|
|
@@ -956,22 +1923,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
956
1923
|
}
|
|
957
1924
|
|
|
958
1925
|
/**
|
|
959
|
-
* @function
|
|
1926
|
+
* @function synchronizel2User
|
|
960
1927
|
* @pronghornType method
|
|
961
|
-
* @name
|
|
962
|
-
* @summary
|
|
1928
|
+
* @name synchronizel2User
|
|
1929
|
+
* @summary Synchronize l2-user
|
|
963
1930
|
*
|
|
964
1931
|
* @param {string} intent - the intent
|
|
965
1932
|
* @param {getCallback} callback - a callback function to return the result
|
|
966
1933
|
* @return {object} results - An object containing the response of the action
|
|
967
1934
|
*
|
|
968
|
-
* @route {POST} /
|
|
1935
|
+
* @route {POST} /synchronizel2User
|
|
969
1936
|
* @roles admin
|
|
970
1937
|
* @task true
|
|
971
1938
|
*/
|
|
972
1939
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
973
|
-
|
|
974
|
-
const meth = 'adapter-
|
|
1940
|
+
synchronizel2User(intent, callback) {
|
|
1941
|
+
const meth = 'adapter-synchronizel2User';
|
|
975
1942
|
const origin = `${this.id}-${meth}`;
|
|
976
1943
|
log.trace(origin);
|
|
977
1944
|
|
|
@@ -1013,7 +1980,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1013
1980
|
try {
|
|
1014
1981
|
// Make the call -
|
|
1015
1982
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1016
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
1983
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'synchronizel2User', reqObj, true, (irReturnData, irReturnError) => {
|
|
1017
1984
|
// if we received an error or their is no response on the results
|
|
1018
1985
|
// return an error
|
|
1019
1986
|
if (irReturnError) {
|
|
@@ -1021,7 +1988,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1021
1988
|
return callback(null, irReturnError);
|
|
1022
1989
|
}
|
|
1023
1990
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1024
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
1991
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizel2User'], null, null, null);
|
|
1025
1992
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1026
1993
|
return callback(null, errorObj);
|
|
1027
1994
|
}
|
|
@@ -1038,23 +2005,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1038
2005
|
}
|
|
1039
2006
|
|
|
1040
2007
|
/**
|
|
1041
|
-
* @function
|
|
2008
|
+
* @function getl2User
|
|
1042
2009
|
* @pronghornType method
|
|
1043
|
-
* @name
|
|
1044
|
-
* @summary
|
|
2010
|
+
* @name getl2User
|
|
2011
|
+
* @summary GET l2-user
|
|
1045
2012
|
*
|
|
1046
2013
|
* @param {string} intent - the intent
|
|
1047
|
-
* @param {object} body - body param
|
|
1048
2014
|
* @param {getCallback} callback - a callback function to return the result
|
|
1049
2015
|
* @return {object} results - An object containing the response of the action
|
|
1050
2016
|
*
|
|
1051
|
-
* @route {POST} /
|
|
2017
|
+
* @route {POST} /getl2User
|
|
1052
2018
|
* @roles admin
|
|
1053
2019
|
* @task true
|
|
1054
2020
|
*/
|
|
1055
2021
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1056
|
-
|
|
1057
|
-
const meth = 'adapter-
|
|
2022
|
+
getl2User(intent, callback) {
|
|
2023
|
+
const meth = 'adapter-getl2User';
|
|
1058
2024
|
const origin = `${this.id}-${meth}`;
|
|
1059
2025
|
log.trace(origin);
|
|
1060
2026
|
|
|
@@ -1070,17 +2036,12 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1070
2036
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1071
2037
|
return callback(null, errorObj);
|
|
1072
2038
|
}
|
|
1073
|
-
if (body === undefined || body === null || body === '') {
|
|
1074
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1075
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1076
|
-
return callback(null, errorObj);
|
|
1077
|
-
}
|
|
1078
2039
|
|
|
1079
2040
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1080
2041
|
const queryParamsAvailable = {};
|
|
1081
2042
|
const queryParams = {};
|
|
1082
2043
|
const pathVars = [intent];
|
|
1083
|
-
const bodyVars =
|
|
2044
|
+
const bodyVars = {};
|
|
1084
2045
|
|
|
1085
2046
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1086
2047
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -1101,7 +2062,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1101
2062
|
try {
|
|
1102
2063
|
// Make the call -
|
|
1103
2064
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1104
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2065
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'getl2User', reqObj, true, (irReturnData, irReturnError) => {
|
|
1105
2066
|
// if we received an error or their is no response on the results
|
|
1106
2067
|
// return an error
|
|
1107
2068
|
if (irReturnError) {
|
|
@@ -1109,7 +2070,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1109
2070
|
return callback(null, irReturnError);
|
|
1110
2071
|
}
|
|
1111
2072
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1112
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2073
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getl2User'], null, null, null);
|
|
1113
2074
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1114
2075
|
return callback(null, errorObj);
|
|
1115
2076
|
}
|
|
@@ -1126,22 +2087,23 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1126
2087
|
}
|
|
1127
2088
|
|
|
1128
2089
|
/**
|
|
1129
|
-
* @function
|
|
2090
|
+
* @function modifyl2User
|
|
1130
2091
|
* @pronghornType method
|
|
1131
|
-
* @name
|
|
1132
|
-
* @summary
|
|
2092
|
+
* @name modifyl2User
|
|
2093
|
+
* @summary Modify l2-user
|
|
1133
2094
|
*
|
|
1134
2095
|
* @param {string} intent - the intent
|
|
2096
|
+
* @param {object} body - body param
|
|
1135
2097
|
* @param {getCallback} callback - a callback function to return the result
|
|
1136
2098
|
* @return {object} results - An object containing the response of the action
|
|
1137
2099
|
*
|
|
1138
|
-
* @route {POST} /
|
|
2100
|
+
* @route {POST} /modifyl2User
|
|
1139
2101
|
* @roles admin
|
|
1140
2102
|
* @task true
|
|
1141
2103
|
*/
|
|
1142
2104
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1143
|
-
|
|
1144
|
-
const meth = 'adapter-
|
|
2105
|
+
modifyl2User(intent, body, callback) {
|
|
2106
|
+
const meth = 'adapter-modifyl2User';
|
|
1145
2107
|
const origin = `${this.id}-${meth}`;
|
|
1146
2108
|
log.trace(origin);
|
|
1147
2109
|
|
|
@@ -1157,12 +2119,17 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1157
2119
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1158
2120
|
return callback(null, errorObj);
|
|
1159
2121
|
}
|
|
2122
|
+
if (body === undefined || body === null || body === '') {
|
|
2123
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
2124
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2125
|
+
return callback(null, errorObj);
|
|
2126
|
+
}
|
|
1160
2127
|
|
|
1161
2128
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1162
2129
|
const queryParamsAvailable = {};
|
|
1163
2130
|
const queryParams = {};
|
|
1164
2131
|
const pathVars = [intent];
|
|
1165
|
-
const bodyVars =
|
|
2132
|
+
const bodyVars = body;
|
|
1166
2133
|
|
|
1167
2134
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1168
2135
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -1183,7 +2150,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1183
2150
|
try {
|
|
1184
2151
|
// Make the call -
|
|
1185
2152
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1186
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2153
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'modifyl2User', reqObj, false, (irReturnData, irReturnError) => {
|
|
1187
2154
|
// if we received an error or their is no response on the results
|
|
1188
2155
|
// return an error
|
|
1189
2156
|
if (irReturnError) {
|
|
@@ -1191,7 +2158,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1191
2158
|
return callback(null, irReturnError);
|
|
1192
2159
|
}
|
|
1193
2160
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1194
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2161
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['modifyl2User'], null, null, null);
|
|
1195
2162
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1196
2163
|
return callback(null, errorObj);
|
|
1197
2164
|
}
|
|
@@ -1208,22 +2175,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1208
2175
|
}
|
|
1209
2176
|
|
|
1210
2177
|
/**
|
|
1211
|
-
* @function
|
|
2178
|
+
* @function deletel2User
|
|
1212
2179
|
* @pronghornType method
|
|
1213
|
-
* @name
|
|
1214
|
-
* @summary
|
|
2180
|
+
* @name deletel2User
|
|
2181
|
+
* @summary Delete l2-user
|
|
1215
2182
|
*
|
|
1216
2183
|
* @param {string} intent - the intent
|
|
1217
2184
|
* @param {getCallback} callback - a callback function to return the result
|
|
1218
2185
|
* @return {object} results - An object containing the response of the action
|
|
1219
2186
|
*
|
|
1220
|
-
* @route {POST} /
|
|
2187
|
+
* @route {POST} /deletel2User
|
|
1221
2188
|
* @roles admin
|
|
1222
2189
|
* @task true
|
|
1223
2190
|
*/
|
|
1224
2191
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1225
|
-
|
|
1226
|
-
const meth = 'adapter-
|
|
2192
|
+
deletel2User(intent, callback) {
|
|
2193
|
+
const meth = 'adapter-deletel2User';
|
|
1227
2194
|
const origin = `${this.id}-${meth}`;
|
|
1228
2195
|
log.trace(origin);
|
|
1229
2196
|
|
|
@@ -1265,7 +2232,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1265
2232
|
try {
|
|
1266
2233
|
// Make the call -
|
|
1267
2234
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1268
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2235
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'deletel2User', reqObj, false, (irReturnData, irReturnError) => {
|
|
1269
2236
|
// if we received an error or their is no response on the results
|
|
1270
2237
|
// return an error
|
|
1271
2238
|
if (irReturnError) {
|
|
@@ -1273,7 +2240,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1273
2240
|
return callback(null, irReturnError);
|
|
1274
2241
|
}
|
|
1275
2242
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1276
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2243
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletel2User'], null, null, null);
|
|
1277
2244
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1278
2245
|
return callback(null, errorObj);
|
|
1279
2246
|
}
|
|
@@ -1290,22 +2257,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1290
2257
|
}
|
|
1291
2258
|
|
|
1292
2259
|
/**
|
|
1293
|
-
* @function
|
|
2260
|
+
* @function auditl2User
|
|
1294
2261
|
* @pronghornType method
|
|
1295
|
-
* @name
|
|
1296
|
-
* @summary Audit
|
|
2262
|
+
* @name auditl2User
|
|
2263
|
+
* @summary Audit l2-user
|
|
1297
2264
|
*
|
|
1298
2265
|
* @param {string} intent - the intent
|
|
1299
2266
|
* @param {getCallback} callback - a callback function to return the result
|
|
1300
2267
|
* @return {object} results - An object containing the response of the action
|
|
1301
2268
|
*
|
|
1302
|
-
* @route {POST} /
|
|
2269
|
+
* @route {POST} /auditl2User
|
|
1303
2270
|
* @roles admin
|
|
1304
2271
|
* @task true
|
|
1305
2272
|
*/
|
|
1306
2273
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1307
|
-
|
|
1308
|
-
const meth = 'adapter-
|
|
2274
|
+
auditl2User(intent, callback) {
|
|
2275
|
+
const meth = 'adapter-auditl2User';
|
|
1309
2276
|
const origin = `${this.id}-${meth}`;
|
|
1310
2277
|
log.trace(origin);
|
|
1311
2278
|
|
|
@@ -1347,7 +2314,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1347
2314
|
try {
|
|
1348
2315
|
// Make the call -
|
|
1349
2316
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1350
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2317
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'auditl2User', reqObj, true, (irReturnData, irReturnError) => {
|
|
1351
2318
|
// if we received an error or their is no response on the results
|
|
1352
2319
|
// return an error
|
|
1353
2320
|
if (irReturnError) {
|
|
@@ -1355,7 +2322,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1355
2322
|
return callback(null, irReturnError);
|
|
1356
2323
|
}
|
|
1357
2324
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1358
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2325
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditl2User'], null, null, null);
|
|
1359
2326
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1360
2327
|
return callback(null, errorObj);
|
|
1361
2328
|
}
|
|
@@ -1372,22 +2339,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1372
2339
|
}
|
|
1373
2340
|
|
|
1374
2341
|
/**
|
|
1375
|
-
* @function
|
|
2342
|
+
* @function getIbnIntent
|
|
1376
2343
|
* @pronghornType method
|
|
1377
|
-
* @name
|
|
1378
|
-
* @summary
|
|
2344
|
+
* @name getIbnIntent
|
|
2345
|
+
* @summary GET ibn intent
|
|
1379
2346
|
*
|
|
1380
|
-
* @param {string} intent - the intent
|
|
2347
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
1381
2348
|
* @param {getCallback} callback - a callback function to return the result
|
|
1382
2349
|
* @return {object} results - An object containing the response of the action
|
|
1383
2350
|
*
|
|
1384
|
-
* @route {POST} /
|
|
2351
|
+
* @route {POST} /getIbnIntent
|
|
1385
2352
|
* @roles admin
|
|
1386
2353
|
* @task true
|
|
1387
2354
|
*/
|
|
1388
2355
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1389
|
-
|
|
1390
|
-
const meth = 'adapter-
|
|
2356
|
+
getIbnIntent(intent, callback) {
|
|
2357
|
+
const meth = 'adapter-getIbnIntent';
|
|
1391
2358
|
const origin = `${this.id}-${meth}`;
|
|
1392
2359
|
log.trace(origin);
|
|
1393
2360
|
|
|
@@ -1403,11 +2370,15 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1403
2370
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1404
2371
|
return callback(null, errorObj);
|
|
1405
2372
|
}
|
|
2373
|
+
let newIntent = intent;
|
|
2374
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2375
|
+
newIntent = `intent=${intent}`;
|
|
2376
|
+
}
|
|
1406
2377
|
|
|
1407
2378
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1408
2379
|
const queryParamsAvailable = {};
|
|
1409
2380
|
const queryParams = {};
|
|
1410
|
-
const pathVars = [
|
|
2381
|
+
const pathVars = [newIntent];
|
|
1411
2382
|
const bodyVars = {};
|
|
1412
2383
|
|
|
1413
2384
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -1429,7 +2400,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1429
2400
|
try {
|
|
1430
2401
|
// Make the call -
|
|
1431
2402
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1432
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2403
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'getIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
|
|
1433
2404
|
// if we received an error or their is no response on the results
|
|
1434
2405
|
// return an error
|
|
1435
2406
|
if (irReturnError) {
|
|
@@ -1437,7 +2408,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1437
2408
|
return callback(null, irReturnError);
|
|
1438
2409
|
}
|
|
1439
2410
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1440
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2411
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getIbnIntent'], null, null, null);
|
|
1441
2412
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1442
2413
|
return callback(null, errorObj);
|
|
1443
2414
|
}
|
|
@@ -1454,22 +2425,23 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1454
2425
|
}
|
|
1455
2426
|
|
|
1456
2427
|
/**
|
|
1457
|
-
* @function
|
|
2428
|
+
* @function modifyIbnIntent
|
|
1458
2429
|
* @pronghornType method
|
|
1459
|
-
* @name
|
|
1460
|
-
* @summary
|
|
2430
|
+
* @name modifyIbnIntent
|
|
2431
|
+
* @summary Modify ibn intent
|
|
1461
2432
|
*
|
|
1462
|
-
* @param {string} intent - the intent
|
|
2433
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
2434
|
+
* @param {object} body - body param
|
|
1463
2435
|
* @param {getCallback} callback - a callback function to return the result
|
|
1464
2436
|
* @return {object} results - An object containing the response of the action
|
|
1465
2437
|
*
|
|
1466
|
-
* @route {POST} /
|
|
2438
|
+
* @route {POST} /modifyIbnIntent
|
|
1467
2439
|
* @roles admin
|
|
1468
2440
|
* @task true
|
|
1469
2441
|
*/
|
|
1470
2442
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1471
|
-
|
|
1472
|
-
const meth = 'adapter-
|
|
2443
|
+
modifyIbnIntent(intent, body, callback) {
|
|
2444
|
+
const meth = 'adapter-modifyIbnIntent';
|
|
1473
2445
|
const origin = `${this.id}-${meth}`;
|
|
1474
2446
|
log.trace(origin);
|
|
1475
2447
|
|
|
@@ -1485,12 +2457,21 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1485
2457
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1486
2458
|
return callback(null, errorObj);
|
|
1487
2459
|
}
|
|
2460
|
+
if (body === undefined || body === null || body === '') {
|
|
2461
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
2462
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2463
|
+
return callback(null, errorObj);
|
|
2464
|
+
}
|
|
2465
|
+
let newIntent = intent;
|
|
2466
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2467
|
+
newIntent = `intent=${intent}`;
|
|
2468
|
+
}
|
|
1488
2469
|
|
|
1489
2470
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1490
2471
|
const queryParamsAvailable = {};
|
|
1491
2472
|
const queryParams = {};
|
|
1492
|
-
const pathVars = [
|
|
1493
|
-
const bodyVars =
|
|
2473
|
+
const pathVars = [newIntent];
|
|
2474
|
+
const bodyVars = body;
|
|
1494
2475
|
|
|
1495
2476
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1496
2477
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -1511,7 +2492,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1511
2492
|
try {
|
|
1512
2493
|
// Make the call -
|
|
1513
2494
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1514
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2495
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'modifyIbnIntent', reqObj, false, (irReturnData, irReturnError) => {
|
|
1515
2496
|
// if we received an error or their is no response on the results
|
|
1516
2497
|
// return an error
|
|
1517
2498
|
if (irReturnError) {
|
|
@@ -1519,7 +2500,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1519
2500
|
return callback(null, irReturnError);
|
|
1520
2501
|
}
|
|
1521
2502
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1522
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2503
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['modifyIbnIntent'], null, null, null);
|
|
1523
2504
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1524
2505
|
return callback(null, errorObj);
|
|
1525
2506
|
}
|
|
@@ -1536,23 +2517,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1536
2517
|
}
|
|
1537
2518
|
|
|
1538
2519
|
/**
|
|
1539
|
-
* @function
|
|
2520
|
+
* @function deleteIbnIntent
|
|
1540
2521
|
* @pronghornType method
|
|
1541
|
-
* @name
|
|
1542
|
-
* @summary
|
|
2522
|
+
* @name deleteIbnIntent
|
|
2523
|
+
* @summary Delete ibn intent
|
|
1543
2524
|
*
|
|
1544
|
-
* @param {string} intent - the intent
|
|
1545
|
-
* @param {object} body - body param
|
|
2525
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
1546
2526
|
* @param {getCallback} callback - a callback function to return the result
|
|
1547
2527
|
* @return {object} results - An object containing the response of the action
|
|
1548
2528
|
*
|
|
1549
|
-
* @route {POST} /
|
|
2529
|
+
* @route {POST} /deleteIbnIntent
|
|
1550
2530
|
* @roles admin
|
|
1551
2531
|
* @task true
|
|
1552
2532
|
*/
|
|
1553
2533
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1554
|
-
|
|
1555
|
-
const meth = 'adapter-
|
|
2534
|
+
deleteIbnIntent(intent, callback) {
|
|
2535
|
+
const meth = 'adapter-deleteIbnIntent';
|
|
1556
2536
|
const origin = `${this.id}-${meth}`;
|
|
1557
2537
|
log.trace(origin);
|
|
1558
2538
|
|
|
@@ -1568,17 +2548,16 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1568
2548
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1569
2549
|
return callback(null, errorObj);
|
|
1570
2550
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
return callback(null, errorObj);
|
|
2551
|
+
let newIntent = intent;
|
|
2552
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2553
|
+
newIntent = `intent=${intent}`;
|
|
1575
2554
|
}
|
|
1576
2555
|
|
|
1577
2556
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1578
2557
|
const queryParamsAvailable = {};
|
|
1579
2558
|
const queryParams = {};
|
|
1580
|
-
const pathVars = [
|
|
1581
|
-
const bodyVars =
|
|
2559
|
+
const pathVars = [newIntent];
|
|
2560
|
+
const bodyVars = {};
|
|
1582
2561
|
|
|
1583
2562
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1584
2563
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -1599,7 +2578,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1599
2578
|
try {
|
|
1600
2579
|
// Make the call -
|
|
1601
2580
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1602
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2581
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'deleteIbnIntent', reqObj, false, (irReturnData, irReturnError) => {
|
|
1603
2582
|
// if we received an error or their is no response on the results
|
|
1604
2583
|
// return an error
|
|
1605
2584
|
if (irReturnError) {
|
|
@@ -1607,7 +2586,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1607
2586
|
return callback(null, irReturnError);
|
|
1608
2587
|
}
|
|
1609
2588
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1610
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2589
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteIbnIntent'], null, null, null);
|
|
1611
2590
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1612
2591
|
return callback(null, errorObj);
|
|
1613
2592
|
}
|
|
@@ -1624,22 +2603,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1624
2603
|
}
|
|
1625
2604
|
|
|
1626
2605
|
/**
|
|
1627
|
-
* @function
|
|
2606
|
+
* @function synchronizeIbnIntent
|
|
1628
2607
|
* @pronghornType method
|
|
1629
|
-
* @name
|
|
1630
|
-
* @summary
|
|
2608
|
+
* @name synchronizeIbnIntent
|
|
2609
|
+
* @summary Synchronize ibn intent
|
|
1631
2610
|
*
|
|
1632
|
-
* @param {string} intent - the intent
|
|
2611
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
1633
2612
|
* @param {getCallback} callback - a callback function to return the result
|
|
1634
2613
|
* @return {object} results - An object containing the response of the action
|
|
1635
2614
|
*
|
|
1636
|
-
* @route {POST} /
|
|
2615
|
+
* @route {POST} /synchronizeIbnIntent
|
|
1637
2616
|
* @roles admin
|
|
1638
2617
|
* @task true
|
|
1639
2618
|
*/
|
|
1640
2619
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1641
|
-
|
|
1642
|
-
const meth = 'adapter-
|
|
2620
|
+
synchronizeIbnIntent(intent, callback) {
|
|
2621
|
+
const meth = 'adapter-synchronizeIbnIntent';
|
|
1643
2622
|
const origin = `${this.id}-${meth}`;
|
|
1644
2623
|
log.trace(origin);
|
|
1645
2624
|
|
|
@@ -1655,11 +2634,15 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1655
2634
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1656
2635
|
return callback(null, errorObj);
|
|
1657
2636
|
}
|
|
2637
|
+
let newIntent = intent;
|
|
2638
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2639
|
+
newIntent = `intent=${intent}`;
|
|
2640
|
+
}
|
|
1658
2641
|
|
|
1659
2642
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1660
2643
|
const queryParamsAvailable = {};
|
|
1661
2644
|
const queryParams = {};
|
|
1662
|
-
const pathVars = [
|
|
2645
|
+
const pathVars = [newIntent];
|
|
1663
2646
|
const bodyVars = {};
|
|
1664
2647
|
|
|
1665
2648
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -1681,7 +2664,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1681
2664
|
try {
|
|
1682
2665
|
// Make the call -
|
|
1683
2666
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1684
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2667
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'synchronizeIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
|
|
1685
2668
|
// if we received an error or their is no response on the results
|
|
1686
2669
|
// return an error
|
|
1687
2670
|
if (irReturnError) {
|
|
@@ -1689,7 +2672,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1689
2672
|
return callback(null, irReturnError);
|
|
1690
2673
|
}
|
|
1691
2674
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1692
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2675
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizeIbnIntent'], null, null, null);
|
|
1693
2676
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1694
2677
|
return callback(null, errorObj);
|
|
1695
2678
|
}
|
|
@@ -1706,22 +2689,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1706
2689
|
}
|
|
1707
2690
|
|
|
1708
2691
|
/**
|
|
1709
|
-
* @function
|
|
2692
|
+
* @function auditIbnIntent
|
|
1710
2693
|
* @pronghornType method
|
|
1711
|
-
* @name
|
|
1712
|
-
* @summary Audit
|
|
2694
|
+
* @name auditIbnIntent
|
|
2695
|
+
* @summary Audit ibn intent
|
|
1713
2696
|
*
|
|
1714
|
-
* @param {string} intent - the intent
|
|
2697
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
1715
2698
|
* @param {getCallback} callback - a callback function to return the result
|
|
1716
2699
|
* @return {object} results - An object containing the response of the action
|
|
1717
2700
|
*
|
|
1718
|
-
* @route {POST} /
|
|
2701
|
+
* @route {POST} /auditIbnIntent
|
|
1719
2702
|
* @roles admin
|
|
1720
2703
|
* @task true
|
|
1721
2704
|
*/
|
|
1722
2705
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1723
|
-
|
|
1724
|
-
const meth = 'adapter-
|
|
2706
|
+
auditIbnIntent(intent, callback) {
|
|
2707
|
+
const meth = 'adapter-auditIbnIntent';
|
|
1725
2708
|
const origin = `${this.id}-${meth}`;
|
|
1726
2709
|
log.trace(origin);
|
|
1727
2710
|
|
|
@@ -1737,11 +2720,15 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1737
2720
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1738
2721
|
return callback(null, errorObj);
|
|
1739
2722
|
}
|
|
2723
|
+
let newIntent = intent;
|
|
2724
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2725
|
+
newIntent = `intent=${intent}`;
|
|
2726
|
+
}
|
|
1740
2727
|
|
|
1741
2728
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1742
2729
|
const queryParamsAvailable = {};
|
|
1743
2730
|
const queryParams = {};
|
|
1744
|
-
const pathVars = [
|
|
2731
|
+
const pathVars = [newIntent];
|
|
1745
2732
|
const bodyVars = {};
|
|
1746
2733
|
|
|
1747
2734
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -1763,7 +2750,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1763
2750
|
try {
|
|
1764
2751
|
// Make the call -
|
|
1765
2752
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1766
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2753
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'auditIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
|
|
1767
2754
|
// if we received an error or their is no response on the results
|
|
1768
2755
|
// return an error
|
|
1769
2756
|
if (irReturnError) {
|
|
@@ -1771,7 +2758,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1771
2758
|
return callback(null, irReturnError);
|
|
1772
2759
|
}
|
|
1773
2760
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1774
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2761
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditIbnIntent'], null, null, null);
|
|
1775
2762
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1776
2763
|
return callback(null, errorObj);
|
|
1777
2764
|
}
|