@itentialopensource/adapter-apic 0.12.1 → 0.13.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
@@ -1093,6 +1093,2084 @@ class Apic extends AdapterBaseCl {
1093
1093
  return callback(null, errorObj);
1094
1094
  }
1095
1095
  }
1096
+
1097
+ /**
1098
+ * @function getAllTenants
1099
+ * @pronghornType method
1100
+ * @name getAllTenants
1101
+ * @summary Get All Tenants
1102
+ *
1103
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1104
+ * @param {getCallback} callback - a callback function to return the result
1105
+ * @return {object} results - An object containing the response of the action
1106
+ *
1107
+ * @route {GET} /getAllTenants
1108
+ * @roles admin
1109
+ * @task true
1110
+ */
1111
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1112
+ getAllTenants(iapMetadata, callback) {
1113
+ const meth = 'adapter-getAllTenants';
1114
+ const origin = `${this.id}-${meth}`;
1115
+ log.trace(origin);
1116
+
1117
+ if (this.suspended && this.suspendMode === 'error') {
1118
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1119
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1120
+ return callback(null, errorObj);
1121
+ }
1122
+
1123
+ /* HERE IS WHERE YOU VALIDATE DATA */
1124
+
1125
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1126
+ const queryParamsAvailable = {};
1127
+ const queryParams = {};
1128
+ const pathVars = [];
1129
+ const bodyVars = {};
1130
+
1131
+ // loop in template. long callback arg name to avoid identifier conflicts
1132
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1133
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1134
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1135
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1136
+ }
1137
+ });
1138
+
1139
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1140
+ // see adapter code documentation for more information on the request object's fields
1141
+ let reqObj = {
1142
+ payload: bodyVars,
1143
+ uriPathVars: pathVars,
1144
+ uriQuery: queryParams
1145
+ };
1146
+
1147
+ // Parse and merge iapMetadata fields into reqObj
1148
+ if (iapMetadata && typeof iapMetadata === 'object') {
1149
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1150
+ }
1151
+
1152
+ try {
1153
+ // Make the call -
1154
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1155
+ return this.requestHandlerInst.identifyRequest('TenantOperations', 'getAllTenants', reqObj, true, (irReturnData, irReturnError) => {
1156
+ // if we received an error or their is no response on the results
1157
+ // return an error
1158
+ if (irReturnError) {
1159
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1160
+ return callback(null, irReturnError);
1161
+ }
1162
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1163
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllTenants'], null, null, null);
1164
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1165
+ return callback(null, errorObj);
1166
+ }
1167
+
1168
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1169
+ // return the response
1170
+ return callback(irReturnData, null);
1171
+ });
1172
+ } catch (ex) {
1173
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1174
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1175
+ return callback(null, errorObj);
1176
+ }
1177
+ }
1178
+
1179
+ /**
1180
+ * @function getTenant
1181
+ * @pronghornType method
1182
+ * @name getTenant
1183
+ * @summary Get Specific Tenant
1184
+ *
1185
+ * @param {string} tenantName - tenantName param
1186
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1187
+ * @param {getCallback} callback - a callback function to return the result
1188
+ * @return {object} results - An object containing the response of the action
1189
+ *
1190
+ * @route {POST} /getTenant
1191
+ * @roles admin
1192
+ * @task true
1193
+ */
1194
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1195
+ getTenant(tenantName, iapMetadata, callback) {
1196
+ const meth = 'adapter-getTenant';
1197
+ const origin = `${this.id}-${meth}`;
1198
+ log.trace(origin);
1199
+
1200
+ if (this.suspended && this.suspendMode === 'error') {
1201
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1202
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1203
+ return callback(null, errorObj);
1204
+ }
1205
+
1206
+ /* HERE IS WHERE YOU VALIDATE DATA */
1207
+ if (tenantName === undefined || tenantName === null || tenantName === '') {
1208
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['tenantName'], null, null, null);
1209
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1210
+ return callback(null, errorObj);
1211
+ }
1212
+
1213
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1214
+ const queryParamsAvailable = {};
1215
+ const queryParams = {};
1216
+ const pathVars = [tenantName];
1217
+ const bodyVars = {};
1218
+
1219
+ // loop in template. long callback arg name to avoid identifier conflicts
1220
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1221
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1222
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1223
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1224
+ }
1225
+ });
1226
+
1227
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1228
+ // see adapter code documentation for more information on the request object's fields
1229
+ let reqObj = {
1230
+ payload: bodyVars,
1231
+ uriPathVars: pathVars,
1232
+ uriQuery: queryParams
1233
+ };
1234
+
1235
+ // Parse and merge iapMetadata fields into reqObj
1236
+ if (iapMetadata && typeof iapMetadata === 'object') {
1237
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1238
+ }
1239
+
1240
+ try {
1241
+ // Make the call -
1242
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1243
+ return this.requestHandlerInst.identifyRequest('TenantOperations', 'getTenant', reqObj, true, (irReturnData, irReturnError) => {
1244
+ // if we received an error or their is no response on the results
1245
+ // return an error
1246
+ if (irReturnError) {
1247
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1248
+ return callback(null, irReturnError);
1249
+ }
1250
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1251
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getTenant'], null, null, null);
1252
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1253
+ return callback(null, errorObj);
1254
+ }
1255
+
1256
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1257
+ // return the response
1258
+ return callback(irReturnData, null);
1259
+ });
1260
+ } catch (ex) {
1261
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1262
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1263
+ return callback(null, errorObj);
1264
+ }
1265
+ }
1266
+
1267
+ /**
1268
+ * @function getTenantWithFullSubtree
1269
+ * @pronghornType method
1270
+ * @name getTenantWithFullSubtree
1271
+ * @summary Get Tenant with Full Subtree
1272
+ *
1273
+ * @param {string} tenantName - tenantName param
1274
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1275
+ * @param {getCallback} callback - a callback function to return the result
1276
+ * @return {object} results - An object containing the response of the action
1277
+ *
1278
+ * @route {POST} /getTenantWithFullSubtree
1279
+ * @roles admin
1280
+ * @task true
1281
+ */
1282
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1283
+ getTenantWithFullSubtree(tenantName, iapMetadata, callback) {
1284
+ const meth = 'adapter-getTenantWithFullSubtree';
1285
+ const origin = `${this.id}-${meth}`;
1286
+ log.trace(origin);
1287
+
1288
+ if (this.suspended && this.suspendMode === 'error') {
1289
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1290
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1291
+ return callback(null, errorObj);
1292
+ }
1293
+
1294
+ /* HERE IS WHERE YOU VALIDATE DATA */
1295
+ if (tenantName === undefined || tenantName === null || tenantName === '') {
1296
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['tenantName'], null, null, null);
1297
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1298
+ return callback(null, errorObj);
1299
+ }
1300
+
1301
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1302
+ const queryParamsAvailable = {};
1303
+ const queryParams = {};
1304
+ const pathVars = [tenantName];
1305
+ const bodyVars = {};
1306
+
1307
+ // loop in template. long callback arg name to avoid identifier conflicts
1308
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1309
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1310
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1311
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1312
+ }
1313
+ });
1314
+
1315
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1316
+ // see adapter code documentation for more information on the request object's fields
1317
+ let reqObj = {
1318
+ payload: bodyVars,
1319
+ uriPathVars: pathVars,
1320
+ uriQuery: queryParams
1321
+ };
1322
+
1323
+ // Parse and merge iapMetadata fields into reqObj
1324
+ if (iapMetadata && typeof iapMetadata === 'object') {
1325
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1326
+ }
1327
+
1328
+ try {
1329
+ // Make the call -
1330
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1331
+ return this.requestHandlerInst.identifyRequest('TenantOperations', 'getTenantWithFullSubtree', reqObj, true, (irReturnData, irReturnError) => {
1332
+ // if we received an error or their is no response on the results
1333
+ // return an error
1334
+ if (irReturnError) {
1335
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1336
+ return callback(null, irReturnError);
1337
+ }
1338
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1339
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getTenantWithFullSubtree'], null, null, null);
1340
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1341
+ return callback(null, errorObj);
1342
+ }
1343
+
1344
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1345
+ // return the response
1346
+ return callback(irReturnData, null);
1347
+ });
1348
+ } catch (ex) {
1349
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1350
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1351
+ return callback(null, errorObj);
1352
+ }
1353
+ }
1354
+
1355
+ /**
1356
+ * @function createTenantOrEnvironment
1357
+ * @pronghornType method
1358
+ * @name createTenantOrEnvironment
1359
+ * @summary Create Tenant or Complete Environment
1360
+ *
1361
+ * @param {object} body - body param
1362
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1363
+ * @param {getCallback} callback - a callback function to return the result
1364
+ * @return {object} results - An object containing the response of the action
1365
+ *
1366
+ * @route {POST} /createTenantOrEnvironment
1367
+ * @roles admin
1368
+ * @task true
1369
+ */
1370
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1371
+ createTenantOrEnvironment(body, iapMetadata, callback) {
1372
+ const meth = 'adapter-createTenantOrEnvironment';
1373
+ const origin = `${this.id}-${meth}`;
1374
+ log.trace(origin);
1375
+
1376
+ if (this.suspended && this.suspendMode === 'error') {
1377
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1378
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1379
+ return callback(null, errorObj);
1380
+ }
1381
+
1382
+ /* HERE IS WHERE YOU VALIDATE DATA */
1383
+ if (body === undefined || body === null || body === '') {
1384
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1385
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1386
+ return callback(null, errorObj);
1387
+ }
1388
+
1389
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1390
+ const queryParamsAvailable = {};
1391
+ const queryParams = {};
1392
+ const pathVars = [];
1393
+ const bodyVars = body;
1394
+
1395
+ // loop in template. long callback arg name to avoid identifier conflicts
1396
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1397
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1398
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1399
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1400
+ }
1401
+ });
1402
+
1403
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1404
+ // see adapter code documentation for more information on the request object's fields
1405
+ let reqObj = {
1406
+ payload: bodyVars,
1407
+ uriPathVars: pathVars,
1408
+ uriQuery: queryParams
1409
+ };
1410
+
1411
+ // Parse and merge iapMetadata fields into reqObj
1412
+ if (iapMetadata && typeof iapMetadata === 'object') {
1413
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1414
+ }
1415
+
1416
+ try {
1417
+ // Make the call -
1418
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1419
+ return this.requestHandlerInst.identifyRequest('TenantOperations', 'createTenantOrEnvironment', reqObj, true, (irReturnData, irReturnError) => {
1420
+ // if we received an error or their is no response on the results
1421
+ // return an error
1422
+ if (irReturnError) {
1423
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1424
+ return callback(null, irReturnError);
1425
+ }
1426
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1427
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createTenantOrEnvironment'], null, null, null);
1428
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1429
+ return callback(null, errorObj);
1430
+ }
1431
+
1432
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1433
+ // return the response
1434
+ return callback(irReturnData, null);
1435
+ });
1436
+ } catch (ex) {
1437
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1438
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1439
+ return callback(null, errorObj);
1440
+ }
1441
+ }
1442
+
1443
+ /**
1444
+ * @function createTenantResource
1445
+ * @pronghornType method
1446
+ * @name createTenantResource
1447
+ * @summary Create Resources in Tenant
1448
+ *
1449
+ * @param {string} tenantName - tenantName param
1450
+ * @param {object} body - body param
1451
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1452
+ * @param {getCallback} callback - a callback function to return the result
1453
+ * @return {object} results - An object containing the response of the action
1454
+ *
1455
+ * @route {POST} /createTenantResource
1456
+ * @roles admin
1457
+ * @task true
1458
+ */
1459
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1460
+ createTenantResource(tenantName, body, iapMetadata, callback) {
1461
+ const meth = 'adapter-createTenantResource';
1462
+ const origin = `${this.id}-${meth}`;
1463
+ log.trace(origin);
1464
+
1465
+ if (this.suspended && this.suspendMode === 'error') {
1466
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1467
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1468
+ return callback(null, errorObj);
1469
+ }
1470
+
1471
+ /* HERE IS WHERE YOU VALIDATE DATA */
1472
+ if (tenantName === undefined || tenantName === null || tenantName === '') {
1473
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['tenantName'], null, null, null);
1474
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1475
+ return callback(null, errorObj);
1476
+ }
1477
+ if (body === undefined || body === null || body === '') {
1478
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1479
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1480
+ return callback(null, errorObj);
1481
+ }
1482
+
1483
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1484
+ const queryParamsAvailable = {};
1485
+ const queryParams = {};
1486
+ const pathVars = [tenantName];
1487
+ const bodyVars = body;
1488
+
1489
+ // loop in template. long callback arg name to avoid identifier conflicts
1490
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1491
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1492
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1493
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1494
+ }
1495
+ });
1496
+
1497
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1498
+ // see adapter code documentation for more information on the request object's fields
1499
+ let reqObj = {
1500
+ payload: bodyVars,
1501
+ uriPathVars: pathVars,
1502
+ uriQuery: queryParams
1503
+ };
1504
+
1505
+ // Parse and merge iapMetadata fields into reqObj
1506
+ if (iapMetadata && typeof iapMetadata === 'object') {
1507
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1508
+ }
1509
+
1510
+ try {
1511
+ // Make the call -
1512
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1513
+ return this.requestHandlerInst.identifyRequest('VRFOperations', 'createTenantResource', reqObj, true, (irReturnData, irReturnError) => {
1514
+ // if we received an error or their is no response on the results
1515
+ // return an error
1516
+ if (irReturnError) {
1517
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1518
+ return callback(null, irReturnError);
1519
+ }
1520
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1521
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createTenantResource'], null, null, null);
1522
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1523
+ return callback(null, errorObj);
1524
+ }
1525
+
1526
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1527
+ // return the response
1528
+ return callback(irReturnData, null);
1529
+ });
1530
+ } catch (ex) {
1531
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1532
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1533
+ return callback(null, errorObj);
1534
+ }
1535
+ }
1536
+
1537
+ /**
1538
+ * @function getAllVRFs
1539
+ * @pronghornType method
1540
+ * @name getAllVRFs
1541
+ * @summary Get All VRFs
1542
+ *
1543
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1544
+ * @param {getCallback} callback - a callback function to return the result
1545
+ * @return {object} results - An object containing the response of the action
1546
+ *
1547
+ * @route {GET} /getAllVRFs
1548
+ * @roles admin
1549
+ * @task true
1550
+ */
1551
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1552
+ getAllVRFs(iapMetadata, callback) {
1553
+ const meth = 'adapter-getAllVRFs';
1554
+ const origin = `${this.id}-${meth}`;
1555
+ log.trace(origin);
1556
+
1557
+ if (this.suspended && this.suspendMode === 'error') {
1558
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1559
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1560
+ return callback(null, errorObj);
1561
+ }
1562
+
1563
+ /* HERE IS WHERE YOU VALIDATE DATA */
1564
+
1565
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1566
+ const queryParamsAvailable = {};
1567
+ const queryParams = {};
1568
+ const pathVars = [];
1569
+ const bodyVars = {};
1570
+
1571
+ // loop in template. long callback arg name to avoid identifier conflicts
1572
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1573
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1574
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1575
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1576
+ }
1577
+ });
1578
+
1579
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1580
+ // see adapter code documentation for more information on the request object's fields
1581
+ let reqObj = {
1582
+ payload: bodyVars,
1583
+ uriPathVars: pathVars,
1584
+ uriQuery: queryParams
1585
+ };
1586
+
1587
+ // Parse and merge iapMetadata fields into reqObj
1588
+ if (iapMetadata && typeof iapMetadata === 'object') {
1589
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1590
+ }
1591
+
1592
+ try {
1593
+ // Make the call -
1594
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1595
+ return this.requestHandlerInst.identifyRequest('VRFOperations', 'getAllVRFs', reqObj, true, (irReturnData, irReturnError) => {
1596
+ // if we received an error or their is no response on the results
1597
+ // return an error
1598
+ if (irReturnError) {
1599
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1600
+ return callback(null, irReturnError);
1601
+ }
1602
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1603
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllVRFs'], null, null, null);
1604
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1605
+ return callback(null, errorObj);
1606
+ }
1607
+
1608
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1609
+ // return the response
1610
+ return callback(irReturnData, null);
1611
+ });
1612
+ } catch (ex) {
1613
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1614
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1615
+ return callback(null, errorObj);
1616
+ }
1617
+ }
1618
+
1619
+ /**
1620
+ * @function getAllBridgeDomains
1621
+ * @pronghornType method
1622
+ * @name getAllBridgeDomains
1623
+ * @summary Get All Bridge Domains
1624
+ *
1625
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1626
+ * @param {getCallback} callback - a callback function to return the result
1627
+ * @return {object} results - An object containing the response of the action
1628
+ *
1629
+ * @route {GET} /getAllBridgeDomains
1630
+ * @roles admin
1631
+ * @task true
1632
+ */
1633
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1634
+ getAllBridgeDomains(iapMetadata, callback) {
1635
+ const meth = 'adapter-getAllBridgeDomains';
1636
+ const origin = `${this.id}-${meth}`;
1637
+ log.trace(origin);
1638
+
1639
+ if (this.suspended && this.suspendMode === 'error') {
1640
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1641
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1642
+ return callback(null, errorObj);
1643
+ }
1644
+
1645
+ /* HERE IS WHERE YOU VALIDATE DATA */
1646
+
1647
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1648
+ const queryParamsAvailable = {};
1649
+ const queryParams = {};
1650
+ const pathVars = [];
1651
+ const bodyVars = {};
1652
+
1653
+ // loop in template. long callback arg name to avoid identifier conflicts
1654
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1655
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1656
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1657
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1658
+ }
1659
+ });
1660
+
1661
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1662
+ // see adapter code documentation for more information on the request object's fields
1663
+ let reqObj = {
1664
+ payload: bodyVars,
1665
+ uriPathVars: pathVars,
1666
+ uriQuery: queryParams
1667
+ };
1668
+
1669
+ // Parse and merge iapMetadata fields into reqObj
1670
+ if (iapMetadata && typeof iapMetadata === 'object') {
1671
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1672
+ }
1673
+
1674
+ try {
1675
+ // Make the call -
1676
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1677
+ return this.requestHandlerInst.identifyRequest('BridgeDomainOperations', 'getAllBridgeDomains', reqObj, true, (irReturnData, irReturnError) => {
1678
+ // if we received an error or their is no response on the results
1679
+ // return an error
1680
+ if (irReturnError) {
1681
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1682
+ return callback(null, irReturnError);
1683
+ }
1684
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1685
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllBridgeDomains'], null, null, null);
1686
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1687
+ return callback(null, errorObj);
1688
+ }
1689
+
1690
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1691
+ // return the response
1692
+ return callback(irReturnData, null);
1693
+ });
1694
+ } catch (ex) {
1695
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1696
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1697
+ return callback(null, errorObj);
1698
+ }
1699
+ }
1700
+
1701
+ /**
1702
+ * @function createDHCPRelayPolicy
1703
+ * @pronghornType method
1704
+ * @name createDHCPRelayPolicy
1705
+ * @summary Configure DHCP Relay Policy
1706
+ *
1707
+ * @param {string} tenantName - tenantName param
1708
+ * @param {string} dhcpRelayPolicyName - dhcpRelayPolicyName param
1709
+ * @param {object} body - body param
1710
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1711
+ * @param {getCallback} callback - a callback function to return the result
1712
+ * @return {object} results - An object containing the response of the action
1713
+ *
1714
+ * @route {POST} /createDHCPRelayPolicy
1715
+ * @roles admin
1716
+ * @task true
1717
+ */
1718
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1719
+ createDHCPRelayPolicy(tenantName, dhcpRelayPolicyName, body, iapMetadata, callback) {
1720
+ const meth = 'adapter-createDHCPRelayPolicy';
1721
+ const origin = `${this.id}-${meth}`;
1722
+ log.trace(origin);
1723
+
1724
+ if (this.suspended && this.suspendMode === 'error') {
1725
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1726
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1727
+ return callback(null, errorObj);
1728
+ }
1729
+
1730
+ /* HERE IS WHERE YOU VALIDATE DATA */
1731
+ if (tenantName === undefined || tenantName === null || tenantName === '') {
1732
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['tenantName'], null, null, null);
1733
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1734
+ return callback(null, errorObj);
1735
+ }
1736
+ if (dhcpRelayPolicyName === undefined || dhcpRelayPolicyName === null || dhcpRelayPolicyName === '') {
1737
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['dhcpRelayPolicyName'], null, null, null);
1738
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1739
+ return callback(null, errorObj);
1740
+ }
1741
+ if (body === undefined || body === null || body === '') {
1742
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1743
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1744
+ return callback(null, errorObj);
1745
+ }
1746
+
1747
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1748
+ const queryParamsAvailable = {};
1749
+ const queryParams = {};
1750
+ const pathVars = [tenantName, dhcpRelayPolicyName];
1751
+ const bodyVars = body;
1752
+
1753
+ // loop in template. long callback arg name to avoid identifier conflicts
1754
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1755
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1756
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1757
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1758
+ }
1759
+ });
1760
+
1761
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1762
+ // see adapter code documentation for more information on the request object's fields
1763
+ let reqObj = {
1764
+ payload: bodyVars,
1765
+ uriPathVars: pathVars,
1766
+ uriQuery: queryParams
1767
+ };
1768
+
1769
+ // Parse and merge iapMetadata fields into reqObj
1770
+ if (iapMetadata && typeof iapMetadata === 'object') {
1771
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1772
+ }
1773
+
1774
+ try {
1775
+ // Make the call -
1776
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1777
+ return this.requestHandlerInst.identifyRequest('BridgeDomainOperations', 'createDHCPRelayPolicy', reqObj, true, (irReturnData, irReturnError) => {
1778
+ // if we received an error or their is no response on the results
1779
+ // return an error
1780
+ if (irReturnError) {
1781
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1782
+ return callback(null, irReturnError);
1783
+ }
1784
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1785
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createDHCPRelayPolicy'], null, null, null);
1786
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1787
+ return callback(null, errorObj);
1788
+ }
1789
+
1790
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1791
+ // return the response
1792
+ return callback(irReturnData, null);
1793
+ });
1794
+ } catch (ex) {
1795
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1796
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1797
+ return callback(null, errorObj);
1798
+ }
1799
+ }
1800
+
1801
+ /**
1802
+ * @function associateDHCPRelayToBD
1803
+ * @pronghornType method
1804
+ * @name associateDHCPRelayToBD
1805
+ * @summary Associate DHCP Relay Policy to BD
1806
+ *
1807
+ * @param {string} tenantName - tenantName param
1808
+ * @param {string} bdName - bdName param
1809
+ * @param {object} body - body param
1810
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1811
+ * @param {getCallback} callback - a callback function to return the result
1812
+ * @return {object} results - An object containing the response of the action
1813
+ *
1814
+ * @route {POST} /associateDHCPRelayToBD
1815
+ * @roles admin
1816
+ * @task true
1817
+ */
1818
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1819
+ associateDHCPRelayToBD(tenantName, bdName, body, iapMetadata, callback) {
1820
+ const meth = 'adapter-associateDHCPRelayToBD';
1821
+ const origin = `${this.id}-${meth}`;
1822
+ log.trace(origin);
1823
+
1824
+ if (this.suspended && this.suspendMode === 'error') {
1825
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1826
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1827
+ return callback(null, errorObj);
1828
+ }
1829
+
1830
+ /* HERE IS WHERE YOU VALIDATE DATA */
1831
+ if (tenantName === undefined || tenantName === null || tenantName === '') {
1832
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['tenantName'], null, null, null);
1833
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1834
+ return callback(null, errorObj);
1835
+ }
1836
+ if (bdName === undefined || bdName === null || bdName === '') {
1837
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['bdName'], null, null, null);
1838
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1839
+ return callback(null, errorObj);
1840
+ }
1841
+ if (body === undefined || body === null || body === '') {
1842
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1843
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1844
+ return callback(null, errorObj);
1845
+ }
1846
+
1847
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1848
+ const queryParamsAvailable = {};
1849
+ const queryParams = {};
1850
+ const pathVars = [tenantName, bdName];
1851
+ const bodyVars = body;
1852
+
1853
+ // loop in template. long callback arg name to avoid identifier conflicts
1854
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1855
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1856
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1857
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1858
+ }
1859
+ });
1860
+
1861
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1862
+ // see adapter code documentation for more information on the request object's fields
1863
+ let reqObj = {
1864
+ payload: bodyVars,
1865
+ uriPathVars: pathVars,
1866
+ uriQuery: queryParams
1867
+ };
1868
+
1869
+ // Parse and merge iapMetadata fields into reqObj
1870
+ if (iapMetadata && typeof iapMetadata === 'object') {
1871
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1872
+ }
1873
+
1874
+ try {
1875
+ // Make the call -
1876
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1877
+ return this.requestHandlerInst.identifyRequest('BridgeDomainOperations', 'associateDHCPRelayToBD', reqObj, true, (irReturnData, irReturnError) => {
1878
+ // if we received an error or their is no response on the results
1879
+ // return an error
1880
+ if (irReturnError) {
1881
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1882
+ return callback(null, irReturnError);
1883
+ }
1884
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1885
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['associateDHCPRelayToBD'], null, null, null);
1886
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1887
+ return callback(null, errorObj);
1888
+ }
1889
+
1890
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1891
+ // return the response
1892
+ return callback(irReturnData, null);
1893
+ });
1894
+ } catch (ex) {
1895
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1896
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1897
+ return callback(null, errorObj);
1898
+ }
1899
+ }
1900
+
1901
+ /**
1902
+ * @function getAllApplicationProfiles
1903
+ * @pronghornType method
1904
+ * @name getAllApplicationProfiles
1905
+ * @summary Get All Application Profiles
1906
+ *
1907
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1908
+ * @param {getCallback} callback - a callback function to return the result
1909
+ * @return {object} results - An object containing the response of the action
1910
+ *
1911
+ * @route {GET} /getAllApplicationProfiles
1912
+ * @roles admin
1913
+ * @task true
1914
+ */
1915
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1916
+ getAllApplicationProfiles(iapMetadata, callback) {
1917
+ const meth = 'adapter-getAllApplicationProfiles';
1918
+ const origin = `${this.id}-${meth}`;
1919
+ log.trace(origin);
1920
+
1921
+ if (this.suspended && this.suspendMode === 'error') {
1922
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1923
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1924
+ return callback(null, errorObj);
1925
+ }
1926
+
1927
+ /* HERE IS WHERE YOU VALIDATE DATA */
1928
+
1929
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1930
+ const queryParamsAvailable = {};
1931
+ const queryParams = {};
1932
+ const pathVars = [];
1933
+ const bodyVars = {};
1934
+
1935
+ // loop in template. long callback arg name to avoid identifier conflicts
1936
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1937
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1938
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1939
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1940
+ }
1941
+ });
1942
+
1943
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1944
+ // see adapter code documentation for more information on the request object's fields
1945
+ let reqObj = {
1946
+ payload: bodyVars,
1947
+ uriPathVars: pathVars,
1948
+ uriQuery: queryParams
1949
+ };
1950
+
1951
+ // Parse and merge iapMetadata fields into reqObj
1952
+ if (iapMetadata && typeof iapMetadata === 'object') {
1953
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
1954
+ }
1955
+
1956
+ try {
1957
+ // Make the call -
1958
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1959
+ return this.requestHandlerInst.identifyRequest('ApplicationProfileOperations', 'getAllApplicationProfiles', reqObj, true, (irReturnData, irReturnError) => {
1960
+ // if we received an error or their is no response on the results
1961
+ // return an error
1962
+ if (irReturnError) {
1963
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1964
+ return callback(null, irReturnError);
1965
+ }
1966
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1967
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllApplicationProfiles'], null, null, null);
1968
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1969
+ return callback(null, errorObj);
1970
+ }
1971
+
1972
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1973
+ // return the response
1974
+ return callback(irReturnData, null);
1975
+ });
1976
+ } catch (ex) {
1977
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1978
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1979
+ return callback(null, errorObj);
1980
+ }
1981
+ }
1982
+
1983
+ /**
1984
+ * @function getAllEPGs
1985
+ * @pronghornType method
1986
+ * @name getAllEPGs
1987
+ * @summary Get All EPGs
1988
+ *
1989
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
1990
+ * @param {getCallback} callback - a callback function to return the result
1991
+ * @return {object} results - An object containing the response of the action
1992
+ *
1993
+ * @route {GET} /getAllEPGs
1994
+ * @roles admin
1995
+ * @task true
1996
+ */
1997
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1998
+ getAllEPGs(iapMetadata, callback) {
1999
+ const meth = 'adapter-getAllEPGs';
2000
+ const origin = `${this.id}-${meth}`;
2001
+ log.trace(origin);
2002
+
2003
+ if (this.suspended && this.suspendMode === 'error') {
2004
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2005
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2006
+ return callback(null, errorObj);
2007
+ }
2008
+
2009
+ /* HERE IS WHERE YOU VALIDATE DATA */
2010
+
2011
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2012
+ const queryParamsAvailable = {};
2013
+ const queryParams = {};
2014
+ const pathVars = [];
2015
+ const bodyVars = {};
2016
+
2017
+ // loop in template. long callback arg name to avoid identifier conflicts
2018
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2019
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2020
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2021
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2022
+ }
2023
+ });
2024
+
2025
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2026
+ // see adapter code documentation for more information on the request object's fields
2027
+ let reqObj = {
2028
+ payload: bodyVars,
2029
+ uriPathVars: pathVars,
2030
+ uriQuery: queryParams
2031
+ };
2032
+
2033
+ // Parse and merge iapMetadata fields into reqObj
2034
+ if (iapMetadata && typeof iapMetadata === 'object') {
2035
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2036
+ }
2037
+
2038
+ try {
2039
+ // Make the call -
2040
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2041
+ return this.requestHandlerInst.identifyRequest('EPGOperations', 'getAllEPGs', reqObj, true, (irReturnData, irReturnError) => {
2042
+ // if we received an error or their is no response on the results
2043
+ // return an error
2044
+ if (irReturnError) {
2045
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2046
+ return callback(null, irReturnError);
2047
+ }
2048
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2049
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllEPGs'], null, null, null);
2050
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2051
+ return callback(null, errorObj);
2052
+ }
2053
+
2054
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2055
+ // return the response
2056
+ return callback(irReturnData, null);
2057
+ });
2058
+ } catch (ex) {
2059
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2060
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2061
+ return callback(null, errorObj);
2062
+ }
2063
+ }
2064
+
2065
+ /**
2066
+ * @function getEPGsInTenant
2067
+ * @pronghornType method
2068
+ * @name getEPGsInTenant
2069
+ * @summary Get EPGs in Tenant
2070
+ *
2071
+ * @param {string} queryTargetFilter - queryTargetFilter param
2072
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2073
+ * @param {getCallback} callback - a callback function to return the result
2074
+ * @return {object} results - An object containing the response of the action
2075
+ *
2076
+ * @route {POST} /getEPGsInTenant
2077
+ * @roles admin
2078
+ * @task true
2079
+ */
2080
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2081
+ getEPGsInTenant(queryTargetFilter, iapMetadata, callback) {
2082
+ const meth = 'adapter-getEPGsInTenant';
2083
+ const origin = `${this.id}-${meth}`;
2084
+ log.trace(origin);
2085
+
2086
+ if (this.suspended && this.suspendMode === 'error') {
2087
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2088
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2089
+ return callback(null, errorObj);
2090
+ }
2091
+
2092
+ /* HERE IS WHERE YOU VALIDATE DATA */
2093
+ if (queryTargetFilter === undefined || queryTargetFilter === null || queryTargetFilter === '') {
2094
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['queryTargetFilter'], null, null, null);
2095
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2096
+ return callback(null, errorObj);
2097
+ }
2098
+
2099
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2100
+ const queryParamsAvailable = { queryTargetFilter };
2101
+ const queryParams = {};
2102
+ const pathVars = [];
2103
+ const bodyVars = {};
2104
+
2105
+ // loop in template. long callback arg name to avoid identifier conflicts
2106
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2107
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2108
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2109
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2110
+ }
2111
+ });
2112
+
2113
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2114
+ // see adapter code documentation for more information on the request object's fields
2115
+ let reqObj = {
2116
+ payload: bodyVars,
2117
+ uriPathVars: pathVars,
2118
+ uriQuery: queryParams
2119
+ };
2120
+
2121
+ // Parse and merge iapMetadata fields into reqObj
2122
+ if (iapMetadata && typeof iapMetadata === 'object') {
2123
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2124
+ }
2125
+
2126
+ try {
2127
+ // Make the call -
2128
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2129
+ return this.requestHandlerInst.identifyRequest('EPGOperations', 'getEPGsInTenant', reqObj, true, (irReturnData, irReturnError) => {
2130
+ // if we received an error or their is no response on the results
2131
+ // return an error
2132
+ if (irReturnError) {
2133
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2134
+ return callback(null, irReturnError);
2135
+ }
2136
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2137
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getEPGsInTenant'], null, null, null);
2138
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2139
+ return callback(null, errorObj);
2140
+ }
2141
+
2142
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2143
+ // return the response
2144
+ return callback(irReturnData, null);
2145
+ });
2146
+ } catch (ex) {
2147
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2148
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2149
+ return callback(null, errorObj);
2150
+ }
2151
+ }
2152
+
2153
+ /**
2154
+ * @function createEPGWithVMM
2155
+ * @pronghornType method
2156
+ * @name createEPGWithVMM
2157
+ * @summary Create EPG with BD and VMM Association
2158
+ *
2159
+ * @param {string} tenantName - tenantName param
2160
+ * @param {string} appProfileName - appProfileName param
2161
+ * @param {object} body - body param
2162
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2163
+ * @param {getCallback} callback - a callback function to return the result
2164
+ * @return {object} results - An object containing the response of the action
2165
+ *
2166
+ * @route {POST} /createEPGWithVMM
2167
+ * @roles admin
2168
+ * @task true
2169
+ */
2170
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2171
+ createEPGWithVMM(tenantName, appProfileName, body, iapMetadata, callback) {
2172
+ const meth = 'adapter-createEPGWithVMM';
2173
+ const origin = `${this.id}-${meth}`;
2174
+ log.trace(origin);
2175
+
2176
+ if (this.suspended && this.suspendMode === 'error') {
2177
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2178
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2179
+ return callback(null, errorObj);
2180
+ }
2181
+
2182
+ /* HERE IS WHERE YOU VALIDATE DATA */
2183
+ if (tenantName === undefined || tenantName === null || tenantName === '') {
2184
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['tenantName'], null, null, null);
2185
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2186
+ return callback(null, errorObj);
2187
+ }
2188
+ if (appProfileName === undefined || appProfileName === null || appProfileName === '') {
2189
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['appProfileName'], null, null, null);
2190
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2191
+ return callback(null, errorObj);
2192
+ }
2193
+ if (body === undefined || body === null || body === '') {
2194
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2195
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2196
+ return callback(null, errorObj);
2197
+ }
2198
+
2199
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2200
+ const queryParamsAvailable = {};
2201
+ const queryParams = {};
2202
+ const pathVars = [tenantName, appProfileName];
2203
+ const bodyVars = body;
2204
+
2205
+ // loop in template. long callback arg name to avoid identifier conflicts
2206
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2207
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2208
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2209
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2210
+ }
2211
+ });
2212
+
2213
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2214
+ // see adapter code documentation for more information on the request object's fields
2215
+ let reqObj = {
2216
+ payload: bodyVars,
2217
+ uriPathVars: pathVars,
2218
+ uriQuery: queryParams
2219
+ };
2220
+
2221
+ // Parse and merge iapMetadata fields into reqObj
2222
+ if (iapMetadata && typeof iapMetadata === 'object') {
2223
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2224
+ }
2225
+
2226
+ try {
2227
+ // Make the call -
2228
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2229
+ return this.requestHandlerInst.identifyRequest('EPGOperations', 'createEPGWithVMM', reqObj, true, (irReturnData, irReturnError) => {
2230
+ // if we received an error or their is no response on the results
2231
+ // return an error
2232
+ if (irReturnError) {
2233
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2234
+ return callback(null, irReturnError);
2235
+ }
2236
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2237
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createEPGWithVMM'], null, null, null);
2238
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2239
+ return callback(null, errorObj);
2240
+ }
2241
+
2242
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2243
+ // return the response
2244
+ return callback(irReturnData, null);
2245
+ });
2246
+ } catch (ex) {
2247
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2248
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2249
+ return callback(null, errorObj);
2250
+ }
2251
+ }
2252
+
2253
+ /**
2254
+ * @function associateEPGWithVMM
2255
+ * @pronghornType method
2256
+ * @name associateEPGWithVMM
2257
+ * @summary Associate EPG with VMM Domain
2258
+ *
2259
+ * @param {string} tenantName - tenantName param
2260
+ * @param {string} appProfileName - appProfileName param
2261
+ * @param {string} epgName - epgName param
2262
+ * @param {object} body - body param
2263
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2264
+ * @param {getCallback} callback - a callback function to return the result
2265
+ * @return {object} results - An object containing the response of the action
2266
+ *
2267
+ * @route {POST} /associateEPGWithVMM
2268
+ * @roles admin
2269
+ * @task true
2270
+ */
2271
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2272
+ associateEPGWithVMM(tenantName, appProfileName, epgName, body, iapMetadata, callback) {
2273
+ const meth = 'adapter-associateEPGWithVMM';
2274
+ const origin = `${this.id}-${meth}`;
2275
+ log.trace(origin);
2276
+
2277
+ if (this.suspended && this.suspendMode === 'error') {
2278
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2279
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2280
+ return callback(null, errorObj);
2281
+ }
2282
+
2283
+ /* HERE IS WHERE YOU VALIDATE DATA */
2284
+ if (tenantName === undefined || tenantName === null || tenantName === '') {
2285
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['tenantName'], null, null, null);
2286
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2287
+ return callback(null, errorObj);
2288
+ }
2289
+ if (appProfileName === undefined || appProfileName === null || appProfileName === '') {
2290
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['appProfileName'], null, null, null);
2291
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2292
+ return callback(null, errorObj);
2293
+ }
2294
+ if (epgName === undefined || epgName === null || epgName === '') {
2295
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['epgName'], null, null, null);
2296
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2297
+ return callback(null, errorObj);
2298
+ }
2299
+ if (body === undefined || body === null || body === '') {
2300
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2301
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2302
+ return callback(null, errorObj);
2303
+ }
2304
+
2305
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2306
+ const queryParamsAvailable = {};
2307
+ const queryParams = {};
2308
+ const pathVars = [tenantName, appProfileName, epgName];
2309
+ const bodyVars = body;
2310
+
2311
+ // loop in template. long callback arg name to avoid identifier conflicts
2312
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2313
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2314
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2315
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2316
+ }
2317
+ });
2318
+
2319
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2320
+ // see adapter code documentation for more information on the request object's fields
2321
+ let reqObj = {
2322
+ payload: bodyVars,
2323
+ uriPathVars: pathVars,
2324
+ uriQuery: queryParams
2325
+ };
2326
+
2327
+ // Parse and merge iapMetadata fields into reqObj
2328
+ if (iapMetadata && typeof iapMetadata === 'object') {
2329
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2330
+ }
2331
+
2332
+ try {
2333
+ // Make the call -
2334
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2335
+ return this.requestHandlerInst.identifyRequest('EPGOperations', 'associateEPGWithVMM', reqObj, true, (irReturnData, irReturnError) => {
2336
+ // if we received an error or their is no response on the results
2337
+ // return an error
2338
+ if (irReturnError) {
2339
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2340
+ return callback(null, irReturnError);
2341
+ }
2342
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2343
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['associateEPGWithVMM'], null, null, null);
2344
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2345
+ return callback(null, errorObj);
2346
+ }
2347
+
2348
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2349
+ // return the response
2350
+ return callback(irReturnData, null);
2351
+ });
2352
+ } catch (ex) {
2353
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2354
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2355
+ return callback(null, errorObj);
2356
+ }
2357
+ }
2358
+
2359
+ /**
2360
+ * @function getAllVMMDomains
2361
+ * @pronghornType method
2362
+ * @name getAllVMMDomains
2363
+ * @summary Get All VMM Domains
2364
+ *
2365
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2366
+ * @param {getCallback} callback - a callback function to return the result
2367
+ * @return {object} results - An object containing the response of the action
2368
+ *
2369
+ * @route {GET} /getAllVMMDomains
2370
+ * @roles admin
2371
+ * @task true
2372
+ */
2373
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2374
+ getAllVMMDomains(iapMetadata, callback) {
2375
+ const meth = 'adapter-getAllVMMDomains';
2376
+ const origin = `${this.id}-${meth}`;
2377
+ log.trace(origin);
2378
+
2379
+ if (this.suspended && this.suspendMode === 'error') {
2380
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2381
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2382
+ return callback(null, errorObj);
2383
+ }
2384
+
2385
+ /* HERE IS WHERE YOU VALIDATE DATA */
2386
+
2387
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2388
+ const queryParamsAvailable = {};
2389
+ const queryParams = {};
2390
+ const pathVars = [];
2391
+ const bodyVars = {};
2392
+
2393
+ // loop in template. long callback arg name to avoid identifier conflicts
2394
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2395
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2396
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2397
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2398
+ }
2399
+ });
2400
+
2401
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2402
+ // see adapter code documentation for more information on the request object's fields
2403
+ let reqObj = {
2404
+ payload: bodyVars,
2405
+ uriPathVars: pathVars,
2406
+ uriQuery: queryParams
2407
+ };
2408
+
2409
+ // Parse and merge iapMetadata fields into reqObj
2410
+ if (iapMetadata && typeof iapMetadata === 'object') {
2411
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2412
+ }
2413
+
2414
+ try {
2415
+ // Make the call -
2416
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2417
+ return this.requestHandlerInst.identifyRequest('VMMDomainOperations', 'getAllVMMDomains', reqObj, true, (irReturnData, irReturnError) => {
2418
+ // if we received an error or their is no response on the results
2419
+ // return an error
2420
+ if (irReturnError) {
2421
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2422
+ return callback(null, irReturnError);
2423
+ }
2424
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2425
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllVMMDomains'], null, null, null);
2426
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2427
+ return callback(null, errorObj);
2428
+ }
2429
+
2430
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2431
+ // return the response
2432
+ return callback(irReturnData, null);
2433
+ });
2434
+ } catch (ex) {
2435
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2436
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2437
+ return callback(null, errorObj);
2438
+ }
2439
+ }
2440
+
2441
+ /**
2442
+ * @function getVMwareVMMDomains
2443
+ * @pronghornType method
2444
+ * @name getVMwareVMMDomains
2445
+ * @summary Get VMware VMM Domains
2446
+ *
2447
+ * @param {string} queryTargetFilter - queryTargetFilter param
2448
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2449
+ * @param {getCallback} callback - a callback function to return the result
2450
+ * @return {object} results - An object containing the response of the action
2451
+ *
2452
+ * @route {POST} /getVMwareVMMDomains
2453
+ * @roles admin
2454
+ * @task true
2455
+ */
2456
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2457
+ getVMwareVMMDomains(queryTargetFilter, iapMetadata, callback) {
2458
+ const meth = 'adapter-getVMwareVMMDomains';
2459
+ const origin = `${this.id}-${meth}`;
2460
+ log.trace(origin);
2461
+
2462
+ if (this.suspended && this.suspendMode === 'error') {
2463
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2464
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2465
+ return callback(null, errorObj);
2466
+ }
2467
+
2468
+ /* HERE IS WHERE YOU VALIDATE DATA */
2469
+ if (queryTargetFilter === undefined || queryTargetFilter === null || queryTargetFilter === '') {
2470
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['queryTargetFilter'], null, null, null);
2471
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2472
+ return callback(null, errorObj);
2473
+ }
2474
+
2475
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2476
+ const queryParamsAvailable = { queryTargetFilter };
2477
+ const queryParams = {};
2478
+ const pathVars = [];
2479
+ const bodyVars = {};
2480
+
2481
+ // loop in template. long callback arg name to avoid identifier conflicts
2482
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2483
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2484
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2485
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2486
+ }
2487
+ });
2488
+
2489
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2490
+ // see adapter code documentation for more information on the request object's fields
2491
+ let reqObj = {
2492
+ payload: bodyVars,
2493
+ uriPathVars: pathVars,
2494
+ uriQuery: queryParams
2495
+ };
2496
+
2497
+ // Parse and merge iapMetadata fields into reqObj
2498
+ if (iapMetadata && typeof iapMetadata === 'object') {
2499
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2500
+ }
2501
+
2502
+ try {
2503
+ // Make the call -
2504
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2505
+ return this.requestHandlerInst.identifyRequest('VMMDomainOperations', 'getVMwareVMMDomains', reqObj, true, (irReturnData, irReturnError) => {
2506
+ // if we received an error or their is no response on the results
2507
+ // return an error
2508
+ if (irReturnError) {
2509
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2510
+ return callback(null, irReturnError);
2511
+ }
2512
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2513
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getVMwareVMMDomains'], null, null, null);
2514
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2515
+ return callback(null, errorObj);
2516
+ }
2517
+
2518
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2519
+ // return the response
2520
+ return callback(irReturnData, null);
2521
+ });
2522
+ } catch (ex) {
2523
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2524
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2525
+ return callback(null, errorObj);
2526
+ }
2527
+ }
2528
+
2529
+ /**
2530
+ * @function getAllVLANPools
2531
+ * @pronghornType method
2532
+ * @name getAllVLANPools
2533
+ * @summary Get All VLAN Pools
2534
+ *
2535
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2536
+ * @param {getCallback} callback - a callback function to return the result
2537
+ * @return {object} results - An object containing the response of the action
2538
+ *
2539
+ * @route {GET} /getAllVLANPools
2540
+ * @roles admin
2541
+ * @task true
2542
+ */
2543
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2544
+ getAllVLANPools(iapMetadata, callback) {
2545
+ const meth = 'adapter-getAllVLANPools';
2546
+ const origin = `${this.id}-${meth}`;
2547
+ log.trace(origin);
2548
+
2549
+ if (this.suspended && this.suspendMode === 'error') {
2550
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2551
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2552
+ return callback(null, errorObj);
2553
+ }
2554
+
2555
+ /* HERE IS WHERE YOU VALIDATE DATA */
2556
+
2557
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2558
+ const queryParamsAvailable = {};
2559
+ const queryParams = {};
2560
+ const pathVars = [];
2561
+ const bodyVars = {};
2562
+
2563
+ // loop in template. long callback arg name to avoid identifier conflicts
2564
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2565
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2566
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2567
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2568
+ }
2569
+ });
2570
+
2571
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2572
+ // see adapter code documentation for more information on the request object's fields
2573
+ let reqObj = {
2574
+ payload: bodyVars,
2575
+ uriPathVars: pathVars,
2576
+ uriQuery: queryParams
2577
+ };
2578
+
2579
+ // Parse and merge iapMetadata fields into reqObj
2580
+ if (iapMetadata && typeof iapMetadata === 'object') {
2581
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2582
+ }
2583
+
2584
+ try {
2585
+ // Make the call -
2586
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2587
+ return this.requestHandlerInst.identifyRequest('VLANPoolOperations', 'getAllVLANPools', reqObj, true, (irReturnData, irReturnError) => {
2588
+ // if we received an error or their is no response on the results
2589
+ // return an error
2590
+ if (irReturnError) {
2591
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2592
+ return callback(null, irReturnError);
2593
+ }
2594
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2595
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllVLANPools'], null, null, null);
2596
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2597
+ return callback(null, errorObj);
2598
+ }
2599
+
2600
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2601
+ // return the response
2602
+ return callback(irReturnData, null);
2603
+ });
2604
+ } catch (ex) {
2605
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2606
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2607
+ return callback(null, errorObj);
2608
+ }
2609
+ }
2610
+
2611
+ /**
2612
+ * @function createDynamicVLANPool
2613
+ * @pronghornType method
2614
+ * @name createDynamicVLANPool
2615
+ * @summary Create Dynamic VLAN Pool
2616
+ *
2617
+ * @param {string} vlanPoolName - vlanPoolName param
2618
+ * @param {object} body - body param
2619
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2620
+ * @param {getCallback} callback - a callback function to return the result
2621
+ * @return {object} results - An object containing the response of the action
2622
+ *
2623
+ * @route {POST} /createDynamicVLANPool
2624
+ * @roles admin
2625
+ * @task true
2626
+ */
2627
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2628
+ createDynamicVLANPool(vlanPoolName, body, iapMetadata, callback) {
2629
+ const meth = 'adapter-createDynamicVLANPool';
2630
+ const origin = `${this.id}-${meth}`;
2631
+ log.trace(origin);
2632
+
2633
+ if (this.suspended && this.suspendMode === 'error') {
2634
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2635
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2636
+ return callback(null, errorObj);
2637
+ }
2638
+
2639
+ /* HERE IS WHERE YOU VALIDATE DATA */
2640
+ if (vlanPoolName === undefined || vlanPoolName === null || vlanPoolName === '') {
2641
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vlanPoolName'], null, null, null);
2642
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2643
+ return callback(null, errorObj);
2644
+ }
2645
+ if (body === undefined || body === null || body === '') {
2646
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2647
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2648
+ return callback(null, errorObj);
2649
+ }
2650
+
2651
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2652
+ const queryParamsAvailable = {};
2653
+ const queryParams = {};
2654
+ const pathVars = [vlanPoolName];
2655
+ const bodyVars = body;
2656
+
2657
+ // loop in template. long callback arg name to avoid identifier conflicts
2658
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2659
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2660
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2661
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2662
+ }
2663
+ });
2664
+
2665
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2666
+ // see adapter code documentation for more information on the request object's fields
2667
+ let reqObj = {
2668
+ payload: bodyVars,
2669
+ uriPathVars: pathVars,
2670
+ uriQuery: queryParams
2671
+ };
2672
+
2673
+ // Parse and merge iapMetadata fields into reqObj
2674
+ if (iapMetadata && typeof iapMetadata === 'object') {
2675
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2676
+ }
2677
+
2678
+ try {
2679
+ // Make the call -
2680
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2681
+ return this.requestHandlerInst.identifyRequest('VLANPoolOperations', 'createDynamicVLANPool', reqObj, true, (irReturnData, irReturnError) => {
2682
+ // if we received an error or their is no response on the results
2683
+ // return an error
2684
+ if (irReturnError) {
2685
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2686
+ return callback(null, irReturnError);
2687
+ }
2688
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2689
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createDynamicVLANPool'], null, null, null);
2690
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2691
+ return callback(null, errorObj);
2692
+ }
2693
+
2694
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2695
+ // return the response
2696
+ return callback(irReturnData, null);
2697
+ });
2698
+ } catch (ex) {
2699
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2700
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2701
+ return callback(null, errorObj);
2702
+ }
2703
+ }
2704
+
2705
+ /**
2706
+ * @function getVLANPoolDetails
2707
+ * @pronghornType method
2708
+ * @name getVLANPoolDetails
2709
+ * @summary Get VLAN Pool Details
2710
+ *
2711
+ * @param {string} vlanPoolName - vlanPoolName param
2712
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2713
+ * @param {getCallback} callback - a callback function to return the result
2714
+ * @return {object} results - An object containing the response of the action
2715
+ *
2716
+ * @route {POST} /getVLANPoolDetails
2717
+ * @roles admin
2718
+ * @task true
2719
+ */
2720
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2721
+ getVLANPoolDetails(vlanPoolName, iapMetadata, callback) {
2722
+ const meth = 'adapter-getVLANPoolDetails';
2723
+ const origin = `${this.id}-${meth}`;
2724
+ log.trace(origin);
2725
+
2726
+ if (this.suspended && this.suspendMode === 'error') {
2727
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2728
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2729
+ return callback(null, errorObj);
2730
+ }
2731
+
2732
+ /* HERE IS WHERE YOU VALIDATE DATA */
2733
+ if (vlanPoolName === undefined || vlanPoolName === null || vlanPoolName === '') {
2734
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vlanPoolName'], null, null, null);
2735
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2736
+ return callback(null, errorObj);
2737
+ }
2738
+
2739
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2740
+ const queryParamsAvailable = {};
2741
+ const queryParams = {};
2742
+ const pathVars = [vlanPoolName];
2743
+ const bodyVars = {};
2744
+
2745
+ // loop in template. long callback arg name to avoid identifier conflicts
2746
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2747
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2748
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2749
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2750
+ }
2751
+ });
2752
+
2753
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2754
+ // see adapter code documentation for more information on the request object's fields
2755
+ let reqObj = {
2756
+ payload: bodyVars,
2757
+ uriPathVars: pathVars,
2758
+ uriQuery: queryParams
2759
+ };
2760
+
2761
+ // Parse and merge iapMetadata fields into reqObj
2762
+ if (iapMetadata && typeof iapMetadata === 'object') {
2763
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2764
+ }
2765
+
2766
+ try {
2767
+ // Make the call -
2768
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2769
+ return this.requestHandlerInst.identifyRequest('VLANPoolOperations', 'getVLANPoolDetails', reqObj, true, (irReturnData, irReturnError) => {
2770
+ // if we received an error or their is no response on the results
2771
+ // return an error
2772
+ if (irReturnError) {
2773
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2774
+ return callback(null, irReturnError);
2775
+ }
2776
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2777
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getVLANPoolDetails'], null, null, null);
2778
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2779
+ return callback(null, errorObj);
2780
+ }
2781
+
2782
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2783
+ // return the response
2784
+ return callback(irReturnData, null);
2785
+ });
2786
+ } catch (ex) {
2787
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2788
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2789
+ return callback(null, errorObj);
2790
+ }
2791
+ }
2792
+
2793
+ /**
2794
+ * @function createStaticVLANPool
2795
+ * @pronghornType method
2796
+ * @name createStaticVLANPool
2797
+ * @summary Create Static VLAN Pool
2798
+ *
2799
+ * @param {string} vlanPoolName - vlanPoolName param
2800
+ * @param {object} body - body param
2801
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2802
+ * @param {getCallback} callback - a callback function to return the result
2803
+ * @return {object} results - An object containing the response of the action
2804
+ *
2805
+ * @route {POST} /createStaticVLANPool
2806
+ * @roles admin
2807
+ * @task true
2808
+ */
2809
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2810
+ createStaticVLANPool(vlanPoolName, body, iapMetadata, callback) {
2811
+ const meth = 'adapter-createStaticVLANPool';
2812
+ const origin = `${this.id}-${meth}`;
2813
+ log.trace(origin);
2814
+
2815
+ if (this.suspended && this.suspendMode === 'error') {
2816
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2817
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2818
+ return callback(null, errorObj);
2819
+ }
2820
+
2821
+ /* HERE IS WHERE YOU VALIDATE DATA */
2822
+ if (vlanPoolName === undefined || vlanPoolName === null || vlanPoolName === '') {
2823
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vlanPoolName'], null, null, null);
2824
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2825
+ return callback(null, errorObj);
2826
+ }
2827
+ if (body === undefined || body === null || body === '') {
2828
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2829
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2830
+ return callback(null, errorObj);
2831
+ }
2832
+
2833
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2834
+ const queryParamsAvailable = {};
2835
+ const queryParams = {};
2836
+ const pathVars = [vlanPoolName];
2837
+ const bodyVars = body;
2838
+
2839
+ // loop in template. long callback arg name to avoid identifier conflicts
2840
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2841
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2842
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2843
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2844
+ }
2845
+ });
2846
+
2847
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2848
+ // see adapter code documentation for more information on the request object's fields
2849
+ let reqObj = {
2850
+ payload: bodyVars,
2851
+ uriPathVars: pathVars,
2852
+ uriQuery: queryParams
2853
+ };
2854
+
2855
+ // Parse and merge iapMetadata fields into reqObj
2856
+ if (iapMetadata && typeof iapMetadata === 'object') {
2857
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2858
+ }
2859
+
2860
+ try {
2861
+ // Make the call -
2862
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2863
+ return this.requestHandlerInst.identifyRequest('VLANPoolOperations', 'createStaticVLANPool', reqObj, true, (irReturnData, irReturnError) => {
2864
+ // if we received an error or their is no response on the results
2865
+ // return an error
2866
+ if (irReturnError) {
2867
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2868
+ return callback(null, irReturnError);
2869
+ }
2870
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2871
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createStaticVLANPool'], null, null, null);
2872
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2873
+ return callback(null, errorObj);
2874
+ }
2875
+
2876
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2877
+ // return the response
2878
+ return callback(irReturnData, null);
2879
+ });
2880
+ } catch (ex) {
2881
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2882
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2883
+ return callback(null, errorObj);
2884
+ }
2885
+ }
2886
+
2887
+ /**
2888
+ * @function associateVLANPoolWithVMM
2889
+ * @pronghornType method
2890
+ * @name associateVLANPoolWithVMM
2891
+ * @summary Associate VLAN Pool with VMM Domain
2892
+ *
2893
+ * @param {string} vmmDomainName - vmmDomainName param
2894
+ * @param {object} body - body param
2895
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2896
+ * @param {getCallback} callback - a callback function to return the result
2897
+ * @return {object} results - An object containing the response of the action
2898
+ *
2899
+ * @route {POST} /associateVLANPoolWithVMM
2900
+ * @roles admin
2901
+ * @task true
2902
+ */
2903
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2904
+ associateVLANPoolWithVMM(vmmDomainName, body, iapMetadata, callback) {
2905
+ const meth = 'adapter-associateVLANPoolWithVMM';
2906
+ const origin = `${this.id}-${meth}`;
2907
+ log.trace(origin);
2908
+
2909
+ if (this.suspended && this.suspendMode === 'error') {
2910
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2911
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2912
+ return callback(null, errorObj);
2913
+ }
2914
+
2915
+ /* HERE IS WHERE YOU VALIDATE DATA */
2916
+ if (vmmDomainName === undefined || vmmDomainName === null || vmmDomainName === '') {
2917
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vmmDomainName'], null, null, null);
2918
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2919
+ return callback(null, errorObj);
2920
+ }
2921
+ if (body === undefined || body === null || body === '') {
2922
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2923
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2924
+ return callback(null, errorObj);
2925
+ }
2926
+
2927
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2928
+ const queryParamsAvailable = {};
2929
+ const queryParams = {};
2930
+ const pathVars = [vmmDomainName];
2931
+ const bodyVars = body;
2932
+
2933
+ // loop in template. long callback arg name to avoid identifier conflicts
2934
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2935
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2936
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2937
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2938
+ }
2939
+ });
2940
+
2941
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
2942
+ // see adapter code documentation for more information on the request object's fields
2943
+ let reqObj = {
2944
+ payload: bodyVars,
2945
+ uriPathVars: pathVars,
2946
+ uriQuery: queryParams
2947
+ };
2948
+
2949
+ // Parse and merge iapMetadata fields into reqObj
2950
+ if (iapMetadata && typeof iapMetadata === 'object') {
2951
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
2952
+ }
2953
+
2954
+ try {
2955
+ // Make the call -
2956
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2957
+ return this.requestHandlerInst.identifyRequest('VLANPoolOperations', 'associateVLANPoolWithVMM', reqObj, true, (irReturnData, irReturnError) => {
2958
+ // if we received an error or their is no response on the results
2959
+ // return an error
2960
+ if (irReturnError) {
2961
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
2962
+ return callback(null, irReturnError);
2963
+ }
2964
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2965
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['associateVLANPoolWithVMM'], null, null, null);
2966
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2967
+ return callback(null, errorObj);
2968
+ }
2969
+
2970
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
2971
+ // return the response
2972
+ return callback(irReturnData, null);
2973
+ });
2974
+ } catch (ex) {
2975
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
2976
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2977
+ return callback(null, errorObj);
2978
+ }
2979
+ }
2980
+
2981
+ /**
2982
+ * @function getVMMDomainVLANPoolAssociation
2983
+ * @pronghornType method
2984
+ * @name getVMMDomainVLANPoolAssociation
2985
+ * @summary Get VMM Domain VLAN Pool Association
2986
+ *
2987
+ * @param {string} vmmDomainName - vmmDomainName param
2988
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
2989
+ * @param {getCallback} callback - a callback function to return the result
2990
+ * @return {object} results - An object containing the response of the action
2991
+ *
2992
+ * @route {POST} /getVMMDomainVLANPoolAssociation
2993
+ * @roles admin
2994
+ * @task true
2995
+ */
2996
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2997
+ getVMMDomainVLANPoolAssociation(vmmDomainName, iapMetadata, callback) {
2998
+ const meth = 'adapter-getVMMDomainVLANPoolAssociation';
2999
+ const origin = `${this.id}-${meth}`;
3000
+ log.trace(origin);
3001
+
3002
+ if (this.suspended && this.suspendMode === 'error') {
3003
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3004
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3005
+ return callback(null, errorObj);
3006
+ }
3007
+
3008
+ /* HERE IS WHERE YOU VALIDATE DATA */
3009
+ if (vmmDomainName === undefined || vmmDomainName === null || vmmDomainName === '') {
3010
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vmmDomainName'], null, null, null);
3011
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3012
+ return callback(null, errorObj);
3013
+ }
3014
+
3015
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
3016
+ const queryParamsAvailable = {};
3017
+ const queryParams = {};
3018
+ const pathVars = [vmmDomainName];
3019
+ const bodyVars = {};
3020
+
3021
+ // loop in template. long callback arg name to avoid identifier conflicts
3022
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
3023
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
3024
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3025
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
3026
+ }
3027
+ });
3028
+
3029
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
3030
+ // see adapter code documentation for more information on the request object's fields
3031
+ let reqObj = {
3032
+ payload: bodyVars,
3033
+ uriPathVars: pathVars,
3034
+ uriQuery: queryParams
3035
+ };
3036
+
3037
+ // Parse and merge iapMetadata fields into reqObj
3038
+ if (iapMetadata && typeof iapMetadata === 'object') {
3039
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
3040
+ }
3041
+
3042
+ try {
3043
+ // Make the call -
3044
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
3045
+ return this.requestHandlerInst.identifyRequest('VLANPoolOperations', 'getVMMDomainVLANPoolAssociation', reqObj, true, (irReturnData, irReturnError) => {
3046
+ // if we received an error or their is no response on the results
3047
+ // return an error
3048
+ if (irReturnError) {
3049
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
3050
+ return callback(null, irReturnError);
3051
+ }
3052
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
3053
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getVMMDomainVLANPoolAssociation'], null, null, null);
3054
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3055
+ return callback(null, errorObj);
3056
+ }
3057
+
3058
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
3059
+ // return the response
3060
+ return callback(irReturnData, null);
3061
+ });
3062
+ } catch (ex) {
3063
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
3064
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3065
+ return callback(null, errorObj);
3066
+ }
3067
+ }
3068
+
3069
+ /**
3070
+ * @function addVLANRangeToPool
3071
+ * @pronghornType method
3072
+ * @name addVLANRangeToPool
3073
+ * @summary Add VLAN Range to Existing Pool
3074
+ *
3075
+ * @param {string} vlanPoolName - vlanPoolName param
3076
+ * @param {string} vlanStart - vlanStart param
3077
+ * @param {string} vlanEnd - vlanEnd param
3078
+ * @param {object} body - body param
3079
+ * @param {object} iapMetadata - IAP Metadata object contains additional info needed for the request: payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, etc.
3080
+ * @param {getCallback} callback - a callback function to return the result
3081
+ * @return {object} results - An object containing the response of the action
3082
+ *
3083
+ * @route {POST} /addVLANRangeToPool
3084
+ * @roles admin
3085
+ * @task true
3086
+ */
3087
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
3088
+ addVLANRangeToPool(vlanPoolName, vlanStart, vlanEnd, body, iapMetadata, callback) {
3089
+ const meth = 'adapter-addVLANRangeToPool';
3090
+ const origin = `${this.id}-${meth}`;
3091
+ log.trace(origin);
3092
+
3093
+ if (this.suspended && this.suspendMode === 'error') {
3094
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3095
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3096
+ return callback(null, errorObj);
3097
+ }
3098
+
3099
+ /* HERE IS WHERE YOU VALIDATE DATA */
3100
+ if (vlanPoolName === undefined || vlanPoolName === null || vlanPoolName === '') {
3101
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vlanPoolName'], null, null, null);
3102
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3103
+ return callback(null, errorObj);
3104
+ }
3105
+ if (vlanStart === undefined || vlanStart === null || vlanStart === '') {
3106
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vlanStart'], null, null, null);
3107
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3108
+ return callback(null, errorObj);
3109
+ }
3110
+ if (vlanEnd === undefined || vlanEnd === null || vlanEnd === '') {
3111
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vlanEnd'], null, null, null);
3112
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3113
+ return callback(null, errorObj);
3114
+ }
3115
+ if (body === undefined || body === null || body === '') {
3116
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
3117
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3118
+ return callback(null, errorObj);
3119
+ }
3120
+
3121
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
3122
+ const queryParamsAvailable = {};
3123
+ const queryParams = {};
3124
+ const pathVars = [vlanPoolName, vlanStart, vlanEnd];
3125
+ const bodyVars = body;
3126
+
3127
+ // loop in template. long callback arg name to avoid identifier conflicts
3128
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
3129
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
3130
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3131
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
3132
+ }
3133
+ });
3134
+
3135
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
3136
+ // see adapter code documentation for more information on the request object's fields
3137
+ let reqObj = {
3138
+ payload: bodyVars,
3139
+ uriPathVars: pathVars,
3140
+ uriQuery: queryParams
3141
+ };
3142
+
3143
+ // Parse and merge iapMetadata fields into reqObj
3144
+ if (iapMetadata && typeof iapMetadata === 'object') {
3145
+ reqObj = this.parseIapMetadata(reqObj, iapMetadata);
3146
+ }
3147
+
3148
+ try {
3149
+ // Make the call -
3150
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
3151
+ return this.requestHandlerInst.identifyRequest('VLANPoolOperations', 'addVLANRangeToPool', reqObj, true, (irReturnData, irReturnError) => {
3152
+ // if we received an error or their is no response on the results
3153
+ // return an error
3154
+ if (irReturnError) {
3155
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
3156
+ return callback(null, irReturnError);
3157
+ }
3158
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
3159
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addVLANRangeToPool'], null, null, null);
3160
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3161
+ return callback(null, errorObj);
3162
+ }
3163
+
3164
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
3165
+ // return the response
3166
+ return callback(irReturnData, null);
3167
+ });
3168
+ } catch (ex) {
3169
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
3170
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3171
+ return callback(null, errorObj);
3172
+ }
3173
+ }
1096
3174
  }
1097
3175
 
1098
3176
  module.exports = Apic;