@itentialopensource/adapter-gitlab 0.7.4 → 0.8.1
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 +169 -0
- package/CHANGELOG.md +54 -27
- package/CODE_OF_CONDUCT.md +12 -17
- package/CONTRIBUTING.md +88 -74
- package/ENHANCE.md +69 -0
- package/PROPERTIES.md +641 -0
- package/README.md +221 -571
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +384 -73
- package/adapterBase.js +1021 -245
- package/entities/.generic/action.json +110 -5
- package/entities/.generic/schema.json +6 -1
- package/entities/groups/action.json +21 -0
- package/entities/groups/schema.json +11 -0
- package/error.json +6 -0
- package/package.json +13 -7
- package/pronghorn.json +696 -378
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +421 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +10 -0
- package/report/updateReport1652962168533.json +120 -0
- package/sampleProperties.json +90 -1
- package/test/integration/adapterTestBasicGet.js +1 -1
- package/test/integration/adapterTestIntegration.js +91 -102
- package/test/unit/adapterBaseTestUnit.js +30 -25
- package/test/unit/adapterTestUnit.js +239 -181
- package/utils/adapterInfo.js +206 -0
- package/utils/addAuth.js +94 -0
- package/utils/basicGet.js +1 -14
- package/utils/entitiesToDB.js +179 -0
- package/utils/modify.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +3 -0
- package/utils/removeHooks.js +20 -0
- package/utils/tbScript.js +43 -22
- package/utils/tbUtils.js +99 -19
- package/utils/testRunner.js +16 -16
- package/utils/troubleshootingAdapter.js +2 -26
package/adapter.js
CHANGED
|
@@ -82,10 +82,18 @@ class Gitlab extends AdapterBaseCl {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* @
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
let myIgnore = [
|
|
85
|
+
* @iapGetAdapterWorkflowFunctions
|
|
86
|
+
*/
|
|
87
|
+
iapGetAdapterWorkflowFunctions(inIgnore) {
|
|
88
|
+
let myIgnore = [
|
|
89
|
+
'healthCheck',
|
|
90
|
+
'iapGetAdapterWorkflowFunctions',
|
|
91
|
+
'iapHasAdapterEntity',
|
|
92
|
+
'iapVerifyAdapterCapability',
|
|
93
|
+
'iapUpdateAdapterEntityCache',
|
|
94
|
+
'hasEntities',
|
|
95
|
+
'getAuthorization'
|
|
96
|
+
];
|
|
89
97
|
if (!inIgnore && Array.isArray(inIgnore)) {
|
|
90
98
|
myIgnore = inIgnore;
|
|
91
99
|
} else if (!inIgnore && typeof inIgnore === 'string') {
|
|
@@ -96,15 +104,15 @@ class Gitlab extends AdapterBaseCl {
|
|
|
96
104
|
// you can add specific methods that you do not want to be workflow functions to ignore like below
|
|
97
105
|
// myIgnore.push('myMethodNotInWorkflow');
|
|
98
106
|
|
|
99
|
-
return super.
|
|
107
|
+
return super.iapGetAdapterWorkflowFunctions(myIgnore);
|
|
100
108
|
}
|
|
101
109
|
|
|
102
110
|
/**
|
|
103
|
-
*
|
|
111
|
+
* iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
|
|
104
112
|
* allows customers to make changes to adapter configuration without having to be on the
|
|
105
113
|
* file system.
|
|
106
114
|
*
|
|
107
|
-
* @function
|
|
115
|
+
* @function iapUpdateAdapterConfiguration
|
|
108
116
|
* @param {string} configFile - the name of the file being updated (required)
|
|
109
117
|
* @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
|
|
110
118
|
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
|
|
@@ -112,36 +120,42 @@ class Gitlab extends AdapterBaseCl {
|
|
|
112
120
|
* @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
|
|
113
121
|
* @param {Callback} callback - The results of the call
|
|
114
122
|
*/
|
|
115
|
-
|
|
116
|
-
const
|
|
123
|
+
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
|
|
124
|
+
const meth = 'adapter-iapUpdateAdapterConfiguration';
|
|
125
|
+
const origin = `${this.id}-${meth}`;
|
|
117
126
|
log.trace(origin);
|
|
118
|
-
|
|
127
|
+
|
|
128
|
+
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
|
|
119
129
|
}
|
|
120
130
|
|
|
121
131
|
/**
|
|
122
132
|
* See if the API path provided is found in this adapter
|
|
123
133
|
*
|
|
124
|
-
* @function
|
|
134
|
+
* @function iapFindAdapterPath
|
|
125
135
|
* @param {string} apiPath - the api path to check on
|
|
126
136
|
* @param {Callback} callback - The results of the call
|
|
127
137
|
*/
|
|
128
|
-
|
|
129
|
-
const
|
|
138
|
+
iapFindAdapterPath(apiPath, callback) {
|
|
139
|
+
const meth = 'adapter-iapFindAdapterPath';
|
|
140
|
+
const origin = `${this.id}-${meth}`;
|
|
130
141
|
log.trace(origin);
|
|
131
|
-
|
|
142
|
+
|
|
143
|
+
super.iapFindAdapterPath(apiPath, callback);
|
|
132
144
|
}
|
|
133
145
|
|
|
134
146
|
/**
|
|
135
147
|
* @summary Suspends adapter
|
|
136
148
|
*
|
|
137
|
-
* @function
|
|
149
|
+
* @function iapSuspendAdapter
|
|
138
150
|
* @param {Callback} callback - callback function
|
|
139
151
|
*/
|
|
140
|
-
|
|
141
|
-
const
|
|
152
|
+
iapSuspendAdapter(mode, callback) {
|
|
153
|
+
const meth = 'adapter-iapSuspendAdapter';
|
|
154
|
+
const origin = `${this.id}-${meth}`;
|
|
142
155
|
log.trace(origin);
|
|
156
|
+
|
|
143
157
|
try {
|
|
144
|
-
return super.
|
|
158
|
+
return super.iapSuspendAdapter(mode, callback);
|
|
145
159
|
} catch (error) {
|
|
146
160
|
log.error(`${origin}: ${error}`);
|
|
147
161
|
return callback(null, error);
|
|
@@ -151,14 +165,16 @@ class Gitlab extends AdapterBaseCl {
|
|
|
151
165
|
/**
|
|
152
166
|
* @summary Unsuspends adapter
|
|
153
167
|
*
|
|
154
|
-
* @function
|
|
168
|
+
* @function iapUnsuspendAdapter
|
|
155
169
|
* @param {Callback} callback - callback function
|
|
156
170
|
*/
|
|
157
|
-
|
|
158
|
-
const
|
|
171
|
+
iapUnsuspendAdapter(callback) {
|
|
172
|
+
const meth = 'adapter-iapUnsuspendAdapter';
|
|
173
|
+
const origin = `${this.id}-${meth}`;
|
|
159
174
|
log.trace(origin);
|
|
175
|
+
|
|
160
176
|
try {
|
|
161
|
-
return super.
|
|
177
|
+
return super.iapUnsuspendAdapter(callback);
|
|
162
178
|
} catch (error) {
|
|
163
179
|
log.error(`${origin}: ${error}`);
|
|
164
180
|
return callback(null, error);
|
|
@@ -168,29 +184,33 @@ class Gitlab extends AdapterBaseCl {
|
|
|
168
184
|
/**
|
|
169
185
|
* @summary Get the Adaoter Queue
|
|
170
186
|
*
|
|
171
|
-
* @function
|
|
187
|
+
* @function iapGetAdapterQueue
|
|
172
188
|
* @param {Callback} callback - callback function
|
|
173
189
|
*/
|
|
174
|
-
|
|
175
|
-
const
|
|
190
|
+
iapGetAdapterQueue(callback) {
|
|
191
|
+
const meth = 'adapter-iapGetAdapterQueue';
|
|
192
|
+
const origin = `${this.id}-${meth}`;
|
|
176
193
|
log.trace(origin);
|
|
177
|
-
|
|
194
|
+
|
|
195
|
+
return super.iapGetAdapterQueue(callback);
|
|
178
196
|
}
|
|
179
197
|
|
|
180
198
|
/**
|
|
181
199
|
* @summary Runs troubleshoot scripts for adapter
|
|
182
200
|
*
|
|
183
|
-
* @function
|
|
201
|
+
* @function iapTroubleshootAdapter
|
|
184
202
|
* @param {Object} props - the connection, healthcheck and authentication properties
|
|
185
203
|
*
|
|
186
204
|
* @param {boolean} persistFlag - whether the adapter properties should be updated
|
|
187
205
|
* @param {Callback} callback - The results of the call
|
|
188
206
|
*/
|
|
189
|
-
|
|
190
|
-
const
|
|
207
|
+
iapTroubleshootAdapter(props, persistFlag, callback) {
|
|
208
|
+
const meth = 'adapter-iapTroubleshootAdapter';
|
|
209
|
+
const origin = `${this.id}-${meth}`;
|
|
191
210
|
log.trace(origin);
|
|
211
|
+
|
|
192
212
|
try {
|
|
193
|
-
return super.
|
|
213
|
+
return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
|
|
194
214
|
} catch (error) {
|
|
195
215
|
log.error(`${origin}: ${error}`);
|
|
196
216
|
return callback(null, error);
|
|
@@ -200,15 +220,17 @@ class Gitlab extends AdapterBaseCl {
|
|
|
200
220
|
/**
|
|
201
221
|
* @summary runs healthcheck script for adapter
|
|
202
222
|
*
|
|
203
|
-
* @function
|
|
223
|
+
* @function iapRunAdapterHealthcheck
|
|
204
224
|
* @param {Adapter} adapter - adapter instance to troubleshoot
|
|
205
225
|
* @param {Callback} callback - callback function
|
|
206
226
|
*/
|
|
207
|
-
|
|
208
|
-
const
|
|
227
|
+
iapRunAdapterHealthcheck(callback) {
|
|
228
|
+
const meth = 'adapter-iapRunAdapterHealthcheck';
|
|
229
|
+
const origin = `${this.id}-${meth}`;
|
|
209
230
|
log.trace(origin);
|
|
231
|
+
|
|
210
232
|
try {
|
|
211
|
-
return super.
|
|
233
|
+
return super.iapRunAdapterHealthcheck(this, callback);
|
|
212
234
|
} catch (error) {
|
|
213
235
|
log.error(`${origin}: ${error}`);
|
|
214
236
|
return callback(null, error);
|
|
@@ -218,14 +240,16 @@ class Gitlab extends AdapterBaseCl {
|
|
|
218
240
|
/**
|
|
219
241
|
* @summary runs connectivity check script for adapter
|
|
220
242
|
*
|
|
221
|
-
* @function
|
|
243
|
+
* @function iapRunAdapterConnectivity
|
|
222
244
|
* @param {Callback} callback - callback function
|
|
223
245
|
*/
|
|
224
|
-
|
|
225
|
-
const
|
|
246
|
+
iapRunAdapterConnectivity(callback) {
|
|
247
|
+
const meth = 'adapter-iapRunAdapterConnectivity';
|
|
248
|
+
const origin = `${this.id}-${meth}`;
|
|
226
249
|
log.trace(origin);
|
|
250
|
+
|
|
227
251
|
try {
|
|
228
|
-
return super.
|
|
252
|
+
return super.iapRunAdapterConnectivity(callback);
|
|
229
253
|
} catch (error) {
|
|
230
254
|
log.error(`${origin}: ${error}`);
|
|
231
255
|
return callback(null, error);
|
|
@@ -235,44 +259,67 @@ class Gitlab extends AdapterBaseCl {
|
|
|
235
259
|
/**
|
|
236
260
|
* @summary runs basicGet script for adapter
|
|
237
261
|
*
|
|
238
|
-
* @function
|
|
262
|
+
* @function iapRunAdapterBasicGet
|
|
239
263
|
* @param {Callback} callback - callback function
|
|
240
264
|
*/
|
|
241
|
-
|
|
242
|
-
const
|
|
265
|
+
iapRunAdapterBasicGet(callback) {
|
|
266
|
+
const meth = 'adapter-iapRunAdapterBasicGet';
|
|
267
|
+
const origin = `${this.id}-${meth}`;
|
|
243
268
|
log.trace(origin);
|
|
269
|
+
|
|
244
270
|
try {
|
|
245
|
-
return super.
|
|
271
|
+
return super.iapRunAdapterBasicGet(callback);
|
|
246
272
|
} catch (error) {
|
|
247
273
|
log.error(`${origin}: ${error}`);
|
|
248
274
|
return callback(null, error);
|
|
249
275
|
}
|
|
250
276
|
}
|
|
251
277
|
|
|
278
|
+
/**
|
|
279
|
+
* @summary moves entites into Mongo DB
|
|
280
|
+
*
|
|
281
|
+
* @function iapMoveAdapterEntitiesToDB
|
|
282
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
283
|
+
* or the error
|
|
284
|
+
*/
|
|
285
|
+
iapMoveAdapterEntitiesToDB(callback) {
|
|
286
|
+
const meth = 'adapter-iapMoveAdapterEntitiesToDB';
|
|
287
|
+
const origin = `${this.id}-${meth}`;
|
|
288
|
+
log.trace(origin);
|
|
289
|
+
|
|
290
|
+
try {
|
|
291
|
+
return super.iapMoveAdapterEntitiesToDB(callback);
|
|
292
|
+
} catch (err) {
|
|
293
|
+
log.error(`${origin}: ${err}`);
|
|
294
|
+
return callback(null, err);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* BROKER CALLS */
|
|
252
299
|
/**
|
|
253
300
|
* @summary Determines if this adapter supports the specific entity
|
|
254
301
|
*
|
|
255
|
-
* @function
|
|
302
|
+
* @function iapHasAdapterEntity
|
|
256
303
|
* @param {String} entityType - the entity type to check for
|
|
257
304
|
* @param {String/Array} entityId - the specific entity we are looking for
|
|
258
305
|
*
|
|
259
306
|
* @param {Callback} callback - An array of whether the adapter can has the
|
|
260
307
|
* desired capability or an error
|
|
261
308
|
*/
|
|
262
|
-
|
|
263
|
-
const origin = `${this.id}-adapter-
|
|
309
|
+
iapHasAdapterEntity(entityType, entityId, callback) {
|
|
310
|
+
const origin = `${this.id}-adapter-iapHasAdapterEntity`;
|
|
264
311
|
log.trace(origin);
|
|
265
312
|
|
|
266
313
|
// Make the call -
|
|
267
|
-
//
|
|
268
|
-
return this.
|
|
314
|
+
// iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
|
|
315
|
+
return this.iapVerifyAdapterCapability(entityType, null, entityId, callback);
|
|
269
316
|
}
|
|
270
317
|
|
|
271
318
|
/**
|
|
272
319
|
* @summary Provides a way for the adapter to tell north bound integrations
|
|
273
320
|
* whether the adapter supports type, action and specific entity
|
|
274
321
|
*
|
|
275
|
-
* @function
|
|
322
|
+
* @function iapVerifyAdapterCapability
|
|
276
323
|
* @param {String} entityType - the entity type to check for
|
|
277
324
|
* @param {String} actionType - the action type to check for
|
|
278
325
|
* @param {String/Array} entityId - the specific entity we are looking for
|
|
@@ -280,15 +327,15 @@ class Gitlab extends AdapterBaseCl {
|
|
|
280
327
|
* @param {Callback} callback - An array of whether the adapter can has the
|
|
281
328
|
* desired capability or an error
|
|
282
329
|
*/
|
|
283
|
-
|
|
284
|
-
const meth = 'adapterBase-
|
|
330
|
+
iapVerifyAdapterCapability(entityType, actionType, entityId, callback) {
|
|
331
|
+
const meth = 'adapterBase-iapVerifyAdapterCapability';
|
|
285
332
|
const origin = `${this.id}-${meth}`;
|
|
286
333
|
log.trace(origin);
|
|
287
334
|
|
|
288
335
|
// if caching
|
|
289
336
|
if (this.caching) {
|
|
290
|
-
// Make the call -
|
|
291
|
-
return this.requestHandlerInst.
|
|
337
|
+
// Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
|
|
338
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
|
|
292
339
|
if (error) {
|
|
293
340
|
return callback(null, error);
|
|
294
341
|
}
|
|
@@ -306,7 +353,7 @@ class Gitlab extends AdapterBaseCl {
|
|
|
306
353
|
}
|
|
307
354
|
|
|
308
355
|
// need to check the cache again since it has been updated
|
|
309
|
-
return this.requestHandlerInst.
|
|
356
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
|
|
310
357
|
if (verror) {
|
|
311
358
|
return callback(null, verror);
|
|
312
359
|
}
|
|
@@ -339,7 +386,7 @@ class Gitlab extends AdapterBaseCl {
|
|
|
339
386
|
// if no entity id
|
|
340
387
|
if (!entityId) {
|
|
341
388
|
// need to check the cache again since it has been updated
|
|
342
|
-
return this.requestHandlerInst.
|
|
389
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
|
|
343
390
|
if (verror) {
|
|
344
391
|
return callback(null, verror);
|
|
345
392
|
}
|
|
@@ -360,7 +407,7 @@ class Gitlab extends AdapterBaseCl {
|
|
|
360
407
|
}
|
|
361
408
|
|
|
362
409
|
// need to check the cache again since it has been updated
|
|
363
|
-
return this.requestHandlerInst.
|
|
410
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
|
|
364
411
|
if (verror) {
|
|
365
412
|
return callback(null, verror);
|
|
366
413
|
}
|
|
@@ -401,11 +448,11 @@ class Gitlab extends AdapterBaseCl {
|
|
|
401
448
|
/**
|
|
402
449
|
* @summary Updates the cache for all entities by call the get All entity method
|
|
403
450
|
*
|
|
404
|
-
* @function
|
|
451
|
+
* @function iapUpdateAdapterEntityCache
|
|
405
452
|
*
|
|
406
453
|
*/
|
|
407
|
-
|
|
408
|
-
const origin = `${this.id}-adapter-
|
|
454
|
+
iapUpdateAdapterEntityCache() {
|
|
455
|
+
const origin = `${this.id}-adapter-iapUpdateAdapterEntityCache`;
|
|
409
456
|
log.trace(origin);
|
|
410
457
|
|
|
411
458
|
if (this.caching) {
|
|
@@ -418,6 +465,140 @@ class Gitlab extends AdapterBaseCl {
|
|
|
418
465
|
}
|
|
419
466
|
}
|
|
420
467
|
|
|
468
|
+
/**
|
|
469
|
+
* @summary Determines if this adapter supports any in a list of entities
|
|
470
|
+
*
|
|
471
|
+
* @function hasEntities
|
|
472
|
+
* @param {String} entityType - the entity type to check for
|
|
473
|
+
* @param {Array} entityList - the list of entities we are looking for
|
|
474
|
+
*
|
|
475
|
+
* @param {Callback} callback - A map where the entity is the key and the
|
|
476
|
+
* value is true or false
|
|
477
|
+
*/
|
|
478
|
+
hasEntities(entityType, entityList, callback) {
|
|
479
|
+
const meth = 'adapter-hasEntities';
|
|
480
|
+
const origin = `${this.id}-${meth}`;
|
|
481
|
+
log.trace(origin);
|
|
482
|
+
|
|
483
|
+
try {
|
|
484
|
+
return super.hasEntities(entityType, entityList, callback);
|
|
485
|
+
} catch (err) {
|
|
486
|
+
log.error(`${origin}: ${err}`);
|
|
487
|
+
return callback(null, err);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* @summary Get Appliance that match the deviceName
|
|
493
|
+
*
|
|
494
|
+
* @function getDevice
|
|
495
|
+
* @param {String} deviceName - the deviceName to find (required)
|
|
496
|
+
*
|
|
497
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
498
|
+
* (appliance) or the error
|
|
499
|
+
*/
|
|
500
|
+
getDevice(deviceName, callback) {
|
|
501
|
+
const meth = 'adapter-getDevice';
|
|
502
|
+
const origin = `${this.id}-${meth}`;
|
|
503
|
+
log.trace(origin);
|
|
504
|
+
|
|
505
|
+
try {
|
|
506
|
+
return super.getDevice(deviceName, callback);
|
|
507
|
+
} catch (err) {
|
|
508
|
+
log.error(`${origin}: ${err}`);
|
|
509
|
+
return callback(null, err);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* @summary Get Appliances that match the filter
|
|
515
|
+
*
|
|
516
|
+
* @function getDevicesFiltered
|
|
517
|
+
* @param {Object} options - the data to use to filter the appliances (optional)
|
|
518
|
+
*
|
|
519
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
520
|
+
* (appliances) or the error
|
|
521
|
+
*/
|
|
522
|
+
getDevicesFiltered(options, callback) {
|
|
523
|
+
const meth = 'adapter-getDevicesFiltered';
|
|
524
|
+
const origin = `${this.id}-${meth}`;
|
|
525
|
+
log.trace(origin);
|
|
526
|
+
|
|
527
|
+
try {
|
|
528
|
+
return super.getDevicesFiltered(options, callback);
|
|
529
|
+
} catch (err) {
|
|
530
|
+
log.error(`${origin}: ${err}`);
|
|
531
|
+
return callback(null, err);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* @summary Gets the status for the provided appliance
|
|
537
|
+
*
|
|
538
|
+
* @function isAlive
|
|
539
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
540
|
+
*
|
|
541
|
+
* @param {configCallback} callback - callback function to return the result
|
|
542
|
+
* (appliance isAlive) or the error
|
|
543
|
+
*/
|
|
544
|
+
isAlive(deviceName, callback) {
|
|
545
|
+
const meth = 'adapter-isAlive';
|
|
546
|
+
const origin = `${this.id}-${meth}`;
|
|
547
|
+
log.trace(origin);
|
|
548
|
+
|
|
549
|
+
try {
|
|
550
|
+
return super.isAlive(deviceName, callback);
|
|
551
|
+
} catch (err) {
|
|
552
|
+
log.error(`${origin}: ${err}`);
|
|
553
|
+
return callback(null, err);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* @summary Gets a config for the provided Appliance
|
|
559
|
+
*
|
|
560
|
+
* @function getConfig
|
|
561
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
562
|
+
* @param {String} format - the desired format of the config. (optional)
|
|
563
|
+
*
|
|
564
|
+
* @param {configCallback} callback - callback function to return the result
|
|
565
|
+
* (appliance config) or the error
|
|
566
|
+
*/
|
|
567
|
+
getConfig(deviceName, format, callback) {
|
|
568
|
+
const meth = 'adapter-getConfig';
|
|
569
|
+
const origin = `${this.id}-${meth}`;
|
|
570
|
+
log.trace(origin);
|
|
571
|
+
|
|
572
|
+
try {
|
|
573
|
+
return super.getConfig(deviceName, format, callback);
|
|
574
|
+
} catch (err) {
|
|
575
|
+
log.error(`${origin}: ${err}`);
|
|
576
|
+
return callback(null, err);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* @summary Gets the device count from the system
|
|
582
|
+
*
|
|
583
|
+
* @function iapGetDeviceCount
|
|
584
|
+
*
|
|
585
|
+
* @param {getCallback} callback - callback function to return the result
|
|
586
|
+
* (count) or the error
|
|
587
|
+
*/
|
|
588
|
+
iapGetDeviceCount(callback) {
|
|
589
|
+
const meth = 'adapter-iapGetDeviceCount';
|
|
590
|
+
const origin = `${this.id}-${meth}`;
|
|
591
|
+
log.trace(origin);
|
|
592
|
+
|
|
593
|
+
try {
|
|
594
|
+
return super.iapGetDeviceCount(callback);
|
|
595
|
+
} catch (err) {
|
|
596
|
+
log.error(`${origin}: ${err}`);
|
|
597
|
+
return callback(null, err);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
|
|
421
602
|
/**
|
|
422
603
|
* Makes the requested generic call
|
|
423
604
|
*
|
|
@@ -528,6 +709,116 @@ class Gitlab extends AdapterBaseCl {
|
|
|
528
709
|
}
|
|
529
710
|
}
|
|
530
711
|
|
|
712
|
+
/**
|
|
713
|
+
* Makes the requested generic call with no base path or version
|
|
714
|
+
*
|
|
715
|
+
* @function genericAdapterRequestNoBasePath
|
|
716
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
|
|
717
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
|
|
718
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
719
|
+
* Can be a stringified Object.
|
|
720
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
721
|
+
* Can be a stringified Object.
|
|
722
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
723
|
+
* Can be a stringified Object.
|
|
724
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
725
|
+
* or the error
|
|
726
|
+
*/
|
|
727
|
+
genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
|
|
728
|
+
const meth = 'adapter-genericAdapterRequestNoBasePath';
|
|
729
|
+
const origin = `${this.id}-${meth}`;
|
|
730
|
+
log.trace(origin);
|
|
731
|
+
|
|
732
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
733
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
734
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
735
|
+
return callback(null, errorObj);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
739
|
+
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
740
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
741
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
742
|
+
return callback(null, errorObj);
|
|
743
|
+
}
|
|
744
|
+
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
745
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
746
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
747
|
+
return callback(null, errorObj);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
751
|
+
// remove any leading / and split the uripath into path variables
|
|
752
|
+
let myPath = uriPath;
|
|
753
|
+
while (myPath.indexOf('/') === 0) {
|
|
754
|
+
myPath = myPath.substring(1);
|
|
755
|
+
}
|
|
756
|
+
const pathVars = myPath.split('/');
|
|
757
|
+
const queryParamsAvailable = queryData;
|
|
758
|
+
const queryParams = {};
|
|
759
|
+
const bodyVars = requestBody;
|
|
760
|
+
|
|
761
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
762
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
763
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
764
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
765
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
770
|
+
const reqObj = {
|
|
771
|
+
payload: bodyVars,
|
|
772
|
+
uriPathVars: pathVars,
|
|
773
|
+
uriQuery: queryParams,
|
|
774
|
+
uriOptions: {}
|
|
775
|
+
};
|
|
776
|
+
// add headers if provided
|
|
777
|
+
if (addlHeaders) {
|
|
778
|
+
reqObj.addlHeaders = addlHeaders;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// determine the call and return flag
|
|
782
|
+
let action = 'getGenericsNoBase';
|
|
783
|
+
let returnF = true;
|
|
784
|
+
if (restMethod.toUpperCase() === 'POST') {
|
|
785
|
+
action = 'createGenericNoBase';
|
|
786
|
+
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
787
|
+
action = 'updateGenericNoBase';
|
|
788
|
+
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
789
|
+
action = 'patchGenericNoBase';
|
|
790
|
+
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
791
|
+
action = 'deleteGenericNoBase';
|
|
792
|
+
returnF = false;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
try {
|
|
796
|
+
// Make the call -
|
|
797
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
798
|
+
return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
|
|
799
|
+
// if we received an error or their is no response on the results
|
|
800
|
+
// return an error
|
|
801
|
+
if (irReturnError) {
|
|
802
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
803
|
+
return callback(null, irReturnError);
|
|
804
|
+
}
|
|
805
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
806
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
|
|
807
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
808
|
+
return callback(null, errorObj);
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
812
|
+
// return the response
|
|
813
|
+
return callback(irReturnData, null);
|
|
814
|
+
});
|
|
815
|
+
} catch (ex) {
|
|
816
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
817
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
818
|
+
return callback(null, errorObj);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
531
822
|
/**
|
|
532
823
|
* @callback healthCallback
|
|
533
824
|
* @param {Object} result - the result of the get request (contains an id and a status)
|
|
@@ -2048,23 +2339,16 @@ class Gitlab extends AdapterBaseCl {
|
|
|
2048
2339
|
}
|
|
2049
2340
|
|
|
2050
2341
|
/**
|
|
2051
|
-
* @summary Get a list of projects in this group.
|
|
2342
|
+
* @summary Get a list of projects in this group with options.
|
|
2052
2343
|
*
|
|
2053
|
-
* @function
|
|
2344
|
+
* @function getV4GroupsIdProjectsWitOptions
|
|
2054
2345
|
* @param {string} id - The ID of a group
|
|
2055
|
-
* @param {
|
|
2056
|
-
* @param {string} visibility - Limit by visibility
|
|
2057
|
-
* @param {string} search - Return list of authorized projects matching the search criteria
|
|
2058
|
-
* @param {string} orderBy - Return projects ordered by field
|
|
2059
|
-
* @param {string} sort - Return projects sorted in ascending and descending order
|
|
2060
|
-
* @param {boolean} simple - Return only the ID, URL, name, and path of each project
|
|
2061
|
-
* @param {number} page - Current page number
|
|
2062
|
-
* @param {number} perPage - Number of items per page
|
|
2346
|
+
* @param {object} queryData - query options object (e.g. sortBy, includeSubgroups)
|
|
2063
2347
|
* @param {getCallback} callback - a callback function to return the result
|
|
2064
2348
|
*/
|
|
2065
2349
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2066
|
-
|
|
2067
|
-
const meth = 'adapter-
|
|
2350
|
+
getV4GroupsIdProjectsWithOptions(id, queryData, callback) {
|
|
2351
|
+
const meth = 'adapter-getV4GroupsIdProjectsWithOptions';
|
|
2068
2352
|
const origin = `${this.id}-${meth}`;
|
|
2069
2353
|
log.trace(origin);
|
|
2070
2354
|
|
|
@@ -2082,7 +2366,7 @@ class Gitlab extends AdapterBaseCl {
|
|
|
2082
2366
|
}
|
|
2083
2367
|
|
|
2084
2368
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2085
|
-
const queryParamsAvailable =
|
|
2369
|
+
const queryParamsAvailable = queryData;
|
|
2086
2370
|
const queryParams = {};
|
|
2087
2371
|
const pathVars = [id];
|
|
2088
2372
|
const bodyVars = {};
|
|
@@ -2129,6 +2413,27 @@ class Gitlab extends AdapterBaseCl {
|
|
|
2129
2413
|
}
|
|
2130
2414
|
}
|
|
2131
2415
|
|
|
2416
|
+
/**
|
|
2417
|
+
* @summary Get a list of projects in this group.
|
|
2418
|
+
*
|
|
2419
|
+
* @function getV4GroupsIdProjects
|
|
2420
|
+
* @param {string} id - The ID of a group
|
|
2421
|
+
* @param {boolean} archived - Limit by archived status
|
|
2422
|
+
* @param {string} visibility - Limit by visibility
|
|
2423
|
+
* @param {string} search - Return list of authorized projects matching the search criteria
|
|
2424
|
+
* @param {string} orderBy - Return projects ordered by field
|
|
2425
|
+
* @param {string} sort - Return projects sorted in ascending and descending order
|
|
2426
|
+
* @param {boolean} simple - Return only the ID, URL, name, and path of each project
|
|
2427
|
+
* @param {number} page - Current page number
|
|
2428
|
+
* @param {number} perPage - Number of items per page
|
|
2429
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2430
|
+
*/
|
|
2431
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2432
|
+
getV4GroupsIdProjects(id, archived, visibility = 'public', search, orderBy = 'id', sort = 'asc', simple, page, perPage, callback) {
|
|
2433
|
+
const queryData = { archived, visibility, search, orderBy, sort, simple, page, perPage };
|
|
2434
|
+
this.getV4GroupsIdProjectsWithOptions(id, queryData, callback);
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2132
2437
|
/**
|
|
2133
2438
|
* @summary Transfer a project to the group namespace. Available only for admin.
|
|
2134
2439
|
*
|
|
@@ -28619,10 +28924,11 @@ class Gitlab extends AdapterBaseCl {
|
|
|
28619
28924
|
* @function deleteV4ProjectsIdRepositoryFiles
|
|
28620
28925
|
* @param {string} id - The project ID
|
|
28621
28926
|
* @param {string} filePath - Url encoded full path to new file
|
|
28927
|
+
* @param {object} body - the payload to send with the request
|
|
28622
28928
|
* @param {getCallback} callback - a callback function to return the result
|
|
28623
28929
|
*/
|
|
28624
28930
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
28625
|
-
deleteV4ProjectsIdRepositoryFiles(id, filePath, callback) {
|
|
28931
|
+
deleteV4ProjectsIdRepositoryFiles(id, filePath, body, callback) {
|
|
28626
28932
|
const meth = 'adapter-deleteV4ProjectsIdRepositoryFiles';
|
|
28627
28933
|
const origin = `${this.id}-${meth}`;
|
|
28628
28934
|
log.trace(origin);
|
|
@@ -28644,12 +28950,17 @@ class Gitlab extends AdapterBaseCl {
|
|
|
28644
28950
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28645
28951
|
return callback(null, errorObj);
|
|
28646
28952
|
}
|
|
28953
|
+
if (body === undefined || body === null || body === '') {
|
|
28954
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
28955
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28956
|
+
return callback(null, errorObj);
|
|
28957
|
+
}
|
|
28647
28958
|
|
|
28648
28959
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
28649
28960
|
const queryParamsAvailable = {};
|
|
28650
28961
|
const queryParams = {};
|
|
28651
28962
|
const pathVars = [id, filePath];
|
|
28652
|
-
const bodyVars =
|
|
28963
|
+
const bodyVars = body;
|
|
28653
28964
|
|
|
28654
28965
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
28655
28966
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|