policy

package
v0.0.0-...-e4b6a09 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Mgr = New()

Mgr is a global instance of policy manager

Functions

This section is empty.

Types

type Filter

type Filter interface {
	// Build filter from the given policy schema
	BuildFrom(pl *policy.Schema) Filter
	// Filter the inputting candidates and return the matched ones.
	Filter(candidates []*selector.Candidate) ([]*selector.Candidate, error)
}

Filter defines the filter operations of the preheat policy.

func NewFilter

func NewFilter() Filter

NewFilter constructs a filter

type Manager

type Manager interface {
	// Count returns the total count of policies according to the query
	Count(ctx context.Context, query *q.Query) (total int64, err error)
	// Create the policy schema
	Create(ctx context.Context, schema *policy.Schema) (id int64, err error)
	// Update the policy schema, Only the properties specified by "props" will be updated if it is set
	Update(ctx context.Context, schema *policy.Schema, props ...string) (err error)
	// Get the policy schema by id
	Get(ctx context.Context, id int64) (schema *policy.Schema, err error)
	// GetByName the policy schema by project ID and name
	GetByName(ctx context.Context, projectID int64, name string) (schema *policy.Schema, err error)
	// Delete the policy schema by id
	Delete(ctx context.Context, id int64) (err error)
	// List policy schemas by query
	ListPolicies(ctx context.Context, query *q.Query) (schemas []*policy.Schema, err error)
	// list policy schema under project
	ListPoliciesByProject(ctx context.Context, project int64, query *q.Query) (schemas []*policy.Schema, err error)
}

Manager manages the policy

func New

func New() Manager

New creates an instance of the default policy manager

Jump to

Keyboard shortcuts

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