Documentation ¶
Index ¶
Constants ¶
View Source
const ( // AlgorithmOR for OR algorithm AlgorithmOR = "or" // TriggerKindSchedule Schedule TriggerKindSchedule = "Schedule" // TriggerSettingsCron cron TriggerSettingsCron = "cron" // TriggerSettingNextScheduledTime next_scheduled_time TriggerSettingNextScheduledTime = "next_scheduled_time" // ScopeLevelProject project ScopeLevelProject = "project" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { // Builds runnable processor // // Arguments: // policy *Metadata : the simple metadata of retention policy // isDryRun bool : indicate if we need to build a processor for dry run // // Returns: // Processor : a processor implementation to process the candidates // error : common error object if any errors occurred Build(policy *lwp.Metadata, isDryRun bool) (alg.Processor, error) }
Builder builds the runnable processor from the raw policy
func NewBuilder ¶
NewBuilder news a basic builder
type Metadata ¶
type Metadata struct { // ID of the policy ID int64 `json:"id"` // Algorithm applied to the rules // "OR" / "AND" Algorithm string `json:"algorithm" valid:"Required;Match(or)"` // Rule collection Rules []rule.Metadata `json:"rules"` // Trigger about how to launch the policy Trigger *Trigger `json:"trigger" valid:"Required"` // Which scope the policy will be applied to Scope *Scope `json:"scope" valid:"Required"` }
Metadata of policy
func WithNDaysSinceLastPull ¶
WithNDaysSinceLastPull build a retention rule to keep images n days to since last pull
func (*Metadata) ValidateRetentionPolicy ¶
ValidateRetentionPolicy validate the retention policy
type Scope ¶
type Scope struct { // Scope level declaration // 'system', 'project' and 'repository' Level string `json:"level" valid:"Required;Match(/^(project)$/)"` // The reference identity for the specified level // 0 for 'system', project ID for 'project' and repo ID for 'repository' Reference int64 `json:"ref" valid:"Required"` }
Scope definition
type Trigger ¶
type Trigger struct { // Const string to declare the trigger type // 'Schedule' Kind string `json:"kind" valid:"Required"` // Settings for the specified trigger // '[cron]="* 22 11 * * *"' for the 'Schedule' Settings map[string]interface{} `json:"settings" valid:"Required"` }
Trigger of the policy
Click to show internal directories.
Click to hide internal directories.