sdk

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

README

SDK

The Rönd SDK API is experimental and currently under heavy development; for this reason it could undergo breaking changes regardless of the rönd package version.

Usage

It is possible to see some example usages of the SDK in tests.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGetEvaluator = errors.New("no Evaluator found in request context")
)

Functions

func WithEvaluator

func WithEvaluator(ctx context.Context, evaluator Evaluator) context.Context

Types

type AuditEvaluatorOptions added in v1.14.2

type AuditEvaluatorOptions struct {
	MongoDBClient       types.MongoClient
	StorageMode         []string
	AuditCollectionName string
	AuditConfig         audit.Config
}

type AuditLabels added in v1.14.0

type AuditLabels = audit.Labels

type AuditOptions added in v1.14.0

type AuditOptions struct {
	AggregationID string
}

type EvaluateOptions added in v1.10.0

type EvaluateOptions struct {
	Logger logging.Logger
	Audit  AuditOptions
}

func (EvaluateOptions) GetLogger added in v1.10.0

func (e EvaluateOptions) GetLogger() logging.Logger

type Evaluator

type Evaluator interface {
	// retrieve the RondConfig used to generate the evaluator
	Config() core.RondConfig

	// EvaluateResponsePolicy evaluate request policy. In the response, it is specified if the
	// request is allowed and the request query (if filter generation is requested)
	EvaluateRequestPolicy(ctx context.Context, input core.Input, options *EvaluateOptions) (PolicyResult, error)
	// EvaluateResponsePolicy evaluate response policy. The response is the response
	// value returned by the policy.
	EvaluateResponsePolicy(ctx context.Context, input core.Input, options *EvaluateOptions) ([]byte, error)
}

Warning: This interface is experimental, and it could change with breaking also in rond patches. Do not use outside this repository until it is ready.

func GetEvaluator

func GetEvaluator(ctx context.Context) (Evaluator, error)

func NewWithConfig

func NewWithConfig(ctx context.Context, opaModuleConfig *core.OPAModuleConfig, rondConfig core.RondConfig, options *Options) (Evaluator, error)

type EvaluatorOptions added in v1.10.0

type EvaluatorOptions struct {
	MongoClient           custom_builtins.IMongoClient
	EnablePrintStatements bool
	EnableAuditTracing    bool
	AuditTracingOptions   AuditEvaluatorOptions
}

type OASEvaluatorFinder

type OASEvaluatorFinder interface {
	FindEvaluator(method, path string) (Evaluator, error)
}

func NewFromOAS

func NewFromOAS(ctx context.Context, opaModuleConfig *core.OPAModuleConfig, oas *openapi.OpenAPISpec, options *Options) (OASEvaluatorFinder, error)

type Options

type Options struct {
	EvaluatorOptions *EvaluatorOptions
	Metrics          *metrics.Metrics
	Logger           logging.Logger
	AuditLabels      AuditLabels
}

type PolicyResult

type PolicyResult struct {
	QueryToProxy []byte
	Allowed      bool
}

Directories

Path Synopsis
rondinput

Jump to

Keyboard shortcuts

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