@itentialopensource/adapter-azure_aks 0.2.0 → 0.3.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 +126 -0
- package/CHANGELOG.md +8 -0
- package/CONTRIBUTING.md +1 -160
- package/ENHANCE.md +2 -2
- package/README.md +32 -23
- package/adapter.js +160 -338
- package/adapterBase.js +549 -879
- package/changelogs/changelog.md +16 -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 +3708 -0
- package/report/adapter-openapi.yaml +3084 -0
- package/report/adapterInfo.json +8 -8
- package/report/updateReport1691507435017.json +120 -0
- package/report/updateReport1692202466826.json +120 -0
- package/report/updateReport1694460918275.json +120 -0
- package/report/updateReport1698420595972.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
|
@@ -83,15 +83,9 @@ class AzureAks extends AdapterBaseCl {
|
|
|
83
83
|
*/
|
|
84
84
|
healthCheck(reqObj, callback) {
|
|
85
85
|
// you can modify what is passed into the healthcheck by changing things in the newReq
|
|
86
|
-
let newReq =
|
|
87
|
-
if (
|
|
88
|
-
newReq
|
|
89
|
-
newReq.uriPathVars = [this.subscriptionId];
|
|
90
|
-
} else {
|
|
91
|
-
newReq = {
|
|
92
|
-
authData: this.authObject,
|
|
93
|
-
uriPathVars: [this.subscriptionId]
|
|
94
|
-
};
|
|
86
|
+
let newReq = null;
|
|
87
|
+
if (reqObj) {
|
|
88
|
+
newReq = Object.assign(...reqObj);
|
|
95
89
|
}
|
|
96
90
|
super.healthCheck(newReq, callback);
|
|
97
91
|
}
|
|
@@ -103,9 +97,6 @@ class AzureAks extends AdapterBaseCl {
|
|
|
103
97
|
let myIgnore = [
|
|
104
98
|
'healthCheck',
|
|
105
99
|
'iapGetAdapterWorkflowFunctions',
|
|
106
|
-
'iapHasAdapterEntity',
|
|
107
|
-
'iapVerifyAdapterCapability',
|
|
108
|
-
'iapUpdateAdapterEntityCache',
|
|
109
100
|
'hasEntities',
|
|
110
101
|
'getAuthorization'
|
|
111
102
|
];
|
|
@@ -133,29 +124,15 @@ class AzureAks extends AdapterBaseCl {
|
|
|
133
124
|
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
|
|
134
125
|
* @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
|
|
135
126
|
* @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
|
|
127
|
+
* @param {boolean} replace - true to replace entire mock data, false to merge/append
|
|
136
128
|
* @param {Callback} callback - The results of the call
|
|
137
129
|
*/
|
|
138
|
-
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
|
|
130
|
+
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
|
|
139
131
|
const meth = 'adapter-iapUpdateAdapterConfiguration';
|
|
140
132
|
const origin = `${this.id}-${meth}`;
|
|
141
133
|
log.trace(origin);
|
|
142
134
|
|
|
143
|
-
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* See if the API path provided is found in this adapter
|
|
148
|
-
*
|
|
149
|
-
* @function iapFindAdapterPath
|
|
150
|
-
* @param {string} apiPath - the api path to check on
|
|
151
|
-
* @param {Callback} callback - The results of the call
|
|
152
|
-
*/
|
|
153
|
-
iapFindAdapterPath(apiPath, callback) {
|
|
154
|
-
const meth = 'adapter-iapFindAdapterPath';
|
|
155
|
-
const origin = `${this.id}-${meth}`;
|
|
156
|
-
log.trace(origin);
|
|
157
|
-
|
|
158
|
-
super.iapFindAdapterPath(apiPath, callback);
|
|
135
|
+
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
|
|
159
136
|
}
|
|
160
137
|
|
|
161
138
|
/**
|
|
@@ -197,7 +174,7 @@ class AzureAks extends AdapterBaseCl {
|
|
|
197
174
|
}
|
|
198
175
|
|
|
199
176
|
/**
|
|
200
|
-
* @summary Get the
|
|
177
|
+
* @summary Get the Adapter Queue
|
|
201
178
|
*
|
|
202
179
|
* @function iapGetAdapterQueue
|
|
203
180
|
* @param {Callback} callback - callback function
|
|
@@ -210,6 +187,22 @@ class AzureAks extends AdapterBaseCl {
|
|
|
210
187
|
return super.iapGetAdapterQueue(callback);
|
|
211
188
|
}
|
|
212
189
|
|
|
190
|
+
/* SCRIPT CALLS */
|
|
191
|
+
/**
|
|
192
|
+
* See if the API path provided is found in this adapter
|
|
193
|
+
*
|
|
194
|
+
* @function iapFindAdapterPath
|
|
195
|
+
* @param {string} apiPath - the api path to check on
|
|
196
|
+
* @param {Callback} callback - The results of the call
|
|
197
|
+
*/
|
|
198
|
+
iapFindAdapterPath(apiPath, callback) {
|
|
199
|
+
const meth = 'adapter-iapFindAdapterPath';
|
|
200
|
+
const origin = `${this.id}-${meth}`;
|
|
201
|
+
log.trace(origin);
|
|
202
|
+
|
|
203
|
+
super.iapFindAdapterPath(apiPath, callback);
|
|
204
|
+
}
|
|
205
|
+
|
|
213
206
|
/**
|
|
214
207
|
* @summary Runs troubleshoot scripts for adapter
|
|
215
208
|
*
|
|
@@ -310,176 +303,93 @@ class AzureAks extends AdapterBaseCl {
|
|
|
310
303
|
}
|
|
311
304
|
}
|
|
312
305
|
|
|
313
|
-
/* BROKER CALLS */
|
|
314
306
|
/**
|
|
315
|
-
* @summary
|
|
307
|
+
* @summary Deactivate adapter tasks
|
|
316
308
|
*
|
|
317
|
-
* @function
|
|
318
|
-
* @param {String} entityType - the entity type to check for
|
|
319
|
-
* @param {String/Array} entityId - the specific entity we are looking for
|
|
309
|
+
* @function iapDeactivateTasks
|
|
320
310
|
*
|
|
321
|
-
* @param {
|
|
322
|
-
*
|
|
311
|
+
* @param {Array} tasks - List of tasks to deactivate
|
|
312
|
+
* @param {Callback} callback
|
|
323
313
|
*/
|
|
324
|
-
|
|
325
|
-
const
|
|
314
|
+
iapDeactivateTasks(tasks, callback) {
|
|
315
|
+
const meth = 'adapter-iapDeactivateTasks';
|
|
316
|
+
const origin = `${this.id}-${meth}`;
|
|
326
317
|
log.trace(origin);
|
|
327
318
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
319
|
+
try {
|
|
320
|
+
return super.iapDeactivateTasks(tasks, callback);
|
|
321
|
+
} catch (err) {
|
|
322
|
+
log.error(`${origin}: ${err}`);
|
|
323
|
+
return callback(null, err);
|
|
324
|
+
}
|
|
331
325
|
}
|
|
332
326
|
|
|
333
327
|
/**
|
|
334
|
-
* @summary
|
|
335
|
-
* whether the adapter supports type, action and specific entity
|
|
328
|
+
* @summary Activate adapter tasks that have previously been deactivated
|
|
336
329
|
*
|
|
337
|
-
* @function
|
|
338
|
-
* @param {String} entityType - the entity type to check for
|
|
339
|
-
* @param {String} actionType - the action type to check for
|
|
340
|
-
* @param {String/Array} entityId - the specific entity we are looking for
|
|
330
|
+
* @function iapActivateTasks
|
|
341
331
|
*
|
|
342
|
-
* @param {
|
|
343
|
-
*
|
|
332
|
+
* @param {Array} tasks - List of tasks to activate
|
|
333
|
+
* @param {Callback} callback
|
|
344
334
|
*/
|
|
345
|
-
|
|
346
|
-
const meth = '
|
|
335
|
+
iapActivateTasks(tasks, callback) {
|
|
336
|
+
const meth = 'adapter-iapActivateTasks';
|
|
347
337
|
const origin = `${this.id}-${meth}`;
|
|
348
338
|
log.trace(origin);
|
|
349
339
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
return callback(null, error);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
// if the cache needs to be updated, update and try again
|
|
359
|
-
if (results && results[0] === 'needupdate') {
|
|
360
|
-
switch (entityType) {
|
|
361
|
-
case 'template_entity': {
|
|
362
|
-
// if the cache is invalid, update the cache
|
|
363
|
-
return this.getEntities(null, null, null, null, (data, err) => {
|
|
364
|
-
if (err) {
|
|
365
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
|
|
366
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
367
|
-
return callback(null, errorObj);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
// need to check the cache again since it has been updated
|
|
371
|
-
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
|
|
372
|
-
if (verror) {
|
|
373
|
-
return callback(null, verror);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
return this.capabilityResults(vcapable, callback);
|
|
377
|
-
});
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
default: {
|
|
381
|
-
// unsupported entity type
|
|
382
|
-
const result = [false];
|
|
383
|
-
|
|
384
|
-
// put false in array for all entities
|
|
385
|
-
if (Array.isArray(entityId)) {
|
|
386
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
387
|
-
result.push(false);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
return callback(result);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
// return the results
|
|
397
|
-
return this.capabilityResults(results, callback);
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
// if no entity id
|
|
402
|
-
if (!entityId) {
|
|
403
|
-
// need to check the cache again since it has been updated
|
|
404
|
-
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
|
|
405
|
-
if (verror) {
|
|
406
|
-
return callback(null, verror);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
return this.capabilityResults(vcapable, callback);
|
|
410
|
-
});
|
|
340
|
+
try {
|
|
341
|
+
return super.iapActivateTasks(tasks, callback);
|
|
342
|
+
} catch (err) {
|
|
343
|
+
log.error(`${origin}: ${err}`);
|
|
344
|
+
return callback(null, err);
|
|
411
345
|
}
|
|
346
|
+
}
|
|
412
347
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
return callback(null, verror);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
// is the entity in the list?
|
|
431
|
-
const isEntity = this.entityInList(entityId, data.response, callback);
|
|
432
|
-
const res = [];
|
|
433
|
-
|
|
434
|
-
// not found
|
|
435
|
-
for (let i = 0; i < isEntity.length; i += 1) {
|
|
436
|
-
if (vcapable) {
|
|
437
|
-
res.push(isEntity[i]);
|
|
438
|
-
} else {
|
|
439
|
-
res.push(false);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
return callback(res);
|
|
444
|
-
});
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
default: {
|
|
448
|
-
// unsupported entity type
|
|
449
|
-
const result = [false];
|
|
450
|
-
|
|
451
|
-
// put false in array for all entities
|
|
452
|
-
if (Array.isArray(entityId)) {
|
|
453
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
454
|
-
result.push(false);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
348
|
+
/* CACHE CALLS */
|
|
349
|
+
/**
|
|
350
|
+
* @summary Populate the cache for the given entities
|
|
351
|
+
*
|
|
352
|
+
* @function iapPopulateEntityCache
|
|
353
|
+
* @param {String/Array of Strings} entityType - the entity type(s) to populate
|
|
354
|
+
* @param {Callback} callback - whether the cache was updated or not for each entity type
|
|
355
|
+
*
|
|
356
|
+
* @returns status of the populate
|
|
357
|
+
*/
|
|
358
|
+
iapPopulateEntityCache(entityTypes, callback) {
|
|
359
|
+
const meth = 'adapter-iapPopulateEntityCache';
|
|
360
|
+
const origin = `${this.id}-${meth}`;
|
|
361
|
+
log.trace(origin);
|
|
457
362
|
|
|
458
|
-
|
|
459
|
-
|
|
363
|
+
try {
|
|
364
|
+
return super.iapPopulateEntityCache(entityTypes, callback);
|
|
365
|
+
} catch (err) {
|
|
366
|
+
log.error(`${origin}: ${err}`);
|
|
367
|
+
return callback(null, err);
|
|
460
368
|
}
|
|
461
369
|
}
|
|
462
370
|
|
|
463
371
|
/**
|
|
464
|
-
* @summary
|
|
465
|
-
*
|
|
466
|
-
* @function iapUpdateAdapterEntityCache
|
|
372
|
+
* @summary Retrieves data from cache for specified entity type
|
|
467
373
|
*
|
|
374
|
+
* @function iapRetrieveEntitiesCache
|
|
375
|
+
* @param {String} entityType - entity of which to retrieve
|
|
376
|
+
* @param {Object} options - settings of which data to return and how to return it
|
|
377
|
+
* @param {Callback} callback - the data if it was retrieved
|
|
468
378
|
*/
|
|
469
|
-
|
|
470
|
-
const
|
|
379
|
+
iapRetrieveEntitiesCache(entityType, options, callback) {
|
|
380
|
+
const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
|
|
381
|
+
const origin = `${this.id}-${meth}`;
|
|
471
382
|
log.trace(origin);
|
|
472
383
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
});
|
|
384
|
+
try {
|
|
385
|
+
return super.iapRetrieveEntitiesCache(entityType, options, callback);
|
|
386
|
+
} catch (err) {
|
|
387
|
+
log.error(`${origin}: ${err}`);
|
|
388
|
+
return callback(null, err);
|
|
480
389
|
}
|
|
481
390
|
}
|
|
482
391
|
|
|
392
|
+
/* BROKER CALLS */
|
|
483
393
|
/**
|
|
484
394
|
* @summary Determines if this adapter supports any in a list of entities
|
|
485
395
|
*
|
|
@@ -614,6 +524,38 @@ class AzureAks extends AdapterBaseCl {
|
|
|
614
524
|
}
|
|
615
525
|
|
|
616
526
|
/* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
|
|
527
|
+
/**
|
|
528
|
+
* Makes the requested generic call
|
|
529
|
+
*
|
|
530
|
+
* @function iapExpandedGenericAdapterRequest
|
|
531
|
+
* @param {Object} metadata - metadata for the call (optional).
|
|
532
|
+
* Can be a stringified Object.
|
|
533
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
|
|
534
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
|
|
535
|
+
* @param {Object} pathVars - the parameters to be put within the url path (optional).
|
|
536
|
+
* Can be a stringified Object.
|
|
537
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
538
|
+
* Can be a stringified Object.
|
|
539
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
540
|
+
* Can be a stringified Object.
|
|
541
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
542
|
+
* Can be a stringified Object.
|
|
543
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
544
|
+
* or the error
|
|
545
|
+
*/
|
|
546
|
+
iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
|
|
547
|
+
const meth = 'adapter-iapExpandedGenericAdapterRequest';
|
|
548
|
+
const origin = `${this.id}-${meth}`;
|
|
549
|
+
log.trace(origin);
|
|
550
|
+
|
|
551
|
+
try {
|
|
552
|
+
return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
|
|
553
|
+
} catch (err) {
|
|
554
|
+
log.error(`${origin}: ${err}`);
|
|
555
|
+
return callback(null, err);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
617
559
|
/**
|
|
618
560
|
* Makes the requested generic call
|
|
619
561
|
*
|
|
@@ -634,93 +576,11 @@ class AzureAks extends AdapterBaseCl {
|
|
|
634
576
|
const origin = `${this.id}-${meth}`;
|
|
635
577
|
log.trace(origin);
|
|
636
578
|
|
|
637
|
-
if (this.suspended && this.suspendMode === 'error') {
|
|
638
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
639
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
640
|
-
return callback(null, errorObj);
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
644
|
-
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
645
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
646
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
647
|
-
return callback(null, errorObj);
|
|
648
|
-
}
|
|
649
|
-
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
650
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
651
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
652
|
-
return callback(null, errorObj);
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
656
|
-
// remove any leading / and split the uripath into path variables
|
|
657
|
-
let myPath = uriPath;
|
|
658
|
-
while (myPath.indexOf('/') === 0) {
|
|
659
|
-
myPath = myPath.substring(1);
|
|
660
|
-
}
|
|
661
|
-
const pathVars = myPath.split('/');
|
|
662
|
-
const queryParamsAvailable = queryData;
|
|
663
|
-
const queryParams = {};
|
|
664
|
-
const bodyVars = requestBody;
|
|
665
|
-
|
|
666
|
-
// loop in template. long callback arg name to avoid identifier conflicts
|
|
667
|
-
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
668
|
-
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
669
|
-
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
670
|
-
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
671
|
-
}
|
|
672
|
-
});
|
|
673
|
-
|
|
674
|
-
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
675
|
-
const reqObj = {
|
|
676
|
-
payload: bodyVars,
|
|
677
|
-
uriPathVars: pathVars,
|
|
678
|
-
uriQuery: queryParams,
|
|
679
|
-
uriOptions: {}
|
|
680
|
-
};
|
|
681
|
-
// add headers if provided
|
|
682
|
-
if (addlHeaders) {
|
|
683
|
-
reqObj.addlHeaders = addlHeaders;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
// determine the call and return flag
|
|
687
|
-
let action = 'getGenerics';
|
|
688
|
-
let returnF = true;
|
|
689
|
-
if (restMethod.toUpperCase() === 'POST') {
|
|
690
|
-
action = 'createGeneric';
|
|
691
|
-
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
692
|
-
action = 'updateGeneric';
|
|
693
|
-
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
694
|
-
action = 'patchGeneric';
|
|
695
|
-
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
696
|
-
action = 'deleteGeneric';
|
|
697
|
-
returnF = false;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
579
|
try {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
// return an error
|
|
706
|
-
if (irReturnError) {
|
|
707
|
-
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
708
|
-
return callback(null, irReturnError);
|
|
709
|
-
}
|
|
710
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
711
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
|
|
712
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
713
|
-
return callback(null, errorObj);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
717
|
-
// return the response
|
|
718
|
-
return callback(irReturnData, null);
|
|
719
|
-
});
|
|
720
|
-
} catch (ex) {
|
|
721
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
722
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
723
|
-
return callback(null, errorObj);
|
|
580
|
+
return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
581
|
+
} catch (err) {
|
|
582
|
+
log.error(`${origin}: ${err}`);
|
|
583
|
+
return callback(null, err);
|
|
724
584
|
}
|
|
725
585
|
}
|
|
726
586
|
|
|
@@ -744,94 +604,56 @@ class AzureAks extends AdapterBaseCl {
|
|
|
744
604
|
const origin = `${this.id}-${meth}`;
|
|
745
605
|
log.trace(origin);
|
|
746
606
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
754
|
-
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
755
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
756
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
757
|
-
return callback(null, errorObj);
|
|
758
|
-
}
|
|
759
|
-
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
760
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
761
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
762
|
-
return callback(null, errorObj);
|
|
607
|
+
try {
|
|
608
|
+
return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
609
|
+
} catch (err) {
|
|
610
|
+
log.error(`${origin}: ${err}`);
|
|
611
|
+
return callback(null, err);
|
|
763
612
|
}
|
|
613
|
+
}
|
|
764
614
|
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
const
|
|
774
|
-
const
|
|
615
|
+
/* INVENTORY CALLS */
|
|
616
|
+
/**
|
|
617
|
+
* @summary run the adapter lint script to return the results.
|
|
618
|
+
*
|
|
619
|
+
* @function iapRunAdapterLint
|
|
620
|
+
* @param {Callback} callback - callback function
|
|
621
|
+
*/
|
|
622
|
+
iapRunAdapterLint(callback) {
|
|
623
|
+
const meth = 'adapter-iapRunAdapterLint';
|
|
624
|
+
const origin = `${this.id}-${meth}`;
|
|
625
|
+
log.trace(origin);
|
|
775
626
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
779
|
-
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
780
|
-
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
781
|
-
}
|
|
782
|
-
});
|
|
627
|
+
return super.iapRunAdapterLint(callback);
|
|
628
|
+
}
|
|
783
629
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
630
|
+
/**
|
|
631
|
+
* @summary run the adapter test scripts (baseunit and unit) to return the results.
|
|
632
|
+
* can not run integration as there can be implications with that.
|
|
633
|
+
*
|
|
634
|
+
* @function iapRunAdapterTests
|
|
635
|
+
* @param {Callback} callback - callback function
|
|
636
|
+
*/
|
|
637
|
+
iapRunAdapterTests(callback) {
|
|
638
|
+
const meth = 'adapter-iapRunAdapterTests';
|
|
639
|
+
const origin = `${this.id}-${meth}`;
|
|
640
|
+
log.trace(origin);
|
|
795
641
|
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
let returnF = true;
|
|
799
|
-
if (restMethod.toUpperCase() === 'POST') {
|
|
800
|
-
action = 'createGenericNoBase';
|
|
801
|
-
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
802
|
-
action = 'updateGenericNoBase';
|
|
803
|
-
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
804
|
-
action = 'patchGenericNoBase';
|
|
805
|
-
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
806
|
-
action = 'deleteGenericNoBase';
|
|
807
|
-
returnF = false;
|
|
808
|
-
}
|
|
642
|
+
return super.iapRunAdapterTests(callback);
|
|
643
|
+
}
|
|
809
644
|
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
821
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
|
|
822
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
823
|
-
return callback(null, errorObj);
|
|
824
|
-
}
|
|
645
|
+
/**
|
|
646
|
+
* @summary provide inventory information abbout the adapter
|
|
647
|
+
*
|
|
648
|
+
* @function iapGetAdapterInventory
|
|
649
|
+
* @param {Callback} callback - callback function
|
|
650
|
+
*/
|
|
651
|
+
iapGetAdapterInventory(callback) {
|
|
652
|
+
const meth = 'adapter-iapGetAdapterInventory';
|
|
653
|
+
const origin = `${this.id}-${meth}`;
|
|
654
|
+
log.trace(origin);
|
|
825
655
|
|
|
826
|
-
|
|
827
|
-
// return the response
|
|
828
|
-
return callback(irReturnData, null);
|
|
829
|
-
});
|
|
830
|
-
} catch (ex) {
|
|
831
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
832
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
833
|
-
return callback(null, errorObj);
|
|
834
|
-
}
|
|
656
|
+
return super.iapGetAdapterInventory(callback);
|
|
835
657
|
}
|
|
836
658
|
|
|
837
659
|
/**
|