Documentation ¶
Index ¶
- Constants
- Variables
- func AddRequiredHeadersToRedirectedRequests(req *http.Request, via []*http.Request) error
- func ExpandAndVerifyRegistryUrl(hostname string) (string, error)
- func HTTPRequestFactory(metaHeaders map[string][]string) *utils.HTTPRequestFactory
- func IndexServerAddress() string
- func Login(authConfig *AuthConfig, factory *utils.HTTPRequestFactory) (string, error)
- func ResolveRepositoryName(reposName string) (string, string, error)
- func SaveConfig(configFile *ConfigFile) error
- type AuthConfig
- type ConfigFile
- type ImgData
- type Registry
- func (r *Registry) GetAuthConfig(withPasswd bool) *AuthConfig
- func (r *Registry) GetRemoteHistory(imgID, registry string, token []string) ([]string, error)
- func (r *Registry) GetRemoteImageJSON(imgID, registry string, token []string) ([]byte, int, error)
- func (r *Registry) GetRemoteImageLayer(imgID, registry string, token []string, imgSize int64) (io.ReadCloser, error)
- func (r *Registry) GetRemoteTags(registries []string, repository string, token []string) (map[string]string, error)
- func (r *Registry) GetRepositoryData(remote string) (*RepositoryData, error)
- func (r *Registry) LookupRemoteImage(imgID, registry string, token []string) bool
- func (r *Registry) PushImageChecksumRegistry(imgData *ImgData, registry string, token []string) error
- func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validate bool, regs []string) (*RepositoryData, error)
- func (r *Registry) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, registry string, token []string) error
- func (r *Registry) PushImageLayerRegistry(imgID string, layer io.Reader, registry string, token []string, jsonRaw []byte) (checksum string, checksumPayload string, err error)
- func (r *Registry) PushRegistryTag(remote, revision, tag, registry string, token []string) error
- func (r *Registry) SearchRepositories(term string) (*SearchResults, error)
- type RegistryInfo
- type RepositoryData
- type SearchResult
- type SearchResults
- type Service
- type TimeoutType
Constants ¶
const CONFIGFILE = ".dockercfg"
Where we store the config file
const INDEXSERVER = "https://index.docker.io/v1/"
Only used for user auth + account creation
Variables ¶
var ( ErrAlreadyExists = errors.New("Image already exists") ErrInvalidRepositoryName = errors.New("Invalid repository name (ex: \"registry.domain.tld/myrepos\")") )
var (
ErrConfigFileMissing = errors.New("The Auth config file is missing")
)
Functions ¶
func ExpandAndVerifyRegistryUrl ¶
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 HTTPRequestFactory ¶
func HTTPRequestFactory(metaHeaders map[string][]string) *utils.HTTPRequestFactory
func IndexServerAddress ¶
func IndexServerAddress() string
func Login ¶
func Login(authConfig *AuthConfig, factory *utils.HTTPRequestFactory) (string, error)
try to register/login to the registry server
func ResolveRepositoryName ¶
Resolves a repository name to a hostname + name
Types ¶
type AuthConfig ¶
type ConfigFile ¶
type ConfigFile struct { Configs map[string]AuthConfig `json:"configs,omitempty"` // contains filtered or unexported fields }
func LoadConfig ¶
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 ¶
func (config *ConfigFile) ResolveAuthConfig(hostname string) AuthConfig
this method matches a auth configuration to a server address or a url
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry(authConfig *AuthConfig, factory *utils.HTTPRequestFactory, indexEndpoint string, timeout bool) (r *Registry, err error)
func (*Registry) GetAuthConfig ¶
func (r *Registry) GetAuthConfig(withPasswd bool) *AuthConfig
func (*Registry) GetRemoteHistory ¶
Retrieve the history of a given image from the Registry. Return a list of the parent's json (requested image included)
func (*Registry) GetRemoteImageJSON ¶
Retrieve an image from the Registry.
func (*Registry) GetRemoteImageLayer ¶
func (*Registry) GetRemoteTags ¶
func (*Registry) GetRepositoryData ¶
func (r *Registry) GetRepositoryData(remote string) (*RepositoryData, error)
func (*Registry) LookupRemoteImage ¶
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 ¶
func (*Registry) PushImageJSONIndex ¶
func (*Registry) PushImageJSONRegistry ¶
func (r *Registry) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, registry string, token []string) error
Push a local image to the registry
func (*Registry) PushImageLayerRegistry ¶
func (*Registry) PushRegistryTag ¶
push a tag on the registry. Remote has the format '<user>/<repo>
func (*Registry) SearchRepositories ¶
func (r *Registry) SearchRepositories(term string) (*SearchResults, error)
type RegistryInfo ¶
type RepositoryData ¶
type SearchResult ¶
type SearchResults ¶
type SearchResults struct { Query string `json:"query"` NumResults int `json:"num_results"` Results []SearchResult `json:"results"` }
type Service ¶
type Service struct { }
Service exposes registry capabilities in the standard Engine interface. Once installed, it extends the engine with the following calls:
'auth': Authenticate against the public registry 'search': Search for images on the public registry 'pull': Download images from any registry (TODO) 'push': Upload images to any registry (TODO)
func NewService ¶
func NewService() *Service
NewService returns a new instance of Service ready to be installed no an engine.
func (*Service) Auth ¶
Auth contacts the public registry with the provided credentials, and returns OK if authentication was sucessful. It can be used to verify the validity of a client's credentials.
func (*Service) Search ¶
Search queries the public registry for images matching the specified search terms, and returns the results.
Argument syntax: search TERM
Option environment:
'authConfig': json-encoded credentials to authenticate against the registry. The search extends to images only accessible via the credentials. 'metaHeaders': extra HTTP headers to include in the request to the registry. The headers should be passed as a json-encoded dictionary.
Output:
Results are sent as a collection of structured messages (using engine.Table). Each result is sent as a separate message. Results are ordered by number of stars on the public registry.
type TimeoutType ¶
type TimeoutType uint32
const ( NoTimeout TimeoutType = iota ReceiveTimeout ConnectTimeout )