rules

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2017 License: Apache-2.0 Imports: 15 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBulkNotSupported is returned when unsupported bulk operations are attempted.
	ErrBulkNotSupported = fmt.Errorf("bulk operations not supported")
)

Functions

This section is empty.

Types

type Entry

type Entry struct {
	IV      string `json:"IV"`
	Payload string `json:"payload"`
}

Entry is used to encapsulate a record with an IV for encryption and decryption.

type InvalidRuleError

type InvalidRuleError struct{}

InvalidRuleError occurs when a rule is not valid

func (*InvalidRuleError) Error

func (e *InvalidRuleError) Error() string

Error description

type JSONMarshalError

type JSONMarshalError struct {
	Message string
}

JSONMarshalError describes a JSON marshal or unmarshaling error

func (*JSONMarshalError) Error

func (e *JSONMarshalError) Error() string

Error description

type K8S added in v1.0.0

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

K8S controller. Currently no bulk insert/update operations are supported and the controller is bound to a single namespace.

func NewK8S added in v1.0.0

func NewK8S(ns string) (*K8S, error)

NewK8S creates a kubernetes controller for the namespace.

func (*K8S) AddRules added in v1.0.0

func (k8s *K8S) AddRules(_ string, rules []api.Rule) (out NewRules, err error)

AddRules validates the rules and adds them to the collection for the namespace.

func (*K8S) DeleteRules added in v1.0.0

func (k8s *K8S) DeleteRules(_ string, f api.RuleFilter) (err error)

DeleteRules deletes rules that match the filter in the namespace. FIXME: retrieve, filter and delete are not atomic.

func (*K8S) GetRules added in v1.0.0

func (k8s *K8S) GetRules(_ string, f api.RuleFilter) (RetrievedRules, error)

GetRules returns a collection of filtered rules from the namespace.

func (*K8S) UpdateRules added in v1.0.0

func (k8s *K8S) UpdateRules(_ string, rules []api.Rule) (err error)

UpdateRules updates rules by ID in the namespace.

type Manager

type Manager interface {
	// AddRules validates the rules and adds them to the collection for the namespace.
	AddRules(namespace string, rules []api.Rule) (NewRules, error)

	// GetRules returns a collection of filtered rules from the namespace.
	GetRules(namespace string, filter api.RuleFilter) (RetrievedRules, error)

	// UpdateRules updates rules by ID in the namespace.
	UpdateRules(namespace string, rules []api.Rule) error

	// DeleteRules deletes rules that match the filter in the namespace.
	DeleteRules(namespace string, filter api.RuleFilter) error
}

Manager is an interface for managing collections of rules mapped by namespace.

func NewMemoryManager

func NewMemoryManager(validator api.Validator) Manager

NewMemoryManager constructs a new in memory manager.

func NewRedisManager

func NewRedisManager(host, pass string, v api.Validator) Manager

NewRedisManager creates a Redis backed manager implementation.

type NewRules

type NewRules struct {
	// IDs of the added rules.
	IDs []string
}

NewRules provides information about newly added rules.

type RedisInsertError

type RedisInsertError struct{}

RedisInsertError occurs when there is an issue writing to Redis

func (*RedisInsertError) Error

func (e *RedisInsertError) Error() string

Error description

type RetrievedRules

type RetrievedRules struct {
	// Rules that passed the filter.
	Rules []api.Rule

	// Revision of the rules for this namespace. Each time the collection of rules for the namespace are changed
	// the revision is incremented.
	Revision int64
}

RetrievedRules are the results of a read from a manager.

Jump to

Keyboard shortcuts

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