Git for data import Data Source
Use the Git for data import Data Source to make JSON data available to policies using data in a Git repository and a Git data source that automatically reads JSON, YAML, XML, and .tfstate
files from the Git repository.
Creating or Configuring the Data Source through the Styra DAS UI
Create or configure the Data Source through the Styra DAS UI.
- Login to the Styra DAS UI.
- Select the System to add the Data Source.
- Click the kebab icon (three dots ⋮) to the right of the System and select Add Data Source. The Add Data Source dialog box appears.
- Select Git for JSON object import.
- In Path type a new or existing path separated by
/
. For example,am/datasourcetypes
. - In Data Source name (required) type the name for the Data Source.
- (Optional) Type in a Description.
- In Git authentication select HTTPS or SSH authentication for Git.
- Git repository (required) type the subdirectory where you want to save the policies. Enter the Git repository. For example,
https://github.com/username/test-rules.git
. - (HTTPS) In Username type in the Git username.
- (HTTPS) In Personal access token type in the Git Personal access token.
- (SSH) In SSH key (required) provide the SSH key.
- (SSH) In SSH key passphrase type the SSH key passphrase.
- In Reference type a tag or branch reference. For example,
refs/heads/master
. - In Git Commit SHA type in the Git commit SHA.
- In Repository path type a relative path within the given repository. For example,
example.json
. - In Refresh interval type a refresh interval which is the amount of time between polling intervals. Default is
s
. - (Optional) Click the arrow to expand the Advanced field.
- (Optional) In Data transform: Specify a policy and write a query that allows you to apply Rego transformations before it is persisted as data. For Custom and fill in the following fields:
- In Policy type an existing policy separated by
/
. For example,transform/transform.rego
. - In Rego query type the path to the Rego rule to evaluate. For example,
data.transform.query
.
- In Policy type an existing policy separated by
- Preview the Data Source in the right pane. If the data is over 1 MB, the Preview will display an error.
- Click the Add.
The following shows an example output which appears after the data source is created in Styra DAS.
{
"a":1,
"b":2,
"c":3
}