rule

package
v0.0.0-...-a7b91b5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Evaluator

type Evaluator interface {
	// Filter the inputs and return the filtered outputs
	//
	//  Arguments:
	//    artifacts []*art.Candidate : candidates for processing
	//
	//  Returns:
	//    []*art.Candidate : matched candidates for next stage
	//    error            : common error object if any errors occurred
	Process(artifacts []*selector.Candidate) ([]*selector.Candidate, error)

	// Specify what action is performed to the candidates processed by this evaluator
	Action() string
}

Evaluator defines method of executing rule

type Factory

type Factory func(parameters Parameters) Evaluator

Factory defines a factory method for creating rule evaluator

type Metadata

type Metadata struct {
	// UUID of rule
	ID int `json:"id"`

	// Priority of rule when doing calculating
	Priority int `json:"priority"`

	// Disabled rule
	Disabled bool `json:"disabled"`

	// Action of the rule performs
	// "retain"
	Action string `json:"action" valid:"Required"`

	// Template ID
	Template string `json:"template" valid:"Required"`

	// The parameters of this rule
	Parameters Parameters `json:"params" valid:"Required"`

	// Selector attached to the rule for filtering tags
	TagSelectors []*Selector `json:"tag_selectors" valid:"Required"`

	// Selector attached to the rule for filtering scope (e.g: repositories or namespaces)
	ScopeSelectors map[string][]*Selector `json:"scope_selectors" valid:"Required"`
}

Metadata of the retention rule

func (*Metadata) Valid

func (m *Metadata) Valid(v *validation.Validation)

Valid Valid

type Parameter

type Parameter interface{}

Parameter of rule

type Parameters

type Parameters map[string]Parameter

Parameters of rule, indexed by the key

type Selector

type Selector struct {
	// Kind of the selector
	// "doublestar" or "label"
	Kind string `json:"kind" valid:"Required;Match(doublestar)"`

	// Decorated the selector
	// for "doublestar" : "matching" and "excluding"
	// for "label" : "with" and "without"
	Decoration string `json:"decoration" valid:"Required"`

	// Param for the selector
	Pattern string `json:"pattern" valid:"Required"`

	// Extras for other settings
	Extras string `json:"extras"`
}

Selector to narrow down the list

type Validator

type Validator func(parameters Parameters) error

Validator ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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