@itentialopensource/adapter-zscaler 0.7.0 → 0.8.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/CALLS.md +342 -0
- package/CHANGELOG.md +3 -112
- package/CONTRIBUTING.md +1 -160
- package/ENHANCE.md +2 -2
- package/README.md +32 -23
- package/adapter.js +157 -329
- package/adapterBase.js +549 -879
- package/changelogs/CHANGELOG.md +118 -0
- package/metadata.json +49 -0
- package/package.json +24 -25
- package/pronghorn.json +981 -642
- package/propertiesSchema.json +431 -31
- package/refs?service=git-upload-pack +0 -0
- package/report/adapter-openapi.json +1828 -0
- package/report/adapter-openapi.yaml +1462 -0
- package/report/adapterInfo.json +8 -8
- package/report/updateReport1691508819418.json +120 -0
- package/report/updateReport1692203278243.json +120 -0
- package/report/updateReport1694468959859.json +120 -0
- package/report/updateReport1698422816279.json +120 -0
- package/sampleProperties.json +63 -2
- package/test/integration/adapterTestBasicGet.js +2 -4
- package/test/integration/adapterTestConnectivity.js +91 -42
- package/test/integration/adapterTestIntegration.js +130 -2
- package/test/unit/adapterBaseTestUnit.js +388 -313
- package/test/unit/adapterTestUnit.js +338 -112
- package/utils/adapterInfo.js +1 -1
- package/utils/addAuth.js +1 -1
- package/utils/artifactize.js +1 -1
- package/utils/checkMigrate.js +1 -1
- package/utils/entitiesToDB.js +2 -2
- package/utils/findPath.js +1 -1
- package/utils/methodDocumentor.js +273 -0
- package/utils/modify.js +13 -15
- package/utils/packModificationScript.js +1 -1
- package/utils/pre-commit.sh +2 -0
- package/utils/taskMover.js +309 -0
- package/utils/tbScript.js +89 -34
- package/utils/tbUtils.js +41 -21
- package/utils/testRunner.js +1 -1
- package/utils/troubleshootingAdapter.js +9 -6
- package/workflows/README.md +0 -3
package/adapter.js
CHANGED
|
@@ -88,9 +88,6 @@ class Zscaler extends AdapterBaseCl {
|
|
|
88
88
|
let myIgnore = [
|
|
89
89
|
'healthCheck',
|
|
90
90
|
'iapGetAdapterWorkflowFunctions',
|
|
91
|
-
'iapHasAdapterEntity',
|
|
92
|
-
'iapVerifyAdapterCapability',
|
|
93
|
-
'iapUpdateAdapterEntityCache',
|
|
94
91
|
'hasEntities',
|
|
95
92
|
'getAuthorization',
|
|
96
93
|
'getObfuscatedKey'
|
|
@@ -119,29 +116,15 @@ class Zscaler extends AdapterBaseCl {
|
|
|
119
116
|
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
|
|
120
117
|
* @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
|
|
121
118
|
* @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
|
|
119
|
+
* @param {boolean} replace - true to replace entire mock data, false to merge/append
|
|
122
120
|
* @param {Callback} callback - The results of the call
|
|
123
121
|
*/
|
|
124
|
-
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
|
|
122
|
+
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
|
|
125
123
|
const meth = 'adapter-iapUpdateAdapterConfiguration';
|
|
126
124
|
const origin = `${this.id}-${meth}`;
|
|
127
125
|
log.trace(origin);
|
|
128
126
|
|
|
129
|
-
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* See if the API path provided is found in this adapter
|
|
134
|
-
*
|
|
135
|
-
* @function iapFindAdapterPath
|
|
136
|
-
* @param {string} apiPath - the api path to check on
|
|
137
|
-
* @param {Callback} callback - The results of the call
|
|
138
|
-
*/
|
|
139
|
-
iapFindAdapterPath(apiPath, callback) {
|
|
140
|
-
const meth = 'adapter-iapFindAdapterPath';
|
|
141
|
-
const origin = `${this.id}-${meth}`;
|
|
142
|
-
log.trace(origin);
|
|
143
|
-
|
|
144
|
-
super.iapFindAdapterPath(apiPath, callback);
|
|
127
|
+
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
|
|
145
128
|
}
|
|
146
129
|
|
|
147
130
|
/**
|
|
@@ -183,7 +166,7 @@ class Zscaler extends AdapterBaseCl {
|
|
|
183
166
|
}
|
|
184
167
|
|
|
185
168
|
/**
|
|
186
|
-
* @summary Get the
|
|
169
|
+
* @summary Get the Adapter Queue
|
|
187
170
|
*
|
|
188
171
|
* @function iapGetAdapterQueue
|
|
189
172
|
* @param {Callback} callback - callback function
|
|
@@ -196,6 +179,22 @@ class Zscaler extends AdapterBaseCl {
|
|
|
196
179
|
return super.iapGetAdapterQueue(callback);
|
|
197
180
|
}
|
|
198
181
|
|
|
182
|
+
/* SCRIPT CALLS */
|
|
183
|
+
/**
|
|
184
|
+
* See if the API path provided is found in this adapter
|
|
185
|
+
*
|
|
186
|
+
* @function iapFindAdapterPath
|
|
187
|
+
* @param {string} apiPath - the api path to check on
|
|
188
|
+
* @param {Callback} callback - The results of the call
|
|
189
|
+
*/
|
|
190
|
+
iapFindAdapterPath(apiPath, callback) {
|
|
191
|
+
const meth = 'adapter-iapFindAdapterPath';
|
|
192
|
+
const origin = `${this.id}-${meth}`;
|
|
193
|
+
log.trace(origin);
|
|
194
|
+
|
|
195
|
+
super.iapFindAdapterPath(apiPath, callback);
|
|
196
|
+
}
|
|
197
|
+
|
|
199
198
|
/**
|
|
200
199
|
* @summary Runs troubleshoot scripts for adapter
|
|
201
200
|
*
|
|
@@ -296,176 +295,93 @@ class Zscaler extends AdapterBaseCl {
|
|
|
296
295
|
}
|
|
297
296
|
}
|
|
298
297
|
|
|
299
|
-
/* BROKER CALLS */
|
|
300
298
|
/**
|
|
301
|
-
* @summary
|
|
299
|
+
* @summary Deactivate adapter tasks
|
|
302
300
|
*
|
|
303
|
-
* @function
|
|
304
|
-
* @param {String} entityType - the entity type to check for
|
|
305
|
-
* @param {String/Array} entityId - the specific entity we are looking for
|
|
301
|
+
* @function iapDeactivateTasks
|
|
306
302
|
*
|
|
307
|
-
* @param {
|
|
308
|
-
*
|
|
303
|
+
* @param {Array} tasks - List of tasks to deactivate
|
|
304
|
+
* @param {Callback} callback
|
|
309
305
|
*/
|
|
310
|
-
|
|
311
|
-
const
|
|
306
|
+
iapDeactivateTasks(tasks, callback) {
|
|
307
|
+
const meth = 'adapter-iapDeactivateTasks';
|
|
308
|
+
const origin = `${this.id}-${meth}`;
|
|
312
309
|
log.trace(origin);
|
|
313
310
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
311
|
+
try {
|
|
312
|
+
return super.iapDeactivateTasks(tasks, callback);
|
|
313
|
+
} catch (err) {
|
|
314
|
+
log.error(`${origin}: ${err}`);
|
|
315
|
+
return callback(null, err);
|
|
316
|
+
}
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
/**
|
|
320
|
-
* @summary
|
|
321
|
-
* whether the adapter supports type, action and specific entity
|
|
320
|
+
* @summary Activate adapter tasks that have previously been deactivated
|
|
322
321
|
*
|
|
323
|
-
* @function
|
|
324
|
-
* @param {String} entityType - the entity type to check for
|
|
325
|
-
* @param {String} actionType - the action type to check for
|
|
326
|
-
* @param {String/Array} entityId - the specific entity we are looking for
|
|
322
|
+
* @function iapActivateTasks
|
|
327
323
|
*
|
|
328
|
-
* @param {
|
|
329
|
-
*
|
|
324
|
+
* @param {Array} tasks - List of tasks to activate
|
|
325
|
+
* @param {Callback} callback
|
|
330
326
|
*/
|
|
331
|
-
|
|
332
|
-
const meth = '
|
|
327
|
+
iapActivateTasks(tasks, callback) {
|
|
328
|
+
const meth = 'adapter-iapActivateTasks';
|
|
333
329
|
const origin = `${this.id}-${meth}`;
|
|
334
330
|
log.trace(origin);
|
|
335
331
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
return callback(null, error);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// if the cache needs to be updated, update and try again
|
|
345
|
-
if (results && results[0] === 'needupdate') {
|
|
346
|
-
switch (entityType) {
|
|
347
|
-
case 'template_entity': {
|
|
348
|
-
// if the cache is invalid, update the cache
|
|
349
|
-
return this.getEntities(null, null, null, null, (data, err) => {
|
|
350
|
-
if (err) {
|
|
351
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
|
|
352
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
353
|
-
return callback(null, errorObj);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// need to check the cache again since it has been updated
|
|
357
|
-
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
|
|
358
|
-
if (verror) {
|
|
359
|
-
return callback(null, verror);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
return this.capabilityResults(vcapable, callback);
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
default: {
|
|
367
|
-
// unsupported entity type
|
|
368
|
-
const result = [false];
|
|
369
|
-
|
|
370
|
-
// put false in array for all entities
|
|
371
|
-
if (Array.isArray(entityId)) {
|
|
372
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
373
|
-
result.push(false);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
return callback(result);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
// return the results
|
|
383
|
-
return this.capabilityResults(results, callback);
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
// if no entity id
|
|
388
|
-
if (!entityId) {
|
|
389
|
-
// need to check the cache again since it has been updated
|
|
390
|
-
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
|
|
391
|
-
if (verror) {
|
|
392
|
-
return callback(null, verror);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
return this.capabilityResults(vcapable, callback);
|
|
396
|
-
});
|
|
332
|
+
try {
|
|
333
|
+
return super.iapActivateTasks(tasks, callback);
|
|
334
|
+
} catch (err) {
|
|
335
|
+
log.error(`${origin}: ${err}`);
|
|
336
|
+
return callback(null, err);
|
|
397
337
|
}
|
|
338
|
+
}
|
|
398
339
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
return callback(null, verror);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// is the entity in the list?
|
|
417
|
-
const isEntity = this.entityInList(entityId, data.response, callback);
|
|
418
|
-
const res = [];
|
|
419
|
-
|
|
420
|
-
// not found
|
|
421
|
-
for (let i = 0; i < isEntity.length; i += 1) {
|
|
422
|
-
if (vcapable) {
|
|
423
|
-
res.push(isEntity[i]);
|
|
424
|
-
} else {
|
|
425
|
-
res.push(false);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
return callback(res);
|
|
430
|
-
});
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
default: {
|
|
434
|
-
// unsupported entity type
|
|
435
|
-
const result = [false];
|
|
436
|
-
|
|
437
|
-
// put false in array for all entities
|
|
438
|
-
if (Array.isArray(entityId)) {
|
|
439
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
440
|
-
result.push(false);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
340
|
+
/* CACHE CALLS */
|
|
341
|
+
/**
|
|
342
|
+
* @summary Populate the cache for the given entities
|
|
343
|
+
*
|
|
344
|
+
* @function iapPopulateEntityCache
|
|
345
|
+
* @param {String/Array of Strings} entityType - the entity type(s) to populate
|
|
346
|
+
* @param {Callback} callback - whether the cache was updated or not for each entity type
|
|
347
|
+
*
|
|
348
|
+
* @returns status of the populate
|
|
349
|
+
*/
|
|
350
|
+
iapPopulateEntityCache(entityTypes, callback) {
|
|
351
|
+
const meth = 'adapter-iapPopulateEntityCache';
|
|
352
|
+
const origin = `${this.id}-${meth}`;
|
|
353
|
+
log.trace(origin);
|
|
443
354
|
|
|
444
|
-
|
|
445
|
-
|
|
355
|
+
try {
|
|
356
|
+
return super.iapPopulateEntityCache(entityTypes, callback);
|
|
357
|
+
} catch (err) {
|
|
358
|
+
log.error(`${origin}: ${err}`);
|
|
359
|
+
return callback(null, err);
|
|
446
360
|
}
|
|
447
361
|
}
|
|
448
362
|
|
|
449
363
|
/**
|
|
450
|
-
* @summary
|
|
451
|
-
*
|
|
452
|
-
* @function iapUpdateAdapterEntityCache
|
|
364
|
+
* @summary Retrieves data from cache for specified entity type
|
|
453
365
|
*
|
|
366
|
+
* @function iapRetrieveEntitiesCache
|
|
367
|
+
* @param {String} entityType - entity of which to retrieve
|
|
368
|
+
* @param {Object} options - settings of which data to return and how to return it
|
|
369
|
+
* @param {Callback} callback - the data if it was retrieved
|
|
454
370
|
*/
|
|
455
|
-
|
|
456
|
-
const
|
|
371
|
+
iapRetrieveEntitiesCache(entityType, options, callback) {
|
|
372
|
+
const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
|
|
373
|
+
const origin = `${this.id}-${meth}`;
|
|
457
374
|
log.trace(origin);
|
|
458
375
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
});
|
|
376
|
+
try {
|
|
377
|
+
return super.iapRetrieveEntitiesCache(entityType, options, callback);
|
|
378
|
+
} catch (err) {
|
|
379
|
+
log.error(`${origin}: ${err}`);
|
|
380
|
+
return callback(null, err);
|
|
466
381
|
}
|
|
467
382
|
}
|
|
468
383
|
|
|
384
|
+
/* BROKER CALLS */
|
|
469
385
|
/**
|
|
470
386
|
* @summary Determines if this adapter supports any in a list of entities
|
|
471
387
|
*
|
|
@@ -600,6 +516,38 @@ class Zscaler extends AdapterBaseCl {
|
|
|
600
516
|
}
|
|
601
517
|
|
|
602
518
|
/* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
|
|
519
|
+
/**
|
|
520
|
+
* Makes the requested generic call
|
|
521
|
+
*
|
|
522
|
+
* @function iapExpandedGenericAdapterRequest
|
|
523
|
+
* @param {Object} metadata - metadata for the call (optional).
|
|
524
|
+
* Can be a stringified Object.
|
|
525
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
|
|
526
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
|
|
527
|
+
* @param {Object} pathVars - the parameters to be put within the url path (optional).
|
|
528
|
+
* Can be a stringified Object.
|
|
529
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
530
|
+
* Can be a stringified Object.
|
|
531
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
532
|
+
* Can be a stringified Object.
|
|
533
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
534
|
+
* Can be a stringified Object.
|
|
535
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
536
|
+
* or the error
|
|
537
|
+
*/
|
|
538
|
+
iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
|
|
539
|
+
const meth = 'adapter-iapExpandedGenericAdapterRequest';
|
|
540
|
+
const origin = `${this.id}-${meth}`;
|
|
541
|
+
log.trace(origin);
|
|
542
|
+
|
|
543
|
+
try {
|
|
544
|
+
return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
|
|
545
|
+
} catch (err) {
|
|
546
|
+
log.error(`${origin}: ${err}`);
|
|
547
|
+
return callback(null, err);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
603
551
|
/**
|
|
604
552
|
* Makes the requested generic call
|
|
605
553
|
*
|
|
@@ -620,93 +568,11 @@ class Zscaler extends AdapterBaseCl {
|
|
|
620
568
|
const origin = `${this.id}-${meth}`;
|
|
621
569
|
log.trace(origin);
|
|
622
570
|
|
|
623
|
-
if (this.suspended && this.suspendMode === 'error') {
|
|
624
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
625
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
626
|
-
return callback(null, errorObj);
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
630
|
-
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
631
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
632
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
633
|
-
return callback(null, errorObj);
|
|
634
|
-
}
|
|
635
|
-
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
636
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
637
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
638
|
-
return callback(null, errorObj);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
642
|
-
// remove any leading / and split the uripath into path variables
|
|
643
|
-
let myPath = uriPath;
|
|
644
|
-
while (myPath.indexOf('/') === 0) {
|
|
645
|
-
myPath = myPath.substring(1);
|
|
646
|
-
}
|
|
647
|
-
const pathVars = myPath.split('/');
|
|
648
|
-
const queryParamsAvailable = queryData;
|
|
649
|
-
const queryParams = {};
|
|
650
|
-
const bodyVars = requestBody;
|
|
651
|
-
|
|
652
|
-
// loop in template. long callback arg name to avoid identifier conflicts
|
|
653
|
-
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
654
|
-
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
655
|
-
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
656
|
-
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
657
|
-
}
|
|
658
|
-
});
|
|
659
|
-
|
|
660
|
-
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
661
|
-
const reqObj = {
|
|
662
|
-
payload: bodyVars,
|
|
663
|
-
uriPathVars: pathVars,
|
|
664
|
-
uriQuery: queryParams,
|
|
665
|
-
uriOptions: {}
|
|
666
|
-
};
|
|
667
|
-
// add headers if provided
|
|
668
|
-
if (addlHeaders) {
|
|
669
|
-
reqObj.addlHeaders = addlHeaders;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
// determine the call and return flag
|
|
673
|
-
let action = 'getGenerics';
|
|
674
|
-
let returnF = true;
|
|
675
|
-
if (restMethod.toUpperCase() === 'POST') {
|
|
676
|
-
action = 'createGeneric';
|
|
677
|
-
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
678
|
-
action = 'updateGeneric';
|
|
679
|
-
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
680
|
-
action = 'patchGeneric';
|
|
681
|
-
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
682
|
-
action = 'deleteGeneric';
|
|
683
|
-
returnF = false;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
571
|
try {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
// return an error
|
|
692
|
-
if (irReturnError) {
|
|
693
|
-
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
694
|
-
return callback(null, irReturnError);
|
|
695
|
-
}
|
|
696
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
697
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
|
|
698
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
699
|
-
return callback(null, errorObj);
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
703
|
-
// return the response
|
|
704
|
-
return callback(irReturnData, null);
|
|
705
|
-
});
|
|
706
|
-
} catch (ex) {
|
|
707
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
708
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
709
|
-
return callback(null, errorObj);
|
|
572
|
+
return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
573
|
+
} catch (err) {
|
|
574
|
+
log.error(`${origin}: ${err}`);
|
|
575
|
+
return callback(null, err);
|
|
710
576
|
}
|
|
711
577
|
}
|
|
712
578
|
|
|
@@ -730,94 +596,56 @@ class Zscaler extends AdapterBaseCl {
|
|
|
730
596
|
const origin = `${this.id}-${meth}`;
|
|
731
597
|
log.trace(origin);
|
|
732
598
|
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
740
|
-
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
741
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
742
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
743
|
-
return callback(null, errorObj);
|
|
744
|
-
}
|
|
745
|
-
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
746
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
747
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
748
|
-
return callback(null, errorObj);
|
|
599
|
+
try {
|
|
600
|
+
return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
601
|
+
} catch (err) {
|
|
602
|
+
log.error(`${origin}: ${err}`);
|
|
603
|
+
return callback(null, err);
|
|
749
604
|
}
|
|
605
|
+
}
|
|
750
606
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
const
|
|
760
|
-
const
|
|
607
|
+
/* INVENTORY CALLS */
|
|
608
|
+
/**
|
|
609
|
+
* @summary run the adapter lint script to return the results.
|
|
610
|
+
*
|
|
611
|
+
* @function iapRunAdapterLint
|
|
612
|
+
* @param {Callback} callback - callback function
|
|
613
|
+
*/
|
|
614
|
+
iapRunAdapterLint(callback) {
|
|
615
|
+
const meth = 'adapter-iapRunAdapterLint';
|
|
616
|
+
const origin = `${this.id}-${meth}`;
|
|
617
|
+
log.trace(origin);
|
|
761
618
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
765
|
-
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
766
|
-
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
767
|
-
}
|
|
768
|
-
});
|
|
619
|
+
return super.iapRunAdapterLint(callback);
|
|
620
|
+
}
|
|
769
621
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
622
|
+
/**
|
|
623
|
+
* @summary run the adapter test scripts (baseunit and unit) to return the results.
|
|
624
|
+
* can not run integration as there can be implications with that.
|
|
625
|
+
*
|
|
626
|
+
* @function iapRunAdapterTests
|
|
627
|
+
* @param {Callback} callback - callback function
|
|
628
|
+
*/
|
|
629
|
+
iapRunAdapterTests(callback) {
|
|
630
|
+
const meth = 'adapter-iapRunAdapterTests';
|
|
631
|
+
const origin = `${this.id}-${meth}`;
|
|
632
|
+
log.trace(origin);
|
|
781
633
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
let returnF = true;
|
|
785
|
-
if (restMethod.toUpperCase() === 'POST') {
|
|
786
|
-
action = 'createGenericNoBase';
|
|
787
|
-
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
788
|
-
action = 'updateGenericNoBase';
|
|
789
|
-
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
790
|
-
action = 'patchGenericNoBase';
|
|
791
|
-
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
792
|
-
action = 'deleteGenericNoBase';
|
|
793
|
-
returnF = false;
|
|
794
|
-
}
|
|
634
|
+
return super.iapRunAdapterTests(callback);
|
|
635
|
+
}
|
|
795
636
|
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
807
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
|
|
808
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
809
|
-
return callback(null, errorObj);
|
|
810
|
-
}
|
|
637
|
+
/**
|
|
638
|
+
* @summary provide inventory information abbout the adapter
|
|
639
|
+
*
|
|
640
|
+
* @function iapGetAdapterInventory
|
|
641
|
+
* @param {Callback} callback - callback function
|
|
642
|
+
*/
|
|
643
|
+
iapGetAdapterInventory(callback) {
|
|
644
|
+
const meth = 'adapter-iapGetAdapterInventory';
|
|
645
|
+
const origin = `${this.id}-${meth}`;
|
|
646
|
+
log.trace(origin);
|
|
811
647
|
|
|
812
|
-
|
|
813
|
-
// return the response
|
|
814
|
-
return callback(irReturnData, null);
|
|
815
|
-
});
|
|
816
|
-
} catch (ex) {
|
|
817
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
818
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
819
|
-
return callback(null, errorObj);
|
|
820
|
-
}
|
|
648
|
+
return super.iapGetAdapterInventory(callback);
|
|
821
649
|
}
|
|
822
650
|
|
|
823
651
|
/**
|