@itentialopensource/adapter-solarwinds 0.6.0 → 0.6.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/CHANGELOG.md +8 -0
- package/adapter.js +75 -0
- package/entities/CRUD/action.json +21 -0
- package/entities/CRUD/schema.json +2 -1
- package/package.json +2 -2
- package/pronghorn.json +44 -0
- package/refs?service=git-upload-pack +0 -0
- package/test/integration/adapterTestIntegration.js +30 -0
- package/test/unit/adapterTestUnit.js +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
## 0.6.1 [05-04-2023]
|
|
3
|
+
|
|
4
|
+
* Added new call to create custom property for orion node
|
|
5
|
+
|
|
6
|
+
See merge request itentialopensource/adapters/telemetry-analytics/adapter-solarwinds!16
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
2
10
|
## 0.6.0 [05-27-2022]
|
|
3
11
|
|
|
4
12
|
* Migration to the latest Adapter Foundation
|
package/adapter.js
CHANGED
|
@@ -55512,6 +55512,81 @@ class Solarwinds extends AdapterBaseCl {
|
|
|
55512
55512
|
return callback(null, errorObj);
|
|
55513
55513
|
}
|
|
55514
55514
|
}
|
|
55515
|
+
|
|
55516
|
+
/**
|
|
55517
|
+
* @summary function postCreateOrionNodeCustomProperty
|
|
55518
|
+
*
|
|
55519
|
+
* @function postCreateOrionNodeCustomProperty
|
|
55520
|
+
* @param {string} swisUri - swis uri for node
|
|
55521
|
+
* @param {object} body - body param
|
|
55522
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
55523
|
+
*/
|
|
55524
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
55525
|
+
postCreateOrionNodeCustomProperty(swisUri, body, callback) {
|
|
55526
|
+
const meth = 'adapter-postCreateOrionNodeCustomProperty';
|
|
55527
|
+
const origin = `${this.id}-${meth}`;
|
|
55528
|
+
log.trace(origin);
|
|
55529
|
+
|
|
55530
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
55531
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
55532
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
55533
|
+
return callback(null, errorObj);
|
|
55534
|
+
}
|
|
55535
|
+
|
|
55536
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
55537
|
+
if (swisUri === undefined || swisUri === null || swisUri === '') {
|
|
55538
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['swisUri'], null, null, null);
|
|
55539
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
55540
|
+
return callback(null, errorObj);
|
|
55541
|
+
}
|
|
55542
|
+
|
|
55543
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
55544
|
+
const queryParamsAvailable = {};
|
|
55545
|
+
const queryParams = {};
|
|
55546
|
+
const pathVars = [swisUri];
|
|
55547
|
+
const bodyVars = body;
|
|
55548
|
+
|
|
55549
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
55550
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
55551
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
55552
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
55553
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
55554
|
+
}
|
|
55555
|
+
});
|
|
55556
|
+
|
|
55557
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
55558
|
+
const reqObj = {
|
|
55559
|
+
payload: bodyVars,
|
|
55560
|
+
uriPathVars: pathVars,
|
|
55561
|
+
uriQuery: queryParams
|
|
55562
|
+
};
|
|
55563
|
+
|
|
55564
|
+
try {
|
|
55565
|
+
// Make the call -
|
|
55566
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
55567
|
+
return this.requestHandlerInst.identifyRequest('CRUD', 'postCreateOrionNodeCustomProperty', reqObj, true, (irReturnData, irReturnError) => {
|
|
55568
|
+
// if we received an error or their is no response on the results
|
|
55569
|
+
// return an error
|
|
55570
|
+
if (irReturnError) {
|
|
55571
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
55572
|
+
return callback(null, irReturnError);
|
|
55573
|
+
}
|
|
55574
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
55575
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postCreateOrionNodeCustomProperty'], null, null, null);
|
|
55576
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
55577
|
+
return callback(null, errorObj);
|
|
55578
|
+
}
|
|
55579
|
+
|
|
55580
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
55581
|
+
// return the response
|
|
55582
|
+
return callback(irReturnData, null);
|
|
55583
|
+
});
|
|
55584
|
+
} catch (ex) {
|
|
55585
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
55586
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
55587
|
+
return callback(null, errorObj);
|
|
55588
|
+
}
|
|
55589
|
+
}
|
|
55515
55590
|
}
|
|
55516
55591
|
|
|
55517
55592
|
module.exports = Solarwinds;
|
|
@@ -3443,6 +3443,27 @@
|
|
|
3443
3443
|
"mockFile": ""
|
|
3444
3444
|
}
|
|
3445
3445
|
]
|
|
3446
|
+
},
|
|
3447
|
+
{
|
|
3448
|
+
"name" : "postCreateOrionNodeCustomProperty",
|
|
3449
|
+
"protocol": "REST",
|
|
3450
|
+
"method": "POST",
|
|
3451
|
+
"entitypath": "{base_path}/{version}/{pathv1}/CustomProperties?{query}",
|
|
3452
|
+
"requestSchema": "schema.json",
|
|
3453
|
+
"responseSchema": "schema.json",
|
|
3454
|
+
"timeout": 0,
|
|
3455
|
+
"sendEmpty": false,
|
|
3456
|
+
"sendGetBody": false,
|
|
3457
|
+
"requestDatatype": "JSON",
|
|
3458
|
+
"responseDatatype": "PLAIN",
|
|
3459
|
+
"headers": {},
|
|
3460
|
+
"responseObjects": [
|
|
3461
|
+
{
|
|
3462
|
+
"type": "default",
|
|
3463
|
+
"key": "",
|
|
3464
|
+
"mockFile": ""
|
|
3465
|
+
}
|
|
3466
|
+
]
|
|
3446
3467
|
}
|
|
3447
3468
|
]
|
|
3448
3469
|
}
|
|
@@ -173,7 +173,8 @@
|
|
|
173
173
|
"postCreateOrionWirelessHeatMapMap",
|
|
174
174
|
"postCreateSWISfRemoteSWIS",
|
|
175
175
|
"postCreateSystemSubscription",
|
|
176
|
-
"postCreateSystemSubscriptionProperty"
|
|
176
|
+
"postCreateSystemSubscriptionProperty",
|
|
177
|
+
"postCreateOrionNodeCustomProperty"
|
|
177
178
|
],
|
|
178
179
|
"external_name": "ph_request_type"
|
|
179
180
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-solarwinds",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "This adapter integrates with system Solarwinds",
|
|
5
5
|
"main": "adapter.js",
|
|
6
6
|
"systemName": "Solarwinds",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"author": "Itential",
|
|
55
55
|
"homepage": "https://gitlab.com/itentialopensource/adapters/telemetry-analytics/adapter-solarwinds#readme",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@itentialopensource/adapter-utils": "^4.
|
|
57
|
+
"@itentialopensource/adapter-utils": "^4.48.13",
|
|
58
58
|
"ajv": "^6.12.0",
|
|
59
59
|
"axios": "^0.21.0",
|
|
60
60
|
"commander": "^2.20.0",
|
package/pronghorn.json
CHANGED
|
@@ -27587,6 +27587,50 @@
|
|
|
27587
27587
|
"path": "/postInvokeSystemActiveQueryCancelByClientSessionID"
|
|
27588
27588
|
},
|
|
27589
27589
|
"task": true
|
|
27590
|
+
},
|
|
27591
|
+
{
|
|
27592
|
+
"name": "postCreateOrionNodeCustomProperty",
|
|
27593
|
+
"summary": "",
|
|
27594
|
+
"description": "",
|
|
27595
|
+
"input": [
|
|
27596
|
+
{
|
|
27597
|
+
"name" : "swisUri",
|
|
27598
|
+
"type": "string",
|
|
27599
|
+
"info": "",
|
|
27600
|
+
"required": true,
|
|
27601
|
+
"schema" : {
|
|
27602
|
+
"title": "swisUri",
|
|
27603
|
+
"type" : "string"
|
|
27604
|
+
}
|
|
27605
|
+
},
|
|
27606
|
+
{
|
|
27607
|
+
"name": "body",
|
|
27608
|
+
"type": "object",
|
|
27609
|
+
"info": "",
|
|
27610
|
+
"required": true,
|
|
27611
|
+
"schema": {
|
|
27612
|
+
"title": "body",
|
|
27613
|
+
"type": "object"
|
|
27614
|
+
}
|
|
27615
|
+
}
|
|
27616
|
+
],
|
|
27617
|
+
"output": {
|
|
27618
|
+
"name": "result",
|
|
27619
|
+
"type": "object",
|
|
27620
|
+
"description": "A JSON Object containing status, code and the result",
|
|
27621
|
+
"schema": {
|
|
27622
|
+
"title": "result",
|
|
27623
|
+
"type": "object"
|
|
27624
|
+
}
|
|
27625
|
+
},
|
|
27626
|
+
"roles": [
|
|
27627
|
+
"admin"
|
|
27628
|
+
],
|
|
27629
|
+
"route": {
|
|
27630
|
+
"verb": "POST",
|
|
27631
|
+
"path": "/postCreateOrionNodeCustomProperty"
|
|
27632
|
+
},
|
|
27633
|
+
"task": true
|
|
27590
27634
|
}
|
|
27591
27635
|
]
|
|
27592
27636
|
}
|
|
Binary file
|
|
@@ -23471,5 +23471,35 @@ describe('[integration] SolarWinds Adapter Test', () => {
|
|
|
23471
23471
|
}
|
|
23472
23472
|
}).timeout(attemptTimeout);
|
|
23473
23473
|
});
|
|
23474
|
+
|
|
23475
|
+
describe('#postCreateOrionNodeCustomProperty - errors', () => {
|
|
23476
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
23477
|
+
try {
|
|
23478
|
+
a.postCreateOrionNodeCustomProperty('fakedata', 'fakedata', (data, error) => {
|
|
23479
|
+
try {
|
|
23480
|
+
if (stub) {
|
|
23481
|
+
assert.notEqual(undefined, error);
|
|
23482
|
+
assert.notEqual(null, error);
|
|
23483
|
+
assert.equal(null, data);
|
|
23484
|
+
assert.equal('AD.500', error.icode);
|
|
23485
|
+
assert.equal('Error 400 received on request', error.IAPerror.displayString);
|
|
23486
|
+
const temp = 'no mock data for';
|
|
23487
|
+
assert.equal(0, error.IAPerror.raw_response.message.indexOf(temp));
|
|
23488
|
+
} else {
|
|
23489
|
+
runCommonAsserts(data, error);
|
|
23490
|
+
}
|
|
23491
|
+
|
|
23492
|
+
done();
|
|
23493
|
+
} catch (err) {
|
|
23494
|
+
log.error(`Test Failure: ${err}`);
|
|
23495
|
+
done(err);
|
|
23496
|
+
}
|
|
23497
|
+
});
|
|
23498
|
+
} catch (error) {
|
|
23499
|
+
log.error(`Adapter Exception: ${error}`);
|
|
23500
|
+
done(error);
|
|
23501
|
+
}
|
|
23502
|
+
}).timeout(attemptTimeout);
|
|
23503
|
+
});
|
|
23474
23504
|
});
|
|
23475
23505
|
});
|
|
@@ -10850,5 +10850,34 @@ describe('[unit] SolarWinds Adapter Test', () => {
|
|
|
10850
10850
|
}
|
|
10851
10851
|
}).timeout(attemptTimeout);
|
|
10852
10852
|
});
|
|
10853
|
+
|
|
10854
|
+
describe('#postCreateOrionNodeCustomProperty - errors', () => {
|
|
10855
|
+
it('should have a postCreateOrionNodeCustomProperty function', (done) => {
|
|
10856
|
+
try {
|
|
10857
|
+
assert.equal(true, typeof a.postCreateOrionNodeCustomProperty === 'function');
|
|
10858
|
+
done();
|
|
10859
|
+
} catch (error) {
|
|
10860
|
+
log.error(`Test Failure: ${error}`);
|
|
10861
|
+
done(error);
|
|
10862
|
+
}
|
|
10863
|
+
}).timeout(attemptTimeout);
|
|
10864
|
+
it('should error if - missing swisUri', (done) => {
|
|
10865
|
+
try {
|
|
10866
|
+
a.postCreateOrionNodeCustomProperty(null, null, (data, error) => {
|
|
10867
|
+
try {
|
|
10868
|
+
const displayE = 'swisUri is required';
|
|
10869
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-solarwinds-adapter-postCreateOrionNodeCustomProperty', displayE);
|
|
10870
|
+
done();
|
|
10871
|
+
} catch (err) {
|
|
10872
|
+
log.error(`Test Failure: ${err}`);
|
|
10873
|
+
done(err);
|
|
10874
|
+
}
|
|
10875
|
+
});
|
|
10876
|
+
} catch (error) {
|
|
10877
|
+
log.error(`Adapter Exception: ${error}`);
|
|
10878
|
+
done(error);
|
|
10879
|
+
}
|
|
10880
|
+
}).timeout(attemptTimeout);
|
|
10881
|
+
});
|
|
10853
10882
|
});
|
|
10854
10883
|
});
|