Documentation ¶
Overview ¶
Package transport provides facilities for setting up an authenticated http.RoundTripper given an Authenticator and base RoundTripper. See transport.New for more information.
Index ¶
- Constants
- func CheckError(resp *http.Response, codes ...int) error
- func New(reg name.Registry, auth authn.Authenticator, t http.RoundTripper, ...) (http.RoundTripper, error)
- func NewLogger(inner http.RoundTripper) http.RoundTripper
- func NewRetry(inner http.RoundTripper, opts ...Option) http.RoundTripper
- type Diagnostic
- type Error
- type ErrorCode
- type Option
Constants ¶
const ( PullScope string = "pull" PushScope string = "push,pull" // For now DELETE is PUSH, which is the read/write ACL. DeleteScope string = PushScope CatalogScope string = "catalog" )
Scopes suitable to qualify each Repository
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶
CheckError returns a structured error if the response status is not in codes.
func New ¶
func New(reg name.Registry, auth authn.Authenticator, t http.RoundTripper, scopes []string) (http.RoundTripper, error)
New returns a new RoundTripper based on the provided RoundTripper that has been setup to authenticate with the remote registry "reg", in the capacity laid out by the specified scopes.
func NewLogger ¶
func NewLogger(inner http.RoundTripper) http.RoundTripper
NewLogger returns a transport that logs requests and responses to github.com/google/go-containerregistry/pkg/logs.Debug.
func NewRetry ¶
func NewRetry(inner http.RoundTripper, opts ...Option) http.RoundTripper
NewRetry returns a transport that retries errors.
Types ¶
type Diagnostic ¶
type Diagnostic struct { Code ErrorCode `json:"code"` Message string `json:"message,omitempty"` Detail interface{} `json:"detail,omitempty"` }
Diagnostic represents a single error returned by a Docker registry interaction.
func (Diagnostic) String ¶
func (d Diagnostic) String() string
String stringifies the Diagnostic in the form: $Code: $Message[; $Detail]
type Error ¶
type Error struct { Errors []Diagnostic `json:"errors,omitempty"` // The http status code returned. StatusCode int // contains filtered or unexported fields }
Error implements error to support the following error specification: https://github.com/docker/distribution/blob/master/docs/spec/api.md#errors
type ErrorCode ¶
type ErrorCode string
ErrorCode is an enumeration of supported error codes.
const ( BlobUnknownErrorCode ErrorCode = "BLOB_UNKNOWN" BlobUploadInvalidErrorCode ErrorCode = "BLOB_UPLOAD_INVALID" BlobUploadUnknownErrorCode ErrorCode = "BLOB_UPLOAD_UNKNOWN" DigestInvalidErrorCode ErrorCode = "DIGEST_INVALID" ManifestBlobUnknownErrorCode ErrorCode = "MANIFEST_BLOB_UNKNOWN" ManifestInvalidErrorCode ErrorCode = "MANIFEST_INVALID" ManifestUnknownErrorCode ErrorCode = "MANIFEST_UNKNOWN" ManifestUnverifiedErrorCode ErrorCode = "MANIFEST_UNVERIFIED" NameInvalidErrorCode ErrorCode = "NAME_INVALID" NameUnknownErrorCode ErrorCode = "NAME_UNKNOWN" SizeInvalidErrorCode ErrorCode = "SIZE_INVALID" TagInvalidErrorCode ErrorCode = "TAG_INVALID" DeniedErrorCode ErrorCode = "DENIED" UnsupportedErrorCode ErrorCode = "UNSUPPORTED" )
The set of error conditions a registry may return: https://github.com/docker/distribution/blob/master/docs/spec/api.md#errors-2
type Option ¶
type Option func(*options)
Option is a functional option for retryTransport.
func WithRetryBackoff ¶
WithRetryBackoff sets the backoff for retry operations.
func WithRetryPredicate ¶
WithRetryPredicate sets the predicate for retry operations.