@itentialopensource/adapter-azure_aks 0.1.1 → 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/AUTH.md +39 -0
- package/BROKER.md +199 -0
- package/CALLS.md +295 -0
- package/CHANGELOG.md +17 -2
- package/CODE_OF_CONDUCT.md +12 -17
- package/CONTRIBUTING.md +3 -148
- package/ENHANCE.md +69 -0
- package/PROPERTIES.md +641 -0
- package/README.md +235 -576
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +385 -271
- package/adapterBase.js +854 -408
- package/changelogs/changelog.md +16 -0
- package/entities/.generic/action.json +110 -5
- package/entities/.generic/schema.json +6 -1
- package/error.json +6 -0
- package/metadata.json +49 -0
- package/package.json +27 -22
- package/pronghorn.json +691 -88
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +828 -7
- 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 +10 -0
- package/report/updateReport1653089062336.json +120 -0
- 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 +153 -3
- package/test/integration/adapterTestBasicGet.js +3 -5
- package/test/integration/adapterTestConnectivity.js +91 -42
- package/test/integration/adapterTestIntegration.js +155 -110
- package/test/unit/adapterBaseTestUnit.js +388 -308
- package/test/unit/adapterTestUnit.js +484 -247
- package/utils/adapterInfo.js +206 -0
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +1 -1
- package/utils/basicGet.js +1 -14
- package/utils/checkMigrate.js +1 -1
- package/utils/entitiesToDB.js +179 -0
- package/utils/findPath.js +1 -1
- package/utils/methodDocumentor.js +273 -0
- package/utils/modify.js +14 -16
- package/utils/packModificationScript.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +5 -0
- package/utils/removeHooks.js +20 -0
- package/utils/taskMover.js +309 -0
- package/utils/tbScript.js +129 -53
- package/utils/tbUtils.js +125 -25
- package/utils/testRunner.js +17 -17
- package/utils/troubleshootingAdapter.js +10 -31
- package/workflows/README.md +0 -3
package/adapter.js
CHANGED
|
@@ -82,24 +82,24 @@ class AzureAks extends AdapterBaseCl {
|
|
|
82
82
|
* @param {Callback} callback - The results of the call
|
|
83
83
|
*/
|
|
84
84
|
healthCheck(reqObj, callback) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
newReq
|
|
89
|
-
} else {
|
|
90
|
-
newReq = {
|
|
91
|
-
authData: this.authObject,
|
|
92
|
-
uriPathVars: [this.subscriptionId]
|
|
93
|
-
};
|
|
85
|
+
// you can modify what is passed into the healthcheck by changing things in the newReq
|
|
86
|
+
let newReq = null;
|
|
87
|
+
if (reqObj) {
|
|
88
|
+
newReq = Object.assign(...reqObj);
|
|
94
89
|
}
|
|
95
90
|
super.healthCheck(newReq, callback);
|
|
96
91
|
}
|
|
97
92
|
|
|
98
93
|
/**
|
|
99
|
-
* @
|
|
94
|
+
* @iapGetAdapterWorkflowFunctions
|
|
100
95
|
*/
|
|
101
|
-
|
|
102
|
-
let myIgnore = [
|
|
96
|
+
iapGetAdapterWorkflowFunctions(inIgnore) {
|
|
97
|
+
let myIgnore = [
|
|
98
|
+
'healthCheck',
|
|
99
|
+
'iapGetAdapterWorkflowFunctions',
|
|
100
|
+
'hasEntities',
|
|
101
|
+
'getAuthorization'
|
|
102
|
+
];
|
|
103
103
|
if (!inIgnore && Array.isArray(inIgnore)) {
|
|
104
104
|
myIgnore = inIgnore;
|
|
105
105
|
} else if (!inIgnore && typeof inIgnore === 'string') {
|
|
@@ -110,52 +110,44 @@ class AzureAks extends AdapterBaseCl {
|
|
|
110
110
|
// you can add specific methods that you do not want to be workflow functions to ignore like below
|
|
111
111
|
// myIgnore.push('myMethodNotInWorkflow');
|
|
112
112
|
|
|
113
|
-
return super.
|
|
113
|
+
return super.iapGetAdapterWorkflowFunctions(myIgnore);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
117
|
+
* iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
|
|
118
118
|
* allows customers to make changes to adapter configuration without having to be on the
|
|
119
119
|
* file system.
|
|
120
120
|
*
|
|
121
|
-
* @function
|
|
121
|
+
* @function iapUpdateAdapterConfiguration
|
|
122
122
|
* @param {string} configFile - the name of the file being updated (required)
|
|
123
123
|
* @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
|
|
124
124
|
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
|
|
125
125
|
* @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
|
|
126
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
|
|
127
128
|
* @param {Callback} callback - The results of the call
|
|
128
129
|
*/
|
|
129
|
-
|
|
130
|
-
const
|
|
130
|
+
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
|
|
131
|
+
const meth = 'adapter-iapUpdateAdapterConfiguration';
|
|
132
|
+
const origin = `${this.id}-${meth}`;
|
|
131
133
|
log.trace(origin);
|
|
132
|
-
super.updateAdapterConfiguration(configFile, changes, entity, type, action, callback);
|
|
133
|
-
}
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
* See if the API path provided is found in this adapter
|
|
137
|
-
*
|
|
138
|
-
* @function findPath
|
|
139
|
-
* @param {string} apiPath - the api path to check on
|
|
140
|
-
* @param {Callback} callback - The results of the call
|
|
141
|
-
*/
|
|
142
|
-
findPath(apiPath, callback) {
|
|
143
|
-
const origin = `${this.id}-adapter-findPath`;
|
|
144
|
-
log.trace(origin);
|
|
145
|
-
super.findPath(apiPath, callback);
|
|
135
|
+
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
|
|
146
136
|
}
|
|
147
137
|
|
|
148
138
|
/**
|
|
149
139
|
* @summary Suspends adapter
|
|
150
140
|
*
|
|
151
|
-
* @function
|
|
141
|
+
* @function iapSuspendAdapter
|
|
152
142
|
* @param {Callback} callback - callback function
|
|
153
143
|
*/
|
|
154
|
-
|
|
155
|
-
const
|
|
144
|
+
iapSuspendAdapter(mode, callback) {
|
|
145
|
+
const meth = 'adapter-iapSuspendAdapter';
|
|
146
|
+
const origin = `${this.id}-${meth}`;
|
|
156
147
|
log.trace(origin);
|
|
148
|
+
|
|
157
149
|
try {
|
|
158
|
-
return super.
|
|
150
|
+
return super.iapSuspendAdapter(mode, callback);
|
|
159
151
|
} catch (error) {
|
|
160
152
|
log.error(`${origin}: ${error}`);
|
|
161
153
|
return callback(null, error);
|
|
@@ -165,14 +157,16 @@ class AzureAks extends AdapterBaseCl {
|
|
|
165
157
|
/**
|
|
166
158
|
* @summary Unsuspends adapter
|
|
167
159
|
*
|
|
168
|
-
* @function
|
|
160
|
+
* @function iapUnsuspendAdapter
|
|
169
161
|
* @param {Callback} callback - callback function
|
|
170
162
|
*/
|
|
171
|
-
|
|
172
|
-
const
|
|
163
|
+
iapUnsuspendAdapter(callback) {
|
|
164
|
+
const meth = 'adapter-iapUnsuspendAdapter';
|
|
165
|
+
const origin = `${this.id}-${meth}`;
|
|
173
166
|
log.trace(origin);
|
|
167
|
+
|
|
174
168
|
try {
|
|
175
|
-
return super.
|
|
169
|
+
return super.iapUnsuspendAdapter(callback);
|
|
176
170
|
} catch (error) {
|
|
177
171
|
log.error(`${origin}: ${error}`);
|
|
178
172
|
return callback(null, error);
|
|
@@ -180,31 +174,51 @@ class AzureAks extends AdapterBaseCl {
|
|
|
180
174
|
}
|
|
181
175
|
|
|
182
176
|
/**
|
|
183
|
-
* @summary Get the
|
|
177
|
+
* @summary Get the Adapter Queue
|
|
184
178
|
*
|
|
185
|
-
* @function
|
|
179
|
+
* @function iapGetAdapterQueue
|
|
186
180
|
* @param {Callback} callback - callback function
|
|
187
181
|
*/
|
|
188
|
-
|
|
189
|
-
const
|
|
182
|
+
iapGetAdapterQueue(callback) {
|
|
183
|
+
const meth = 'adapter-iapGetAdapterQueue';
|
|
184
|
+
const origin = `${this.id}-${meth}`;
|
|
190
185
|
log.trace(origin);
|
|
191
|
-
|
|
186
|
+
|
|
187
|
+
return super.iapGetAdapterQueue(callback);
|
|
188
|
+
}
|
|
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);
|
|
192
204
|
}
|
|
193
205
|
|
|
194
206
|
/**
|
|
195
207
|
* @summary Runs troubleshoot scripts for adapter
|
|
196
208
|
*
|
|
197
|
-
* @function
|
|
209
|
+
* @function iapTroubleshootAdapter
|
|
198
210
|
* @param {Object} props - the connection, healthcheck and authentication properties
|
|
199
211
|
*
|
|
200
212
|
* @param {boolean} persistFlag - whether the adapter properties should be updated
|
|
201
213
|
* @param {Callback} callback - The results of the call
|
|
202
214
|
*/
|
|
203
|
-
|
|
204
|
-
const
|
|
215
|
+
iapTroubleshootAdapter(props, persistFlag, callback) {
|
|
216
|
+
const meth = 'adapter-iapTroubleshootAdapter';
|
|
217
|
+
const origin = `${this.id}-${meth}`;
|
|
205
218
|
log.trace(origin);
|
|
219
|
+
|
|
206
220
|
try {
|
|
207
|
-
return super.
|
|
221
|
+
return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
|
|
208
222
|
} catch (error) {
|
|
209
223
|
log.error(`${origin}: ${error}`);
|
|
210
224
|
return callback(null, error);
|
|
@@ -214,15 +228,17 @@ class AzureAks extends AdapterBaseCl {
|
|
|
214
228
|
/**
|
|
215
229
|
* @summary runs healthcheck script for adapter
|
|
216
230
|
*
|
|
217
|
-
* @function
|
|
231
|
+
* @function iapRunAdapterHealthcheck
|
|
218
232
|
* @param {Adapter} adapter - adapter instance to troubleshoot
|
|
219
233
|
* @param {Callback} callback - callback function
|
|
220
234
|
*/
|
|
221
|
-
|
|
222
|
-
const
|
|
235
|
+
iapRunAdapterHealthcheck(callback) {
|
|
236
|
+
const meth = 'adapter-iapRunAdapterHealthcheck';
|
|
237
|
+
const origin = `${this.id}-${meth}`;
|
|
223
238
|
log.trace(origin);
|
|
239
|
+
|
|
224
240
|
try {
|
|
225
|
-
return super.
|
|
241
|
+
return super.iapRunAdapterHealthcheck(this, callback);
|
|
226
242
|
} catch (error) {
|
|
227
243
|
log.error(`${origin}: ${error}`);
|
|
228
244
|
return callback(null, error);
|
|
@@ -232,14 +248,16 @@ class AzureAks extends AdapterBaseCl {
|
|
|
232
248
|
/**
|
|
233
249
|
* @summary runs connectivity check script for adapter
|
|
234
250
|
*
|
|
235
|
-
* @function
|
|
251
|
+
* @function iapRunAdapterConnectivity
|
|
236
252
|
* @param {Callback} callback - callback function
|
|
237
253
|
*/
|
|
238
|
-
|
|
239
|
-
const
|
|
254
|
+
iapRunAdapterConnectivity(callback) {
|
|
255
|
+
const meth = 'adapter-iapRunAdapterConnectivity';
|
|
256
|
+
const origin = `${this.id}-${meth}`;
|
|
240
257
|
log.trace(origin);
|
|
258
|
+
|
|
241
259
|
try {
|
|
242
|
-
return super.
|
|
260
|
+
return super.iapRunAdapterConnectivity(callback);
|
|
243
261
|
} catch (error) {
|
|
244
262
|
log.error(`${origin}: ${error}`);
|
|
245
263
|
return callback(null, error);
|
|
@@ -249,14 +267,16 @@ class AzureAks extends AdapterBaseCl {
|
|
|
249
267
|
/**
|
|
250
268
|
* @summary runs basicGet script for adapter
|
|
251
269
|
*
|
|
252
|
-
* @function
|
|
270
|
+
* @function iapRunAdapterBasicGet
|
|
253
271
|
* @param {Callback} callback - callback function
|
|
254
272
|
*/
|
|
255
|
-
|
|
256
|
-
const
|
|
273
|
+
iapRunAdapterBasicGet(callback) {
|
|
274
|
+
const meth = 'adapter-iapRunAdapterBasicGet';
|
|
275
|
+
const origin = `${this.id}-${meth}`;
|
|
257
276
|
log.trace(origin);
|
|
277
|
+
|
|
258
278
|
try {
|
|
259
|
-
return super.
|
|
279
|
+
return super.iapRunAdapterBasicGet(callback);
|
|
260
280
|
} catch (error) {
|
|
261
281
|
log.error(`${origin}: ${error}`);
|
|
262
282
|
return callback(null, error);
|
|
@@ -264,171 +284,275 @@ class AzureAks extends AdapterBaseCl {
|
|
|
264
284
|
}
|
|
265
285
|
|
|
266
286
|
/**
|
|
267
|
-
* @summary
|
|
287
|
+
* @summary moves entites into Mongo DB
|
|
268
288
|
*
|
|
269
|
-
* @function
|
|
270
|
-
* @param {
|
|
271
|
-
*
|
|
289
|
+
* @function iapMoveAdapterEntitiesToDB
|
|
290
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
291
|
+
* or the error
|
|
292
|
+
*/
|
|
293
|
+
iapMoveAdapterEntitiesToDB(callback) {
|
|
294
|
+
const meth = 'adapter-iapMoveAdapterEntitiesToDB';
|
|
295
|
+
const origin = `${this.id}-${meth}`;
|
|
296
|
+
log.trace(origin);
|
|
297
|
+
|
|
298
|
+
try {
|
|
299
|
+
return super.iapMoveAdapterEntitiesToDB(callback);
|
|
300
|
+
} catch (err) {
|
|
301
|
+
log.error(`${origin}: ${err}`);
|
|
302
|
+
return callback(null, err);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @summary Deactivate adapter tasks
|
|
308
|
+
*
|
|
309
|
+
* @function iapDeactivateTasks
|
|
310
|
+
*
|
|
311
|
+
* @param {Array} tasks - List of tasks to deactivate
|
|
312
|
+
* @param {Callback} callback
|
|
313
|
+
*/
|
|
314
|
+
iapDeactivateTasks(tasks, callback) {
|
|
315
|
+
const meth = 'adapter-iapDeactivateTasks';
|
|
316
|
+
const origin = `${this.id}-${meth}`;
|
|
317
|
+
log.trace(origin);
|
|
318
|
+
|
|
319
|
+
try {
|
|
320
|
+
return super.iapDeactivateTasks(tasks, callback);
|
|
321
|
+
} catch (err) {
|
|
322
|
+
log.error(`${origin}: ${err}`);
|
|
323
|
+
return callback(null, err);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* @summary Activate adapter tasks that have previously been deactivated
|
|
329
|
+
*
|
|
330
|
+
* @function iapActivateTasks
|
|
331
|
+
*
|
|
332
|
+
* @param {Array} tasks - List of tasks to activate
|
|
333
|
+
* @param {Callback} callback
|
|
334
|
+
*/
|
|
335
|
+
iapActivateTasks(tasks, callback) {
|
|
336
|
+
const meth = 'adapter-iapActivateTasks';
|
|
337
|
+
const origin = `${this.id}-${meth}`;
|
|
338
|
+
log.trace(origin);
|
|
339
|
+
|
|
340
|
+
try {
|
|
341
|
+
return super.iapActivateTasks(tasks, callback);
|
|
342
|
+
} catch (err) {
|
|
343
|
+
log.error(`${origin}: ${err}`);
|
|
344
|
+
return callback(null, err);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
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);
|
|
362
|
+
|
|
363
|
+
try {
|
|
364
|
+
return super.iapPopulateEntityCache(entityTypes, callback);
|
|
365
|
+
} catch (err) {
|
|
366
|
+
log.error(`${origin}: ${err}`);
|
|
367
|
+
return callback(null, err);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* @summary Retrieves data from cache for specified entity type
|
|
272
373
|
*
|
|
273
|
-
* @
|
|
274
|
-
*
|
|
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
|
|
275
378
|
*/
|
|
276
|
-
|
|
277
|
-
const
|
|
379
|
+
iapRetrieveEntitiesCache(entityType, options, callback) {
|
|
380
|
+
const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
|
|
381
|
+
const origin = `${this.id}-${meth}`;
|
|
278
382
|
log.trace(origin);
|
|
279
383
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
384
|
+
try {
|
|
385
|
+
return super.iapRetrieveEntitiesCache(entityType, options, callback);
|
|
386
|
+
} catch (err) {
|
|
387
|
+
log.error(`${origin}: ${err}`);
|
|
388
|
+
return callback(null, err);
|
|
389
|
+
}
|
|
283
390
|
}
|
|
284
391
|
|
|
392
|
+
/* BROKER CALLS */
|
|
285
393
|
/**
|
|
286
|
-
* @summary
|
|
287
|
-
* whether the adapter supports type, action and specific entity
|
|
394
|
+
* @summary Determines if this adapter supports any in a list of entities
|
|
288
395
|
*
|
|
289
|
-
* @function
|
|
396
|
+
* @function hasEntities
|
|
290
397
|
* @param {String} entityType - the entity type to check for
|
|
291
|
-
* @param {
|
|
292
|
-
* @param {String/Array} entityId - the specific entity we are looking for
|
|
398
|
+
* @param {Array} entityList - the list of entities we are looking for
|
|
293
399
|
*
|
|
294
|
-
* @param {Callback} callback -
|
|
295
|
-
*
|
|
400
|
+
* @param {Callback} callback - A map where the entity is the key and the
|
|
401
|
+
* value is true or false
|
|
296
402
|
*/
|
|
297
|
-
|
|
298
|
-
const meth = '
|
|
403
|
+
hasEntities(entityType, entityList, callback) {
|
|
404
|
+
const meth = 'adapter-hasEntities';
|
|
299
405
|
const origin = `${this.id}-${meth}`;
|
|
300
406
|
log.trace(origin);
|
|
301
407
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
408
|
+
try {
|
|
409
|
+
return super.hasEntities(entityType, entityList, callback);
|
|
410
|
+
} catch (err) {
|
|
411
|
+
log.error(`${origin}: ${err}`);
|
|
412
|
+
return callback(null, err);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
309
415
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
|
|
324
|
-
if (verror) {
|
|
325
|
-
return callback(null, verror);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return this.capabilityResults(vcapable, callback);
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
default: {
|
|
333
|
-
// unsupported entity type
|
|
334
|
-
const result = [false];
|
|
335
|
-
|
|
336
|
-
// put false in array for all entities
|
|
337
|
-
if (Array.isArray(entityId)) {
|
|
338
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
339
|
-
result.push(false);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
return callback(result);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
416
|
+
/**
|
|
417
|
+
* @summary Get Appliance that match the deviceName
|
|
418
|
+
*
|
|
419
|
+
* @function getDevice
|
|
420
|
+
* @param {String} deviceName - the deviceName to find (required)
|
|
421
|
+
*
|
|
422
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
423
|
+
* (appliance) or the error
|
|
424
|
+
*/
|
|
425
|
+
getDevice(deviceName, callback) {
|
|
426
|
+
const meth = 'adapter-getDevice';
|
|
427
|
+
const origin = `${this.id}-${meth}`;
|
|
428
|
+
log.trace(origin);
|
|
347
429
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
430
|
+
try {
|
|
431
|
+
return super.getDevice(deviceName, callback);
|
|
432
|
+
} catch (err) {
|
|
433
|
+
log.error(`${origin}: ${err}`);
|
|
434
|
+
return callback(null, err);
|
|
351
435
|
}
|
|
436
|
+
}
|
|
352
437
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
438
|
+
/**
|
|
439
|
+
* @summary Get Appliances that match the filter
|
|
440
|
+
*
|
|
441
|
+
* @function getDevicesFiltered
|
|
442
|
+
* @param {Object} options - the data to use to filter the appliances (optional)
|
|
443
|
+
*
|
|
444
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
445
|
+
* (appliances) or the error
|
|
446
|
+
*/
|
|
447
|
+
getDevicesFiltered(options, callback) {
|
|
448
|
+
const meth = 'adapter-getDevicesFiltered';
|
|
449
|
+
const origin = `${this.id}-${meth}`;
|
|
450
|
+
log.trace(origin);
|
|
360
451
|
|
|
361
|
-
|
|
362
|
-
|
|
452
|
+
try {
|
|
453
|
+
return super.getDevicesFiltered(options, callback);
|
|
454
|
+
} catch (err) {
|
|
455
|
+
log.error(`${origin}: ${err}`);
|
|
456
|
+
return callback(null, err);
|
|
363
457
|
}
|
|
458
|
+
}
|
|
364
459
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (verror) {
|
|
379
|
-
return callback(null, verror);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
// is the entity in the list?
|
|
383
|
-
const isEntity = this.entityInList(entityId, data.response, callback);
|
|
384
|
-
const res = [];
|
|
385
|
-
|
|
386
|
-
// not found
|
|
387
|
-
for (let i = 0; i < isEntity.length; i += 1) {
|
|
388
|
-
if (vcapable) {
|
|
389
|
-
res.push(isEntity[i]);
|
|
390
|
-
} else {
|
|
391
|
-
res.push(false);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
return callback(res);
|
|
396
|
-
});
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
default: {
|
|
400
|
-
// unsupported entity type
|
|
401
|
-
const result = [false];
|
|
402
|
-
|
|
403
|
-
// put false in array for all entities
|
|
404
|
-
if (Array.isArray(entityId)) {
|
|
405
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
406
|
-
result.push(false);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
460
|
+
/**
|
|
461
|
+
* @summary Gets the status for the provided appliance
|
|
462
|
+
*
|
|
463
|
+
* @function isAlive
|
|
464
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
465
|
+
*
|
|
466
|
+
* @param {configCallback} callback - callback function to return the result
|
|
467
|
+
* (appliance isAlive) or the error
|
|
468
|
+
*/
|
|
469
|
+
isAlive(deviceName, callback) {
|
|
470
|
+
const meth = 'adapter-isAlive';
|
|
471
|
+
const origin = `${this.id}-${meth}`;
|
|
472
|
+
log.trace(origin);
|
|
409
473
|
|
|
410
|
-
|
|
411
|
-
|
|
474
|
+
try {
|
|
475
|
+
return super.isAlive(deviceName, callback);
|
|
476
|
+
} catch (err) {
|
|
477
|
+
log.error(`${origin}: ${err}`);
|
|
478
|
+
return callback(null, err);
|
|
412
479
|
}
|
|
413
480
|
}
|
|
414
481
|
|
|
415
482
|
/**
|
|
416
|
-
* @summary
|
|
483
|
+
* @summary Gets a config for the provided Appliance
|
|
417
484
|
*
|
|
418
|
-
* @function
|
|
485
|
+
* @function getConfig
|
|
486
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
487
|
+
* @param {String} format - the desired format of the config. (optional)
|
|
419
488
|
*
|
|
489
|
+
* @param {configCallback} callback - callback function to return the result
|
|
490
|
+
* (appliance config) or the error
|
|
420
491
|
*/
|
|
421
|
-
|
|
422
|
-
const
|
|
492
|
+
getConfig(deviceName, format, callback) {
|
|
493
|
+
const meth = 'adapter-getConfig';
|
|
494
|
+
const origin = `${this.id}-${meth}`;
|
|
423
495
|
log.trace(origin);
|
|
424
496
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
497
|
+
try {
|
|
498
|
+
return super.getConfig(deviceName, format, callback);
|
|
499
|
+
} catch (err) {
|
|
500
|
+
log.error(`${origin}: ${err}`);
|
|
501
|
+
return callback(null, err);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* @summary Gets the device count from the system
|
|
507
|
+
*
|
|
508
|
+
* @function iapGetDeviceCount
|
|
509
|
+
*
|
|
510
|
+
* @param {getCallback} callback - callback function to return the result
|
|
511
|
+
* (count) or the error
|
|
512
|
+
*/
|
|
513
|
+
iapGetDeviceCount(callback) {
|
|
514
|
+
const meth = 'adapter-iapGetDeviceCount';
|
|
515
|
+
const origin = `${this.id}-${meth}`;
|
|
516
|
+
log.trace(origin);
|
|
517
|
+
|
|
518
|
+
try {
|
|
519
|
+
return super.iapGetDeviceCount(callback);
|
|
520
|
+
} catch (err) {
|
|
521
|
+
log.error(`${origin}: ${err}`);
|
|
522
|
+
return callback(null, err);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
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);
|
|
432
556
|
}
|
|
433
557
|
}
|
|
434
558
|
|
|
@@ -452,94 +576,84 @@ class AzureAks extends AdapterBaseCl {
|
|
|
452
576
|
const origin = `${this.id}-${meth}`;
|
|
453
577
|
log.trace(origin);
|
|
454
578
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
579
|
+
try {
|
|
580
|
+
return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
581
|
+
} catch (err) {
|
|
582
|
+
log.error(`${origin}: ${err}`);
|
|
583
|
+
return callback(null, err);
|
|
459
584
|
}
|
|
585
|
+
}
|
|
460
586
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
587
|
+
/**
|
|
588
|
+
* Makes the requested generic call with no base path or version
|
|
589
|
+
*
|
|
590
|
+
* @function genericAdapterRequestNoBasePath
|
|
591
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
|
|
592
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
|
|
593
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
594
|
+
* Can be a stringified Object.
|
|
595
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
596
|
+
* Can be a stringified Object.
|
|
597
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
598
|
+
* Can be a stringified Object.
|
|
599
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
600
|
+
* or the error
|
|
601
|
+
*/
|
|
602
|
+
genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
|
|
603
|
+
const meth = 'adapter-genericAdapterRequestNoBasePath';
|
|
604
|
+
const origin = `${this.id}-${meth}`;
|
|
605
|
+
log.trace(origin);
|
|
472
606
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
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);
|
|
478
612
|
}
|
|
479
|
-
|
|
480
|
-
const queryParamsAvailable = queryData;
|
|
481
|
-
const queryParams = {};
|
|
482
|
-
const bodyVars = requestBody;
|
|
613
|
+
}
|
|
483
614
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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);
|
|
491
626
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
payload: bodyVars,
|
|
495
|
-
uriPathVars: pathVars,
|
|
496
|
-
uriQuery: queryParams,
|
|
497
|
-
uriOptions: {}
|
|
498
|
-
};
|
|
499
|
-
// add headers if provided
|
|
500
|
-
if (addlHeaders) {
|
|
501
|
-
reqObj.addlHeaders = addlHeaders;
|
|
502
|
-
}
|
|
627
|
+
return super.iapRunAdapterLint(callback);
|
|
628
|
+
}
|
|
503
629
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
returnF = false;
|
|
516
|
-
}
|
|
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);
|
|
517
641
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
521
|
-
return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
|
|
522
|
-
// if we received an error or their is no response on the results
|
|
523
|
-
// return an error
|
|
524
|
-
if (irReturnError) {
|
|
525
|
-
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
526
|
-
return callback(null, irReturnError);
|
|
527
|
-
}
|
|
528
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
529
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
|
|
530
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
531
|
-
return callback(null, errorObj);
|
|
532
|
-
}
|
|
642
|
+
return super.iapRunAdapterTests(callback);
|
|
643
|
+
}
|
|
533
644
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
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);
|
|
655
|
+
|
|
656
|
+
return super.iapGetAdapterInventory(callback);
|
|
543
657
|
}
|
|
544
658
|
|
|
545
659
|
/**
|