Documentation
¶
Index ¶
- Variables
- func Log(format string, args ...any)
- func Quiet(_ string, _ ...any)
- func WrapTransport(transport http.RoundTripper, url, username, password string) http.RoundTripper
- type AuthorizationChallenge
- type BasicTransport
- type ErrorTransport
- type HTTPStatusError
- type LogfCallback
- type ManifestEntry
- type ManifestList
- type PlatformSpec
- type Registry
- func (registry *Registry) BlobMetadata(repository string, dig digest.Digest) (distribution.Descriptor, error)
- func (registry *Registry) DeleteManifest(repository string, dig digest.Digest) error
- func (registry *Registry) DownloadBlob(repository string, dig digest.Digest) (io.ReadCloser, error)
- func (registry *Registry) HasBlob(repository string, dig 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) ManifestList(repository, reference string) (bool, *ManifestList, error)
- func (registry *Registry) ManifestOCI(repository, reference string) (*schema2.DeserializedManifest, 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, dig digest.Digest, content io.Reader) error
- type TokenTransport
Constants ¶
This section is empty.
Variables ¶
var (
ErrNoMorePages = errors.New("no more pages")
)
Functions ¶
func WrapTransport ¶
func WrapTransport(transport http.RoundTripper, url, username, password string) http.RoundTripper
WrapTransport 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 }
BasicTransport is a custom HTTP transport that adds basic authentication to requests.
type ErrorTransport ¶
type ErrorTransport struct {
Transport http.RoundTripper
}
ErrorTransport is a custom HTTP transport that checks for non-successful HTTP responses.
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 }
HTTPStatusError is returned when a non-successful HTTP response is received.
func (*HTTPStatusError) Error ¶
func (err *HTTPStatusError) Error() string
Error implements the error interface for HTTPStatusError.
type LogfCallback ¶
LogfCallback is a callback function type for logging
type ManifestEntry ¶
type ManifestEntry struct { MediaType string `json:"mediaType"` Digest string `json:"digest"` Size int `json:"size"` Platform PlatformSpec `json:"platform"` }
ManifestEntry describes a single entry in a manifest list.
type ManifestList ¶
type ManifestList struct { MediaType string `json:"mediaType"` SchemaVersion int `json:"schemaVersion"` Manifests []ManifestEntry `json:"manifests"` }
ManifestList represents a list of manifests in a registry.
func (*ManifestList) Arch ¶
func (m *ManifestList) Arch() []string
Arch returns the list of architectures for the manifests in the manifest list.
func (*ManifestList) OS ¶
func (m *ManifestList) OS() []string
OS returns the list of OSes for the manifests in the manifest list.
type PlatformSpec ¶
PlatformSpec describes the platform of a manifest entry.
type Registry ¶
type Registry struct { URL string Client *http.Client Logf LogfCallback }
Registry is a structure that holds the URL of the registry and the HTTP client
func New ¶
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 ¶
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, dig digest.Digest) (distribution.Descriptor, error)
BlobMetadata retrieves the metadata of a blob from the registry.
func (*Registry) DeleteManifest ¶
DeleteManifest deletes a manifest from the registry.
func (*Registry) DownloadBlob ¶
DownloadBlob retrieves a blob from the registry.
func (*Registry) Manifest ¶
func (registry *Registry) Manifest(repository, reference string) (*schema1.SignedManifest, error)
Manifest retrieves the V1 manifest for a given repository and reference.
func (*Registry) ManifestDigest ¶
ManifestDigest retrieves the digest of a manifest for a given repository and reference.
func (*Registry) ManifestList ¶
func (registry *Registry) ManifestList(repository, reference string) (bool, *ManifestList, error)
ManifestList retrieves the manifest list for a given repository and reference.
func (*Registry) ManifestOCI ¶
func (registry *Registry) ManifestOCI(repository, reference string) (*schema2.DeserializedManifest, error)
ManifestOCI retrieves the OCI manifest for a given repository and reference.
func (*Registry) ManifestV2 ¶
func (registry *Registry) ManifestV2(repository, reference string) (*schema2.DeserializedManifest, error)
ManifestV2 retrieves the V2 manifest for a given repository and reference.
func (*Registry) PutManifest ¶
func (registry *Registry) PutManifest(repository, reference string, manifest distribution.Manifest) error
PutManifest uploads a manifest to the registry.
func (*Registry) Repositories ¶
Repositories returns a list of repositories in the registry.
type TokenTransport ¶
type TokenTransport struct { Transport http.RoundTripper Username string Password string }