registry

package
v0.10.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtocolFilesystem is the protocol for file system based registries.
	ProtocolFilesystem = "fs"
	// ProtocolGitHub is a the protocol for GitHub based registries.
	ProtocolGitHub = "github"
)
View Source
const (
	// DefaultAPIVersion is the default version of the registry API.
	DefaultAPIVersion = "0.1.0"
	// DefaultKind is the default kind of the registry API.
	DefaultKind = "ksonnet.io/registry"
)

Variables

This section is empty.

Functions

func CacheDependency

func CacheDependency(a app.App, d pkg.Descriptor, customName string) error

CacheDependency vendors registry dependencies. TODO: create unit tests for this once mocks for this package are worked out.

func DefaultYAMLData

func DefaultYAMLData(r Registry) ([]byte, error)

DefaultYAMLData generates the contents for a registry's spec.

func Package

func Package(a app.App, name string) (*pkg.Package, error)

Package finds a package in a registry by name.

Types

type Fs

type Fs struct {
	// contains filtered or unexported fields
}

Fs is a registry based on a local filesystem.

func NewFs

func NewFs(a app.App, registryRef *app.RegistryRefSpec) (*Fs, error)

NewFs creates an instance of Fs. Assign a name to the RegistryRefSpec if you want the Fs to know it's name.

func (*Fs) FetchRegistrySpec

func (fs *Fs) FetchRegistrySpec() (*Spec, error)

FetchRegistrySpec fetches the registry spec.

func (*Fs) IsOverride

func (fs *Fs) IsOverride() bool

IsOverride is true if this registry an an override.

func (*Fs) MakeRegistryRefSpec

func (fs *Fs) MakeRegistryRefSpec() *app.RegistryRefSpec

MakeRegistryRefSpec returns an app registry ref spec.

func (*Fs) Name

func (fs *Fs) Name() string

Name is the registry name.

func (*Fs) Protocol

func (fs *Fs) Protocol() string

Protocol is the registry protocol.

func (*Fs) RegistrySpecDir

func (fs *Fs) RegistrySpecDir() string

RegistrySpecDir is the registry directory.

func (*Fs) RegistrySpecFilePath

func (fs *Fs) RegistrySpecFilePath() string

RegistrySpecFilePath is the path for the registry.yaml

func (*Fs) ResolveLibrary

func (fs *Fs) ResolveLibrary(partName, partAlias, libRefSpec string, onFile ResolveFile, onDir ResolveDirectory) (*parts.Spec, *app.LibraryRefSpec, error)

ResolveLibrary fetches the part and creates a parts spec and library ref spec.

func (*Fs) ResolveLibrarySpec

func (fs *Fs) ResolveLibrarySpec(partName, libRefSpec string) (*parts.Spec, error)

ResolveLibrarySpec returns a resolved spec for a part. `libRefSpec` is ignored.

func (*Fs) URI

func (fs *Fs) URI() string

URI is the registry URI.

type GitHub

type GitHub struct {
	// contains filtered or unexported fields
}

GitHub is a Github Registry

func NewGitHub

func NewGitHub(a app.App, registryRef *app.RegistryRefSpec, opts ...GitHubOpt) (*GitHub, error)

NewGitHub creates an instance of GitHub.

func (*GitHub) FetchRegistrySpec

func (gh *GitHub) FetchRegistrySpec() (*Spec, error)

FetchRegistrySpec fetches the registry spec.

func (*GitHub) IsOverride

func (gh *GitHub) IsOverride() bool

IsOverride is true if this registry an an override.

func (*GitHub) MakeRegistryRefSpec

func (gh *GitHub) MakeRegistryRefSpec() *app.RegistryRefSpec

MakeRegistryRefSpec returns an app registry ref spec.

func (*GitHub) Name

func (gh *GitHub) Name() string

Name is the registry name.

func (*GitHub) Protocol

func (gh *GitHub) Protocol() string

Protocol is the registry protocol.

func (*GitHub) RegistrySpecDir

func (gh *GitHub) RegistrySpecDir() string

RegistrySpecDir is the registry directory.

func (*GitHub) RegistrySpecFilePath

func (gh *GitHub) RegistrySpecFilePath() string

RegistrySpecFilePath is the path for the registry.yaml

func (*GitHub) ResolveLibrary

func (gh *GitHub) ResolveLibrary(partName, partAlias, libRefSpec string, onFile ResolveFile, onDir ResolveDirectory) (*parts.Spec, *app.LibraryRefSpec, error)

ResolveLibrary fetches the part and creates a parts spec and library ref spec.

func (*GitHub) ResolveLibrarySpec

func (gh *GitHub) ResolveLibrarySpec(partName, libRefSpec string) (*parts.Spec, error)

ResolveLibrarySpec returns a resolved spec for a part.

func (*GitHub) URI

func (gh *GitHub) URI() string

URI is the registry URI.

type GitHubOpt

type GitHubOpt func(*GitHub)

GitHubOpt is an option for configuring GitHub.

func GitHubClient

func GitHubClient(c github.GitHub) GitHubOpt

GitHubClient is an option for the setting a github client.

type LibraryRef

type LibraryRef struct {
	Version string `json:"version"`
	Path    string `json:"path"`
}

LibraryRef is library reference.

type LibraryRefSpecs

type LibraryRefSpecs map[string]*LibraryRef

LibraryRefSpecs maps LibraryRefs to a name.

type Registry

type Registry interface {
	RegistrySpecDir() string
	RegistrySpecFilePath() string
	FetchRegistrySpec() (*Spec, error)
	MakeRegistryRefSpec() *app.RegistryRefSpec
	ResolveLibrarySpec(libID, libRefSpec string) (*parts.Spec, error)
	ResolveLibrary(libID, libAlias, version string, onFile ResolveFile, onDir ResolveDirectory) (*parts.Spec, *app.LibraryRefSpec, error)
	Name() string
	Protocol() string
	URI() string
	IsOverride() bool
}

Registry is a Registry

func List

func List(ksApp app.App) ([]Registry, error)

List returns a list of alphabetically sorted Registries.

func Locate

func Locate(a app.App, spec *app.RegistryRefSpec) (Registry, error)

Locate locates a registry given a spec.

type ResolveDirectory

type ResolveDirectory func(relPath string) error

ResolveDirectory resolves directories when searching a part.

type ResolveFile

type ResolveFile func(relPath string, contents []byte) error

ResolveFile resolves files found when searching a part.

type Spec

type Spec struct {
	APIVersion string              `json:"apiVersion"`
	Kind       string              `json:"kind"`
	GitVersion *app.GitVersionSpec `json:"gitVersion"`
	Libraries  LibraryRefSpecs     `json:"libraries"`
}

Spec describes how a registry is stored.

func Add

func Add(a app.App, name, protocol, uri, version string, isOverride bool) (*Spec, error)

Add adds a registry with `name`, `protocol`, and `uri` to the current ksonnet application.

func Unmarshal

func Unmarshal(bytes []byte) (*Spec, error)

Unmarshal unmarshals bytes to a Spec.

func (*Spec) Marshal

func (s *Spec) Marshal() ([]byte, error)

Marshal marshals a Spec to YAML.

type Specs

type Specs []*Spec

Specs is a slice of *Spec.

Directories

Path Synopsis
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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