registry

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2014 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const CONFIGFILE = ".dockercfg"

Where we store the config file

View Source
const INDEXSERVER = "https://index.docker.io/v1/"

Only used for user auth + account creation

Variables

View Source
var (
	ErrAlreadyExists         = errors.New("Image already exists")
	ErrInvalidRepositoryName = errors.New("Invalid repository name (ex: \"registry.domain.tld/myrepos\")")
)
View Source
var (
	ErrConfigFileMissing = errors.New("The Auth config file is missing")
)

Functions

func ExpandAndVerifyRegistryUrl added in v0.6.2

func ExpandAndVerifyRegistryUrl(hostname string) (string, error)

this method expands the registry name as used in the prefix of a repo to a full url. if it already is a url, there will be no change. The registry is pinged to test if it http or https

func IndexServerAddress added in v0.10.0

func IndexServerAddress() string

func Login added in v0.10.0

func Login(authConfig *AuthConfig, factory *utils.HTTPRequestFactory) (string, error)

try to register/login to the registry server

func ResolveRepositoryName added in v0.5.0

func ResolveRepositoryName(reposName string) (string, string, error)

Resolves a repository name to a hostname + name

func SaveConfig added in v0.10.0

func SaveConfig(configFile *ConfigFile) error

save the auth config

Types

type AuthConfig added in v0.10.0

type AuthConfig struct {
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	Auth          string `json:"auth"`
	Email         string `json:"email"`
	ServerAddress string `json:"serveraddress,omitempty"`
}

type ConfigFile added in v0.10.0

type ConfigFile struct {
	Configs map[string]AuthConfig `json:"configs,omitempty"`
	// contains filtered or unexported fields
}

func LoadConfig added in v0.10.0

func LoadConfig(rootPath string) (*ConfigFile, error)

load up the auth config information and return values FIXME: use the internal golang config parser

func (*ConfigFile) ResolveAuthConfig added in v0.10.0

func (config *ConfigFile) ResolveAuthConfig(hostname string) AuthConfig

this method matches a auth configuration to a server address or a url

type ImgData

type ImgData struct {
	ID              string `json:"id"`
	Checksum        string `json:"checksum,omitempty"`
	ChecksumPayload string `json:"-"`
	Tag             string `json:",omitempty"`
}

type Registry

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

func NewRegistry

func NewRegistry(authConfig *AuthConfig, factory *utils.HTTPRequestFactory, indexEndpoint string) (r *Registry, err error)

func (*Registry) GetAuthConfig

func (r *Registry) GetAuthConfig(withPasswd bool) *AuthConfig

func (*Registry) GetRemoteHistory

func (r *Registry) GetRemoteHistory(imgID, registry string, token []string) ([]string, error)

Retrieve the history of a given image from the Registry. Return a list of the parent's json (requested image included)

func (*Registry) GetRemoteImageJSON added in v0.4.1

func (r *Registry) GetRemoteImageJSON(imgID, registry string, token []string) ([]byte, int, error)

Retrieve an image from the Registry.

func (*Registry) GetRemoteImageLayer

func (r *Registry) GetRemoteImageLayer(imgID, registry string, token []string) (io.ReadCloser, error)

func (*Registry) GetRemoteTags

func (r *Registry) GetRemoteTags(registries []string, repository string, token []string) (map[string]string, error)

func (*Registry) GetRepositoryData

func (r *Registry) GetRepositoryData(remote string) (*RepositoryData, error)

func (*Registry) LookupRemoteImage

func (r *Registry) LookupRemoteImage(imgID, registry string, token []string) bool

Check if an image exists in the Registry TODO: This method should return the errors instead of masking them and returning false

func (*Registry) PushImageChecksumRegistry added in v0.6.0

func (r *Registry) PushImageChecksumRegistry(imgData *ImgData, registry string, token []string) error

func (*Registry) PushImageJSONIndex added in v0.4.1

func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validate bool, regs []string) (*RepositoryData, error)

func (*Registry) PushImageJSONRegistry added in v0.4.1

func (r *Registry) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, registry string, token []string) error

Push a local image to the registry

func (*Registry) PushImageLayerRegistry

func (r *Registry) PushImageLayerRegistry(imgID string, layer io.Reader, registry string, token []string, jsonRaw []byte) (checksum string, checksumPayload string, err error)

func (*Registry) PushRegistryTag

func (r *Registry) PushRegistryTag(remote, revision, tag, registry string, token []string) error

push a tag on the registry. Remote has the format '<user>/<repo>

func (*Registry) SearchRepositories

func (r *Registry) SearchRepositories(term string) (*SearchResults, error)

type RepositoryData

type RepositoryData struct {
	ImgList   map[string]*ImgData
	Endpoints []string
	Tokens    []string
}

type SearchResult added in v0.6.6

type SearchResult struct {
	StarCount   int    `json:"star_count"`
	IsOfficial  bool   `json:"is_official"`
	Name        string `json:"name"`
	IsTrusted   bool   `json:"is_trusted"`
	Description string `json:"description"`
}

type SearchResults

type SearchResults struct {
	Query      string         `json:"query"`
	NumResults int            `json:"num_results"`
	Results    []SearchResult `json:"results"`
}

Jump to

Keyboard shortcuts

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