opa

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUndefinedErr

func IsUndefinedErr(err error) bool

IsUndefinedErr returns true if the err represents an undefined result from OPA.

func MakeDenyObject

func MakeDenyObject(id, kind, name, namespace, message string, patches []types.PatchOperation) types.Deny

MakeDenyObject is helped menthod to make deny object

Types

type Client

type Client interface {
	Policies
	Query
}

Client defines the OPA client interface.

func New

func New(url string, opaCAs *x509.CertPool, opaAuthToken string) Client

New returns a new Client object.

func NewFromFlags

func NewFromFlags() Client

type Error

type Error struct {
	Code    string          `json:"code"`
	Message string          `json:"message"`
	Errors  json.RawMessage `json:"errors,omitempty"`
}

Error contains the standard error fields returned by OPA.

func (*Error) Error

func (err *Error) Error() string

type FakeOPA

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

FakeOPA is a OPA mock used for unit testing

func (*FakeOPA) PostQuery

func (o *FakeOPA) PostQuery(query string) ([]map[string]interface{}, error)

PostQuery implements the PostQuest OPA client interface and returns violations based matching query patterns set using SetViolations api

func (*FakeOPA) SetViolation

func (o *FakeOPA) SetViolation(querypattern string, violations ...types.Deny)

SetViolation sets a violation for a query pattern

type Policies

type Policies interface {
	InsertPolicy(id string, bs []byte) error
	DeletePolicy(id string) error
}

Policies defines the policy management interface in OPA.

type Query

type Query interface {
	PostQuery(query string) ([]map[string]interface{}, error)
}

Query defines the interface for query data in OPA.

type Undefined

type Undefined struct{}

Undefined represents an undefined response from OPA.

func (Undefined) Error

func (Undefined) Error() string

Jump to

Keyboard shortcuts

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