repo

package
v0.8.0-pre.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 19 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",
}

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) GetPackage added in v0.7.0

func (c *Client) GetPackage(name string, version string) (packages.Package, error)

GetPackage provides an Package for a provided package name and optional version

func (*Client) GetPackageBytes added in v0.7.0

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

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

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 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) GetByNameAndVersion

func (i IndexFile) GetByNameAndVersion(name, version string) (*PackageVersion, error)

GetByNameAndVersion 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.

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"`

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

	// AppVersion is the underlying service version (the format is not in our control)
	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 []*v1beta1.Maintainer `json:"maintainers,omitempty"`
}

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

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.PackageFiles, 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

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.

type Repository added in v0.3.0

type Repository interface {
	GetPackage(name string, version string) (packages.Package, error)
}

Repository is an abstraction for a service that can retrieve packages

Jump to

Keyboard shortcuts

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