server

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2017 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package server contains the policy engine's server handlers.

Index

Constants

View Source
const DefaultDiagnosticsBufferSize = 10

DefaultDiagnosticsBufferSize is the default size of the server's diagnostic buffer.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationScheme added in v0.4.5

type AuthenticationScheme int

AuthenticationScheme enumerates the supported authentication schemes. The authentication scheme determines how client identities are established.

const (
	AuthenticationOff   AuthenticationScheme = iota
	AuthenticationToken                      = iota
)

Set of supported authentication schemes.

type AuthorizationScheme added in v0.4.5

type AuthorizationScheme int

AuthorizationScheme enumerates the supported authorization schemes. The authorization scheme determines how access to OPA is controlled.

const (
	AuthorizationOff   AuthorizationScheme = iota
	AuthorizationBasic                     = iota
)

Set of supported authorization schemes.

type Buffer added in v0.5.5

type Buffer interface {
	// Push adds the given Info into the buffer.
	Push(*Info)

	// Iter iterates over the buffer, from oldest present Info to newest. It should
	// call fn on each Info.
	Iter(fn func(*Info))
}

Buffer defines the interface for types that can be used as the diagnostic buffer within the OPA server. Buffers must be be able to handle concurrent calls.

func NewBoundedBuffer added in v0.5.5

func NewBoundedBuffer(n int) Buffer

NewBoundedBuffer creates a new Buffer with maximum size n. NewBoundedBuffer will panic if n is not positive.

type Info added in v0.5.5

type Info struct {
	Query     string
	Timestamp time.Time

	Input   interface{}
	Results *interface{}
	Error   error

	Metrics metrics.Metrics
	Trace   []*topdown.Event
}

Info stores diagnostic information about the evaluation of a query.

type Server

type Server struct {
	Handler http.Handler
	// contains filtered or unexported fields
}

Server represents an instance of OPA running in server mode.

func New

func New() *Server

New returns a new Server.

func (*Server) Compiler

func (s *Server) Compiler() *ast.Compiler

Compiler returns the server's compiler.

The server's compiler contains the compiled versions of all modules added to the server as well as data structures for performing query analysis. This is intended to allow services to embed the OPA server while still relying on the topdown package for query evaluation.

func (*Server) Init added in v0.4.5

func (s *Server) Init(ctx context.Context) (*Server, error)

Init initializes the server. This function MUST be called before Loop.

func (*Server) Listeners added in v0.4.6

func (s *Server) Listeners() (func() error, func() error)

Listeners returns functions that listen and serve connections.

func (*Server) WithAddress added in v0.4.5

func (s *Server) WithAddress(addr string) *Server

WithAddress sets the listening address that the server will bind to.

func (*Server) WithAuthentication added in v0.4.5

func (s *Server) WithAuthentication(scheme AuthenticationScheme) *Server

WithAuthentication sets authentication scheme to use on the server.

func (*Server) WithAuthorization added in v0.4.5

func (s *Server) WithAuthorization(scheme AuthorizationScheme) *Server

WithAuthorization sets authorization scheme to use on the server.

func (*Server) WithCertificate added in v0.4.5

func (s *Server) WithCertificate(cert *tls.Certificate) *Server

WithCertificate sets the server-side certificate that the server will use.

func (*Server) WithCompilerErrorLimit added in v0.5.3

func (s *Server) WithCompilerErrorLimit(limit int) *Server

WithCompilerErrorLimit sets the limit on the number of compiler errors the server will allow.

func (*Server) WithDiagnosticsBuffer added in v0.5.5

func (s *Server) WithDiagnosticsBuffer(buf Buffer) *Server

WithDiagnosticsBuffer sets the diagnostics buffer stored by the server.

func (*Server) WithInsecureAddress added in v0.4.6

func (s *Server) WithInsecureAddress(addr string) *Server

WithInsecureAddress sets the listening address that the server will bind to.

func (*Server) WithStore added in v0.5.0

func (s *Server) WithStore(store storage.Store) *Server

WithStore sets the storage used by the server.

Directories

Path Synopsis
Package authorizer provides authorization handlers to the server.
Package authorizer provides authorization handlers to the server.
Package identifier provides handlers for associating an identity with incoming requests.
Package identifier provides handlers for associating an identity with incoming requests.
Package types contains request/response types and codes for the server.
Package types contains request/response types and codes for the server.
Package writer contains utilities for writing responses in the server.
Package writer contains utilities for writing responses in the server.

Jump to

Keyboard shortcuts

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