-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for UserDefinedValue can be fetched from configured json DataSource #183
base: dev
Are you sure you want to change the base?
Conversation
UserDefined to create Values defined in User provided DataSource. Supported Datasources: JSON File available in classpath Rest Endpoint that serve JSON response
Updated ValueExpressionParser to support userDefinedDataType
Hi Hemanth, |
@vajda Yes I need HTTP (JSON) DataSource for Berserker the same way as CSV DataSource exists within Ranger project |
@hemanthkilari |
@vajda Let us discuss your approach. We will take decision based on outcome. |
@hemanthkilari
I'd like that we come up with common agreement on this conceptual level first, then we can discuss implementation approach and details. |
@vajda I have no issues with your suggestions. The presented code was written for our need. I do not mind in changing it to satisfy Ranger specification. Provide me other details to proceed with implementation. |
@hemanthkilari
Besides I think that's all. When you make these changes, I'll do a code review on the pull request. Once again, thanks for your interest in Ranger, your help is very much appreciated and welcome! |
Created support for UsedDefinedValue to be fetched from a Json or http endpoint along with option to apply filter on the Datasource. This requirement is needed for me, when I tried creating berserker configurations in the form of a workflow for a Rest service having dependent rest Endpoints. And I believe that this is a requirement that most berserker users like.
Method Usage:
userDefinedValue("DataSourceName","JsonPathQuery","refreshIntervalInSeconds","regExpressionToFetchExpectedStringFromFetchedField")
DataSourceName: Can be a name of JSON file available in classpath/ A Rest endpoint that return a JSON response
JsonPathQuery: JSON path query to extract a Filed from specified Data Source. For semantics, please refer to https://github.com/json-path/JsonPath
refreshIntervalInSeconds: To refresh the data at configured intervals if the source support dynamic data retrieval.
regExpressionToFetchExpectedStringFromFetchedField: To support the case where the requirement is not complete field and only specific part.
example definitions:
Sample JSON:
{
"firstName": "John",
"lastName" : "doe",
"age" : 26,
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
},
"phoneNumbers": [
{
"type" : "iPhone",
"number": "0123-4567-8888"
},
{
"type" : "home",
"number": "0123-4567-8910"
}
]
}
userDefinedValue("resources","$.phoneNumbers[].type","100"," ")
userDefinedValue("http:/url/resources","$.phoneNumbers[].type","100"," ")
above Value Definition will evaluate to Values
"iPhone",
"home"