@itentialopensource/adapter-checkpoint_management 0.4.0 → 0.5.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/CHANGELOG.md
CHANGED
package/adapter.js
CHANGED
|
@@ -928,6 +928,101 @@ class CheckpointManagement extends AdapterBaseCl {
|
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
930
|
|
|
931
|
+
/**
|
|
932
|
+
* @summary loginToDomainWithSid
|
|
933
|
+
*
|
|
934
|
+
* @function loginToDomainWithSid
|
|
935
|
+
* @param {string} sid - session id
|
|
936
|
+
* @param {object} body - body param
|
|
937
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
938
|
+
*/
|
|
939
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
940
|
+
loginToDomainWithSid(sid, body, callback) {
|
|
941
|
+
const meth = 'adapter-loginToDomainWithSid';
|
|
942
|
+
const origin = `${this.id}-${meth}`;
|
|
943
|
+
log.trace(origin);
|
|
944
|
+
|
|
945
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
946
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
947
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
948
|
+
return callback(null, errorObj);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
952
|
+
if (body === undefined || body === null || body === '') {
|
|
953
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
954
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
955
|
+
return callback(null, errorObj);
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
959
|
+
const queryParamsAvailable = {};
|
|
960
|
+
const queryParams = {};
|
|
961
|
+
const pathVars = [];
|
|
962
|
+
const bodyVars = body;
|
|
963
|
+
|
|
964
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
965
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
966
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
967
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
968
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
|
|
972
|
+
// if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
|
|
973
|
+
let thisHeaderData = null;
|
|
974
|
+
// if the additional headers was passed in as a string parse the json into an object
|
|
975
|
+
if (thisHeaderData !== null && thisHeaderData.constructor === String) {
|
|
976
|
+
try {
|
|
977
|
+
// parse the additional headers object that was passed in
|
|
978
|
+
thisHeaderData = JSON.parse(thisHeaderData);
|
|
979
|
+
} catch (err) {
|
|
980
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
|
|
981
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
982
|
+
return callback(null, errorObj);
|
|
983
|
+
}
|
|
984
|
+
} else if (thisHeaderData === null) {
|
|
985
|
+
thisHeaderData = { xChkpSid: '' };
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
989
|
+
const reqObj = {
|
|
990
|
+
payload: bodyVars,
|
|
991
|
+
uriPathVars: pathVars,
|
|
992
|
+
uriQuery: queryParams,
|
|
993
|
+
addlHeaders: thisHeaderData
|
|
994
|
+
};
|
|
995
|
+
if (sid) {
|
|
996
|
+
reqObj.addlHeaders['X-chkp-sid'] = sid;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
try {
|
|
1000
|
+
// Make the call -
|
|
1001
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1002
|
+
return this.requestHandlerInst.identifyRequest('SessionManagement', 'loginToDomainWithSid', reqObj, true, (irReturnData, irReturnError) => {
|
|
1003
|
+
// if we received an error or their is no response on the results
|
|
1004
|
+
// return an error
|
|
1005
|
+
if (irReturnError) {
|
|
1006
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1007
|
+
return callback(null, irReturnError);
|
|
1008
|
+
}
|
|
1009
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1010
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['loginToDomainWithSid'], null, null, null);
|
|
1011
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1012
|
+
return callback(null, errorObj);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1016
|
+
// return the response
|
|
1017
|
+
return callback(irReturnData, null);
|
|
1018
|
+
});
|
|
1019
|
+
} catch (ex) {
|
|
1020
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1021
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1022
|
+
return callback(null, errorObj);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
|
|
931
1026
|
/**
|
|
932
1027
|
* @summary publish
|
|
933
1028
|
*
|
|
@@ -21,6 +21,27 @@
|
|
|
21
21
|
}
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
"name": "loginToDomainWithSid",
|
|
26
|
+
"protocol": "REST",
|
|
27
|
+
"method": "POST",
|
|
28
|
+
"entitypath": "{base_path}/{version}/login-to-domain?{query}",
|
|
29
|
+
"requestSchema": "schema.json",
|
|
30
|
+
"responseSchema": "schema.json",
|
|
31
|
+
"timeout": 0,
|
|
32
|
+
"sendEmpty": true,
|
|
33
|
+
"sendGetBody": false,
|
|
34
|
+
"requestDatatype": "JSON",
|
|
35
|
+
"responseDatatype": "JSON",
|
|
36
|
+
"headers": {},
|
|
37
|
+
"responseObjects": [
|
|
38
|
+
{
|
|
39
|
+
"type": "default",
|
|
40
|
+
"key": "",
|
|
41
|
+
"mockFile": ""
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
24
45
|
{
|
|
25
46
|
"name": "publish",
|
|
26
47
|
"protocol": "REST",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-checkpoint_management",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "This adapter integrates with system described as: checkpointManagementApi.",
|
|
5
5
|
"main": "adapter.js",
|
|
6
6
|
"systemName": "Check Point Management",
|
package/pronghorn.json
CHANGED
|
@@ -699,6 +699,50 @@
|
|
|
699
699
|
},
|
|
700
700
|
"task": true
|
|
701
701
|
},
|
|
702
|
+
{
|
|
703
|
+
"name": "loginToDomainWithSid",
|
|
704
|
+
"summary": "loginToDomainWithSid",
|
|
705
|
+
"description": "Login to a domain with sid.",
|
|
706
|
+
"input": [
|
|
707
|
+
{
|
|
708
|
+
"name": "sid",
|
|
709
|
+
"type": "string",
|
|
710
|
+
"info": "Session unique identifier returned by the login request.",
|
|
711
|
+
"required": true,
|
|
712
|
+
"schema": {
|
|
713
|
+
"title": "sid",
|
|
714
|
+
"type": "string"
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
"name": "body",
|
|
719
|
+
"type": "object",
|
|
720
|
+
"info": ": object",
|
|
721
|
+
"required": true,
|
|
722
|
+
"schema": {
|
|
723
|
+
"title": "body",
|
|
724
|
+
"type": "object"
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
],
|
|
728
|
+
"output": {
|
|
729
|
+
"name": "result",
|
|
730
|
+
"type": "object",
|
|
731
|
+
"description": "A JSON Object containing status, code and the result",
|
|
732
|
+
"schema": {
|
|
733
|
+
"title": "result",
|
|
734
|
+
"type": "object"
|
|
735
|
+
}
|
|
736
|
+
},
|
|
737
|
+
"roles": [
|
|
738
|
+
"admin"
|
|
739
|
+
],
|
|
740
|
+
"route": {
|
|
741
|
+
"verb": "POST",
|
|
742
|
+
"path": "/loginToDomainWithSid"
|
|
743
|
+
},
|
|
744
|
+
"task": true
|
|
745
|
+
},
|
|
702
746
|
{
|
|
703
747
|
"name": "publish",
|
|
704
748
|
"summary": "publish",
|
|
Binary file
|