@itentialopensource/adapter-f5_bigiq 0.3.3 → 0.3.5

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/CHANGELOG.md CHANGED
@@ -1,4 +1,20 @@
1
1
 
2
+ ## 0.3.5 [09-28-2023]
3
+
4
+ * Adds device upgrade methods for updating and retrieving device upgrades.
5
+
6
+ See merge request itentialopensource/adapters/controller-orchestrator/adapter-f5_bigiq!8
7
+
8
+ ---
9
+
10
+ ## 0.3.4 [09-26-2023]
11
+
12
+ * Add device upgrade calls
13
+
14
+ See merge request itentialopensource/adapters/controller-orchestrator/adapter-f5_bigiq!7
15
+
16
+ ---
17
+
2
18
  ## 0.3.3 [07-25-2023]
3
19
 
4
20
  * Add default value to schema files
package/adapter.js CHANGED
@@ -28504,6 +28504,656 @@ class F5BigIQ extends AdapterBaseCl {
28504
28504
  return callback(null, errorObj);
28505
28505
  }
28506
28506
  }
28507
+
28508
+ /**
28509
+ * @function rebootDevice
28510
+ * @pronghornType method
28511
+ * @name rebootDevice
28512
+ * @summary Reboot Device
28513
+ *
28514
+ * @param {object} body - body param
28515
+ * @param {getCallback} callback - a callback function to return the result
28516
+ * @return {object} results - An object containing the response of the action
28517
+ *
28518
+ * @route {POST} /rebootDevice
28519
+ * @roles admin
28520
+ * @task true
28521
+ */
28522
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
28523
+ rebootDevice(body, callback) {
28524
+ const meth = 'adapter-rebootDevice';
28525
+ const origin = `${this.id}-${meth}`;
28526
+ log.trace(origin);
28527
+
28528
+ if (this.suspended && this.suspendMode === 'error') {
28529
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
28530
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28531
+ return callback(null, errorObj);
28532
+ }
28533
+
28534
+ /* HERE IS WHERE YOU VALIDATE DATA */
28535
+ if (body === undefined || body === null || body === '') {
28536
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
28537
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28538
+ return callback(null, errorObj);
28539
+ }
28540
+
28541
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
28542
+ const queryParamsAvailable = {};
28543
+ const queryParams = {};
28544
+ const pathVars = [];
28545
+ const bodyVars = body;
28546
+
28547
+ // loop in template. long callback arg name to avoid identifier conflicts
28548
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
28549
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
28550
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
28551
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
28552
+ }
28553
+ });
28554
+
28555
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
28556
+ // see adapter code documentation for more information on the request object's fields
28557
+ const reqObj = {
28558
+ payload: bodyVars,
28559
+ uriPathVars: pathVars,
28560
+ uriQuery: queryParams
28561
+ };
28562
+
28563
+ try {
28564
+ // Make the call -
28565
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
28566
+ return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'rebootDevice', reqObj, true, (irReturnData, irReturnError) => {
28567
+ // if we received an error or their is no response on the results
28568
+ // return an error
28569
+ if (irReturnError) {
28570
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
28571
+ return callback(null, irReturnError);
28572
+ }
28573
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
28574
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['rebootDevice'], null, null, null);
28575
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28576
+ return callback(null, errorObj);
28577
+ }
28578
+
28579
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
28580
+ // return the response
28581
+ return callback(irReturnData, null);
28582
+ });
28583
+ } catch (ex) {
28584
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
28585
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28586
+ return callback(null, errorObj);
28587
+ }
28588
+ }
28589
+
28590
+ /**
28591
+ * @function removeDeviceServices
28592
+ * @pronghornType method
28593
+ * @name removeDeviceServices
28594
+ * @summary Remove Device Services
28595
+ *
28596
+ * @param {object} body - body param
28597
+ * @param {getCallback} callback - a callback function to return the result
28598
+ * @return {object} results - An object containing the response of the action
28599
+ *
28600
+ * @route {POST} /removeDeviceServices
28601
+ * @roles admin
28602
+ * @task true
28603
+ */
28604
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
28605
+ removeDeviceServices(body, callback) {
28606
+ const meth = 'adapter-removeDeviceServices';
28607
+ const origin = `${this.id}-${meth}`;
28608
+ log.trace(origin);
28609
+
28610
+ if (this.suspended && this.suspendMode === 'error') {
28611
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
28612
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28613
+ return callback(null, errorObj);
28614
+ }
28615
+
28616
+ /* HERE IS WHERE YOU VALIDATE DATA */
28617
+ if (body === undefined || body === null || body === '') {
28618
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
28619
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28620
+ return callback(null, errorObj);
28621
+ }
28622
+
28623
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
28624
+ const queryParamsAvailable = {};
28625
+ const queryParams = {};
28626
+ const pathVars = [];
28627
+ const bodyVars = body;
28628
+
28629
+ // loop in template. long callback arg name to avoid identifier conflicts
28630
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
28631
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
28632
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
28633
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
28634
+ }
28635
+ });
28636
+
28637
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
28638
+ // see adapter code documentation for more information on the request object's fields
28639
+ const reqObj = {
28640
+ payload: bodyVars,
28641
+ uriPathVars: pathVars,
28642
+ uriQuery: queryParams
28643
+ };
28644
+
28645
+ try {
28646
+ // Make the call -
28647
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
28648
+ return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'removeDeviceServices', reqObj, true, (irReturnData, irReturnError) => {
28649
+ // if we received an error or their is no response on the results
28650
+ // return an error
28651
+ if (irReturnError) {
28652
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
28653
+ return callback(null, irReturnError);
28654
+ }
28655
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
28656
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['removeDeviceServices'], null, null, null);
28657
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28658
+ return callback(null, errorObj);
28659
+ }
28660
+
28661
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
28662
+ // return the response
28663
+ return callback(irReturnData, null);
28664
+ });
28665
+ } catch (ex) {
28666
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
28667
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28668
+ return callback(null, errorObj);
28669
+ }
28670
+ }
28671
+
28672
+ /**
28673
+ * @function getRemoveDeviceServicesStatusById
28674
+ * @pronghornType method
28675
+ * @name getRemoveDeviceServicesStatusById
28676
+ * @summary Get Remove Device Services Status by Id
28677
+ *
28678
+ * @param {string} id - id param
28679
+ * @param {getCallback} callback - a callback function to return the result
28680
+ * @return {object} results - An object containing the response of the action
28681
+ *
28682
+ * @route {POST} /getRemoveDeviceServicesStatusById
28683
+ * @roles admin
28684
+ * @task true
28685
+ */
28686
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
28687
+ getRemoveDeviceServicesStatusById(id, callback) {
28688
+ const meth = 'adapter-getRemoveDeviceServicesStatusById';
28689
+ const origin = `${this.id}-${meth}`;
28690
+ log.trace(origin);
28691
+
28692
+ if (this.suspended && this.suspendMode === 'error') {
28693
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
28694
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28695
+ return callback(null, errorObj);
28696
+ }
28697
+
28698
+ /* HERE IS WHERE YOU VALIDATE DATA */
28699
+ if (id === undefined || id === null || id === '') {
28700
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
28701
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28702
+ return callback(null, errorObj);
28703
+ }
28704
+
28705
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
28706
+ const queryParamsAvailable = {};
28707
+ const queryParams = {};
28708
+ const pathVars = [id];
28709
+ const bodyVars = {};
28710
+
28711
+ // loop in template. long callback arg name to avoid identifier conflicts
28712
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
28713
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
28714
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
28715
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
28716
+ }
28717
+ });
28718
+
28719
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
28720
+ // see adapter code documentation for more information on the request object's fields
28721
+ const reqObj = {
28722
+ payload: bodyVars,
28723
+ uriPathVars: pathVars,
28724
+ uriQuery: queryParams
28725
+ };
28726
+
28727
+ try {
28728
+ // Make the call -
28729
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
28730
+ return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'getRemoveDeviceServicesStatusById', reqObj, true, (irReturnData, irReturnError) => {
28731
+ // if we received an error or their is no response on the results
28732
+ // return an error
28733
+ if (irReturnError) {
28734
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
28735
+ return callback(null, irReturnError);
28736
+ }
28737
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
28738
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRemoveDeviceServicesStatusById'], null, null, null);
28739
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28740
+ return callback(null, errorObj);
28741
+ }
28742
+
28743
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
28744
+ // return the response
28745
+ return callback(irReturnData, null);
28746
+ });
28747
+ } catch (ex) {
28748
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
28749
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28750
+ return callback(null, errorObj);
28751
+ }
28752
+ }
28753
+
28754
+ /**
28755
+ * @function removeDeviceTrust
28756
+ * @pronghornType method
28757
+ * @name removeDeviceTrust
28758
+ * @summary Remove Device Trust
28759
+ *
28760
+ * @param {object} body - body param
28761
+ * @param {getCallback} callback - a callback function to return the result
28762
+ * @return {object} results - An object containing the response of the action
28763
+ *
28764
+ * @route {POST} /removeDeviceTrust
28765
+ * @roles admin
28766
+ * @task true
28767
+ */
28768
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
28769
+ removeDeviceTrust(body, callback) {
28770
+ const meth = 'adapter-removeDeviceTrust';
28771
+ const origin = `${this.id}-${meth}`;
28772
+ log.trace(origin);
28773
+
28774
+ if (this.suspended && this.suspendMode === 'error') {
28775
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
28776
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28777
+ return callback(null, errorObj);
28778
+ }
28779
+
28780
+ /* HERE IS WHERE YOU VALIDATE DATA */
28781
+ if (body === undefined || body === null || body === '') {
28782
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
28783
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28784
+ return callback(null, errorObj);
28785
+ }
28786
+
28787
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
28788
+ const queryParamsAvailable = {};
28789
+ const queryParams = {};
28790
+ const pathVars = [];
28791
+ const bodyVars = body;
28792
+
28793
+ // loop in template. long callback arg name to avoid identifier conflicts
28794
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
28795
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
28796
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
28797
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
28798
+ }
28799
+ });
28800
+
28801
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
28802
+ // see adapter code documentation for more information on the request object's fields
28803
+ const reqObj = {
28804
+ payload: bodyVars,
28805
+ uriPathVars: pathVars,
28806
+ uriQuery: queryParams
28807
+ };
28808
+
28809
+ try {
28810
+ // Make the call -
28811
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
28812
+ return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'removeDeviceTrust', reqObj, true, (irReturnData, irReturnError) => {
28813
+ // if we received an error or their is no response on the results
28814
+ // return an error
28815
+ if (irReturnError) {
28816
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
28817
+ return callback(null, irReturnError);
28818
+ }
28819
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
28820
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['removeDeviceTrust'], null, null, null);
28821
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28822
+ return callback(null, errorObj);
28823
+ }
28824
+
28825
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
28826
+ // return the response
28827
+ return callback(irReturnData, null);
28828
+ });
28829
+ } catch (ex) {
28830
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
28831
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28832
+ return callback(null, errorObj);
28833
+ }
28834
+ }
28835
+
28836
+ /**
28837
+ * @function getRemoveDeviceTrustStatusById
28838
+ * @pronghornType method
28839
+ * @name getRemoveDeviceTrustStatusById
28840
+ * @summary Get Remove Device Trust Status By Id
28841
+ *
28842
+ * @param {string} id - id param
28843
+ * @param {getCallback} callback - a callback function to return the result
28844
+ * @return {object} results - An object containing the response of the action
28845
+ *
28846
+ * @route {POST} /getRemoveDeviceTrustStatusById
28847
+ * @roles admin
28848
+ * @task true
28849
+ */
28850
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
28851
+ getRemoveDeviceTrustStatusById(id, callback) {
28852
+ const meth = 'adapter-getRemoveDeviceTrustStatusById';
28853
+ const origin = `${this.id}-${meth}`;
28854
+ log.trace(origin);
28855
+
28856
+ if (this.suspended && this.suspendMode === 'error') {
28857
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
28858
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28859
+ return callback(null, errorObj);
28860
+ }
28861
+
28862
+ /* HERE IS WHERE YOU VALIDATE DATA */
28863
+ if (id === undefined || id === null || id === '') {
28864
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
28865
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28866
+ return callback(null, errorObj);
28867
+ }
28868
+
28869
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
28870
+ const queryParamsAvailable = {};
28871
+ const queryParams = {};
28872
+ const pathVars = [id];
28873
+ const bodyVars = {};
28874
+
28875
+ // loop in template. long callback arg name to avoid identifier conflicts
28876
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
28877
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
28878
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
28879
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
28880
+ }
28881
+ });
28882
+
28883
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
28884
+ // see adapter code documentation for more information on the request object's fields
28885
+ const reqObj = {
28886
+ payload: bodyVars,
28887
+ uriPathVars: pathVars,
28888
+ uriQuery: queryParams
28889
+ };
28890
+
28891
+ try {
28892
+ // Make the call -
28893
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
28894
+ return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'getRemoveDeviceTrustStatusById', reqObj, true, (irReturnData, irReturnError) => {
28895
+ // if we received an error or their is no response on the results
28896
+ // return an error
28897
+ if (irReturnError) {
28898
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
28899
+ return callback(null, irReturnError);
28900
+ }
28901
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
28902
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRemoveDeviceTrustStatusById'], null, null, null);
28903
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28904
+ return callback(null, errorObj);
28905
+ }
28906
+
28907
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
28908
+ // return the response
28909
+ return callback(irReturnData, null);
28910
+ });
28911
+ } catch (ex) {
28912
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
28913
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28914
+ return callback(null, errorObj);
28915
+ }
28916
+ }
28917
+
28918
+ /**
28919
+ * @function updateDeviceUpgrade
28920
+ * @pronghornType method
28921
+ * @name updateDeviceUpgrade
28922
+ * @summary Update Device Upgrade
28923
+ *
28924
+ * @param {object} body - body param
28925
+ * @param {getCallback} callback - a callback function to return the result
28926
+ * @return {object} results - An object containing the response of the action
28927
+ *
28928
+ * @route {POST} /updateDeviceUpgrade
28929
+ * @roles admin
28930
+ * @task true
28931
+ */
28932
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
28933
+ updateDeviceUpgrade(body, callback) {
28934
+ const meth = 'adapter-updateDeviceUpgrade';
28935
+ const origin = `${this.id}-${meth}`;
28936
+ log.trace(origin);
28937
+
28938
+ if (this.suspended && this.suspendMode === 'error') {
28939
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
28940
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28941
+ return callback(null, errorObj);
28942
+ }
28943
+
28944
+ /* HERE IS WHERE YOU VALIDATE DATA */
28945
+ if (body === undefined || body === null || body === '') {
28946
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
28947
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28948
+ return callback(null, errorObj);
28949
+ }
28950
+
28951
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
28952
+ const queryParamsAvailable = {};
28953
+ const queryParams = {};
28954
+ const pathVars = [];
28955
+ const bodyVars = body;
28956
+
28957
+ // loop in template. long callback arg name to avoid identifier conflicts
28958
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
28959
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
28960
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
28961
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
28962
+ }
28963
+ });
28964
+
28965
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
28966
+ // see adapter code documentation for more information on the request object's fields
28967
+ const reqObj = {
28968
+ payload: bodyVars,
28969
+ uriPathVars: pathVars,
28970
+ uriQuery: queryParams
28971
+ };
28972
+
28973
+ try {
28974
+ // Make the call -
28975
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
28976
+ return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'updateDeviceUpgrade', reqObj, true, (irReturnData, irReturnError) => {
28977
+ // if we received an error or their is no response on the results
28978
+ // return an error
28979
+ if (irReturnError) {
28980
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
28981
+ return callback(null, irReturnError);
28982
+ }
28983
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
28984
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateDeviceUpgrade'], null, null, null);
28985
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28986
+ return callback(null, errorObj);
28987
+ }
28988
+
28989
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
28990
+ // return the response
28991
+ return callback(irReturnData, null);
28992
+ });
28993
+ } catch (ex) {
28994
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
28995
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
28996
+ return callback(null, errorObj);
28997
+ }
28998
+ }
28999
+
29000
+ /**
29001
+ * @function getAllUpgradeInstances
29002
+ * @pronghornType method
29003
+ * @name getAllUpgradeInstances
29004
+ * @summary Get All Upgrade Instances
29005
+ *
29006
+ * @param {getCallback} callback - a callback function to return the result
29007
+ * @return {object} results - An object containing the response of the action
29008
+ *
29009
+ * @route {GET} /getAllUpgradeInstances
29010
+ * @roles admin
29011
+ * @task true
29012
+ */
29013
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29014
+ getAllUpgradeInstances(callback) {
29015
+ const meth = 'adapter-getAllUpgradeInstances';
29016
+ const origin = `${this.id}-${meth}`;
29017
+ log.trace(origin);
29018
+
29019
+ if (this.suspended && this.suspendMode === 'error') {
29020
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29021
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29022
+ return callback(null, errorObj);
29023
+ }
29024
+
29025
+ /* HERE IS WHERE YOU VALIDATE DATA */
29026
+
29027
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29028
+ const queryParamsAvailable = {};
29029
+ const queryParams = {};
29030
+ const pathVars = [];
29031
+ const bodyVars = {};
29032
+
29033
+ // loop in template. long callback arg name to avoid identifier conflicts
29034
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29035
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
29036
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
29037
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
29038
+ }
29039
+ });
29040
+
29041
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
29042
+ // see adapter code documentation for more information on the request object's fields
29043
+ const reqObj = {
29044
+ payload: bodyVars,
29045
+ uriPathVars: pathVars,
29046
+ uriQuery: queryParams
29047
+ };
29048
+
29049
+ try {
29050
+ // Make the call -
29051
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
29052
+ return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'getAllUpgradeInstances', reqObj, true, (irReturnData, irReturnError) => {
29053
+ // if we received an error or their is no response on the results
29054
+ // return an error
29055
+ if (irReturnError) {
29056
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
29057
+ return callback(null, irReturnError);
29058
+ }
29059
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
29060
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllUpgradeInstances'], null, null, null);
29061
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29062
+ return callback(null, errorObj);
29063
+ }
29064
+
29065
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
29066
+ // return the response
29067
+ return callback(irReturnData, null);
29068
+ });
29069
+ } catch (ex) {
29070
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
29071
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29072
+ return callback(null, errorObj);
29073
+ }
29074
+ }
29075
+
29076
+ /**
29077
+ * @function getUpgradeInstancesById
29078
+ * @pronghornType method
29079
+ * @name getUpgradeInstancesById
29080
+ * @summary Get Upgrade Instance By Id
29081
+ *
29082
+ * @param {string} upgradeTaskId - upgradeTaskId param
29083
+ * @param {getCallback} callback - a callback function to return the result
29084
+ * @return {object} results - An object containing the response of the action
29085
+ *
29086
+ * @route {POST} /getUpgradeInstancesById
29087
+ * @roles admin
29088
+ * @task true
29089
+ */
29090
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29091
+ getUpgradeInstancesById(upgradeTaskId, callback) {
29092
+ const meth = 'adapter-getUpgradeInstancesById';
29093
+ const origin = `${this.id}-${meth}`;
29094
+ log.trace(origin);
29095
+
29096
+ if (this.suspended && this.suspendMode === 'error') {
29097
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29098
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29099
+ return callback(null, errorObj);
29100
+ }
29101
+
29102
+ /* HERE IS WHERE YOU VALIDATE DATA */
29103
+ if (upgradeTaskId === undefined || upgradeTaskId === null || upgradeTaskId === '') {
29104
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['upgradeTaskId'], null, null, null);
29105
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29106
+ return callback(null, errorObj);
29107
+ }
29108
+
29109
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29110
+ const queryParamsAvailable = {};
29111
+ const queryParams = {};
29112
+ const pathVars = [upgradeTaskId];
29113
+ const bodyVars = {};
29114
+
29115
+ // loop in template. long callback arg name to avoid identifier conflicts
29116
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29117
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
29118
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
29119
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
29120
+ }
29121
+ });
29122
+
29123
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
29124
+ // see adapter code documentation for more information on the request object's fields
29125
+ const reqObj = {
29126
+ payload: bodyVars,
29127
+ uriPathVars: pathVars,
29128
+ uriQuery: queryParams
29129
+ };
29130
+
29131
+ try {
29132
+ // Make the call -
29133
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
29134
+ return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'getUpgradeInstancesById', reqObj, true, (irReturnData, irReturnError) => {
29135
+ // if we received an error or their is no response on the results
29136
+ // return an error
29137
+ if (irReturnError) {
29138
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
29139
+ return callback(null, irReturnError);
29140
+ }
29141
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
29142
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getUpgradeInstancesById'], null, null, null);
29143
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29144
+ return callback(null, errorObj);
29145
+ }
29146
+
29147
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
29148
+ // return the response
29149
+ return callback(irReturnData, null);
29150
+ });
29151
+ } catch (ex) {
29152
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
29153
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29154
+ return callback(null, errorObj);
29155
+ }
29156
+ }
28507
29157
  }
28508
29158
 
28509
29159
  module.exports = F5BigIQ;