opaclient

package
v0.51.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OPAUpdatePolicy is the update policies path in the opa rest api.
	OPAUpdatePolicy = "/v1/policies"
	// OPANamedPolicyDecision is the eval policies path in the opa rest api.
	OPANamedPolicyDecision = "/v1/data"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	RemoteURI string
	Policy    string

	PolicyName string
	PolicyPath string
	// contains filtered or unexported fields
}

Client is the configuration struct for the opa client.

func (*Client) Bootstrap

func (c *Client) Bootstrap() error

Bootstrap loads the rego policies found in "$DataDir/policy.rego" in the remote opa, name of the remote policy is the value of $DataDir

if the policy exists it is updated

it is important that the package in the rego document matches the DataDir.

func (*Client) Decide

func (c *Client) Decide(data []byte) (bool, error)

Decide sends the provided data to the remote OPA server for a named decision uses the DataDir value above to match the policy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL