Skip to main content

Git for JSON Object Import Data Source

Another option for making JSON data available to policies is to store that data in a Git repository and use a Git data source that automatically reads the JSON out of the Git repository.

Configure through the DAS GUI

The following section guides you through configuring <das-id> to access a data source stored in Git repository using the DAS GUI.

Create a DAS System

Go to <das-id> To add a new system, click the ( ⨁ ) plus icon next to SYSTEMS on the left side of the navigation panel.

Fill in the following fields:

  • System type (required): Select any system type from the drop down list. For example, Custom.

  • System name (required): A user-friendly name so that you can distinguish between the different systems.

  • Description (optional): More details about this system.

  • Leave the Show errors switch ON to display the errors.

  • Click Add system button.

Now, your DAS system is created under the SYSTEMS on the left side of the navigation panel.

Add a Data Source

After you create your system, click the three dots () next to it and select Add Data Source to start configuring the data source.

Figure 1 - Add Data SourceFigure 1 - Add Data Source

Now, your Custom System >> Add Data Source dialog appears.

Figure 2 - Add Data Source WindowFigure 2 - Add Data Source Window

Complete the following steps in your Custom System >> Add Data Source dialog box.

  1. Type: An editable data source that you fill in with JSON data and publish. Click the down arrow to select the data source type. For example, select Git for JSON Object Import to pull a JSON object from Git. This refreshes regularly.

    Figure 3 - Data Source TypeFigure 3 - Data Source Type

  2. Path: Enter a new or existing path separated by /. For example, am/datasourcetypes.

  3. Data source name (required): Enter a name for the data source. For example, am-git-for-json-object-import.

  4. Description: This field is optional.

  5. Git authentication: Styra DAS supports either HTTPS or SSH authentication for Git. For example, select HTTPS.

  6. Git repository (required): The subdirectory where you want to save the policies. Enter the Git repository. For example,

  7. Access credentials (required): Enter the access credentials. If the access key and secret already exist, then click the Update access key button.

  8. Reference: Specify a tag or branch reference. For example, refs/heads/master.

  9. Repository path: Enter a relative path within the given repository. For example, example.json.

  10. Refresh interval: Enter a refresh interval which is the amount of time between polling intervals. Default is s.

  11. Click the arrow to expand the Advanced field.

  12. Data transform: Specify a policy and write a query that allows you to apply Rego transformations before it is persisted as data. For example, Select Custom and fill in the following fields:

    • Policy: An existing policy separated by /. For example, transform/transform.rego.

    • Rego query: Path to the Rego rule to evaluate. For example, data.transform.query.

  13. Leave the Enable on-premises data source agent switch OFF. Enable on-premises data source agent shows how and where to run the data source. If set to true then datasource-agent will run on-premises setup, otherwise on SaaS.

    Now, make sure you filled all the fields similar to Figure 5.

    Figure 4 - Verify the Data Source FormFigure 4 - Verify the Data Source Form

  14. Finally, click the Add button to add a data source.

The following shows an example output which appears after the data source is created in DAS.