Documentation
¶
Index ¶
Constants ¶
const ( // DefaultRetryLimit sets how many retry attempts are made for non-fatal errors DefaultRetryLimit = 5 // DefaultUserAgent sets the header on http requests DefaultUserAgent = "regclient/regclient" // DockerCertDir default location for docker certs DockerCertDir = "/etc/docker/certs.d" // DockerRegistry is the name resolved in docker images on Hub DockerRegistry = "docker.io" // DockerRegistryAuth is the name provided in docker's config for Hub DockerRegistryAuth = "https://index.docker.io/v1/" // DockerRegistryDNS is the host to connect to for Hub DockerRegistryDNS = "registry-1.docker.io" // MediaTypeDocker1Manifest deprecated media type for docker schema1 manifests MediaTypeDocker1Manifest = "application/vnd.docker.distribution.manifest.v1+json" // MediaTypeDocker1ManifestSigned is a deprecated schema1 manifest with jws signing MediaTypeDocker1ManifestSigned = "application/vnd.docker.distribution.manifest.v1+prettyjws" // MediaTypeDocker2Manifest is the media type when pulling manifests from a v2 registry MediaTypeDocker2Manifest = dockerSchema2.MediaTypeManifest // MediaTypeDocker2ManifestList is the media type when pulling a manifest list from a v2 registry MediaTypeDocker2ManifestList = dockerManifestList.MediaTypeManifestList // MediaTypeDocker2ImageConfig is for the configuration json object media type MediaTypeDocker2ImageConfig = dockerSchema2.MediaTypeImageConfig // MediaTypeOCI1Manifest OCI v1 manifest media type MediaTypeOCI1Manifest = ociv1.MediaTypeImageManifest // MediaTypeOCI1ManifestList OCI v1 manifest list media type MediaTypeOCI1ManifestList = ociv1.MediaTypeImageIndex // MediaTypeOCI1ImageConfig OCI v1 configuration json object media type MediaTypeOCI1ImageConfig = ociv1.MediaTypeImageConfig // MediaTypeDocker2Layer is the default compressed layer for docker schema2 MediaTypeDocker2Layer = dockerSchema2.MediaTypeLayer )
Variables ¶
var ( // ErrAPINotFound if an api is not available for the host ErrAPINotFound = errors.New("API not found") // ErrCanceled if the context was canceled ErrCanceled = errors.New("Context was canceled") // ErrHttpStatus if the http status code was unexpected ErrHttpStatus = errors.New("Unexpected http status code") // ErrMissingDigest returned when image reference does not include a digest ErrMissingDigest = errors.New("Digest missing from image reference") // ErrMissingName returned when name missing for host ErrMissingName = errors.New("Name missing") // ErrMissingTag returned when image reference does not include a tag ErrMissingTag = errors.New("Tag missing from image reference") // ErrMissingTagOrDigest returned when image reference does not include a tag or digest ErrMissingTagOrDigest = errors.New("Tag or Digest missing from image reference") // ErrNotFound isn't there, search for your value elsewhere ErrNotFound = errors.New("Not found") // ErrNotImplemented returned when method has not been implemented yet ErrNotImplemented = errors.New("Not implemented") // ErrParsingFailed when a string cannot be parsed ErrParsingFailed = errors.New("Parsing failed") // ErrRateLimit when requests exceed server rate limit ErrRateLimit = errors.New("Rate limit exceeded") ErrUnavailable = errors.New("Unavailable") ErrUnauthorized = errors.New("Unauthorized") // ErrUnsupportedConfigVersion happens when config file version is greater than this command supports ErrUnsupportedConfigVersion = errors.New("Unsupported config version") // ErrUnsupportedMediaType returned when media type is unknown or unsupported ErrUnsupportedMediaType = errors.New("Unsupported media type") )
var TemplateFuncs = gotemplate.FuncMap{
"printPretty": printPretty,
}
TemplateFuncs provides additional functions for handling regclient types in templates
var (
// VCSRef is injected from a build flag, used to version the UserAgent header
VCSRef = "unknown"
)
Functions ¶
This section is empty.
Types ¶
type BlobClient ¶ added in v0.3.0
type BlobClient interface {
BlobCopy(ctx context.Context, refSrc types.Ref, refTgt types.Ref, d digest.Digest) error
BlobGet(ctx context.Context, ref types.Ref, d digest.Digest, accepts []string) (blob.Reader, error)
BlobGetOCIConfig(ctx context.Context, ref types.Ref, d digest.Digest) (blob.OCIConfig, error)
BlobHead(ctx context.Context, ref types.Ref, d digest.Digest) (blob.Reader, error)
BlobMount(ctx context.Context, refSrc types.Ref, refTgt types.Ref, d digest.Digest) error
BlobPut(ctx context.Context, ref types.Ref, d digest.Digest, rdr io.Reader, ct string, cl int64) (digest.Digest, int64, error)
}
BlobClient provides registry client requests to Blobs
type ConfigHost ¶
type ConfigHost struct {
Name string `json:"-"`
Scheme string `json:"scheme,omitempty"` // TODO: deprecate, delete
TLS TLSConf `json:"tls,omitempty"`
RegCert string `json:"regcert,omitempty"`
ClientCert string `json:"clientcert,omitempty"`
ClientKey string `json:"clientkey,omitempty"`
DNS []string `json:"dns,omitempty"` // TODO: remove slice, single string, or remove entirely?
Hostname string `json:"hostname,omitempty"` // replaces DNS array with single string
User string `json:"user,omitempty"`
Pass string `json:"pass,omitempty"`
Token string `json:"token,omitempty"`
PathPrefix string `json:"pathPrefix,omitempty"` // used for mirrors defined within a repository namespace
Mirrors []string `json:"mirrors,omitempty"` // list of other ConfigHost Names to use as mirrors
Priority uint `json:"priority,omitempty"` // priority when sorting mirrors, higher priority attempted first
API string `json:"api,omitempty"` // registry API to use
}
ConfigHost struct contains host specific settings
func ConfigHostNew ¶
func ConfigHostNew() *ConfigHost
ConfigHostNew creates a default ConfigHost entry
func ConfigHostNewName ¶ added in v0.3.0
func ConfigHostNewName(host string) *ConfigHost
ConfigHostNewName creates a default ConfigHost with a hostname
type ImageClient ¶ added in v0.3.0
type ImageClient interface {
ImageCopy(ctx context.Context, refSrc types.Ref, refTgt types.Ref) error
ImageExport(ctx context.Context, ref types.Ref, outStream io.Writer) error
ImageImport(ctx context.Context, ref types.Ref, tarFile string) error
}
ImageClient provides registry client requests to images
type ManifestClient ¶ added in v0.3.0
type ManifestClient interface {
ManifestDelete(ctx context.Context, ref types.Ref) error
ManifestGet(ctx context.Context, ref types.Ref) (manifest.Manifest, error)
ManifestHead(ctx context.Context, ref types.Ref) (manifest.Manifest, error)
ManifestPut(ctx context.Context, ref types.Ref, m manifest.Manifest) error
}
ManifestClient provides registry client requests to manifests
type Opt ¶
type Opt func(*regClient)
Opt functions are used to configure NewRegClient
func WithCertDir ¶ added in v0.3.0
WithCertDir adds a path of certificates to trust similar to Docker's /etc/docker/certs.d
func WithConfigHost ¶ added in v0.1.0
func WithConfigHost(configHost ConfigHost) Opt
WithConfigHost adds config host settings
func WithConfigHosts ¶ added in v0.1.0
func WithConfigHosts(configHosts []ConfigHost) Opt
WithConfigHosts adds a list of config host settings
func WithDockerCerts ¶
func WithDockerCerts() Opt
WithDockerCerts adds certificates trusted by docker in /etc/docker/certs.d
func WithDockerCreds ¶
func WithDockerCreds() Opt
WithDockerCreds adds configuration from users docker config with registry logins This changes the default value from the config file, and should be added after the config file is loaded
func WithRetryLimit ¶ added in v0.3.0
WithRetryLimit specifies the number of retries for non-fatal errors
func WithUserAgent ¶ added in v0.3.0
WithUserAgent specifies the User-Agent http header
type RegClient ¶
type RegClient interface {
RepoClient
TagClient
ManifestClient
ImageClient
BlobClient
}
RegClient provides an interfaces to working with registries
type RepoClient ¶ added in v0.3.0
type RepoClient interface {
RepoList(ctx context.Context, hostname string) (RepoList, error)
RepoListWithOpts(ctx context.Context, hostname string, opts RepoOpts) (RepoList, error)
}
RepoClient provides registry client requests to repositories
type RepoDockerList ¶ added in v0.3.0
type RepoDockerList struct {
Repositories []string `json:"repositories"`
}
RepoDockerList is a list of repositories from the _catalog API
func (RepoDockerList) GetRepos ¶ added in v0.3.0
func (rl RepoDockerList) GetRepos() ([]string, error)
GetRepos returns the repositories
func (RepoDockerList) MarshalPretty ¶ added in v0.3.0
func (rl RepoDockerList) MarshalPretty() ([]byte, error)
MarshalPretty is used for printPretty template formatting
type RepoList ¶ added in v0.3.0
type RepoList interface {
GetOrig() interface{}
MarshalJSON() ([]byte, error)
RawBody() ([]byte, error)
RawHeaders() (http.Header, error)
GetRepos() ([]string, error)
}
RepoList interface is used for listing tags
type TLSConf ¶ added in v0.1.0
type TLSConf int
TLSConf specifies whether TLS is enabled for a host
func (TLSConf) MarshalJSON ¶ added in v0.1.0
MarshalJSON converts to a json string using MarshalText
func (TLSConf) MarshalText ¶ added in v0.1.0
MarshalText converts TLSConf to a string
func (*TLSConf) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON converts TLSConf from a json string
func (*TLSConf) UnmarshalText ¶ added in v0.1.0
UnmarshalText converts TLSConf from a string
type TagClient ¶ added in v0.3.0
type TagClient interface {
TagDelete(ctx context.Context, ref types.Ref) error
TagList(ctx context.Context, ref types.Ref) (TagList, error)
TagListWithOpts(ctx context.Context, ref types.Ref, opts TagOpts) (TagList, error)
}
TagClient wraps calls to tag list and delete
type TagDockerList ¶ added in v0.3.0
TagDockerList is returned from registry/2.0 API's
func (TagDockerList) GetTags ¶ added in v0.3.0
func (tl TagDockerList) GetTags() ([]string, error)
GetTags returns the tags from a list
func (TagDockerList) MarshalPretty ¶ added in v0.3.0
func (tl TagDockerList) MarshalPretty() ([]byte, error)
MarshalPretty is used for printPretty template formatting