Load external JSON data snapshot from a URL for policy evaluation
Description
Availability for getting JSON data from external URL should be provided. Configuration for the external URL source must be provided in a configuration file in the policy bundle folder in the policy repository. The configuration must contain a URL, a request method and a period in which to make an update request. Optional body of the request could be provided. Example:
{
"url": "wwww.example.com/data.json?page=3",
"method": "GET",
"period": "10h"
}
The policy synchronization application should be changed in order to sync the configurations for the external JSON data sources.
Important
In policy bundle folder either a data.json file or a configuration for external JSON data snapshot should be provided. There should be a warning that the data.json file will be replaced once the JSON data is fetched form the external source.
AC:
- configuration for fetching external JSON data snapshot is synchronized and persisted in a mongo DB collection;
- in the DB collection the last execution time is stored;
- an asynchronous process in policy service is querying the DB collection on some configurable period for configurations that are due for execution;
- an execution is making a request with the configured method on the configured URL and with passing the optional body of the request;
- the result of the execution is a valid JSON which is stored in the data field in the
policies
collection for the current policy and is later available in the execution runtime for the policy.