Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
HTTPClient is interface of http.Client for replancement with owned HTTP client
type Local ¶ added in v0.1.0
type Local struct {
// contains filtered or unexported fields
}
Local loads and compile local policy data and evaluate input data with them.
func NewLocal ¶ added in v0.1.0
func NewLocal(options ...LocalOption) (*Local, error)
NewLocal creates a new Local client. It requires one or more WithFile, WithDir or WithPolicyData.
type LocalOption ¶ added in v0.1.0
type LocalOption func(x *Local)
LocalOption is Option of functional option pattern for Local
func WithDir ¶ added in v0.1.0
func WithDir(dirPath string) LocalOption
WithDir specifies directory path of .rego policy. Import policy files recursively.
func WithFile ¶ added in v0.1.0
func WithFile(filePath string) LocalOption
WithFile specifies .rego policy file path
func WithLoggingLocal ¶ added in v0.1.0
func WithLoggingLocal() LocalOption
WithLoggingLocal enables logger for debug
func WithPackage ¶ added in v0.1.0
func WithPackage(pkg string) LocalOption
WithPackage specifies using package name. e.g. "example.my_policy"
func WithPolicyData ¶ added in v0.1.0
func WithPolicyData(name, policy string) LocalOption
WithPolicyData specifies raw policy data with name. If the `name` conflicts with file path loaded by WithFile or WithDir, the policy overwrites data loaded by WithFile or WithDir.
func WithRegoPrint ¶ added in v0.1.0
func WithRegoPrint(w io.Writer) LocalOption
WithRegoPrint enables OPA print function and output to `w`
type Remote ¶ added in v0.1.0
type Remote struct {
// contains filtered or unexported fields
}
Remote sends a HTTP/HTTPS request to OPA server.
type RemoteOption ¶ added in v0.1.0
type RemoteOption func(x *Remote)
RemoteOption is Option of functional option pattern for Remote
func WithHTTPClient ¶
func WithHTTPClient(client HTTPClient) RemoteOption
WithHTTPClient replaces `http.DefaultClient` with own `HTTPClient` instance.
func WithHTTPHeader ¶ added in v0.1.0
func WithHTTPHeader(name, value string) RemoteOption
WithHTTPHeader adds HTTP header. It can be added multiply.
func WithLoggingRemote ¶ added in v0.1.0
func WithLoggingRemote() RemoteOption
WithLoggingRemote enables logger for debug