repo

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Version is the repo / packaging version
	Version = "v1"
)

Variables

View Source
var Default = &Configuration{
	Name: defaultRepoName,
	URL:  "https://kudo-repository.storage.googleapis.com/v1",
}

Default initialized repository.

Functions

This section is empty.

Types

type Client added in v0.6.0

type Client struct {
	Config *Configuration
	Client http.Client
}

Client represents an operator repository

func ClientFromSettings added in v0.6.0

func ClientFromSettings(fs afero.Fs, home kudohome.Home, repoName string) (*Client, error)

ClientFromSettings retrieves the operator repo for the configured repo in settings

func NewClient added in v0.6.0

func NewClient(conf *Configuration) (*Client, error)

NewClient constructs repository client

func (*Client) DownloadIndexFile added in v0.6.0

func (c *Client) DownloadIndexFile() (*IndexFile, error)

DownloadIndexFile fetches the index file from a repository.

func (*Client) Find added in v0.13.0

func (c *Client) Find(search string, allVersions bool) (EntrySummaries, error)

func (*Client) GetPackageBytes added in v0.7.0

func (c *Client) GetPackageBytes(name string, appVersion string, operatorVersion string) (*bytes.Buffer, error)

GetPackageBytes provides an io.Reader for a provided package name and optional version

func (*Client) Resolve added in v0.9.0

func (c *Client) Resolve(out afero.Fs, name string, appVersion string, operatorVersion string) (*packages.Resources, error)

Resolve returns a Package for a passed package name and optional version. This is an implementation of the DependenciesResolver interface located in packages/resolver/resolver.go

func (*Client) String added in v0.8.0

func (c *Client) String() string

type Configuration added in v0.6.0

type Configuration struct {
	URL  string `json:"url"`
	Name string `json:"name"`
}

Configuration represents a collection of parameters for operator repository.

func ConfigurationFromSettings added in v0.6.0

func ConfigurationFromSettings(fs afero.Fs, home kudohome.Home, repoName string) (*Configuration, error)

ConfigurationFromSettings gets the repo configuration from settings

func (*Configuration) String added in v0.8.0

func (c *Configuration) String() string

String is a stringer function for Configuration

type Configurations added in v0.8.0

type Configurations []*Configuration

Configurations is a collection of Configuration for Stringer

func (Configurations) String added in v0.8.0

func (c Configurations) String() string

String is a stringer function for Configurations

type EntrySummaries added in v0.13.0

type EntrySummaries []EntrySummary

func (EntrySummaries) Len added in v0.13.0

func (b EntrySummaries) Len() int

Len returns the number of entry summaries. This is needed to allow sorting of entries.

func (EntrySummaries) Less added in v0.13.0

func (b EntrySummaries) Less(x, y int) bool

Less returns true if the version of entry a is less than the version of entry b. This is needed to allow sorting of entry summaries.

func (EntrySummaries) Swap added in v0.13.0

func (b EntrySummaries) Swap(i, j int)

Swap swaps the position of two items in the entry summaries slice. This is needed to allow sorting of entry summaries.

type EntrySummary added in v0.13.0

type EntrySummary struct {
	Name            string
	OperatorVersion string
	AppVersion      string
}

type IndexFile

type IndexFile struct {
	APIVersion string                     `json:"apiVersion"`
	Entries    map[string]PackageVersions `json:"entries"`
	Generated  *time.Time                 `json:"generated"`
}

IndexFile represents the index file in an operator repository.

func IndexDirectory added in v0.6.0

func IndexDirectory(fs afero.Fs, path string, url string, now *time.Time) (*IndexFile, error)

IndexDirectory creates an index file for the operators in the path

func ParseIndexFile added in v0.7.0

func ParseIndexFile(data []byte) (*IndexFile, error)

ParseIndexFile loads an index file and sorts the included packages by version. The function will fail if `APIVersion` is not specified.

func (*IndexFile) AddPackageVersion added in v0.7.0

func (i *IndexFile) AddPackageVersion(pv *PackageVersion) error

AddPackageVersion adds an entry to the IndexFile (does not allow dups)

func (IndexFile) Find added in v0.13.0

func (i IndexFile) Find(search string, allVersions bool) (EntrySummaries, error)

func (IndexFile) FindFirstMatch added in v0.10.1

func (i IndexFile) FindFirstMatch(name string, appVersion string, operatorVersion string) (*PackageVersion, error)

