@itentialopensource/adapter-rubrik 0.6.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/adapter.js CHANGED
@@ -786,6 +786,1765 @@ class Rubrik extends AdapterBaseCl {
786
786
  return callback(null, errorObj);
787
787
  }
788
788
  }
789
+
790
+ /**
791
+ * @function checkIfClusterLocked
792
+ * @pronghornType method
793
+ * @name checkIfClusterLocked
794
+ * @summary checkIfClusterLocked
795
+ *
796
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
797
+ * @param {getCallback} callback - a callback function to return the result
798
+ * @return {object} results - An object containing the response of the action
799
+ *
800
+ * @route {GET} /checkIfClusterLocked
801
+ * @roles admin
802
+ * @task true
803
+ */
804
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
805
+ checkIfClusterLocked(iapMetadata, callback) {
806
+ const meth = 'adapter-checkIfClusterLocked';
807
+ const origin = `${this.id}-${meth}`;
808
+ log.trace(origin);
809
+
810
+ if (this.suspended && this.suspendMode === 'error') {
811
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
812
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
813
+ return callback(null, errorObj);
814
+ }
815
+
816
+ /* HERE IS WHERE YOU VALIDATE DATA */
817
+
818
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
819
+ const queryParamsAvailable = {};
820
+ const queryParams = {};
821
+ const pathVars = [];
822
+ const bodyVars = {};
823
+
824
+ // loop in template. long callback arg name to avoid identifier conflicts
825
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
826
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
827
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
828
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
829
+ }
830
+ });
831
+
832
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
833
+ // see adapter code documentation for more information on the request object's fields
834
+ let reqObj = {
835
+ payload: bodyVars,
836
+ uriPathVars: pathVars,
837
+ uriQuery: queryParams
838
+ };
839
+
840
+ // Parse and merge iapMetadata fields into reqObj
841
+ if (iapMetadata && typeof iapMetadata === 'object') {
842
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
843
+ }
844
+
845
+ try {
846
+ // Make the call -
847
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
848
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'checkIfClusterLocked', reqObj, true, (irReturnData, irReturnError) => {
849
+ // if we received an error or their is no response on the results
850
+ // return an error
851
+ if (irReturnError) {
852
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
853
+ return callback(null, irReturnError);
854
+ }
855
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
856
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['checkIfClusterLocked'], null, null, null);
857
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
858
+ return callback(null, errorObj);
859
+ }
860
+
861
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
862
+ // return the response
863
+ return callback(irReturnData, null);
864
+ });
865
+ } catch (ex) {
866
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
867
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
868
+ return callback(null, errorObj);
869
+ }
870
+ }
871
+
872
+ /**
873
+ * @function getClusterWorkflowVersion
874
+ * @pronghornType method
875
+ * @name getClusterWorkflowVersion
876
+ * @summary getClusterWorkflowVersion
877
+ *
878
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
879
+ * @param {getCallback} callback - a callback function to return the result
880
+ * @return {object} results - An object containing the response of the action
881
+ *
882
+ * @route {GET} /getClusterWorkflowVersion
883
+ * @roles admin
884
+ * @task true
885
+ */
886
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
887
+ getClusterWorkflowVersion(iapMetadata, callback) {
888
+ const meth = 'adapter-getClusterWorkflowVersion';
889
+ const origin = `${this.id}-${meth}`;
890
+ log.trace(origin);
891
+
892
+ if (this.suspended && this.suspendMode === 'error') {
893
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
894
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
895
+ return callback(null, errorObj);
896
+ }
897
+
898
+ /* HERE IS WHERE YOU VALIDATE DATA */
899
+
900
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
901
+ const queryParamsAvailable = {};
902
+ const queryParams = {};
903
+ const pathVars = [];
904
+ const bodyVars = {};
905
+
906
+ // loop in template. long callback arg name to avoid identifier conflicts
907
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
908
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
909
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
910
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
911
+ }
912
+ });
913
+
914
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
915
+ // see adapter code documentation for more information on the request object's fields
916
+ let reqObj = {
917
+ payload: bodyVars,
918
+ uriPathVars: pathVars,
919
+ uriQuery: queryParams
920
+ };
921
+
922
+ // Parse and merge iapMetadata fields into reqObj
923
+ if (iapMetadata && typeof iapMetadata === 'object') {
924
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
925
+ }
926
+
927
+ try {
928
+ // Make the call -
929
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
930
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'getClusterWorkflowVersion', reqObj, true, (irReturnData, irReturnError) => {
931
+ // if we received an error or their is no response on the results
932
+ // return an error
933
+ if (irReturnError) {
934
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
935
+ return callback(null, irReturnError);
936
+ }
937
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
938
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getClusterWorkflowVersion'], null, null, null);
939
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
940
+ return callback(null, errorObj);
941
+ }
942
+
943
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
944
+ // return the response
945
+ return callback(irReturnData, null);
946
+ });
947
+ } catch (ex) {
948
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
949
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
950
+ return callback(null, errorObj);
951
+ }
952
+ }
953
+
954
+ /**
955
+ * @function configureVmanage
956
+ * @pronghornType method
957
+ * @name configureVmanage
958
+ * @summary configureVmanage
959
+ *
960
+ * @param {object} [body] - vManage server config
961
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
962
+ * @param {getCallback} callback - a callback function to return the result
963
+ * @return {object} results - An object containing the response of the action
964
+ *
965
+ * @route {POST} /configureVmanage
966
+ * @roles admin
967
+ * @task true
968
+ */
969
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
970
+ configureVmanage(body, iapMetadata, callback) {
971
+ const meth = 'adapter-configureVmanage';
972
+ const origin = `${this.id}-${meth}`;
973
+ log.trace(origin);
974
+
975
+ if (this.suspended && this.suspendMode === 'error') {
976
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
977
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
978
+ return callback(null, errorObj);
979
+ }
980
+
981
+ /* HERE IS WHERE YOU VALIDATE DATA */
982
+
983
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
984
+ const queryParamsAvailable = {};
985
+ const queryParams = {};
986
+ const pathVars = [];
987
+ const bodyVars = body;
988
+
989
+ // loop in template. long callback arg name to avoid identifier conflicts
990
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
991
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
992
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
993
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
994
+ }
995
+ });
996
+
997
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
998
+ // see adapter code documentation for more information on the request object's fields
999
+ let reqObj = {
1000
+ payload: bodyVars,
1001
+ uriPathVars: pathVars,
1002
+ uriQuery: queryParams
1003
+ };
1004
+
1005
+ // Parse and merge iapMetadata fields into reqObj
1006
+ if (iapMetadata && typeof iapMetadata === 'object') {
1007
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1008
+ }
1009
+
1010
+ try {
1011
+ // Make the call -
1012
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1013
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'configureVmanage', reqObj, true, (irReturnData, irReturnError) => {
1014
+ // if we received an error or their is no response on the results
1015
+ // return an error
1016
+ if (irReturnError) {
1017
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1018
+ return callback(null, irReturnError);
1019
+ }
1020
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1021
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['configureVmanage'], null, null, null);
1022
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1023
+ return callback(null, errorObj);
1024
+ }
1025
+
1026
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1027
+ // return the response
1028
+ return callback(irReturnData, null);
1029
+ });
1030
+ } catch (ex) {
1031
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1032
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1033
+ return callback(null, errorObj);
1034
+ }
1035
+ }
1036
+
1037
+ /**
1038
+ * @function getConnectedDevices
1039
+ * @pronghornType method
1040
+ * @name getConnectedDevices
1041
+ * @summary getConnectedDevices
1042
+ *
1043
+ * @param {string} vmanageIP - vManage IP
1044
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1045
+ * @param {getCallback} callback - a callback function to return the result
1046
+ * @return {object} results - An object containing the response of the action
1047
+ *
1048
+ * @route {POST} /getConnectedDevices
1049
+ * @roles admin
1050
+ * @task true
1051
+ */
1052
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1053
+ getConnectedDevices(vmanageIP, iapMetadata, callback) {
1054
+ const meth = 'adapter-getConnectedDevices';
1055
+ const origin = `${this.id}-${meth}`;
1056
+ log.trace(origin);
1057
+
1058
+ if (this.suspended && this.suspendMode === 'error') {
1059
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1060
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1061
+ return callback(null, errorObj);
1062
+ }
1063
+
1064
+ /* HERE IS WHERE YOU VALIDATE DATA */
1065
+ if (vmanageIP === undefined || vmanageIP === null || vmanageIP === '') {
1066
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vmanageIP'], null, null, null);
1067
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1068
+ return callback(null, errorObj);
1069
+ }
1070
+
1071
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1072
+ const queryParamsAvailable = {};
1073
+ const queryParams = {};
1074
+ const pathVars = [vmanageIP];
1075
+ const bodyVars = {};
1076
+
1077
+ // loop in template. long callback arg name to avoid identifier conflicts
1078
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1079
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1080
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1081
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1082
+ }
1083
+ });
1084
+
1085
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1086
+ // see adapter code documentation for more information on the request object's fields
1087
+ let reqObj = {
1088
+ payload: bodyVars,
1089
+ uriPathVars: pathVars,
1090
+ uriQuery: queryParams
1091
+ };
1092
+
1093
+ // Parse and merge iapMetadata fields into reqObj
1094
+ if (iapMetadata && typeof iapMetadata === 'object') {
1095
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1096
+ }
1097
+
1098
+ try {
1099
+ // Make the call -
1100
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1101
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'getConnectedDevices', reqObj, true, (irReturnData, irReturnError) => {
1102
+ // if we received an error or their is no response on the results
1103
+ // return an error
1104
+ if (irReturnError) {
1105
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1106
+ return callback(null, irReturnError);
1107
+ }
1108
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1109
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getConnectedDevices'], null, null, null);
1110
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1111
+ return callback(null, errorObj);
1112
+ }
1113
+
1114
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1115
+ // return the response
1116
+ return callback(irReturnData, null);
1117
+ });
1118
+ } catch (ex) {
1119
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1120
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1121
+ return callback(null, errorObj);
1122
+ }
1123
+ }
1124
+
1125
+ /**
1126
+ * @function healthDetails
1127
+ * @pronghornType method
1128
+ * @name healthDetails
1129
+ * @summary healthDetails
1130
+ *
1131
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1132
+ * @param {getCallback} callback - a callback function to return the result
1133
+ * @return {object} results - An object containing the response of the action
1134
+ *
1135
+ * @route {GET} /healthDetails
1136
+ * @roles admin
1137
+ * @task true
1138
+ */
1139
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1140
+ healthDetails(iapMetadata, callback) {
1141
+ const meth = 'adapter-healthDetails';
1142
+ const origin = `${this.id}-${meth}`;
1143
+ log.trace(origin);
1144
+
1145
+ if (this.suspended && this.suspendMode === 'error') {
1146
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1147
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1148
+ return callback(null, errorObj);
1149
+ }
1150
+
1151
+ /* HERE IS WHERE YOU VALIDATE DATA */
1152
+
1153
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1154
+ const queryParamsAvailable = {};
1155
+ const queryParams = {};
1156
+ const pathVars = [];
1157
+ const bodyVars = {};
1158
+
1159
+ // loop in template. long callback arg name to avoid identifier conflicts
1160
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1161
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1162
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1163
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1164
+ }
1165
+ });
1166
+
1167
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1168
+ // see adapter code documentation for more information on the request object's fields
1169
+ let reqObj = {
1170
+ payload: bodyVars,
1171
+ uriPathVars: pathVars,
1172
+ uriQuery: queryParams
1173
+ };
1174
+
1175
+ // Parse and merge iapMetadata fields into reqObj
1176
+ if (iapMetadata && typeof iapMetadata === 'object') {
1177
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1178
+ }
1179
+
1180
+ try {
1181
+ // Make the call -
1182
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1183
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'healthDetails', reqObj, true, (irReturnData, irReturnError) => {
1184
+ // if we received an error or their is no response on the results
1185
+ // return an error
1186
+ if (irReturnError) {
1187
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1188
+ return callback(null, irReturnError);
1189
+ }
1190
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1191
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['healthDetails'], null, null, null);
1192
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1193
+ return callback(null, errorObj);
1194
+ }
1195
+
1196
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1197
+ // return the response
1198
+ return callback(irReturnData, null);
1199
+ });
1200
+ } catch (ex) {
1201
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1202
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1203
+ return callback(null, errorObj);
1204
+ }
1205
+ }
1206
+
1207
+ /**
1208
+ * @function healthStatusInfo
1209
+ * @pronghornType method
1210
+ * @name healthStatusInfo
1211
+ * @summary healthStatusInfo
1212
+ *
1213
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1214
+ * @param {getCallback} callback - a callback function to return the result
1215
+ * @return {object} results - An object containing the response of the action
1216
+ *
1217
+ * @route {GET} /healthStatusInfo
1218
+ * @roles admin
1219
+ * @task true
1220
+ */
1221
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1222
+ healthStatusInfo(iapMetadata, callback) {
1223
+ const meth = 'adapter-healthStatusInfo';
1224
+ const origin = `${this.id}-${meth}`;
1225
+ log.trace(origin);
1226
+
1227
+ if (this.suspended && this.suspendMode === 'error') {
1228
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1229
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1230
+ return callback(null, errorObj);
1231
+ }
1232
+
1233
+ /* HERE IS WHERE YOU VALIDATE DATA */
1234
+
1235
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1236
+ const queryParamsAvailable = {};
1237
+ const queryParams = {};
1238
+ const pathVars = [];
1239
+ const bodyVars = {};
1240
+
1241
+ // loop in template. long callback arg name to avoid identifier conflicts
1242
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1243
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1244
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1245
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1246
+ }
1247
+ });
1248
+
1249
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1250
+ // see adapter code documentation for more information on the request object's fields
1251
+ let reqObj = {
1252
+ payload: bodyVars,
1253
+ uriPathVars: pathVars,
1254
+ uriQuery: queryParams
1255
+ };
1256
+
1257
+ // Parse and merge iapMetadata fields into reqObj
1258
+ if (iapMetadata && typeof iapMetadata === 'object') {
1259
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1260
+ }
1261
+
1262
+ try {
1263
+ // Make the call -
1264
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1265
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'healthStatusInfo', reqObj, true, (irReturnData, irReturnError) => {
1266
+ // if we received an error or their is no response on the results
1267
+ // return an error
1268
+ if (irReturnError) {
1269
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1270
+ return callback(null, irReturnError);
1271
+ }
1272
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1273
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['healthStatusInfo'], null, null, null);
1274
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1275
+ return callback(null, errorObj);
1276
+ }
1277
+
1278
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1279
+ // return the response
1280
+ return callback(irReturnData, null);
1281
+ });
1282
+ } catch (ex) {
1283
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1284
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1285
+ return callback(null, errorObj);
1286
+ }
1287
+ }
1288
+
1289
+ /**
1290
+ * @function healthSummary
1291
+ * @pronghornType method
1292
+ * @name healthSummary
1293
+ * @summary healthSummary
1294
+ *
1295
+ * @param {boolean} [isCached] - Flag to enable cached result
1296
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1297
+ * @param {getCallback} callback - a callback function to return the result
1298
+ * @return {object} results - An object containing the response of the action
1299
+ *
1300
+ * @route {POST} /healthSummary
1301
+ * @roles admin
1302
+ * @task true
1303
+ */
1304
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1305
+ healthSummary(isCached, iapMetadata, callback) {
1306
+ const meth = 'adapter-healthSummary';
1307
+ const origin = `${this.id}-${meth}`;
1308
+ log.trace(origin);
1309
+
1310
+ if (this.suspended && this.suspendMode === 'error') {
1311
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1312
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1313
+ return callback(null, errorObj);
1314
+ }
1315
+
1316
+ /* HERE IS WHERE YOU VALIDATE DATA */
1317
+
1318
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1319
+ const queryParamsAvailable = { isCached };
1320
+ const queryParams = {};
1321
+ const pathVars = [];
1322
+ const bodyVars = {};
1323
+
1324
+ // loop in template. long callback arg name to avoid identifier conflicts
1325
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1326
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1327
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1328
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1329
+ }
1330
+ });
1331
+
1332
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1333
+ // see adapter code documentation for more information on the request object's fields
1334
+ let reqObj = {
1335
+ payload: bodyVars,
1336
+ uriPathVars: pathVars,
1337
+ uriQuery: queryParams
1338
+ };
1339
+
1340
+ // Parse and merge iapMetadata fields into reqObj
1341
+ if (iapMetadata && typeof iapMetadata === 'object') {
1342
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1343
+ }
1344
+
1345
+ try {
1346
+ // Make the call -
1347
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1348
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'healthSummary', reqObj, true, (irReturnData, irReturnError) => {
1349
+ // if we received an error or their is no response on the results
1350
+ // return an error
1351
+ if (irReturnError) {
1352
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1353
+ return callback(null, irReturnError);
1354
+ }
1355
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1356
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['healthSummary'], null, null, null);
1357
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1358
+ return callback(null, errorObj);
1359
+ }
1360
+
1361
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1362
+ // return the response
1363
+ return callback(irReturnData, null);
1364
+ });
1365
+ } catch (ex) {
1366
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1367
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1368
+ return callback(null, errorObj);
1369
+ }
1370
+ }
1371
+
1372
+ /**
1373
+ * @function getConfiguredIPList
1374
+ * @pronghornType method
1375
+ * @name getConfiguredIPList
1376
+ * @summary getConfiguredIPList
1377
+ *
1378
+ * @param {string} vmanageID - vManage Id
1379
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1380
+ * @param {getCallback} callback - a callback function to return the result
1381
+ * @return {object} results - An object containing the response of the action
1382
+ *
1383
+ * @route {POST} /getConfiguredIPList
1384
+ * @roles admin
1385
+ * @task true
1386
+ */
1387
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1388
+ getConfiguredIPList(vmanageID, iapMetadata, callback) {
1389
+ const meth = 'adapter-getConfiguredIPList';
1390
+ const origin = `${this.id}-${meth}`;
1391
+ log.trace(origin);
1392
+
1393
+ if (this.suspended && this.suspendMode === 'error') {
1394
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1395
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1396
+ return callback(null, errorObj);
1397
+ }
1398
+
1399
+ /* HERE IS WHERE YOU VALIDATE DATA */
1400
+ if (vmanageID === undefined || vmanageID === null || vmanageID === '') {
1401
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vmanageID'], null, null, null);
1402
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1403
+ return callback(null, errorObj);
1404
+ }
1405
+
1406
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1407
+ const queryParamsAvailable = {};
1408
+ const queryParams = {};
1409
+ const pathVars = [vmanageID];
1410
+ const bodyVars = {};
1411
+
1412
+ // loop in template. long callback arg name to avoid identifier conflicts
1413
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1414
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1415
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1416
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1417
+ }
1418
+ });
1419
+
1420
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1421
+ // see adapter code documentation for more information on the request object's fields
1422
+ let reqObj = {
1423
+ payload: bodyVars,
1424
+ uriPathVars: pathVars,
1425
+ uriQuery: queryParams
1426
+ };
1427
+
1428
+ // Parse and merge iapMetadata fields into reqObj
1429
+ if (iapMetadata && typeof iapMetadata === 'object') {
1430
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1431
+ }
1432
+
1433
+ try {
1434
+ // Make the call -
1435
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1436
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'getConfiguredIPList', reqObj, true, (irReturnData, irReturnError) => {
1437
+ // if we received an error or their is no response on the results
1438
+ // return an error
1439
+ if (irReturnError) {
1440
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1441
+ return callback(null, irReturnError);
1442
+ }
1443
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1444
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getConfiguredIPList'], null, null, null);
1445
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1446
+ return callback(null, errorObj);
1447
+ }
1448
+
1449
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1450
+ // return the response
1451
+ return callback(irReturnData, null);
1452
+ });
1453
+ } catch (ex) {
1454
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1455
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1456
+ return callback(null, errorObj);
1457
+ }
1458
+ }
1459
+
1460
+ /**
1461
+ * @function isClusterReady
1462
+ * @pronghornType method
1463
+ * @name isClusterReady
1464
+ * @summary isClusterReady
1465
+ *
1466
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1467
+ * @param {getCallback} callback - a callback function to return the result
1468
+ * @return {object} results - An object containing the response of the action
1469
+ *
1470
+ * @route {GET} /isClusterReady
1471
+ * @roles admin
1472
+ * @task true
1473
+ */
1474
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1475
+ isClusterReady(iapMetadata, callback) {
1476
+ const meth = 'adapter-isClusterReady';
1477
+ const origin = `${this.id}-${meth}`;
1478
+ log.trace(origin);
1479
+
1480
+ if (this.suspended && this.suspendMode === 'error') {
1481
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1482
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1483
+ return callback(null, errorObj);
1484
+ }
1485
+
1486
+ /* HERE IS WHERE YOU VALIDATE DATA */
1487
+
1488
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1489
+ const queryParamsAvailable = {};
1490
+ const queryParams = {};
1491
+ const pathVars = [];
1492
+ const bodyVars = {};
1493
+
1494
+ // loop in template. long callback arg name to avoid identifier conflicts
1495
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1496
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1497
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1498
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1499
+ }
1500
+ });
1501
+
1502
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1503
+ // see adapter code documentation for more information on the request object's fields
1504
+ let reqObj = {
1505
+ payload: bodyVars,
1506
+ uriPathVars: pathVars,
1507
+ uriQuery: queryParams
1508
+ };
1509
+
1510
+ // Parse and merge iapMetadata fields into reqObj
1511
+ if (iapMetadata && typeof iapMetadata === 'object') {
1512
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1513
+ }
1514
+
1515
+ try {
1516
+ // Make the call -
1517
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1518
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'isClusterReady', reqObj, true, (irReturnData, irReturnError) => {
1519
+ // if we received an error or their is no response on the results
1520
+ // return an error
1521
+ if (irReturnError) {
1522
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1523
+ return callback(null, irReturnError);
1524
+ }
1525
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1526
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['isClusterReady'], null, null, null);
1527
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1528
+ return callback(null, errorObj);
1529
+ }
1530
+
1531
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1532
+ // return the response
1533
+ return callback(irReturnData, null);
1534
+ });
1535
+ } catch (ex) {
1536
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1537
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1538
+ return callback(null, errorObj);
1539
+ }
1540
+ }
1541
+
1542
+ /**
1543
+ * @function listVmanages
1544
+ * @pronghornType method
1545
+ * @name listVmanages
1546
+ * @summary listVmanages
1547
+ *
1548
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1549
+ * @param {getCallback} callback - a callback function to return the result
1550
+ * @return {object} results - An object containing the response of the action
1551
+ *
1552
+ * @route {GET} /listVmanages
1553
+ * @roles admin
1554
+ * @task true
1555
+ */
1556
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1557
+ listVmanages(iapMetadata, callback) {
1558
+ const meth = 'adapter-listVmanages';
1559
+ const origin = `${this.id}-${meth}`;
1560
+ log.trace(origin);
1561
+
1562
+ if (this.suspended && this.suspendMode === 'error') {
1563
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1564
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1565
+ return callback(null, errorObj);
1566
+ }
1567
+
1568
+ /* HERE IS WHERE YOU VALIDATE DATA */
1569
+
1570
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1571
+ const queryParamsAvailable = {};
1572
+ const queryParams = {};
1573
+ const pathVars = [];
1574
+ const bodyVars = {};
1575
+
1576
+ // loop in template. long callback arg name to avoid identifier conflicts
1577
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1578
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1579
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1580
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1581
+ }
1582
+ });
1583
+
1584
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1585
+ // see adapter code documentation for more information on the request object's fields
1586
+ let reqObj = {
1587
+ payload: bodyVars,
1588
+ uriPathVars: pathVars,
1589
+ uriQuery: queryParams
1590
+ };
1591
+
1592
+ // Parse and merge iapMetadata fields into reqObj
1593
+ if (iapMetadata && typeof iapMetadata === 'object') {
1594
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1595
+ }
1596
+
1597
+ try {
1598
+ // Make the call -
1599
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1600
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'listVmanages', reqObj, true, (irReturnData, irReturnError) => {
1601
+ // if we received an error or their is no response on the results
1602
+ // return an error
1603
+ if (irReturnError) {
1604
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1605
+ return callback(null, irReturnError);
1606
+ }
1607
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1608
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['listVmanages'], null, null, null);
1609
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1610
+ return callback(null, errorObj);
1611
+ }
1612
+
1613
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1614
+ // return the response
1615
+ return callback(irReturnData, null);
1616
+ });
1617
+ } catch (ex) {
1618
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1619
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1620
+ return callback(null, errorObj);
1621
+ }
1622
+ }
1623
+
1624
+ /**
1625
+ * @function nodeProperties
1626
+ * @pronghornType method
1627
+ * @name nodeProperties
1628
+ * @summary nodeProperties
1629
+ *
1630
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1631
+ * @param {getCallback} callback - a callback function to return the result
1632
+ * @return {object} results - An object containing the response of the action
1633
+ *
1634
+ * @route {GET} /nodeProperties
1635
+ * @roles admin
1636
+ * @task true
1637
+ */
1638
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1639
+ nodeProperties(iapMetadata, callback) {
1640
+ const meth = 'adapter-nodeProperties';
1641
+ const origin = `${this.id}-${meth}`;
1642
+ log.trace(origin);
1643
+
1644
+ if (this.suspended && this.suspendMode === 'error') {
1645
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1646
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1647
+ return callback(null, errorObj);
1648
+ }
1649
+
1650
+ /* HERE IS WHERE YOU VALIDATE DATA */
1651
+
1652
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1653
+ const queryParamsAvailable = {};
1654
+ const queryParams = {};
1655
+ const pathVars = [];
1656
+ const bodyVars = {};
1657
+
1658
+ // loop in template. long callback arg name to avoid identifier conflicts
1659
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1660
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1661
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1662
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1663
+ }
1664
+ });
1665
+
1666
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1667
+ // see adapter code documentation for more information on the request object's fields
1668
+ let reqObj = {
1669
+ payload: bodyVars,
1670
+ uriPathVars: pathVars,
1671
+ uriQuery: queryParams
1672
+ };
1673
+
1674
+ // Parse and merge iapMetadata fields into reqObj
1675
+ if (iapMetadata && typeof iapMetadata === 'object') {
1676
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1677
+ }
1678
+
1679
+ try {
1680
+ // Make the call -
1681
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1682
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'nodeProperties', reqObj, true, (irReturnData, irReturnError) => {
1683
+ // if we received an error or their is no response on the results
1684
+ // return an error
1685
+ if (irReturnError) {
1686
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1687
+ return callback(null, irReturnError);
1688
+ }
1689
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1690
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['nodeProperties'], null, null, null);
1691
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1692
+ return callback(null, errorObj);
1693
+ }
1694
+
1695
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1696
+ // return the response
1697
+ return callback(irReturnData, null);
1698
+ });
1699
+ } catch (ex) {
1700
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1701
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1702
+ return callback(null, errorObj);
1703
+ }
1704
+ }
1705
+
1706
+ /**
1707
+ * @function removeVmanage
1708
+ * @pronghornType method
1709
+ * @name removeVmanage
1710
+ * @summary removeVmanage
1711
+ *
1712
+ * @param {object} [body] - vManage server info
1713
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1714
+ * @param {getCallback} callback - a callback function to return the result
1715
+ * @return {object} results - An object containing the response of the action
1716
+ *
1717
+ * @route {POST} /removeVmanage
1718
+ * @roles admin
1719
+ * @task true
1720
+ */
1721
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1722
+ removeVmanage(body, iapMetadata, callback) {
1723
+ const meth = 'adapter-removeVmanage';
1724
+ const origin = `${this.id}-${meth}`;
1725
+ log.trace(origin);
1726
+
1727
+ if (this.suspended && this.suspendMode === 'error') {
1728
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1729
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1730
+ return callback(null, errorObj);
1731
+ }
1732
+
1733
+ /* HERE IS WHERE YOU VALIDATE DATA */
1734
+
1735
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1736
+ const queryParamsAvailable = {};
1737
+ const queryParams = {};
1738
+ const pathVars = [];
1739
+ const bodyVars = body;
1740
+
1741
+ // loop in template. long callback arg name to avoid identifier conflicts
1742
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1743
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1744
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1745
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1746
+ }
1747
+ });
1748
+
1749
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1750
+ // see adapter code documentation for more information on the request object's fields
1751
+ let reqObj = {
1752
+ payload: bodyVars,
1753
+ uriPathVars: pathVars,
1754
+ uriQuery: queryParams
1755
+ };
1756
+
1757
+ // Parse and merge iapMetadata fields into reqObj
1758
+ if (iapMetadata && typeof iapMetadata === 'object') {
1759
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1760
+ }
1761
+
1762
+ try {
1763
+ // Make the call -
1764
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1765
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'removeVmanage', reqObj, true, (irReturnData, irReturnError) => {
1766
+ // if we received an error or their is no response on the results
1767
+ // return an error
1768
+ if (irReturnError) {
1769
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1770
+ return callback(null, irReturnError);
1771
+ }
1772
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1773
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['removeVmanage'], null, null, null);
1774
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1775
+ return callback(null, errorObj);
1776
+ }
1777
+
1778
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1779
+ // return the response
1780
+ return callback(irReturnData, null);
1781
+ });
1782
+ } catch (ex) {
1783
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1784
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1785
+ return callback(null, errorObj);
1786
+ }
1787
+ }
1788
+
1789
+ /**
1790
+ * @function performReplicationAndRebalanceOfKafkaPartitions
1791
+ * @pronghornType method
1792
+ * @name performReplicationAndRebalanceOfKafkaPartitions
1793
+ * @summary performReplicationAndRebalanceOfKafkaPartitions
1794
+ *
1795
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1796
+ * @param {getCallback} callback - a callback function to return the result
1797
+ * @return {object} results - An object containing the response of the action
1798
+ *
1799
+ * @route {GET} /performReplicationAndRebalanceOfKafkaPartitions
1800
+ * @roles admin
1801
+ * @task true
1802
+ */
1803
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1804
+ performReplicationAndRebalanceOfKafkaPartitions(iapMetadata, callback) {
1805
+ const meth = 'adapter-performReplicationAndRebalanceOfKafkaPartitions';
1806
+ const origin = `${this.id}-${meth}`;
1807
+ log.trace(origin);
1808
+
1809
+ if (this.suspended && this.suspendMode === 'error') {
1810
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1811
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1812
+ return callback(null, errorObj);
1813
+ }
1814
+
1815
+ /* HERE IS WHERE YOU VALIDATE DATA */
1816
+
1817
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1818
+ const queryParamsAvailable = {};
1819
+ const queryParams = {};
1820
+ const pathVars = [];
1821
+ const bodyVars = {};
1822
+
1823
+ // loop in template. long callback arg name to avoid identifier conflicts
1824
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1825
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1826
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1827
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1828
+ }
1829
+ });
1830
+
1831
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1832
+ // see adapter code documentation for more information on the request object's fields
1833
+ let reqObj = {
1834
+ payload: bodyVars,
1835
+ uriPathVars: pathVars,
1836
+ uriQuery: queryParams
1837
+ };
1838
+
1839
+ // Parse and merge iapMetadata fields into reqObj
1840
+ if (iapMetadata && typeof iapMetadata === 'object') {
1841
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1842
+ }
1843
+
1844
+ try {
1845
+ // Make the call -
1846
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1847
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'performReplicationAndRebalanceOfKafkaPartitions', reqObj, true, (irReturnData, irReturnError) => {
1848
+ // if we received an error or their is no response on the results
1849
+ // return an error
1850
+ if (irReturnError) {
1851
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1852
+ return callback(null, irReturnError);
1853
+ }
1854
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1855
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['performReplicationAndRebalanceOfKafkaPartitions'], null, null, null);
1856
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1857
+ return callback(null, errorObj);
1858
+ }
1859
+
1860
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1861
+ // return the response
1862
+ return callback(irReturnData, null);
1863
+ });
1864
+ } catch (ex) {
1865
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1866
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1867
+ return callback(null, errorObj);
1868
+ }
1869
+ }
1870
+
1871
+ /**
1872
+ * @function editVmanage
1873
+ * @pronghornType method
1874
+ * @name editVmanage
1875
+ * @summary editVmanage
1876
+ *
1877
+ * @param {object} [body] - vManage cluster config
1878
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1879
+ * @param {getCallback} callback - a callback function to return the result
1880
+ * @return {object} results - An object containing the response of the action
1881
+ *
1882
+ * @route {POST} /editVmanage
1883
+ * @roles admin
1884
+ * @task true
1885
+ */
1886
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1887
+ editVmanage(body, iapMetadata, callback) {
1888
+ const meth = 'adapter-editVmanage';
1889
+ const origin = `${this.id}-${meth}`;
1890
+ log.trace(origin);
1891
+
1892
+ if (this.suspended && this.suspendMode === 'error') {
1893
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1894
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1895
+ return callback(null, errorObj);
1896
+ }
1897
+
1898
+ /* HERE IS WHERE YOU VALIDATE DATA */
1899
+
1900
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1901
+ const queryParamsAvailable = {};
1902
+ const queryParams = {};
1903
+ const pathVars = [];
1904
+ const bodyVars = body;
1905
+
1906
+ // loop in template. long callback arg name to avoid identifier conflicts
1907
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1908
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1909
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1910
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1911
+ }
1912
+ });
1913
+
1914
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1915
+ // see adapter code documentation for more information on the request object's fields
1916
+ let reqObj = {
1917
+ payload: bodyVars,
1918
+ uriPathVars: pathVars,
1919
+ uriQuery: queryParams
1920
+ };
1921
+
1922
+ // Parse and merge iapMetadata fields into reqObj
1923
+ if (iapMetadata && typeof iapMetadata === 'object') {
1924
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1925
+ }
1926
+
1927
+ try {
1928
+ // Make the call -
1929
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1930
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'editVmanage', reqObj, true, (irReturnData, irReturnError) => {
1931
+ // if we received an error or their is no response on the results
1932
+ // return an error
1933
+ if (irReturnError) {
1934
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1935
+ return callback(null, irReturnError);
1936
+ }
1937
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1938
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['editVmanage'], null, null, null);
1939
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1940
+ return callback(null, errorObj);
1941
+ }
1942
+
1943
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1944
+ // return the response
1945
+ return callback(irReturnData, null);
1946
+ });
1947
+ } catch (ex) {
1948
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1949
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1950
+ return callback(null, errorObj);
1951
+ }
1952
+ }
1953
+
1954
+ /**
1955
+ * @function addVmanage
1956
+ * @pronghornType method
1957
+ * @name addVmanage
1958
+ * @summary addVmanage
1959
+ *
1960
+ * @param {object} [body] - vManage cluster config
1961
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1962
+ * @param {getCallback} callback - a callback function to return the result
1963
+ * @return {object} results - An object containing the response of the action
1964
+ *
1965
+ * @route {POST} /addVmanage
1966
+ * @roles admin
1967
+ * @task true
1968
+ */
1969
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1970
+ addVmanage(body, iapMetadata, callback) {
1971
+ const meth = 'adapter-addVmanage';
1972
+ const origin = `${this.id}-${meth}`;
1973
+ log.trace(origin);
1974
+
1975
+ if (this.suspended && this.suspendMode === 'error') {
1976
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1977
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1978
+ return callback(null, errorObj);
1979
+ }
1980
+
1981
+ /* HERE IS WHERE YOU VALIDATE DATA */
1982
+
1983
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1984
+ const queryParamsAvailable = {};
1985
+ const queryParams = {};
1986
+ const pathVars = [];
1987
+ const bodyVars = body;
1988
+
1989
+ // loop in template. long callback arg name to avoid identifier conflicts
1990
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1991
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1992
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1993
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1994
+ }
1995
+ });
1996
+
1997
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1998
+ // see adapter code documentation for more information on the request object's fields
1999
+ let reqObj = {
2000
+ payload: bodyVars,
2001
+ uriPathVars: pathVars,
2002
+ uriQuery: queryParams
2003
+ };
2004
+
2005
+ // Parse and merge iapMetadata fields into reqObj
2006
+ if (iapMetadata && typeof iapMetadata === 'object') {
2007
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2008
+ }
2009
+
2010
+ try {
2011
+ // Make the call -
2012
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2013
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'addVmanage', reqObj, true, (irReturnData, irReturnError) => {
2014
+ // if we received an error or their is no response on the results
2015
+ // return an error
2016
+ if (irReturnError) {
2017
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2018
+ return callback(null, irReturnError);
2019
+ }
2020
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2021
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addVmanage'], null, null, null);
2022
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2023
+ return callback(null, errorObj);
2024
+ }
2025
+
2026
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2027
+ // return the response
2028
+ return callback(irReturnData, null);
2029
+ });
2030
+ } catch (ex) {
2031
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2032
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2033
+ return callback(null, errorObj);
2034
+ }
2035
+ }
2036
+
2037
+ /**
2038
+ * @function getTenancyMode
2039
+ * @pronghornType method
2040
+ * @name getTenancyMode
2041
+ * @summary getTenancyMode
2042
+ *
2043
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2044
+ * @param {getCallback} callback - a callback function to return the result
2045
+ * @return {object} results - An object containing the response of the action
2046
+ *
2047
+ * @route {GET} /getTenancyMode
2048
+ * @roles admin
2049
+ * @task true
2050
+ */
2051
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2052
+ getTenancyMode(iapMetadata, callback) {
2053
+ const meth = 'adapter-getTenancyMode';
2054
+ const origin = `${this.id}-${meth}`;
2055
+ log.trace(origin);
2056
+
2057
+ if (this.suspended && this.suspendMode === 'error') {
2058
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2059
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2060
+ return callback(null, errorObj);
2061
+ }
2062
+
2063
+ /* HERE IS WHERE YOU VALIDATE DATA */
2064
+
2065
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2066
+ const queryParamsAvailable = {};
2067
+ const queryParams = {};
2068
+ const pathVars = [];
2069
+ const bodyVars = {};
2070
+
2071
+ // loop in template. long callback arg name to avoid identifier conflicts
2072
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2073
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2074
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2075
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2076
+ }
2077
+ });
2078
+
2079
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2080
+ // see adapter code documentation for more information on the request object's fields
2081
+ let reqObj = {
2082
+ payload: bodyVars,
2083
+ uriPathVars: pathVars,
2084
+ uriQuery: queryParams
2085
+ };
2086
+
2087
+ // Parse and merge iapMetadata fields into reqObj
2088
+ if (iapMetadata && typeof iapMetadata === 'object') {
2089
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2090
+ }
2091
+
2092
+ try {
2093
+ // Make the call -
2094
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2095
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'getTenancyMode', reqObj, true, (irReturnData, irReturnError) => {
2096
+ // if we received an error or their is no response on the results
2097
+ // return an error
2098
+ if (irReturnError) {
2099
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2100
+ return callback(null, irReturnError);
2101
+ }
2102
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2103
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getTenancyMode'], null, null, null);
2104
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2105
+ return callback(null, errorObj);
2106
+ }
2107
+
2108
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2109
+ // return the response
2110
+ return callback(irReturnData, null);
2111
+ });
2112
+ } catch (ex) {
2113
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2114
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2115
+ return callback(null, errorObj);
2116
+ }
2117
+ }
2118
+
2119
+ /**
2120
+ * @function setTenancyMode
2121
+ * @pronghornType method
2122
+ * @name setTenancyMode
2123
+ * @summary setTenancyMode
2124
+ *
2125
+ * @param {object} [body] - Tenancy mode setting
2126
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2127
+ * @param {getCallback} callback - a callback function to return the result
2128
+ * @return {object} results - An object containing the response of the action
2129
+ *
2130
+ * @route {POST} /setTenancyMode
2131
+ * @roles admin
2132
+ * @task true
2133
+ */
2134
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2135
+ setTenancyMode(body, iapMetadata, callback) {
2136
+ const meth = 'adapter-setTenancyMode';
2137
+ const origin = `${this.id}-${meth}`;
2138
+ log.trace(origin);
2139
+
2140
+ if (this.suspended && this.suspendMode === 'error') {
2141
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2142
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2143
+ return callback(null, errorObj);
2144
+ }
2145
+
2146
+ /* HERE IS WHERE YOU VALIDATE DATA */
2147
+
2148
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2149
+ const queryParamsAvailable = {};
2150
+ const queryParams = {};
2151
+ const pathVars = [];
2152
+ const bodyVars = body;
2153
+
2154
+ // loop in template. long callback arg name to avoid identifier conflicts
2155
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2156
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2157
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2158
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2159
+ }
2160
+ });
2161
+
2162
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2163
+ // see adapter code documentation for more information on the request object's fields
2164
+ let reqObj = {
2165
+ payload: bodyVars,
2166
+ uriPathVars: pathVars,
2167
+ uriQuery: queryParams
2168
+ };
2169
+
2170
+ // Parse and merge iapMetadata fields into reqObj
2171
+ if (iapMetadata && typeof iapMetadata === 'object') {
2172
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2173
+ }
2174
+
2175
+ try {
2176
+ // Make the call -
2177
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2178
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'setTenancyMode', reqObj, true, (irReturnData, irReturnError) => {
2179
+ // if we received an error or their is no response on the results
2180
+ // return an error
2181
+ if (irReturnError) {
2182
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2183
+ return callback(null, irReturnError);
2184
+ }
2185
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2186
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['setTenancyMode'], null, null, null);
2187
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2188
+ return callback(null, errorObj);
2189
+ }
2190
+
2191
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2192
+ // return the response
2193
+ return callback(irReturnData, null);
2194
+ });
2195
+ } catch (ex) {
2196
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2197
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2198
+ return callback(null, errorObj);
2199
+ }
2200
+ }
2201
+
2202
+ /**
2203
+ * @function getTenantsList
2204
+ * @pronghornType method
2205
+ * @name getTenantsList
2206
+ * @summary getTenantsList
2207
+ *
2208
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2209
+ * @param {getCallback} callback - a callback function to return the result
2210
+ * @return {object} results - An object containing the response of the action
2211
+ *
2212
+ * @route {GET} /getTenantsList
2213
+ * @roles admin
2214
+ * @task true
2215
+ */
2216
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2217
+ getTenantsList(iapMetadata, callback) {
2218
+ const meth = 'adapter-getTenantsList';
2219
+ const origin = `${this.id}-${meth}`;
2220
+ log.trace(origin);
2221
+
2222
+ if (this.suspended && this.suspendMode === 'error') {
2223
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2224
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2225
+ return callback(null, errorObj);
2226
+ }
2227
+
2228
+ /* HERE IS WHERE YOU VALIDATE DATA */
2229
+
2230
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2231
+ const queryParamsAvailable = {};
2232
+ const queryParams = {};
2233
+ const pathVars = [];
2234
+ const bodyVars = {};
2235
+
2236
+ // loop in template. long callback arg name to avoid identifier conflicts
2237
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2238
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2239
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2240
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2241
+ }
2242
+ });
2243
+
2244
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2245
+ // see adapter code documentation for more information on the request object's fields
2246
+ let reqObj = {
2247
+ payload: bodyVars,
2248
+ uriPathVars: pathVars,
2249
+ uriQuery: queryParams
2250
+ };
2251
+
2252
+ // Parse and merge iapMetadata fields into reqObj
2253
+ if (iapMetadata && typeof iapMetadata === 'object') {
2254
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2255
+ }
2256
+
2257
+ try {
2258
+ // Make the call -
2259
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2260
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'getTenantsList', reqObj, true, (irReturnData, irReturnError) => {
2261
+ // if we received an error or their is no response on the results
2262
+ // return an error
2263
+ if (irReturnError) {
2264
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2265
+ return callback(null, irReturnError);
2266
+ }
2267
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2268
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getTenantsList'], null, null, null);
2269
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2270
+ return callback(null, errorObj);
2271
+ }
2272
+
2273
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2274
+ // return the response
2275
+ return callback(irReturnData, null);
2276
+ });
2277
+ } catch (ex) {
2278
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2279
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2280
+ return callback(null, errorObj);
2281
+ }
2282
+ }
2283
+
2284
+ /**
2285
+ * @function addOrUpdateUserCredentials
2286
+ * @pronghornType method
2287
+ * @name addOrUpdateUserCredentials
2288
+ * @summary addOrUpdateUserCredentials
2289
+ *
2290
+ * @param {object} [body] - User credential
2291
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2292
+ * @param {getCallback} callback - a callback function to return the result
2293
+ * @return {object} results - An object containing the response of the action
2294
+ *
2295
+ * @route {POST} /addOrUpdateUserCredentials
2296
+ * @roles admin
2297
+ * @task true
2298
+ */
2299
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2300
+ addOrUpdateUserCredentials(body, iapMetadata, callback) {
2301
+ const meth = 'adapter-addOrUpdateUserCredentials';
2302
+ const origin = `${this.id}-${meth}`;
2303
+ log.trace(origin);
2304
+
2305
+ if (this.suspended && this.suspendMode === 'error') {
2306
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2307
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2308
+ return callback(null, errorObj);
2309
+ }
2310
+
2311
+ /* HERE IS WHERE YOU VALIDATE DATA */
2312
+
2313
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2314
+ const queryParamsAvailable = {};
2315
+ const queryParams = {};
2316
+ const pathVars = [];
2317
+ const bodyVars = body;
2318
+
2319
+ // loop in template. long callback arg name to avoid identifier conflicts
2320
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2321
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2322
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2323
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2324
+ }
2325
+ });
2326
+
2327
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2328
+ // see adapter code documentation for more information on the request object's fields
2329
+ let reqObj = {
2330
+ payload: bodyVars,
2331
+ uriPathVars: pathVars,
2332
+ uriQuery: queryParams
2333
+ };
2334
+
2335
+ // Parse and merge iapMetadata fields into reqObj
2336
+ if (iapMetadata && typeof iapMetadata === 'object') {
2337
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2338
+ }
2339
+
2340
+ try {
2341
+ // Make the call -
2342
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2343
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'addOrUpdateUserCredentials', reqObj, true, (irReturnData, irReturnError) => {
2344
+ // if we received an error or their is no response on the results
2345
+ // return an error
2346
+ if (irReturnError) {
2347
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2348
+ return callback(null, irReturnError);
2349
+ }
2350
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2351
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addOrUpdateUserCredentials'], null, null, null);
2352
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2353
+ return callback(null, errorObj);
2354
+ }
2355
+
2356
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2357
+ // return the response
2358
+ return callback(irReturnData, null);
2359
+ });
2360
+ } catch (ex) {
2361
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2362
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2363
+ return callback(null, errorObj);
2364
+ }
2365
+ }
2366
+
2367
+ /**
2368
+ * @function getVManageDetails
2369
+ * @pronghornType method
2370
+ * @name getVManageDetails
2371
+ * @summary getVManageDetails
2372
+ *
2373
+ * @param {string} vmanageIP - vManage IP
2374
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2375
+ * @param {getCallback} callback - a callback function to return the result
2376
+ * @return {object} results - An object containing the response of the action
2377
+ *
2378
+ * @route {POST} /getVManageDetails
2379
+ * @roles admin
2380
+ * @task true
2381
+ */
2382
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2383
+ getVManageDetails(vmanageIP, iapMetadata, callback) {
2384
+ const meth = 'adapter-getVManageDetails';
2385
+ const origin = `${this.id}-${meth}`;
2386
+ log.trace(origin);
2387
+
2388
+ if (this.suspended && this.suspendMode === 'error') {
2389
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2390
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2391
+ return callback(null, errorObj);
2392
+ }
2393
+
2394
+ /* HERE IS WHERE YOU VALIDATE DATA */
2395
+ if (vmanageIP === undefined || vmanageIP === null || vmanageIP === '') {
2396
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vmanageIP'], null, null, null);
2397
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2398
+ return callback(null, errorObj);
2399
+ }
2400
+
2401
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2402
+ const queryParamsAvailable = {};
2403
+ const queryParams = {};
2404
+ const pathVars = [vmanageIP];
2405
+ const bodyVars = {};
2406
+
2407
+ // loop in template. long callback arg name to avoid identifier conflicts
2408
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2409
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2410
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2411
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2412
+ }
2413
+ });
2414
+
2415
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2416
+ // see adapter code documentation for more information on the request object's fields
2417
+ let reqObj = {
2418
+ payload: bodyVars,
2419
+ uriPathVars: pathVars,
2420
+ uriQuery: queryParams
2421
+ };
2422
+
2423
+ // Parse and merge iapMetadata fields into reqObj
2424
+ if (iapMetadata && typeof iapMetadata === 'object') {
2425
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2426
+ }
2427
+
2428
+ try {
2429
+ // Make the call -
2430
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2431
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'getVManageDetails', reqObj, true, (irReturnData, irReturnError) => {
2432
+ // if we received an error or their is no response on the results
2433
+ // return an error
2434
+ if (irReturnError) {
2435
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2436
+ return callback(null, irReturnError);
2437
+ }
2438
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2439
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getVManageDetails'], null, null, null);
2440
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2441
+ return callback(null, errorObj);
2442
+ }
2443
+
2444
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2445
+ // return the response
2446
+ return callback(irReturnData, null);
2447
+ });
2448
+ } catch (ex) {
2449
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2450
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2451
+ return callback(null, errorObj);
2452
+ }
2453
+ }
2454
+
2455
+ /**
2456
+ * @function getConnectedDevicesPerTenant
2457
+ * @pronghornType method
2458
+ * @name getConnectedDevicesPerTenant
2459
+ * @summary getConnectedDevicesPerTenant
2460
+ *
2461
+ * @param {string} tenantId - Tenant Id
2462
+ * @param {string} vmanageIP - vManage IP
2463
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2464
+ * @param {getCallback} callback - a callback function to return the result
2465
+ * @return {object} results - An object containing the response of the action
2466
+ *
2467
+ * @route {POST} /getConnectedDevicesPerTenant
2468
+ * @roles admin
2469
+ * @task true
2470
+ */
2471
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2472
+ getConnectedDevicesPerTenant(tenantId, vmanageIP, iapMetadata, callback) {
2473
+ const meth = 'adapter-getConnectedDevicesPerTenant';
2474
+ const origin = `${this.id}-${meth}`;
2475
+ log.trace(origin);
2476
+
2477
+ if (this.suspended && this.suspendMode === 'error') {
2478
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2479
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2480
+ return callback(null, errorObj);
2481
+ }
2482
+
2483
+ /* HERE IS WHERE YOU VALIDATE DATA */
2484
+ if (tenantId === undefined || tenantId === null || tenantId === '') {
2485
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['tenantId'], null, null, null);
2486
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2487
+ return callback(null, errorObj);
2488
+ }
2489
+ if (vmanageIP === undefined || vmanageIP === null || vmanageIP === '') {
2490
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vmanageIP'], null, null, null);
2491
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2492
+ return callback(null, errorObj);
2493
+ }
2494
+
2495
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2496
+ const queryParamsAvailable = {};
2497
+ const queryParams = {};
2498
+ const pathVars = [tenantId, vmanageIP];
2499
+ const bodyVars = {};
2500
+
2501
+ // loop in template. long callback arg name to avoid identifier conflicts
2502
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2503
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2504
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2505
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2506
+ }
2507
+ });
2508
+
2509
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2510
+ // see adapter code documentation for more information on the request object's fields
2511
+ let reqObj = {
2512
+ payload: bodyVars,
2513
+ uriPathVars: pathVars,
2514
+ uriQuery: queryParams
2515
+ };
2516
+
2517
+ // Parse and merge iapMetadata fields into reqObj
2518
+ if (iapMetadata && typeof iapMetadata === 'object') {
2519
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2520
+ }
2521
+
2522
+ try {
2523
+ // Make the call -
2524
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2525
+ return this.requestHandlerInst.identifyRequest('ClusterManagement', 'getConnectedDevicesPerTenant', reqObj, true, (irReturnData, irReturnError) => {
2526
+ // if we received an error or their is no response on the results
2527
+ // return an error
2528
+ if (irReturnError) {
2529
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2530
+ return callback(null, irReturnError);
2531
+ }
2532
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2533
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getConnectedDevicesPerTenant'], null, null, null);
2534
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2535
+ return callback(null, errorObj);
2536
+ }
2537
+
2538
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2539
+ // return the response
2540
+ return callback(irReturnData, null);
2541
+ });
2542
+ } catch (ex) {
2543
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2544
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2545
+ return callback(null, errorObj);
2546
+ }
2547
+ }
789
2548
  }
790
2549
 
791
2550
  module.exports = Rubrik;