Documentation
¶
Index ¶
- type OCIError
- func ErrBadRequest(msg string) *OCIError
- func ErrBlobUnknown(digest string) *OCIError
- func ErrBlobUploadInvalid(msg string) *OCIError
- func ErrBlobUploadOutOfOrder() *OCIError
- func ErrBlobUploadUnknown(session string) *OCIError
- func ErrDenied(msg string) *OCIError
- func ErrDigestInvalid(msg string) *OCIError
- func ErrManifestBlobUnknown(digest string) *OCIError
- func ErrManifestInvalid(details string) *OCIError
- func ErrManifestTooLarge() *OCIError
- func ErrManifestUnknown(digest string) *OCIError
- func ErrMediaTypeUnsupported(mediaType string) *OCIError
- func ErrMethodNotAllowed(msg string) *OCIError
- func ErrNameInvalid(name string) *OCIError
- func ErrNameUnknown(name string) *OCIError
- func ErrNotAcceptable(mediaType string) *OCIError
- func ErrNotImplemented() *OCIError
- func ErrRangeNotSatisfiable(msg string) *OCIError
- func ErrReferrersUnknown(digest string) *OCIError
- func ErrServerError() *OCIError
- func ErrTooManyRequests() *OCIError
- func ErrUnauthorized() *OCIError
- type Redirecter
- type Server
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OCIError ¶ added in v0.0.20
type OCIError struct {
Code string `json:"code"`
Message string `json:"message,omitempty"`
Detail string `json:"detail,omitempty"`
// contains filtered or unexported fields
}
OCIError is a struct that implements the error interface, and formats errors in a way that adheres to the OCI distribution spec
func ErrBadRequest ¶ added in v0.0.20
ErrBadRequest is not an OCI error... just added for a catch-all for now
func ErrBlobUnknown ¶ added in v0.0.20
ErrBlobUnknown is for when a blob is not found in the registry
func ErrBlobUploadInvalid ¶ added in v0.0.20
ErrBlobUploadInvalid is a generic error message if something is invalid on upload
func ErrBlobUploadOutOfOrder ¶ added in v0.0.20
func ErrBlobUploadOutOfOrder() *OCIError
ErrBlobUploadOutOfOrder is an error when blobs are uploaded out of order
func ErrBlobUploadUnknown ¶ added in v0.0.20
ErrBlobUploadUnknown is an error for when the upload session is not found
func ErrDigestInvalid ¶ added in v0.0.20
ErrDigestInvalid is sent if the digest is invalid
func ErrManifestBlobUnknown ¶ added in v0.0.20
ErrManifestBlobUnknown is an error for when the registry has not received a blob referenced by a manifest
func ErrManifestInvalid ¶ added in v0.0.20
ErrManifestInvalid is an error for when a manifest is invalid in some way
func ErrManifestTooLarge ¶ added in v0.0.20
func ErrManifestTooLarge() *OCIError
ErrManifestTooLarge is returned when the pushed manifest exceeds the registry size limit.
func ErrManifestUnknown ¶ added in v0.0.20
ErrManifestUnknown is an error for if a manifest is not found in the registry
func ErrMediaTypeUnsupported ¶ added in v0.0.20
ErrMediaTypeUnsupported is an error for when a pushed mediatype is unsupported
func ErrMethodNotAllowed ¶ added in v0.0.20
ErrMethodNotAllowed is returned when an operation is not permitted on the target resource.
func ErrNameInvalid ¶ added in v0.0.20
ErrNameInvalid is returned when the repository name is invalid.
func ErrNameUnknown ¶ added in v0.0.20
ErrNameUnknown is returned when the repository name is not known to the registry
func ErrNotAcceptable ¶ added in v0.0.20
ErrNotAcceptable is returned when a stored representation cannot satisfy the Accept header.
func ErrNotImplemented ¶ added in v0.0.20
func ErrNotImplemented() *OCIError
ErrNotImplemented is returned when an endpoint or operation has not been implemented.
func ErrRangeNotSatisfiable ¶ added in v0.0.20
ErrRangeNotSatisfiable is returned when a requested byte range cannot be satisfied.
func ErrReferrersUnknown ¶ added in v0.0.20
ErrReferrersUnknown is an error for if there are no referrers for a given digest
func ErrServerError ¶ added in v0.0.20
func ErrServerError() *OCIError
ErrServerError is returned when an unexpected internal error occurs.
func ErrTooManyRequests ¶ added in v0.0.20
func ErrTooManyRequests() *OCIError
ErrTooManyRequests is an error if too many requests have been sent
func ErrUnauthorized ¶ added in v0.0.20
func ErrUnauthorized() *OCIError
ErrUnauthorized is a generic error for if a request is unauthorized
type Redirecter ¶ added in v0.0.20
type Redirecter interface {
// Redirect returns whether the request should redirect, the redirect URL, and
// any error encountered while deciding.
Redirect(r *http.Request, desc oci.Descriptor, repo string) (bool, string, error)
}
Redirecter provides storage-backed URL generation for blob redirects.
type Server ¶ added in v0.0.20
type Server struct {
// contains filtered or unexported fields
}
Server contains everything necessary to run the API portion of the service
func New ¶
func New(pers oci.Interface, cfg0 *ServerConfig) (*Server, error)
New returns a new server backed by pers. A nil cfg is equivalent to a pointer to a zero ServerConfig. The configuration is copied before New returns and may be modified by the caller afterward.
func (*Server) Mux ¶ added in v0.0.20
Mux returns the server's root router. Callers may use it to add routes outside the built-in /v2 namespace, which is owned by a mounted child router. Root middleware must be configured through ServerConfig.Middlewares because the router does not allow middleware to be added after routes are registered.
func (*Server) ServeHTTP ¶ added in v0.0.20
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.
type ServerConfig ¶ added in v0.0.20
type ServerConfig struct {
// Logger receives diagnostics for unexpected internal failures. A nil
// Logger disables logging.
Logger *slog.Logger
// Middlewares are applied to all routes on the server's root mux, including
// routes added through [Server.Mux]. They are applied in the order provided;
// the first middleware is the outermost middleware.
Middlewares []func(http.Handler) http.Handler
// AuthMiddleware, when non-nil, is applied only to the built-in OCI routes.
AuthMiddleware func(http.Handler) http.Handler
}
ServerConfig configures a Server.