FindFirstMatch returns the operator of given name and version. If no specific version is required, pass an empty string as version and the the latest version will be returned. Possible package options include: foo-1.0.0.tgz, foo-2.0.0_1.0.1.tgz and foo-3.0.0_1.0.1.tgz The Entries are sorted by AppVersion first, then OpVersion. Entries with no appVersion are later in the sort order than entries with appVersion. Given a search for an opVersion = 1.0.1 (without appVersion) given the above foo options, foo-3.0.0-1.0.1 (the latest app version for this opVersion) appVersion could be arbitrary. if appVersion is "bar" than foo-var_1.0.1.tgz

func (IndexFile) Write added in v0.7.0

func (i IndexFile) Write(w io.Writer) error

func (*IndexFile) WriteFile added in v0.6.0

func (i *IndexFile) WriteFile(fs afero.Fs, file string) (err error)

WriteFile is used to write the index file

type Metadata

type Metadata struct {
	// Name is the name of the operator.
	Name string `json:"name,omitempty"`

	// OperatorVersion is a A SemVer 2 conformant version string of the operator.
	OperatorVersion string `protobuf:"bytes,4,opt,name=version" json:"operatorVersion"`

	// AppVersion is a SemVer 2 conformant version string of the underlying service.
	AppVersion string `json:"appVersion,omitempty"`

	// Description is a one-sentence description of the operator.
	Description string `json:"description,omitempty"`

	// Maintainers is a list of name and URL/email addresses of the maintainer(s).
	Maintainers []*kudoapi.Maintainer `json:"maintainers,omitempty"`
}

Metadata for an Operator. This models the structure of an operator.yaml file.

type PackageFilesDigest added in v0.9.0

type PackageFilesDigest struct {
	PackageFiles *packages.Files
	Digest       string
}

PackageFilesDigest is a tuple of data used to return the package files AND the digest of a tarball

type PackageVersion added in v0.6.0

type PackageVersion struct {
	*Metadata
	URLs    []string `json:"urls"`
	Removed bool     `json:"removed,omitempty"`
	Digest  string   `json:"digest,omitempty"`
}

PackageVersion represents an operator entry in the IndexFile.

func ToPackageVersion added in v0.6.0

func ToPackageVersion(pf *packages.Files, digest string, url string) *PackageVersion

ToPackageVersion provided the packageFiles will create a PackageVersion (used for index)

type PackageVersions added in v0.6.0

type PackageVersions []*PackageVersion

PackageVersions is a list of versioned package references. Implements a sorter on Version.

func Map added in v0.6.0

func Map(pkgs []*PackageFilesDigest, url string) PackageVersions

Map transforms a slice of packagefiles with file digests into a slice of PackageVersions

func (PackageVersions) Len added in v0.6.0

func (b PackageVersions) Len() int

Len returns the number of package versions. This is needed to allow sorting of packages.

func (PackageVersions) Less added in v0.6.0

func (b PackageVersions) Less(x, y int) bool

Less returns true if the version of entry a is less than the version of entry b. This is needed to allow sorting of packages.

func (PackageVersions) Swap added in v0.6.0

func (b PackageVersions) Swap(i, j int)

Swap swaps the position of two items in the versions slice. This is needed to allow sorting of packages.

type Repositories added in v0.6.0

type Repositories struct {
	RepoVersion  string         `json:"repoVersion"`
	Context      string         `json:"context"`
	Repositories Configurations `json:"repositories"`
}

Repositories represents the repositories.yaml file usually in the $KUDO_HOME

func LoadRepositories added in v0.6.0

func LoadRepositories(fs afero.Fs, path string) (*Repositories, error)

LoadRepositories reads the Repositories file

func NewRepositories added in v0.6.0

func NewRepositories() *Repositories

NewRepositories creates a new repo with only defaults populated

func (*Repositories) Add added in v0.6.0

func (r *Repositories) Add(repo ...*Configuration)

Add appends a slice of repo configs to repositories file

func (*Repositories) CurrentConfiguration added in v0.6.0

func (r *Repositories) CurrentConfiguration() *Configuration

CurrentConfiguration provides the repo config for the current context

func (*Repositories) GetConfiguration added in v0.6.0

func (r *Repositories) GetConfiguration(name string) *Configuration

GetConfiguration returns a RepoName Config for a name or nil

func (*Repositories) Remove added in v0.6.0

func (r *Repositories) Remove(name string) bool

Remove removes the repo config with the provided name

func (*Repositories) SetContext added in v0.6.0

func (r *Repositories) SetContext(context string) error

SetContext switches the context to another repo config in the repositories file. errors if no repo found.

func (*Repositories) WriteFile added in v0.6.0

func (r *Repositories) WriteFile(fs afero.Fs, path string, perm os.FileMode) error

WriteFile writes a repositories file to the given path.

Jump to

Keyboard shortcuts

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