policy

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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// FilterTypeRepository represents the repository filter type
	FilterTypeRepository FilterType = "repository"
	// FilterTypeTag represents the tag filter type
	FilterTypeTag FilterType = "tag"
	// FilterTypeSignature represents the signature filter type
	FilterTypeSignature FilterType = "signature"
	// FilterTypeVulnerability represents the vulnerability filter type
	FilterTypeVulnerability FilterType = "vulnerability"
	// FilterTypeLabel represents the label filter type
	FilterTypeLabel FilterType = "label"

	// TriggerTypeManual represents the manual trigger type
	TriggerTypeManual TriggerType = "manual"
	// TriggerTypeScheduled represents the scheduled trigger type
	TriggerTypeScheduled TriggerType = "scheduled"
	// TriggerTypeEventBased represents the event_based trigger type
	TriggerTypeEventBased TriggerType = "event_based"

	// ScopeTypeSinglePeer represents preheat image to single peer in p2p cluster.
	ScopeTypeSinglePeer ScopeType = "single_peer"
	// ScopeTypeAllPeers represents preheat image to all peers in p2p cluster.
	ScopeTypeAllPeers ScopeType = "all_peers"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Type  FilterType  `json:"type"`
	Value interface{} `json:"value"`
}

Filter holds the info of the filter

type FilterType

type FilterType = string

FilterType represents the type info of the filter.

type Schema

type Schema struct {
	ID          int64  `orm:"column(id)" json:"id"`
	Name        string `orm:"column(name)" json:"name"`
	Description string `orm:"column(description)" json:"description"`
	// use project id
	ProjectID  int64     `orm:"column(project_id)" json:"project_id"`
	ProviderID int64     `orm:"column(provider_id)" json:"provider_id"`
	Filters    []*Filter `orm:"-" json:"filters"`
	// Use JSON data format (query by filter type should be supported)
	FiltersStr string   `orm:"column(filters)" json:"-"`
	Trigger    *Trigger `orm:"-" json:"trigger"`
	// Use JSON data format (query by trigger type should be supported)
	TriggerStr string `orm:"column(trigger)" json:"-"`
	Enabled    bool   `orm:"column(enabled)" json:"enabled"`
	// Scope decides the preheat scope.
	Scope       string    `orm:"column(scope)" json:"scope"`
	CreatedAt   time.Time `orm:"column(creation_time)" json:"creation_time"`
	UpdatedTime time.Time `orm:"column(update_time)" json:"update_time"`
}

Schema defines p2p preheat policy schema

func (*Schema) Decode

func (s *Schema) Decode() error

Decode decodes policy schema.

func (*Schema) Encode

func (s *Schema) Encode() error

Encode encodes policy schema.

func (*Schema) GetDefaultSorts

func (s *Schema) GetDefaultSorts() []*q.Sort

GetDefaultSorts specifies the default sorts

func (*Schema) TableName

func (s *Schema) TableName() string

TableName specifies the policy schema table name.

func (*Schema) ValidatePreheatPolicy

func (s *Schema) ValidatePreheatPolicy() error

ValidatePreheatPolicy validate preheat policy

type ScopeType

type ScopeType = string

ScopeType represents the preheat scope type.

type Trigger

type Trigger struct {
	// The preheat policy trigger type. The valid values ar manual, scheduled.
	Type     TriggerType `json:"type"`
	Settings struct {
		// The cron string for scheduled trigger.
		Cron string `json:"cron,omitempty"`
	} `json:"trigger_setting,omitempty"`
}

Trigger holds the trigger info.

type TriggerType

type TriggerType = string

TriggerType represents the type of trigger.

Jump to

Keyboard shortcuts

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