selector

package
v0.0.0-...-ad8c5df Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Image kind
	Image = "image"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	// Namespace(project) ID
	NamespaceID int64 `json:"namespace_id"`
	// Namespace
	Namespace string `json:"namespace"`
	// Repository name
	Repository string `json:"repository"`
	// Kind of the candidate
	// "image"
	Kind string `json:"kind"`
	// Tags attached with the candidate
	Tags []string `json:"tags"`
	// Digest
	Digest string `json:"digest"`
	// Pushed time in seconds
	PushedTime int64 `json:"pushed_time_second"`
	// Pulled time in seconds
	PulledTime int64 `json:"pulled_time_second"`
	// Created time in seconds
	CreationTime int64 `json:"create_time_second"`
	// Labels attached with the candidate
	Labels []string `json:"labels"`
	// Overall severity of the candidate
	// Use severity code value here to avoid pkg dependency issue.
	VulnerabilitySeverity uint `json:"vulnerability_severity"`
	// Signatures of the above Tags
	// This is not technical correct, just for keeping compatibilities with the original definition.
	Signatures map[string]bool `json:"signatures"`
}

Candidate for retention processor to match

func (*Candidate) Hash

func (c *Candidate) Hash() string

Hash code based on the candidate info for differentiation

type Factory

type Factory func(decoration string, pattern interface{}, extras string) Selector

Factory is factory method to return a selector implementation Pattern can be any type of data. TODO: 'extras' can also be an optional interface{} to accept more complicated data.

type ImmutableError

type ImmutableError struct {
}

ImmutableError ...

func (*ImmutableError) Error

func (e *ImmutableError) Error() string

type Repository

type Repository struct {
	// Namespace(project) ID
	NamespaceID int64
	// Namespace
	Namespace string `json:"namespace"`
	// Repository name
	Name string `json:"name"`
	// So far we need the kind of repository and retrieve candidates with different APIs
	// TODO: REMOVE IT IN THE FUTURE IF WE SUPPORT UNIFIED ARTIFACT MODEL
	Kind string `json:"kind"`
}

Repository of candidate

func (*Repository) FromJSON

func (r *Repository) FromJSON(jsonData string) error

FromJSON constructs the repository from json data

func (*Repository) ToJSON

func (r *Repository) ToJSON() (string, error)

ToJSON marshals repository to JSON string

type Result

type Result struct {
	Target *Candidate `json:"target"`
	// nil error means success
	Error error `json:"error"`
}

Result keeps the action result

type Selector

type Selector interface {
	// Select the matched ones
	//
	//  Arguments:
	//    artifacts []*Candidate : candidates for matching
	//
	//  Returns:
	//    []*Candidate : matched candidates
	Select(artifacts []*Candidate) ([]*Candidate, error)
}

Selector is used to filter the inputting list

Directories

Path Synopsis
selectors

Jump to

Keyboard shortcuts

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