Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type Configuration
- type Configurations
- type IndexFile
- type Metadata
- type PackageVersion
- type PackageVersions
- type Repositories
- func (r *Repositories) Add(repo ...*Configuration)
- func (r *Repositories) CurrentConfiguration() *Configuration
- func (r *Repositories) GetConfiguration(name string) *Configuration
- func (r *Repositories) Remove(name string) bool
- func (r *Repositories) SetContext(context string) error
- func (r *Repositories) WriteFile(fs afero.Fs, path string, perm os.FileMode) error
- type Repository
Constants ¶
const (
// Version is the repo / packaging version
Version = "v1"
)
Variables ¶
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
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
DownloadIndexFile fetches the index file from a repository.
func (*Client) GetPackage ¶ added in v0.7.0
GetPackage provides an Package for a provided package name and optional version
func (*Client) GetPackageBytes ¶ added in v0.7.0
GetPackageBytes provides an io.Reader for a provided package name and optional version
type Configuration ¶ added in v0.6.0
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
IndexDirectory creates an index file for the operators in the path
func ParseIndexFile ¶ added in v0.7.0
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.
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
func Map(pkgs []*packages.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.