opa

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ERR_CODE_BUILD_MANAGER_FAILURE     = "OPA_BUILD_MANAGER_FAILURE"
	ERR_CODE_BUILD_DISCOVERY_FAILURE   = "OPA_BUILD_DISCOVERY_FAILURE"
	ERR_CODE_START_MANAGER_FAILURE     = "OPA_START_MANAGER_FAILURE"
	ERR_CODE_BUILD_REGO_OBJECT_FAILURE = "OPA_BUILD_REGO_FAILURE"
	ERR_CODE_EVAL_REGO_FAILURE         = "OPA_EVAL_REGO_FAILURE"
	ERR_CODE_NO_DECISION               = "OPA_NO_DECISION"
	ERR_CODE_NON_BOOLEAN_DECISION      = "OPA_NON_BOOLEAN_DECISION"
)

Variables

View Source
var (
	ErrNoDecision                            = errors.New("Undefined decision").WithCode(ERR_CODE_NO_DECISION)
	ErrNonBooleanDecision errors.CustomError = errors.New("Non-boolean decision").WithCode(ERR_CODE_NON_BOOLEAN_DECISION)
)

Functions

This section is empty.

Types

type AuthorizationResult

type AuthorizationResult []map[string]interface{}

AuthorizationResult ...

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an OPA authorization client

func MustNewClient added in v1.0.1

func MustNewClient(opaBundleBaseURL string, opaPollingMinDelay, opaPollingMaxDelay int) Client

MustNewClient creates a new Client object. It panics if any error is found.

func NewClient

func NewClient(opaBundleBaseURL string, opaPollingMinDelay, opaPollingMaxDelay int) (Client, error)

NewClient creates a new Client object

func (Client) DecideIfAllowed

func (c Client) DecideIfAllowed(ctx context.Context, regoQuery, method, path, brandID, userID string) (bool, error)

DecideIfAllowed indicates if the given user is allowed to perform the given action

func (Client) ExecuteQuery

func (c Client) ExecuteQuery(ctx context.Context, query string, input map[string]interface{}) (AuthorizationResult, error)

ExecuteQuery ...

Jump to

Keyboard shortcuts

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