Documentation ¶
Index ¶
- Variables
- func Log(format string, args ...interface{})
- func Quiet(format string, args ...interface{})
- func WrapTransport(transport http.RoundTripper, url, username, password string) http.RoundTripper
- type AuthorizationChallenge
- type BasicTransport
- type CannotReplayRequestBody
- type ErrorTransport
- type HTTPStatusError
- type LogfCallback
- type Registry
- func (registry *Registry) BlobMetadata(repository string, digest digest.Digest) (distribution.Descriptor, error)
- func (registry *Registry) DeleteImage(image string) error
- func (registry *Registry) DeleteManifest(repository string, digest digest.Digest) error
- func (registry *Registry) DeleteTag(image, tag string) error
- func (registry *Registry) DownloadBlob(repository string, digest digest.Digest) (io.ReadCloser, error)
- func (registry *Registry) GetImages() (map[string][]string, error)
- func (registry *Registry) HasBlob(repository string, digest digest.Digest) (bool, error)
- func (registry *Registry) Manifest(repository, reference string) (*schema1.SignedManifest, error)
- func (registry *Registry) ManifestDigest(repository, reference string) (digest.Digest, error)
- func (registry *Registry) ManifestV2(repository, reference string) (*schema2.DeserializedManifest, error)
- func (r *Registry) Ping() error
- func (registry *Registry) PutManifest(repository, reference string, manifest distribution.Manifest) error
- func (registry *Registry) Repositories() ([]string, error)
- func (registry *Registry) Tags(repository string) (tags []string, err error)
- func (registry *Registry) UploadBlob(repository string, digest digest.Digest, content io.Reader, ...) error
- type TokenTransport
Constants ¶
This section is empty.
Variables ¶
var ErrNoMorePages = errors.New("no more pages")
Functions ¶
func Log ¶
func Log(format string, args ...interface{})
* Pass log messages along to Go's "log" module.
func WrapTransport ¶
func WrapTransport(transport http.RoundTripper, url, username, password string) http.RoundTripper
* Given an existing http.RoundTripper such as http.DefaultTransport, build the * transport stack necessary to authenticate to the Docker registry API. This * adds in support for OAuth bearer tokens and HTTP Basic auth, and sets up * error handling this library relies on.
Types ¶
type AuthorizationChallenge ¶
AuthorizationChallenge carries information from a WWW-Authenticate response header.
type BasicTransport ¶
type BasicTransport struct { Transport http.RoundTripper URL string Username string Password string }
type CannotReplayRequestBody ¶
type CannotReplayRequestBody struct {
Err error
}
CannotReplayRequestBody describes the HTTP error, when the server responded with a WWW-Authenticate header, but the body of the request (POST, PUT, PATCH) couldn't be replayed
func (CannotReplayRequestBody) Error ¶
func (e CannotReplayRequestBody) Error() string
type ErrorTransport ¶
type ErrorTransport struct {
Transport http.RoundTripper
}
type HTTPStatusError ¶
type HTTPStatusError struct { Response *http.Response // Copied from `Response.Body` to avoid problems with unclosed bodies later. // Nobody calls `err.Response.Body.Close()`, ever. Body []byte }
func (*HTTPStatusError) Error ¶
func (err *HTTPStatusError) Error() string
type LogfCallback ¶
type LogfCallback func(format string, args ...interface{})
type Registry ¶
type Registry struct { URL string Client *http.Client Logf LogfCallback }
func New ¶
* Create a new Registry with the given URL and credentials, then Ping()s it * before returning it to verify that the registry is available. * * You can, alternately, construct a Registry manually by populating the fields. * This passes http.DefaultTransport to WrapTransport when creating the * http.Client.
func NewInsecure ¶
* Create a new Registry, as with New, using an http.Transport that disables * SSL certificate verification.
func (*Registry) BlobMetadata ¶
func (registry *Registry) BlobMetadata(repository string, digest digest.Digest) (distribution.Descriptor, error)
func (*Registry) DeleteImage ¶
DeleteImage deletes an image:tag from the registry
func (*Registry) DeleteManifest ¶
func (*Registry) DownloadBlob ¶
func (*Registry) GetImages ¶
GetImages returns a map[string][]string which keys are the image name and the values are a []string with the tags of each image
func (*Registry) Manifest ¶
func (registry *Registry) Manifest(repository, reference string) (*schema1.SignedManifest, error)
func (*Registry) ManifestDigest ¶
func (*Registry) ManifestV2 ¶
func (registry *Registry) ManifestV2(repository, reference string) (*schema2.DeserializedManifest, error)
func (*Registry) PutManifest ¶
func (registry *Registry) PutManifest(repository, reference string, manifest distribution.Manifest) error
func (*Registry) Repositories ¶
func (*Registry) UploadBlob ¶
func (registry *Registry) UploadBlob(repository string, digest digest.Digest, content io.Reader, getBody func() (io.ReadCloser, error)) error
UploadBlob can be used to upload an FS layer or an image config file into the given repository. It uploads the bytes read from content. Digest must match with the hash of those bytes. In case of token authentication the HTTP request must be retried after a 401 Unauthorized response (see https://docs.docker.com/registry/spec/auth/token/). In this case the getBody function is called in order to retrieve a fresh instance of the content reader. This behavior matches exactly of the GetBody parameter of http.Client. This also means that if content is of type *bytes.Buffer, *bytes.Reader or *strings.Reader, then GetBody is populated automatically (as explained in the documentation of http.NewRequest()), so nil can be passed as the getBody parameter.
type TokenTransport ¶
type TokenTransport struct { Transport http.RoundTripper Username string Password string }