@itentialopensource/adapter-infoblox 1.12.2 → 1.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,20 @@
1
1
 
2
+ ## 1.12.4 [05-18-2023]
3
+
4
+ * added call to list network containers
5
+
6
+ See merge request itentialopensource/adapters/inventory/adapter-infoblox!28
7
+
8
+ ---
9
+
10
+ ## 1.12.3 [04-06-2023]
11
+
12
+ * updated adapter utils version
13
+
14
+ See merge request itentialopensource/adapters/inventory/adapter-infoblox!26
15
+
16
+ ---
17
+
2
18
  ## 1.12.2 [03-24-2023]
3
19
 
4
20
  * updated adapter utils version
package/adapter.js CHANGED
@@ -1495,6 +1495,72 @@ class Infoblox extends AdapterBaseCl {
1495
1495
  }
1496
1496
  }
1497
1497
 
1498
+ /**
1499
+ * @summary This function will get the list of network containers
1500
+ *
1501
+ * @function listNetworkContainers
1502
+ * @param {object} query - optional query params for request
1503
+ * @param {getCallback} callback - a callback function to return the result
1504
+ * (entities) or the error
1505
+ */
1506
+ listNetworkContainers(query, callback) {
1507
+ const meth = 'adapter-listNetworkContainers';
1508
+ const origin = `${this.id}-${meth}`;
1509
+ log.trace(origin);
1510
+
1511
+ if (this.suspended && this.suspendMode === 'error') {
1512
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1513
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1514
+ return callback(null, errorObj);
1515
+ }
1516
+
1517
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1518
+ const queryParamsAvailable = {};
1519
+ const queryParams = {};
1520
+ const pathVars = [];
1521
+ const bodyVars = {};
1522
+ if (query) {
1523
+ Object.assign(queryParamsAvailable, query);
1524
+ }
1525
+
1526
+ // loop in template. long callback arg name to avoid identifier conflicts
1527
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1528
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1529
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1530
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1531
+ }
1532
+ });
1533
+
1534
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1535
+ // see adapter code documentation for more information on the request object's fields
1536
+ const reqObj = {
1537
+ payload: bodyVars,
1538
+ uriPathVars: pathVars,
1539
+ uriQuery: queryParams
1540
+ };
1541
+
1542
+ try {
1543
+ // Make the call -
1544
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1545
+ return this.requestHandlerInst.identifyRequest('Networks', 'listNetworkContainers', reqObj, true, (irReturnData, irReturnError) => {
1546
+ // if we received an error or their is no response on the results
1547
+ // return an error
1548
+ if (irReturnError) {
1549
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1550
+ return callback(null, irReturnError);
1551
+ }
1552
+
1553
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1554
+ // return the response
1555
+ return callback(irReturnData);
1556
+ });
1557
+ } catch (ex) {
1558
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1559
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1560
+ return callback(null, errorObj);
1561
+ }
1562
+ }
1563
+
1498
1564
  /**
1499
1565
  * @summary This function will get the auth zone details
1500
1566
  *
@@ -104,6 +104,27 @@
104
104
  }
105
105
  ]
106
106
  },
107
+ {
108
+ "name": "listNetworkContainers",
109
+ "protocol": "REST",
110
+ "method": "GET",
111
+ "entitypath": "{base_path}/{version}/networkcontainer?{query}",
112
+ "requestSchema": "requestSchema.json",
113
+ "responseSchema": "responseSchema.json",
114
+ "timeout": 0,
115
+ "sendEmpty": false,
116
+ "sendGetBody": false,
117
+ "requestDatatype": "JSON",
118
+ "responseDatatype": "JSON",
119
+ "headers": {},
120
+ "responseObjects": [
121
+ {
122
+ "type": "default",
123
+ "key": "",
124
+ "mockFile": "mockdatafiles/listNetworkContainers.json"
125
+ }
126
+ ]
127
+ },
107
128
  {
108
129
  "name": "createNetworkContainer",
109
130
  "protocol": "REST",
@@ -0,0 +1,6 @@
1
+ [{
2
+ "_ref": "network/ZG5zLm5ldHdvcmskMy4xLjEuMC8yNC8w:3.1.1.0/24/default",
3
+ "comment": "For test purpose",
4
+ "network": "3.1.1.0/24",
5
+ "network_view": "default"
6
+ }]
@@ -29,7 +29,8 @@
29
29
  "getNetworkContainerNextNetworkIps",
30
30
  "getIpv6NetworkContainerNextNetworkIps",
31
31
  "getNetworkZoneAssociations",
32
- "addNetworkZoneAssociation"
32
+ "addNetworkZoneAssociation",
33
+ "listNetworkContainers"
33
34
  ],
34
35
  "external_name": "ph_request_type"
35
36
  },
@@ -27,7 +27,8 @@
27
27
  "getNetworkContainerNextNetworkIps",
28
28
  "getIpv6NetworkContainerNextNetworkIps",
29
29
  "getNetworkZoneAssociations",
30
- "addNetworkZoneAssociation"
30
+ "addNetworkZoneAssociation",
31
+ "listNetworkContainers"
31
32
  ],
32
33
  "external_name": "ph_request_type"
33
34
  },
@@ -15,6 +15,7 @@
15
15
  "getNetworkDetails",
16
16
  "createNetwork",
17
17
  "getNetworkContainerDetails",
18
+ "listNetworkContainers",
18
19
  "createNetworkContainer",
19
20
  "deleteNetworkContainer",
20
21
  "genericCreateNextAvailableNetwork",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-infoblox",
3
- "version": "1.12.2",
3
+ "version": "1.12.4",
4
4
  "description": "Itential Infoblox Adapter",
5
5
  "main": "adapter.js",
6
6
  "systemName": "Infoblox",
@@ -57,7 +57,7 @@
57
57
  "author": "Itential",
58
58
  "homepage": "https://gitlab.com/itentialopensource/adapters/inventory/adapter-infoblox#readme",
59
59
  "dependencies": {
60
- "@itentialopensource/adapter-utils": "^4.48.10",
60
+ "@itentialopensource/adapter-utils": "^4.48.13",
61
61
  "ajv": "^6.12.0",
62
62
  "axios": "^0.21.0",
63
63
  "commander": "^2.20.0",
package/pronghorn.json CHANGED
@@ -1213,6 +1213,40 @@
1213
1213
  },
1214
1214
  "task": true
1215
1215
  },
1216
+ {
1217
+ "name": "listNetworkContainers",
1218
+ "summary": "listNetworkContainers",
1219
+ "description": "listNetworkContainers will get a list of containers",
1220
+ "input": [ {
1221
+ "name": "query",
1222
+ "type": "object",
1223
+ "info": "query parameters for the request, e.g.: _schema, _return_type, _return_fields, _method...",
1224
+ "required": false,
1225
+ "schema": {
1226
+ "title": "query",
1227
+ "type": "object"
1228
+ }
1229
+ }
1230
+ ],
1231
+ "output": {
1232
+ "type": "object",
1233
+ "name": "result",
1234
+ "description": "",
1235
+ "schema": {
1236
+ "title": "result",
1237
+ "type": "object"
1238
+ }
1239
+ },
1240
+ "roles": [
1241
+ "admin",
1242
+ "pronghorn_admin"
1243
+ ],
1244
+ "route": {
1245
+ "verb": "POST",
1246
+ "path": "/listNetworkContainers"
1247
+ },
1248
+ "task": true
1249
+ },
1216
1250
  {
1217
1251
  "name": "getNetworkContainerDetailsWithQuery",
1218
1252
  "summary": "getNetworkContainerDetails",
Binary file
@@ -1188,6 +1188,29 @@ describe('[integration] Infoblox Adapter Test', () => {
1188
1188
  }
1189
1189
  }).timeout(attemptTimeout);
1190
1190
  });
1191
+ describe('#listNetworkContainers - errors', () => {
1192
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1193
+ try {
1194
+ a.listNetworkContainers({ key: 'fakedata' }, (data, error) => {
1195
+ try {
1196
+ if (stub) {
1197
+ runCommonAsserts(data, error);
1198
+ } else {
1199
+ runCommonAsserts(data, error);
1200
+ }
1201
+ saveMockData('Networks', 'listNetworkContainers', 'default', data);
1202
+ done();
1203
+ } catch (err) {
1204
+ log.error(`Test Failure: ${err}`);
1205
+ done(err);
1206
+ }
1207
+ });
1208
+ } catch (error) {
1209
+ log.error(`Adapter Exception: ${error}`);
1210
+ done(error);
1211
+ }
1212
+ }).timeout(attemptTimeout);
1213
+ });
1191
1214
 
1192
1215
  const networksObjectReference = 'fakedata';
1193
1216
 
@@ -2225,6 +2225,18 @@ describe('[unit] Infoblox Adapter Test', () => {
2225
2225
  }).timeout(attemptTimeout);
2226
2226
  });
2227
2227
 
2228
+ describe('#listNetworkContainers - errors', () => {
2229
+ it('should have a listNetworkContainers function', (done) => {
2230
+ try {
2231
+ assert.equal(true, typeof a.listNetworkContainers === 'function');
2232
+ done();
2233
+ } catch (error) {
2234
+ log.error(`Test Failure: ${error}`);
2235
+ done(error);
2236
+ }
2237
+ }).timeout(attemptTimeout);
2238
+ });
2239
+
2228
2240
  describe('#createNetworkContainer - errors', () => {
2229
2241
  it('should have a createNetworkContainer function', (done) => {
2230
2242
  try {