@itentialopensource/adapter-f5_bigiq 0.4.4 → 0.4.6
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 +6 -0
- package/CHANGELOG.md +16 -0
- package/adapter.js +82 -0
- package/entities/BIGIPTMSHScripting/action.json +21 -0
- package/entities/BIGIPTMSHScripting/schema.json +2 -1
- package/package.json +4 -4
- package/pronghorn.json +34 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +7 -7
- package/test/integration/adapterTestIntegration.js +25 -0
- package/test/unit/adapterTestUnit.js +31 -2
package/CALLS.md
CHANGED
|
@@ -2128,6 +2128,12 @@ Specific adapter calls are built based on the API of the f5 BIG-IQ. The Adapter
|
|
|
2128
2128
|
<td style="padding:15px">{base_path}/{version}/mgmt/shared/user-script-execution/{pathv1}?{query}</td>
|
|
2129
2129
|
<td style="padding:15px">Yes</td>
|
|
2130
2130
|
</tr>
|
|
2131
|
+
<tr>
|
|
2132
|
+
<td style="padding:15px">deleteBIGIPscript(scriptId, callback)</td>
|
|
2133
|
+
<td style="padding:15px">Delete BIG-IP script</td>
|
|
2134
|
+
<td style="padding:15px">{base_path}/{version}/mgmt/shared/user-scripts/{pathv1}?{query}</td>
|
|
2135
|
+
<td style="padding:15px">Yes</td>
|
|
2136
|
+
</tr>
|
|
2131
2137
|
<tr>
|
|
2132
2138
|
<td style="padding:15px">retrieveallSoftwareImages(filter, orderby, callback)</td>
|
|
2133
2139
|
<td style="padding:15px">Retrieve all Software Images</td>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
## 0.4.6 [03-08-2024]
|
|
3
|
+
|
|
4
|
+
* Adds call to delete script from BIG-IQ
|
|
5
|
+
|
|
6
|
+
See merge request itentialopensource/adapters/controller-orchestrator/adapter-f5_bigiq!13
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 0.4.5 [02-28-2024]
|
|
11
|
+
|
|
12
|
+
* Changes made at 2024.02.28_11:25AM
|
|
13
|
+
|
|
14
|
+
See merge request itentialopensource/adapters/controller-orchestrator/adapter-f5_bigiq!12
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
2
18
|
## 0.4.4 [12-24-2023]
|
|
3
19
|
|
|
4
20
|
* update metadata
|
package/adapter.js
CHANGED
|
@@ -27433,6 +27433,88 @@ class F5BigIQ extends AdapterBaseCl {
|
|
|
27433
27433
|
}
|
|
27434
27434
|
}
|
|
27435
27435
|
|
|
27436
|
+
/**
|
|
27437
|
+
* @function deleteBIGIPscript
|
|
27438
|
+
* @pronghornType method
|
|
27439
|
+
* @name deleteBIGIPscript
|
|
27440
|
+
* @summary Delete BIG-IP script
|
|
27441
|
+
*
|
|
27442
|
+
* @param {string} scriptId - scriptId param
|
|
27443
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
27444
|
+
* @return {object} results - An object containing the response of the action
|
|
27445
|
+
*
|
|
27446
|
+
* @route {DELETE} /deleteBIGIPscript
|
|
27447
|
+
* @roles admin
|
|
27448
|
+
* @task true
|
|
27449
|
+
*/
|
|
27450
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
27451
|
+
deleteBIGIPscript(scriptId, callback) {
|
|
27452
|
+
const meth = 'adapter-deleteBIGIPscript';
|
|
27453
|
+
const origin = `${this.id}-${meth}`;
|
|
27454
|
+
log.trace(origin);
|
|
27455
|
+
|
|
27456
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
27457
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
27458
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
27459
|
+
return callback(null, errorObj);
|
|
27460
|
+
}
|
|
27461
|
+
|
|
27462
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
27463
|
+
if (scriptId === undefined || scriptId === null || scriptId === '') {
|
|
27464
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['scriptId'], null, null, null);
|
|
27465
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
27466
|
+
return callback(null, errorObj);
|
|
27467
|
+
}
|
|
27468
|
+
|
|
27469
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
27470
|
+
const queryParamsAvailable = {};
|
|
27471
|
+
const queryParams = {};
|
|
27472
|
+
const pathVars = [scriptId];
|
|
27473
|
+
const bodyVars = {};
|
|
27474
|
+
|
|
27475
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
27476
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
27477
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
27478
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
27479
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
27480
|
+
}
|
|
27481
|
+
});
|
|
27482
|
+
|
|
27483
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
27484
|
+
// see adapter code documentation for more information on the request object's fields
|
|
27485
|
+
const reqObj = {
|
|
27486
|
+
payload: bodyVars,
|
|
27487
|
+
uriPathVars: pathVars,
|
|
27488
|
+
uriQuery: queryParams
|
|
27489
|
+
};
|
|
27490
|
+
|
|
27491
|
+
try {
|
|
27492
|
+
// Make the call -
|
|
27493
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
27494
|
+
return this.requestHandlerInst.identifyRequest('BIGIPTMSHScripting', 'deleteBIGIPscript', reqObj, true, (irReturnData, irReturnError) => {
|
|
27495
|
+
// if we received an error or their is no response on the results
|
|
27496
|
+
// return an error
|
|
27497
|
+
if (irReturnError) {
|
|
27498
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
27499
|
+
return callback(null, irReturnError);
|
|
27500
|
+
}
|
|
27501
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
27502
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteBIGIPscript'], null, null, null);
|
|
27503
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
27504
|
+
return callback(null, errorObj);
|
|
27505
|
+
}
|
|
27506
|
+
|
|
27507
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
27508
|
+
// return the response
|
|
27509
|
+
return callback(irReturnData, null);
|
|
27510
|
+
});
|
|
27511
|
+
} catch (ex) {
|
|
27512
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
27513
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
27514
|
+
return callback(null, errorObj);
|
|
27515
|
+
}
|
|
27516
|
+
}
|
|
27517
|
+
|
|
27436
27518
|
/**
|
|
27437
27519
|
* @function retrieveallSoftwareImages
|
|
27438
27520
|
* @pronghornType method
|
|
@@ -102,6 +102,27 @@
|
|
|
102
102
|
"mockFile": ""
|
|
103
103
|
}
|
|
104
104
|
]
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "deleteBIGIPscript",
|
|
108
|
+
"protocol": "REST",
|
|
109
|
+
"method": "DELETE",
|
|
110
|
+
"entitypath": "{base_path}/{version}/mgmt/shared/user-scripts/{pathv1}?{query}",
|
|
111
|
+
"requestSchema": "schema.json",
|
|
112
|
+
"responseSchema": "schema.json",
|
|
113
|
+
"timeout": 0,
|
|
114
|
+
"sendEmpty": false,
|
|
115
|
+
"sendGetBody": false,
|
|
116
|
+
"requestDatatype": "JSON",
|
|
117
|
+
"responseDatatype": "JSON",
|
|
118
|
+
"headers": {},
|
|
119
|
+
"responseObjects": [
|
|
120
|
+
{
|
|
121
|
+
"type": "default",
|
|
122
|
+
"key": "",
|
|
123
|
+
"mockFile": ""
|
|
124
|
+
}
|
|
125
|
+
]
|
|
105
126
|
}
|
|
106
127
|
]
|
|
107
128
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-f5_bigiq",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "This adapter integrates with system described as: f5Big-iqApi.",
|
|
5
5
|
"main": "adapter.js",
|
|
6
6
|
"wizardVersion": "2.44.7",
|
|
@@ -55,15 +55,15 @@
|
|
|
55
55
|
"author": "Itential",
|
|
56
56
|
"homepage": "https://gitlab.com/itentialopensource/adapters/controller-orchestrator/adapter-f5_bigiq#readme",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@itentialopensource/adapter-utils": "^5.3.
|
|
58
|
+
"@itentialopensource/adapter-utils": "^5.3.8",
|
|
59
59
|
"acorn": "^8.10.0",
|
|
60
60
|
"ajv": "^8.12.0",
|
|
61
|
-
"axios": "^1.6.
|
|
61
|
+
"axios": "^1.6.7",
|
|
62
62
|
"commander": "^11.0.0",
|
|
63
63
|
"dns-lookup-promise": "^1.0.4",
|
|
64
64
|
"fs-extra": "^11.1.1",
|
|
65
65
|
"json-query": "^2.2.2",
|
|
66
|
-
"mocha": "^10.
|
|
66
|
+
"mocha": "^10.3.0",
|
|
67
67
|
"mocha-param": "^2.0.1",
|
|
68
68
|
"mongodb": "^4.17.1",
|
|
69
69
|
"nyc": "^15.1.0",
|
package/pronghorn.json
CHANGED
|
@@ -12643,6 +12643,40 @@
|
|
|
12643
12643
|
},
|
|
12644
12644
|
"task": true
|
|
12645
12645
|
},
|
|
12646
|
+
{
|
|
12647
|
+
"name": "deleteBIGIPscript",
|
|
12648
|
+
"summary": "Delete BIG-IP script",
|
|
12649
|
+
"description": "Delete BIG-IP script",
|
|
12650
|
+
"input": [
|
|
12651
|
+
{
|
|
12652
|
+
"name": "scriptId",
|
|
12653
|
+
"type": "string",
|
|
12654
|
+
"info": ": string",
|
|
12655
|
+
"required": true,
|
|
12656
|
+
"schema": {
|
|
12657
|
+
"title": "scriptId",
|
|
12658
|
+
"type": "string"
|
|
12659
|
+
}
|
|
12660
|
+
}
|
|
12661
|
+
],
|
|
12662
|
+
"output": {
|
|
12663
|
+
"name": "result",
|
|
12664
|
+
"type": "object",
|
|
12665
|
+
"description": "A JSON Object containing status, code and the result",
|
|
12666
|
+
"schema": {
|
|
12667
|
+
"title": "result",
|
|
12668
|
+
"type": "object"
|
|
12669
|
+
}
|
|
12670
|
+
},
|
|
12671
|
+
"roles": [
|
|
12672
|
+
"admin"
|
|
12673
|
+
],
|
|
12674
|
+
"route": {
|
|
12675
|
+
"verb": "POST",
|
|
12676
|
+
"path": "/deleteBIGIPscript"
|
|
12677
|
+
},
|
|
12678
|
+
"task": true
|
|
12679
|
+
},
|
|
12646
12680
|
{
|
|
12647
12681
|
"name": "retrieveallSoftwareImages",
|
|
12648
12682
|
"summary": "Retrieve all Software Images",
|
|
Binary file
|
package/report/adapterInfo.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.4.
|
|
3
|
-
"configLines":
|
|
2
|
+
"version": "0.4.5",
|
|
3
|
+
"configLines": 15378,
|
|
4
4
|
"scriptLines": 1783,
|
|
5
|
-
"codeLines":
|
|
6
|
-
"testLines":
|
|
7
|
-
"testCases":
|
|
8
|
-
"totalCodeLines":
|
|
9
|
-
"wfTasks":
|
|
5
|
+
"codeLines": 30745,
|
|
6
|
+
"testLines": 23341,
|
|
7
|
+
"testCases": 1246,
|
|
8
|
+
"totalCodeLines": 55869,
|
|
9
|
+
"wfTasks": 369
|
|
10
10
|
}
|
|
@@ -8716,6 +8716,31 @@ describe('[integration] F5BigIQ Adapter Test', () => {
|
|
|
8716
8716
|
}).timeout(attemptTimeout);
|
|
8717
8717
|
});
|
|
8718
8718
|
|
|
8719
|
+
describe('#deleteBIGIPscript - errors', () => {
|
|
8720
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
8721
|
+
try {
|
|
8722
|
+
a.deleteBIGIPscript('fakedata', (data, error) => {
|
|
8723
|
+
try {
|
|
8724
|
+
if (stub) {
|
|
8725
|
+
const displayE = 'Error 400 received on request';
|
|
8726
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-f5_bigiq-connectorRest-handleEndResponse', displayE);
|
|
8727
|
+
} else {
|
|
8728
|
+
runCommonAsserts(data, error);
|
|
8729
|
+
}
|
|
8730
|
+
saveMockData('BIGIPTMSHScripting', 'deleteBIGIPscript', 'default', data);
|
|
8731
|
+
done();
|
|
8732
|
+
} catch (err) {
|
|
8733
|
+
log.error(`Test Failure: ${err}`);
|
|
8734
|
+
done(err);
|
|
8735
|
+
}
|
|
8736
|
+
});
|
|
8737
|
+
} catch (error) {
|
|
8738
|
+
log.error(`Adapter Exception: ${error}`);
|
|
8739
|
+
done(error);
|
|
8740
|
+
}
|
|
8741
|
+
}).timeout(attemptTimeout);
|
|
8742
|
+
});
|
|
8743
|
+
|
|
8719
8744
|
describe('#retrieveallSoftwareImages - errors', () => {
|
|
8720
8745
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
8721
8746
|
try {
|
|
@@ -316,10 +316,10 @@ describe('[unit] F5BigIQ Adapter Test', () => {
|
|
|
316
316
|
assert.notEqual(null, packageDotJson.dependencies);
|
|
317
317
|
assert.notEqual('', packageDotJson.dependencies);
|
|
318
318
|
assert.equal('^8.12.0', packageDotJson.dependencies.ajv);
|
|
319
|
-
assert.equal('^1.6.
|
|
319
|
+
assert.equal('^1.6.7', packageDotJson.dependencies.axios);
|
|
320
320
|
assert.equal('^11.0.0', packageDotJson.dependencies.commander);
|
|
321
321
|
assert.equal('^11.1.1', packageDotJson.dependencies['fs-extra']);
|
|
322
|
-
assert.equal('^10.
|
|
322
|
+
assert.equal('^10.3.0', packageDotJson.dependencies.mocha);
|
|
323
323
|
assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
|
|
324
324
|
assert.equal('^15.1.0', packageDotJson.dependencies.nyc);
|
|
325
325
|
assert.equal('^0.4.4', packageDotJson.dependencies.ping);
|
|
@@ -12072,6 +12072,35 @@ describe('[unit] F5BigIQ Adapter Test', () => {
|
|
|
12072
12072
|
}).timeout(attemptTimeout);
|
|
12073
12073
|
});
|
|
12074
12074
|
|
|
12075
|
+
describe('#deleteBIGIPscript - errors', () => {
|
|
12076
|
+
it('should have a deleteBIGIPscript function', (done) => {
|
|
12077
|
+
try {
|
|
12078
|
+
assert.equal(true, typeof a.deleteBIGIPscript === 'function');
|
|
12079
|
+
done();
|
|
12080
|
+
} catch (error) {
|
|
12081
|
+
log.error(`Test Failure: ${error}`);
|
|
12082
|
+
done(error);
|
|
12083
|
+
}
|
|
12084
|
+
}).timeout(attemptTimeout);
|
|
12085
|
+
it('should error if - missing scriptId', (done) => {
|
|
12086
|
+
try {
|
|
12087
|
+
a.deleteBIGIPscript(null, (data, error) => {
|
|
12088
|
+
try {
|
|
12089
|
+
const displayE = 'scriptId is required';
|
|
12090
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-f5_bigiq-adapter-deleteBIGIPscript', displayE);
|
|
12091
|
+
done();
|
|
12092
|
+
} catch (err) {
|
|
12093
|
+
log.error(`Test Failure: ${err}`);
|
|
12094
|
+
done(err);
|
|
12095
|
+
}
|
|
12096
|
+
});
|
|
12097
|
+
} catch (error) {
|
|
12098
|
+
log.error(`Adapter Exception: ${error}`);
|
|
12099
|
+
done(error);
|
|
12100
|
+
}
|
|
12101
|
+
}).timeout(attemptTimeout);
|
|
12102
|
+
});
|
|
12103
|
+
|
|
12075
12104
|
describe('#retrieveallSoftwareImages - errors', () => {
|
|
12076
12105
|
it('should have a retrieveallSoftwareImages function', (done) => {
|
|
12077
12106
|
try {
|